From 64d2591aad950bff5b402066612332d0bdafd42b Mon Sep 17 00:00:00 2001 From: Kenji Saito Date: Sat, 6 Dec 2025 18:44:01 +0900 Subject: [PATCH 1/3] Add the Strands example --- .github/dependabot.yml | 1 + agents/agent-sdk/package.json | 2 +- agents/agent-strands/.gitignore | 105 +++ agents/agent-strands/bin/cdk.d.ts | 2 + agents/agent-strands/bin/cdk.js | 12 + agents/agent-strands/bin/cdk.ts | 15 + agents/agent-strands/cdk.context.json | 6 + agents/agent-strands/cdk.json | 25 + .../agent-strands-lambda-example.assets.json | 34 + ...agent-strands-lambda-example.template.json | 196 +++++ .../index.mjs | 238 ++++++ .../index.mjs | 238 ++++++ .../index.mjs | 238 ++++++ agents/agent-strands/cdk.out/cdk.out | 1 + agents/agent-strands/cdk.out/manifest.json | 521 +++++++++++++ agents/agent-strands/cdk.out/tree.json | 1 + agents/agent-strands/eslint.config.d.ts | 3 + agents/agent-strands/eslint.config.js | 63 ++ agents/agent-strands/eslint.config.ts | 73 ++ agents/agent-strands/lambda/agent.d.ts | 5 + agents/agent-strands/lambda/agent.js | 12 + agents/agent-strands/lambda/agent.ts | 14 + agents/agent-strands/lambda/awslambda.d.ts | 24 + agents/agent-strands/lambda/index.d.ts | 7 + agents/agent-strands/lambda/index.js | 21 + agents/agent-strands/lambda/index.ts | 27 + agents/agent-strands/lib/cdk-stack.d.ts | 9 + agents/agent-strands/lib/cdk-stack.js | 64 ++ agents/agent-strands/lib/cdk-stack.ts | 77 ++ agents/agent-strands/package.json | 43 ++ agents/agent-strands/test/index.test.d.ts | 1 + agents/agent-strands/test/index.test.js | 20 + agents/agent-strands/test/index.test.ts | 23 + agents/agent-strands/tsconfig.json | 31 + agents/agent-voltagent/package.json | 2 +- basic/cdk/package.json | 6 +- common/backend/package.json | 2 +- mcp/clients/langgraph-mcp-client/package.json | 6 +- mcp/clients/mastra-mcp-client/tsconfig.json | 3 +- mcp/clients/mcp-client-http/package.json | 2 +- .../mcp-client-typescript/package.json | 2 +- pnpm-lock.yaml | 718 ++++++++++-------- pnpm-workspace.yaml | 1 + rag/batch/package.json | 4 +- rag/cdk/package.json | 8 +- 45 files changed, 2564 insertions(+), 342 deletions(-) create mode 100644 agents/agent-strands/.gitignore create mode 100644 agents/agent-strands/bin/cdk.d.ts create mode 100644 agents/agent-strands/bin/cdk.js create mode 100644 agents/agent-strands/bin/cdk.ts create mode 100644 agents/agent-strands/cdk.context.json create mode 100644 agents/agent-strands/cdk.json create mode 100644 agents/agent-strands/cdk.out/agent-strands-lambda-example.assets.json create mode 100644 agents/agent-strands/cdk.out/agent-strands-lambda-example.template.json create mode 100644 agents/agent-strands/cdk.out/asset.45d1724bd92ced9b013372e2515c63cb4bef12b5bc2c51651008462827d96d45/index.mjs create mode 100644 agents/agent-strands/cdk.out/asset.60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321/index.mjs create mode 100644 agents/agent-strands/cdk.out/asset.716071e6193d8d65285fec67182520a245dc4d4cf966b8c5765ff14412b10546/index.mjs create mode 100644 agents/agent-strands/cdk.out/cdk.out create mode 100644 agents/agent-strands/cdk.out/manifest.json create mode 100644 agents/agent-strands/cdk.out/tree.json create mode 100644 agents/agent-strands/eslint.config.d.ts create mode 100644 agents/agent-strands/eslint.config.js create mode 100644 agents/agent-strands/eslint.config.ts create mode 100644 agents/agent-strands/lambda/agent.d.ts create mode 100644 agents/agent-strands/lambda/agent.js create mode 100644 agents/agent-strands/lambda/agent.ts create mode 100644 agents/agent-strands/lambda/awslambda.d.ts create mode 100644 agents/agent-strands/lambda/index.d.ts create mode 100644 agents/agent-strands/lambda/index.js create mode 100644 agents/agent-strands/lambda/index.ts create mode 100644 agents/agent-strands/lib/cdk-stack.d.ts create mode 100644 agents/agent-strands/lib/cdk-stack.js create mode 100644 agents/agent-strands/lib/cdk-stack.ts create mode 100644 agents/agent-strands/package.json create mode 100644 agents/agent-strands/test/index.test.d.ts create mode 100644 agents/agent-strands/test/index.test.js create mode 100644 agents/agent-strands/test/index.test.ts create mode 100644 agents/agent-strands/tsconfig.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5b83d7af..00aecf6e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -25,6 +25,7 @@ updates: - '/agents/agent-mastra/' - '/agents/agent-voltagent/' - '/agents/agent-sdk/' + - '/agents/agent-strands/' - '/basic/cdk/' - '/basic/app/' - '/mcp/clients/langgraph-mcp-client/' diff --git a/agents/agent-sdk/package.json b/agents/agent-sdk/package.json index b7740380..cee6b0fe 100644 --- a/agents/agent-sdk/package.json +++ b/agents/agent-sdk/package.json @@ -34,7 +34,7 @@ "vitest": "^4.0.15" }, "dependencies": { - "@anthropic-ai/claude-agent-sdk": "^0.1.59", + "@anthropic-ai/claude-agent-sdk": "^0.1.60", "source-map-support": "^0.5.21", "uuid": "^13.0.0", "zod": "^4.1.13" diff --git a/agents/agent-strands/.gitignore b/agents/agent-strands/.gitignore new file mode 100644 index 00000000..53c6a9a4 --- /dev/null +++ b/agents/agent-strands/.gitignore @@ -0,0 +1,105 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +# dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and *not* Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port +.DS_Store diff --git a/agents/agent-strands/bin/cdk.d.ts b/agents/agent-strands/bin/cdk.d.ts new file mode 100644 index 00000000..b7988016 --- /dev/null +++ b/agents/agent-strands/bin/cdk.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/agents/agent-strands/bin/cdk.js b/agents/agent-strands/bin/cdk.js new file mode 100644 index 00000000..62b8a152 --- /dev/null +++ b/agents/agent-strands/bin/cdk.js @@ -0,0 +1,12 @@ +#!/usr/bin/env node +import * as cdk from 'aws-cdk-lib'; +import { CloudfrontCdnTemplateStack, } from '../lib/cdk-stack.js'; +const app = new cdk.App(); +new CloudfrontCdnTemplateStack(app, 'agent-strands-lambda-example', { + appName: 'agent-strands-lambda-example', + env: { + account: app.account, + region: app.region, + }, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2RrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY2RrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxPQUFPLEtBQUssR0FBRyxNQUFNLGFBQWEsQ0FBQztBQUNuQyxPQUFPLEVBQ0wsMEJBQTBCLEdBQzNCLE1BQU0scUJBQXFCLENBQUM7QUFFN0IsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsSUFBSSwwQkFBMEIsQ0FBQyxHQUFHLEVBQUUsOEJBQThCLEVBQUU7SUFDbEUsT0FBTyxFQUFFLDhCQUE4QjtJQUN2QyxHQUFHLEVBQUU7UUFDSCxPQUFPLEVBQUUsR0FBRyxDQUFDLE9BQU87UUFDcEIsTUFBTSxFQUFFLEdBQUcsQ0FBQyxNQUFNO0tBQ25CO0NBQ0YsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiIyEvdXNyL2Jpbi9lbnYgbm9kZVxuaW1wb3J0ICogYXMgY2RrIGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCB7XG4gIENsb3VkZnJvbnRDZG5UZW1wbGF0ZVN0YWNrLFxufSBmcm9tICcuLi9saWIvY2RrLXN0YWNrLmpzJztcblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcblxubmV3IENsb3VkZnJvbnRDZG5UZW1wbGF0ZVN0YWNrKGFwcCwgJ2FnZW50LXN0cmFuZHMtbGFtYmRhLWV4YW1wbGUnLCB7XG4gIGFwcE5hbWU6ICdhZ2VudC1zdHJhbmRzLWxhbWJkYS1leGFtcGxlJyxcbiAgZW52OiB7XG4gICAgYWNjb3VudDogYXBwLmFjY291bnQsXG4gICAgcmVnaW9uOiBhcHAucmVnaW9uLFxuICB9LFxufSk7XG4iXX0= \ No newline at end of file diff --git a/agents/agent-strands/bin/cdk.ts b/agents/agent-strands/bin/cdk.ts new file mode 100644 index 00000000..8e038a02 --- /dev/null +++ b/agents/agent-strands/bin/cdk.ts @@ -0,0 +1,15 @@ +#!/usr/bin/env node +import * as cdk from 'aws-cdk-lib'; +import { + CloudfrontCdnTemplateStack, +} from '../lib/cdk-stack.js'; + +const app = new cdk.App(); + +new CloudfrontCdnTemplateStack(app, 'agent-strands-lambda-example', { + appName: 'agent-strands-lambda-example', + env: { + account: app.account, + region: app.region, + }, +}); diff --git a/agents/agent-strands/cdk.context.json b/agents/agent-strands/cdk.context.json new file mode 100644 index 00000000..57652ec2 --- /dev/null +++ b/agents/agent-strands/cdk.context.json @@ -0,0 +1,6 @@ +{ + "acknowledged-issue-numbers": [ + 34892 + ], + "cli-telemetry": false +} diff --git a/agents/agent-strands/cdk.json b/agents/agent-strands/cdk.json new file mode 100644 index 00000000..80477505 --- /dev/null +++ b/agents/agent-strands/cdk.json @@ -0,0 +1,25 @@ +{ + "app": "pnpm dlx tsx bin/cdk.ts", + "watch": { + "include": [ + "**" + ], + "exclude": [ + "README.md", + "cdk*.json", + "**/*.d.ts", + "**/*.js", + "tsconfig.json", + "package*.json", + "yarn.lock", + "node_modules", + "test", + "eslint.config.mjs" + ] + }, + "requireApproval": "never", + "versionReporting": false, + "pathMetadata": false, + "context": { + } +} diff --git a/agents/agent-strands/cdk.out/agent-strands-lambda-example.assets.json b/agents/agent-strands/cdk.out/agent-strands-lambda-example.assets.json new file mode 100644 index 00000000..5303b5c8 --- /dev/null +++ b/agents/agent-strands/cdk.out/agent-strands-lambda-example.assets.json @@ -0,0 +1,34 @@ +{ + "version": "48.0.0", + "files": { + "60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321": { + "displayName": "Lambda/Code", + "source": { + "path": "asset.60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region-956ec07c": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "3f8dbdc3ac62bea8df0a326a27741714ed2c72c72c4f444c3c879792383f5078": { + "displayName": "agent-strands-lambda-example Template", + "source": { + "path": "agent-strands-lambda-example.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region-e082d771": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "3f8dbdc3ac62bea8df0a326a27741714ed2c72c72c4f444c3c879792383f5078.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/agents/agent-strands/cdk.out/agent-strands-lambda-example.template.json b/agents/agent-strands/cdk.out/agent-strands-lambda-example.template.json new file mode 100644 index 00000000..d7e9011d --- /dev/null +++ b/agents/agent-strands/cdk.out/agent-strands-lambda-example.template.json @@ -0,0 +1,196 @@ +{ + "Resources": { + "ApolloLambdaFunctionLogGroup34540FC6": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/agent-strands-lambda-example", + "RetentionInDays": 1 + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "ApolloLambdaFunctionExecutionRole85D9D1FB": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/AWSLambdaExecute" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/CloudFrontReadOnlyAccess" + ] + ] + } + ], + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "bedrock:InvokeModel*", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "bedrock-policy" + } + ] + } + }, + "LambdaD247545B": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Architectures": [ + "arm64" + ], + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321.zip" + }, + "FunctionName": "agent-strands-lambda-example", + "Handler": "index.handler", + "LoggingConfig": { + "ApplicationLogLevel": "TRACE", + "LogFormat": "JSON" + }, + "MemorySize": 256, + "Role": { + "Fn::GetAtt": [ + "ApolloLambdaFunctionExecutionRole85D9D1FB", + "Arn" + ] + }, + "Runtime": "nodejs24.x", + "Timeout": 60 + }, + "DependsOn": [ + "ApolloLambdaFunctionExecutionRole85D9D1FB" + ], + "Metadata": { + "aws:asset:path": "asset.60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321", + "aws:asset:is-bundled": true, + "aws:asset:property": "Code" + } + }, + "LambdaEventInvokeConfig9A47C8EE": { + "Type": "AWS::Lambda::EventInvokeConfig", + "Properties": { + "FunctionName": { + "Ref": "LambdaD247545B" + }, + "MaximumRetryAttempts": 0, + "Qualifier": "$LATEST" + } + }, + "LambdainvokefunctionurlECBD6AC0": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunctionUrl", + "FunctionName": { + "Fn::GetAtt": [ + "LambdaD247545B", + "Arn" + ] + }, + "FunctionUrlAuthType": "NONE", + "Principal": "*" + } + }, + "LambdainvokefunctionCF40E9E5": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "LambdaD247545B", + "Arn" + ] + }, + "InvokedViaFunctionUrl": true, + "Principal": "*" + } + }, + "LambdaFunctionUrl62966E86": { + "Type": "AWS::Lambda::Url", + "Properties": { + "AuthType": "NONE", + "InvokeMode": "RESPONSE_STREAM", + "TargetFunctionArn": { + "Fn::GetAtt": [ + "LambdaD247545B", + "Arn" + ] + } + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/agents/agent-strands/cdk.out/asset.45d1724bd92ced9b013372e2515c63cb4bef12b5bc2c51651008462827d96d45/index.mjs b/agents/agent-strands/cdk.out/asset.45d1724bd92ced9b013372e2515c63cb4bef12b5bc2c51651008462827d96d45/index.mjs new file mode 100644 index 00000000..89fd0651 --- /dev/null +++ b/agents/agent-strands/cdk.out/asset.45d1724bd92ced9b013372e2515c63cb4bef12b5bc2c51651008462827d96d45/index.mjs @@ -0,0 +1,238 @@ +import { createRequire } from 'module';const require = createRequire(import.meta.url); +var FU=Object.create;var zb=Object.defineProperty;var BU=Object.getOwnPropertyDescriptor;var ZU=Object.getOwnPropertyNames;var qU=Object.getPrototypeOf,VU=Object.prototype.hasOwnProperty;var P=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),gi=(t,e)=>{for(var r in e)zb(t,r,{get:e[r],enumerable:!0})},GU=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ZU(e))!VU.call(t,o)&&o!==r&&zb(t,o,{get:()=>e[o],enumerable:!(n=BU(e,o))||n.enumerable});return t};var mn=(t,e,r)=>(r=t!=null?FU(qU(t)):{},GU(e||!t||!t.__esModule?zb(r,"default",{value:t,enumerable:!0}):r,t));var Xb=P((Kl,lc)=>{var JU=200,GT="__lodash_hash_undefined__",XU=800,YU=16,KT=9007199254740991,HT="[object Arguments]",QU="[object Array]",e4="[object AsyncFunction]",t4="[object Boolean]",r4="[object Date]",n4="[object Error]",WT="[object Function]",o4="[object GeneratorFunction]",i4="[object Map]",s4="[object Number]",a4="[object Null]",JT="[object Object]",c4="[object Proxy]",u4="[object RegExp]",l4="[object Set]",d4="[object String]",p4="[object Undefined]",f4="[object WeakMap]",m4="[object ArrayBuffer]",h4="[object DataView]",g4="[object Float32Array]",_4="[object Float64Array]",y4="[object Int8Array]",v4="[object Int16Array]",b4="[object Int32Array]",w4="[object Uint8Array]",x4="[object Uint8ClampedArray]",$4="[object Uint16Array]",I4="[object Uint32Array]",S4=/[\\^$.*+?()[\]{}|]/g,k4=/^\[object .+?Constructor\]$/,T4=/^(?:0|[1-9]\d*)$/,st={};st[g4]=st[_4]=st[y4]=st[v4]=st[b4]=st[w4]=st[x4]=st[$4]=st[I4]=!0;st[HT]=st[QU]=st[m4]=st[t4]=st[h4]=st[r4]=st[n4]=st[WT]=st[i4]=st[s4]=st[JT]=st[u4]=st[l4]=st[d4]=st[f4]=!1;var XT=typeof global=="object"&&global&&global.Object===Object&&global,E4=typeof self=="object"&&self&&self.Object===Object&&self,Jl=XT||E4||Function("return this")(),YT=typeof Kl=="object"&&Kl&&!Kl.nodeType&&Kl,Hl=YT&&typeof lc=="object"&&lc&&!lc.nodeType&&lc,QT=Hl&&Hl.exports===YT,Fb=QT&&XT.process,jT=(function(){try{var t=Hl&&Hl.require&&Hl.require("util").types;return t||Fb&&Fb.binding&&Fb.binding("util")}catch{}})(),DT=jT&&jT.isTypedArray;function A4(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function O4(t,e){for(var r=-1,n=Array(t);++r-1}function Y4(t,e){var r=this.__data__,n=pm(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}jo.prototype.clear=H4;jo.prototype.delete=W4;jo.prototype.get=J4;jo.prototype.has=X4;jo.prototype.set=Y4;function dc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(i=t.length>3&&typeof i=="function"?(o--,i):void 0,s&&T2(r[0],r[1],s)&&(i=o<3?void 0:i,o=1),e=Object(e);++n-1&&t%1==0&&t0){if(++e>=XU)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function z2(t){if(t!=null){try{return dm.call(t)}catch{}try{return t+""}catch{}}return""}function hm(t,e){return t===e||t!==t&&e!==e}var Vb=VT((function(){return arguments})())?VT:function(t){return Xl(t)&&Mo.call(t,"callee")&&!D4.call(t,"callee")},Gb=Array.isArray;function Wb(t){return t!=null&&aE(t.length)&&!Jb(t)}function M2(t){return Xl(t)&&Wb(t)}var sE=U4||F2;function Jb(t){if(!Ps(t))return!1;var e=fm(t);return e==WT||e==o4||e==e4||e==c4}function aE(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=KT}function Ps(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Xl(t){return t!=null&&typeof t=="object"}function j2(t){if(!Xl(t)||fm(t)!=JT)return!1;var e=tE(t);if(e===null)return!0;var r=Mo.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&dm.call(r)==M4}var cE=DT?P4(DT):f2;function D2(t){return x2(t,uE(t))}function uE(t){return Wb(t)?u2(t,!0):m2(t)}var L2=$2(function(t,e,r){nE(t,e,r)});function U2(t){return function(){return t}}function lE(t){return t}function F2(){return!1}lc.exports=L2});var xA=P((_de,wA)=>{"use strict";wA.exports=function(t,e){if(typeof t!="string")throw new TypeError("Expected a string");return e=typeof e>"u"?"_":e,t.replace(/([a-z\d])([A-Z])/g,"$1"+e+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+e+"$2").toLowerCase()}});var AA=P((yde,Zw)=>{"use strict";var dB=/[\p{Lu}]/u,pB=/[\p{Ll}]/u,$A=/^[\p{Lu}](?![\p{Lu}])/gu,kA=/([\p{Alpha}\p{N}_]|$)/u,TA=/[_.\- ]+/,fB=new RegExp("^"+TA.source),IA=new RegExp(TA.source+kA.source,"gu"),SA=new RegExp("\\d+"+kA.source,"gu"),mB=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let s=0;s($A.lastIndex=0,t.replace($A,r=>e(r))),gB=(t,e)=>(IA.lastIndex=0,SA.lastIndex=0,t.replace(IA,(r,n)=>e(n)).replace(SA,r=>e(r))),EA=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(t)?t=t.map(i=>i.trim()).filter(i=>i.length).join("-"):t=t.trim(),t.length===0)return"";let r=e.locale===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(e.locale),n=e.locale===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(e.locale);return t.length===1?e.pascalCase?n(t):r(t):(t!==r(t)&&(t=mB(t,r,n)),t=t.replace(fB,""),e.preserveConsecutiveUppercase?t=hB(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),gB(t,n))};Zw.exports=EA;Zw.exports.default=EA});var cP=P((ime,Ix)=>{"use strict";var v6=Object.prototype.hasOwnProperty,hr="~";function Cd(){}Object.create&&(Cd.prototype=Object.create(null),new Cd().__proto__||(hr=!1));function b6(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function aP(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new b6(r,n||t,o),s=hr?hr+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],i]:t._events[s].push(i):(t._events[s]=i,t._eventsCount++),t}function wh(t,e){--t._eventsCount===0?t._events=new Cd:delete t._events[e]}function tr(){this._events=new Cd,this._eventsCount=0}tr.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)v6.call(r,n)&&e.push(hr?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};tr.prototype.listeners=function(e){var r=hr?hr+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,s=new Array(i);o{"use strict";uP.exports=(t,e)=>(e=e||(()=>{}),t.then(r=>new Promise(n=>{n(e())}).then(()=>r),r=>new Promise(n=>{n(e())}).then(()=>{throw r})))});var pP=P((ame,$h)=>{"use strict";var w6=lP(),xh=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},dP=(t,e,r)=>new Promise((n,o)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){n(t);return}let i=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(c){o(c)}return}let s=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,a=r instanceof Error?r:new xh(s);typeof t.cancel=="function"&&t.cancel(),o(a)},e);w6(t.then(n,o),()=>{clearTimeout(i)})});$h.exports=dP;$h.exports.default=dP;$h.exports.TimeoutError=xh});var fP=P(Sx=>{"use strict";Object.defineProperty(Sx,"__esModule",{value:!0});function x6(t,e,r){let n=0,o=t.length;for(;o>0;){let i=o/2|0,s=n+i;r(t[s],e)<=0?(n=++s,o-=i+1):o=i}return n}Sx.default=x6});var mP=P(Tx=>{"use strict";Object.defineProperty(Tx,"__esModule",{value:!0});var $6=fP(),kx=class{constructor(){this._queue=[]}enqueue(e,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let o=$6.default(this._queue,n,(i,s)=>s.priority-i.priority);this._queue.splice(o,0,n)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this._queue.length}};Tx.default=kx});var Sh=P(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:!0});var I6=cP(),hP=pP(),S6=mP(),Ih=()=>{},k6=new hP.TimeoutError,Ex=class extends I6{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Ih,this._resolveIdle=Ih,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:S6.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(i=(o=e.interval)===null||o===void 0?void 0:o.toString())!==null&&i!==void 0?i:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||e.interval===0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=e.throwOnTimeout===!0,this._isPaused=e.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),e&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,r={}){return new Promise((n,o)=>{let i=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&r.timeout===void 0?e():hP.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(k6)});n(await s)}catch(s){o(s)}this._next()};this._queue.enqueue(i,r),this._tryToStartAnother(),this.emit("add")})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(e=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}};Ax.default=Ex});var Nd=P((mme,gP)=>{"use strict";var E6="2.0.0",A6=Number.MAX_SAFE_INTEGER||9007199254740991,O6=16,P6=250,C6=["major","premajor","minor","preminor","patch","prepatch","prerelease"];gP.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:O6,MAX_SAFE_BUILD_LENGTH:P6,MAX_SAFE_INTEGER:A6,RELEASE_TYPES:C6,SEMVER_SPEC_VERSION:E6,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var zd=P((hme,_P)=>{"use strict";var R6=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};_P.exports=R6});var lu=P((fo,yP)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Cx,MAX_SAFE_BUILD_LENGTH:N6,MAX_LENGTH:z6}=Nd(),M6=zd();fo=yP.exports={};var j6=fo.re=[],D6=fo.safeRe=[],X=fo.src=[],L6=fo.safeSrc=[],Y=fo.t={},U6=0,Rx="[a-zA-Z0-9-]",F6=[["\\s",1],["\\d",z6],[Rx,N6]],B6=t=>{for(let[e,r]of F6)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Ie=(t,e,r)=>{let n=B6(e),o=U6++;M6(t,o,e),Y[t]=o,X[o]=e,L6[o]=n,j6[o]=new RegExp(e,r?"g":void 0),D6[o]=new RegExp(n,r?"g":void 0)};Ie("NUMERICIDENTIFIER","0|[1-9]\\d*");Ie("NUMERICIDENTIFIERLOOSE","\\d+");Ie("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Rx}*`);Ie("MAINVERSION",`(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})`);Ie("MAINVERSIONLOOSE",`(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})`);Ie("PRERELEASEIDENTIFIER",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIER]})`);Ie("PRERELEASEIDENTIFIERLOOSE",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIERLOOSE]})`);Ie("PRERELEASE",`(?:-(${X[Y.PRERELEASEIDENTIFIER]}(?:\\.${X[Y.PRERELEASEIDENTIFIER]})*))`);Ie("PRERELEASELOOSE",`(?:-?(${X[Y.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${X[Y.PRERELEASEIDENTIFIERLOOSE]})*))`);Ie("BUILDIDENTIFIER",`${Rx}+`);Ie("BUILD",`(?:\\+(${X[Y.BUILDIDENTIFIER]}(?:\\.${X[Y.BUILDIDENTIFIER]})*))`);Ie("FULLPLAIN",`v?${X[Y.MAINVERSION]}${X[Y.PRERELEASE]}?${X[Y.BUILD]}?`);Ie("FULL",`^${X[Y.FULLPLAIN]}$`);Ie("LOOSEPLAIN",`[v=\\s]*${X[Y.MAINVERSIONLOOSE]}${X[Y.PRERELEASELOOSE]}?${X[Y.BUILD]}?`);Ie("LOOSE",`^${X[Y.LOOSEPLAIN]}$`);Ie("GTLT","((?:<|>)?=?)");Ie("XRANGEIDENTIFIERLOOSE",`${X[Y.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Ie("XRANGEIDENTIFIER",`${X[Y.NUMERICIDENTIFIER]}|x|X|\\*`);Ie("XRANGEPLAIN",`[v=\\s]*(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:${X[Y.PRERELEASE]})?${X[Y.BUILD]}?)?)?`);Ie("XRANGEPLAINLOOSE",`[v=\\s]*(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:${X[Y.PRERELEASELOOSE]})?${X[Y.BUILD]}?)?)?`);Ie("XRANGE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAIN]}$`);Ie("XRANGELOOSE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAINLOOSE]}$`);Ie("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Cx}})(?:\\.(\\d{1,${Cx}}))?(?:\\.(\\d{1,${Cx}}))?`);Ie("COERCE",`${X[Y.COERCEPLAIN]}(?:$|[^\\d])`);Ie("COERCEFULL",X[Y.COERCEPLAIN]+`(?:${X[Y.PRERELEASE]})?(?:${X[Y.BUILD]})?(?:$|[^\\d])`);Ie("COERCERTL",X[Y.COERCE],!0);Ie("COERCERTLFULL",X[Y.COERCEFULL],!0);Ie("LONETILDE","(?:~>?)");Ie("TILDETRIM",`(\\s*)${X[Y.LONETILDE]}\\s+`,!0);fo.tildeTrimReplace="$1~";Ie("TILDE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAIN]}$`);Ie("TILDELOOSE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAINLOOSE]}$`);Ie("LONECARET","(?:\\^)");Ie("CARETTRIM",`(\\s*)${X[Y.LONECARET]}\\s+`,!0);fo.caretTrimReplace="$1^";Ie("CARET",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAIN]}$`);Ie("CARETLOOSE",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAINLOOSE]}$`);Ie("COMPARATORLOOSE",`^${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]})$|^$`);Ie("COMPARATOR",`^${X[Y.GTLT]}\\s*(${X[Y.FULLPLAIN]})$|^$`);Ie("COMPARATORTRIM",`(\\s*)${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]}|${X[Y.XRANGEPLAIN]})`,!0);fo.comparatorTrimReplace="$1$2$3";Ie("HYPHENRANGE",`^\\s*(${X[Y.XRANGEPLAIN]})\\s+-\\s+(${X[Y.XRANGEPLAIN]})\\s*$`);Ie("HYPHENRANGELOOSE",`^\\s*(${X[Y.XRANGEPLAINLOOSE]})\\s+-\\s+(${X[Y.XRANGEPLAINLOOSE]})\\s*$`);Ie("STAR","(<|>)?=?\\s*\\*");Ie("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Ie("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Th=P((gme,vP)=>{"use strict";var Z6=Object.freeze({loose:!0}),q6=Object.freeze({}),V6=t=>t?typeof t!="object"?Z6:t:q6;vP.exports=V6});var Nx=P((_me,xP)=>{"use strict";var bP=/^[0-9]+$/,wP=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:twP(e,t);xP.exports={compareIdentifiers:wP,rcompareIdentifiers:G6}});var rr=P((yme,IP)=>{"use strict";var Eh=zd(),{MAX_LENGTH:$P,MAX_SAFE_INTEGER:Ah}=Nd(),{safeRe:Oh,t:Ph}=lu(),K6=Th(),{compareIdentifiers:zx}=Nx(),Mx=class t{constructor(e,r){if(r=K6(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>$P)throw new TypeError(`version is longer than ${$P} characters`);Eh("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Oh[Ph.LOOSE]:Oh[Ph.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Ah||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ah||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ah||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let i=+o;if(i>=0&&ie.major?1:this.minore.minor?1:this.patche.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(Eh("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return zx(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(Eh("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return zx(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?Oh[Ph.PRERELEASELOOSE]:Oh[Ph.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let i=[r,o];n===!1&&(i=[r]),zx(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};IP.exports=Mx});var pa=P((vme,kP)=>{"use strict";var SP=rr(),H6=(t,e,r=!1)=>{if(t instanceof SP)return t;try{return new SP(t,e)}catch(n){if(!r)return null;throw n}};kP.exports=H6});var EP=P((bme,TP)=>{"use strict";var W6=pa(),J6=(t,e)=>{let r=W6(t,e);return r?r.version:null};TP.exports=J6});var OP=P((wme,AP)=>{"use strict";var X6=pa(),Y6=(t,e)=>{let r=X6(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};AP.exports=Y6});var RP=P((xme,CP)=>{"use strict";var PP=rr(),Q6=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new PP(t instanceof PP?t.version:t,r).inc(e,n,o).version}catch{return null}};CP.exports=Q6});var MP=P(($me,zP)=>{"use strict";var NP=pa(),eZ=(t,e)=>{let r=NP(t,null,!0),n=NP(e,null,!0),o=r.compare(n);if(o===0)return null;let i=o>0,s=i?r:n,a=i?n:r,c=!!s.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0)return a.minor&&!a.patch?"minor":"patch"}let l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};zP.exports=eZ});var DP=P((Ime,jP)=>{"use strict";var tZ=rr(),rZ=(t,e)=>new tZ(t,e).major;jP.exports=rZ});var UP=P((Sme,LP)=>{"use strict";var nZ=rr(),oZ=(t,e)=>new nZ(t,e).minor;LP.exports=oZ});var BP=P((kme,FP)=>{"use strict";var iZ=rr(),sZ=(t,e)=>new iZ(t,e).patch;FP.exports=sZ});var qP=P((Tme,ZP)=>{"use strict";var aZ=pa(),cZ=(t,e)=>{let r=aZ(t,e);return r&&r.prerelease.length?r.prerelease:null};ZP.exports=cZ});var gn=P((Eme,GP)=>{"use strict";var VP=rr(),uZ=(t,e,r)=>new VP(t,r).compare(new VP(e,r));GP.exports=uZ});var HP=P((Ame,KP)=>{"use strict";var lZ=gn(),dZ=(t,e,r)=>lZ(e,t,r);KP.exports=dZ});var JP=P((Ome,WP)=>{"use strict";var pZ=gn(),fZ=(t,e)=>pZ(t,e,!0);WP.exports=fZ});var Ch=P((Pme,YP)=>{"use strict";var XP=rr(),mZ=(t,e,r)=>{let n=new XP(t,r),o=new XP(e,r);return n.compare(o)||n.compareBuild(o)};YP.exports=mZ});var eC=P((Cme,QP)=>{"use strict";var hZ=Ch(),gZ=(t,e)=>t.sort((r,n)=>hZ(r,n,e));QP.exports=gZ});var rC=P((Rme,tC)=>{"use strict";var _Z=Ch(),yZ=(t,e)=>t.sort((r,n)=>_Z(n,r,e));tC.exports=yZ});var Md=P((Nme,nC)=>{"use strict";var vZ=gn(),bZ=(t,e,r)=>vZ(t,e,r)>0;nC.exports=bZ});var Rh=P((zme,oC)=>{"use strict";var wZ=gn(),xZ=(t,e,r)=>wZ(t,e,r)<0;oC.exports=xZ});var jx=P((Mme,iC)=>{"use strict";var $Z=gn(),IZ=(t,e,r)=>$Z(t,e,r)===0;iC.exports=IZ});var Dx=P((jme,sC)=>{"use strict";var SZ=gn(),kZ=(t,e,r)=>SZ(t,e,r)!==0;sC.exports=kZ});var Nh=P((Dme,aC)=>{"use strict";var TZ=gn(),EZ=(t,e,r)=>TZ(t,e,r)>=0;aC.exports=EZ});var zh=P((Lme,cC)=>{"use strict";var AZ=gn(),OZ=(t,e,r)=>AZ(t,e,r)<=0;cC.exports=OZ});var Lx=P((Ume,uC)=>{"use strict";var PZ=jx(),CZ=Dx(),RZ=Md(),NZ=Nh(),zZ=Rh(),MZ=zh(),jZ=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return PZ(t,r,n);case"!=":return CZ(t,r,n);case">":return RZ(t,r,n);case">=":return NZ(t,r,n);case"<":return zZ(t,r,n);case"<=":return MZ(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};uC.exports=jZ});var dC=P((Fme,lC)=>{"use strict";var DZ=rr(),LZ=pa(),{safeRe:Mh,t:jh}=lu(),UZ=(t,e)=>{if(t instanceof DZ)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Mh[jh.COERCEFULL]:Mh[jh.COERCE]);else{let c=e.includePrerelease?Mh[jh.COERCERTLFULL]:Mh[jh.COERCERTL],u;for(;(u=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",i=r[4]||"0",s=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return LZ(`${n}.${o}.${i}${s}${a}`,e)};lC.exports=UZ});var fC=P((Bme,pC)=>{"use strict";var Ux=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};pC.exports=Ux});var _n=P((Zme,_C)=>{"use strict";var FZ=/\s+/g,Fx=class t{constructor(e,r){if(r=ZZ(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Bx)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(FZ," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(o=>!hC(o[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&JZ(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&HZ)|(this.options.loose&&WZ))+":"+e,o=mC.get(n);if(o)return o;let i=this.options.loose,s=i?gr[nr.HYPHENRANGELOOSE]:gr[nr.HYPHENRANGE];e=e.replace(s,s9(this.options.includePrerelease)),at("hyphen replace",e),e=e.replace(gr[nr.COMPARATORTRIM],VZ),at("comparator trim",e),e=e.replace(gr[nr.TILDETRIM],GZ),at("tilde trim",e),e=e.replace(gr[nr.CARETTRIM],KZ),at("caret trim",e);let a=e.split(" ").map(d=>XZ(d,this.options)).join(" ").split(/\s+/).map(d=>i9(d,this.options));i&&(a=a.filter(d=>(at("loose invalid filter",d,this.options),!!d.match(gr[nr.COMPARATORLOOSE])))),at("range list",a);let c=new Map,u=a.map(d=>new Bx(d,this.options));for(let d of u){if(hC(d))return[d];c.set(d.value,d)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return mC.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>gC(n,r)&&e.set.some(o=>gC(o,r)&&n.every(i=>o.every(s=>i.intersects(s,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new qZ(e,this.options)}catch{return!1}for(let r=0;rt.value==="<0.0.0-0",JZ=t=>t.value==="",gC=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(i=>o.intersects(i,e)),o=n.pop();return r},XZ=(t,e)=>(t=t.replace(gr[nr.BUILD],""),at("comp",t,e),t=e9(t,e),at("caret",t),t=YZ(t,e),at("tildes",t),t=r9(t,e),at("xrange",t),t=o9(t,e),at("stars",t),t),_r=t=>!t||t.toLowerCase()==="x"||t==="*",YZ=(t,e)=>t.trim().split(/\s+/).map(r=>QZ(r,e)).join(" "),QZ=(t,e)=>{let r=e.loose?gr[nr.TILDELOOSE]:gr[nr.TILDE];return t.replace(r,(n,o,i,s,a)=>{at("tilde",t,n,o,i,s,a);let c;return _r(o)?c="":_r(i)?c=`>=${o}.0.0 <${+o+1}.0.0-0`:_r(s)?c=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:a?(at("replaceTilde pr",a),c=`>=${o}.${i}.${s}-${a} <${o}.${+i+1}.0-0`):c=`>=${o}.${i}.${s} <${o}.${+i+1}.0-0`,at("tilde return",c),c})},e9=(t,e)=>t.trim().split(/\s+/).map(r=>t9(r,e)).join(" "),t9=(t,e)=>{at("caret",t,e);let r=e.loose?gr[nr.CARETLOOSE]:gr[nr.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,s,a,c)=>{at("caret",t,o,i,s,a,c);let u;return _r(i)?u="":_r(s)?u=`>=${i}.0.0${n} <${+i+1}.0.0-0`:_r(a)?i==="0"?u=`>=${i}.${s}.0${n} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.0${n} <${+i+1}.0.0-0`:c?(at("replaceCaret pr",c),i==="0"?s==="0"?u=`>=${i}.${s}.${a}-${c} <${i}.${s}.${+a+1}-0`:u=`>=${i}.${s}.${a}-${c} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.${a}-${c} <${+i+1}.0.0-0`):(at("no pr"),i==="0"?s==="0"?u=`>=${i}.${s}.${a}${n} <${i}.${s}.${+a+1}-0`:u=`>=${i}.${s}.${a}${n} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.${a} <${+i+1}.0.0-0`),at("caret return",u),u})},r9=(t,e)=>(at("replaceXRanges",t,e),t.split(/\s+/).map(r=>n9(r,e)).join(" ")),n9=(t,e)=>{t=t.trim();let r=e.loose?gr[nr.XRANGELOOSE]:gr[nr.XRANGE];return t.replace(r,(n,o,i,s,a,c)=>{at("xRange",t,n,o,i,s,a,c);let u=_r(i),l=u||_r(s),d=l||_r(a),f=d;return o==="="&&f&&(o=""),c=e.includePrerelease?"-0":"",u?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&f?(l&&(s=0),a=0,o===">"?(o=">=",l?(i=+i+1,s=0,a=0):(s=+s+1,a=0)):o==="<="&&(o="<",l?i=+i+1:s=+s+1),o==="<"&&(c="-0"),n=`${o+i}.${s}.${a}${c}`):l?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${s}.0${c} <${i}.${+s+1}.0-0`),at("xRange return",n),n})},o9=(t,e)=>(at("replaceStars",t,e),t.trim().replace(gr[nr.STAR],"")),i9=(t,e)=>(at("replaceGTE0",t,e),t.trim().replace(gr[e.includePrerelease?nr.GTE0PRE:nr.GTE0],"")),s9=t=>(e,r,n,o,i,s,a,c,u,l,d,f)=>(_r(n)?r="":_r(o)?r=`>=${n}.0.0${t?"-0":""}`:_r(i)?r=`>=${n}.${o}.0${t?"-0":""}`:s?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,_r(u)?c="":_r(l)?c=`<${+u+1}.0.0-0`:_r(d)?c=`<${u}.${+l+1}.0-0`:f?c=`<=${u}.${l}.${d}-${f}`:t?c=`<${u}.${l}.${+d+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),a9=(t,e,r)=>{for(let n=0;n0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var jd=P((qme,$C)=>{"use strict";var Dd=Symbol("SemVer ANY"),Vx=class t{static get ANY(){return Dd}constructor(e,r){if(r=yC(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),qx("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Dd?this.value="":this.value=this.operator+this.semver.version,qx("comp",this)}parse(e){let r=this.options.loose?vC[bC.COMPARATORLOOSE]:vC[bC.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new wC(n[2],this.options.loose):this.semver=Dd}toString(){return this.value}test(e){if(qx("Comparator.test",e,this.options.loose),this.semver===Dd||e===Dd)return!0;if(typeof e=="string")try{e=new wC(e,this.options)}catch{return!1}return Zx(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new xC(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new xC(this.value,r).test(e.semver):(r=yC(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Zx(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Zx(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};$C.exports=Vx;var yC=Th(),{safeRe:vC,t:bC}=lu(),Zx=Lx(),qx=zd(),wC=rr(),xC=_n()});var Ld=P((Vme,IC)=>{"use strict";var c9=_n(),u9=(t,e,r)=>{try{e=new c9(e,r)}catch{return!1}return e.test(t)};IC.exports=u9});var kC=P((Gme,SC)=>{"use strict";var l9=_n(),d9=(t,e)=>new l9(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));SC.exports=d9});var EC=P((Kme,TC)=>{"use strict";var p9=rr(),f9=_n(),m9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new f9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===-1)&&(n=s,o=new p9(n,r))}),n};TC.exports=m9});var OC=P((Hme,AC)=>{"use strict";var h9=rr(),g9=_n(),_9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new g9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===1)&&(n=s,o=new h9(n,r))}),n};AC.exports=_9});var RC=P((Wme,CC)=>{"use strict";var Gx=rr(),y9=_n(),PC=Md(),v9=(t,e)=>{t=new y9(t,e);let r=new Gx("0.0.0");if(t.test(r)||(r=new Gx("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n{let a=new Gx(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||PC(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),i&&(!r||PC(r,i))&&(r=i)}return r&&t.test(r)?r:null};CC.exports=v9});var zC=P((Jme,NC)=>{"use strict";var b9=_n(),w9=(t,e)=>{try{return new b9(t,e).range||"*"}catch{return null}};NC.exports=w9});var Dh=P((Xme,LC)=>{"use strict";var x9=rr(),DC=jd(),{ANY:$9}=DC,I9=_n(),S9=Ld(),MC=Md(),jC=Rh(),k9=zh(),T9=Nh(),E9=(t,e,r,n)=>{t=new x9(t,n),e=new I9(e,n);let o,i,s,a,c;switch(r){case">":o=MC,i=k9,s=jC,a=">",c=">=";break;case"<":o=jC,i=T9,s=MC,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(S9(t,e,n))return!1;for(let u=0;u{p.semver===$9&&(p=new DC(">=0.0.0")),d=d||p,f=f||p,o(p.semver,d.semver,n)?d=p:s(p.semver,f.semver,n)&&(f=p)}),d.operator===a||d.operator===c||(!f.operator||f.operator===a)&&i(t,f.semver))return!1;if(f.operator===c&&s(t,f.semver))return!1}return!0};LC.exports=E9});var FC=P((Yme,UC)=>{"use strict";var A9=Dh(),O9=(t,e,r)=>A9(t,e,">",r);UC.exports=O9});var ZC=P((Qme,BC)=>{"use strict";var P9=Dh(),C9=(t,e,r)=>P9(t,e,"<",r);BC.exports=C9});var GC=P((ehe,VC)=>{"use strict";var qC=_n(),R9=(t,e,r)=>(t=new qC(t,r),e=new qC(e,r),t.intersects(e,r));VC.exports=R9});var HC=P((the,KC)=>{"use strict";var N9=Ld(),z9=gn();KC.exports=(t,e,r)=>{let n=[],o=null,i=null,s=t.sort((l,d)=>z9(l,d,r));for(let l of s)N9(l,e,r)?(i=l,o||(o=l)):(i&&n.push([o,i]),i=null,o=null);o&&n.push([o,null]);let a=[];for(let[l,d]of n)l===d?a.push(l):!d&&l===s[0]?a.push("*"):d?l===s[0]?a.push(`<=${d}`):a.push(`${l} - ${d}`):a.push(`>=${l}`);let c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length{"use strict";var WC=_n(),Hx=jd(),{ANY:Kx}=Hx,Ud=Ld(),Wx=gn(),M9=(t,e,r={})=>{if(t===e)return!0;t=new WC(t,r),e=new WC(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let s=D9(o,i,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},j9=[new Hx(">=0.0.0-0")],JC=[new Hx(">=0.0.0")],D9=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Kx){if(e.length===1&&e[0].semver===Kx)return!0;r.includePrerelease?t=j9:t=JC}if(e.length===1&&e[0].semver===Kx){if(r.includePrerelease)return!0;e=JC}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=XC(o,p,r):p.operator==="<"||p.operator==="<="?i=YC(i,p,r):n.add(p.semver);if(n.size>1)return null;let s;if(o&&i){if(s=Wx(o.semver,i.semver,r),s>0)return null;if(s===0&&(o.operator!==">="||i.operator!=="<="))return null}for(let p of n){if(o&&!Ud(p,String(o),r)||i&&!Ud(p,String(i),r))return null;for(let m of e)if(!Ud(p,String(m),r))return!1;return!0}let a,c,u,l,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of e){if(l=l||p.operator===">"||p.operator===">=",u=u||p.operator==="<"||p.operator==="<=",o){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator===">"||p.operator===">="){if(a=XC(o,p,r),a===p&&a!==o)return!1}else if(o.operator===">="&&!Ud(o.semver,String(p),r))return!1}if(i){if(d&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===d.major&&p.semver.minor===d.minor&&p.semver.patch===d.patch&&(d=!1),p.operator==="<"||p.operator==="<="){if(c=YC(i,p,r),c===p&&c!==i)return!1}else if(i.operator==="<="&&!Ud(i.semver,String(p),r))return!1}if(!p.operator&&(i||o)&&s!==0)return!1}return!(o&&u&&!i&&s!==0||i&&l&&!o&&s!==0||f||d)},XC=(t,e,r)=>{if(!t)return e;let n=Wx(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},YC=(t,e,r)=>{if(!t)return e;let n=Wx(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};QC.exports=M9});var oR=P((nhe,nR)=>{"use strict";var Jx=lu(),tR=Nd(),L9=rr(),rR=Nx(),U9=pa(),F9=EP(),B9=OP(),Z9=RP(),q9=MP(),V9=DP(),G9=UP(),K9=BP(),H9=qP(),W9=gn(),J9=HP(),X9=JP(),Y9=Ch(),Q9=eC(),eq=rC(),tq=Md(),rq=Rh(),nq=jx(),oq=Dx(),iq=Nh(),sq=zh(),aq=Lx(),cq=dC(),uq=jd(),lq=_n(),dq=Ld(),pq=kC(),fq=EC(),mq=OC(),hq=RC(),gq=zC(),_q=Dh(),yq=FC(),vq=ZC(),bq=GC(),wq=HC(),xq=eR();nR.exports={parse:U9,valid:F9,clean:B9,inc:Z9,diff:q9,major:V9,minor:G9,patch:K9,prerelease:H9,compare:W9,rcompare:J9,compareLoose:X9,compareBuild:Y9,sort:Q9,rsort:eq,gt:tq,lt:rq,eq:nq,neq:oq,gte:iq,lte:sq,cmp:aq,coerce:cq,Comparator:uq,Range:lq,satisfies:dq,toComparators:pq,maxSatisfying:fq,minSatisfying:mq,minVersion:hq,validRange:gq,outside:_q,gtr:yq,ltr:vq,intersects:bq,simplifyRange:wq,subset:xq,SemVer:L9,re:Jx.re,src:Jx.src,tokens:Jx.t,SEMVER_SPEC_VERSION:tR.SEMVER_SPEC_VERSION,RELEASE_TYPES:tR.RELEASE_TYPES,compareIdentifiers:rR.compareIdentifiers,rcompareIdentifiers:rR.rcompareIdentifiers}});var IR=P((Ghe,$R)=>{"use strict";var wR=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,xR=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function qq(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",e.color.ansi256=wR(),e.color.ansi16m=xR(),e.bgColor.ansi256=wR(10),e.bgColor.ansi16m=xR(10),Object.defineProperties(e,{rgbToAnsi256:{value:(r,n,o)=>r===n&&n===o?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:o}=n.groups;o.length===3&&(o=o.split("").map(s=>s+s).join(""));let i=Number.parseInt(o,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:r=>e.rgbToAnsi256(...e.hexToRgb(r)),enumerable:!1}}),e}Object.defineProperty($R,"exports",{enumerable:!0,get:qq})});var KM=P(dv=>{"use strict";dv.byteLength=AW;dv.toByteArray=PW;dv.fromByteArray=NW;var So=[],Sn=[],EW=typeof Uint8Array<"u"?Uint8Array:Array,BI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Va=0,VM=BI.length;Va0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function AW(t){var e=GM(t),r=e[0],n=e[1];return(r+n)*3/4-n}function OW(t,e,r){return(e+r)*3/4-r}function PW(t){var e,r=GM(t),n=r[0],o=r[1],i=new EW(OW(t,n,o)),s=0,a=o>0?n-4:n,c;for(c=0;c>16&255,i[s++]=e>>8&255,i[s++]=e&255;return o===2&&(e=Sn[t.charCodeAt(c)]<<2|Sn[t.charCodeAt(c+1)]>>4,i[s++]=e&255),o===1&&(e=Sn[t.charCodeAt(c)]<<10|Sn[t.charCodeAt(c+1)]<<4|Sn[t.charCodeAt(c+2)]>>2,i[s++]=e>>8&255,i[s++]=e&255),i}function CW(t){return So[t>>18&63]+So[t>>12&63]+So[t>>6&63]+So[t&63]}function RW(t,e,r){for(var n,o=[],i=e;ia?a:s+i));return n===1?(e=t[r-1],o.push(So[e>>2]+So[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(So[e>>10]+So[e>>4&63]+So[e<<2&63]+"=")),o.join("")}});var Cf=P(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.regexpCode=Fe.getEsmExportName=Fe.getProperty=Fe.safeStringify=Fe.stringify=Fe.strConcat=Fe.addCodeArg=Fe.str=Fe._=Fe.nil=Fe._Code=Fe.Name=Fe.IDENTIFIER=Fe._CodeOrName=void 0;var Of=class{};Fe._CodeOrName=Of;Fe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Qa=class extends Of{constructor(e){if(super(),!Fe.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Fe.Name=Qa;var Tn=class extends Of{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Qa&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Fe._Code=Tn;Fe.nil=new Tn("");function Xj(t,...e){let r=[t[0]],n=0;for(;n{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.ValueScope=Br.ValueScopeName=Br.Scope=Br.varKinds=Br.UsedValueState=void 0;var Fr=Cf(),DS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Hv;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Hv||(Br.UsedValueState=Hv={}));Br.varKinds={const:new Fr.Name("const"),let:new Fr.Name("let"),var:new Fr.Name("var")};var Wv=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Fr.Name?e:this.name(e)}name(e){return new Fr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Br.Scope=Wv;var Jv=class extends Fr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Fr._)`.${new Fr.Name(r)}[${n}]`}};Br.ValueScopeName=Jv;var z7=(0,Fr._)`\n`,LS=class extends Wv{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?z7:Fr.nil}}get(){return this._scope}name(e){return new Jv(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:i}=o,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[i];if(a){let l=a.get(s);if(l)return l}else a=this._values[i]=new Map;a.set(s,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Fr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let i=Fr.nil;for(let s in e){let a=e[s];if(!a)continue;let c=n[s]=n[s]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Hv.Started);let l=r(u);if(l){let d=this.opts.es5?Br.varKinds.var:Br.varKinds.const;i=(0,Fr._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Fr._)`${i}${l}${this.opts._n}`;else throw new DS(u);c.set(u,Hv.Completed)})}return i}};Br.ValueScope=LS});var Oe=P(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.or=Ce.and=Ce.not=Ce.CodeGen=Ce.operators=Ce.varKinds=Ce.ValueScopeName=Ce.ValueScope=Ce.Scope=Ce.Name=Ce.regexpCode=Ce.stringify=Ce.getProperty=Ce.nil=Ce.strConcat=Ce.str=Ce._=void 0;var Le=Cf(),Xn=US(),_s=Cf();Object.defineProperty(Ce,"_",{enumerable:!0,get:function(){return _s._}});Object.defineProperty(Ce,"str",{enumerable:!0,get:function(){return _s.str}});Object.defineProperty(Ce,"strConcat",{enumerable:!0,get:function(){return _s.strConcat}});Object.defineProperty(Ce,"nil",{enumerable:!0,get:function(){return _s.nil}});Object.defineProperty(Ce,"getProperty",{enumerable:!0,get:function(){return _s.getProperty}});Object.defineProperty(Ce,"stringify",{enumerable:!0,get:function(){return _s.stringify}});Object.defineProperty(Ce,"regexpCode",{enumerable:!0,get:function(){return _s.regexpCode}});Object.defineProperty(Ce,"Name",{enumerable:!0,get:function(){return _s.Name}});var eb=US();Object.defineProperty(Ce,"Scope",{enumerable:!0,get:function(){return eb.Scope}});Object.defineProperty(Ce,"ValueScope",{enumerable:!0,get:function(){return eb.ValueScope}});Object.defineProperty(Ce,"ValueScopeName",{enumerable:!0,get:function(){return eb.ValueScopeName}});Object.defineProperty(Ce,"varKinds",{enumerable:!0,get:function(){return eb.varKinds}});Ce.operators={GT:new Le._Code(">"),GTE:new Le._Code(">="),LT:new Le._Code("<"),LTE:new Le._Code("<="),EQ:new Le._Code("==="),NEQ:new Le._Code("!=="),NOT:new Le._Code("!"),OR:new Le._Code("||"),AND:new Le._Code("&&"),ADD:new Le._Code("+")};var di=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},FS=class extends di{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Xn.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Sl(this.rhs,e,r)),this}get names(){return this.rhs instanceof Le._CodeOrName?this.rhs.names:{}}},Xv=class extends di{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Le.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Sl(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Le.Name?{}:{...this.lhs.names};return Qv(e,this.rhs)}},BS=class extends Xv{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},ZS=class extends di{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qS=class extends di{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},VS=class extends di{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},GS=class extends di{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Sl(this.code,e,r),this}get names(){return this.code instanceof Le._CodeOrName?this.code.names:{}}},Rf=class extends di{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(e,r)||(M7(e,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rc(e,r.names),{})}},pi=class extends Rf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},KS=class extends Rf{},Il=class extends pi{};Il.kind="else";var ec=class t extends pi{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Il(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Qj(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Sl(this.condition,e,r),this}get names(){let e=super.names;return Qv(e,this.condition),this.else&&rc(e,this.else.names),e}};ec.kind="if";var tc=class extends pi{};tc.kind="for";var HS=class extends tc{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Sl(this.iteration,e,r),this}get names(){return rc(super.names,this.iteration.names)}},WS=class extends tc{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?Xn.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=Qv(super.names,this.from);return Qv(e,this.to)}},Yv=class extends tc{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Sl(this.iterable,e,r),this}get names(){return rc(super.names,this.iterable.names)}},Nf=class extends pi{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Nf.kind="func";var zf=class extends Rf{render(e){return"return "+super.render(e)}};zf.kind="return";var JS=class extends pi{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rc(e,this.catch.names),this.finally&&rc(e,this.finally.names),e}},Mf=class extends pi{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Mf.kind="catch";var jf=class extends pi{render(e){return"finally"+super.render(e)}};jf.kind="finally";var XS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?` +`:""},this._extScope=e,this._scope=new Xn.Scope({parent:e}),this._nodes=[new KS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new FS(e,i,n)),i}const(e,r,n){return this._def(Xn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Xn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Xn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Xv(e,r,n))}add(e,r){return this._leafNode(new BS(e,Ce.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Le.nil&&this._leafNode(new GS(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Le.addCodeArg)(r,o));return r.push("}"),new Le._Code(r)}if(e,r,n){if(this._blockNode(new ec(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ec(e))}else(){return this._elseNode(new Il)}endIf(){return this._endBlockNode(ec,Il)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new HS(e),r)}forRange(e,r,n,o,i=this.opts.es5?Xn.varKinds.var:Xn.varKinds.let){let s=this._scope.toName(e);return this._for(new WS(i,s,r,n),()=>o(s))}forOf(e,r,n,o=Xn.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let s=r instanceof Le.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Le._)`${s}.length`,a=>{this.var(i,(0,Le._)`${s}[${a}]`),n(i)})}return this._for(new Yv("of",o,i,r),()=>n(i))}forIn(e,r,n,o=this.opts.es5?Xn.varKinds.var:Xn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Le._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new Yv("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(tc)}label(e){return this._leafNode(new ZS(e))}break(e){return this._leafNode(new qS(e))}return(e){let r=new zf;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(zf)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new JS;if(this._blockNode(o),this.code(e),r){let i=this.name("e");this._currNode=o.catch=new Mf(i),r(i)}return n&&(this._currNode=o.finally=new jf,this.code(n)),this._endBlockNode(Mf,jf)}throw(e){return this._leafNode(new VS(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Le.nil,n,o){return this._blockNode(new Nf(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Nf)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof ec))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ce.CodeGen=XS;function rc(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Qv(t,e){return e instanceof Le._CodeOrName?rc(t,e.names):t}function Sl(t,e,r){if(t instanceof Le.Name)return n(t);if(!o(t))return t;return new Le._Code(t._items.reduce((i,s)=>(s instanceof Le.Name&&(s=n(s)),s instanceof Le._Code?i.push(...s._items):i.push(s),i),[]));function n(i){let s=r[i.str];return s===void 0||e[i.str]!==1?i:(delete e[i.str],s)}function o(i){return i instanceof Le._Code&&i._items.some(s=>s instanceof Le.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function M7(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Qj(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Le._)`!${YS(t)}`}Ce.not=Qj;var j7=eD(Ce.operators.AND);function D7(...t){return t.reduce(j7)}Ce.and=D7;var L7=eD(Ce.operators.OR);function U7(...t){return t.reduce(L7)}Ce.or=U7;function eD(t){return(e,r)=>e===Le.nil?r:r===Le.nil?e:(0,Le._)`${YS(e)} ${t} ${YS(r)}`}function YS(t){return t instanceof Le.Name?t:(0,Le._)`(${t})`}});var Be=P(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.checkStrictMode=Ne.getErrorPath=Ne.Type=Ne.useFunc=Ne.setEvaluated=Ne.evaluatedPropsToName=Ne.mergeEvaluated=Ne.eachItem=Ne.unescapeJsonPointer=Ne.escapeJsonPointer=Ne.escapeFragment=Ne.unescapeFragment=Ne.schemaRefOrVal=Ne.schemaHasRulesButRef=Ne.schemaHasRules=Ne.checkUnknownRules=Ne.alwaysValidSchema=Ne.toHash=void 0;var rt=Oe(),F7=Cf();function B7(t){let e={};for(let r of t)e[r]=!0;return e}Ne.toHash=B7;function Z7(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(nD(t,e),!oD(e,t.self.RULES.all))}Ne.alwaysValidSchema=Z7;function nD(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let i in e)o[i]||aD(t,`unknown keyword: "${i}"`)}Ne.checkUnknownRules=nD;function oD(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Ne.schemaHasRules=oD;function q7(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Ne.schemaHasRulesButRef=q7;function V7({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,rt._)`${r}`}return(0,rt._)`${t}${e}${(0,rt.getProperty)(n)}`}Ne.schemaRefOrVal=V7;function G7(t){return iD(decodeURIComponent(t))}Ne.unescapeFragment=G7;function K7(t){return encodeURIComponent(ek(t))}Ne.escapeFragment=K7;function ek(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Ne.escapeJsonPointer=ek;function iD(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Ne.unescapeJsonPointer=iD;function H7(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Ne.eachItem=H7;function tD({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,i,s,a)=>{let c=s===void 0?i:s instanceof rt.Name?(i instanceof rt.Name?t(o,i,s):e(o,i,s),s):i instanceof rt.Name?(e(o,s,i),i):r(i,s);return a===rt.Name&&!(c instanceof rt.Name)?n(o,c):c}}Ne.mergeEvaluated={props:tD({mergeNames:(t,e,r)=>t.if((0,rt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,rt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,rt._)`${r} || {}`).code((0,rt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,rt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,rt._)`${r} || {}`),tk(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:sD}),items:tD({mergeNames:(t,e,r)=>t.if((0,rt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,rt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,rt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,rt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function sD(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,rt._)`{}`);return e!==void 0&&tk(t,r,e),r}Ne.evaluatedPropsToName=sD;function tk(t,e,r){Object.keys(r).forEach(n=>t.assign((0,rt._)`${e}${(0,rt.getProperty)(n)}`,!0))}Ne.setEvaluated=tk;var rD={};function W7(t,e){return t.scopeValue("func",{ref:e,code:rD[e.code]||(rD[e.code]=new F7._Code(e.code))})}Ne.useFunc=W7;var QS;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(QS||(Ne.Type=QS={}));function J7(t,e,r){if(t instanceof rt.Name){let n=e===QS.Num;return r?n?(0,rt._)`"[" + ${t} + "]"`:(0,rt._)`"['" + ${t} + "']"`:n?(0,rt._)`"/" + ${t}`:(0,rt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,rt.getProperty)(t).toString():"/"+ek(t)}Ne.getErrorPath=J7;function aD(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Ne.checkStrictMode=aD});var fi=P(rk=>{"use strict";Object.defineProperty(rk,"__esModule",{value:!0});var ur=Oe(),X7={data:new ur.Name("data"),valCxt:new ur.Name("valCxt"),instancePath:new ur.Name("instancePath"),parentData:new ur.Name("parentData"),parentDataProperty:new ur.Name("parentDataProperty"),rootData:new ur.Name("rootData"),dynamicAnchors:new ur.Name("dynamicAnchors"),vErrors:new ur.Name("vErrors"),errors:new ur.Name("errors"),this:new ur.Name("this"),self:new ur.Name("self"),scope:new ur.Name("scope"),json:new ur.Name("json"),jsonPos:new ur.Name("jsonPos"),jsonLen:new ur.Name("jsonLen"),jsonPart:new ur.Name("jsonPart")};rk.default=X7});var Df=P(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.extendErrors=lr.resetErrorsCount=lr.reportExtraError=lr.reportError=lr.keyword$DataError=lr.keywordError=void 0;var Ue=Oe(),tb=Be(),kr=fi();lr.keywordError={message:({keyword:t})=>(0,Ue.str)`must pass "${t}" keyword validation`};lr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ue.str)`"${t}" keyword must be ${e} ($data)`:(0,Ue.str)`"${t}" keyword is invalid ($data)`};function Y7(t,e=lr.keywordError,r,n){let{it:o}=t,{gen:i,compositeRule:s,allErrors:a}=o,c=lD(t,e,r);n??(s||a)?cD(i,c):uD(o,(0,Ue._)`[${c}]`)}lr.reportError=Y7;function Q7(t,e=lr.keywordError,r){let{it:n}=t,{gen:o,compositeRule:i,allErrors:s}=n,a=lD(t,e,r);cD(o,a),i||s||uD(n,kr.default.vErrors)}lr.reportExtraError=Q7;function eX(t,e){t.assign(kr.default.errors,e),t.if((0,Ue._)`${kr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ue._)`${kr.default.vErrors}.length`,e),()=>t.assign(kr.default.vErrors,null)))}lr.resetErrorsCount=eX;function tX({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",o,kr.default.errors,a=>{t.const(s,(0,Ue._)`${kr.default.vErrors}[${a}]`),t.if((0,Ue._)`${s}.instancePath === undefined`,()=>t.assign((0,Ue._)`${s}.instancePath`,(0,Ue.strConcat)(kr.default.instancePath,i.errorPath))),t.assign((0,Ue._)`${s}.schemaPath`,(0,Ue.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,Ue._)`${s}.schema`,r),t.assign((0,Ue._)`${s}.data`,n))})}lr.extendErrors=tX;function cD(t,e){let r=t.const("err",e);t.if((0,Ue._)`${kr.default.vErrors} === null`,()=>t.assign(kr.default.vErrors,(0,Ue._)`[${r}]`),(0,Ue._)`${kr.default.vErrors}.push(${r})`),t.code((0,Ue._)`${kr.default.errors}++`)}function uD(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,Ue._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ue._)`${n}.errors`,e),r.return(!1))}var nc={keyword:new Ue.Name("keyword"),schemaPath:new Ue.Name("schemaPath"),params:new Ue.Name("params"),propertyName:new Ue.Name("propertyName"),message:new Ue.Name("message"),schema:new Ue.Name("schema"),parentSchema:new Ue.Name("parentSchema")};function lD(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Ue._)`{}`:rX(t,e,r)}function rX(t,e,r={}){let{gen:n,it:o}=t,i=[nX(o,r),oX(t,r)];return iX(t,e,i),n.object(...i)}function nX({errorPath:t},{instancePath:e}){let r=e?(0,Ue.str)`${t}${(0,tb.getErrorPath)(e,tb.Type.Str)}`:t;return[kr.default.instancePath,(0,Ue.strConcat)(kr.default.instancePath,r)]}function oX({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,Ue.str)`${e}/${t}`;return r&&(o=(0,Ue.str)`${o}${(0,tb.getErrorPath)(r,tb.Type.Str)}`),[nc.schemaPath,o]}function iX(t,{params:e,message:r},n){let{keyword:o,data:i,schemaValue:s,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([nc.keyword,o],[nc.params,typeof e=="function"?e(t):e||(0,Ue._)`{}`]),c.messages&&n.push([nc.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([nc.schema,s],[nc.parentSchema,(0,Ue._)`${l}${d}`],[kr.default.data,i]),u&&n.push([nc.propertyName,u])}});var pD=P(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.boolOrEmptySchema=kl.topBoolOrEmptySchema=void 0;var sX=Df(),aX=Oe(),cX=fi(),uX={message:"boolean schema is false"};function lX(t){let{gen:e,schema:r,validateName:n}=t;r===!1?dD(t,!1):typeof r=="object"&&r.$async===!0?e.return(cX.default.data):(e.assign((0,aX._)`${n}.errors`,null),e.return(!0))}kl.topBoolOrEmptySchema=lX;function dX(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),dD(t)):r.var(e,!0)}kl.boolOrEmptySchema=dX;function dD(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,sX.reportError)(o,uX,void 0,e)}});var nk=P(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.getRules=Tl.isJSONType=void 0;var pX=["string","number","integer","boolean","null","object","array"],fX=new Set(pX);function mX(t){return typeof t=="string"&&fX.has(t)}Tl.isJSONType=mX;function hX(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Tl.getRules=hX});var ok=P(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.shouldUseRule=ys.shouldUseGroup=ys.schemaHasRulesForType=void 0;function gX({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&fD(t,n)}ys.schemaHasRulesForType=gX;function fD(t,e){return e.rules.some(r=>mD(t,r))}ys.shouldUseGroup=fD;function mD(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ys.shouldUseRule=mD});var Lf=P(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.reportTypeError=dr.checkDataTypes=dr.checkDataType=dr.coerceAndCheckDataType=dr.getJSONTypes=dr.getSchemaTypes=dr.DataType=void 0;var _X=nk(),yX=ok(),vX=Df(),Te=Oe(),hD=Be(),El;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(El||(dr.DataType=El={}));function bX(t){let e=gD(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}dr.getSchemaTypes=bX;function gD(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(_X.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}dr.getJSONTypes=gD;function wX(t,e){let{gen:r,data:n,opts:o}=t,i=xX(e,o.coerceTypes),s=e.length>0&&!(i.length===0&&e.length===1&&(0,yX.schemaHasRulesForType)(t,e[0]));if(s){let a=sk(e,n,o.strictNumbers,El.Wrong);r.if(a,()=>{i.length?$X(t,e,i):ak(t)})}return s}dr.coerceAndCheckDataType=wX;var _D=new Set(["string","number","integer","boolean","null"]);function xX(t,e){return e?t.filter(r=>_D.has(r)||e==="array"&&r==="array"):[]}function $X(t,e,r){let{gen:n,data:o,opts:i}=t,s=n.let("dataType",(0,Te._)`typeof ${o}`),a=n.let("coerced",(0,Te._)`undefined`);i.coerceTypes==="array"&&n.if((0,Te._)`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,Te._)`${o}[0]`).assign(s,(0,Te._)`typeof ${o}`).if(sk(e,o,i.strictNumbers),()=>n.assign(a,o))),n.if((0,Te._)`${a} !== undefined`);for(let u of r)(_D.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),ak(t),n.endIf(),n.if((0,Te._)`${a} !== undefined`,()=>{n.assign(o,a),IX(t,a)});function c(u){switch(u){case"string":n.elseIf((0,Te._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,Te._)`"" + ${o}`).elseIf((0,Te._)`${o} === null`).assign(a,(0,Te._)`""`);return;case"number":n.elseIf((0,Te._)`${s} == "boolean" || ${o} === null + || (${s} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,Te._)`+${o}`);return;case"integer":n.elseIf((0,Te._)`${s} === "boolean" || ${o} === null + || (${s} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,Te._)`+${o}`);return;case"boolean":n.elseIf((0,Te._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,Te._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,Te._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,Te._)`${s} === "string" || ${s} === "number" + || ${s} === "boolean" || ${o} === null`).assign(a,(0,Te._)`[${o}]`)}}}function IX({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Te._)`${e} !== undefined`,()=>t.assign((0,Te._)`${e}[${r}]`,n))}function ik(t,e,r,n=El.Correct){let o=n===El.Correct?Te.operators.EQ:Te.operators.NEQ,i;switch(t){case"null":return(0,Te._)`${e} ${o} null`;case"array":i=(0,Te._)`Array.isArray(${e})`;break;case"object":i=(0,Te._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=s((0,Te._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=s();break;default:return(0,Te._)`typeof ${e} ${o} ${t}`}return n===El.Correct?i:(0,Te.not)(i);function s(a=Te.nil){return(0,Te.and)((0,Te._)`typeof ${e} == "number"`,a,r?(0,Te._)`isFinite(${e})`:Te.nil)}}dr.checkDataType=ik;function sk(t,e,r,n){if(t.length===1)return ik(t[0],e,r,n);let o,i=(0,hD.toHash)(t);if(i.array&&i.object){let s=(0,Te._)`typeof ${e} != "object"`;o=i.null?s:(0,Te._)`!${e} || ${s}`,delete i.null,delete i.array,delete i.object}else o=Te.nil;i.number&&delete i.integer;for(let s in i)o=(0,Te.and)(o,ik(s,e,r,n));return o}dr.checkDataTypes=sk;var SX={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Te._)`{type: ${t}}`:(0,Te._)`{type: ${e}}`};function ak(t){let e=kX(t);(0,vX.reportError)(e,SX)}dr.reportTypeError=ak;function kX(t){let{gen:e,data:r,schema:n}=t,o=(0,hD.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var vD=P(rb=>{"use strict";Object.defineProperty(rb,"__esModule",{value:!0});rb.assignDefaults=void 0;var Al=Oe(),TX=Be();function EX(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)yD(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,i)=>yD(t,i,o.default))}rb.assignDefaults=EX;function yD(t,e,r){let{gen:n,compositeRule:o,data:i,opts:s}=t;if(r===void 0)return;let a=(0,Al._)`${i}${(0,Al.getProperty)(e)}`;if(o){(0,TX.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Al._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,Al._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Al._)`${a} = ${(0,Al.stringify)(r)}`)}});var En=P(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.validateUnion=Xe.validateArray=Xe.usePattern=Xe.callValidateCode=Xe.schemaProperties=Xe.allSchemaProperties=Xe.noPropertyInData=Xe.propertyInData=Xe.isOwnProperty=Xe.hasPropFunc=Xe.reportMissingProp=Xe.checkMissingProp=Xe.checkReportMissingProp=void 0;var ut=Oe(),ck=Be(),vs=fi(),AX=Be();function OX(t,e){let{gen:r,data:n,it:o}=t;r.if(lk(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,ut._)`${e}`},!0),t.error()})}Xe.checkReportMissingProp=OX;function PX({gen:t,data:e,it:{opts:r}},n,o){return(0,ut.or)(...n.map(i=>(0,ut.and)(lk(t,e,i,r.ownProperties),(0,ut._)`${o} = ${i}`)))}Xe.checkMissingProp=PX;function CX(t,e){t.setParams({missingProperty:e},!0),t.error()}Xe.reportMissingProp=CX;function bD(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ut._)`Object.prototype.hasOwnProperty`})}Xe.hasPropFunc=bD;function uk(t,e,r){return(0,ut._)`${bD(t)}.call(${e}, ${r})`}Xe.isOwnProperty=uk;function RX(t,e,r,n){let o=(0,ut._)`${e}${(0,ut.getProperty)(r)} !== undefined`;return n?(0,ut._)`${o} && ${uk(t,e,r)}`:o}Xe.propertyInData=RX;function lk(t,e,r,n){let o=(0,ut._)`${e}${(0,ut.getProperty)(r)} === undefined`;return n?(0,ut.or)(o,(0,ut.not)(uk(t,e,r))):o}Xe.noPropertyInData=lk;function wD(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Xe.allSchemaProperties=wD;function NX(t,e){return wD(e).filter(r=>!(0,ck.alwaysValidSchema)(t,e[r]))}Xe.schemaProperties=NX;function zX({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:s},a,c,u){let l=u?(0,ut._)`${t}, ${e}, ${n}${o}`:e,d=[[vs.default.instancePath,(0,ut.strConcat)(vs.default.instancePath,i)],[vs.default.parentData,s.parentData],[vs.default.parentDataProperty,s.parentDataProperty],[vs.default.rootData,vs.default.rootData]];s.opts.dynamicRef&&d.push([vs.default.dynamicAnchors,vs.default.dynamicAnchors]);let f=(0,ut._)`${l}, ${r.object(...d)}`;return c!==ut.nil?(0,ut._)`${a}.call(${c}, ${f})`:(0,ut._)`${a}(${f})`}Xe.callValidateCode=zX;var MX=(0,ut._)`new RegExp`;function jX({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,i=o(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ut._)`${o.code==="new RegExp"?MX:(0,AX.useFunc)(t,o)}(${r}, ${n})`})}Xe.usePattern=jX;function DX(t){let{gen:e,data:r,keyword:n,it:o}=t,i=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(i,!0),s(()=>e.break()),i;function s(a){let c=e.const("len",(0,ut._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:ck.Type.Num},i),e.if((0,ut.not)(i),a)})}}Xe.validateArray=DX;function LX(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,ck.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(s,(0,ut._)`${s} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,ut.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}Xe.validateUnion=LX});var ID=P(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.validateKeywordUsage=Eo.validSchemaType=Eo.funcKeywordCode=Eo.macroKeywordCode=void 0;var Tr=Oe(),oc=fi(),UX=En(),FX=Df();function BX(t,e){let{gen:r,keyword:n,schema:o,parentSchema:i,it:s}=t,a=e.macro.call(s.self,o,i,s),c=$D(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:Tr.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Eo.macroKeywordCode=BX;function ZX(t,e){var r;let{gen:n,keyword:o,schema:i,parentSchema:s,$data:a,it:c}=t;VX(c,e);let u=!a&&e.compile?e.compile.call(c.self,i,s,c):e.validate,l=$D(n,o,u),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&xD(t),_(()=>t.error());else{let v=e.async?p():m();e.modifying&&xD(t),_(()=>qX(t,v))}}function p(){let v=n.let("ruleErrs",null);return n.try(()=>h((0,Tr._)`await `),b=>n.assign(d,!1).if((0,Tr._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,Tr._)`${b}.errors`),()=>n.throw(b))),v}function m(){let v=(0,Tr._)`${l}.errors`;return n.assign(v,null),h(Tr.nil),v}function h(v=e.async?(0,Tr._)`await `:Tr.nil){let b=c.opts.passContext?oc.default.this:oc.default.self,x=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Tr._)`${v}${(0,UX.callValidateCode)(t,l,b,x)}`,e.modifying)}function _(v){var b;n.if((0,Tr.not)((b=e.valid)!==null&&b!==void 0?b:d),v)}}Eo.funcKeywordCode=ZX;function xD(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Tr._)`${n.parentData}[${n.parentDataProperty}]`))}function qX(t,e){let{gen:r}=t;r.if((0,Tr._)`Array.isArray(${e})`,()=>{r.assign(oc.default.vErrors,(0,Tr._)`${oc.default.vErrors} === null ? ${e} : ${oc.default.vErrors}.concat(${e})`).assign(oc.default.errors,(0,Tr._)`${oc.default.vErrors}.length`),(0,FX.extendErrors)(t)},()=>t.error())}function VX({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function $D(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Tr.stringify)(r)})}function GX(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Eo.validSchemaType=GX;function KX({schema:t,opts:e,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let s=o.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Eo.validateKeywordUsage=KX});var kD=P(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.extendSubschemaMode=bs.extendSubschemaData=bs.getSubschema=void 0;var Ao=Oe(),SD=Be();function HX(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ao._)`${t.schemaPath}${(0,Ao.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ao._)`${t.schemaPath}${(0,Ao.getProperty)(e)}${(0,Ao.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,SD.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:s,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}bs.getSubschema=HX;function WX(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:s}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,f=a.let("data",(0,Ao._)`${e.data}${(0,Ao.getProperty)(r)}`,!0);c(f),t.errorPath=(0,Ao.str)`${u}${(0,SD.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ao._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Ao.Name?o:a.let("data",o,!0);c(u),s!==void 0&&(t.propertyName=s)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}bs.extendSubschemaData=WX;function JX(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}bs.extendSubschemaMode=JX});var dk=P((Z2e,TD)=>{"use strict";TD.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var s=i[o];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var AD=P((q2e,ED)=>{"use strict";var ws=ED.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};nb(e,n,o,t,"",t)};ws.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ws.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ws.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ws.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function nb(t,e,r,n,o,i,s,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,i,s,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ws.arrayKeywords)for(var f=0;f{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.getSchemaRefs=Zr.resolveUrl=Zr.normalizeId=Zr._getFullPath=Zr.getFullPath=Zr.inlineRef=void 0;var YX=Be(),QX=dk(),eY=AD(),tY=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function rY(t,e=!0){return typeof t=="boolean"?!0:e===!0?!pk(t):e?OD(t)<=e:!1}Zr.inlineRef=rY;var nY=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function pk(t){for(let e in t){if(nY.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(pk)||typeof r=="object"&&pk(r))return!0}return!1}function OD(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!tY.has(r)&&(typeof t[r]=="object"&&(0,YX.eachItem)(t[r],n=>e+=OD(n)),e===1/0))return 1/0}return e}function PD(t,e="",r){r!==!1&&(e=Ol(e));let n=t.parse(e);return CD(t,n)}Zr.getFullPath=PD;function CD(t,e){return t.serialize(e).split("#")[0]+"#"}Zr._getFullPath=CD;var oY=/#\/?$/;function Ol(t){return t?t.replace(oY,""):""}Zr.normalizeId=Ol;function iY(t,e,r){return r=Ol(r),t.resolve(e,r)}Zr.resolveUrl=iY;var sY=/^[a-z_][-a-z0-9._]*$/i;function aY(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Ol(t[r]||e),i={"":o},s=PD(n,o,!1),a={},c=new Set;return eY(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=s+f,_=i[m];typeof d[r]=="string"&&(_=v.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),i[f]=_;function v(x){let k=this.opts.uriResolver.resolve;if(x=Ol(_?k(_,x):x),c.has(x))throw l(x);c.add(x);let T=this.refs[x];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?u(d,T.schema,x):x!==Ol(h)&&(x[0]==="#"?(u(d,a[x],x),a[x]=d):this.refs[x]=h),x}function b(x){if(typeof x=="string"){if(!sY.test(x))throw new Error(`invalid anchor "${x}"`);v.call(this,`#${x}`)}}}),a;function u(d,f,p){if(f!==void 0&&!QX(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Zr.getSchemaRefs=aY});var Zf=P(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.getData=xs.KeywordCxt=xs.validateFunctionCode=void 0;var jD=pD(),RD=Lf(),mk=ok(),ob=Lf(),cY=vD(),Bf=ID(),fk=kD(),ae=Oe(),we=fi(),uY=Uf(),mi=Be(),Ff=Df();function lY(t){if(UD(t)&&(FD(t),LD(t))){fY(t);return}DD(t,()=>(0,jD.topBoolOrEmptySchema)(t))}xs.validateFunctionCode=lY;function DD({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,ae._)`${we.default.data}, ${we.default.valCxt}`,n.$async,()=>{t.code((0,ae._)`"use strict"; ${ND(r,o)}`),pY(t,o),t.code(i)}):t.func(e,(0,ae._)`${we.default.data}, ${dY(o)}`,n.$async,()=>t.code(ND(r,o)).code(i))}function dY(t){return(0,ae._)`{${we.default.instancePath}="", ${we.default.parentData}, ${we.default.parentDataProperty}, ${we.default.rootData}=${we.default.data}${t.dynamicRef?(0,ae._)`, ${we.default.dynamicAnchors}={}`:ae.nil}}={}`}function pY(t,e){t.if(we.default.valCxt,()=>{t.var(we.default.instancePath,(0,ae._)`${we.default.valCxt}.${we.default.instancePath}`),t.var(we.default.parentData,(0,ae._)`${we.default.valCxt}.${we.default.parentData}`),t.var(we.default.parentDataProperty,(0,ae._)`${we.default.valCxt}.${we.default.parentDataProperty}`),t.var(we.default.rootData,(0,ae._)`${we.default.valCxt}.${we.default.rootData}`),e.dynamicRef&&t.var(we.default.dynamicAnchors,(0,ae._)`${we.default.valCxt}.${we.default.dynamicAnchors}`)},()=>{t.var(we.default.instancePath,(0,ae._)`""`),t.var(we.default.parentData,(0,ae._)`undefined`),t.var(we.default.parentDataProperty,(0,ae._)`undefined`),t.var(we.default.rootData,we.default.data),e.dynamicRef&&t.var(we.default.dynamicAnchors,(0,ae._)`{}`)})}function fY(t){let{schema:e,opts:r,gen:n}=t;DD(t,()=>{r.$comment&&e.$comment&&ZD(t),yY(t),n.let(we.default.vErrors,null),n.let(we.default.errors,0),r.unevaluated&&mY(t),BD(t),wY(t)})}function mY(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,ae._)`${r}.evaluated`),e.if((0,ae._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ae._)`${t.evaluated}.props`,(0,ae._)`undefined`)),e.if((0,ae._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ae._)`${t.evaluated}.items`,(0,ae._)`undefined`))}function ND(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,ae._)`/*# sourceURL=${r} */`:ae.nil}function hY(t,e){if(UD(t)&&(FD(t),LD(t))){gY(t,e);return}(0,jD.boolOrEmptySchema)(t,e)}function LD({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function UD(t){return typeof t.schema!="boolean"}function gY(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&ZD(t),vY(t),bY(t);let i=n.const("_errs",we.default.errors);BD(t,i),n.var(e,(0,ae._)`${i} === ${we.default.errors}`)}function FD(t){(0,mi.checkUnknownRules)(t),_Y(t)}function BD(t,e){if(t.opts.jtd)return zD(t,[],!1,e);let r=(0,RD.getSchemaTypes)(t.schema),n=(0,RD.coerceAndCheckDataType)(t,r);zD(t,r,!n,e)}function _Y(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,mi.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function yY(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,mi.checkStrictMode)(t,"default is ignored in the schema root")}function vY(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,uY.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function bY(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function ZD({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,ae._)`${we.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let s=(0,ae.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,ae._)`${we.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function wY(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=t;r.$async?e.if((0,ae._)`${we.default.errors} === 0`,()=>e.return(we.default.data),()=>e.throw((0,ae._)`new ${o}(${we.default.vErrors})`)):(e.assign((0,ae._)`${n}.errors`,we.default.vErrors),i.unevaluated&&xY(t),e.return((0,ae._)`${we.default.errors} === 0`))}function xY({gen:t,evaluated:e,props:r,items:n}){r instanceof ae.Name&&t.assign((0,ae._)`${e}.props`,r),n instanceof ae.Name&&t.assign((0,ae._)`${e}.items`,n)}function zD(t,e,r,n){let{gen:o,schema:i,data:s,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,mi.schemaHasRulesButRef)(i,l))){o.block(()=>VD(t,"$ref",l.all.$ref.definition));return}c.jtd||$Y(t,e),o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,mk.shouldUseGroup)(i,f)&&(f.type?(o.if((0,ob.checkDataType)(f.type,s,c.strictNumbers)),MD(t,f),e.length===1&&e[0]===f.type&&r&&(o.else(),(0,ob.reportTypeError)(t)),o.endIf()):MD(t,f),a||o.if((0,ae._)`${we.default.errors} === ${n||0}`))}}function MD(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,cY.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,mk.shouldUseRule)(n,i)&&VD(t,i.keyword,i.definition,e.type)})}function $Y(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(IY(t,e),t.opts.allowUnionTypes||SY(t,e),kY(t,t.dataTypes))}function IY(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{qD(t.dataTypes,r)||hk(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),EY(t,e)}}function SY(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&hk(t,"use allowUnionTypes to allow union type keyword")}function kY(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,mk.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(s=>TY(e,s))&&hk(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function TY(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function qD(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function EY(t,e){let r=[];for(let n of t.dataTypes)qD(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function hk(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,mi.checkStrictMode)(t,e,t.opts.strictTypes)}var ib=class{constructor(e,r,n){if((0,Bf.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,mi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",GD(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Bf.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",we.default.errors))}result(e,r,n){this.failResult((0,ae.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,ae.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,ae._)`${r} !== undefined && (${(0,ae.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Ff.reportExtraError:Ff.reportError)(this,this.def.error,r)}$dataError(){(0,Ff.reportError)(this,this.def.$dataError||Ff.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ff.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=ae.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=ae.nil,r=ae.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:s}=this;n.if((0,ae.or)((0,ae._)`${o} === undefined`,r)),e!==ae.nil&&n.assign(e,!0),(i.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==ae.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,ae.or)(s(),a());function s(){if(n.length){if(!(r instanceof ae.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,ae._)`${(0,ob.checkDataTypes)(c,r,i.opts.strictNumbers,ob.DataType.Wrong)}`}return ae.nil}function a(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,ae._)`!${c}(${r})`}return ae.nil}}subschema(e,r){let n=(0,fk.getSubschema)(this.it,e);(0,fk.extendSubschemaData)(n,this.it,e),(0,fk.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return hY(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=mi.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=mi.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,ae.Name)),!0}};xs.KeywordCxt=ib;function VD(t,e,r,n){let o=new ib(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Bf.funcKeywordCode)(o,r):"macro"in r?(0,Bf.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Bf.funcKeywordCode)(o,r)}var AY=/^\/(?:[^~]|~0|~1)*$/,OY=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function GD(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return we.default.rootData;if(t[0]==="/"){if(!AY.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=we.default.rootData}else{let u=OY.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!o)return i}let s=i,a=o.split("/");for(let u of a)u&&(i=(0,ae._)`${i}${(0,ae.getProperty)((0,mi.unescapeJsonPointer)(u))}`,s=(0,ae._)`${s} && ${i}`);return s;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}xs.getData=GD});var sb=P(_k=>{"use strict";Object.defineProperty(_k,"__esModule",{value:!0});var gk=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};_k.default=gk});var qf=P(bk=>{"use strict";Object.defineProperty(bk,"__esModule",{value:!0});var yk=Uf(),vk=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,yk.resolveUrl)(e,r,n),this.missingSchema=(0,yk.normalizeId)((0,yk.getFullPath)(e,this.missingRef))}};bk.default=vk});var cb=P(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.resolveSchema=An.getCompilingSchema=An.resolveRef=An.compileSchema=An.SchemaEnv=void 0;var Yn=Oe(),PY=sb(),ic=fi(),Qn=Uf(),KD=Be(),CY=Zf(),Pl=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Qn.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};An.SchemaEnv=Pl;function xk(t){let e=HD.call(this,t);if(e)return e;let r=(0,Qn.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,s=new Yn.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),a;t.$async&&(a=s.scopeValue("Error",{ref:PY.default,code:(0,Yn._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");t.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:ic.default.data,parentData:ic.default.parentData,parentDataProperty:ic.default.parentDataProperty,dataNames:[ic.default.data],dataPathArr:[Yn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Yn.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Yn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Yn._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,CY.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let d=s.toString();l=`${s.scopeRefs(ic.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let p=new Function(`${ic.default.self}`,`${ic.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=u;p.evaluated={props:m instanceof Yn.Name?void 0:m,items:h instanceof Yn.Name?void 0:h,dynamicProps:m instanceof Yn.Name,dynamicItems:h instanceof Yn.Name},p.source&&(p.source.evaluated=(0,Yn.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}An.compileSchema=xk;function RY(t,e,r){var n;r=(0,Qn.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let i=MY.call(this,t,r);if(i===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(i=new Pl({schema:s,schemaId:a,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=NY.call(this,i)}An.resolveRef=RY;function NY(t){return(0,Qn.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:xk.call(this,t)}function HD(t){for(let e of this._compilations)if(zY(e,t))return e}An.getCompilingSchema=HD;function zY(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function MY(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||ab.call(this,t,e)}function ab(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Qn._getFullPath)(this.opts.uriResolver,r),o=(0,Qn.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return wk.call(this,r,t);let i=(0,Qn.normalizeId)(n),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){let a=ab.call(this,t,s);return typeof a?.schema!="object"?void 0:wk.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||xk.call(this,s),i===(0,Qn.normalizeId)(e)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,Qn.resolveUrl)(this.opts.uriResolver,o,u)),new Pl({schema:a,schemaId:c,root:t,baseId:o})}return wk.call(this,r,s)}}An.resolveSchema=ab;var jY=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function wk(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,KD.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!jY.has(a)&&u&&(e=(0,Qn.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,KD.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Qn.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=ab.call(this,n,a)}let{schemaId:s}=this.opts;if(i=i||new Pl({schema:r,schemaId:s,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var WD=P((J2e,DY)=>{DY.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Ik=P((X2e,QD)=>{"use strict";var LY=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),XD=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function $k(t){let e="",r=0,n=0;for(n=0;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var UY=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function JD(t){return t.length=0,!0}function FY(t,e,r){if(t.length){let n=$k(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function BY(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,s=!1,a=FY;for(let c=0;c7){r.error=!0;break}c>0&&t[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=JD}else{o.push(u);continue}}return o.length&&(a===JD?r.zone=o.join(""):s?n.push(o.join("")):n.push($k(o))),r.address=n.join(""),r}function YD(t){if(ZY(t,":")<2)return{host:t,isIPV6:!1};let e=BY(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function ZY(t,e){let r=0;for(let n=0;n{"use strict";var{isUUID:KY}=Ik(),HY=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,WY=["http","https","ws","wss","urn","urn:uuid"];function JY(t){return WY.indexOf(t)!==-1}function Sk(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function eL(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function tL(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function XY(t){return t.secure=Sk(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function YY(t){if((t.port===(Sk(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function QY(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(HY);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,i=kk(o);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function eQ(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,i=kk(o);i&&(t=i.serialize(t,e));let s=t,a=t.nss;return s.path=`${n||e.nid}:${a}`,e.skipEscape=!0,s}function tQ(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!KY(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function rQ(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var rL={scheme:"http",domainHost:!0,parse:eL,serialize:tL},nQ={scheme:"https",domainHost:rL.domainHost,parse:eL,serialize:tL},ub={scheme:"ws",domainHost:!0,parse:XY,serialize:YY},oQ={scheme:"wss",domainHost:ub.domainHost,parse:ub.parse,serialize:ub.serialize},iQ={scheme:"urn",parse:QY,serialize:eQ,skipNormalize:!0},sQ={scheme:"urn:uuid",parse:tQ,serialize:rQ,skipNormalize:!0},lb={http:rL,https:nQ,ws:ub,wss:oQ,urn:iQ,"urn:uuid":sQ};Object.setPrototypeOf(lb,null);function kk(t){return t&&(lb[t]||lb[t.toLowerCase()])||void 0}nL.exports={wsIsSecure:Sk,SCHEMES:lb,isValidSchemeName:JY,getSchemeHandler:kk}});var aL=P((Q2e,pb)=>{"use strict";var{normalizeIPv6:aQ,removeDotSegments:Vf,recomposeAuthority:cQ,normalizeComponentEncoding:db,isIPv4:uQ,nonSimpleDomain:lQ}=Ik(),{SCHEMES:dQ,getSchemeHandler:iL}=oL();function pQ(t,e){return typeof t=="string"?t=Oo(hi(t,e),e):typeof t=="object"&&(t=hi(Oo(t,e),e)),t}function fQ(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=sL(hi(t,n),hi(e,n),n,!0);return n.skipEscape=!0,Oo(o,n)}function sL(t,e,r,n){let o={};return n||(t=hi(Oo(t,r),r),e=hi(Oo(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Vf(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Vf(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=Vf(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=Vf(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function mQ(t,e,r){return typeof t=="string"?(t=unescape(t),t=Oo(db(hi(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Oo(db(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Oo(db(hi(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Oo(db(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Oo(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],i=iL(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let s=cQ(r);if(s!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(s),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(a=Vf(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var hQ=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function hi(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(hQ);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(uQ(n.host)===!1){let c=aQ(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let s=iL(r.scheme||n.scheme);if(!r.unicodeSupport&&(!s||!s.unicodeSupport)&&n.host&&(r.domainHost||s&&s.domainHost)&&o===!1&&lQ(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!s||s&&!s.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),s&&s.parse&&s.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Tk={SCHEMES:dQ,normalize:pQ,resolve:fQ,resolveComponent:sL,equal:mQ,serialize:Oo,parse:hi};pb.exports=Tk;pb.exports.default=Tk;pb.exports.fastUri=Tk});var uL=P(Ek=>{"use strict";Object.defineProperty(Ek,"__esModule",{value:!0});var cL=aL();cL.code='require("ajv/dist/runtime/uri").default';Ek.default=cL});var _L=P(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.CodeGen=Xt.Name=Xt.nil=Xt.stringify=Xt.str=Xt._=Xt.KeywordCxt=void 0;var gQ=Zf();Object.defineProperty(Xt,"KeywordCxt",{enumerable:!0,get:function(){return gQ.KeywordCxt}});var Cl=Oe();Object.defineProperty(Xt,"_",{enumerable:!0,get:function(){return Cl._}});Object.defineProperty(Xt,"str",{enumerable:!0,get:function(){return Cl.str}});Object.defineProperty(Xt,"stringify",{enumerable:!0,get:function(){return Cl.stringify}});Object.defineProperty(Xt,"nil",{enumerable:!0,get:function(){return Cl.nil}});Object.defineProperty(Xt,"Name",{enumerable:!0,get:function(){return Cl.Name}});Object.defineProperty(Xt,"CodeGen",{enumerable:!0,get:function(){return Cl.CodeGen}});var _Q=sb(),mL=qf(),yQ=nk(),Gf=cb(),vQ=Oe(),Kf=Uf(),fb=Lf(),Ok=Be(),lL=WD(),bQ=uL(),hL=(t,e)=>new RegExp(t,e);hL.code="new RegExp";var wQ=["removeAdditional","useDefaults","coerceTypes"],xQ=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),$Q={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},IQ={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},dL=200;function SQ(t){var e,r,n,o,i,s,a,c,u,l,d,f,p,m,h,_,v,b,x,k,T,F,J,w,Z;let oe=t.strict,Q=(e=t.code)===null||e===void 0?void 0:e.optimize,wt=Q===!0||Q===void 0?1:Q||0,dn=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:hL,pn=(o=t.uriResolver)!==null&&o!==void 0?o:bQ.default;return{strictSchema:(s=(i=t.strictSchema)!==null&&i!==void 0?i:oe)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:oe)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:oe)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:oe)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:oe)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:wt,regExp:dn}:{optimize:wt,regExp:dn},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:dL,loopEnum:(_=t.loopEnum)!==null&&_!==void 0?_:dL,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(x=t.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(k=t.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(F=t.validateSchema)!==null&&F!==void 0?F:!0,validateFormats:(J=t.validateFormats)!==null&&J!==void 0?J:!0,unicodeRegExp:(w=t.unicodeRegExp)!==null&&w!==void 0?w:!0,int32range:(Z=t.int32range)!==null&&Z!==void 0?Z:!0,uriResolver:pn}}var Hf=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...SQ(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new vQ.ValueScope({scope:{},prefixes:xQ,es5:r,lines:n}),this.logger=PQ(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,yQ.getRules)(),pL.call(this,$Q,e,"NOT SUPPORTED"),pL.call(this,IQ,e,"DEPRECATED","warn"),this._metaOpts=AQ.call(this),e.formats&&TQ.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&EQ.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),kQ.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=lL;n==="id"&&(o={...lL},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await i.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||s.call(this,f)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof mL.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,o);return this}let i;if(typeof e=="object"){let{schemaId:s}=this.opts;if(i=e[s],i!==void 0&&typeof i!="string")throw new Error(`schema ${s} must be string`)}return r=(0,Kf.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(e){let r;for(;typeof(r=fL.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Gf.SchemaEnv({schema:{},schemaId:n});if(r=Gf.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=fL.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Kf.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(RQ.call(this,n,r),!r)return(0,Ok.eachItem)(n,i=>Ak.call(this,i)),this;zQ.call(this,r);let o={...r,type:(0,fb.getJSONTypes)(r.type),schemaType:(0,fb.getJSONTypes)(r.schemaType)};return(0,Ok.eachItem)(n,o.type.length===0?i=>Ak.call(this,i,o):i=>o.type.forEach(s=>Ak.call(this,i,o,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let i=o.split("/").slice(1),s=e;for(let a of i)s=s[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=s[a];u&&l&&(s[a]=gL(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Kf.normalizeId)(s||n);let u=Kf.getSchemaRefs.call(this,e,n);return c=new Gf.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Gf.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Gf.compileSchema.call(this,e)}finally{this.opts=r}}};Hf.ValidationError=_Q.default;Hf.MissingRefError=mL.default;Xt.default=Hf;function pL(t,e,r,n="error"){for(let o in t){let i=o;i in e&&this.logger[n](`${r}: option ${o}. ${t[i]}`)}}function fL(t){return t=(0,Kf.normalizeId)(t),this.schemas[t]||this.refs[t]}function kQ(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function TQ(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function EQ(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function AQ(){let t={...this.opts};for(let e of wQ)delete t[e];return t}var OQ={log(){},warn(){},error(){}};function PQ(t){if(t===!1)return OQ;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var CQ=/^[a-z_$][a-z0-9_$:-]*$/i;function RQ(t,e){let{RULES:r}=this;if((0,Ok.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!CQ.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Ak(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=o?i.post:i.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,fb.getJSONTypes)(e.type),schemaType:(0,fb.getJSONTypes)(e.schemaType)}};e.before?NQ.call(this,s,a,e.before):s.rules.push(a),i.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function NQ(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function zQ(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=gL(e)),t.validateSchema=this.compile(e,!0))}var MQ={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function gL(t){return{anyOf:[t,MQ]}}});var yL=P(Pk=>{"use strict";Object.defineProperty(Pk,"__esModule",{value:!0});var jQ={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Pk.default=jQ});var xL=P(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.callRef=sc.getValidate=void 0;var DQ=qf(),vL=En(),qr=Oe(),Rl=fi(),bL=cb(),mb=Be(),LQ={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:i,validateName:s,opts:a,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=bL.resolveRef.call(c,u,o,r);if(l===void 0)throw new DQ.default(n.opts.uriResolver,o,r);if(l instanceof bL.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return hb(t,s,i,i.$async);let m=e.scopeValue("root",{ref:u});return hb(t,(0,qr._)`${m}.validate`,u,u.$async)}function f(m){let h=wL(t,m);hb(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,qr.stringify)(m)}:{ref:m}),_=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:qr.nil,topSchemaRef:h,errSchemaPath:r},_);t.mergeEvaluated(v),t.ok(_)}}};function wL(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,qr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}sc.getValidate=wL;function hb(t,e,r,n){let{gen:o,it:i}=t,{allErrors:s,schemaEnv:a,opts:c}=i,u=c.passContext?Rl.default.this:qr.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{o.code((0,qr._)`await ${(0,vL.callValidateCode)(t,e,u)}`),p(e),s||o.assign(m,!0)},h=>{o.if((0,qr._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),f(h),s||o.assign(m,!1)}),t.ok(m)}function d(){t.result((0,vL.callValidateCode)(t,e,u),()=>p(e),()=>f(e))}function f(m){let h=(0,qr._)`${m}.errors`;o.assign(Rl.default.vErrors,(0,qr._)`${Rl.default.vErrors} === null ? ${h} : ${Rl.default.vErrors}.concat(${h})`),o.assign(Rl.default.errors,(0,qr._)`${Rl.default.vErrors}.length`)}function p(m){var h;if(!i.opts.unevaluated)return;let _=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(i.props=mb.mergeEvaluated.props(o,_.props,i.props));else{let v=o.var("props",(0,qr._)`${m}.evaluated.props`);i.props=mb.mergeEvaluated.props(o,v,i.props,qr.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=mb.mergeEvaluated.items(o,_.items,i.items));else{let v=o.var("items",(0,qr._)`${m}.evaluated.items`);i.items=mb.mergeEvaluated.items(o,v,i.items,qr.Name)}}}sc.callRef=hb;sc.default=LQ});var $L=P(Ck=>{"use strict";Object.defineProperty(Ck,"__esModule",{value:!0});var UQ=yL(),FQ=xL(),BQ=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",UQ.default,FQ.default];Ck.default=BQ});var IL=P(Rk=>{"use strict";Object.defineProperty(Rk,"__esModule",{value:!0});var gb=Oe(),$s=gb.operators,_b={maximum:{okStr:"<=",ok:$s.LTE,fail:$s.GT},minimum:{okStr:">=",ok:$s.GTE,fail:$s.LT},exclusiveMaximum:{okStr:"<",ok:$s.LT,fail:$s.GTE},exclusiveMinimum:{okStr:">",ok:$s.GT,fail:$s.LTE}},ZQ={message:({keyword:t,schemaCode:e})=>(0,gb.str)`must be ${_b[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,gb._)`{comparison: ${_b[t].okStr}, limit: ${e}}`},qQ={keyword:Object.keys(_b),type:"number",schemaType:"number",$data:!0,error:ZQ,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,gb._)`${r} ${_b[e].fail} ${n} || isNaN(${r})`)}};Rk.default=qQ});var SL=P(Nk=>{"use strict";Object.defineProperty(Nk,"__esModule",{value:!0});var Wf=Oe(),VQ={message:({schemaCode:t})=>(0,Wf.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Wf._)`{multipleOf: ${t}}`},GQ={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:VQ,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,i=o.opts.multipleOfPrecision,s=e.let("res"),a=i?(0,Wf._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:(0,Wf._)`${s} !== parseInt(${s})`;t.fail$data((0,Wf._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};Nk.default=GQ});var TL=P(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});function kL(t){let e=t.length,r=0,n=0,o;for(;n=55296&&o<=56319&&n{"use strict";Object.defineProperty(Mk,"__esModule",{value:!0});var ac=Oe(),KQ=Be(),HQ=TL(),WQ={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,ac.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,ac._)`{limit: ${t}}`},JQ={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:WQ,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,i=e==="maxLength"?ac.operators.GT:ac.operators.LT,s=o.opts.unicode===!1?(0,ac._)`${r}.length`:(0,ac._)`${(0,KQ.useFunc)(t.gen,HQ.default)}(${r})`;t.fail$data((0,ac._)`${s} ${i} ${n}`)}};Mk.default=JQ});var AL=P(jk=>{"use strict";Object.defineProperty(jk,"__esModule",{value:!0});var XQ=En(),yb=Oe(),YQ={message:({schemaCode:t})=>(0,yb.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,yb._)`{pattern: ${t}}`},QQ={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:YQ,code(t){let{data:e,$data:r,schema:n,schemaCode:o,it:i}=t,s=i.opts.unicodeRegExp?"u":"",a=r?(0,yb._)`(new RegExp(${o}, ${s}))`:(0,XQ.usePattern)(t,n);t.fail$data((0,yb._)`!${a}.test(${e})`)}};jk.default=QQ});var OL=P(Dk=>{"use strict";Object.defineProperty(Dk,"__esModule",{value:!0});var Jf=Oe(),eee={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Jf.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Jf._)`{limit: ${t}}`},tee={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:eee,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Jf.operators.GT:Jf.operators.LT;t.fail$data((0,Jf._)`Object.keys(${r}).length ${o} ${n}`)}};Dk.default=tee});var PL=P(Lk=>{"use strict";Object.defineProperty(Lk,"__esModule",{value:!0});var Xf=En(),Yf=Oe(),ree=Be(),nee={message:({params:{missingProperty:t}})=>(0,Yf.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Yf._)`{missingProperty: ${t}}`},oee={keyword:"required",type:"object",schemaType:"array",$data:!0,error:nee,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:i,it:s}=t,{opts:a}=s;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?u():l(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let _=s.schemaEnv.baseId+s.errSchemaPath,v=`required property "${h}" is not defined at "${_}" (strictRequired)`;(0,ree.checkStrictMode)(s,v,s.opts.strictRequired)}}function u(){if(c||i)t.block$data(Yf.nil,d);else for(let p of r)(0,Xf.checkReportMissingProp)(t,p)}function l(){let p=e.let("missing");if(c||i){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,Xf.checkMissingProp)(t,r,p)),(0,Xf.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Xf.noPropertyInData)(e,o,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,Xf.propertyInData)(e,o,p,a.ownProperties)),e.if((0,Yf.not)(m),()=>{t.error(),e.break()})},Yf.nil)}}};Lk.default=oee});var CL=P(Uk=>{"use strict";Object.defineProperty(Uk,"__esModule",{value:!0});var Qf=Oe(),iee={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Qf.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Qf._)`{limit: ${t}}`},see={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:iee,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Qf.operators.GT:Qf.operators.LT;t.fail$data((0,Qf._)`${r}.length ${o} ${n}`)}};Uk.default=see});var vb=P(Fk=>{"use strict";Object.defineProperty(Fk,"__esModule",{value:!0});var RL=dk();RL.code='require("ajv/dist/runtime/equal").default';Fk.default=RL});var NL=P(Zk=>{"use strict";Object.defineProperty(Zk,"__esModule",{value:!0});var Bk=Lf(),Yt=Oe(),aee=Be(),cee=vb(),uee={message:({params:{i:t,j:e}})=>(0,Yt.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Yt._)`{i: ${t}, j: ${e}}`},lee={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:uee,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:i,schemaCode:s,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=i.items?(0,Bk.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Yt._)`${s} === false`),t.ok(c);function l(){let m=e.let("i",(0,Yt._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,Yt._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,h){let _=e.name("item"),v=(0,Bk.checkDataTypes)(u,_,a.opts.strictNumbers,Bk.DataType.Wrong),b=e.const("indices",(0,Yt._)`{}`);e.for((0,Yt._)`;${m}--;`,()=>{e.let(_,(0,Yt._)`${r}[${m}]`),e.if(v,(0,Yt._)`continue`),u.length>1&&e.if((0,Yt._)`typeof ${_} == "string"`,(0,Yt._)`${_} += "_"`),e.if((0,Yt._)`typeof ${b}[${_}] == "number"`,()=>{e.assign(h,(0,Yt._)`${b}[${_}]`),t.error(),e.assign(c,!1).break()}).code((0,Yt._)`${b}[${_}] = ${m}`)})}function p(m,h){let _=(0,aee.useFunc)(e,cee.default),v=e.name("outer");e.label(v).for((0,Yt._)`;${m}--;`,()=>e.for((0,Yt._)`${h} = ${m}; ${h}--;`,()=>e.if((0,Yt._)`${_}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Zk.default=lee});var zL=P(Vk=>{"use strict";Object.defineProperty(Vk,"__esModule",{value:!0});var qk=Oe(),dee=Be(),pee=vb(),fee={message:"must be equal to constant",params:({schemaCode:t})=>(0,qk._)`{allowedValue: ${t}}`},mee={keyword:"const",$data:!0,error:fee,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,qk._)`!${(0,dee.useFunc)(e,pee.default)}(${r}, ${o})`):t.fail((0,qk._)`${i} !== ${r}`)}};Vk.default=mee});var ML=P(Gk=>{"use strict";Object.defineProperty(Gk,"__esModule",{value:!0});var em=Oe(),hee=Be(),gee=vb(),_ee={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,em._)`{allowedValues: ${t}}`},yee={keyword:"enum",schemaType:"array",$data:!0,error:_ee,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:s}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=s.opts.loopEnum,c,u=()=>c??(c=(0,hee.useFunc)(e,gee.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let p=e.const("vSchema",i);l=(0,em.or)(...o.map((m,h)=>f(p,h)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,p=>e.if((0,em._)`${u()}(${r}, ${p})`,()=>e.assign(l,!0).break()))}function f(p,m){let h=o[m];return typeof h=="object"&&h!==null?(0,em._)`${u()}(${r}, ${p}[${m}])`:(0,em._)`${r} === ${h}`}}};Gk.default=yee});var jL=P(Kk=>{"use strict";Object.defineProperty(Kk,"__esModule",{value:!0});var vee=IL(),bee=SL(),wee=EL(),xee=AL(),$ee=OL(),Iee=PL(),See=CL(),kee=NL(),Tee=zL(),Eee=ML(),Aee=[vee.default,bee.default,wee.default,xee.default,$ee.default,Iee.default,See.default,kee.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Tee.default,Eee.default];Kk.default=Aee});var Wk=P(tm=>{"use strict";Object.defineProperty(tm,"__esModule",{value:!0});tm.validateAdditionalItems=void 0;var cc=Oe(),Hk=Be(),Oee={message:({params:{len:t}})=>(0,cc.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,cc._)`{limit: ${t}}`},Pee={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Oee,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Hk.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}DL(t,n)}};function DL(t,e){let{gen:r,schema:n,data:o,keyword:i,it:s}=t;s.items=!0;let a=r.const("len",(0,cc._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,cc._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Hk.alwaysValidSchema)(s,n)){let u=r.var("valid",(0,cc._)`${a} <= ${e.length}`);r.if((0,cc.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:Hk.Type.Num},u),s.allErrors||r.if((0,cc.not)(u),()=>r.break())})}}tm.validateAdditionalItems=DL;tm.default=Pee});var Jk=P(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});rm.validateTuple=void 0;var LL=Oe(),bb=Be(),Cee=En(),Ree={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return UL(t,"additionalItems",e);r.items=!0,!(0,bb.alwaysValidSchema)(r,e)&&t.ok((0,Cee.validateArray)(t))}};function UL(t,e,r=t.schema){let{gen:n,parentSchema:o,data:i,keyword:s,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=bb.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,LL._)`${i}.length`);r.forEach((d,f)=>{(0,bb.alwaysValidSchema)(a,d)||(n.if((0,LL._)`${u} > ${f}`,()=>t.subschema({keyword:s,schemaProp:f,dataProp:f},c)),t.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let _=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,bb.checkStrictMode)(a,_,f.strictTuples)}}}rm.validateTuple=UL;rm.default=Ree});var FL=P(Xk=>{"use strict";Object.defineProperty(Xk,"__esModule",{value:!0});var Nee=Jk(),zee={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Nee.validateTuple)(t,"items")};Xk.default=zee});var ZL=P(Yk=>{"use strict";Object.defineProperty(Yk,"__esModule",{value:!0});var BL=Oe(),Mee=Be(),jee=En(),Dee=Wk(),Lee={message:({params:{len:t}})=>(0,BL.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,BL._)`{limit: ${t}}`},Uee={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Lee,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,Mee.alwaysValidSchema)(n,e)&&(o?(0,Dee.validateAdditionalItems)(t,o):t.ok((0,jee.validateArray)(t)))}};Yk.default=Uee});var qL=P(Qk=>{"use strict";Object.defineProperty(Qk,"__esModule",{value:!0});var On=Oe(),wb=Be(),Fee={message:({params:{min:t,max:e}})=>e===void 0?(0,On.str)`must contain at least ${t} valid item(s)`:(0,On.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,On._)`{minContains: ${t}}`:(0,On._)`{minContains: ${t}, maxContains: ${e}}`},Bee={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Fee,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t,s,a,{minContains:c,maxContains:u}=n;i.opts.next?(s=c===void 0?1:c,a=u):s=1;let l=e.const("len",(0,On._)`${o}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,wb.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,wb.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,wb.alwaysValidSchema)(i,r)){let h=(0,On._)`${l} >= ${s}`;a!==void 0&&(h=(0,On._)`${h} && ${l} <= ${a}`),t.pass(h);return}i.items=!0;let d=e.name("valid");a===void 0&&s===1?p(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,On._)`${o}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),_=e.let("count",0);p(h,()=>e.if(h,()=>m(_)))}function p(h,_){e.forRange("i",0,l,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:wb.Type.Num,compositeRule:!0},h),_()})}function m(h){e.code((0,On._)`${h}++`),a===void 0?e.if((0,On._)`${h} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,On._)`${h} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,On._)`${h} >= ${s}`,()=>e.assign(d,!0)))}}};Qk.default=Bee});var KL=P(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.validateSchemaDeps=Po.validatePropertyDeps=Po.error=void 0;var eT=Oe(),Zee=Be(),nm=En();Po.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,eT.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,eT._)`{property: ${t}, + missingProperty: ${n}, + depsCount: ${e}, + deps: ${r}}`};var qee={keyword:"dependencies",type:"object",schemaType:"object",error:Po.error,code(t){let[e,r]=Vee(t);VL(t,e),GL(t,r)}};function Vee({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function VL(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let c=(0,nm.propertyInData)(r,n,s,o.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,nm.checkReportMissingProp)(t,u)}):(r.if((0,eT._)`${c} && (${(0,nm.checkMissingProp)(t,a,i)})`),(0,nm.reportMissingProp)(t,i),r.else())}}Po.validatePropertyDeps=VL;function GL(t,e=t.schema){let{gen:r,data:n,keyword:o,it:i}=t,s=r.name("valid");for(let a in e)(0,Zee.alwaysValidSchema)(i,e[a])||(r.if((0,nm.propertyInData)(r,n,a,i.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},s);t.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),t.ok(s))}Po.validateSchemaDeps=GL;Po.default=qee});var WL=P(tT=>{"use strict";Object.defineProperty(tT,"__esModule",{value:!0});var HL=Oe(),Gee=Be(),Kee={message:"property name must be valid",params:({params:t})=>(0,HL._)`{propertyName: ${t.propertyName}}`},Hee={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Kee,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,Gee.alwaysValidSchema)(o,r))return;let i=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),e.if((0,HL.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};tT.default=Hee});var nT=P(rT=>{"use strict";Object.defineProperty(rT,"__esModule",{value:!0});var xb=En(),eo=Oe(),Wee=fi(),$b=Be(),Jee={message:"must NOT have additional properties",params:({params:t})=>(0,eo._)`{additionalProperty: ${t.additionalProperty}}`},Xee={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Jee,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,$b.alwaysValidSchema)(s,r))return;let u=(0,xb.allSchemaProperties)(n.properties),l=(0,xb.allSchemaProperties)(n.patternProperties);d(),t.ok((0,eo._)`${i} === ${Wee.default.errors}`);function d(){e.forIn("key",o,_=>{!u.length&&!l.length?m(_):e.if(f(_),()=>m(_))})}function f(_){let v;if(u.length>8){let b=(0,$b.schemaRefOrVal)(s,n.properties,"properties");v=(0,xb.isOwnProperty)(e,b,_)}else u.length?v=(0,eo.or)(...u.map(b=>(0,eo._)`${_} === ${b}`)):v=eo.nil;return l.length&&(v=(0,eo.or)(v,...l.map(b=>(0,eo._)`${(0,xb.usePattern)(t,b)}.test(${_})`))),(0,eo.not)(v)}function p(_){e.code((0,eo._)`delete ${o}[${_}]`)}function m(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(_);return}if(r===!1){t.setParams({additionalProperty:_}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,$b.alwaysValidSchema)(s,r)){let v=e.name("valid");c.removeAdditional==="failing"?(h(_,v,!1),e.if((0,eo.not)(v),()=>{t.reset(),p(_)})):(h(_,v),a||e.if((0,eo.not)(v),()=>e.break()))}}function h(_,v,b){let x={keyword:"additionalProperties",dataProp:_,dataPropType:$b.Type.Str};b===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,v)}}};rT.default=Xee});var YL=P(iT=>{"use strict";Object.defineProperty(iT,"__esModule",{value:!0});var Yee=Zf(),JL=En(),oT=Be(),XL=nT(),Qee={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&XL.default.code(new Yee.KeywordCxt(i,XL.default,"additionalProperties"));let s=(0,JL.allSchemaProperties)(r);for(let d of s)i.definedProperties.add(d);i.opts.unevaluated&&s.length&&i.props!==!0&&(i.props=oT.mergeEvaluated.props(e,(0,oT.toHash)(s),i.props));let a=s.filter(d=>!(0,oT.alwaysValidSchema)(i,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,JL.propertyInData)(e,o,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};iT.default=Qee});var rU=P(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0});var QL=En(),Ib=Oe(),eU=Be(),tU=Be(),ete={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:i}=t,{opts:s}=i,a=(0,QL.allSchemaProperties)(r),c=a.filter(h=>(0,eU.alwaysValidSchema)(i,r[h]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&o.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof Ib.Name)&&(i.props=(0,tU.evaluatedPropsToName)(e,i.props));let{props:d}=i;f();function f(){for(let h of a)u&&p(h),i.allErrors?m(h):(e.var(l,!0),m(h),e.if(l))}function p(h){for(let _ in u)new RegExp(h).test(_)&&(0,eU.checkStrictMode)(i,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,_=>{e.if((0,Ib._)`${(0,QL.usePattern)(t,h)}.test(${_})`,()=>{let v=c.includes(h);v||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:tU.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,Ib._)`${d}[${_}]`,!0):!v&&!i.allErrors&&e.if((0,Ib.not)(l),()=>e.break())})})}}};sT.default=ete});var nU=P(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});var tte=Be(),rte={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,tte.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};aT.default=rte});var oU=P(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});var nte=En(),ote={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:nte.validateUnion,error:{message:"must match a schema in anyOf"}};cT.default=ote});var iU=P(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});var Sb=Oe(),ite=Be(),ste={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Sb._)`{passingSchemas: ${t.passing}}`},ate={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:ste,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,s=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(s,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let f;(0,ite.alwaysValidSchema)(o,l)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Sb._)`${c} && ${s}`).assign(s,!1).assign(a,(0,Sb._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(s,!0),e.assign(a,d),f&&t.mergeEvaluated(f,Sb.Name)})})}}};uT.default=ate});var sU=P(lT=>{"use strict";Object.defineProperty(lT,"__esModule",{value:!0});var cte=Be(),ute={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((i,s)=>{if((0,cte.alwaysValidSchema)(n,i))return;let a=t.subschema({keyword:"allOf",schemaProp:s},o);t.ok(o),t.mergeEvaluated(a)})}};lT.default=ute});var uU=P(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0});var kb=Oe(),cU=Be(),lte={message:({params:t})=>(0,kb.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,kb._)`{failingKeyword: ${t.ifClause}}`},dte={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:lte,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,cU.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=aU(n,"then"),i=aU(n,"else");if(!o&&!i)return;let s=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else o?e.if(a,u("then")):e.if((0,kb.not)(a),u("else"));t.pass(s,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let f=t.subschema({keyword:l},a);e.assign(s,a),t.mergeValidEvaluated(f,s),d?e.assign(d,(0,kb._)`${l}`):t.setParams({ifClause:l})}}}};function aU(t,e){let r=t.schema[e];return r!==void 0&&!(0,cU.alwaysValidSchema)(t,r)}dT.default=dte});var lU=P(pT=>{"use strict";Object.defineProperty(pT,"__esModule",{value:!0});var pte=Be(),fte={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,pte.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};pT.default=fte});var dU=P(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});var mte=Wk(),hte=FL(),gte=Jk(),_te=ZL(),yte=qL(),vte=KL(),bte=WL(),wte=nT(),xte=YL(),$te=rU(),Ite=nU(),Ste=oU(),kte=iU(),Tte=sU(),Ete=uU(),Ate=lU();function Ote(t=!1){let e=[Ite.default,Ste.default,kte.default,Tte.default,Ete.default,Ate.default,bte.default,wte.default,vte.default,xte.default,$te.default];return t?e.push(hte.default,_te.default):e.push(mte.default,gte.default),e.push(yte.default),e}fT.default=Ote});var pU=P(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});var kt=Oe(),Pte={message:({schemaCode:t})=>(0,kt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,kt._)`{format: ${t}}`},Cte={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Pte,code(t,e){let{gen:r,data:n,$data:o,schema:i,schemaCode:s,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,kt._)`${m}[${s}]`),_=r.let("fType"),v=r.let("format");r.if((0,kt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(_,(0,kt._)`${h}.type || "string"`).assign(v,(0,kt._)`${h}.validate`),()=>r.assign(_,(0,kt._)`"string"`).assign(v,h)),t.fail$data((0,kt.or)(b(),x()));function b(){return c.strictSchema===!1?kt.nil:(0,kt._)`${s} && !${v}`}function x(){let k=l.$async?(0,kt._)`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,kt._)`${v}(${n})`,T=(0,kt._)`(typeof ${v} == "function" ? ${k} : ${v}.test(${n}))`;return(0,kt._)`${v} && ${v} !== true && ${_} === ${e} && !${T}`}}function p(){let m=d.formats[i];if(!m){b();return}if(m===!0)return;let[h,_,v]=x(m);h===e&&t.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function x(T){let F=T instanceof RegExp?(0,kt.regexpCode)(T):c.code.formats?(0,kt._)`${c.code.formats}${(0,kt.getProperty)(i)}`:void 0,J=r.scopeValue("formats",{key:i,ref:T,code:F});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,kt._)`${J}.validate`]:["string",T,J]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,kt._)`await ${v}(${n})`}return typeof _=="function"?(0,kt._)`${v}(${n})`:(0,kt._)`${v}.test(${n})`}}}};mT.default=Cte});var fU=P(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});var Rte=pU(),Nte=[Rte.default];hT.default=Nte});var mU=P(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.contentVocabulary=Nl.metadataVocabulary=void 0;Nl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Nl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var gU=P(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});var zte=$L(),Mte=jL(),jte=dU(),Dte=fU(),hU=mU(),Lte=[zte.default,Mte.default,(0,jte.default)(),Dte.default,hU.metadataVocabulary,hU.contentVocabulary];gT.default=Lte});var yU=P(Tb=>{"use strict";Object.defineProperty(Tb,"__esModule",{value:!0});Tb.DiscrError=void 0;var _U;(function(t){t.Tag="tag",t.Mapping="mapping"})(_U||(Tb.DiscrError=_U={}))});var bU=P(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});var zl=Oe(),_T=yU(),vU=cb(),Ute=qf(),Fte=Be(),Bte={message:({params:{discrError:t,tagName:e}})=>t===_T.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,zl._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},Zte={keyword:"discriminator",type:"object",schemaType:"object",error:Bte,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:i}=t,{oneOf:s}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,zl._)`${r}${(0,zl.getProperty)(a)}`);e.if((0,zl._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:_T.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,zl._)`${u} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:_T.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(h,zl.Name),m}function f(){var p;let m={},h=v(o),_=!0;for(let k=0;k{qte.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var bT=P((lt,vT)=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.MissingRefError=lt.ValidationError=lt.CodeGen=lt.Name=lt.nil=lt.stringify=lt.str=lt._=lt.KeywordCxt=lt.Ajv=void 0;var Vte=_L(),Gte=gU(),Kte=bU(),xU=wU(),Hte=["/properties"],Eb="http://json-schema.org/draft-07/schema",Ml=class extends Vte.default{_addVocabularies(){super._addVocabularies(),Gte.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Kte.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(xU,Hte):xU;this.addMetaSchema(e,Eb,!1),this.refs["http://json-schema.org/schema"]=Eb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Eb)?Eb:void 0)}};lt.Ajv=Ml;vT.exports=lt=Ml;vT.exports.Ajv=Ml;Object.defineProperty(lt,"__esModule",{value:!0});lt.default=Ml;var Wte=Zf();Object.defineProperty(lt,"KeywordCxt",{enumerable:!0,get:function(){return Wte.KeywordCxt}});var jl=Oe();Object.defineProperty(lt,"_",{enumerable:!0,get:function(){return jl._}});Object.defineProperty(lt,"str",{enumerable:!0,get:function(){return jl.str}});Object.defineProperty(lt,"stringify",{enumerable:!0,get:function(){return jl.stringify}});Object.defineProperty(lt,"nil",{enumerable:!0,get:function(){return jl.nil}});Object.defineProperty(lt,"Name",{enumerable:!0,get:function(){return jl.Name}});Object.defineProperty(lt,"CodeGen",{enumerable:!0,get:function(){return jl.CodeGen}});var Jte=sb();Object.defineProperty(lt,"ValidationError",{enumerable:!0,get:function(){return Jte.default}});var Xte=qf();Object.defineProperty(lt,"MissingRefError",{enumerable:!0,get:function(){return Xte.default}})});var OU=P(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.formatNames=Ro.fastFormats=Ro.fullFormats=void 0;function Co(t,e){return{validate:t,compare:e}}Ro.fullFormats={date:Co(kU,IT),time:Co(xT(!0),ST),"date-time":Co($U(!0),EU),"iso-time":Co(xT(),TU),"iso-date-time":Co($U(),AU),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:nre,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:lre,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:ore,int32:{type:"number",validate:are},int64:{type:"number",validate:cre},float:{type:"number",validate:SU},double:{type:"number",validate:SU},password:!0,binary:!0};Ro.fastFormats={...Ro.fullFormats,date:Co(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,IT),time:Co(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ST),"date-time":Co(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,EU),"iso-time":Co(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,TU),"iso-date-time":Co(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,AU),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Ro.formatNames=Object.keys(Ro.fullFormats);function Yte(t){return t%4===0&&(t%100!==0||t%400===0)}var Qte=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,ere=[0,31,28,31,30,31,30,31,31,30,31,30,31];function kU(t){let e=Qte.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&Yte(r)?29:ere[n])}function IT(t,e){if(t&&e)return t>e?1:t23||l>59||t&&!a)return!1;if(o<=23&&i<=59&&s<60)return!0;let d=i-l*c,f=o-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&s<61}}function ST(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function TU(t,e){if(!(t&&e))return;let r=wT.exec(t),n=wT.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t=ire}function cre(t){return Number.isInteger(t)}function SU(){return!0}var ure=/[^\\]\\Z/;function lre(t){if(ure.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var PU=P(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.formatLimitDefinition=void 0;var dre=bT(),to=Oe(),Is=to.operators,Ab={formatMaximum:{okStr:"<=",ok:Is.LTE,fail:Is.GT},formatMinimum:{okStr:">=",ok:Is.GTE,fail:Is.LT},formatExclusiveMaximum:{okStr:"<",ok:Is.LT,fail:Is.GTE},formatExclusiveMinimum:{okStr:">",ok:Is.GT,fail:Is.LTE}},pre={message:({keyword:t,schemaCode:e})=>(0,to.str)`should be ${Ab[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,to._)`{comparison: ${Ab[t].okStr}, limit: ${e}}`};Dl.formatLimitDefinition={keyword:Object.keys(Ab),type:"string",schemaType:"string",$data:!0,error:pre,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:i}=t,{opts:s,self:a}=i;if(!s.validateFormats)return;let c=new dre.KeywordCxt(i,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),p=e.const("fmt",(0,to._)`${f}[${c.schemaCode}]`);t.fail$data((0,to.or)((0,to._)`typeof ${p} != "object"`,(0,to._)`${p} instanceof RegExp`,(0,to._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${f}" does not define "compare" function`);let m=e.scopeValue("formats",{key:f,ref:p,code:s.code.formats?(0,to._)`${s.code.formats}${(0,to.getProperty)(f)}`:void 0});t.fail$data(d(m))}function d(f){return(0,to._)`${f}.compare(${r}, ${n}) ${Ab[o].fail} 0`}},dependencies:["format"]};var fre=t=>(t.addKeyword(Dl.formatLimitDefinition),t);Dl.default=fre});var zU=P((om,NU)=>{"use strict";Object.defineProperty(om,"__esModule",{value:!0});var Ll=OU(),mre=PU(),kT=Oe(),CU=new kT.Name("fullFormats"),hre=new kT.Name("fastFormats"),TT=(t,e={keywords:!0})=>{if(Array.isArray(e))return RU(t,e,Ll.fullFormats,CU),t;let[r,n]=e.mode==="fast"?[Ll.fastFormats,hre]:[Ll.fullFormats,CU],o=e.formats||Ll.formatNames;return RU(t,o,r,n),e.keywords&&(0,mre.default)(t),t};TT.get=(t,e="full")=>{let n=(e==="fast"?Ll.fastFormats:Ll.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function RU(t,e,r,n){var o,i;(o=(i=t.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,kT._)`require("ajv-formats/dist/formats").${n}`);for(let s of e)t.addFormat(s,r[s])}NU.exports=om=TT;Object.defineProperty(om,"__esModule",{value:!0});om.default=TT});var Mb={PRETTY:4,COMPACT:0};var Ke={TRACE:6,DEBUG:8,INFO:12,WARN:16,ERROR:20,CRITICAL:24,SILENT:28},OT=["level","message","sampling_rate","service","timestamp"],PT="Uncaught error detected, flushing log buffer before exit";var ql={REQUEST_ID:Symbol.for("_AWS_LAMBDA_REQUEST_ID"),X_RAY_TRACE_ID:Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),TENANT_ID:Symbol.for("_AWS_LAMBDA_TENANT_ID")},jb=["true","1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??"");jb||(globalThis.awslambda=globalThis.awslambda||{});var sm=class{static PROTECTED_KEYS=ql;isProtectedKey(e){return Object.values(ql).includes(e)}getRequestId(){return this.get(ql.REQUEST_ID)??"-"}getXRayTraceId(){return this.get(ql.X_RAY_TRACE_ID)}getTenantId(){return this.get(ql.TENANT_ID)}},Db=class extends sm{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==void 0}get(e){return this.currentContext?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);this.currentContext=this.currentContext||{},this.currentContext[e]=r}run(e,r){this.currentContext=e;try{return r()}finally{this.currentContext=void 0}}},Lb=class t extends sm{als;static async create(){let e=new t,r=await import("node:async_hooks");return e.als=new r.AsyncLocalStorage,e}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==void 0}get(e){return this.als.getStore()?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);let n=this.als.getStore();if(!n)throw new Error("No context available");n[e]=r}run(e,r){return this.als.run(e,r)}},CT;(function(t){let e=null;async function r(){return e||(e=(async()=>{let o="AWS_LAMBDA_MAX_CONCURRENCY"in process.env?await Lb.create():new Db;return!jb&&globalThis.awslambda?.InvokeStore?globalThis.awslambda.InvokeStore:(!jb&&globalThis.awslambda&&(globalThis.awslambda.InvokeStore=o),o)})()),e}t.getInstanceAsync=r,t._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE==="1"?{reset:()=>{e=null,globalThis.awslambda?.InvokeStore&&delete globalThis.awslambda.InvokeStore,globalThis.awslambda={}}}:void 0})(CT||(CT={}));var RT="AWS_LAMBDA_MAX_CONCURRENCY",NT="POWERTOOLS_DEV";var zT="_X_AMZN_TRACE_ID";var Vr=({key:t,defaultValue:e,errorMessage:r})=>{let n=process.env[t];if(n===void 0){if(e!==void 0)return e;throw r?new Error(r):new Error(`Environment variable ${t} is required`)}return n.trim()},MT=({key:t,defaultValue:e,errorMessage:r})=>{let n=Vr({key:t,defaultValue:String(e),errorMessage:r}),o=Number(n);if(Number.isNaN(o))throw new TypeError(`Environment variable ${t} must be a number`);return o},KU=new Set(["1","y","yes","t","true","on"]),HU=new Set(["0","n","no","f","false","off"]),Ub=({key:t,defaultValue:e,errorMessage:r,extendedParsing:n})=>{let i=Vr({key:t,defaultValue:String(e),errorMessage:r}).toLowerCase();if(n){if(KU.has(i))return!0;if(HU.has(i))return!1}if(i!=="true"&&i!=="false")throw new Error(`Environment variable ${t} must be a boolean`);return i==="true"},Vl=()=>{try{return Ub({key:NT,extendedParsing:!0})}catch{return!1}};var WU=()=>{let t=globalThis.awslambda?.InvokeStore?.getXRayTraceId()??Vr({key:zT,defaultValue:""});if(t==="")return;if(!t.includes("="))return{Root:t};let e={};for(let r of t.split(";")){let[n,o]=r.split("=");e[n]=o}return e};var am=()=>Vr({key:RT,defaultValue:""})!=="",Gl=()=>WU()?.Root;var Es=class{formatError(e){let{name:r,message:n,stack:o,cause:i,...s}=e,a={name:r,location:this.getCodeLocation(e.stack),message:n,stack:Vl()&&typeof o=="string"?o?.split(` +`):o,cause:i instanceof Error?this.formatError(i):i};for(let c in e)typeof c=="string"&&!["name","message","stack","cause"].includes(c)&&(a[c]=s[c]);return a}formatTimestamp(e){let n=Vr({key:"TZ",defaultValue:""});return n&&!n.includes("UTC")?this.#r(e,n):e.toISOString()}getCodeLocation(e){if(!e)return"";let r=e.split(` +`),n=/\(([^()]*?):(\d+?):(\d+?)\)\\?$/;for(let o of r){let i=n.exec(o);if(Array.isArray(i))return`${i[1]}:${Number(i[2])}`}return""}#e=e=>{let r="2-digit",n=Intl.supportedValuesOf("timeZone").includes(e)?e:"UTC";return new Intl.DateTimeFormat("en",{hourCycle:"h23",year:"numeric",month:r,day:r,hour:r,minute:r,second:r,timeZone:n})};#r(e,r){let{year:n,month:o,day:i,hour:s,minute:a,second:c}=this.#e(r).formatToParts(e).reduce((_,v)=>(_[v.type]=v.value,_),{}),u=`${n}-${o}-${i}T${s}:${a}:${c}`,l=-e.getTimezoneOffset(),d=l>=0?"+":"-",f=Math.abs(Math.floor(l/60)).toString().padStart(2,"0"),p=Math.abs(l%60).toString().padStart(2,"0"),m=e.getMilliseconds().toString().padStart(3,"0"),h=`${d}${f}:${p}`;return`${u}.${m}${h}`}};var dE=mn(Xb(),1),_i=class{attributes={};constructor(e){this.setAttributes(e.attributes)}addAttributes(e){return(0,dE.default)(this.attributes,e),this}getAttributes(){return this.attributes}prepareForPrint(){this.attributes=this.removeEmptyKeys(this.getAttributes())}removeEmptyKeys(e){let r={};for(let n in e)e[n]!==void 0&&e[n]!==""&&e[n]!==null&&(r[n]=e[n]);return r}setAttributes(e){this.attributes=e}};import{Console as B2}from"node:console";import{randomInt as Z2}from"node:crypto";var Yl="2.29.0";var Rre=process.env.AWS_EXECUTION_ENV||"NA";var gm="powertools-for-aws",pE=`${gm}.tracer`,fE=`${gm}.metrics`,mE=`${gm}.logger`,hE=`${gm}.idempotency`;var Yb=t=>typeof t=="string";var gE=t=>Object.is(t,null),Qb=t=>gE(t)||Object.is(t,void 0);var Ql=class{#e;coldStart=!0;defaultServiceName="service_undefined";constructor(){this.#e=this.getInitializationType(),this.#e!=="on-demand"&&(this.coldStart=!1)}getInitializationType(){let e=process.env.AWS_LAMBDA_INITIALIZATION_TYPE?.trim();return e==="on-demand"?"on-demand":e==="provisioned-concurrency"?"provisioned-concurrency":"unknown"}getColdStart(){return this.#e!=="on-demand"?!1:this.coldStart?(this.coldStart=!1,!0):!1}isValidServiceName(e){return typeof e=="string"&&e.trim().length>0}};var _E=process.env.AWS_EXECUTION_ENV||"NA";process.env.AWS_SDK_UA_APP_ID?process.env.AWS_SDK_UA_APP_ID=`${process.env.AWS_SDK_UA_APP_ID}/PT/NO-OP/${Yl}/PTEnv/${_E}`:process.env.AWS_SDK_UA_APP_ID=`PT/NO-OP/${Yl}/PTEnv/${_E}`;var bm=mn(Xb(),1);var _m=class extends Es{#e;constructor(e){super(),this.#e=e?.logRecordOrder}formatAttributes(e,r){let n={level:e.logLevel,message:e.message,timestamp:this.formatTimestamp(e.timestamp),service:e.serviceName,cold_start:e.lambdaContext?.coldStart,function_arn:e.lambdaContext?.invokedFunctionArn,function_memory_size:e.lambdaContext?.memoryLimitInMB,function_name:e.lambdaContext?.functionName,function_request_id:e.lambdaContext?.awsRequestId,sampling_rate:e.sampleRateValue,xray_trace_id:e.xRayTraceId};if(this.#e===void 0)return new _i({attributes:n}).addAttributes(r);let o={};for(let s of this.#e)s in n&&!(s in o)?o[s]=n[s]:s in r&&!(s in o)&&(o[s]=r[s]);for(let s in n)s in o||(o[s]=n[s]);for(let s in r)s in o||(o[s]=r[s]);return new _i({attributes:o})}};var ym=class{#e=Symbol("powertools.logger.temporaryAttributes");#r=Symbol("powertools.logger.keys");#i={};#c=new Map;#n={};#o(){if(!am())return this.#i;if(globalThis.awslambda?.InvokeStore===void 0)throw new Error("InvokeStore is not available");let e=globalThis.awslambda.InvokeStore,r=e.get(this.#e);return r==null&&(r={},e.set(this.#e,r)),r}#t(){if(!am())return this.#c;if(globalThis.awslambda?.InvokeStore===void 0)throw new Error("InvokeStore is not available");let e=globalThis.awslambda.InvokeStore,r=e.get(this.#r);return r==null&&(r=new Map,e.set(this.#r,r)),r}appendTemporaryKeys(e){let r=this.#o(),n=this.#t();for(let[o,i]of Object.entries(e))r[o]=i,n.set(o,"temp")}removeTemporaryKeys(e){let r=this.#o(),n=this.#t();for(let o of e)r[o]=void 0,this.#n[o]?n.set(o,"persistent"):n.delete(o)}getTemporaryAttributes(){return{...this.#o()}}clearTemporaryAttributes(){let e=this.#o(),r=this.#t();for(let n of Object.keys(e))this.#n[n]?r.set(n,"persistent"):r.delete(n);if(!am()){this.#i={};return}globalThis.awslambda.InvokeStore?.set(this.#e,{})}setPersistentAttributes(e){let r=this.#t();this.#n={...e};for(let n of Object.keys(e))r.set(n,"persistent")}getPersistentAttributes(){return{...this.#n}}getAllAttributes(){let e={},r=this.#o(),n=this.#t();for(let[o,i]of Object.entries(this.#n))i!==void 0&&(e[o]=i);for(let[o,i]of n.entries())i==="temp"&&r[o]!==void 0&&(e[o]=r[o]);return e}removePersistentKeys(e){let r=this.#t(),n=this.#o();for(let o of e)this.#n[o]=void 0,n[o]?r.set(o,"temp"):r.delete(o)}};var ew=class{value;logLevel;byteSize;constructor(e,r){if(!Yb(e))throw new Error("Value should be a string");this.value=e,this.logLevel=r,this.byteSize=Buffer.byteLength(e)}},tw=class extends Set{currentBytesSize=0;hasEvictedLog=!1;add(e){return this.currentBytesSize+=e.byteSize,super.add(e),this}delete(e){let r=super.delete(e);return r&&(this.currentBytesSize-=e.byteSize),r}clear(){super.clear(),this.currentBytesSize=0}shift(){let e=this.values().next().value;return e&&this.delete(e),e}},vm=class extends Map{#e;#r;constructor({maxBytesSize:e,onBufferOverflow:r}){super(),this.#e=e,this.#r=r}setItem(e,r,n){let o=new ew(r,n);if(o.byteSize>this.#e)throw new Error("Item too big");let i=this.get(e)||new tw;return i.currentBytesSize!==0&&i.currentBytesSize+o.byteSize>=this.#e&&(this.#i(i,o),this.#r&&this.#r()),i.add(o),super.set(e,i),this}#i(e,r){for(;e.size!==0&&e.currentBytesSize+r.byteSize>=this.#e;)e.shift(),e.hasEvictedLog=!0}};var ed=class t extends Ql{console;customConfigService;logEvent=!1;logFormatter;logIndentation=Mb.COMPACT;logLevel=Ke.INFO;#e;powertoolsLogData={sampleRateValue:0};#r=new ym;#i=[];#c=!1;#n=Ke.INFO;#o;#t={enabled:!1,flushOnErrorLog:!0,maxBytes:20480,bufferAtVerbosity:Ke.DEBUG};#s;#u;#a={sampleRateValue:0,refreshedTimes:0};#p=new Map;get level(){return this.logLevel}constructor(e={}){super();let{customConfigService:r,...n}=e;this.customConfigService=r||void 0,this.setOptions(n),this.#c=!0;for(let[o,i]of this.#i)this.printLog(o,this.createAndPopulateLogItem(...i));this.#i=[]}addContext(e){this.addToPowertoolsLogData({lambdaContext:{invokedFunctionArn:e.invokedFunctionArn,coldStart:this.getColdStart(),awsRequestId:e.awsRequestId,memoryLimitInMB:e.memoryLimitInMB,functionName:e.functionName,functionVersion:e.functionVersion}})}addPersistentLogAttributes(e){this.appendPersistentKeys(e)}appendKeys(e){this.#m(e,"temp")}appendPersistentKeys(e){this.#m(e,"persistent")}createChild(e={}){let r="persistentLogAttributes"in e&&!("persistentKeys"in e)?"persistentLogAttributes":"persistentKeys",n=this.createLogger((0,bm.default)({},{logLevel:this.getLevelName(),serviceName:this.powertoolsLogData.serviceName,sampleRateValue:this.#a.sampleRateValue,logFormatter:this.getLogFormatter(),customConfigService:this.getCustomConfigService(),environment:this.powertoolsLogData.environment,[r]:this.#r.getPersistentAttributes(),jsonReplacerFn:this.#o,correlationIdSearchFn:this.#u,...this.#t.enabled&&{logBufferOptions:{maxBytes:this.#t.maxBytes,bufferAtVerbosity:this.getLogLevelNameFromNumber(this.#t.bufferAtVerbosity),flushOnErrorLog:this.#t.flushOnErrorLog}}},e));this.powertoolsLogData.lambdaContext&&n.addContext(this.powertoolsLogData.lambdaContext);let o=this.#r.getTemporaryAttributes();return Object.keys(o).length>0&&n.appendKeys(o),n}critical(e,...r){this.processLogItem(Ke.CRITICAL,e,r)}debug(e,...r){this.processLogItem(Ke.DEBUG,e,r)}error(e,...r){this.#t.enabled&&this.#t.flushOnErrorLog&&this.flushBuffer(),this.processLogItem(Ke.ERROR,e,r)}getLevelName(){return this.getLogLevelNameFromNumber(this.logLevel)}getLogEvent(){return this.logEvent}getPersistentLogAttributes(){return this.#r.getPersistentAttributes()}info(e,...r){this.processLogItem(Ke.INFO,e,r)}injectLambdaContext(e){return(r,n,o)=>{let i=o.value,s=this;o.value=async function(...a){s.refreshSampleRateCalculation(),s.addContext(a[1]),s.logEventIfEnabled(a[0],e?.logEvent),e?.correlationIdPath&&s.setCorrelationId(a[0],e?.correlationIdPath);try{return await i.apply(this,a)}catch(c){throw e?.flushBufferOnUncaughtError&&(s.flushBuffer(),s.error({message:PT,error:c})),c}finally{(e?.clearState||e?.resetKeys)&&s.resetKeys(),s.clearBuffer()}}}}static injectLambdaContextAfterOrOnError(e,r,n){n&&(n.clearState||n?.resetKeys)&&e.resetKeys()}static injectLambdaContextBefore(e,r,n,o){e.addContext(n),e.logEventIfEnabled(r,o?.logEvent)}logEventIfEnabled(e,r){this.shouldLogEvent(r)&&this.info("Lambda invocation event",{event:e})}refreshSampleRateCalculation(){if(this.#a.refreshedTimes===0){this.#a.refreshedTimes++;return}this.#h()&&this.logLevel>Ke.TRACE?(this.setLogLevel("DEBUG"),this.debug("Setting log level to DEBUG due to sampling rate")):this.setLogLevel(this.getLogLevelNameFromNumber(this.#n))}removeKeys(e){this.#r.removeTemporaryKeys(e)}removePersistentKeys(e){this.#r.removePersistentKeys(e)}removePersistentLogAttributes(e){this.removePersistentKeys(e)}resetKeys(){this.#r.clearTemporaryAttributes()}setLogLevel(e){if(!this.awsLogLevelShortCircuit(e))if(this.isValidLogLevel(e))this.logLevel=Ke[e];else throw new Error(`Invalid log level: ${e}`)}setPersistentLogAttributes(e){let r=this.#f(e);this.#r.setPersistentAttributes(r)}get persistentLogAttributes(){return this.#r.getPersistentAttributes()}shouldLogEvent(e){return typeof e=="boolean"?e:this.getLogEvent()}trace(e,...r){this.processLogItem(Ke.TRACE,e,r)}warn(e,...r){this.processLogItem(Ke.WARN,e,r)}#l(e){this.#p.has(e)||(this.#p.set(e,!0),this.warn(e))}createLogger(e){return new t(e)}getJsonReplacer(){let e=new WeakSet;return(r,n)=>{let o=n;if(this.#o&&(o=this.#o?.(r,o)),o instanceof Error&&(o=this.getLogFormatter().formatError(o)),typeof o=="bigint")return o.toString();if(typeof o=="object"&&o!==null){if(e.has(o))return;e.add(o)}return o}}addToPowertoolsLogData(e){(0,bm.default)(this.powertoolsLogData,e)}#f(e){let r={};for(let[n,o]of Object.entries(e))this.#d(n)||(r[n]=o);return r}#m(e,r){let n=this.#f(e);if(r==="temp")this.#r.appendTemporaryKeys(n);else{let o=this.#r.getPersistentAttributes();this.#r.setPersistentAttributes((0,bm.default)(o,n))}}awsLogLevelShortCircuit(e){return this.#e!==void 0?(this.logLevel=Ke[this.#e],this.isValidLogLevel(e)&&this.logLevel>Ke[e]&&this.#l(`Current log level (${e}) does not match AWS Lambda Advanced Logging Controls minimum log level (${this.#e}). This can lead to data loss, consider adjusting them.`),!0):!1}createAndPopulateLogItem(e,r,n){let o={logLevel:this.getLogLevelNameFromNumber(e),timestamp:new Date,xRayTraceId:Gl(),...this.getPowertoolsLogData(),message:""},i=this.#r.getAllAttributes();return this.#g(r,o,i),this.#_(n,i),this.getLogFormatter().formatAttributes(o,i)}#g(e,r,n){if(typeof e=="string"){r.message=e;return}let{message:o,...i}=e;r.message=o;for(let[s,a]of Object.entries(i))this.#d(s)||(n[s]=a)}#_(e,r){for(let n of e)Qb(n)||(n instanceof Error?r.error=n:typeof n=="string"?r.extra=n:this.#y(n,r))}#y(e,r){for(let[n,o]of Object.entries(e))this.#d(n)||(r[n]=o)}#h(){return this.#a.sampleRateValue&&Z2(0,100)/100<=this.#a.sampleRateValue}#d(e){return OT.includes(e)?(this.warn(`The key "${e}" is a reserved key and will be dropped.`),!0):!1}getCustomConfigService(){return this.customConfigService}getLogFormatter(){return this.logFormatter}getLogLevelNameFromNumber(e){let r;for(let[n,o]of Object.entries(Ke))if(o===e){r=n;break}return r}getPowertoolsLogData(){return this.powertoolsLogData}isValidLogLevel(e){return typeof e=="string"&&e in Ke}isValidSampleRate(e){return typeof e=="number"&&0<=e&&e<=1}printLog(e,r){r.prepareForPrint();let n=e===Ke.CRITICAL?"error":this.getLogLevelNameFromNumber(e).toLowerCase();this.console[n](JSON.stringify(r.getAttributes(),this.getJsonReplacer(),this.logIndentation))}processLogItem(e,r,n){let o=Gl();if(o!==void 0&&this.shouldBufferLog(o,e)){try{this.bufferLogItem(o,this.createAndPopulateLogItem(e,r,n),e)}catch(i){this.printLog(Ke.WARN,this.createAndPopulateLogItem(Ke.WARN,`Unable to buffer log: ${i.message}`,[i])),this.printLog(e,this.createAndPopulateLogItem(e,r,n))}return}e>=this.logLevel&&(this.#c?this.printLog(e,this.createAndPopulateLogItem(e,r,n)):this.#i.push([e,[e,r,n]]))}setConsole(){Vl()?this.console=console:this.console=new B2({stdout:process.stdout,stderr:process.stderr}),this.console.trace=(e,...r)=>{this.console.log(e,...r)}}setInitialLogLevel(e){let r=e?.toUpperCase();if(this.awsLogLevelShortCircuit(r)){this.#n=this.logLevel;return}if(this.isValidLogLevel(r)){this.logLevel=Ke[r],this.#n=this.logLevel;return}let n=this.getCustomConfigService()?.getLogLevel()?.toUpperCase();if(this.isValidLogLevel(n)){this.logLevel=Ke[n],this.#n=this.logLevel;return}let o=Vr({key:"POWERTOOLS_LOG_LEVEL",defaultValue:""}),i=Vr({key:"LOG_LEVEL",defaultValue:""}),s=o!==""?o:i;this.isValidLogLevel(s)&&(this.logLevel=Ke[s],this.#n=this.logLevel)}setInitialSampleRate(e){let r=e,n=this.getCustomConfigService()?.getSampleRateValue(),o=MT({key:"POWERTOOLS_LOGGER_SAMPLE_RATE",defaultValue:0});for(let i of[r,n,o])if(this.isValidSampleRate(i)){this.#a.sampleRateValue=i,this.powertoolsLogData.sampleRateValue=i,this.#h()&&this.logLevel>Ke.TRACE&&(this.setLogLevel("DEBUG"),this.debug("Setting log level to DEBUG due to sampling rate"));break}}setLogEvent(){this.logEvent=Ub({key:"POWERTOOLS_LOGGER_LOG_EVENT",defaultValue:!1})}setLogFormatter(e,r){this.logFormatter=e??new _m({logRecordOrder:r})}setLogIndentation(){Vl()&&(this.logIndentation=Mb.PRETTY)}setOptions(e){let{logLevel:r,serviceName:n,sampleRateValue:o,logFormatter:i,persistentKeys:s,persistentLogAttributes:a,environment:c,jsonReplacerFn:u,logRecordOrder:l,logBufferOptions:d,correlationIdSearchFn:f}=e;a&&Object.keys(a).length>0&&s&&Object.keys(s).length>0&&this.warn("Both persistentLogAttributes and persistentKeys options were provided. Using persistentKeys as persistentLogAttributes is deprecated and will be removed in future releases"),this.setPowertoolsLogData(n,c,s||a);let p=Vr({key:"AWS_LAMBDA_LOG_LEVEL",defaultValue:""}),m=p==="FATAL"?"CRITICAL":p;return this.isValidLogLevel(m)&&(this.#e=m),this.setLogEvent(),this.setInitialLogLevel(r),this.setInitialSampleRate(o),this.setLogFormatter(i,l),this.setConsole(),this.setLogIndentation(),this.#o=u,this.#v(d),this.#u=f,this}setPowertoolsLogData(e,r,n){this.addToPowertoolsLogData({awsRegion:Vr({key:"AWS_REGION",defaultValue:""}),environment:r||this.getCustomConfigService()?.getCurrentEnvironment()||Vr({key:"ENVIRONMENT",defaultValue:""}),serviceName:e||this.getCustomConfigService()?.getServiceName()||Vr({key:"POWERTOOLS_SERVICE_NAME",defaultValue:""})||this.defaultServiceName}),n&&this.appendPersistentKeys(n)}#v(e){if(e===void 0||(this.#t.enabled=e?.enabled!==!1,this.#t.enabled===!1))return;e?.maxBytes!==void 0&&(this.#t.maxBytes=e.maxBytes),this.#s=new vm({maxBytesSize:this.#t.maxBytes}),e?.flushOnErrorLog===!1&&(this.#t.flushOnErrorLog=!1);let r=e?.bufferAtVerbosity?.toUpperCase();this.isValidLogLevel(r)&&(this.#t.bufferAtVerbosity=Ke[r]),this.#e!==void 0&&Ke[this.#e]>this.#t.bufferAtVerbosity&&this.#l("Advanced Loggging Controls (ALC) Log Level is less verbose than Log Buffering Log Level. Buffered logs will be filtered by ALC")}bufferLogItem(e,r,n){r.prepareForPrint(),this.#s?.has(e)===!1&&this.#s?.clear(),this.#s?.setItem(e,JSON.stringify(r.getAttributes(),this.getJsonReplacer(),this.logIndentation),n)}flushBuffer(){let e=Gl();if(e===void 0)return;let r=this.#s?.get(e);if(r!==void 0){for(let n of r){let o=this.getLogLevelNameFromNumber(n.logLevel).toLowerCase();this.console[o](n.value)}r.hasEvictedLog&&this.printLog(Ke.WARN,this.createAndPopulateLogItem(Ke.WARN,"Some logs are not displayed because they were evicted from the buffer. Increase buffer size to store more logs in the buffer",[])),this.#e!==void 0&&Ke[this.#e]>this.#t.bufferAtVerbosity&&this.#l("Advanced Loggging Controls (ALC) Log Level is less verbose than Log Buffering Log Level. Some logs might be missing."),this.#s?.delete(e)}}clearBuffer(){let e=Gl();e!==void 0&&this.#s?.delete(e)}shouldBufferLog(e,r){return this.#t.enabled&&e!==void 0&&r<=this.#t.bufferAtVerbosity}setCorrelationId(e,r){if(typeof r=="string"){if(!this.#u){this.#l("correlationIdPath is set but no search function was provided. The correlation ID will not be added to the log attributes.");return}let n=this.#u(r,e);n&&this.appendKeys({correlation_id:n});return}this.appendKeys({correlation_id:e})}getCorrelationId(){return this.#r.getTemporaryAttributes().correlation_id}};var rw=class extends Es{formatAttributes(e,r){let n={logLevel:e.logLevel,timestamp:this.formatTimestamp(e.timestamp),message:e.message},o=new _i({attributes:n});return o.addAttributes(r),o}},wm=new ed({logFormatter:new rw});function ce(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function S(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var nw=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return nw=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function td(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var rd=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var V=class extends Error{},Pt=class t extends V{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("x-request-id"),this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new yi({message:n,cause:rd(r)});let i=r?.error;return e===400?new fc(e,i,n,o):e===401?new mc(e,i,n,o):e===403?new hc(e,i,n,o):e===404?new gc(e,i,n,o):e===409?new _c(e,i,n,o):e===422?new yc(e,i,n,o):e===429?new vc(e,i,n,o):e>=500?new bc(e,i,n,o):new t(e,i,n,o)}},xt=class extends Pt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},yi=class extends Pt{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Do=class extends yi{constructor({message:e}={}){super({message:e??"Request timed out."})}},fc=class extends Pt{},mc=class extends Pt{},hc=class extends Pt{},gc=class extends Pt{},_c=class extends Pt{},yc=class extends Pt{},vc=class extends Pt{},bc=class extends Pt{},wc=class extends V{constructor(){super("Could not parse response content as the length limit was reached")}},xc=class extends V{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},ro=class extends Error{constructor(e){super(e)}};var V2=/^[a-z][a-z0-9+.-]*:/i,yE=t=>V2.test(t),Qt=t=>(Qt=Array.isArray,Qt(t)),ow=Qt;function iw(t){return typeof t!="object"?{}:t??{}}function vE(t){if(!t)return!0;for(let e in t)return!1;return!0}function bE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function nd(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var wE=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new V(`${t} must be an integer`);if(e<0)throw new V(`${t} must be a positive integer`);return e};var xE=t=>{try{return JSON.parse(t)}catch{return}};var no=t=>new Promise(e=>setTimeout(e,t));var vi="6.10.0";var kE=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function G2(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var K2=()=>{let t=G2();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":IE(Deno.build.os),"X-Stainless-Arch":$E(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":IE(globalThis.process.platform??"unknown"),"X-Stainless-Arch":$E(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=H2();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function H2(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,s=n[3]||0;return{browser:e,version:`${o}.${i}.${s}`}}}return null}var $E=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",IE=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),SE,TE=()=>SE??(SE=K2());function EE(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function sw(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function xm(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return sw({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function aw(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function AE(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var OE=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var $m="RFC3986",cw=t=>String(t),Im={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:cw},uw="RFC1738";var Sm=(t,e)=>(Sm=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Sm(t,e)),oo=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var lw=1024,PE=(t,e,r,n,o)=>{if(t.length===0)return t;let i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a=lw?i.slice(a,a+lw):i,u=[];for(let l=0;l=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===uw&&(d===40||d===41)){u[u.length]=c.charAt(l);continue}if(d<128){u[u.length]=oo[d];continue}if(d<2048){u[u.length]=oo[192|d>>6]+oo[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=oo[224|d>>12]+oo[128|d>>6&63]+oo[128|d&63];continue}l+=1,d=65536+((d&1023)<<10|c.charCodeAt(l)&1023),u[u.length]=oo[240|d>>18]+oo[128|d>>12&63]+oo[128|d>>6&63]+oo[128|d&63]}s+=u.join("")}return s};function CE(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function dw(t,e){if(Qt(t)){let r=[];for(let n=0;n"u"&&(k=0)}if(typeof u=="function"?b=u(e,b):b instanceof Date?b=f?.(b):r==="comma"&&Qt(b)&&(b=dw(b,function(oe){return oe instanceof Date?f?.(oe):oe})),b===null){if(i)return c&&!h?c(e,Ct.encoder,_,"key",p):e;b=""}if(X2(b)||CE(b)){if(c){let oe=h?e:c(e,Ct.encoder,_,"key",p);return[m?.(oe)+"="+m?.(c(b,Ct.encoder,_,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let F=[];if(typeof b>"u")return F;let J;if(r==="comma"&&Qt(b))h&&c&&(b=dw(b,c)),J=[{value:b.length>0?b.join(",")||null:void 0}];else if(Qt(u))J=u;else{let oe=Object.keys(b);J=l?oe.sort(l):oe}let w=a?String(e).replace(/\./g,"%2E"):String(e),Z=n&&Qt(b)&&b.length===1?w+"[]":w;if(o&&Qt(b)&&b.length===0)return Z+"[]";for(let oe=0;oe"u"?t.encodeDotInKeys?!0:Ct.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Ct.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Ct.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Ct.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Ct.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Ct.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Ct.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Ct.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Ct.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Ct.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Ct.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Ct.strictNullHandling}}function fw(t,e={}){let r=t,n=Y2(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Qt(n.filter)&&(i=n.filter,o=i);let s=[];if(typeof r!="object"||r===null)return"";let a=NE[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);let u=new WeakMap;for(let f=0;f0?d+l:""}function LE(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}var jE;function $c(t){let e;return(jE??(e=new globalThis.TextEncoder,jE=e.encode.bind(e)))(t)}var DE;function mw(t){let e;return(DE??(e=new globalThis.TextDecoder,DE=e.decode.bind(e)))(t)}var Gr,Kr,Cs=class{constructor(){Gr.set(this,void 0),Kr.set(this,void 0),ce(this,Gr,new Uint8Array,"f"),ce(this,Kr,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?$c(e):e;ce(this,Gr,LE([S(this,Gr,"f"),r]),"f");let n=[],o;for(;(o=eF(S(this,Gr,"f"),S(this,Kr,"f")))!=null;){if(o.carriage&&S(this,Kr,"f")==null){ce(this,Kr,o.index,"f");continue}if(S(this,Kr,"f")!=null&&(o.index!==S(this,Kr,"f")+1||o.carriage)){n.push(mw(S(this,Gr,"f").subarray(0,S(this,Kr,"f")-1))),ce(this,Gr,S(this,Gr,"f").subarray(S(this,Kr,"f")),"f"),ce(this,Kr,null,"f");continue}let i=S(this,Kr,"f")!==null?o.preceding-1:o.preceding,s=mw(S(this,Gr,"f").subarray(0,i));n.push(s),ce(this,Gr,S(this,Gr,"f").subarray(o.index),"f"),ce(this,Kr,null,"f")}return n}flush(){return S(this,Gr,"f").length?this.decode(` +`):[]}};Gr=new WeakMap,Kr=new WeakMap;Cs.NEWLINE_CHARS=new Set([` +`,"\r"]);Cs.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function eF(t,e){for(let o=e??0;o{if(t){if(bE(Tm,t))return t;$t(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Tm))}`)}};function od(){}function km(t,e,r){return!e||Tm[t]>Tm[r]?od:e[t].bind(e)}var tF={error:od,warn:od,info:od,debug:od},FE=new WeakMap;function $t(t){let e=t.logger,r=t.logLevel??"off";if(!e)return tF;let n=FE.get(e);if(n&&n[0]===r)return n[1];let o={error:km("error",e,r),warn:km("warn",e,r),info:km("info",e,r),debug:km("debug",e,r)};return FE.set(e,[r,o]),o}var Lo=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var id,io=class t{constructor(e,r,n){this.iterator=e,id.set(this,void 0),this.controller=r,ce(this,id,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?$t(n):console;async function*s(){if(o)throw new V("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let c of rF(e,r))if(!a){if(c.data.startsWith("[DONE]")){a=!0;continue}if(c.event===null||!c.event.startsWith("thread.")){let u;try{u=JSON.parse(c.data)}catch(l){throw i.error("Could not parse message into JSON:",c.data),i.error("From chunk:",c.raw),l}if(u&&u.error)throw new Pt(void 0,u.error,void 0,e.headers);yield u}else{let u;try{u=JSON.parse(c.data)}catch(l){throw console.error("Could not parse message into JSON:",c.data),console.error("From chunk:",c.raw),l}if(c.event=="error")throw new Pt(void 0,u.error,u.message,void 0);yield{event:c.event,data:u}}}a=!0}catch(c){if(td(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*i(){let a=new Cs,c=aw(e);for await(let u of c)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*s(){if(o)throw new V("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let c of i())a||c&&(yield JSON.parse(c));a=!0}catch(c){if(td(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}[(id=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let s=n.next();e.push(s),r.push(s)}return i.shift()}});return[new t(()=>o(e),this.controller,S(this,id,"f")),new t(()=>o(r),this.controller,S(this,id,"f"))]}toReadableStream(){let e=this,r;return sw({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:i}=await r.next();if(i)return n.close();let s=$c(JSON.stringify(o)+` +`);n.enqueue(s)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};async function*rF(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new V("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new V("Attempted to iterate over a response with no body");let r=new gw,n=new Cs,o=aw(t.body);for await(let i of nF(o))for(let s of n.decode(i)){let a=r.decode(s);a&&(yield a)}for(let i of n.flush()){let s=r.decode(i);s&&(yield s)}}async function*nF(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?$c(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=UE(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var gw=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(` +`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=oF(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function oF(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function Em(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,s=await(async()=>{if(e.options.stream)return $t(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):io.fromSSEResponse(r,e.controller,t);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let c=r.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){let d=await r.json();return _w(d,r)}return await r.text()})();return $t(t).debug(`[${n}] response parsed`,Lo({retryOfRequestLogID:o,url:r.url,status:r.status,body:s,durationMs:Date.now()-i})),s}function _w(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var sd,Rs=class t extends Promise{constructor(e,r,n=Em){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,sd.set(this,void 0),ce(this,sd,e,"f")}_thenUnwrap(e){return new t(S(this,sd,"f"),this.responsePromise,async(r,n)=>_w(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(S(this,sd,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};sd=new WeakMap;var Am,ad=class{constructor(e,r,n,o){Am.set(this,void 0),ce(this,Am,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new V("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await S(this,Am,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Am=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},cd=class extends Rs{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await Em(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},so=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},ke=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),r=e[e.length-1]?.id;return r?{...this.options,query:{...iw(this.options.query),after:r}}:null}},Uo=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1,this.last_id=n.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.last_id;return e?{...this.options,query:{...iw(this.options.query),after:e}}:null}};var bw=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Ic(t,e,r){return bw(),new File(t,e??"unknown_file",r)}function ud(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}var Om=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",ww=async(t,e)=>yw(t.body)?{...t,body:await ZE(t.body,e)}:t,Hr=async(t,e)=>({...t,body:await ZE(t.body,e)}),BE=new WeakMap;function sF(t){let e=typeof t=="function"?t:t.fetch,r=BE.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new o(i).text()}catch{return!0}})();return BE.set(e,n),n}var ZE=async(t,e)=>{if(!await sF(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>vw(r,n,o))),r},qE=t=>t instanceof Blob&&"name"in t,aF=t=>typeof t=="object"&&t!==null&&(t instanceof Response||Om(t)||qE(t)),yw=t=>{if(aF(t))return!0;if(Array.isArray(t))return t.some(yw);if(t&&typeof t=="object"){for(let e in t)if(yw(t[e]))return!0}return!1},vw=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response)t.append(e,Ic([await r.blob()],ud(r)));else if(Om(r))t.append(e,Ic([await new Response(xm(r)).blob()],ud(r)));else if(qE(r))t.append(e,r,ud(r));else if(Array.isArray(r))await Promise.all(r.map(n=>vw(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>vw(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var VE=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",cF=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&VE(t),uF=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";async function ld(t,e,r){if(bw(),t=await t,cF(t))return t instanceof File?t:Ic([await t.arrayBuffer()],t.name);if(uF(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),Ic(await xw(o),e,r)}let n=await xw(t);if(e||(e=ud(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return Ic(n,e,r)}async function xw(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(VE(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(Om(t))for await(let r of t)e.push(...await xw(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${lF(t)}`)}return e}function lF(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var C=class{constructor(e){this._client=e}};function KE(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var GE=Object.freeze(Object.create(null)),pF=(t=KE)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],s=r.reduce((l,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=n[f],m=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??GE)??GE)?.toString)&&(m=p+"",i.push({start:l.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),l+d+(f===n.length?"":m)},""),a=s.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,u;for(;(u=c.exec(a))!==null;)i.push({start:u.index,length:u[0].length,error:`Value "${u[0]}" can't be safely passed as a path parameter`});if(i.sort((l,d)=>l.start-d.start),i.length>0){let l=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-l),h="^".repeat(p.length);return l=p.start+p.length,f+m+h},"");throw new V(`Path parameters result in path with invalid segments: +${i.map(f=>f.error).join(` +`)} +${s} +${d}`)}return s},O=pF(KE);var Ns=class extends C{list(e,r={},n){return this._client.getAPIList(O`/chat/completions/${e}/messages`,ke,{query:r,...n})}};function dd(t){return t!==void 0&&"function"in t&&t.function!==void 0}function pd(t){return t?.$brand==="auto-parseable-response-format"}function zs(t){return t?.$brand==="auto-parseable-tool"}function HE(t,e){return!e||!$w(e)?{...t,choices:t.choices.map(r=>(JE(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:fd(t,e)}function fd(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new wc;if(n.finish_reason==="content_filter")throw new xc;return JE(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>gF(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?hF(e,n.message.content):null}}});return{...t,choices:r}}function hF(t,e){return t.response_format?.type!=="json_schema"?null:t.response_format?.type==="json_schema"?"$parseRaw"in t.response_format?t.response_format.$parseRaw(e):JSON.parse(e):null}function gF(t,e){let r=t.tools?.find(n=>dd(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:zs(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function WE(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>dd(n)&&n.function?.name===e.function.name);return dd(r)&&(zs(r)||r?.function.strict||!1)}function $w(t){return pd(t.response_format)?!0:t.tools?.some(e=>zs(e)||e.type==="function"&&e.function.strict===!0)??!1}function JE(t){for(let e of t||[])if(e.type!=="function")throw new V(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function XE(t){for(let e of t??[]){if(e.type!=="function")throw new V(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new V(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Sc=t=>t?.role==="assistant",Iw=t=>t?.role==="tool";var Sw,Pm,Cm,md,hd,Rm,gd,Fo,_d,Nm,zm,kc,YE,bi=class{constructor(){Sw.add(this),this.controller=new AbortController,Pm.set(this,void 0),Cm.set(this,()=>{}),md.set(this,()=>{}),hd.set(this,void 0),Rm.set(this,()=>{}),gd.set(this,()=>{}),Fo.set(this,{}),_d.set(this,!1),Nm.set(this,!1),zm.set(this,!1),kc.set(this,!1),ce(this,Pm,new Promise((e,r)=>{ce(this,Cm,e,"f"),ce(this,md,r,"f")}),"f"),ce(this,hd,new Promise((e,r)=>{ce(this,Rm,e,"f"),ce(this,gd,r,"f")}),"f"),S(this,Pm,"f").catch(()=>{}),S(this,hd,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},S(this,Sw,"m",YE).bind(this))},0)}_connected(){this.ended||(S(this,Cm,"f").call(this),this._emit("connect"))}get ended(){return S(this,_d,"f")}get errored(){return S(this,Nm,"f")}get aborted(){return S(this,zm,"f")}abort(){this.controller.abort()}on(e,r){return(S(this,Fo,"f")[e]||(S(this,Fo,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=S(this,Fo,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(S(this,Fo,"f")[e]||(S(this,Fo,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ce(this,kc,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ce(this,kc,!0,"f"),await S(this,hd,"f")}_emit(e,...r){if(S(this,_d,"f"))return;e==="end"&&(ce(this,_d,!0,"f"),S(this,Rm,"f").call(this));let n=S(this,Fo,"f")[e];if(n&&(S(this,Fo,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!S(this,kc,"f")&&!n?.length&&Promise.reject(o),S(this,md,"f").call(this,o),S(this,gd,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!S(this,kc,"f")&&!n?.length&&Promise.reject(o),S(this,md,"f").call(this,o),S(this,gd,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Pm=new WeakMap,Cm=new WeakMap,md=new WeakMap,hd=new WeakMap,Rm=new WeakMap,gd=new WeakMap,Fo=new WeakMap,_d=new WeakMap,Nm=new WeakMap,zm=new WeakMap,kc=new WeakMap,Sw=new WeakSet,YE=function(e){if(ce(this,Nm,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new xt),e instanceof xt)return ce(this,zm,!0,"f"),this._emit("abort",e);if(e instanceof V)return this._emit("error",e);if(e instanceof Error){let r=new V(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new V(String(e)))};function QE(t){return typeof t.parse=="function"}var pr,kw,Mm,Tw,Ew,Aw,eA,tA,_F=10,Tc=class extends bi{constructor(){super(...arguments),pr.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let r=e.choices[0]?.message;return r&&this._addMessage(r),e}_addMessage(e,r=!0){if("content"in e||(e.content=null),this.messages.push(e),r){if(this._emit("message",e),Iw(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(Sc(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionToolCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new V("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),S(this,pr,"m",kw).call(this)}async finalMessage(){return await this.done(),S(this,pr,"m",Mm).call(this)}async finalFunctionToolCall(){return await this.done(),S(this,pr,"m",Tw).call(this)}async finalFunctionToolCallResult(){return await this.done(),S(this,pr,"m",Ew).call(this)}async totalUsage(){return await this.done(),S(this,pr,"m",Aw).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=S(this,pr,"m",Mm).call(this);r&&this._emit("finalMessage",r);let n=S(this,pr,"m",kw).call(this);n&&this._emit("finalContent",n);let o=S(this,pr,"m",Tw).call(this);o&&this._emit("finalFunctionToolCall",o);let i=S(this,pr,"m",Ew).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(s=>s.usage)&&this._emit("totalUsage",S(this,pr,"m",Aw).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,pr,"m",eA).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(fd(i,r))}async _runChatCompletion(e,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,r,n)}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:s,...a}=r,c=typeof i!="string"&&i.type==="function"&&i?.function?.name,{maxChatCompletions:u=_F}=n||{},l=r.tools.map(p=>{if(zs(p)){if(!p.$callback)throw new V("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of l)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?l.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;pJSON.stringify(Z)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:v,content:w});continue}let T;try{T=QE(k)?await k.parse(x):x}catch(w){let Z=w instanceof Error?w.message:String(w);this._addMessage({role:o,tool_call_id:v,content:Z});continue}let F=await k.function(T,this),J=S(this,pr,"m",tA).call(this,F);if(this._addMessage({role:o,tool_call_id:v,content:J}),c)return}}}};pr=new WeakSet,kw=function(){return S(this,pr,"m",Mm).call(this).content??null},Mm=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(Sc(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new V("stream ended without producing a ChatCompletionMessage with role=assistant")},Tw=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Sc(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},Ew=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Iw(r)&&r.content!=null&&typeof r.content=="string"&&this.messages.some(n=>n.role==="assistant"&&n.tool_calls?.some(o=>o.type==="function"&&o.id===r.tool_call_id)))return r.content}},Aw=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:r}of this._chatCompletions)r&&(e.completion_tokens+=r.completion_tokens,e.prompt_tokens+=r.prompt_tokens,e.total_tokens+=r.total_tokens);return e},eA=function(e){if(e.n!=null&&e.n>1)throw new V("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},tA=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};var yd=class t extends Tc{static runTools(e,r,n){let o=new t,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}_addMessage(e,r=!0){super._addMessage(e,r),Sc(e)&&e.content&&this._emit("content",e.content)}};var Mt={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511},Ow=class extends Error{},Pw=class extends Error{};function yF(t,e=Mt.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return vF(t.trim(),e)}var vF=(t,e)=>{let r=t.length,n=0,o=f=>{throw new Ow(`${f} at position ${n}`)},i=f=>{throw new Pw(`${f} at position ${n}`)},s=()=>(d(),n>=r&&o("Unexpected end of input"),t[n]==='"'?a():t[n]==="{"?c():t[n]==="["?u():t.substring(n,n+4)==="null"||Mt.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Mt.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Mt.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Mt.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Mt.MINUS_INFINITY&e&&1{let f=n,p=!1;for(n++;n{n++,d();let f={};try{for(;t[n]!=="}";){if(d(),n>=r&&Mt.OBJ&e)return f;let p=a();d(),n++;try{let m=s();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(Mt.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Mt.OBJ&e)return f;o("Expected '}' at end of object")}return n++,f},u=()=>{n++;let f=[];try{for(;t[n]!=="]";)f.push(s()),d(),t[n]===","&&n++}catch{if(Mt.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},l=()=>{if(n===0){t==="-"&&Mt.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Mt.NUM&e)try{return t[t.length-1]==="."?JSON.parse(t.substring(0,t.lastIndexOf("."))):JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch{}i(String(p))}}let f=n;for(t[n]==="-"&&n++;t[n]&&!",]}".includes(t[n]);)n++;n==r&&!(Mt.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Mt.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;nyF(t,Mt.ALL^Mt.NUM);var Rt,Bo,Ec,wi,Rw,jm,Nw,zw,Mw,Dm,jw,rA,Ms=class t extends Tc{constructor(e){super(),Rt.add(this),Bo.set(this,void 0),Ec.set(this,void 0),wi.set(this,void 0),ce(this,Bo,e,"f"),ce(this,Ec,[],"f")}get currentChatCompletionSnapshot(){return S(this,wi,"f")}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createChatCompletion(e,r,n){let o=new t(r);return o._run(()=>o._runChatCompletion(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(e,r,n){super._createChatCompletion;let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,Rt,"m",Rw).call(this);let i=await e.chat.completions.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let s of i)S(this,Rt,"m",Nw).call(this,s);if(i.controller.signal?.aborted)throw new xt;return this._addChatCompletion(S(this,Rt,"m",Dm).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),S(this,Rt,"m",Rw).call(this),this._connected();let o=io.fromReadableStream(e,this.controller),i;for await(let s of o)i&&i!==s.id&&this._addChatCompletion(S(this,Rt,"m",Dm).call(this)),S(this,Rt,"m",Nw).call(this,s),i=s.id;if(o.controller.signal?.aborted)throw new xt;return this._addChatCompletion(S(this,Rt,"m",Dm).call(this))}[(Bo=new WeakMap,Ec=new WeakMap,wi=new WeakMap,Rt=new WeakSet,Rw=function(){this.ended||ce(this,wi,void 0,"f")},jm=function(r){let n=S(this,Ec,"f")[r.index];return n||(n={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},S(this,Ec,"f")[r.index]=n,n)},Nw=function(r){if(this.ended)return;let n=S(this,Rt,"m",rA).call(this,r);this._emit("chunk",r,n);for(let o of r.choices){let i=n.choices[o.index];o.delta.content!=null&&i.message?.role==="assistant"&&i.message?.content&&(this._emit("content",o.delta.content,i.message.content),this._emit("content.delta",{delta:o.delta.content,snapshot:i.message.content,parsed:i.message.parsed})),o.delta.refusal!=null&&i.message?.role==="assistant"&&i.message?.refusal&&this._emit("refusal.delta",{delta:o.delta.refusal,snapshot:i.message.refusal}),o.logprobs?.content!=null&&i.message?.role==="assistant"&&this._emit("logprobs.content.delta",{content:o.logprobs?.content,snapshot:i.logprobs?.content??[]}),o.logprobs?.refusal!=null&&i.message?.role==="assistant"&&this._emit("logprobs.refusal.delta",{refusal:o.logprobs?.refusal,snapshot:i.logprobs?.refusal??[]});let s=S(this,Rt,"m",jm).call(this,i);i.finish_reason&&(S(this,Rt,"m",Mw).call(this,i),s.current_tool_call_index!=null&&S(this,Rt,"m",zw).call(this,i,s.current_tool_call_index));for(let a of o.delta.tool_calls??[])s.current_tool_call_index!==a.index&&(S(this,Rt,"m",Mw).call(this,i),s.current_tool_call_index!=null&&S(this,Rt,"m",zw).call(this,i,s.current_tool_call_index)),s.current_tool_call_index=a.index;for(let a of o.delta.tool_calls??[]){let c=i.message.tool_calls?.[a.index];c?.type&&(c?.type==="function"?this._emit("tool_calls.function.arguments.delta",{name:c.function?.name,index:a.index,arguments:c.function.arguments,parsed_arguments:c.function.parsed_arguments,arguments_delta:a.function?.arguments??""}):(c?.type,void 0))}}},zw=function(r,n){if(S(this,Rt,"m",jm).call(this,r).done_tool_calls.has(n))return;let i=r.message.tool_calls?.[n];if(!i)throw new Error("no tool call snapshot");if(!i.type)throw new Error("tool call snapshot missing `type`");if(i.type==="function"){let s=S(this,Bo,"f")?.tools?.find(a=>dd(a)&&a.function.name===i.function.name);this._emit("tool_calls.function.arguments.done",{name:i.function.name,index:n,arguments:i.function.arguments,parsed_arguments:zs(s)?s.$parseRaw(i.function.arguments):s?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Mw=function(r){let n=S(this,Rt,"m",jm).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=S(this,Rt,"m",jw).call(this);this._emit("content.done",{content:r.message.content,parsed:o?o.$parseRaw(r.message.content):null})}r.message.refusal&&!n.refusal_done&&(n.refusal_done=!0,this._emit("refusal.done",{refusal:r.message.refusal})),r.logprobs?.content&&!n.logprobs_content_done&&(n.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:r.logprobs.content})),r.logprobs?.refusal&&!n.logprobs_refusal_done&&(n.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:r.logprobs.refusal}))},Dm=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");let r=S(this,wi,"f");if(!r)throw new V("request ended without sending any chunks");return ce(this,wi,void 0,"f"),ce(this,Ec,[],"f"),bF(r,S(this,Bo,"f"))},jw=function(){let r=S(this,Bo,"f")?.response_format;return pd(r)?r:null},rA=function(r){var n,o,i,s;let a=S(this,wi,"f"),{choices:c,...u}=r;a?Object.assign(a,u):a=ce(this,wi,{...u,choices:[]},"f");for(let{delta:l,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=a.choices[f];if(h||(h=a.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:F,refusal:J,...w}=p;Object.assign(h.logprobs,w),F&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...F)),J&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...J))}if(d&&(h.finish_reason=d,S(this,Bo,"f")&&$w(S(this,Bo,"f")))){if(d==="length")throw new wc;if(d==="content_filter")throw new xc}if(Object.assign(h,m),!l)continue;let{content:_,refusal:v,function_call:b,role:x,tool_calls:k,...T}=l;if(Object.assign(h.message,T),v&&(h.message.refusal=(h.message.refusal||"")+v),x&&(h.message.role=x),b&&(h.message.function_call?(b.name&&(h.message.function_call.name=b.name),b.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=b.arguments)):h.message.function_call=b),_&&(h.message.content=(h.message.content||"")+_,!h.message.refusal&&S(this,Rt,"m",jw).call(this)&&(h.message.parsed=Cw(h.message.content))),k){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:F,id:J,type:w,function:Z,...oe}of k){let Q=(s=h.message.tool_calls)[F]??(s[F]={});Object.assign(Q,oe),J&&(Q.id=J),w&&(Q.type=w),Z&&(Q.function??(Q.function={name:Z.name??"",arguments:""})),Z?.name&&(Q.function.name=Z.name),Z?.arguments&&(Q.function.arguments+=Z.arguments,WE(S(this,Bo,"f"),Q)&&(Q.function.parsed_arguments=Cw(Q.function.arguments)))}}}return a},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("chunk",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new io(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function bF(t,e){let{id:r,choices:n,created:o,model:i,system_fingerprint:s,...a}=t,c={...a,id:r,choices:n.map(({message:u,finish_reason:l,index:d,logprobs:f,...p})=>{if(!l)throw new V(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:_,...v}=u,b=u.role;if(!b)throw new V(`missing role for choice ${d}`);if(h){let{arguments:x,name:k}=h;if(x==null)throw new V(`missing function_call.arguments for choice ${d}`);if(!k)throw new V(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:x,name:k},role:b,refusal:u.refusal??null},finish_reason:l,index:d,logprobs:f}}return _?{...p,index:d,finish_reason:l,logprobs:f,message:{...v,role:b,content:m,refusal:u.refusal??null,tool_calls:_.map((x,k)=>{let{function:T,type:F,id:J,...w}=x,{arguments:Z,name:oe,...Q}=T||{};if(J==null)throw new V(`missing choices[${d}].tool_calls[${k}].id +${Lm(t)}`);if(F==null)throw new V(`missing choices[${d}].tool_calls[${k}].type +${Lm(t)}`);if(oe==null)throw new V(`missing choices[${d}].tool_calls[${k}].function.name +${Lm(t)}`);if(Z==null)throw new V(`missing choices[${d}].tool_calls[${k}].function.arguments +${Lm(t)}`);return{...w,id:J,type:F,function:{...Q,name:oe,arguments:Z}}})}}:{...p,message:{...v,content:m,role:b,refusal:u.refusal??null},finish_reason:l,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...s?{system_fingerprint:s}:{}};return HE(c,e)}function Lm(t){return JSON.stringify(t)}var vd=class t extends Ms{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runTools(e,r,n){let o=new t(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}};var Zo=class extends C{constructor(){super(...arguments),this.messages=new Ns(this._client)}create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1})}retrieve(e,r){return this._client.get(O`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(O`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/chat/completions/${e}`,r)}parse(e,r){return XE(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>fd(n,e))}runTools(e,r){return e.stream?vd.runTools(this._client,e,r):yd.runTools(this._client,e,r)}stream(e,r){return Ms.createChatCompletion(this._client,e,r)}};Zo.Messages=Ns;var xi=class extends C{constructor(){super(...arguments),this.completions=new Zo(this._client)}};xi.Completions=Zo;var nA=Symbol("brand.privateNullableHeaders");function*xF(t){if(!t)return;if(nA in t){let{values:n,nulls:o}=t;yield*n.entries();for(let i of o)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():ow(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=ow(n[1])?n[1]:[n[1]],s=!1;for(let a of i)a!==void 0&&(e&&!s&&(s=!0,yield[o,null]),yield[o,a])}}var L=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,s]of xF(n)){let a=i.toLowerCase();o.has(a)||(e.delete(i),o.add(a)),s===null?(e.delete(i),r.add(a)):(e.append(i,s),r.delete(a))}}return{[nA]:!0,values:e,nulls:r}};var Ac=class extends C{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:L([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}};var Oc=class extends C{create(e,r){return this._client.post("/audio/transcriptions",Hr({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}};var Pc=class extends C{create(e,r){return this._client.post("/audio/translations",Hr({body:e,...r,__metadata:{model:e.model}},this._client))}};var ao=class extends C{constructor(){super(...arguments),this.transcriptions=new Oc(this._client),this.translations=new Pc(this._client),this.speech=new Ac(this._client)}};ao.Transcriptions=Oc;ao.Translations=Pc;ao.Speech=Ac;var js=class extends C{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(O`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",ke,{query:e,...r})}cancel(e,r){return this._client.post(O`/batches/${e}/cancel`,r)}};var Cc=class extends C{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/assistants/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/assistants/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",ke,{query:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(O`/assistants/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var Rc=class extends C{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var Nc=class extends C{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var $i=class extends C{constructor(){super(...arguments),this.sessions=new Rc(this._client),this.transcriptionSessions=new Nc(this._client)}};$i.Sessions=Rc;$i.TranscriptionSessions=Nc;var zc=class extends C{create(e,r){return this._client.post("/chatkit/sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}cancel(e,r){return this._client.post(O`/chatkit/sessions/${e}/cancel`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}};var Mc=class extends C{retrieve(e,r){return this._client.get(O`/chatkit/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}list(e={},r){return this._client.getAPIList("/chatkit/threads",Uo,{query:e,...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}delete(e,r){return this._client.delete(O`/chatkit/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}listItems(e,r={},n){return this._client.getAPIList(O`/chatkit/threads/${e}/items`,Uo,{query:r,...n,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers])})}};var Ii=class extends C{constructor(){super(...arguments),this.sessions=new zc(this._client),this.threads=new Mc(this._client)}};Ii.Sessions=zc;Ii.Threads=Mc;var jc=class extends C{create(e,r,n){return this._client.post(O`/threads/${e}/messages`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(O`/threads/${o}/messages/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/messages/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/threads/${e}/messages`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(O`/threads/${o}/messages/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var Dc=class extends C{retrieve(e,r,n){let{thread_id:o,run_id:i,...s}=r;return this._client.get(O`/threads/${o}/runs/${i}/steps/${e}`,{query:s,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r,n){let{thread_id:o,...i}=r;return this._client.getAPIList(O`/threads/${o}/runs/${e}/steps`,ke,{query:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var oA=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()};var Zt,Ls,Dw,co,Um,Nn,Us,Lc,Ds,Zm,Wr,Fm,Bm,xd,bd,wd,iA,sA,aA,cA,uA,lA,dA,qo=class extends bi{constructor(){super(...arguments),Zt.add(this),Dw.set(this,[]),co.set(this,{}),Um.set(this,{}),Nn.set(this,void 0),Us.set(this,void 0),Lc.set(this,void 0),Ds.set(this,void 0),Zm.set(this,void 0),Wr.set(this,void 0),Fm.set(this,void 0),Bm.set(this,void 0),xd.set(this,void 0)}[(Dw=new WeakMap,co=new WeakMap,Um=new WeakMap,Nn=new WeakMap,Us=new WeakMap,Lc=new WeakMap,Ds=new WeakMap,Zm=new WeakMap,Wr=new WeakMap,Fm=new WeakMap,Bm=new WeakMap,xd=new WeakMap,Zt=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new Ls;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=io.fromReadableStream(e,this.controller);for await(let i of o)S(this,Zt,"m",bd).call(this,i);if(o.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}toReadableStream(){return new io(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new Ls;return i._run(()=>i._runToolAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...n,stream:!0},a=await e.submitToolOutputs(r,s,{...o,signal:this.controller.signal});this._connected();for await(let c of a)S(this,Zt,"m",bd).call(this,c);if(a.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}static createThreadAssistantStream(e,r,n){let o=new Ls;return o._run(()=>o._threadAssistantStream(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,r,n,o){let i=new Ls;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return S(this,Fm,"f")}currentRun(){return S(this,Bm,"f")}currentMessageSnapshot(){return S(this,Nn,"f")}currentRunStepSnapshot(){return S(this,xd,"f")}async finalRunSteps(){return await this.done(),Object.values(S(this,co,"f"))}async finalMessages(){return await this.done(),Object.values(S(this,Um,"f"))}async finalRun(){if(await this.done(),!S(this,Us,"f"))throw Error("Final run was not received.");return S(this,Us,"f")}async _createThreadAssistantStream(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));let i={...r,stream:!0},s=await e.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let a of s)S(this,Zt,"m",bd).call(this,a);if(s.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}async _createAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...n,stream:!0},a=await e.create(r,s,{...o,signal:this.controller.signal});this._connected();for await(let c of a)S(this,Zt,"m",bd).call(this,c);if(a.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}static accumulateDelta(e,r){for(let[n,o]of Object.entries(r)){if(!e.hasOwnProperty(n)){e[n]=o;continue}let i=e[n];if(i==null){e[n]=o;continue}if(n==="index"||n==="type"){e[n]=o;continue}if(typeof i=="string"&&typeof o=="string")i+=o;else if(typeof i=="number"&&typeof o=="number")i+=o;else if(nd(i)&&nd(o))i=this.accumulateDelta(i,o);else if(Array.isArray(i)&&Array.isArray(o)){if(i.every(s=>typeof s=="string"||typeof s=="number")){i.push(...o);continue}for(let s of o){if(!nd(s))throw new Error(`Expected array delta entry to be an object but got: ${s}`);let a=s.index;if(a==null)throw console.error(s),new Error("Expected array delta entry to have an `index` property");if(typeof a!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${a}`);let c=i[a];c==null?i.push(s):i[a]=this.accumulateDelta(c,s)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${o}, accValue: ${i}`);e[n]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,r,n){return await this._createThreadAssistantStream(r,e,n)}async _runAssistantStream(e,r,n,o){return await this._createAssistantStream(r,e,n,o)}async _runToolAssistantStream(e,r,n,o){return await this._createToolAssistantStream(r,e,n,o)}};Ls=qo,bd=function(e){if(!this.ended)switch(ce(this,Fm,e,"f"),S(this,Zt,"m",aA).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":S(this,Zt,"m",dA).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":S(this,Zt,"m",sA).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":S(this,Zt,"m",iA).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},wd=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");if(!S(this,Us,"f"))throw Error("Final run has not been received");return S(this,Us,"f")},iA=function(e){let[r,n]=S(this,Zt,"m",uA).call(this,e,S(this,Nn,"f"));ce(this,Nn,r,"f"),S(this,Um,"f")[r.id]=r;for(let o of n){let i=r.content[o.index];i?.type=="text"&&this._emit("textCreated",i.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,r),e.data.delta.content)for(let o of e.data.delta.content){if(o.type=="text"&&o.text){let i=o.text,s=r.content[o.index];if(s&&s.type=="text")this._emit("textDelta",i,s.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(o.index!=S(this,Lc,"f")){if(S(this,Ds,"f"))switch(S(this,Ds,"f").type){case"text":this._emit("textDone",S(this,Ds,"f").text,S(this,Nn,"f"));break;case"image_file":this._emit("imageFileDone",S(this,Ds,"f").image_file,S(this,Nn,"f"));break}ce(this,Lc,o.index,"f")}ce(this,Ds,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(S(this,Lc,"f")!==void 0){let o=e.data.content[S(this,Lc,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,S(this,Nn,"f"));break;case"text":this._emit("textDone",o.text,S(this,Nn,"f"));break}}S(this,Nn,"f")&&this._emit("messageDone",e.data),ce(this,Nn,void 0,"f")}},sA=function(e){let r=S(this,Zt,"m",cA).call(this,e);switch(ce(this,xd,r,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let n=e.data.delta;if(n.step_details&&n.step_details.type=="tool_calls"&&n.step_details.tool_calls&&r.step_details.type=="tool_calls")for(let i of n.step_details.tool_calls)i.index==S(this,Zm,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(S(this,Wr,"f")&&this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Zm,i.index,"f"),ce(this,Wr,r.step_details.tool_calls[i.index],"f"),S(this,Wr,"f")&&this._emit("toolCallCreated",S(this,Wr,"f")));this._emit("runStepDelta",e.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":ce(this,xd,void 0,"f"),e.data.step_details.type=="tool_calls"&&S(this,Wr,"f")&&(this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Wr,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},aA=function(e){S(this,Dw,"f").push(e),this._emit("event",e)},cA=function(e){switch(e.event){case"thread.run.step.created":return S(this,co,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=S(this,co,"f")[e.data.id];if(!r)throw Error("Received a RunStepDelta before creation of a snapshot");let n=e.data;if(n.delta){let o=Ls.accumulateDelta(r,n.delta);S(this,co,"f")[e.data.id]=o}return S(this,co,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":S(this,co,"f")[e.data.id]=e.data;break}if(S(this,co,"f")[e.data.id])return S(this,co,"f")[e.data.id];throw new Error("No snapshot available")},uA=function(e,r){let n=[];switch(e.event){case"thread.message.created":return[e.data,n];case"thread.message.delta":if(!r)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let o=e.data;if(o.delta.content)for(let i of o.delta.content)if(i.index in r.content){let s=r.content[i.index];r.content[i.index]=S(this,Zt,"m",lA).call(this,i,s)}else r.content[i.index]=i,n.push(i);return[r,n];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(r)return[r,n];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},lA=function(e,r){return Ls.accumulateDelta(r,e)},dA=function(e){switch(ce(this,Bm,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":ce(this,Us,e.data,"f"),S(this,Wr,"f")&&(this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Wr,void 0,"f"));break;case"thread.run.cancelling":break}};var Fs=class extends C{constructor(){super(...arguments),this.steps=new Dc(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(O`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(O`/threads/${o}/runs/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/runs/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/threads/${e}/runs`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(O`/threads/${o}/runs/${e}/cancel`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(o.id,{thread_id:e},n)}createAndStream(e,r,n){return qo.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(e,r,{...n,headers:{...n?.headers,...o}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return qo.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}async submitToolOutputsAndPoll(e,r,n){let o=await this.submitToolOutputs(e,r,n);return await this.poll(o.id,r,n)}submitToolOutputsStream(e,r,n){return qo.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};Fs.Steps=Dc;var ki=class extends C{constructor(){super(...arguments),this.runs=new Fs(this._client),this.messages=new jc(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/threads/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete(O`/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:e.stream??!1})}async createAndRunPoll(e,r){let n=await this.createAndRun(e,r);return await this.runs.poll(n.id,{thread_id:n.thread_id},r)}createAndRunStream(e,r){return qo.createThreadAssistantStream(e,this._client.beta.threads,r)}};ki.Runs=Fs;ki.Messages=jc;var zn=class extends C{constructor(){super(...arguments),this.realtime=new $i(this._client),this.chatkit=new Ii(this._client),this.assistants=new Cc(this._client),this.threads=new ki(this._client)}};zn.Realtime=$i;zn.ChatKit=Ii;zn.Assistants=Cc;zn.Threads=ki;var Bs=class extends C{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}};var Uc=class extends C{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(O`/containers/${o}/files/${e}/content`,{...n,headers:L([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}};var Zs=class extends C{constructor(){super(...arguments),this.content=new Uc(this._client)}create(e,r,n){return this._client.post(O`/containers/${e}/files`,Hr({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(O`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList(O`/containers/${e}/files`,ke,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(O`/containers/${o}/files/${e}`,{...n,headers:L([{Accept:"*/*"},n?.headers])})}};Zs.Content=Uc;var Ti=class extends C{constructor(){super(...arguments),this.files=new Zs(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get(O`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/containers/${e}`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}};Ti.Files=Zs;var Fc=class extends C{create(e,r,n){let{include:o,...i}=r;return this._client.post(O`/conversations/${e}/items`,{query:{include:o},body:i,...n})}retrieve(e,r,n){let{conversation_id:o,...i}=r;return this._client.get(O`/conversations/${o}/items/${e}`,{query:i,...n})}list(e,r={},n){return this._client.getAPIList(O`/conversations/${e}/items`,Uo,{query:r,...n})}delete(e,r,n){let{conversation_id:o}=r;return this._client.delete(O`/conversations/${o}/items/${e}`,n)}};var Ei=class extends C{constructor(){super(...arguments),this.items=new Fc(this._client)}create(e={},r){return this._client.post("/conversations",{body:e,...r})}retrieve(e,r){return this._client.get(O`/conversations/${e}`,r)}update(e,r,n){return this._client.post(O`/conversations/${e}`,{body:r,...n})}delete(e,r){return this._client.delete(O`/conversations/${e}`,r)}};Ei.Items=Fc;var qs=class extends C{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&$t(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:($t(this._client).debug("embeddings/decoding base64 embeddings from base64"),i._thenUnwrap(s=>(s&&s.data&&s.data.forEach(a=>{let c=a.embedding;a.embedding=oA(c)}),s)))}};var Bc=class extends C{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get(O`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList(O`/evals/${o}/runs/${e}/output_items`,ke,{query:i,...n})}};var Vs=class extends C{constructor(){super(...arguments),this.outputItems=new Bc(this._client)}create(e,r,n){return this._client.post(O`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(O`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList(O`/evals/${e}/runs`,ke,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(O`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(O`/evals/${o}/runs/${e}`,n)}};Vs.OutputItems=Bc;var Ai=class extends C{constructor(){super(...arguments),this.runs=new Vs(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(O`/evals/${e}`,r)}update(e,r,n){return this._client.post(O`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/evals/${e}`,r)}};Ai.Runs=Vs;var Gs=class extends C{create(e,r){return this._client.post("/files",Hr({body:e,...r},this._client))}retrieve(e,r){return this._client.get(O`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/files/${e}`,r)}content(e,r){return this._client.get(O`/files/${e}/content`,{...r,headers:L([{Accept:"application/binary"},r?.headers]),__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:n=1800*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),s=await this.retrieve(e);for(;!s.status||!o.has(s.status);)if(await no(r),s=await this.retrieve(e),Date.now()-i>n)throw new Do({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return s}};var Zc=class extends C{};var qc=class extends C{run(e,r){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...r})}validate(e,r){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...r})}};var Ks=class extends C{constructor(){super(...arguments),this.graders=new qc(this._client)}};Ks.Graders=qc;var Vc=class extends C{create(e,r,n){return this._client.getAPIList(O`/fine_tuning/checkpoints/${e}/permissions`,so,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get(O`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(O`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}};var Hs=class extends C{constructor(){super(...arguments),this.permissions=new Vc(this._client)}};Hs.Permissions=Vc;var Gc=class extends C{list(e,r={},n){return this._client.getAPIList(O`/fine_tuning/jobs/${e}/checkpoints`,ke,{query:r,...n})}};var Ws=class extends C{constructor(){super(...arguments),this.checkpoints=new Gc(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(O`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",ke,{query:e,...r})}cancel(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList(O`/fine_tuning/jobs/${e}/events`,ke,{query:r,...n})}pause(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/resume`,r)}};Ws.Checkpoints=Gc;var Mn=class extends C{constructor(){super(...arguments),this.methods=new Zc(this._client),this.jobs=new Ws(this._client),this.checkpoints=new Hs(this._client),this.alpha=new Ks(this._client)}};Mn.Methods=Zc;Mn.Jobs=Ws;Mn.Checkpoints=Hs;Mn.Alpha=Ks;var Kc=class extends C{};var Oi=class extends C{constructor(){super(...arguments),this.graderModels=new Kc(this._client)}};Oi.GraderModels=Kc;var Js=class extends C{createVariation(e,r){return this._client.post("/images/variations",Hr({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",Hr({body:e,...r,stream:e.stream??!1},this._client))}generate(e,r){return this._client.post("/images/generations",{body:e,...r,stream:e.stream??!1})}};var Xs=class extends C{retrieve(e,r){return this._client.get(O`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",so,e)}delete(e,r){return this._client.delete(O`/models/${e}`,r)}};var Ys=class extends C{create(e,r){return this._client.post("/moderations",{body:e,...r})}};var Hc=class extends C{accept(e,r,n){return this._client.post(O`/realtime/calls/${e}/accept`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}hangup(e,r){return this._client.post(O`/realtime/calls/${e}/hangup`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}refer(e,r,n){return this._client.post(O`/realtime/calls/${e}/refer`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}reject(e,r={},n){return this._client.post(O`/realtime/calls/${e}/reject`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}};var Wc=class extends C{create(e,r){return this._client.post("/realtime/client_secrets",{body:e,...r})}};var Vo=class extends C{constructor(){super(...arguments),this.clientSecrets=new Wc(this._client),this.calls=new Hc(this._client)}};Vo.ClientSecrets=Wc;Vo.Calls=Hc;function pA(t,e){return!e||!QF(e)?{...t,output_parsed:null,output:t.output.map(r=>r.type==="function_call"?{...r,parsed_arguments:null}:r.type==="message"?{...r,content:r.content.map(n=>({...n,parsed:null}))}:r)}:Lw(t,e)}function Lw(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:rB(e,o)};if(o.type==="message"){let i=o.content.map(s=>s.type==="output_text"?{...s,parsed:YF(e,s.text)}:s);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||qm(n),Object.defineProperty(n,"output_parsed",{enumerable:!0,get(){for(let o of n.output)if(o.type==="message"){for(let i of o.content)if(i.type==="output_text"&&i.parsed!==null)return i.parsed}return null}}),n}function YF(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function QF(t){return!!pd(t.text?.format)}function eB(t){return t?.$brand==="auto-parseable-tool"}function tB(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function rB(t,e){let r=tB(t.tools??[],e.name);return{...e,...e,parsed_arguments:eB(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function qm(t){let e=[];for(let r of t.output)if(r.type==="message")for(let n of r.content)n.type==="output_text"&&e.push(n.text);t.output_text=e.join("")}var Jc,Vm,Pi,Gm,fA,mA,hA,gA,Km=class t extends bi{constructor(e){super(),Jc.add(this),Vm.set(this,void 0),Pi.set(this,void 0),Gm.set(this,void 0),ce(this,Vm,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createOrRetrieveResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createOrRetrieveResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,Jc,"m",fA).call(this);let i,s=null;"response_id"in r?(i=await e.responses.retrieve(r.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),s=r.starting_after??null):i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(let a of i)S(this,Jc,"m",mA).call(this,a,s);if(i.controller.signal?.aborted)throw new xt;return S(this,Jc,"m",hA).call(this)}[(Vm=new WeakMap,Pi=new WeakMap,Gm=new WeakMap,Jc=new WeakSet,fA=function(){this.ended||ce(this,Pi,void 0,"f")},mA=function(r,n){if(this.ended)return;let o=(s,a)=>{(n==null||a.sequence_number>n)&&this._emit(s,a)},i=S(this,Jc,"m",gA).call(this,r);switch(o("event",r),r.type){case"response.output_text.delta":{let s=i.output[r.output_index];if(!s)throw new V(`missing output at index ${r.output_index}`);if(s.type==="message"){let a=s.content[r.content_index];if(!a)throw new V(`missing content at index ${r.content_index}`);if(a.type!=="output_text")throw new V(`expected content to be 'output_text', got ${a.type}`);o("response.output_text.delta",{...r,snapshot:a.text})}break}case"response.function_call_arguments.delta":{let s=i.output[r.output_index];if(!s)throw new V(`missing output at index ${r.output_index}`);s.type==="function_call"&&o("response.function_call_arguments.delta",{...r,snapshot:s.arguments});break}default:o(r.type,r);break}},hA=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");let r=S(this,Pi,"f");if(!r)throw new V("request ended without sending any events");ce(this,Pi,void 0,"f");let n=nB(r,S(this,Vm,"f"));return ce(this,Gm,n,"f"),n},gA=function(r){let n=S(this,Pi,"f");if(!n){if(r.type!=="response.created")throw new V(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=ce(this,Pi,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);let i=o.type,s=r.part;i==="message"&&s.type!=="reasoning_text"?o.content.push(s):i==="reasoning"&&s.type==="reasoning_text"&&(o.content||(o.content=[]),o.content.push(s));break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new V(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new V(`expected content to be 'output_text', got ${i.type}`);i.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.reasoning_text.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);if(o.type==="reasoning"){let i=o.content?.[r.content_index];if(!i)throw new V(`missing content at index ${r.content_index}`);if(i.type!=="reasoning_text")throw new V(`expected content to be 'reasoning_text', got ${i.type}`);i.text+=r.delta}break}case"response.completed":{ce(this,Pi,r.response,"f");break}}return n},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=S(this,Gm,"f");if(!e)throw new V("stream ended without producing a ChatCompletion");return e}};function nB(t,e){return pA(t,e)}var Xc=class extends C{list(e,r={},n){return this._client.getAPIList(O`/responses/${e}/input_items`,ke,{query:r,...n})}};var Yc=class extends C{count(e={},r){return this._client.post("/responses/input_tokens",{body:e,...r})}};var Go=class extends C{constructor(){super(...arguments),this.inputItems=new Xc(this._client),this.inputTokens=new Yc(this._client)}create(e,r){return this._client.post("/responses",{body:e,...r,stream:e.stream??!1})._thenUnwrap(n=>("object"in n&&n.object==="response"&&qm(n),n))}retrieve(e,r={},n){return this._client.get(O`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&qm(o),o))}delete(e,r){return this._client.delete(O`/responses/${e}`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>Lw(n,e))}stream(e,r){return Km.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(O`/responses/${e}/cancel`,r)}compact(e={},r){return this._client.post("/responses/compact",{body:e,...r})}};Go.InputItems=Xc;Go.InputTokens=Yc;var Qc=class extends C{create(e,r,n){return this._client.post(O`/uploads/${e}/parts`,Hr({body:r,...n},this._client))}};var Ci=class extends C{constructor(){super(...arguments),this.parts=new Qc(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(O`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(O`/uploads/${e}/complete`,{body:r,...n})}};Ci.Parts=Qc;var _A=async t=>{let e=await Promise.allSettled(t),r=e.filter(o=>o.status==="rejected");if(r.length){for(let o of r)console.error(o.reason);throw new Error(`${r.length} promise(s) failed - see the above errors`)}let n=[];for(let o of e)o.status==="fulfilled"&&n.push(o.value);return n};var eu=class extends C{create(e,r,n){return this._client.post(O`/vector_stores/${e}/file_batches`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(O`/vector_stores/${o}/file_batches/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{vector_store_id:o}=r;return this._client.post(O`/vector_stores/${o}/file_batches/${e}/cancel`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r);return await this.poll(e,o.id,n)}listFiles(e,r,n){let{vector_store_id:o,...i}=r;return this._client.getAPIList(O`/vector_stores/${o}/file_batches/${e}/files`,ke,{query:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse();switch(i.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,s=Math.min(i,r.length),a=this._client,c=r.values(),u=[...n];async function l(f){for(let p of f){let m=await a.files.create({file:p,purpose:"assistants"},o);u.push(m.id)}}let d=Array(s).fill(c).map(l);return await _A(d),await this.createAndPoll(e,{file_ids:u})}};var tu=class extends C{create(e,r,n){return this._client.post(O`/vector_stores/${e}/files`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(O`/vector_stores/${o}/files/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{vector_store_id:o,...i}=r;return this._client.post(O`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/vector_stores/${e}/files`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{vector_store_id:o}=r;return this._client.delete(O`/vector_stores/${o}/files/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse(),s=i.data;switch(s.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=i.response.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"failed":case"completed":return s}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}content(e,r,n){let{vector_store_id:o}=r;return this._client.getAPIList(O`/vector_stores/${o}/files/${e}/content`,so,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var Ko=class extends C{constructor(){super(...arguments),this.files=new tu(this._client),this.fileBatches=new eu(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/vector_stores/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/vector_stores/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",ke,{query:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(O`/vector_stores/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList(O`/vector_stores/${e}/search`,so,{body:r,method:"post",...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};Ko.Files=tu;Ko.FileBatches=eu;var Qs=class extends C{create(e,r){return this._client.post("/videos",ww({body:e,...r},this._client))}retrieve(e,r){return this._client.get(O`/videos/${e}`,r)}list(e={},r){return this._client.getAPIList("/videos",Uo,{query:e,...r})}delete(e,r){return this._client.delete(O`/videos/${e}`,r)}downloadContent(e,r={},n){return this._client.get(O`/videos/${e}/content`,{query:r,...n,headers:L([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}remix(e,r,n){return this._client.post(O`/videos/${e}/remix`,ww({body:r,...n},this._client))}};var ru,yA,Hm,ea=class extends C{constructor(){super(...arguments),ru.add(this)}async unwrap(e,r,n=this._client.webhookSecret,o=300){return await this.verifySignature(e,r,n,o),JSON.parse(e)}async verifySignature(e,r,n=this._client.webhookSecret,o=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");S(this,ru,"m",yA).call(this,n);let i=L([r]).values,s=S(this,ru,"m",Hm).call(this,i,"webhook-signature"),a=S(this,ru,"m",Hm).call(this,i,"webhook-timestamp"),c=S(this,ru,"m",Hm).call(this,i,"webhook-id"),u=parseInt(a,10);if(isNaN(u))throw new ro("Invalid webhook timestamp format");let l=Math.floor(Date.now()/1e3);if(l-u>o)throw new ro("Webhook timestamp is too old");if(u>l+o)throw new ro("Webhook timestamp is too new");let d=s.split(" ").map(h=>h.startsWith("v1,")?h.substring(3):h),f=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),p=c?`${c}.${a}.${e}`:`${a}.${e}`,m=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let h of d)try{let _=Buffer.from(h,"base64");if(await crypto.subtle.verify("HMAC",m,_,new TextEncoder().encode(p)))return}catch{continue}throw new ro("The given webhook signature does not match the expected signature")}};ru=new WeakSet,yA=function(e){if(typeof e!="string"||e.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},Hm=function(e,r){if(!e)throw new Error("Headers are required");let n=e.get(r);if(n==null)throw new Error(`Missing required header: ${r}`);return n};var Uw,Fw,Wm,vA,fe=class{constructor({baseURL:e=Si("OPENAI_BASE_URL"),apiKey:r=Si("OPENAI_API_KEY"),organization:n=Si("OPENAI_ORG_ID")??null,project:o=Si("OPENAI_PROJECT_ID")??null,webhookSecret:i=Si("OPENAI_WEBHOOK_SECRET")??null,...s}={}){if(Uw.add(this),Wm.set(this,void 0),this.completions=new Bs(this),this.chat=new xi(this),this.embeddings=new qs(this),this.files=new Gs(this),this.images=new Js(this),this.audio=new ao(this),this.moderations=new Ys(this),this.models=new Xs(this),this.fineTuning=new Mn(this),this.graders=new Oi(this),this.vectorStores=new Ko(this),this.webhooks=new ea(this),this.beta=new zn(this),this.batches=new js(this),this.uploads=new Ci(this),this.responses=new Go(this),this.realtime=new Vo(this),this.conversations=new Ei(this),this.evals=new Ai(this),this.containers=new Ti(this),this.videos=new Qs(this),r===void 0)throw new V("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");let a={apiKey:r,organization:n,project:o,webhookSecret:i,...s,baseURL:e||"https://api.openai.com/v1"};if(!a.dangerouslyAllowBrowser&&kE())throw new V(`It looks like you're running in a browser-like environment. + +This is disabled by default, as it risks exposing your secret API credentials to attackers. +If you understand the risks and have appropriate mitigations in place, +you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g., + +new OpenAI({ apiKey, dangerouslyAllowBrowser: true }); + +https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety +`);this.baseURL=a.baseURL,this.timeout=a.timeout??Fw.DEFAULT_TIMEOUT,this.logger=a.logger??console;let c="warn";this.logLevel=c,this.logLevel=hw(a.logLevel,"ClientOptions.logLevel",this)??hw(Si("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??c,this.fetchOptions=a.fetchOptions,this.maxRetries=a.maxRetries??2,this.fetch=a.fetch??EE(),ce(this,Wm,OE,"f"),this._options=a,this.apiKey=typeof r=="string"?r:"Missing Key",this.organization=n,this.project=o,this.webhookSecret=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return L([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return fw(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${vi}`}defaultIdempotencyKey(){return`stainless-node-retry-${nw()}`}makeStatusError(e,r,n,o){return Pt.generate(e,r,n,o)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(n){throw n instanceof V?n:new V(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new V(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let o=!S(this,Uw,"m",vA).call(this)&&n||this.baseURL,i=yE(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery();return vE(s)||(r={...s,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}async prepareOptions(e){await this._callApiKey()}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(o=>({method:e,path:r,...o})))}request(e,r=null){return new Rs(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,i=o.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(o);let{req:s,url:a,timeout:c}=await this.buildRequest(o,{retryCount:i-r});await this.prepareRequest(s,{url:a,options:o});let u="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),l=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if($t(this).debug(`[${u}] sending request`,Lo({retryOfRequestLogID:n,method:o.method,url:a,options:o,headers:s.headers})),o.signal?.aborted)throw new xt;let f=new AbortController,p=await this.fetchWithTimeout(a,s,c,f).catch(rd),m=Date.now();if(p instanceof globalThis.Error){let v=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new xt;let b=td(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return $t(this).info(`[${u}] connection ${b?"timed out":"failed"} - ${v}`),$t(this).debug(`[${u}] connection ${b?"timed out":"failed"} (${v})`,Lo({retryOfRequestLogID:n,url:a,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??u);throw $t(this).info(`[${u}] connection ${b?"timed out":"failed"} - error; no more retries left`),$t(this).debug(`[${u}] connection ${b?"timed out":"failed"} (error; no more retries left)`,Lo({retryOfRequestLogID:n,url:a,durationMs:m-d,message:p.message})),b?new Do:new yi({cause:p})}let h=[...p.headers.entries()].filter(([v])=>v==="x-request-id").map(([v,b])=>", "+v+": "+JSON.stringify(b)).join(""),_=`[${u}${l}${h}] ${s.method} ${a} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let v=await this.shouldRetry(p);if(r&&v){let J=`retrying, ${r} attempts remaining`;return await AE(p.body),$t(this).info(`${_} - ${J}`),$t(this).debug(`[${u}] response error (${J})`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??u,p.headers)}let b=v?"error; no more retries left":"error; not retryable";$t(this).info(`${_} - ${b}`);let x=await p.text().catch(J=>rd(J).message),k=xE(x),T=k?void 0:x;throw $t(this).debug(`[${u}] response error (${b})`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:T,durationMs:Date.now()-d})),this.makeStatusError(p.status,k,T,p.headers)}return $t(this).info(_),$t(this).debug(`[${u}] response start`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),{response:p,options:o,controller:f,requestLogID:u,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new cd(this,n,e)}async fetchWithTimeout(e,r,n,o){let{signal:i,method:s,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let c=setTimeout(()=>o.abort(),n),u=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,l={signal:o.signal,...u?{duplex:"half"}:{},method:"GET",...a};s&&(l.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,l)}finally{clearTimeout(c)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,o){let i,s=o?.get("retry-after-ms");if(s){let c=parseFloat(s);Number.isNaN(c)||(i=c)}let a=o?.get("retry-after");if(a&&!i){let c=parseFloat(a);Number.isNaN(c)?i=Date.parse(a)-Date.now():i=c*1e3}if(!(i&&0<=i&&i<60*1e3)){let c=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,c)}return await no(i),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,s=Math.min(.5*Math.pow(2,i),8),a=1-Math.random()*.25;return s*a*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:s,defaultBaseURL:a}=n,c=this.buildURL(i,s,a);"timeout"in n&&wE("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:u,body:l}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:u,retryCount:r});return{req:{method:o,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:c,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let s=L([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...TE(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=L([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:xm(e)}:S(this,Wm,"f").call(this,{body:e,headers:n})}};Fw=fe,Wm=new WeakMap,Uw=new WeakSet,vA=function(){return this.baseURL!=="https://api.openai.com/v1"};fe.OpenAI=Fw;fe.DEFAULT_TIMEOUT=6e5;fe.OpenAIError=V;fe.APIError=Pt;fe.APIConnectionError=yi;fe.APIConnectionTimeoutError=Do;fe.APIUserAbortError=xt;fe.NotFoundError=gc;fe.ConflictError=_c;fe.RateLimitError=vc;fe.BadRequestError=fc;fe.AuthenticationError=mc;fe.InternalServerError=bc;fe.PermissionDeniedError=hc;fe.UnprocessableEntityError=yc;fe.InvalidWebhookSignatureError=ro;fe.toFile=ld;fe.Completions=Bs;fe.Chat=xi;fe.Embeddings=qs;fe.Files=Gs;fe.Images=Js;fe.Audio=ao;fe.Moderations=Ys;fe.Models=Xs;fe.FineTuning=Mn;fe.Graders=Oi;fe.VectorStores=Ko;fe.Webhooks=ea;fe.Beta=zn;fe.Batches=js;fe.Uploads=Ci;fe.Responses=Go;fe.Realtime=Vo;fe.Conversations=Ei;fe.Evals=Ai;fe.Containers=Ti;fe.Videos=Qs;var lB=Object.defineProperty,G=(t,e)=>{for(var r in e)lB(t,r,{get:e[r],enumerable:!0})};function Jr(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function nu(t){return Jr(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function ou(t){return Jr(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function bA(t){return Jr(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function Jm(t){return Jr(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function Xm(t){if(Jr(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function Ym(t){let e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);let r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);let o={};for(let i of t.split(";").slice(1)){let s=i.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);let a=s[0].trim(),c=s[1].trim();if(a==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);o[a]=c}return{type:r,subtype:n,parameters:o}}function ta({dataUrl:t,asTypedArray:e=!1}){let r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let o=e?Uint8Array.from(atob(r[2]),i=>i.charCodeAt(0)):r[2];return{mime_type:n,data:o}}}function $d(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}function Qm(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var OA=mn(xA(),1),_B=mn(AA(),1);function PA(t,e){return e?.[t]||(0,OA.default)(t)}function CA(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var yB={};G(yB,{Serializable:()=>uo,get_lc_unique_name:()=>eh});function RA(t){return Array.isArray(t)?[...t]:{...t}}function vB(t,e){let r=RA(t);for(let[n,o]of Object.entries(e)){let[i,...s]=n.split(".").reverse(),a=r;for(let c of s.reverse()){if(a[c]===void 0)break;a[c]=RA(a[c]),a=a[c]}a[i]!==void 0&&(a[i]={lc:1,type:"secret",id:[o]})}return r}function eh(t){let e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var uo=class NA{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eh(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof NA||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((o,i)=>(o[i]=i in this?this[i]:this.lc_kwargs[i],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(e,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));return Object.keys(r).forEach(o=>{let i=this,s=n,[a,...c]=o.split(".").reverse();for(let u of c.reverse()){if(!(u in i)||i[u]===void 0)return;(!(u in s)||s[u]===void 0)&&(typeof i[u]=="object"&&i[u]!=null?s[u]={}:Array.isArray(i[u])&&(s[u]=[])),i=i[u],s=s[u]}a in i&&i[a]!==void 0&&(s[a]=s[a]||i[a])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:CA(Object.keys(r).length?vB(n,r):n,PA,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function re(t,e){return me(t)&&t.type===e}function me(t){return typeof t=="object"&&t!==null}function Ar(t){return Array.isArray(t)}function K(t){return typeof t=="string"}function Xr(t){return typeof t=="number"}function th(t){return t instanceof Uint8Array}function qw(t){try{return JSON.parse(t)}catch{return}}var Ho=t=>t();function bB(t){if(t.type==="char_location"&&K(t.document_title)&&Xr(t.start_char_index)&&Xr(t.end_char_index)&&K(t.cited_text)){let{document_title:e,start_char_index:r,end_char_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"char",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="page_location"&&K(t.document_title)&&Xr(t.start_page_number)&&Xr(t.end_page_number)&&K(t.cited_text)){let{document_title:e,start_page_number:r,end_page_number:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"page",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="content_block_location"&&K(t.document_title)&&Xr(t.start_block_index)&&Xr(t.end_block_index)&&K(t.cited_text)){let{document_title:e,start_block_index:r,end_block_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"block",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="web_search_result_location"&&K(t.url)&&K(t.title)&&K(t.encrypted_index)&&K(t.cited_text)){let{url:e,title:r,encrypted_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"url",url:e,title:r,startIndex:Number(n),endIndex:Number(n),citedText:o}}if(t.type==="search_result_location"&&K(t.source)&&K(t.title)&&Xr(t.start_block_index)&&Xr(t.end_block_index)&&K(t.cited_text)){let{source:e,title:r,start_block_index:n,end_block_index:o,cited_text:i,...s}=t;return{...s,type:"citation",source:"search",url:e,title:r??void 0,startIndex:n,endIndex:o,citedText:i}}}function MA(t){if(re(t,"document")&&me(t.source)&&"type"in t.source){if(t.source.type==="base64"&&K(t.source.media_type)&&K(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&K(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&K(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&K(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(re(t,"image")&&me(t.source)&&"type"in t.source){if(t.source.type==="base64"&&K(t.source.media_type)&&K(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&K(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&K(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function jA(t){function*e(){for(let r of t){let n=MA(r);n?yield n:yield r}}return Array.from(e())}function zA(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"text")&&K(n.text)){let{text:o,citations:i,...s}=n;if(Ar(i)&&i.length){let a=i.reduce((c,u)=>{let l=bB(u);return l?[...c,l]:c},[]);yield{...s,type:"text",text:o,annotations:a};continue}else{yield{...s,type:"text",text:o};continue}}else if(re(n,"thinking")&&K(n.thinking)){let{thinking:o,signature:i,...s}=n;yield{...s,type:"reasoning",reasoning:o,signature:i};continue}else if(re(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(re(n,"tool_use")&&K(n.name)&&K(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(re(n,"input_json_delta")){if(wB(t)&&t.tool_call_chunks?.length){let o=t.tool_call_chunks[0];yield{type:"tool_call_chunk",id:o.id,name:o.name,args:o.args,index:o.index};continue}}else if(re(n,"server_tool_use")&&K(n.name)&&K(n.id)){let{name:o,id:i}=n;if(o==="web_search"){let s=Ho(()=>{if(typeof n.input=="string")return n.input;if(me(n.input)&&K(n.input.query))return n.input.query;if(K(n.partial_json)){let a=qw(n.partial_json);if(a?.query)return a.query}return""});yield{id:i,type:"server_tool_call",name:"web_search",args:{query:s}};continue}else if(n.name==="code_execution"){let s=Ho(()=>{if(typeof n.input=="string")return n.input;if(me(n.input)&&K(n.input.code))return n.input.code;if(K(n.partial_json)){let a=qw(n.partial_json);if(a?.code)return a.code}return""});yield{id:i,type:"server_tool_call",name:"code_execution",args:{code:s}};continue}}else if(re(n,"web_search_tool_result")&&K(n.tool_use_id)&&Ar(n.content)){let{content:o,tool_use_id:i}=n,s=o.reduce((a,c)=>re(c,"web_search_result")?[...a,c.url]:a,[]);yield{type:"server_tool_call_result",name:"web_search",toolCallId:i,status:"success",output:{urls:s}};continue}else if(re(n,"code_execution_tool_result")&&K(n.tool_use_id)&&me(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(re(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(re(n,"mcp_tool_result")&&K(n.tool_use_id)&&me(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(re(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(re(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(re(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let o=MA(n);if(o){yield o;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var DA={translateContent:zA,translateContentChunk:zA};function wB(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}function xB(t){return nu(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:ou(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:Jm(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function LA(t){return t.map(xB)}function UA(t){return!!(re(t,"image_url")&&me(t.image_url)||re(t,"input_audio")&&me(t.input_audio)||re(t,"file")&&me(t.file))}function FA(t){if(re(t,"image_url")&&me(t.image_url)&&K(t.image_url.url)){let e=ta({dataUrl:t.image_url.url});return e?{type:"image",mimeType:e.mime_type,data:e.data}:{type:"image",url:t.image_url.url}}else{if(re(t,"input_audio")&&me(t.input_audio)&&K(t.input_audio.data)&&K(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(re(t,"file")&&me(t.file)&&K(t.file.data)){let e=ta({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(K(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}function $B(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...rh(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function IB(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...rh(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function rh(t){let e=[];for(let r of t)UA(r)?e.push(FA(r)):e.push(r);return e}function SB(t){if(t.type==="url_citation"){let{url:e,title:r,start_index:n,end_index:o}=t;return{type:"citation",url:e,title:r,startIndex:n,endIndex:o}}if(t.type==="file_citation"){let{file_id:e,filename:r,index:n}=t;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:e}}return t}function BA(t){function*e(){me(t.additional_kwargs?.reasoning)&&Ar(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((o,i)=>me(i)&&K(i.text)?`${o}${i.text}`:o,"")});let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r)if(re(n,"text")){let{text:o,annotations:i,...s}=n;Array.isArray(i)?yield{...s,type:"text",text:String(o),annotations:i.map(SB)}:yield{...s,type:"text",text:String(o)}}for(let n of t.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(me(t.additional_kwargs)&&Ar(t.additional_kwargs.tool_outputs))for(let n of t.additional_kwargs.tool_outputs){if(re(n,"web_search_call")){yield{id:n.id,type:"server_tool_call",name:"web_search",args:{query:n.query}};continue}else if(re(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{query:n.query}};continue}else if(re(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(re(n,"code_interpreter_call")){if(K(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),Ar(n.outputs)){let o=Ho(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(let i of n.outputs)if(re(i,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:o??0,stderr:[0,void 0].includes(o)?void 0:String(i.logs),stdout:[0,void 0].includes(o)?String(i.logs):void 0}};continue}}continue}else if(re(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(re(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(re(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(re(n,"image_generation_call")){yield{type:"non_standard",value:n};continue}me(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function kB(t){function*e(){yield*BA(t);for(let r of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(e())}var ZA={translateContent:t=>typeof t.content=="string"?$B(t):BA(t),translateContentChunk:t=>typeof t.content=="string"?IB(t):kB(t)};function qA(t,e="pretty"){return e==="pretty"?TB(t):JSON.stringify(t)}function TB(t){let e=[],r=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),o="=".repeat(n),i=r.length%2===0?o:`${o}=`;if(e.push(`${o}${r}${i}`),t.type==="ai"){let s=t;if(s.tool_calls&&s.tool_calls.length>0){e.push("Tool Calls:");for(let a of s.tool_calls){e.push(` ${a.name} (${a.id})`),e.push(` Call ID: ${a.id}`),e.push(" Args:");for(let[c,u]of Object.entries(a.args))e.push(` ${c}: ${u}`)}}}if(t.type==="tool"){let s=t;s.name&&e.push(`Name: ${s.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(` +`)}var Vw=Symbol.for("langchain.message");function er(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.length===0?t:Array.isArray(e)&&e.some(r=>Jr(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?ra(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>Jr(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function nh(t,e){return t==="error"||e==="error"?"error":"success"}function EB(t,e){function r(n,o){if(typeof n!="object"||n===null||n===void 0)return n;if(o>=e)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(s=>r(s,o+1));let i={};for(let s of Object.keys(n))i[s]=r(n[s],o+1);return i}return JSON.stringify(r(t,0),null,2)}var qt=class extends uo{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[Vw]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(t){let e=typeof t=="string"||Array.isArray(t)?{content:t}:t;e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),this.name=e.name,e.content===void 0&&e.contentBlocks!==void 0?(this.content=e.contentBlocks,this.response_metadata={output_version:"v1",...e.response_metadata}):e.content!==void 0?(this.content=e.content??[],this.response_metadata=e.response_metadata):(this.content=[],this.response_metadata=e.response_metadata),this.additional_kwargs=e.additional_kwargs,this.id=e.id}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(t=>typeof t=="string"?t:t.type==="text"?t.text:"").join(""):""}get contentBlocks(){let t=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[LA,rh,jA].reduce((n,o)=>o(n),t)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(t){return typeof t=="object"&&t!==null&&Vw in t&&t[Vw]===!0&&Qm(t)}_updateId(t){this.id=t,this.lc_kwargs.id=t}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](t){if(t===null)return this;let e=EB(this._printableFields,Math.max(4,t));return`${this.constructor.lc_name()} ${e}`}toFormattedString(t="pretty"){return qA(this,t)}};function VA(t){return Array.isArray(t)&&t.every(e=>typeof e.index=="number")}function dt(t={},e={}){let r={...t};for(let[n,o]of Object.entries(e))if(r[n]==null)r[n]=o;else{if(o==null)continue;if(typeof r[n]!=typeof o||Array.isArray(r[n])!==Array.isArray(o))throw new Error(`field[${n}] already exists in the message chunk, but with a different type.`);if(typeof r[n]=="string"){if(n==="type")continue;["id","name","output_version","model_provider"].includes(n)?o&&(r[n]=o):r[n]+=o}else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=dt(r[n],o);else if(Array.isArray(r[n]))r[n]=ra(r[n],o);else{if(r[n]===o)continue;console.warn(`field[${n}] already exists in this message chunk and value has unsupported type.`)}}return r}function ra(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)return t||e;{let r=[...t];for(let n of e)if(typeof n=="object"&&n!==null&&"index"in n&&typeof n.index=="number"){let o=r.findIndex(i=>{let s=typeof i=="object",a="index"in i&&i.index===n.index,c="id"in i&&"id"in n&&i?.id===n?.id,u=!("id"in i)||!i?.id||!("id"in n)||!n?.id;return s&&a&&(c||u)});o!==-1&&typeof r[o]=="object"&&r[o]!==null?r[o]=dt(r[o],n):r.push(n)}else{if(typeof n=="object"&&n!==null&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function oh(t,e){if(!t&&!e)throw new Error("Cannot merge two undefined objects.");if(!t||!e)return t||e;if(typeof t!=typeof e)throw new Error(`Cannot merge objects of different types. +Left ${typeof t} +Right ${typeof e}`);if(typeof t=="string"&&typeof e=="string")return t+e;if(Array.isArray(t)&&Array.isArray(e))return ra(t,e);if(typeof t=="object"&&typeof e=="object")return dt(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types. +Left ${t} +Right ${e}`)}var fr=class GA extends qt{static isInstance(e){if(!super.isInstance(e))return!1;let r=Object.getPrototypeOf(e);for(;r!==null;){if(r===GA.prototype)return!0;r=Object.getPrototypeOf(r)}return!1}};function ih(t){return typeof t.role=="string"}function Yr(t){return typeof t?._getType=="function"}function iu(t){return fr.isInstance(t)}function sh(t,e){return dt(t??{},e??{})}function KA(t,e){let r={};return(t?.audio!==void 0||e?.audio!==void 0)&&(r.audio=(t?.audio??0)+(e?.audio??0)),(t?.image!==void 0||e?.image!==void 0)&&(r.image=(t?.image??0)+(e?.image??0)),(t?.video!==void 0||e?.video!==void 0)&&(r.video=(t?.video??0)+(e?.video??0)),(t?.document!==void 0||e?.document!==void 0)&&(r.document=(t?.document??0)+(e?.document??0)),(t?.text!==void 0||e?.text!==void 0)&&(r.text=(t?.text??0)+(e?.text??0)),r}function AB(t,e){let r={...KA(t,e)};return(t?.cache_read!==void 0||e?.cache_read!==void 0)&&(r.cache_read=(t?.cache_read??0)+(e?.cache_read??0)),(t?.cache_creation!==void 0||e?.cache_creation!==void 0)&&(r.cache_creation=(t?.cache_creation??0)+(e?.cache_creation??0)),r}function OB(t,e){let r={...KA(t,e)};return(t?.reasoning!==void 0||e?.reasoning!==void 0)&&(r.reasoning=(t?.reasoning??0)+(e?.reasoning??0)),r}function ah(t,e){return{input_tokens:(t?.input_tokens??0)+(e?.input_tokens??0),output_tokens:(t?.output_tokens??0)+(e?.output_tokens??0),total_tokens:(t?.total_tokens??0)+(e?.total_tokens??0),input_token_details:AB(t?.input_token_details,e?.input_token_details),output_token_details:OB(t?.output_token_details,e?.output_token_details)}}var PB={};G(PB,{ToolMessage:()=>Or,ToolMessageChunk:()=>na,defaultToolCallParser:()=>Sd,isDirectToolOutput:()=>Id,isToolMessage:()=>Gw,isToolMessageChunk:()=>Kw});function Id(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}var Or=class extends qt{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}lc_direct_tool_output=!0;type="tool";status;tool_call_id;metadata;artifact;constructor(t,e,r){let n=typeof t=="string"||Array.isArray(t)?{content:t,name:r,tool_call_id:e}:t;super(n),this.tool_call_id=n.tool_call_id,this.artifact=n.artifact,this.status=n.status,this.metadata=n.metadata}static isInstance(t){return super.isInstance(t)&&t.type==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},na=class extends fr{type="tool";tool_call_id;status;artifact;constructor(t){super(t),this.tool_call_id=t.tool_call_id,this.artifact=t.artifact,this.status=t.status}static lc_name(){return"ToolMessageChunk"}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),artifact:oh(this.artifact,t.artifact),tool_call_id:this.tool_call_id,id:this.id??t.id,status:nh(this.status,t.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}};function Sd(t){let e=[],r=[];for(let n of t)if(n.function){let o=n.function.name;try{let i=JSON.parse(n.function.arguments);e.push({name:o||"",args:i||{},id:n.id})}catch{r.push({name:o,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[e,r]}function Gw(t){return typeof t=="object"&&t!==null&&"getType"in t&&typeof t.getType=="function"&&t.getType()==="tool"}function Kw(t){return t._getType()==="tool"}var jn=class HA extends qt{static lc_name(){return"ChatMessage"}type="generic";role;static _chatMessageClass(){return HA}constructor(e,r){(typeof e=="string"||Array.isArray(e))&&(e={content:e,role:r}),super(e),this.role=e.role}static isInstance(e){return super.isInstance(e)&&e.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},Ri=class extends fr{static lc_name(){return"ChatMessageChunk"}type="generic";role;constructor(t,e){(typeof t=="string"||Array.isArray(t))&&(t={content:t,role:e}),super(t),this.role=t.role}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),role:this.role,id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}};function WA(t){return t._getType()==="generic"}function JA(t){return t._getType()==="generic"}var oa=class extends qt{static lc_name(){return"FunctionMessage"}type="function";name;constructor(t){super(t),this.name=t.name}},Ni=class extends fr{static lc_name(){return"FunctionMessageChunk"}type="function";concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),name:this.name??"",id:this.id??t.id})}};function XA(t){return t._getType()==="function"}function YA(t){return t._getType()==="function"}var mr=class extends qt{static lc_name(){return"HumanMessage"}type="human";constructor(t){super(t)}static isInstance(t){return super.isInstance(t)&&t.type==="human"}},zi=class extends fr{static lc_name(){return"HumanMessageChunk"}type="human";constructor(t){super(t)}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="human"}};function QA(t){return t.getType()==="human"}function eO(t){return t.getType()==="human"}var ia=class extends qt{type="remove";id;constructor(t){super({...t,content:[]}),this.id=t.id}get _printableFields(){return{...super._printableFields,id:this.id}}static isInstance(t){return super.isInstance(t)&&t.type==="remove"}};var hn=class ch extends qt{static lc_name(){return"SystemMessage"}type="system";constructor(e){super(e)}concat(e){if(typeof e=="string")return new ch({...this,content:er(this.content,e)});if(ch.isInstance(e))return new ch({...this,additional_kwargs:{...this.additional_kwargs,...e.additional_kwargs},response_metadata:{...this.response_metadata,...e.response_metadata},content:er(this.content,e.content)});throw new Error("Unexpected chunk type for system message")}static isInstance(e){return super.isInstance(e)&&e.type==="system"}},lo=class extends fr{static lc_name(){return"SystemMessageChunk"}type="system";constructor(t){super(t)}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="system"}};function tO(t){return t._getType()==="system"}function rO(t){return t._getType()==="system"}function uh(t,e){return t.lc_error_code=e,t.message=`${t.message} + +Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/ +`,t}function Mi(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function nO(t){return!!(t&&typeof t=="object"&&"toolCall"in t&&t.toolCall!=null&&typeof t.toolCall=="object"&&"id"in t.toolCall&&typeof t.toolCall.id=="string")}var su=class extends Error{output;constructor(t,e){super(t),this.output=e}};function kd(t,e=sa){t=t.trim();let r=t.indexOf("```");if(r===-1)return e(t);let n=t.substring(r+3);n.startsWith(`json +`)?n=n.substring(5):n.startsWith("json")?n=n.substring(4):n.startsWith(` +`)&&(n=n.substring(1));let o=n.indexOf("```"),i=n;return o!==-1&&(i=n.substring(0,o)),e(i.trim())}function CB(t){try{return JSON.parse(t)}catch{}let e=t.trim();if(e.length===0)throw new Error("Unexpected end of JSON input");let r=0;function n(){for(;r="0"&&e[r]<="9"))throw new Error(`Invalid number at position ${l}`);if(r="1"&&e[r]<="9")for(;r="0"&&e[r]<="9";)d+=e[r],r+=1;if(r="0"&&e[r]<="9";)d+=e[r],r+=1;if(r="0"&&e[r]<="9";)d+=e[r],r+=1;if(d==="-")return-0;let f=Number.parseFloat(d);if(Number.isNaN(f))throw r=l,new Error(`Invalid number '${d}' at position ${l}`);return f}function s(){if(n(),r>=e.length)throw new Error(`Unexpected end of input at position ${r}`);let l=e[r];if(l==="{")return c();if(l==="[")return a();if(l==='"')return o();if("null".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),null;if("true".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),!0;if("false".startsWith(e.substring(r,r+5)))return r+=Math.min(5,e.length-r),!1;if(l==="-"||l>="0"&&l<="9")return i();throw new Error(`Unexpected character '${l}' at position ${r}`)}function a(){if(e[r]!=="[")throw new Error(`Expected '[' at position ${r}, got '${e[r]}'`);let l=[];if(r+=1,n(),r>=e.length)return l;if(e[r]==="]")return r+=1,l;for(;r=e.length||(l.push(s()),n(),r>=e.length))return l;if(e[r]==="]")return r+=1,l;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or ']' at position ${r}, got '${e[r]}'`)}return l}function c(){if(e[r]!=="{")throw new Error(`Expected '{' at position ${r}, got '${e[r]}'`);let l={};if(r+=1,n(),r>=e.length)return l;if(e[r]==="}")return r+=1,l;for(;r=e.length)return l;let d=o();if(n(),r>=e.length)return l;if(e[r]!==":")throw new Error(`Expected ':' at position ${r}, got '${e[r]}'`);if(r+=1,n(),r>=e.length||(l[d]=s(),n(),r>=e.length))return l;if(e[r]==="}")return r+=1,l;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or '}' at position ${r}, got '${e[r]}'`)}return l}let u=s();if(n(),r"u"?null:CB(t)}catch{return null}}function Hw(t){switch(t){case"csv":return"text/csv";case"doc":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"html":return"text/html";case"md":return"text/markdown";case"pdf":return"application/pdf";case"txt":return"text/plain";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"gif":return"image/gif";case"jpeg":return"image/jpeg";case"jpg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"flv":return"video/flv";case"mkv":return"video/mkv";case"mov":return"video/mov";case"mp4":return"video/mp4";case"mpeg":return"video/mpeg";case"mpg":return"video/mpg";case"three_gp":return"video/three_gp";case"webm":return"video/webm";case"wmv":return"video/wmv";default:return"application/octet-stream"}}function RB(t){if(me(t.document)&&me(t.document.source)){let e=me(t.document)&&K(t.document.format)?t.document.format:"",r=Hw(e);if(me(t.document.source)){if(me(t.document.source.s3Location)&&K(t.document.source.s3Location.uri))return{type:"file",mimeType:r,fileId:t.document.source.s3Location.uri};if(th(t.document.source.bytes))return{type:"file",mimeType:r,data:t.document.source.bytes};if(K(t.document.source.text))return{type:"file",mimeType:r,data:Buffer.from(t.document.source.text).toString("base64")};if(Ar(t.document.source.content)){let n=t.document.source.content.reduce((o,i)=>me(i)&&K(i.text)?o+i.text:o,"");return{type:"file",mimeType:r,data:n}}}}return{type:"non_standard",value:t}}function NB(t){if(re(t,"image")&&me(t.image)){let e=me(t.image)&&K(t.image.format)?t.image.format:"",r=Hw(e);if(me(t.image.source)){if(me(t.image.source.s3Location)&&K(t.image.source.s3Location.uri))return{type:"image",mimeType:r,fileId:t.image.source.s3Location.uri};if(th(t.image.source.bytes))return{type:"image",mimeType:r,data:t.image.source.bytes}}}return{type:"non_standard",value:t}}function zB(t){if(re(t,"video")&&me(t.video)){let e=me(t.video)&&K(t.video.format)?t.video.format:"",r=Hw(e);if(me(t.video.source)){if(me(t.video.source.s3Location)&&K(t.video.source.s3Location.uri))return{type:"video",mimeType:r,fileId:t.video.source.s3Location.uri};if(th(t.video.source.bytes))return{type:"video",mimeType:r,data:t.video.source.bytes}}}return{type:"non_standard",value:t}}function oO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"cache_point")){yield{type:"non_standard",value:n};continue}else if(re(n,"citations_content")&&me(n.citationsContent)){let o=Ar(n.citationsContent.content)?n.citationsContent.content.reduce((s,a)=>me(a)&&K(a.text)?s+a.text:s,""):"",i=Ar(n.citationsContent.citations)?n.citationsContent.citations.reduce((s,a)=>{if(me(a)){let c=Ar(a.sourceContent)?a.sourceContent.reduce((l,d)=>me(d)&&K(d.text)?l+d.text:l,""):"",u=Ho(()=>{if(me(a.location)){let l=a.location.documentChar||a.location.documentPage||a.location.documentChunk;if(me(l))return{source:Xr(l.documentIndex)?l.documentIndex.toString():void 0,startIndex:Xr(l.start)?l.start:void 0,endIndex:Xr(l.end)?l.end:void 0}}return{}});s.push({type:"citation",citedText:c,...u})}return s},[]):[];yield{type:"text",text:o,annotations:i};continue}else if(re(n,"document")&&me(n.document)){yield RB(n);continue}else if(re(n,"guard_content")){yield{type:"non_standard",value:n};continue}else if(re(n,"image")&&me(n.image)){yield NB(n);continue}else if(re(n,"reasoning_content")&&K(n.reasoningText)){yield{type:"reasoning",reasoning:n.reasoningText};continue}else if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"tool_result")){yield{type:"non_standard",value:n};continue}else{if(re(n,"tool_call"))continue;if(re(n,"video")&&me(n.video)){yield zB(n);continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var iO={translateContent:oO,translateContentChunk:oO};function sO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"inlineData")&&me(n.inlineData)&&K(n.inlineData.mimeType)&&K(n.inlineData.data)){yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data};continue}else if(re(n,"functionCall")&&me(n.functionCall)&&K(n.functionCall.name)&&me(n.functionCall.args)){yield{type:"tool_call",id:t.id,name:n.functionCall.name,args:n.functionCall.args};continue}else if(re(n,"functionResponse")){yield{type:"non_standard",value:n};continue}else if(re(n,"fileData")&&me(n.fileData)&&K(n.fileData.mimeType)&&K(n.fileData.fileUri)){yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri};continue}else if(re(n,"executableCode")){yield{type:"non_standard",value:n};continue}else if(re(n,"codeExecutionResult")){yield{type:"non_standard",value:n};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var aO={translateContent:sO,translateContentChunk:sO};function cO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"reasoning")&&K(n.reasoning)){let o=Ho(()=>{let i=r.indexOf(n);if(Ar(t.additional_kwargs?.signatures)&&i>=0)return t.additional_kwargs.signatures.at(i)});K(o)?yield{type:"reasoning",reasoning:n.reasoning,signature:o}:yield{type:"reasoning",reasoning:n.reasoning};continue}else if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"image_url")){if(K(n.image_url))if(n.image_url.startsWith("data:")){let o=/^data:([^;]+);base64,(.+)$/,i=n.image_url.match(o);i?yield{type:"image",data:i[2],mimeType:i[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url};continue}else if(re(n,"media")&&K(n.mimeType)&&K(n.data)){yield{type:"file",mimeType:n.mimeType,data:n.data};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var uO={translateContent:cO,translateContentChunk:cO};globalThis.lc_block_translators_registry??=new Map([["anthropic",DA],["bedrock-converse",iO],["google-genai",aO],["google-vertexai",uO],["openai",ZA]]);function Ww(t){return globalThis.lc_block_translators_registry.get(t)}var jt=class extends qt{type="ai";tool_calls=[];invalid_tool_calls=[];usage_metadata;get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls"}}constructor(t){let e;if(typeof t=="string"||Array.isArray(t))e={content:t,tool_calls:[],invalid_tool_calls:[],additional_kwargs:{}};else{e=t;let r=e.additional_kwargs?.tool_calls,n=e.tool_calls;r!=null&&r.length>0&&(n===void 0||n.length===0)&&console.warn(["New LangChain packages are available that more efficiently handle",`tool calling. + +Please upgrade your packages to versions that set`,"message tool calls. e.g., `pnpm install @langchain/anthropic`,","pnpm install @langchain/openai`, etc."].join(" "));try{if(r!=null&&n===void 0){let[o,i]=Sd(r);e.tool_calls=o??[],e.invalid_tool_calls=i??[]}else e.tool_calls=e.tool_calls??[],e.invalid_tool_calls=e.invalid_tool_calls??[]}catch{e.tool_calls=[],e.invalid_tool_calls=[]}if(e.response_metadata!==void 0&&"output_version"in e.response_metadata&&e.response_metadata.output_version==="v1"&&(e.contentBlocks=e.content,e.content=void 0),e.contentBlocks!==void 0){e.contentBlocks.push(...e.tool_calls.map(i=>({type:"tool_call",id:i.id,name:i.name,args:i.args})));let o=e.contentBlocks.filter(i=>i.type==="tool_call").filter(i=>!e.tool_calls?.some(s=>s.id===i.id&&s.name===i.name));o.length>0&&(e.tool_calls=o.map(i=>({type:"tool_call",id:i.id,name:i.name,args:i.args})))}}super(e),typeof e!="string"&&(this.tool_calls=e.tool_calls??this.tool_calls,this.invalid_tool_calls=e.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=e.usage_metadata}static lc_name(){return"AIMessage"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let e=Ww(this.response_metadata.model_provider);if(e)return e.translateContent(this)}let t=super.contentBlocks;if(this.tool_calls){let e=this.tool_calls.filter(r=>!t.some(n=>n.id===r.id&&n.name===r.name));t.push(...e.map(r=>({...r,type:"tool_call",id:r.id,name:r.name,args:r.args})))}return t}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}static isInstance(t){return super.isInstance(t)&&t.type==="ai"}};function aa(t){return t._getType()==="ai"}function Td(t){return t._getType()==="ai"}var Dt=class extends fr{type="ai";tool_calls=[];invalid_tool_calls=[];tool_call_chunks=[];usage_metadata;constructor(t){let e;typeof t=="string"||Array.isArray(t)?e={content:t,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]}:t.tool_call_chunks===void 0||t.tool_call_chunks.length===0?e={...t,tool_calls:t.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:t.usage_metadata!==void 0?t.usage_metadata:void 0}:e={...t,...lh(t.tool_call_chunks??[]),usage_metadata:t.usage_metadata!==void 0?t.usage_metadata:void 0},super(e),this.tool_call_chunks=e.tool_call_chunks??this.tool_call_chunks,this.tool_calls=e.tool_calls??this.tool_calls,this.invalid_tool_calls=e.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=e.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks"}}static lc_name(){return"AIMessageChunk"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let e=Ww(this.response_metadata.model_provider);if(e)return e.translateContent(this)}let t=super.contentBlocks;if(this.tool_calls&&typeof this.content!="string"){let e=this.content.filter(r=>r.type==="tool_call").map(r=>r.id);for(let r of this.tool_calls)r.id&&!e.includes(r.id)&&t.push({...r,type:"tool_call",id:r.id,name:r.name,args:r.args})}return t}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(t){let e={content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:sh(this.response_metadata,t.response_metadata),tool_call_chunks:[],id:this.id??t.id};if(this.tool_call_chunks!==void 0||t.tool_call_chunks!==void 0){let n=ra(this.tool_call_chunks,t.tool_call_chunks);n!==void 0&&n.length>0&&(e.tool_call_chunks=n)}(this.usage_metadata!==void 0||t.usage_metadata!==void 0)&&(e.usage_metadata=ah(this.usage_metadata,t.usage_metadata));let r=this.constructor;return new r(e)}static isInstance(t){return super.isInstance(t)&&t.type==="ai"}};var Xw=t=>t();function MB(t){return Mi(t)?t:typeof t.id=="string"&&t.type==="function"&&typeof t.function=="object"&&t.function!==null&&"arguments"in t.function&&typeof t.function.arguments=="string"&&"name"in t.function&&typeof t.function.name=="string"?{id:t.id,args:JSON.parse(t.function.arguments),name:t.function.name,type:"tool_call"}:t}function jB(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function Jw(t){let e,r;if(jB(t)){let n=t.id.at(-1);n==="HumanMessage"||n==="HumanMessageChunk"?e="user":n==="AIMessage"||n==="AIMessageChunk"?e="assistant":n==="SystemMessage"||n==="SystemMessageChunk"?e="system":n==="FunctionMessage"||n==="FunctionMessageChunk"?e="function":n==="ToolMessage"||n==="ToolMessageChunk"?e="tool":e="unknown",r=t.kwargs}else{let{type:n,...o}=t;e=n,r=o}if(e==="human"||e==="user")return new mr(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new jt(r);let i=n.map(MB);return new jt({...o,tool_calls:i})}else{if(e==="system")return new hn(r);if(e==="developer")return new hn({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new Or({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});if(e==="remove"&&"id"in r&&typeof r.id=="string")return new ia({...r,id:r.id});throw uh(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported. + +Received: ${JSON.stringify(t,null,2)}`),"MESSAGE_COERCION_FAILURE")}}function ji(t){if(typeof t=="string")return new mr(t);if(Yr(t))return t;if(Array.isArray(t)){let[e,r]=t;return Jw({type:e,content:r})}else if(ih(t)){let{role:e,...r}=t;return Jw({...r,type:e})}else return Jw(t)}function au(t,e="Human",r="AI"){let n=[];for(let o of t){let i;if(o._getType()==="human")i=e;else if(o._getType()==="ai")i=r;else if(o._getType()==="system")i="System";else if(o._getType()==="tool")i="Tool";else if(o._getType()==="generic")i=o.role;else throw new Error(`Got unsupported message type: ${o._getType()}`);let s=o.name?`${o.name}, `:"",a=typeof o.content=="string"?o.content:JSON.stringify(o.content,null,2);n.push(`${i}: ${s}${a}`)}return n.join(` +`)}function DB(t){if(t.data!==void 0)return t;{let e=t;return{type:e.type,data:{content:e.text,role:e.role,name:void 0,tool_call_id:void 0}}}}function Ed(t){let e=DB(t);switch(e.type){case"human":return new mr(e.data);case"ai":return new jt(e.data);case"system":return new hn(e.data);case"function":if(e.data.name===void 0)throw new Error("Name must be defined for function messages");return new oa(e.data);case"tool":if(e.data.tool_call_id===void 0)throw new Error("Tool call ID must be defined for tool messages");return new Or(e.data);case"generic":if(e.data.role===void 0)throw new Error("Role must be defined for chat messages");return new jn(e.data);default:throw new Error(`Got unexpected type: ${e.type}`)}}function lO(t){return t.map(Ed)}function dO(t){return t.map(e=>e.toDict())}function ca(t){let e=t._getType();if(e==="human")return new zi({...t});if(e==="ai"){let r={...t};return"tool_calls"in r&&(r={...r,tool_call_chunks:r.tool_calls?.map(n=>({...n,type:"tool_call_chunk",index:void 0,args:JSON.stringify(n.args)}))}),new Dt({...r})}else{if(e==="system")return new lo({...t});if(e==="function")return new Ni({...t});if(jn.isInstance(t))return new Ri({...t});throw new Error("Unknown message type.")}}function lh(t){let e=t.reduce((o,i)=>{let s=o.findIndex(([a])=>"id"in i&&i.id&&"index"in i&&i.index!==void 0?i.id===a.id&&i.index===a.index:"id"in i&&i.id?i.id===a.id:"index"in i&&i.index!==void 0?i.index===a.index:!1);return s!==-1?o[s].push(i):o.push([i]),o},[]),r=[],n=[];for(let o of e){let i=null,s=o[0]?.name??"",a=o.map(l=>l.args||"").join("").trim(),c=a.length?a:"{}",u=o[0]?.id;try{if(i=sa(c),!u||i===null||typeof i!="object"||Array.isArray(i))throw new Error("Malformed tool call chunk args.");r.push({name:s,args:i,id:u,type:"tool_call"})}catch{n.push({name:s,args:c,id:u,error:"Malformed args.",type:"invalid_tool_call"})}}return{tool_call_chunks:t,tool_calls:r,invalid_tool_calls:n}}var pO=Symbol.for("ls:tracing_async_local_storage"),Di=Symbol.for("lc:context_variables"),fO=t=>{globalThis[pO]=t},Li=()=>globalThis[pO];var LB={};G(LB,{getEnv:()=>Qw,getEnvironmentVariable:()=>It,getRuntimeEnvironment:()=>ex,isBrowser:()=>mO,isDeno:()=>dh,isJsDom:()=>gO,isNode:()=>_O,isWebWorker:()=>hO});var mO=()=>typeof window<"u"&&typeof window.document<"u",hO=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",gO=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),dh=()=>typeof Deno<"u",_O=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!dh(),Qw=()=>{let t;return mO()?t="browser":_O()?t="node":hO()?t="webworker":gO()?t="jsdom":dh()?t="deno":t="other",t},Yw;function ex(){return Yw===void 0&&(Yw={library:"langchain-js",runtime:Qw()}),Yw}function It(t){try{return typeof process<"u"?process.env?.[t]:dh()?Deno?.env.get(t):void 0}catch{return}}var yO=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function UB(t){return typeof t=="string"&&yO.test(t)}var Ui=UB;function FB(t){if(!Ui(t))throw TypeError("Invalid UUID");let e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var vO=FB;var Vt=[];for(let t=0;t<256;++t)Vt.push((t+256).toString(16).slice(1));function cu(t,e=0){return(Vt[t[e+0]]+Vt[t[e+1]]+Vt[t[e+2]]+Vt[t[e+3]]+"-"+Vt[t[e+4]]+Vt[t[e+5]]+"-"+Vt[t[e+6]]+Vt[t[e+7]]+"-"+Vt[t[e+8]]+Vt[t[e+9]]+"-"+Vt[t[e+10]]+Vt[t[e+11]]+Vt[t[e+12]]+Vt[t[e+13]]+Vt[t[e+14]]+Vt[t[e+15]]).toLowerCase()}import BB from"node:crypto";var fh=new Uint8Array(256),ph=fh.length;function Ad(){return ph>fh.length-16&&(BB.randomFillSync(fh),ph=0),fh.slice(ph,ph+=16)}function ZB(t){t=unescape(encodeURIComponent(t));let e=[];for(let r=0;rDn&&t.msecs===void 0&&(Dn=s,a!==null&&(c=null,u=null)),a!==null&&(a>2147483647&&(a=2147483647),c=a>>>19&4095,u=a&524287),(c===null||u===null)&&(c=i[6]&127,c=c<<8|i[7],u=i[8]&63,u=u<<8|i[9],u=u<<5|i[10]>>>3),s+1e4>Dn&&a===null?++u>524287&&(u=0,++c>4095&&(c=0,Dn++)):Dn=s,xO=c,wO=u,o[n++]=Dn/1099511627776&255,o[n++]=Dn/4294967296&255,o[n++]=Dn/16777216&255,o[n++]=Dn/65536&255,o[n++]=Dn/256&255,o[n++]=Dn&255,o[n++]=c>>>4&15|112,o[n++]=c&255,o[n++]=u>>>13&63|128,o[n++]=u>>>5&255,o[n++]=u<<3&255|i[10]&7,o[n++]=i[11],o[n++]=i[12],o[n++]=i[13],o[n++]=i[14],o[n++]=i[15],e||cu(o)}var nx=XB;var YB={};G(YB,{BaseCallbackHandler:()=>la,callbackHandlerPrefersStreaming:()=>Od,isBaseCallbackHandler:()=>ox});var QB=class{};function Od(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var la=class extends QB{lc_serializable=!1;get lc_namespace(){return["langchain_core","callbacks",this.name]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eh(this.constructor)]}lc_kwargs;ignoreLLM=!1;ignoreChain=!1;ignoreAgent=!1;ignoreRetriever=!1;ignoreCustomEvent=!1;raiseError=!1;awaitHandlers=It("LANGCHAIN_CALLBACKS_BACKGROUND")==="false";constructor(t){super(),this.lc_kwargs=t||{},t&&(this.ignoreLLM=t.ignoreLLM??this.ignoreLLM,this.ignoreChain=t.ignoreChain??this.ignoreChain,this.ignoreAgent=t.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=t.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=t.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=t.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(t._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return uo.prototype.toJSON.call(this)}toJSONNotImplemented(){return uo.prototype.toJSONNotImplemented.call(this)}static fromMethods(t){class e extends la{name=Et();constructor(){super(),Object.assign(this,t)}}return new e}},ox=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"};var IO="gen_ai.operation.name",SO="gen_ai.system",ix="gen_ai.request.model",kO="gen_ai.response.model",sx="gen_ai.usage.input_tokens",ax="gen_ai.usage.output_tokens",cx="gen_ai.usage.total_tokens",TO="gen_ai.request.max_tokens",EO="gen_ai.request.temperature",AO="gen_ai.request.top_p",OO="gen_ai.request.frequency_penalty",PO="gen_ai.request.presence_penalty",CO="gen_ai.response.finish_reasons",RO="gen_ai.prompt",NO="gen_ai.completion",zO="gen_ai.request.extra_query",MO="gen_ai.request.extra_body",jO="gen_ai.serialized.name",DO="gen_ai.serialized.signature",LO="gen_ai.serialized.doc",UO="gen_ai.response.id",FO="gen_ai.response.service_tier",BO="gen_ai.response.system_fingerprint",ZO="gen_ai.usage.input_token_details",qO="gen_ai.usage.output_token_details",VO="langsmith.trace.session_id",GO="langsmith.trace.session_name",KO="langsmith.span.kind",HO="langsmith.trace.name",WO="langsmith.metadata",ux="langsmith.span.tags";var JO="langsmith.request.streaming",XO="langsmith.request.headers";var t6=(...t)=>fetch(...t),YO=Symbol.for("ls:fetch_implementation");var QO=()=>{let t=globalThis[YO];return t?typeof t=="function"&&"Headers"in t&&"Request"in t&&"Response"in t:!1},eP=t=>async(...e)=>{if(t||At("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[YO]??t6)(...e);return(t||At("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r};var Pd=()=>At("PROJECT")??Qr("LANGCHAIN_SESSION")??"default";var tP={};function uu(t){tP[t]||(console.warn(t),tP[t]=!0)}var r6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function $e(t,e){if(!r6.test(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}function mh(t){let e=typeof t=="string"?Date.parse(t):t;return nx({msecs:e,seq:0})}var hh="0.3.82";var po,n6=()=>typeof window<"u"&&typeof window.document<"u",o6=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",i6=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),rP=()=>typeof Deno<"u",s6=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!rP(),px=()=>po||(typeof Bun<"u"?po="bun":n6()?po="browser":s6()?po="node":o6()?po="webworker":i6()?po="jsdom":rP()?po="deno":po="other",po),lx;function gh(){if(lx===void 0){let t=px(),e=c6();lx={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:hh,...e}}return lx}function fx(){let t=a6(),e={},r=["LANGCHAIN_API_KEY","LANGCHAIN_ENDPOINT","LANGCHAIN_TRACING_V2","LANGCHAIN_PROJECT","LANGCHAIN_SESSION","LANGSMITH_API_KEY","LANGSMITH_ENDPOINT","LANGSMITH_TRACING_V2","LANGSMITH_PROJECT","LANGSMITH_SESSION"];for(let[n,o]of Object.entries(t))typeof o=="string"&&!r.includes(n)&&!n.toLowerCase().includes("key")&&!n.toLowerCase().includes("secret")&&!n.toLowerCase().includes("token")&&(n==="LANGCHAIN_REVISION_ID"?e.revision_id=o:e[n]=o);return e}function a6(){let t={};try{if(typeof process<"u"&&process.env)for(let[e,r]of Object.entries(process.env))(e.startsWith("LANGCHAIN_")||e.startsWith("LANGSMITH_"))&&r!=null&&((e.toLowerCase().includes("key")||e.toLowerCase().includes("secret")||e.toLowerCase().includes("token"))&&typeof r=="string"?t[e]=r.slice(0,2)+"*".repeat(r.length-4)+r.slice(-2):t[e]=r)}catch{}return t}function Qr(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function At(t){return Qr(`LANGSMITH_${t}`)||Qr(`LANGCHAIN_${t}`)}var dx;function c6(){if(dx!==void 0)return dx;let t=["VERCEL_GIT_COMMIT_SHA","NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA","COMMIT_REF","RENDER_GIT_COMMIT","CI_COMMIT_SHA","CIRCLE_SHA1","CF_PAGES_COMMIT_SHA","REACT_APP_GIT_SHA","SOURCE_VERSION","GITHUB_SHA","TRAVIS_COMMIT","GIT_COMMIT","BUILD_VCS_NUMBER","bamboo_planRepository_revision","Build.SourceVersion","BITBUCKET_COMMIT","DRONE_COMMIT_SHA","SEMAPHORE_GIT_SHA","BUILDKITE_COMMIT"],e={};for(let r of t){let n=Qr(r);n!==void 0&&(e[r]=n)}return dx=e,e}function _h(){return Qr("OTEL_ENABLED")==="true"||At("OTEL_ENABLED")==="true"}var gx=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&_h()&&(console.warn('You have enabled OTEL export via the `OTEL_ENABLED` or `LANGSMITH_OTEL_ENABLED` environment variable, but have not initialized the required OTEL instances. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0);let n;if(r.length===1&&typeof r[0]=="function"?n=r[0]:r.length===2&&typeof r[1]=="function"?n=r[1]:r.length===3&&typeof r[2]=="function"&&(n=r[2]),typeof n=="function")return n()}},_x=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new gx})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},yx=class{active(){return{}}with(e,r){return r()}},mx=Symbol.for("ls:otel_trace"),hx=Symbol.for("ls:otel_context"),nP=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),u6=new _x,l6=new yx,vx=class{getTraceInstance(){return globalThis[mx]??u6}getContextInstance(){return globalThis[hx]??l6}initializeGlobalInstances(e){globalThis[mx]===void 0&&(globalThis[mx]=e.trace),globalThis[hx]===void 0&&(globalThis[hx]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[nP]=e}getDefaultOTLPTracerComponents(){return globalThis[nP]??void 0}},bx=new vx;function yh(){return bx.getTraceInstance()}function oP(){return bx.getContextInstance()}function iP(){return bx.getDefaultOTLPTracerComponents()}var d6={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};function p6(t){return d6[t]||t}var vh=class{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(e,r){for(let n of e)try{if(!n.run)continue;if(n.operation==="post"){let o=this.createSpanForRun(n,n.run,r.get(n.id));o&&!n.run.end_time&&this.spans.set(n.id,o)}else this.updateSpanForRun(n,n.run)}catch(o){console.error(`Error processing operation ${n.id}:`,o)}}createSpanForRun(e,r,n){let o=n&&yh().getSpan(n);if(o)try{return this.finishSpanSetup(o,r,e)}catch(i){console.error(`Failed to create span for run ${e.id}:`,i);return}}finishSpanSetup(e,r,n){return this.setSpanAttributes(e,r,n),r.error?(e.setStatus({code:2}),e.recordException(new Error(r.error))):e.setStatus({code:1}),r.end_time&&e.end(new Date(r.end_time)),e}updateSpanForRun(e,r){try{let n=this.spans.get(e.id);if(!n){console.debug(`No span found for run ${e.id} during update`);return}this.setSpanAttributes(n,r,e),r.error?(n.setStatus({code:2}),n.recordException(new Error(r.error))):n.setStatus({code:1});let o=r.end_time;o&&(n.end(new Date(o)),this.spans.delete(e.id))}catch(n){console.error(`Failed to update span for run ${e.id}:`,n)}}extractModelName(e){if(e.extra?.metadata){let r=e.extra.metadata;if(r.ls_model_name)return r.ls_model_name;if(r.invocation_params){let n=r.invocation_params;if(n.model)return n.model;if(n.model_name)return n.model_name}}}setSpanAttributes(e,r,n){if("run_type"in r&&r.run_type){e.setAttribute(KO,r.run_type);let a=p6(r.run_type||"chain");e.setAttribute(IO,a)}"name"in r&&r.name&&e.setAttribute(HO,r.name),"session_id"in r&&r.session_id&&e.setAttribute(VO,r.session_id),"session_name"in r&&r.session_name&&e.setAttribute(GO,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute(ix,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute(sx,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(ax,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(cx,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[a,c]of Object.entries(i))c!=null&&e.setAttribute(`${WO}.${a}`,String(c));let s=r.tags;if(s&&Array.isArray(s)?e.setAttribute(ux,s.join(", ")):s&&e.setAttribute(ux,String(s)),"serialized"in r&&typeof r.serialized=="object"){let a=r.serialized;a.name&&e.setAttribute(jO,String(a.name)),a.signature&&e.setAttribute(DO,String(a.signature)),a.doc&&e.setAttribute(LO,String(a.doc))}this.setIOAttributes(e,n)}setGenAiSystem(e,r){let n="langchain",o=this.extractModelName(r);if(o){let i=o.toLowerCase();i.includes("anthropic")||i.startsWith("claude")?n="anthropic":i.includes("bedrock")?n="aws.bedrock":i.includes("azure")&&i.includes("openai")?n="az.ai.openai":i.includes("azure")&&i.includes("inference")?n="az.ai.inference":i.includes("cohere")?n="cohere":i.includes("deepseek")?n="deepseek":i.includes("gemini")?n="gemini":i.includes("groq")?n="groq":i.includes("watson")||i.includes("ibm")?n="ibm.watsonx.ai":i.includes("mistral")?n="mistral_ai":i.includes("gpt")||i.includes("openai")?n="openai":i.includes("perplexity")||i.includes("sonar")?n="perplexity":i.includes("vertex")?n="vertex_ai":(i.includes("xai")||i.includes("grok"))&&(n="xai")}e.setAttribute(SO,n)}setInvocationParameters(e,r){if(!r.extra?.metadata?.invocation_params)return;let n=r.extra.metadata.invocation_params;n.max_tokens!==void 0&&e.setAttribute(TO,n.max_tokens),n.temperature!==void 0&&e.setAttribute(EO,n.temperature),n.top_p!==void 0&&e.setAttribute(AO,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(OO,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute(PO,n.presence_penalty)}setIOAttributes(e,r){if(r.run.inputs)try{let n=r.run.inputs;typeof n=="object"&&n!==null&&(n.model&&Array.isArray(n.messages)&&e.setAttribute(ix,n.model),n.stream!==void 0&&e.setAttribute(JO,n.stream),n.extra_headers&&e.setAttribute(XO,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute(zO,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(MO,JSON.stringify(n.extra_body))),e.setAttribute(RO,JSON.stringify(n))}catch(n){console.debug(`Failed to process inputs for run ${r.id}`,n)}if(r.run.outputs)try{let n=r.run.outputs,o=this.getUnifiedRunTokens(n);if(o&&(e.setAttribute(sx,o[0]),e.setAttribute(ax,o[1]),e.setAttribute(cx,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(kO,String(n.model)),n.id&&e.setAttribute(UO,n.id),n.choices&&Array.isArray(n.choices)){let i=n.choices.map(s=>s.finish_reason).filter(s=>s).map(String);i.length>0&&e.setAttribute(CO,i.join(", "))}if(n.service_tier&&e.setAttribute(FO,n.service_tier),n.system_fingerprint&&e.setAttribute(BO,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let i=n.usage_metadata;i.input_token_details&&e.setAttribute(ZO,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(qO,JSON.stringify(i.output_token_details))}}e.setAttribute(NO,JSON.stringify(n))}catch(n){console.debug(`Failed to process outputs for run ${r.id}`,n)}}getUnifiedRunTokens(e){if(!e)return null;let r=this.extractUnifiedRunTokens(e.usage_metadata);if(r)return r;let n=Object.keys(e);for(let s of n){let a=e[s];if(!(!a||typeof a!="object")&&(r=this.extractUnifiedRunTokens(a.usage_metadata),r||a.lc===1&&a.kwargs&&typeof a.kwargs=="object"&&(r=this.extractUnifiedRunTokens(a.kwargs.usage_metadata),r)))return r}let o=e.generations||[];if(!Array.isArray(o))return null;let i=Array.isArray(o[0])?o.flat():o;for(let s of i)if(typeof s=="object"&&s.message&&typeof s.message=="object"&&s.message.kwargs&&typeof s.message.kwargs=="object"&&(r=this.extractUnifiedRunTokens(s.message.kwargs.usage_metadata),r))return r;return null}extractUnifiedRunTokens(e){return!e||typeof e!="object"||typeof e.input_tokens!="number"||typeof e.output_tokens!="number"?null:[e.input_tokens,e.output_tokens]}};var f6=Object.prototype.toString,m6=t=>f6.call(t)==="[object Error]",h6=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function wx(t){if(!(t&&m6(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:h6.has(r)}function g6(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function bh(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(_),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},_=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&_.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function $x(t,e={}){if(e={...e},g6(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,bh("factor",e.factor,{min:0,allowInfinity:!1}),bh("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),bh("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),bh("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await y6({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var kh=mn(Sh(),1),T6=[408,425,429,500,502,503,504],Rd=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxQueueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.maxQueueSizeBytes=e.maxQueueSizeBytes,"default"in kh.default?this.queue=new kh.default.default({concurrency:this.maxConcurrency}):this.queue=new kh.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){return this.callWithOptions({},e,...r)}callWithOptions(e,r,...n){let o=e.sizeBytes??0;if(this.maxQueueSizeBytes!==void 0&&o>0&&this.queueSizeBytes+o>this.maxQueueSizeBytes)return Promise.reject(new Error(`Queue size limit (${this.maxQueueSizeBytes} bytes) exceeded. Current queue size: ${this.queueSizeBytes} bytes, attempted addition: ${o} bytes.`));o>0&&(this.queueSizeBytes+=o);let i=this.onFailedResponseHook,s=this.queue.add(()=>$x(()=>r(...n).catch(a=>{throw a instanceof Error?a:new Error(a)}),{async onFailedAttempt({error:a}){if(a.message.startsWith("Cancel")||a.message.startsWith("TimeoutError")||a.name==="TimeoutError"||a.message.startsWith("AbortError")||a?.code==="ECONNABORTED")throw a;let c=a?.response;if(i&&await i(c))return;let u=c?.status??a?.status;if(u&&!T6.includes(+u))throw a},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0});return o>0&&(s=s.finally(()=>{this.queueSizeBytes-=o})),e.signal?Promise.race([s,new Promise((a,c)=>{e.signal?.addEventListener("abort",()=>{c(new Error("AbortError"))})})]):s}};function Ox(t){return typeof t?._getType=="function"}function Px(t){let e={type:t._getType(),data:{content:t.content}};return t?.additional_kwargs&&Object.keys(t.additional_kwargs).length>0&&(e.data.additional_kwargs={...t.additional_kwargs}),e}var $q=mn(oR(),1);function Wo(t){if(!t||t.split("/").length>2||t.startsWith("/")||t.endsWith("/")||t.split(":").length>2)throw new Error(`Invalid identifier format: ${t}`);let[e,r]=t.split(":"),n=r||"latest";if(e.includes("/")){let[o,i]=e.split("/",2);if(!o||!i)throw new Error(`Invalid identifier format: ${t}`);return[o,i,n]}else{if(!e)throw new Error(`Invalid identifier format: ${t}`);return["-",e,n]}}var Xx=class extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}};async function ue(t,e,r){let n;if(t.ok){r&&(n=await t.text());return}if(t.status===403)try{(await t.json())?.error==="org_scoped_key_requires_workspace"&&(n="This API key is org-scoped and requires workspace specification. Please provide 'workspaceId' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.")}catch{let a=new Error(`${t.status} ${t.statusText}`);throw a.status=t?.status,a}if(n===void 0)try{n=await t.text()}catch{n=""}let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Message: ${n}`;if(t.status===409)throw new Xx(o);let i=new Error(o);throw i.status=t.status,i}var iR="ERR_CONFLICTING_ENDPOINTS",Lh=class extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:iR}),this.name="ConflictingEndpointsError"}};function sR(t){return typeof t=="object"&&t!==null&&t.code===iR}var aR="[...]",Iq={result:"[Circular]"},Fh=[],du=[],Sq=new TextEncoder;function kq(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Uh(t){return Sq.encode(t)}function cR(t){if(t&&typeof t=="object"&&t!==null){if(t instanceof Map)return Object.fromEntries(t);if(t instanceof Set)return Array.from(t);if(t instanceof Date)return t.toISOString();if(t instanceof RegExp)return t.toString();if(t instanceof Error)return{name:t.name,message:t.message}}else if(typeof t=="bigint")return t.toString();return t}function Tq(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return cR(r)}}function Pr(t,e,r,n,o){try{let i=JSON.stringify(t,Tq(r),n);return Uh(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?` +Context: ${e}`:""}`),Uh("[Unserializable]");At("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?` +Context: ${e}`:""}`),typeof o>"u"&&(o=kq()),Qx(t,"",0,[],void 0,0,o);let s;try{du.length===0?s=JSON.stringify(t,r,n):s=JSON.stringify(t,Eq(r),n)}catch{return Uh("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Fh.length!==0;){let a=Fh.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return Uh(s)}}function Yx(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),Fh.push([n,r,e,o])):du.push([e,r,t]):(n[r]=t,Fh.push([n,r,e]))}function Qx(t,e,r,n,o,i,s){i+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;as.depthLimit){Yx(aR,t,e,o);return}if(typeof s.edgesLimit<"u"&&r+1>s.edgesLimit){Yx(aR,t,e,o);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n{let e=t?.toString()??At("TRACING_SAMPLING_RATE");if(e===void 0)return;let r=parseFloat(e);if(r<0||r>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${r}`);return r},Oq=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};async function Pq(t){let e=[];for await(let r of t)e.push(r);return e}function Bh(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}var Cq=async t=>{if(t?.status===429){let e=parseInt(t.headers.get("retry-after")??"10",10)*1e3;if(e>0)return await new Promise(r=>setTimeout(r,e)),!0}return!1};function lR(t){return typeof t=="number"?Number(t.toFixed(4)):t}var Rq=24*1024*1024,fR=1024*1024*1024,Nq=1e4,zq=100,dR="https://api.smith.langchain.com",e0=class{constructor(e){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSizeBytes=e??fR}peek(){return this.items[0]}push(e){let r,n=new Promise(i=>{r=i}),o=Pr(e.item,`Serializing run with id: ${e.item.id}`).length;return this.sizeBytes+o>this.maxSizeBytes&&this.items.length>0?(console.warn(`AutoBatchQueue size limit (${this.maxSizeBytes} bytes) exceeded. Dropping run with id: ${e.item.id}. Current queue size: ${this.sizeBytes} bytes, attempted addition: ${o} bytes.`),r(),n):(this.items.push({action:e.action,payload:e.item,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n)}pop({upToSizeBytes:e,upToSize:r}){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let n=[],o=0;for(;o+(this.peek()?.size??0)0&&n.length0){let i=this.items.shift();n.push(i),o+=i.size,this.sizeBytes-=i.size}return[n.map(i=>({action:i.action,item:i.payload,otelContext:i.otelContext,apiKey:i.apiKey,apiUrl:i.apiUrl,size:i.size})),()=>n.forEach(i=>i.itemPromiseResolve())]}},da=class t{get _fetch(){return this.fetchImplementation||eP(this.debug)}constructor(e={}){Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"webUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"workspaceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchIngestCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout_ms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tenantId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filteredPostUuids",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchAggregationDelayMs",{enumerable:!0,configurable:!0,writable:!0,value:250}),Object.defineProperty(this,"batchSizeBytesLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSizeLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"blockOnRootRunFinalization",{enumerable:!0,configurable:!0,writable:!0,value:Qr("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"langSmithToOTELTranslator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchImplementation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cachedLSEnvVarsForMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Qr("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=Aq(e.tracingSamplingRate),this.apiUrl=Bh(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=Bh(e.apiKey??r.apiKey),this.webUrl=Bh(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=Bh(e.workspaceId??At("WORKSPACE_ID")),this.timeout_ms=e.timeout_ms??9e4,this.caller=new Rd({...e.callerOptions??{},maxRetries:4,debug:e.debug??this.debug}),this.traceBatchConcurrency=e.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.debug=e.debug??this.debug,this.fetchImplementation=e.fetchImplementation;let n=e.maxIngestMemoryBytes??fR;this.batchIngestCaller=new Rd({maxRetries:4,maxConcurrency:this.traceBatchConcurrency,maxQueueSizeBytes:n,...e.callerOptions??{},onFailedResponseHook:Cq,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.autoBatchQueue=new e0(n),this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.batchSizeLimit=e.batchSizeLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode,_h()&&(this.langSmithToOTELTranslator=new vh),this.cachedLSEnvVarsForMetadata=fx()}static getDefaultClientConfig(){let e=At("API_KEY"),r=At("ENDPOINT")??dR,n=At("HIDE_INPUTS")==="true",o=At("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:Oq(this.apiUrl)?(this.webUrl="http://localhost:3000",this.webUrl):this.apiUrl.endsWith("/api/v1")?(this.webUrl=this.apiUrl.replace("/api/v1",""),this.webUrl):this.apiUrl.includes("/api")&&!this.apiUrl.split(".",1)[0].endsWith("api")?(this.webUrl=this.apiUrl.replace("/api",""),this.webUrl):this.apiUrl.split(".",1)[0].includes("dev")?(this.webUrl="https://dev.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("eu")?(this.webUrl="https://eu.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("beta")?(this.webUrl="https://beta.smith.langchain.com",this.webUrl):(this.webUrl="https://smith.langchain.com",this.webUrl)}get headers(){let e={"User-Agent":`langsmith-js/${hh}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),this.workspaceId&&(e["x-tenant-id"]=this.workspaceId),e}_getPlatformEndpointPath(e){return this.apiUrl.slice(-3)!=="/v1"&&this.apiUrl.slice(-4)!=="/v1/"?`/v1/platform/${e}`:`/platform/${e}`}async processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}async processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}async prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`;return await this.caller.call(async()=>{let s=await this._fetch(o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,`fetch ${e}`),s})}async _get(e,r){return(await this._getResponse(e,r)).json()}async*_getPaginated(e,r=new URLSearchParams,n){let o=Number(r.get("offset"))||0,i=Number(r.get("limit"))||100;for(;;){r.set("offset",String(o)),r.set("limit",String(i));let s=`${this.apiUrl}${e}?${r}`,a=await this.caller.call(async()=>{let u=await this._fetch(s,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(u,`fetch ${e}`),u}),c=n?n(await a.json()):await a.json();if(c.length===0||(yield c,c.length{let l=await this._fetch(`${this.apiUrl}${e}`,{method:n,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(l,`fetch ${e}`),l})).json();if(!c||!c[o])break;yield c[o];let u=c.cursors;if(!u||!u.next)break;i.cursor=u.next}}_shouldSample(){return this.tracingSampleRate===void 0?!0:Math.random()0;){let[o,i]=this.autoBatchQueue.pop({upToSizeBytes:e,upToSize:r});if(!o.length){i();break}let s=o.reduce((u,l)=>{let d=l.apiUrl??this.apiUrl,f=l.apiKey??this.apiKey,m=l.apiKey===this.apiKey&&l.apiUrl===this.apiUrl?"default":`${d}|${f}`;return u[m]||(u[m]=[]),u[m].push(l),u},{}),a=[];for(let[u,l]of Object.entries(s)){let d=this._processBatch(l,{apiUrl:u==="default"?void 0:u.split("|")[0],apiKey:u==="default"?void 0:u.split("|")[1]});a.push(d)}let c=Promise.all(a).finally(i);n.push(c)}return Promise.all(n)}async _processBatch(e,r){if(!e.length)return;let n=e.reduce((o,i)=>o+(i.size??0),0);try{if(this.langSmithToOTELTranslator!==void 0)this._sendBatchToOTELTranslator(e);else{let o={runCreates:e.filter(s=>s.action==="create").map(s=>s.item),runUpdates:e.filter(s=>s.action==="update").map(s=>s.item)},i=await this._ensureServerInfo();if(i?.batch_ingest_config?.use_multipart_endpoint){let s=i?.instance_flags?.gzip_body_enabled;await this.multipartIngestRuns(o,{...r,useGzip:s,sizeBytes:n})}else await this.batchIngestRuns(o,{...r,sizeBytes:n})}}catch(o){console.error("Error exporting batch:",o)}}_sendBatchToOTELTranslator(e){if(this.langSmithToOTELTranslator!==void 0){let r=new Map,n=[];for(let o of e)o.item.id&&o.otelContext&&(r.set(o.item.id,o.otelContext),o.action==="create"?n.push({operation:"post",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}):n.push({operation:"patch",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}));this.langSmithToOTELTranslator.exportBatch(n,r)}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.item=uR(e.item,this.cachedLSEnvVarsForMetadata);let r=this.autoBatchQueue.push(e);if(this.manualFlushMode)return r;let n=await this._getBatchSizeLimitBytes(),o=await this._getBatchSizeLimit();return(this.autoBatchQueue.sizeBytes>n||this.autoBatchQueue.items.length>o)&&this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o}),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o})},this.autoBatchAggregationDelayMs)),r}async _getServerInfo(){let r=await(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(Nq),...this.fetchOptions});return await ue(n,"get server info"),n})).json();return this.debug&&console.log(` +=== LangSmith Server Configuration === +`+JSON.stringify(r,null,2)+` +`),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch(e){console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${e.status??"Unspecified status code"} ${e.message}`)}return this._serverInfo??{}})()),this._getServerInfoPromise.then(e=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),e))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let e=await this._getBatchSizeLimitBytes(),r=await this._getBatchSizeLimit();await this.drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:r})}_cloneCurrentOTELContext(){let e=yh(),r=oP();if(this.langSmithToOTELTranslator!==void 0){let n=e.getActiveSpan();if(n)return e.setSpan(r.active(),n)}}async createRun(e,r){if(!this._filterForSampling([e]).length)return;let n={...this.headers,"Content-Type":"application/json"},o=e.project_name;delete e.project_name;let i=await this.prepareRunCreateOrUpdateInputs({session_name:o,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&i.trace_id!==void 0&&i.dotted_order!==void 0){let c=this._cloneCurrentOTELContext();this.processRunOperation({action:"create",item:i,otelContext:c,apiKey:r?.apiKey,apiUrl:r?.apiUrl}).catch(console.error);return}let s=uR(i,this.cachedLSEnvVarsForMetadata);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),r?.workspaceId!==void 0&&(n["x-tenant-id"]=r.workspaceId);let a=Pr(s,`Creating run with id: ${s.id}`);await this.caller.call(async()=>{let c=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"create run",!0),c})}async batchIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o=await Promise.all(e?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]),i=await Promise.all(r?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]);if(o.length>0&&i.length>0){let c=o.reduce((l,d)=>(d.id&&(l[d.id]=d),l),{}),u=[];for(let l of i)l.id!==void 0&&c[l.id]?c[l.id]={...c[l.id],...l}:u.push(l);o=Object.values(c),i=u}let s={post:o,patch:i};if(!s.post.length&&!s.patch.length)return;let a={post:[],patch:[]};for(let c of["post","patch"]){let u=c,l=s[u].reverse(),d=l.pop();for(;d!==void 0;)a[u].push(d),d=l.pop()}if(a.post.length>0||a.patch.length>0){let c=a.post.map(u=>u.id).concat(a.patch.map(u=>u.id)).join(",");await this._postBatchIngestRuns(Pr(a,`Ingesting runs with ids: ${c}`),n)}}async _postBatchIngestRuns(e,r){let n={...this.headers,"Content-Type":"application/json",Accept:"application/json"};r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),await this.batchIngestCaller.callWithOptions({sizeBytes:r?.sizeBytes},async()=>{let o=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:e});return await ue(o,"batch create run",!0),o})}async multipartIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o={},i=[];for(let d of e??[]){let f=await this.prepareRunCreateOrUpdateInputs(d);f.id!==void 0&&f.attachments!==void 0&&(o[f.id]=f.attachments),delete f.attachments,i.push(f)}let s=[];for(let d of r??[])s.push(await this.prepareRunCreateOrUpdateInputs(d));if(i.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(s.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(i.length>0&&s.length>0){let d=i.reduce((p,m)=>(m.id&&(p[m.id]=m),p),{}),f=[];for(let p of s)p.id!==void 0&&d[p.id]?d[p.id]={...d[p.id],...p}:f.push(p);i=Object.values(d),s=f}if(i.length===0&&s.length===0)return;let u=[],l=[];for(let[d,f]of[["post",i],["patch",s]])for(let p of f){let{inputs:m,outputs:h,events:_,extra:v,error:b,serialized:x,attachments:k,...T}=p,F={inputs:m,outputs:h,events:_,extra:v,error:b,serialized:x},J=Pr(T,`Serializing for multipart ingestion of run with id: ${T.id}`);l.push({name:`${d}.${T.id}`,payload:new Blob([J],{type:`application/json; length=${J.length}`})});for(let[w,Z]of Object.entries(F)){if(Z===void 0)continue;let oe=Pr(Z,`Serializing ${w} for multipart ingestion of run with id: ${T.id}`);l.push({name:`${d}.${T.id}.${w}`,payload:new Blob([oe],{type:`application/json; length=${oe.length}`})})}if(T.id!==void 0){let w=o[T.id];if(w){delete o[T.id];for(let[Z,oe]of Object.entries(w)){let Q,wt;if(Array.isArray(oe)?[Q,wt]=oe:(Q=oe.mimeType,wt=oe.data),Z.includes(".")){console.warn(`Skipping attachment '${Z}' for run ${T.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}l.push({name:`attachment.${T.id}.${Z}`,payload:new Blob([wt],{type:`${Q}; length=${wt.byteLength}`})})}}}u.push(`trace=${T.trace_id},id=${T.id}`)}await this._sendMultipartRequest(l,u.join("; "),n)}async _createNodeFetchBody(e,r){let n=[];for(let s of e)n.push(new Blob([`--${r}\r +`])),n.push(new Blob([`Content-Disposition: form-data; name="${s.name}"\r +`,`Content-Type: ${s.payload.type}\r +\r +`])),n.push(s.payload),n.push(new Blob([`\r +`]));return n.push(new Blob([`--${r}--\r +`])),await new Blob(n).arrayBuffer()}async _createMultipartStream(e,r){let n=new TextEncoder;return new ReadableStream({async start(i){let s=async a=>{typeof a=="string"?i.enqueue(n.encode(a)):i.enqueue(a)};for(let a of e){await s(`--${r}\r +`),await s(`Content-Disposition: form-data; name="${a.name}"\r +`),await s(`Content-Type: ${a.payload.type}\r +\r +`);let u=a.payload.stream().getReader();try{let l;for(;!(l=await u.read()).done;)i.enqueue(l.value)}finally{u.releaseLock()}await s(`\r +`)}await s(`--${r}--\r +`),i.close()}})}async _sendMultipartRequest(e,r,n){let o="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),i=QO(),s=()=>this._createNodeFetchBody(e,o),a=()=>this._createMultipartStream(e,o),c=async u=>this.batchIngestCaller.callWithOptions({sizeBytes:n?.sizeBytes},async()=>{let l=await u(),d={...this.headers,"Content-Type":`multipart/form-data; boundary=${o}`};n?.apiKey!==void 0&&(d["x-api-key"]=n.apiKey);let f=l;n?.useGzip&&typeof l=="object"&&"pipeThrough"in l&&(f=l.pipeThrough(new CompressionStream("gzip")),d["Content-Encoding"]="gzip");let p=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:d,body:f,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(p,"Failed to send multipart request",!0),p});try{let u,l=!1;!i&&!this.multipartStreamingDisabled&&px()!=="bun"?(l=!0,u=await c(a)):u=await c(s),(!this.multipartStreamingDisabled||l)&&u.status===422&&(n?.apiUrl??this.apiUrl)!==dR&&(console.warn(`Streaming multipart upload to ${n?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${r}".`),this.multipartStreamingDisabled=!0,u=await c(s))}catch(u){console.warn(`${u.message.trim()} + +Context: ${r}`)}}async updateRun(e,r,n){$e(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let o={...r,id:e};if(!this._filterForSampling([o],!0).length)return;if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){let a=this._cloneCurrentOTELContext();if(r.end_time!==void 0&&o.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}else this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}let i={...this.headers,"Content-Type":"application/json"};n?.apiKey!==void 0&&(i["x-api-key"]=n.apiKey),n?.workspaceId!==void 0&&(i["x-tenant-id"]=n.workspaceId);let s=Pr(r,`Serializing payload to update run with id: ${e}`);await this.caller.call(async()=>{let a=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(a,"update run",!0),a})}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){$e(e);let n=await this._get(`/runs/${e}`);return r&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:r,projectOpts:n}){if(r!==void 0){let o;r.session_id?o=r.session_id:n?.projectName?o=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?o=n?.projectId:o=(await this.readProject({projectName:At("PROJECT")||"default"})).id;let i=await this._getTenantId();return`${this.getHostUrl()}/o/${i}/projects/p/${o}/r/${r.id}?poll=true`}else if(e!==void 0){let o=await this.readRun(e);if(!o.app_path)throw new Error(`Run ${e} has no app_path`);return`${this.getHostUrl()}${o.app_path}`}else throw new Error("Must provide either runId or run")}async _loadChildRuns(e){let r=await Pq(this.listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),n={},o={};r.sort((i,s)=>(i?.dotted_order??"").localeCompare(s?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.dotted_order?.startsWith(e.dotted_order??"")&&i.id!==e.id&&(i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i)}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:s,startTime:a,executionOrder:c,isRoot:u,runType:l,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:_,limit:v,select:b,order:x}=e,k=[];if(r&&(k=Array.isArray(r)?r:[r]),n){let w=Array.isArray(n)?n:[n],Z=await Promise.all(w.map(oe=>this.readProject({projectName:oe}).then(Q=>Q.id)));k.push(...Z)}let T=["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],F={session:k.length?k:null,run_type:l,reference_example:s,query:p,filter:m,trace_filter:h,tree_filter:_,execution_order:c,parent_run:o,start_time:a?a.toISOString():null,error:d,id:f,limit:v,trace:i,select:b||T,is_root:u,order:x};F.select.includes("child_run_ids")&&uu("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let J=0;for await(let w of this._getCursorPaginatedList("/runs/query",F))if(v){if(J>=v)break;if(w.length+J>v){yield*w.slice(0,v-J);break}J+=w.length,yield*w}else yield*w}async*listGroupRuns(e){let{projectId:r,projectName:n,groupBy:o,filter:i,startTime:s,endTime:a,limit:c,offset:u}=e,d={session_id:r||(await this.readProject({projectName:n})).id,group_by:o,filter:i,start_time:s?s.toISOString():null,end_time:a?a.toISOString():null,limit:Number(c)||100},f=Number(u)||0,p="/runs/group",m=`${this.apiUrl}${p}`;for(;;){let h={...d,offset:f},_=Object.fromEntries(Object.entries(h).filter(([F,J])=>J!==void 0)),v=JSON.stringify(_),x=await(await this.caller.call(async()=>{let F=await this._fetch(m,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:v});return await ue(F,`Failed to fetch ${p}`),F})).json(),{groups:k,total:T}=x;if(k.length===0)break;for(let F of k)yield F;if(f+=k.length,f>=T)break}}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:s,referenceExampleIds:a,startTime:c,endTime:u,error:l,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:_}){let v=s||[];i&&(v=[...s||[],...await Promise.all(i.map(J=>this.readProject({projectName:J}).then(w=>w.id)))]);let x=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:v,reference_example:a,start_time:c,end_time:u,error:l,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:_}).filter(([J,w])=>w!==void 0)),k=JSON.stringify(x);return await(await this.caller.call(async()=>{let J=await this._fetch(`${this.apiUrl}/runs/stats`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:k});return await ue(J,"get run stats"),J})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||Et()};$e(e);let o=JSON.stringify(n),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ue(a,"share run"),a})).json();if(s===null||!("share_token"in s))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${s.share_token}/r`}async unshareRun(e){$e(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"unshare run",!0),r})}async readRunSharedLink(e){$e(e);let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"read run shared link"),o})).json();if(!(n===null||!("share_token"in n)))return`${this.getHostUrl()}/public/${n.share_token}/r`}async listSharedRuns(e,{runIds:r}={}){let n=new URLSearchParams({share_token:e});if(r!==void 0)for(let s of r)n.append("id",s);return $e(e),await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"list shared runs"),s})).json()}async readDatasetSharedSchema(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id),$e(e);let o=await(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,"read dataset shared schema"),i})).json();return o.url=`${this.getHostUrl()}/public/${o.share_token}/d`,o}async shareDataset(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id);let n={dataset_id:e};$e(e);let o=JSON.stringify(n),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ue(a,"share dataset"),a})).json();return s.url=`${this.getHostUrl()}/public/${s.share_token}/d`,s}async unshareDataset(e){$e(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"unshare dataset",!0),r})}async readSharedDataset(e){return $e(e),await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"read shared dataset"),o})).json()}async listSharedExamples(e,r){let n={};r?.exampleIds&&(n.id=r.exampleIds);let o=new URLSearchParams;Object.entries(n).forEach(([a,c])=>{Array.isArray(c)?c.forEach(u=>o.append(a,u)):o.append(a,c)});let i=await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/public/${e}/examples?${o.toString()}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(a,"list shared examples"),a}),s=await i.json();if(!i.ok)throw"detail"in s?new Error(`Failed to list shared examples. +Status: ${i.status} +Message: ${Array.isArray(s.detail)?s.detail.join(` +`):"Unspecified error"}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return s.map(a=>({...a,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:r=null,metadata:n=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:s=null}){let a=o?"?upsert=true":"",c=`${this.apiUrl}/sessions${a}`,u=i||{};n&&(u.metadata=n);let l={name:e,extra:u,description:r};s!==null&&(l.reference_dataset_id=s);let d=JSON.stringify(l);return await(await this.caller.call(async()=>{let m=await this._fetch(c,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:d});return await ue(m,"create project"),m})).json()}async updateProject(e,{name:r=null,description:n=null,metadata:o=null,projectExtra:i=null,endTime:s=null}){let a=`${this.apiUrl}/sessions/${e}`,c=i;o&&(c={...c||{},metadata:o});let u=JSON.stringify({name:r,extra:c,description:n,end_time:s?new Date(s).toISOString():null});return await(await this.caller.call(async()=>{let f=await this._fetch(a,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"update project"),f})).json()}async hasProject({projectId:e,projectName:r}){let n="/sessions",o=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)$e(e),n+=`/${e}`;else if(r!==void 0)o.append("name",r);else throw new Error("Must provide projectName or projectId");let i=await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${n}?${o}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"has project"),s});try{let s=await i.json();return i.ok?Array.isArray(s)?s.length>0:!0:!1}catch{return!1}}async readProject({projectId:e,projectName:r,includeStats:n}){let o="/sessions",i=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)$e(e),o+=`/${e}`;else if(r!==void 0)i.append("name",r);else throw new Error("Must provide projectName or projectId");n!==void 0&&i.append("include_stats",n.toString());let s=await this._get(o,i),a;if(Array.isArray(s)){if(s.length===0)throw new Error(`Project[id=${e}, name=${r}] not found`);a=s[0]}else a=s;return a}async getProjectUrl({projectId:e,projectName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either projectName or projectId");let n=await this.readProject({projectId:e,projectName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/projects/p/${n.id}`}async getDatasetUrl({datasetId:e,datasetName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");let n=await this.readDataset({datasetId:e,datasetName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/datasets/${n.id}`}async _getTenantId(){if(this._tenantId!==null)return this._tenantId;let e=new URLSearchParams({limit:"1"});for await(let r of this._getPaginated("/sessions",e))return this._tenantId=r[0].tenant_id,r[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:e,name:r,nameContains:n,referenceDatasetId:o,referenceDatasetName:i,includeStats:s,datasetVersion:a,referenceFree:c,metadata:u}={}){let l=new URLSearchParams;if(e!==void 0)for(let d of e)l.append("id",d);if(r!==void 0&&l.append("name",r),n!==void 0&&l.append("name_contains",n),o!==void 0)l.append("reference_dataset",o);else if(i!==void 0){let d=await this.readDataset({datasetName:i});l.append("reference_dataset",d.id)}s!==void 0&&l.append("include_stats",s.toString()),a!==void 0&&l.append("dataset_version",a),c!==void 0&&l.append("reference_free",c.toString()),u!==void 0&&l.append("metadata",JSON.stringify(u));for await(let d of this._getPaginated("/sessions",l))yield*d}async deleteProject({projectId:e,projectName:r}){let n;if(e===void 0&&r===void 0)throw new Error("Must provide projectName or projectId");if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");e===void 0?n=(await this.readProject({projectName:r})).id:n=e,$e(n),await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,`delete session ${n} (${r})`,!0),o})}async uploadCsv({csvFile:e,fileName:r,inputKeys:n,outputKeys:o,description:i,dataType:s,name:a}){let c=`${this.apiUrl}/datasets/upload`,u=new FormData;return u.append("file",e,r),n.forEach(f=>{u.append("input_keys",f)}),o.forEach(f=>{u.append("output_keys",f)}),i&&u.append("description",i),s&&u.append("data_type",s),a&&u.append("name",a),await(await this.caller.call(async()=>{let f=await this._fetch(c,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"upload CSV"),f})).json()}async createDataset(e,{description:r,dataType:n,inputsSchema:o,outputsSchema:i,metadata:s}={}){let a={name:e,description:r,extra:s?{metadata:s}:void 0};n&&(a.data_type=n),o&&(a.inputs_schema_definition=o),i&&(a.outputs_schema_definition=i);let c=JSON.stringify(a);return await(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(d,"create dataset"),d})).json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e&&r)throw new Error("Must provide either datasetName or datasetId, not both");if(e)$e(e),n+=`/${e}`;else if(r)o.append("name",r);else throw new Error("Must provide datasetName or datasetId");let i=await this._get(n,o),s;if(Array.isArray(i)){if(i.length===0)throw new Error(`Dataset[id=${e}, name=${r}] not found`);s=i[0]}else s=i;return s}async hasDataset({datasetId:e,datasetName:r}){try{return await this.readDataset({datasetId:e,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:r,fromVersion:n,toVersion:o}){let i=e;if(i===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:r})).id);let s=new URLSearchParams({from_version:typeof n=="string"?n:n.toISOString(),to_version:typeof o=="string"?o:o.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,s)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:r}){let n="/datasets";if(e===void 0)if(r!==void 0)e=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide either datasetName or datasetId");return(await(await this._getResponse(`${n}/${e}/openai_ft`)).text()).trim().split(` +`).map(a=>JSON.parse(a))}async*listDatasets({limit:e=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:s}={}){let a="/datasets",c=new URLSearchParams({limit:e.toString(),offset:r.toString()});if(n!==void 0)for(let u of n)c.append("id",u);o!==void 0&&c.append("name",o),i!==void 0&&c.append("name_contains",i),s!==void 0&&c.append("metadata",JSON.stringify(s));for await(let u of this._getPaginated(a,c))yield*u}async updateDataset(e){let{datasetId:r,datasetName:n,...o}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;$e(i);let s=JSON.stringify(o);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${i}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"update dataset"),c})).json()}async updateDatasetTag(e){let{datasetId:r,datasetName:n,asOf:o,tag:i}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let s=r??(await this.readDataset({datasetName:n})).id;$e(s);let a=JSON.stringify({as_of:typeof o=="string"?o:o.toISOString(),tag:i});await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${s}/tags`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"update dataset tags",!0),c})}async deleteDataset({datasetId:e,datasetName:r}){let n="/datasets",o=e;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(r!==void 0&&(o=(await this.readDataset({datasetName:r})).id),o!==void 0)$e(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");await this.caller.call(async()=>{let i=await this._fetch(this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,`delete ${n}`,!0),i})}async indexDataset({datasetId:e,datasetName:r,tag:n}){let o=e;if(!o&&!r)throw new Error("Must provide either datasetName or datasetId");if(o&&r)throw new Error("Must provide either datasetName or datasetId, not both");o||(o=(await this.readDataset({datasetName:r})).id),$e(o);let s=JSON.stringify({tag:n});await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${o}/index`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"index dataset"),c})).json()}async similarExamples(e,r,n,{filter:o}={}){let i={limit:n,inputs:e};o!==void 0&&(i.filter=o),$e(r);let s=JSON.stringify(i);return(await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${r}/search`,{headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,method:"POST",body:s});return await ue(u,"fetch similar examples"),u})).json()).examples}async createExample(e,r,n){if(pR(e)&&(r!==void 0||n!==void 0))throw new Error("Cannot provide outputs or options when using ExampleCreate object");let o=r?n?.datasetId:e.dataset_id,i=r?n?.datasetName:e.dataset_name;if(o===void 0&&i===void 0)throw new Error("Must provide either datasetName or datasetId");if(o!==void 0&&i!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");o===void 0&&(o=(await this.readDataset({datasetName:i})).id);let s=(r?n?.createdAt:e.created_at)||new Date,a;pR(e)?a=e:a={inputs:e,outputs:r,created_at:s?.toISOString(),id:n?.exampleId,metadata:n?.metadata,split:n?.split,source_run_id:n?.sourceRunId,use_source_run_io:n?.useSourceRunIO,use_source_run_attachments:n?.useSourceRunAttachments,attachments:n?.attachments};let c=await this._uploadExamplesMultipart(o,[a]);return await this.readExample(c.example_ids?.[0]??Et())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let b=e,x=b[0].dataset_id,k=b[0].dataset_name;if(x===void 0&&k===void 0)throw new Error("Must provide either datasetName or datasetId");if(x!==void 0&&k!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");x===void 0&&(x=(await this.readDataset({datasetName:k})).id);let T=await this._uploadExamplesMultipart(x,b);return await Promise.all(T.example_ids.map(J=>this.readExample(J)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:s,useSourceRunIOs:a,useSourceRunAttachments:c,attachments:u,exampleIds:l,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((b,x)=>({dataset_id:p,inputs:b,outputs:n?.[x],metadata:o?.[x],split:i?.[x],id:l?.[x],attachments:u?.[x],source_run_id:s?.[x],use_source_run_io:a?.[x],use_source_run_attachments:c?.[x]})),_=await this._uploadExamplesMultipart(p,h);return await Promise.all(_.example_ids.map(b=>this.readExample(b)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(s=>Ox(s)?Px(s):s),i=Ox(r)?Px(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){$e(e);let r=`/examples/${e}`,n=await this._get(r),{attachment_urls:o,...i}=n,s=i;return o&&(s.attachments=Object.entries(o).reduce((a,[c,u])=>(a[c.slice(11)]={presigned_url:u.presigned_url,mime_type:u.mime_type},a),{})),s}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:s,metadata:a,limit:c,offset:u,filter:l,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=o?typeof o=="string"?o:o?.toISOString():void 0;m&&p.append("as_of",m);let h=s??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let v of n)p.append("id",v);if(i!==void 0)for(let v of i)p.append("splits",v);if(a!==void 0){let v=JSON.stringify(a);p.append("metadata",v)}c!==void 0&&p.append("limit",c.toString()),u!==void 0&&p.append("offset",u.toString()),l!==void 0&&p.append("filter",l),d===!0&&["attachment_urls","outputs","metadata"].forEach(v=>p.append("select",v));let _=0;for await(let v of this._getPaginated("/examples",p)){for(let b of v){let{attachment_urls:x,...k}=b,T=k;x&&(T.attachments=Object.entries(x).reduce((F,[J,w])=>(F[J.slice(11)]={presigned_url:w.presigned_url,mime_type:w.mime_type||void 0},F),{})),yield T,_++}if(c!==void 0&&_>=c)break}}async deleteExample(e){$e(e);let r=`/examples/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,`delete ${r}`,!0),n})}async updateExample(e,r){let n;r?n=e:n=e.id,$e(n);let o;r?o={id:n,...r}:o=e;let i;return o.dataset_id!==void 0?i=o.dataset_id:i=(await this.readExample(n)).dataset_id,this._updateExamplesMultipart(i,[o])}async updateExamples(e){let r;return e[0].dataset_id===void 0?r=(await this.readExample(e[0].id)).dataset_id:r=e[0].dataset_id,this._updateExamplesMultipart(r,e)}async readDatasetVersion({datasetId:e,datasetName:r,asOf:n,tag:o}){let i;if(e?i=e:i=(await this.readDataset({datasetName:r})).id,$e(i),n&&o||!n&&!o)throw new Error("Exactly one of asOf and tag must be specified.");let s=new URLSearchParams;return n!==void 0&&s.append("as_of",typeof n=="string"?n:n.toISOString()),o!==void 0&&s.append("tag",o),await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${i}/version?${s.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(c,"read dataset version"),c})).json()}async listDatasetSplits({datasetId:e,datasetName:r,asOf:n}){let o;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?o=(await this.readDataset({datasetName:r})).id:o=e,$e(o);let i=new URLSearchParams,s=n?typeof n=="string"?n:n?.toISOString():void 0;return s&&i.append("as_of",s),await this._get(`/datasets/${o}/splits`,i)}async updateDatasetSplits({datasetId:e,datasetName:r,splitName:n,exampleIds:o,remove:i=!1}){let s;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?s=(await this.readDataset({datasetName:r})).id:s=e,$e(s);let a={split_name:n,examples:o.map(u=>($e(u),u)),remove:i},c=JSON.stringify(a);await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${s}/splits`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(u,"update dataset splits",!0),u})}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){uu("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let s;if(typeof e=="string")s=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)s=e;else throw new Error(`Invalid run type: ${typeof e}`);s.reference_example_id!==null&&s.reference_example_id!==void 0&&(i=await this.readExample(s.reference_example_id));let a=await r.evaluateRun(s,i),[c,u]=await this._logEvaluationFeedback(a,s,n);return u[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:s,sourceInfo:a,feedbackSourceType:c="api",sourceRunId:u,feedbackId:l,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:c??"api",metadata:a??{}};u!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:u}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&$e(m.metadata.__run.run_id);let h={id:l??Et(),run_id:e,key:r,score:lR(n),value:o,correction:i,comment:s,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},_=JSON.stringify(h),v=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{let b=await this._fetch(v,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:_});return await ue(b,"create feedback",!0),b}),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let s={};r!=null&&(s.score=lR(r)),n!=null&&(s.value=n),o!=null&&(s.correction=o),i!=null&&(s.comment=i),$e(e);let a=JSON.stringify(s);await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"update feedback",!0),c})}async readFeedback(e){$e(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){$e(e);let r=`/feedback/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,`delete ${r}`,!0),n})}async*listFeedback({runIds:e,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(e)for(let i of e)$e(i),o.append("run",i);if(r)for(let i of r)o.append("key",i);if(n)for(let i of n)o.append("source",i);for await(let i of this._getPaginated("/feedback",o))yield*i}async createPresignedFeedbackToken(e,r,{expiration:n,feedbackConfig:o}={}){let i={run_id:e,feedback_key:r,feedback_config:o};n?typeof n=="string"?i.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(i.expires_in=n):i.expires_in={hours:3};let s=JSON.stringify(i);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"create presigned feedback token"),c})).json()}async createComparativeExperiment({name:e,experimentIds:r,referenceDatasetId:n,createdAt:o,description:i,metadata:s,id:a}){if(r.length===0)throw new Error("At least one experiment is required");if(n||(n=(await this.readProject({projectId:r[0]})).reference_dataset_id),!n==null)throw new Error("A reference dataset is required");let c={id:a,name:e,experiment_ids:r,reference_dataset_id:n,description:i,created_at:(o??new Date)?.toISOString(),extra:{}};s&&(c.extra.metadata=s);let u=JSON.stringify(c);return(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(d,"create comparative experiment"),d})).json()}async*listPresignedFeedbackTokens(e){$e(e);let r=new URLSearchParams({run_id:e});for await(let n of this._getPaginated("/feedback/tokens",r))yield*n}_selectEvalResults(e){let r;return"results"in e?r=e.results:Array.isArray(e)?r=e:r=[e],r}async _logEvaluationFeedback(e,r,n){let o=this._selectEvalResults(e),i=[];for(let s of o){let a=n||{};s.evaluatorInfo&&(a={...s.evaluatorInfo,...a});let c=null;s.targetRunId?c=s.targetRunId:r&&(c=r.id),i.push(await this.createFeedback(c,s.key,{score:s.score,value:s.value,comment:s.comment,correction:s.correction,sourceInfo:a,sourceRunId:s.sourceRunId,feedbackConfig:s.feedbackConfig,feedbackSourceType:"model"}))}return[o,i]}async logEvaluationFeedback(e,r,n){let[o]=await this._logEvaluationFeedback(e,r,n);return o}async*listAnnotationQueues(e={}){let{queueIds:r,name:n,nameContains:o,limit:i}=e,s=new URLSearchParams;r&&r.forEach((c,u)=>{$e(c,`queueIds[${u}]`),s.append("ids",c)}),n&&s.append("name",n),o&&s.append("name_contains",o),s.append("limit",(i!==void 0?Math.min(i,100):100).toString());let a=0;for await(let c of this._getPaginated("/annotation-queues",s))if(yield*c,a++,i!==void 0&&a>=i)break}async createAnnotationQueue(e){let{name:r,description:n,queueId:o,rubricInstructions:i}=e,s={name:r,description:n,id:o||Et(),rubric_instructions:i},a=JSON.stringify(Object.fromEntries(Object.entries(s).filter(([u,l])=>l!==void 0)));return(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(u,"create annotation queue"),u})).json()}async readAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"read annotation queue"),n})).json()}async updateAnnotationQueue(e,r){let{name:n,description:o,rubricInstructions:i}=r,s=JSON.stringify({name:n,description:o,rubric_instructions:i});await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(a,"update annotation queue",!0),a})}async deleteAnnotationQueue(e){await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"delete annotation queue",!0),r})}async addRunsToAnnotationQueue(e,r){let n=JSON.stringify(r.map((o,i)=>$e(o,`runIds[${i}]`).toString()));await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(o,"add runs to annotation queue",!0),o})}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${$e(e,"queueId")}/run`;return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,"get run from annotation queue"),i})).json()}async deleteRunFromAnnotationQueue(e,r){await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/runs/${$e(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"delete run from annotation queue",!0),n})}async getSizeFromAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"get size from annotation queue"),n})).json()}async _currentTenantIsOwner(e){let r=await this._getSettings();return e=="-"||r.tenant_handle===e}async _ownerConflictError(e,r){let n=await this._getSettings();return new Error(`Cannot ${e} for another tenant. + + Current tenant: ${n.tenant_handle} + + Requested tenant: ${r}`)}async _getLatestCommitHash(e){let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/commits/${e}/?limit=1&offset=0`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"get latest commit hash"),o})).json();if(n.commits.length!==0)return n.commits[0].commit_hash}async _likeOrUnlikePrompt(e,r){let[n,o,i]=Wo(e),s=JSON.stringify({like:r});return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/likes/${n}/${o}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,`${r?"like":"unlike"} prompt`),c})).json()}async _getPromptUrl(e){let[r,n,o]=Wo(e);if(await this._currentTenantIsOwner(r)){let i=await this._getSettings();return o!=="latest"?`${this.getHostUrl()}/prompts/${n}/${o.substring(0,8)}?organizationId=${i.id}`:`${this.getHostUrl()}/prompts/${n}?organizationId=${i.id}`}else return o!=="latest"?`${this.getHostUrl()}/hub/${r}/${n}/${o.substring(0,8)}`:`${this.getHostUrl()}/hub/${r}/${n}`}async promptExists(e){return!!await this.getPrompt(e)}async likePrompt(e){return this._likeOrUnlikePrompt(e,!0)}async unlikePrompt(e){return this._likeOrUnlikePrompt(e,!1)}async*listCommits(e){for await(let r of this._getPaginated(`/commits/${e}/`,new URLSearchParams,n=>n.commits))yield*r}async*listPrompts(e){let r=new URLSearchParams;r.append("sort_field",e?.sortField??"updated_at"),r.append("sort_direction","desc"),r.append("is_archived",(!!e?.isArchived).toString()),e?.isPublic!==void 0&&r.append("is_public",e.isPublic.toString()),e?.query&&r.append("query",e.query);for await(let n of this._getPaginated("/repos",r,o=>o.repos))yield*n}async getPrompt(e){let[r,n,o]=Wo(e),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return a?.status===404?null:(await ue(a,"get prompt"),a)}))?.json();return s?.repo?s.repo:null}async createPrompt(e,r){let n=await this._getSettings();if(r?.isPublic&&!n.tenant_handle)throw new Error(`Cannot create a public prompt without first + + creating a LangChain Hub handle. + You can add a handle by creating a public prompt at: + + https://smith.langchain.com/prompts`);let[o,i,s]=Wo(e);if(!await this._currentTenantIsOwner(o))throw await this._ownerConflictError("create a prompt",o);let a={repo_handle:i,...r?.description&&{description:r.description},...r?.readme&&{readme:r.readme},...r?.tags&&{tags:r.tags},is_public:!!r?.isPublic},c=JSON.stringify(a),u=await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(d,"create prompt"),d}),{repo:l}=await u.json();return l}async createCommit(e,r,n){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[o,i,s]=Wo(e),a=n?.parentCommitHash==="latest"||!n?.parentCommitHash?await this._getLatestCommitHash(`${o}/${i}`):n?.parentCommitHash,c={manifest:JSON.parse(JSON.stringify(r)),parent_commit:a},u=JSON.stringify(c),d=await(await this.caller.call(async()=>{let f=await this._fetch(`${this.apiUrl}/commits/${o}/${i}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"create commit"),f})).json();return this._getPromptUrl(`${o}/${i}${d.commit_hash?`:${d.commit_hash}`:""}`)}async updateExamplesMultipart(e,r=[]){return this._updateExamplesMultipart(e,r)}async _updateExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let s of r){let a=s.id,c={...s.metadata&&{metadata:s.metadata},...s.split&&{split:s.split}},u=Pr(c,`Serializing body for example with id: ${a}`),l=new Blob([u],{type:"application/json"});if(n.append(a,l),s.inputs){let d=Pr(s.inputs,`Serializing inputs for example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.inputs`,f)}if(s.outputs){let d=Pr(s.outputs,`Serializing outputs whle updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.outputs`,f)}if(s.attachments)for(let[d,f]of Object.entries(s.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${a}.attachment.${d}`,h)}if(s.attachments_operations){let d=Pr(s.attachments_operations,`Serializing attachments while updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.attachments_operations`,f)}}let o=e??r[0]?.dataset_id;return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${o}/examples`)}`,{method:"PATCH",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(s,"update examples"),s})).json()}async uploadExamplesMultipart(e,r=[]){return this._uploadExamplesMultipart(e,r)}async _uploadExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let i of r){let s=(i.id??Et()).toString(),a={created_at:i.created_at,...i.metadata&&{metadata:i.metadata},...i.split&&{split:i.split},...i.source_run_id&&{source_run_id:i.source_run_id},...i.use_source_run_io&&{use_source_run_io:i.use_source_run_io},...i.use_source_run_attachments&&{use_source_run_attachments:i.use_source_run_attachments}},c=Pr(a,`Serializing body for uploaded example with id: ${s}`),u=new Blob([c],{type:"application/json"});if(n.append(s,u),i.inputs){let l=Pr(i.inputs,`Serializing inputs for uploaded example with id: ${s}`),d=new Blob([l],{type:"application/json"});n.append(`${s}.inputs`,d)}if(i.outputs){let l=Pr(i.outputs,`Serializing outputs for uploaded example with id: ${s}`),d=new Blob([l],{type:"application/json"});n.append(`${s}.outputs`,d)}if(i.attachments)for(let[l,d]of Object.entries(i.attachments)){let f,p;Array.isArray(d)?[f,p]=d:(f=d.mimeType,p=d.data);let m=new Blob([p],{type:`${f}; length=${p.byteLength}`});n.append(`${s}.attachment.${l}`,m)}}return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(i,"upload examples"),i})).json()}async updatePrompt(e,r){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[n,o]=Wo(e);if(!await this._currentTenantIsOwner(n))throw await this._ownerConflictError("update a prompt",n);let i={};if(r?.description!==void 0&&(i.description=r.description),r?.readme!==void 0&&(i.readme=r.readme),r?.tags!==void 0&&(i.tags=r.tags),r?.isPublic!==void 0&&(i.is_public=r.isPublic),r?.isArchived!==void 0&&(i.is_archived=r.isArchived),Object.keys(i).length===0)throw new Error("No valid update options provided");let s=JSON.stringify(i);return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/repos/${n}/${o}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"update prompt"),c})).json()}async deletePrompt(e){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[r,n,o]=Wo(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"delete prompt"),s})).json()}async pullPromptCommit(e,r){let[n,o,i]=Wo(e),a=await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/commits/${n}/${o}/${i}${r?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(c,"pull prompt commit"),c})).json();return{owner:n,repo:o,commit_hash:a.commit_hash,manifest:a.manifest,examples:a.examples}}async _pullPrompt(e,r){let n=await this.pullPromptCommit(e,{includeModel:r?.includeModel});return JSON.stringify(n.manifest)}async pushPrompt(e,r){return await this.promptExists(e)?r&&Object.keys(r).some(o=>o!=="object")&&await this.updatePrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}):await this.createPrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}),r?.object?await this.createCommit(e,r?.object,{parentCommitHash:r?.parentCommitHash}):await this._getPromptUrl(e)}async clonePublicDataset(e,r={}){let{sourceApiUrl:n=this.apiUrl,datasetName:o}=r,[i,s]=this.parseTokenOrUrl(e,n),a=new t({apiUrl:i,apiKey:"placeholder"}),c=await a.readSharedDataset(s),u=o||c.name;try{if(await this.hasDataset({datasetId:u})){console.log(`Dataset ${u} already exists in your tenant. Skipping.`);return}}catch{}let l=await a.listSharedExamples(s),d=await this.createDataset(u,{description:c.description,dataType:c.data_type||"kv",inputsSchema:c.inputs_schema_definition??void 0,outputsSchema:c.outputs_schema_definition??void 0});try{await this.createExamples({inputs:l.map(f=>f.inputs),outputs:l.flatMap(f=>f.outputs?[f.outputs]:[]),datasetId:d.id})}catch(f){throw console.error(`An error occurred while creating dataset ${u}. You should delete it manually.`),f}}parseTokenOrUrl(e,r,n=2,o="dataset"){try{return $e(e),[r,e]}catch{}try{let s=new URL(e).pathname.split("/").filter(a=>a!=="");if(s.length>=n){let a=s[s.length-n];return[r,a]}else throw new Error(`Invalid public ${o} URL: ${e}`)}catch{throw new Error(`Invalid public ${o} URL or token: ${e}`)}}async awaitPendingTraceBatches(){if(this.manualFlushMode)return console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve();await Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()]),this.langSmithToOTELTranslator!==void 0&&await iP()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}};function pR(t){return"dataset_id"in t||"dataset_name"in t}var mR=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>At(r)==="true");var mo=Symbol.for("lc:context_variables"),Zh=Symbol.for("langsmith:replica_trace_roots");function t0(t,e){if(mo in t)return t[mo][e]}function hR(t,e,r){let n=mo in t?t[mo]:{};n[e]=r,t[mo]=n}var Fd=36,Bd="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function gR(t){let r=Object.keys(t).sort().map(n=>`${n}:${t[n]??""}`).join("|");return ua(r,Bd)}function Mq(t){return t.replace(/[-:.]/g,"")}function yR(t,e=1){let r=e.toFixed(0).slice(0,3).padStart(3,"0");return`${new Date(t).toISOString().slice(0,-1)}${r}Z`}function r0(t,e,r=1){let n=yR(t,r);return{dottedOrder:Mq(n)+e,microsecondPrecisionDatestring:n}}var qh=class t{constructor(e,r,n,o){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n,this.replicas=o}static fromHeader(e){let r=e.split(","),n={},o=[],i,s;for(let a of r){let[c,u]=a.split("="),l=decodeURIComponent(u);c==="langsmith-metadata"?n=JSON.parse(l):c==="langsmith-tags"?o=l.split(","):c==="langsmith-project"?i=l:c==="langsmith-replicas"&&(s=JSON.parse(l))}return new t(n,o,i,s)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}},Ln=class t{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"distributedParentId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),vR(e)){Object.assign(this,{...e});return}let r=t.getDefaultConfig(),{metadata:n,...o}=e,i=o.client??t.getSharedClient(),s={...n,...o?.extra?.metadata};if(o.extra={...o.extra,metadata:s},"id"in o&&o.id==null&&delete o.id,Object.assign(this,{...r,...o,client:i}),this.execution_order??=1,this.child_execution_order??=1,this.dotted_order||(this._serialized_start_time=yR(this.start_time,this.execution_order)),this.id||(this.id=mh(this._serialized_start_time??this.start_time)),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.replicas=Uq(this.replicas),!this.dotted_order){let{dottedOrder:a}=r0(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+a:this.dotted_order=a}}set metadata(e){this.extra={...this.extra,metadata:{...this.extra?.metadata,...e}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){let e=Date.now();return{run_type:"chain",project_name:Pd(),child_runs:[],api_url:Qr("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Qr("LANGCHAIN_API_KEY"),caller_options:{},start_time:e,serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new da),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=this.replicas?.map(l=>{let{reroot:d,...f}=l;return f}),o=e.replicas??n,i=new t({...e,parent_run:this,project_name:this.project_name,replicas:o,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});mo in this&&(i[mo]=this[mo]);let s=Symbol.for("lc:child_config"),a=e.extra?.[s]??this.extra[s];if(Dq(a)){let l={...a},d=jq(l.callbacks)?l.callbacks.copy?.():void 0;d&&(Object.assign(d,{_parentRunId:i.id}),d.handlers?.find(bR)?.updateFromRunTree?.(i),l.callbacks=d),i.extra[s]=l}let c=new Set,u=this;for(;u!=null&&!c.has(u.id);)c.add(u.id),u.child_execution_order=Math.max(u.child_execution_order,r),u=u.parent_run;return this.child_runs.push(i),i}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o?.runtime?.library===void 0&&(o.runtime||(o.runtime={}),r))for(let[a,c]of Object.entries(r))o.runtime[a]||(o.runtime[a]=c);let i,s;return n?(s=e.parent_run?.id??e.parent_run_id,i=[]):(i=e.child_runs.map(a=>this._convertToCreate(a,r,n)),s=void 0),{id:e.id,name:e.name,start_time:e._serialized_start_time??e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:o,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:i,parent_run_id:s,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments,events:e.events}}_sliceParentId(e,r){if(r.dotted_order){let n=r.dotted_order.split("."),o=null;for(let i=0;i0?r.trace_id=i[0].slice(-Fd):r.trace_id=r.id}}r.parent_run_id===e&&(r.parent_run_id=void 0)}_setReplicaTraceRoot(e,r){let n=t0(this,Zh)??{};n[e]=r,hR(this,Zh,n);for(let o of this.child_runs)o._setReplicaTraceRoot(e,r)}_remapForProject(e){let{projectName:r,runtimeEnv:n,excludeChildRuns:o=!0,reroot:i=!1,distributedParentId:s,apiUrl:a,apiKey:c,workspaceId:u}=e,l=this._convertToCreate(this,n,o);if(r===this.project_name)return{...l,session_name:r};if(i){if(s)this._sliceParentId(s,l);else if(l.parent_run_id=void 0,l.dotted_order){let b=l.dotted_order.split(".");b.length>0&&(l.dotted_order=b[b.length-1],l.trace_id=l.id)}let v=gR({projectName:r,apiUrl:a,apiKey:c,workspaceId:u});this._setReplicaTraceRoot(v,l.id)}let d;if(!i){let v=t0(this,Zh)??{},b=gR({projectName:r,apiUrl:a,apiKey:c,workspaceId:u});if(d=v[b],d&&(l.trace_id=d,l.dotted_order)){let x=l.dotted_order.split("."),k=null;for(let T=0;T{let k=x.slice(-Fd),T=ua(`${k}:${r}`,Bd);return x.slice(0,-Fd)+T}).join(".")),{...l,id:p,trace_id:m,parent_run_id:h,dotted_order:_,session_name:r}}async postRun(e=!0){try{let r=gh();if(this.replicas&&this.replicas.length>0)for(let{projectName:n,apiKey:o,apiUrl:i,workspaceId:s,reroot:a}of this.replicas){let c=this._remapForProject({projectName:n??this.project_name,runtimeEnv:r,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:i,apiKey:o,workspaceId:s});await this.client.createRun(c,{apiKey:o,apiUrl:i,workspaceId:s})}else{let n=this._convertToCreate(this,r,e);await this.client.createRun(n)}if(!e){uu("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let n of this.child_runs)await n.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(e){if(this.replicas&&this.replicas.length>0)for(let{projectName:r,apiKey:n,apiUrl:o,workspaceId:i,updates:s,reroot:a}of this.replicas){let c=this._remapForProject({projectName:r??this.project_name,runtimeEnv:void 0,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:o,apiKey:n,workspaceId:i}),u={id:c.id,name:c.name,run_type:c.run_type,start_time:c.start_time,outputs:c.outputs,error:c.error,parent_run_id:c.parent_run_id,session_name:c.session_name,reference_example_id:c.reference_example_id,end_time:c.end_time,dotted_order:c.dotted_order,trace_id:c.trace_id,events:c.events,tags:c.tags,extra:c.extra,attachments:this.attachments,...s};e?.excludeInputs||(u.inputs=c.inputs),await this.client.updateRun(c.id,u,{apiKey:n,apiUrl:o,workspaceId:i})}else try{let r={name:this.name,run_type:this.run_type,start_time:this._serialized_start_time??this.start_time,end_time:this.end_time,error:this.error,outputs:this.outputs,parent_run_id:this.parent_run?.id??this.parent_run_id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};e?.excludeInputs||(r.inputs=this.inputs),await this.client.updateRun(this.id,r)}catch(r){console.error(`Error in patchRun for run ${this.id}`,r)}}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(e){this.events||(this.events=[]),typeof e=="string"?this.events.push({name:"event",time:new Date().toISOString(),message:e}):this.events.push({...e,time:e.time??new Date().toISOString()})}static fromRunnableConfig(e,r){let n=e?.callbacks,o,i,s,a=mR();if(n){let u=n?.getParentRunId?.()??"",l=n?.handlers?.find(d=>d?.name=="langchain_tracer");o=l?.getRun?.(u),i=l?.projectName,s=l?.client,a=a||!!l}return o?new t({name:o.name,id:o.id,trace_id:o.trace_id,dotted_order:o.dotted_order,client:s,tracingEnabled:a,project_name:i,tags:[...new Set((o?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...o?.extra?.metadata,...e?.metadata}}}).createChild(r):new t({...r,client:s,tracingEnabled:a,project_name:i})}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,r){let n="get"in e&&typeof e.get=="function"?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,o=n["langsmith-trace"];if(!o||typeof o!="string")return;let i=o.trim(),s=i.split(".").map(l=>{let[d,f]=l.split("Z");return{strTime:d,time:Date.parse(d+"Z"),uuid:f}}),a=s[0].uuid,c={...r,name:r?.name??"parent",run_type:r?.run_type??"chain",start_time:r?.start_time??Date.now(),id:s.at(-1)?.uuid,trace_id:a,dotted_order:i};if(n.baggage&&typeof n.baggage=="string"){let l=qh.fromHeader(n.baggage);c.metadata=l.metadata,c.tags=l.tags,c.project_name=l.project_name,c.replicas=l.replicas}let u=new t(c);return u.distributedParentId=u.id,u}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new qh(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(Ln,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null});function vR(t){return t!=null&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function bR(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function _R(t){return Array.isArray(t)&&t.some(e=>bR(e))}function jq(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function Dq(t){return t!=null&&typeof t.callbacks=="object"&&(_R(t.callbacks?.handlers)||_R(t.callbacks))}function Lq(){let t=Qr("LANGSMITH_RUNS_ENDPOINTS");if(!t)return[];try{let e=JSON.parse(t);if(Array.isArray(e)){let r=[];for(let n of e){if(typeof n!="object"||n===null){console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got ${typeof n}`);continue}if(typeof n.api_url!="string"){console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_url}`);continue}if(typeof n.api_key!="string"){console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_key}`);continue}r.push({apiUrl:n.api_url.replace(/\/$/,""),apiKey:n.api_key})}return r}else if(typeof e=="object"&&e!==null){Fq(e);let r=[];for(let[n,o]of Object.entries(e)){let i=n.replace(/\/$/,"");if(typeof o=="string")r.push({apiUrl:i,apiKey:o});else{console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${n}: expected string, got ${typeof o}`);continue}}return r}else return console.warn(`Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey, got ${typeof e}`),[]}catch(e){if(sR(e))throw e;return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey"),[]}}function Uq(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):Lq()}function Fq(t){if(Object.keys(t).length>0&&At("ENDPOINT"))throw new Lh}var Bq={};G(Bq,{BaseTracer:()=>Un,isBaseTracer:()=>fa});var Zq=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};function o0(t,e){if(t)return new Ln({...t,start_time:t._serialized_start_time??t.start_time,parent_run:o0(e),child_runs:t.child_runs.map(r=>o0(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:ex()},tracingEnabled:!1})}function n0(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function fa(t){return typeof t._addRunToRunMap=="function"}var Un=class extends la{runMap=new Map;runTreeMap=new Map;usesRunTreeMap=!1;constructor(t){super(...arguments)}copy(){return this}getRunById(t){if(t!==void 0)return this.usesRunTreeMap?Zq(this.runTreeMap.get(t)):this.runMap.get(t)}stringifyError(t){return t instanceof Error?t.message+(t?.stack?` + +${t.stack}`:""):typeof t=="string"?t:`${t}`}_addChildRun(t,e){t.child_runs.push(e)}_addRunToRunMap(t){let{dottedOrder:e,microsecondPrecisionDatestring:r}=r0(new Date(t.start_time).getTime(),t.id,t.execution_order),n={...t},o=this.getRunById(n.parent_run_id);if(n.parent_run_id!==void 0?o&&(this._addChildRun(o,n),o.child_execution_order=Math.max(o.child_execution_order,n.child_execution_order),n.trace_id=o.trace_id,o.dotted_order!==void 0&&(n.dotted_order=[o.dotted_order,e].join("."),n._serialized_start_time=r)):(n.trace_id=n.id,n.dotted_order=e,n._serialized_start_time=r),this.usesRunTreeMap){let i=o0(n,o);i!==void 0&&this.runTreeMap.set(n.id,i)}else this.runMap.set(n.id,n);return n}async _endTrace(t){let e=t.parent_run_id!==void 0&&this.getRunById(t.parent_run_id);e?e.child_execution_order=Math.max(e.child_execution_order,t.child_execution_order):await this.persistRun(t),await this.onRunUpdate?.(t),this.usesRunTreeMap?this.runTreeMap.delete(t.id):this.runMap.delete(t.id)}_getExecutionOrder(t){let e=t!==void 0&&this.getRunById(t);return e?e.child_execution_order+1:1}_createRunForLLMStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l=s?{...o,metadata:s}:o,d={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{prompts:e},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:l??{},tags:i||[]};return this._addRunToRunMap(d)}async handleLLMStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForLLMStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}_createRunForChatModelStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l=s?{...o,metadata:s}:o,d={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{messages:e},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:l??{},tags:i||[]};return this._addRunToRunMap(d)}async handleChatModelStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForChatModelStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}async handleLLMEnd(t,e,r,n,o){let i=this.getRunById(e);if(!i||i?.run_type!=="llm")throw new Error("No LLM run to end.");return i.end_time=Date.now(),i.outputs=t,i.events.push({name:"end",time:new Date(i.end_time).toISOString()}),i.extra={...i.extra,...o},await this.onLLMEnd?.(i),await this._endTrace(i),i}async handleLLMError(t,e,r,n,o){let i=this.getRunById(e);if(!i||i?.run_type!=="llm")throw new Error("No LLM run to end.");return i.end_time=Date.now(),i.error=this.stringifyError(t),i.events.push({name:"error",time:new Date(i.end_time).toISOString()}),i.extra={...i.extra,...o},await this.onLLMError?.(i),await this._endTrace(i),i}_createRunForChainStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:e,execution_order:c,child_execution_order:c,run_type:s??"chain",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(l)}async handleChainStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForChainStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onChainStart?.(c),c}async handleChainEnd(t,e,r,n,o){let i=this.getRunById(e);if(!i)throw new Error("No chain run to end.");return i.end_time=Date.now(),i.outputs=n0(t,"output"),i.events.push({name:"end",time:new Date(i.end_time).toISOString()}),o?.inputs!==void 0&&(i.inputs=n0(o.inputs,"input")),await this.onChainEnd?.(i),await this._endTrace(i),i}async handleChainError(t,e,r,n,o){let i=this.getRunById(e);if(!i)throw new Error("No chain run to end.");return i.end_time=Date.now(),i.error=this.stringifyError(t),i.events.push({name:"error",time:new Date(i.end_time).toISOString()}),o?.inputs!==void 0&&(i.inputs=n0(o.inputs,"input")),await this.onChainError?.(i),await this._endTrace(i),i}_createRunForToolStart(t,e,r,n,o,i,s){let a=this._getExecutionOrder(n),c=Date.now(),u={id:r,name:s??t.id[t.id.length-1],parent_run_id:n,start_time:c,serialized:t,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{input:e},execution_order:a,child_execution_order:a,run_type:"tool",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(u)}async handleToolStart(t,e,r,n,o,i,s){let a=this.getRunById(r)??this._createRunForToolStart(t,e,r,n,o,i,s);return await this.onRunCreate?.(a),await this.onToolStart?.(a),a}async handleToolEnd(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.outputs={output:t},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onToolEnd?.(r),await this._endTrace(r),r}async handleToolError(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.error=this.stringifyError(t),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onToolError?.(r),await this._endTrace(r),r}async handleAgentAction(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="chain")return;let n=r;n.actions=n.actions||[],n.actions.push(t),n.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentAction?.(r)}async handleAgentEnd(t,e){let r=this.getRunById(e);!r||r?.run_type!=="chain"||(r.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentEnd?.(r))}_createRunForRetrieverStart(t,e,r,n,o,i,s){let a=this._getExecutionOrder(n),c=Date.now(),u={id:r,name:s??t.id[t.id.length-1],parent_run_id:n,start_time:c,serialized:t,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{query:e},execution_order:a,child_execution_order:a,run_type:"retriever",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(u)}async handleRetrieverStart(t,e,r,n,o,i,s){let a=this.getRunById(r)??this._createRunForRetrieverStart(t,e,r,n,o,i,s);return await this.onRunCreate?.(a),await this.onRetrieverStart?.(a),a}async handleRetrieverEnd(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.outputs={documents:t},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onRetrieverEnd?.(r),await this._endTrace(r),r}async handleRetrieverError(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.error=this.stringifyError(t),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onRetrieverError?.(r),await this._endTrace(r),r}async handleText(t,e){let r=this.getRunById(e);!r||r?.run_type!=="chain"||(r.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:t}}),await this.onText?.(r))}async handleLLMNewToken(t,e,r,n,o,i){let s=this.getRunById(r);if(!s||s?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return s.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:t,idx:e,chunk:i?.chunk}}),await this.onLLMNewToken?.(s,t,{chunk:i?.chunk}),s}};var i0=mn(IR(),1),Vq={};G(Vq,{ConsoleCallbackHandler:()=>Vh});function yr(t,e){return`${t.open}${e}${t.close}`}function yn(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function SR(t){return typeof t=="string"?t.trim():t==null?t:yn(t,t.toString())}function Fi(t){if(!t.end_time)return"";let e=t.end_time-t.start_time;return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}var{color:Cr}=i0.default,Vh=class extends Un{name="console_callback_handler";persistRun(t){return Promise.resolve()}getParents(t){let e=[],r=t;for(;r.parent_run_id;){let n=this.runMap.get(r.parent_run_id);if(n)e.push(n),r=n;else break}return e}getBreadcrumbs(t){let r=[...this.getParents(t).reverse(),t].map((n,o,i)=>{let s=`${n.execution_order}:${n.run_type}:${n.name}`;return o===i.length-1?yr(i0.default.bold,s):s}).join(" > ");return yr(Cr.grey,r)}onChainStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[chain/start]")} [${e}] Entering Chain run with input: ${yn(t.inputs,"[inputs]")}`)}onChainEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[chain/end]")} [${e}] [${Fi(t)}] Exiting Chain run with output: ${yn(t.outputs,"[outputs]")}`)}onChainError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[chain/error]")} [${e}] [${Fi(t)}] Chain run errored with error: ${yn(t.error,"[error]")}`)}onLLMStart(t){let e=this.getBreadcrumbs(t),r="prompts"in t.inputs?{prompts:t.inputs.prompts.map(n=>n.trim())}:t.inputs;console.log(`${yr(Cr.green,"[llm/start]")} [${e}] Entering LLM run with input: ${yn(r,"[inputs]")}`)}onLLMEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[llm/end]")} [${e}] [${Fi(t)}] Exiting LLM run with output: ${yn(t.outputs,"[response]")}`)}onLLMError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[llm/error]")} [${e}] [${Fi(t)}] LLM run errored with error: ${yn(t.error,"[error]")}`)}onToolStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[tool/start]")} [${e}] Entering Tool run with input: "${SR(t.inputs.input)}"`)}onToolEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[tool/end]")} [${e}] [${Fi(t)}] Exiting Tool run with output: "${SR(t.outputs?.output)}"`)}onToolError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[tool/error]")} [${e}] [${Fi(t)}] Tool run errored with error: ${yn(t.error,"[error]")}`)}onRetrieverStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[retriever/start]")} [${e}] Entering Retriever run with input: ${yn(t.inputs,"[inputs]")}`)}onRetrieverEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[retriever/end]")} [${e}] [${Fi(t)}] Exiting Retriever run with output: ${yn(t.outputs,"[outputs]")}`)}onRetrieverError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[retriever/error]")} [${e}] [${Fi(t)}] Retriever run errored with error: ${yn(t.error,"[error]")}`)}onAgentAction(t){let e=t,r=this.getBreadcrumbs(t);console.log(`${yr(Cr.blue,"[agent/action]")} [${r}] Agent selected action: ${yn(e.actions[e.actions.length-1],"[action]")}`)}};var s0,Gh=()=>{if(s0===void 0){let t=It("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};s0=new da(t)}return s0};var c0=class{getStore(){}run(e,r){return r()}},a0=Symbol.for("ls:tracing_async_local_storage"),Gq=new c0,u0=class{getInstance(){return globalThis[a0]??Gq}initializeGlobalInstance(e){globalThis[a0]===void 0&&(globalThis[a0]=e)}},Kq=new u0;function kR(t=!1){let e=Kq.getInstance().getStore();if(!t&&e===void 0)throw new Error(`Could not get the current run tree. + +Please make sure you are calling this method within a traceable function and that tracing is enabled.`);return e}var rge=Symbol.for("langsmith:traceable:root");function Kh(t){return typeof t=="function"&&"langsmith:traceable"in t}var Hq={};G(Hq,{LangChainTracer:()=>Zd});var Zd=class TR extends Un{name="langchain_tracer";projectName;exampleId;client;replicas;usesRunTreeMap=!0;constructor(e={}){super(e);let{exampleId:r,projectName:n,client:o,replicas:i}=e;this.projectName=n??Pd(),this.replicas=i,this.exampleId=r,this.client=o??Gh();let s=TR.getTraceableRunTree();s&&this.updateFromRunTree(s)}async persistRun(e){}async onRunCreate(e){await this.getRunTreeWithTracingConfig(e.id)?.postRun()}async onRunUpdate(e){await this.getRunTreeWithTracingConfig(e.id)?.patchRun()}getRun(e){return this.runTreeMap.get(e)}updateFromRunTree(e){this.runTreeMap.set(e.id,e);let r=e,n=new Set;for(;r.parent_run&&!(n.has(r.id)||(n.add(r.id),!r.parent_run));)r=r.parent_run;n.clear();let o=[r];for(;o.length>0;){let i=o.shift();!i||n.has(i.id)||(n.add(i.id),this.runTreeMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.replicas=e.replicas??this.replicas,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}getRunTreeWithTracingConfig(e){let r=this.runTreeMap.get(e);if(r)return new Ln({...r,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return kR(!0)}catch{return}}};var Hh=mn(Sh(),1),ma;function Wq(){let t="default"in Hh.default?Hh.default.default:Hh.default;return new t({autoStart:!0,concurrency:1})}function Jq(){return typeof ma>"u"&&(ma=Wq()),ma}async function gt(t,e){if(e===!0){let r=Li();r!==void 0?await r.run(void 0,async()=>t()):await t()}else ma=Jq(),ma.add(async()=>{let r=Li();r!==void 0?await r.run(void 0,async()=>t()):await t()})}async function ER(){let t=Gh();await Promise.allSettled([typeof ma<"u"?ma.onIdle():Promise.resolve(),t.awaitPendingTraceBatches()])}var Xq={};G(Xq,{awaitAllCallbacks:()=>ER,consumeCallback:()=>gt});var AR=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>It(r)==="true");function l0(t){let e=Li();return e===void 0?void 0:e.getStore()?.[Di]?.[t]}var Yq=Symbol("lc:configure_hooks"),OR=()=>l0(Yq)||[];var Qq={};G(Qq,{BaseCallbackManager:()=>PR,BaseRunManager:()=>Vd,CallbackManager:()=>St,CallbackManagerForChainRun:()=>RR,CallbackManagerForLLMRun:()=>d0,CallbackManagerForRetrieverRun:()=>CR,CallbackManagerForToolRun:()=>NR,ensureHandler:()=>pu,parseCallbackConfigArg:()=>ha});function ha(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}var PR=class{setHandler(t){return this.setHandlers([t])}},Vd=class{constructor(t,e,r,n,o,i,s,a){this.runId=t,this.handlers=e,this.inheritableHandlers=r,this.tags=n,this.inheritableTags=o,this.metadata=i,this.inheritableMetadata=s,this._parentRunId=a}get parentRunId(){return this._parentRunId}async handleText(t){await Promise.all(this.handlers.map(e=>gt(async()=>{try{await e.handleText?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleText: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleCustomEvent(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{try{await i.handleCustomEvent?.(t,e,this.runId,this.tags,this.metadata)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleCustomEvent: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},CR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleRetrieverEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetriever`),e.raiseError)throw r}},e.awaitHandlers)))}async handleRetrieverError(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetrieverError: ${r}`),e.raiseError)throw t}},e.awaitHandlers)))}},d0=class extends Vd{async handleLLMNewToken(t,e,r,n,o,i){await Promise.all(this.handlers.map(s=>gt(async()=>{if(!s.ignoreLLM)try{await s.handleLLMNewToken?.(t,e??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,i)}catch(a){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleLLMNewToken: ${a}`),s.raiseError)throw a}},s.awaitHandlers)))}async handleLLMError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreLLM)try{await i.handleLLMError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleLLMEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreLLM)try{await i.handleLLMEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},RR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleChainError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreChain)try{await i.handleChainError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleChainEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreChain)try{await i.handleChainEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleAgentAction(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleAgentAction?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentAction: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleAgentEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleAgentEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},NR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleToolError(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleToolError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolError: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleToolEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleToolEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},St=class qd extends PR{handlers=[];inheritableHandlers=[];tags=[];inheritableTags=[];metadata={};inheritableMetadata={};name="callback_manager";_parentRunId;constructor(e,r){super(),this.handlers=r?.handlers??this.handlers,this.inheritableHandlers=r?.inheritableHandlers??this.inheritableHandlers,this.tags=r?.tags??this.tags,this.inheritableTags=r?.inheritableTags??this.inheritableTags,this.metadata=r?.metadata??this.metadata,this.inheritableMetadata=r?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=e}getParentRunId(){return this._parentRunId}async handleLLMStart(e,r,n=void 0,o=void 0,i=void 0,s=void 0,a=void 0,c=void 0){return Promise.all(r.map(async(u,l)=>{let d=l===0&&n?n:Et();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return fa(f)&&f._createRunForLLMStart(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c),gt(async()=>{try{await f.handleLLMStart?.(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c)}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new d0(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(e,r,n=void 0,o=void 0,i=void 0,s=void 0,a=void 0,c=void 0){return Promise.all(r.map(async(u,l)=>{let d=l===0&&n?n:Et();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return fa(f)&&f._createRunForChatModelStart(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c),gt(async()=>{try{if(f.handleChatModelStart)await f.handleChatModelStart?.(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c);else if(f.handleLLMStart){let p=au(u);await f.handleLLMStart?.(e,[p],d,this._parentRunId,i,this.tags,this.metadata,c)}}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new d0(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreChain)return fa(c)&&c._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,a),gt(async()=>{try{await c.handleChainStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,o,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleChainStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new RR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreAgent)return fa(c)&&c._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,a),gt(async()=>{try{await c.handleToolStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleToolStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new NR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreRetriever)return fa(c)&&c._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,a),gt(async()=>{try{await c.handleRetrieverStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleRetrieverStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new CR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(e,r,n,o,i){await Promise.all(this.handlers.map(s=>gt(async()=>{if(!s.ignoreCustomEvent)try{await s.handleCustomEvent?.(e,r,n,this.tags,this.metadata)}catch(a){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleCustomEvent: ${a}`),s.raiseError)throw a}},s.awaitHandlers)))}addHandler(e,r=!0){this.handlers.push(e),r&&this.inheritableHandlers.push(e)}removeHandler(e){this.handlers=this.handlers.filter(r=>r!==e),this.inheritableHandlers=this.inheritableHandlers.filter(r=>r!==e)}setHandlers(e,r=!0){this.handlers=[],this.inheritableHandlers=[];for(let n of e)this.addHandler(n,r)}addTags(e,r=!0){this.removeTags(e),this.tags.push(...e),r&&this.inheritableTags.push(...e)}removeTags(e){this.tags=this.tags.filter(r=>!e.includes(r)),this.inheritableTags=this.inheritableTags.filter(r=>!e.includes(r))}addMetadata(e,r=!0){this.metadata={...this.metadata,...e},r&&(this.inheritableMetadata={...this.inheritableMetadata,...e})}removeMetadata(e){for(let r of Object.keys(e))delete this.metadata[r],delete this.inheritableMetadata[r]}copy(e=[],r=!0){let n=new qd(this._parentRunId);for(let o of this.handlers){let i=this.inheritableHandlers.includes(o);n.addHandler(o,i)}for(let o of this.tags){let i=this.inheritableTags.includes(o);n.addTags([o],i)}for(let o of Object.keys(this.metadata)){let i=Object.keys(this.inheritableMetadata).includes(o);n.addMetadata({[o]:this.metadata[o]},i)}for(let o of e)n.handlers.filter(i=>i.name==="console_callback_handler").some(i=>i.name===o.name)||n.addHandler(o,r);return n}static fromHandlers(e){class r extends la{name=Et();constructor(){super(),Object.assign(this,e)}}let n=new this;return n.addHandler(new r),n}static configure(e,r,n,o,i,s,a){return this._configureSync(e,r,n,o,i,s,a)}static _configureSync(e,r,n,o,i,s,a){let c;(e||r)&&(Array.isArray(e)||!e?(c=new qd,c.setHandlers(e?.map(pu)??[],!0)):c=e,c=c.copy(Array.isArray(r)?r.map(pu):r?.handlers,!1));let u=It("LANGCHAIN_VERBOSE")==="true"||a?.verbose,l=Zd.getTraceableRunTree()?.tracingEnabled||AR(),d=l||(It("LANGCHAIN_TRACING")??!1);if(u||d){if(c||(c=new qd),u&&!c.handlers.some(f=>f.name===Vh.prototype.name)){let f=new Vh;c.addHandler(f,!0)}if(d&&!c.handlers.some(f=>f.name==="langchain_tracer")&&l){let f=new Zd;c.addHandler(f,!0)}if(l){let f=Zd.getTraceableRunTree();f&&c._parentRunId===void 0&&(c._parentRunId=f.id,c.handlers.find(m=>m.name==="langchain_tracer")?.updateFromRunTree(f))}}for(let{contextVar:f,inheritable:p=!0,handlerClass:m,envVar:h}of OR()){let _=h&&It(h)==="true"&&m,v,b=f!==void 0?l0(f):void 0;b&&ox(b)?v=b:_&&(v=new m({})),v!==void 0&&(c||(c=new qd),c.handlers.some(x=>x.name===v.name)||c.addHandler(v,p))}return(n||o)&&c&&(c.addTags(n??[]),c.addTags(o??[],!1)),(i||s)&&c&&(c.addMetadata(i??{}),c.addMetadata(s??{},!1)),c}};function pu(t){return"name"in t?t:la.fromMethods(t)}var p0=class{getStore(){}run(t,e){return e()}enterWith(t){}},eV=new p0,zR=Symbol.for("lc:child_config"),tV=class{getInstance(){return Li()??eV}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[zR]}runWithConfig(t,e,r){let n=St._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata),o=this.getInstance(),i=o.getStore(),s=n?.getParentRunId(),a=n?.handlers?.find(u=>u?.name==="langchain_tracer"),c;return a&&s?c=a.getRunTreeWithTracingConfig(s):r||(c=new Ln({name:"",tracingEnabled:!1})),c&&(c.extra={...c.extra,[zR]:t}),i!==void 0&&i[Di]!==void 0&&(c===void 0&&(c={}),c[Di]=i[Di]),o.run(c,e)}initializeGlobalInstance(t){Li()===void 0&&fO(t)}},Lt=new tV;var rV={};G(rV,{AsyncLocalStorageProviderSingleton:()=>Lt,MockAsyncLocalStorage:()=>p0,_CONTEXT_VARIABLES_KEY:()=>Di});var Wh=25;async function or(t){return St._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function ga(...t){let e={};for(let r of t.filter(n=>!!n))for(let n of Object.keys(r))if(n==="metadata")e[n]={...e[n],...r[n]};else if(n==="tags"){let o=e[n]??[];e[n]=[...new Set(o.concat(r[n]??[]))]}else if(n==="configurable")e[n]={...e[n],...r[n]};else if(n==="timeout")e.timeout===void 0?e.timeout=r.timeout:r.timeout!==void 0&&(e.timeout=Math.min(e.timeout,r.timeout));else if(n==="signal")e.signal===void 0?e.signal=r.signal:r.signal!==void 0&&("any"in AbortSignal?e.signal=AbortSignal.any([e.signal,r.signal]):e.signal=r.signal);else if(n==="callbacks"){let o=e.callbacks,i=r.callbacks;if(Array.isArray(i))if(!o)e.callbacks=i;else if(Array.isArray(o))e.callbacks=o.concat(i);else{let s=o.copy();for(let a of i)s.addHandler(pu(a),!0);e.callbacks=s}else if(i)if(!o)e.callbacks=i;else if(Array.isArray(o)){let s=i.copy();for(let a of o)s.addHandler(pu(a),!0);e.callbacks=s}else e.callbacks=new St(i._parentRunId,{handlers:o.handlers.concat(i.handlers),inheritableHandlers:o.inheritableHandlers.concat(i.inheritableHandlers),tags:Array.from(new Set(o.tags.concat(i.tags))),inheritableTags:Array.from(new Set(o.inheritableTags.concat(i.inheritableTags))),metadata:{...o.metadata,...i.metadata}})}else{let o=n;e[o]=r[o]??e[o]}return e}var nV=new Set(["string","number","boolean"]);function Pe(t){let e=Lt.getRunnableConfig(),r={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(e){let{runId:n,runName:o,...i}=e;r=Object.entries(i).reduce((s,[a,c])=>(c!==void 0&&(s[a]=c),s),r)}if(t&&(r=Object.entries(t).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),r)),r?.configurable)for(let n of Object.keys(r.configurable))nV.has(typeof r.configurable[n])&&!r.metadata?.[n]&&(r.metadata||(r.metadata={}),r.metadata[n]=r.configurable[n]);if(r.timeout!==void 0){if(r.timeout<=0)throw new Error("Timeout must be a positive number");let n=AbortSignal.timeout(r.timeout);r.signal!==void 0?"any"in AbortSignal&&(r.signal=AbortSignal.any([r.signal,n])):r.signal=n,delete r.timeout}return r}function Ve(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:s}={}){let a=Pe(t);return e!==void 0&&(delete a.runName,a.callbacks=e),n!==void 0&&(a.recursionLimit=n),r!==void 0&&(a.maxConcurrency=r),o!==void 0&&(a.runName=o),i!==void 0&&(a.configurable={...a.configurable,...i}),s!==void 0&&delete a.runId,a}function vr(t){if(t)return{configurable:t.configurable,recursionLimit:t.recursionLimit,callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,maxConcurrency:t.maxConcurrency,timeout:t.timeout,signal:t.signal,store:t.store}}async function vn(t,e){if(e===void 0)return t;let r;return Promise.race([t.catch(n=>{if(!e?.aborted)throw n}),new Promise((n,o)=>{r=()=>{o(Bi(e))},e.addEventListener("abort",r),e.aborted&&o(Bi(e))})]).finally(()=>e.removeEventListener("abort",r))}function Bi(t){return t?.reason instanceof Error?t.reason:typeof t?.reason=="string"?new Error(t.reason):new Error("Aborted")}var oV={};G(oV,{AsyncGeneratorWithSetup:()=>Zi,IterableReadableStream:()=>br,atee:()=>Jh,concat:()=>en,pipeGeneratorWithSetup:()=>m0});var br=class f0 extends ReadableStream{reader;ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let e=await this.reader.read();return e.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}throw e}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(e){let r=e.getReader();return new f0({start(n){return o();function o(){return r.read().then(({done:i,value:s})=>{if(i){n.close();return}return n.enqueue(s),o()})}},cancel(){r.releaseLock()}})}static fromAsyncGenerator(e){return new f0({async pull(r){let{value:n,done:o}=await e.next();o&&r.close(),r.enqueue(n)},async cancel(r){await e.return(r)}})}};function Jh(t,e=2){let r=Array.from({length:e},()=>[]);return r.map(async function*(o){for(;;)if(o.length===0){let i=await t.next();for(let s of r)s.push(i)}else{if(o[0].done)return;yield o.shift().value}})}function en(t,e){if(Array.isArray(t)&&Array.isArray(e))return t.concat(e);if(typeof t=="string"&&typeof e=="string")return t+e;if(typeof t=="number"&&typeof e=="number")return t+e;if("concat"in t&&typeof t.concat=="function")return t.concat(e);if(typeof t=="object"&&typeof e=="object"){let r={...t};for(let[n,o]of Object.entries(e))n in r&&!Array.isArray(r[n])?r[n]=en(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}var Zi=class{generator;setup;config;signal;firstResult;firstResultUsed=!1;constructor(t){this.generator=t.generator,this.config=t.config,this.signal=t.signal??this.config?.signal,this.setup=new Promise((e,r)=>{Lt.runWithConfig(vr(t.config),async()=>{this.firstResult=t.generator.next(),t.startSetup?this.firstResult.then(t.startSetup).then(e,r):this.firstResult.then(n=>e(void 0),r)},!0)})}async next(...t){return this.signal?.throwIfAborted(),this.firstResultUsed?Lt.runWithConfig(vr(this.config),this.signal?async()=>vn(this.generator.next(...t),this.signal):async()=>this.generator.next(...t),!0):(this.firstResultUsed=!0,this.firstResult)}async return(t){return this.generator.return(t)}async throw(t){return this.generator.throw(t)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}};async function m0(t,e,r,n,...o){let i=new Zi({generator:e,startSetup:r,signal:n}),s=await i.setup;return{output:t(i,s,...o),setup:s}}var iV=Object.prototype.hasOwnProperty;function Yh(t,e){return iV.call(t,e)}function Qh(t){if(Array.isArray(t)){let r=new Array(t.length);for(let n=0;n=48&&n<=57){e++;continue}return!1}return!0}function Jo(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function tg(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function Xh(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r_t,_areEquals:()=>Gd,applyOperation:()=>_a,applyPatch:()=>qi,applyReducer:()=>cV,deepClone:()=>sV,getValueByPointer:()=>ng,validate:()=>jR,validator:()=>og});var _t=rg,sV=wr,fu={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){let n=ng(r,this.path);n&&(n=wr(n));let o=_a(r,{op:"remove",path:this.from}).removed;return _a(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=ng(r,this.from);return _a(r,{op:"add",path:this.path,value:wr(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:Gd(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},aV={add:function(t,e,r){return eg(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:fu.move,copy:fu.copy,test:fu.test,_get:fu._get};function ng(t,e){if(e=="")return t;var r={op:"_get",path:e};return _a(t,r),r.value}function _a(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):og(e,0)),e.path===""){let s={newDocument:t};if(e.op==="add")return s.newDocument=e.value,s;if(e.op==="replace")return s.newDocument=e.value,s.removed=t,s;if(e.op==="move"||e.op==="copy")return s.newDocument=ng(t,e.from),e.op==="move"&&(s.removed=t),s;if(e.op==="test"){if(s.test=Gd(t,e.value),s.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return s.newDocument=t,s}else{if(e.op==="remove")return s.removed=t,s.newDocument=null,s;if(e.op==="_get")return e.value=t,s;if(r)throw new _t("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return s}}else{n||(t=wr(t));let a=(e.path||"").split("/"),c=t,u=1,l=a.length,d,f,p;for(typeof r=="function"?p=r:p=og;;){if(f=a[u],f&&f.indexOf("~")!=-1&&(f=tg(f)),o&&(f=="__proto__"||f=="prototype"&&u>0&&a[u-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&d===void 0&&(c[f]===void 0?d=a.slice(0,u).join("/"):u==l-1&&(d=e.path),d!==void 0&&p(e,0,t,d)),u++,Array.isArray(c)){if(f==="-")f=c.length;else{if(r&&!eg(f))throw new _t("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,e,t);eg(f)&&(f=~~f)}if(u>=l){if(r&&e.op==="add"&&f>c.length)throw new _t("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let m=aV[e.op].call(e,c,f,t);if(m.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(u>=l){let m=fu[e.op].call(e,c,f,t);if(m.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(c=c[f],r&&u0)throw new _t('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new _t("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new _t("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&Xh(t.value))throw new _t("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var o=t.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new _t("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==n)throw new _t("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var s={op:"_get",path:t.from,value:void 0},a=jR([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new _t("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new _t("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function jR(t,e,r){try{if(!Array.isArray(t))throw new _t("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)qi(wr(e),wr(t),r||!0);else{r=r||og;for(var n=0;n=0;u--){var l=s[u],d=t[l];if(Yh(e,l)&&!(e[l]===void 0&&d!==void 0&&Array.isArray(e)===!1)){var f=e[l];typeof d=="object"&&d!=null&&typeof f=="object"&&f!=null&&Array.isArray(d)===Array.isArray(f)?DR(d,f,r,n+"/"+Jo(l),o):d!==f&&(a=!0,o&&r.push({op:"test",path:n+"/"+Jo(l),value:wr(d)}),r.push({op:"replace",path:n+"/"+Jo(l),value:wr(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+Jo(l),value:wr(d)}),r.push({op:"remove",path:n+"/"+Jo(l)}),c=!0):(o&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),a=!0)}if(!(!c&&i.length==s.length))for(var u=0;usg,RunLog:()=>ig,RunLogPatch:()=>ho,isLogStreamHandler:()=>_0});var ho=class{ops;constructor(t){this.ops=t.ops??[]}concat(t){let e=this.ops.concat(t.ops),r=qi({},e);return new ig({ops:e,state:r[r.length-1].newDocument})}},ig=class g0 extends ho{state;constructor(e){super(e),this.state=e.state}concat(e){let r=this.ops.concat(e.ops),n=qi(this.state,e.ops);return new g0({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=qi({},e.ops);return new g0({ops:e.ops,state:r[r.length-1].newDocument})}},_0=t=>t.name==="log_stream_tracer";async function LR(t,e){if(e==="original")throw new Error("Do not assign inputs with original schema drop the key for now. When inputs are added to streamLog they should be added with standardized schema for streaming events.");let{inputs:r}=t;if(["retriever","llm","prompt"].includes(t.run_type))return r;if(!(Object.keys(r).length===1&&r?.input===""))return r.input}async function UR(t,e){let{outputs:r}=t;return e==="original"||["retriever","llm","prompt"].includes(t.run_type)?r:r!==void 0&&Object.keys(r).length===1&&r?.output!==void 0?r.output:r}function lV(t){return t!==void 0&&t.message!==void 0}var sg=class extends Un{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;_schemaFormat="original";rootId;keyMapByRunId={};counterMapByRunName={};transformStream;writer;receiveStream;name="log_stream_tracer";lc_prefer_streaming=!0;constructor(t){super({_awaitHandler:!0,...t}),this.autoClose=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this._schemaFormat=t?._schemaFormat??this._schemaFormat,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=br.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){if(t.id===this.rootId)return!1;let e=t.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(t.run_type)),this.includeTags!==void 0&&(r=r||e.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(t.run_type)),this.excludeTags!==void 0&&(r=r&&e.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(t,e){for await(let r of e){if(t!==this.rootId){let n=this.keyMapByRunId[t];n&&await this.writer.write(new ho({ops:[{op:"add",path:`/logs/${n}/streamed_output/-`,value:r}]}))}yield r}}async onRunCreate(t){if(this.rootId===void 0&&(this.rootId=t.id,await this.writer.write(new ho({ops:[{op:"replace",path:"",value:{id:t.id,name:t.name,type:t.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(t))return;this.counterMapByRunName[t.name]===void 0&&(this.counterMapByRunName[t.name]=0),this.counterMapByRunName[t.name]+=1;let e=this.counterMapByRunName[t.name];this.keyMapByRunId[t.id]=e===1?t.name:`${t.name}:${e}`;let r={id:t.id,name:t.name,type:t.run_type,tags:t.tags??[],metadata:t.extra?.metadata??{},start_time:new Date(t.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};this._schemaFormat==="streaming_events"&&(r.inputs=await LR(t,this._schemaFormat)),await this.writer.write(new ho({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[t.id]}`,value:r}]}))}async onRunUpdate(t){try{let e=this.keyMapByRunId[t.id];if(e===void 0)return;let r=[];this._schemaFormat==="streaming_events"&&r.push({op:"replace",path:`/logs/${e}/inputs`,value:await LR(t,this._schemaFormat)}),r.push({op:"add",path:`/logs/${e}/final_output`,value:await UR(t,this._schemaFormat)}),t.end_time!==void 0&&r.push({op:"add",path:`/logs/${e}/end_time`,value:new Date(t.end_time).toISOString()});let n=new ho({ops:r});await this.writer.write(n)}finally{if(t.id===this.rootId){let e=new ho({ops:[{op:"replace",path:"/final_output",value:await UR(t,this._schemaFormat)}]});await this.writer.write(e),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(t,e,r){let n=this.keyMapByRunId[t.id];if(n===void 0)return;let o=t.inputs.messages!==void 0,i;o?lV(r?.chunk)?i=r?.chunk:i=new Dt({id:`run-${t.id}`,content:e}):i=e;let s=new ho({ops:[{op:"add",path:`/logs/${n}/streamed_output_str/-`,value:e},{op:"add",path:`/logs/${n}/streamed_output/-`,value:i}]});await this.writer.write(s)}};var dV={};G(dV,{ChatGenerationChunk:()=>Vi,GenerationChunk:()=>go,RUN_KEY:()=>ya});var ya="__run",go=class FR{text;generationInfo;constructor(e){this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new FR({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},Vi=class BR extends go{message;constructor(e){super(e),this.message=e.message}concat(e){return new BR({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo},message:this.message.concat(e.message)})}};function ag({name:t,serialized:e}){return t!==void 0?t:e?.name!==void 0?e.name:e?.id!==void 0&&Array.isArray(e?.id)?e.id[e.id.length-1]:"Unnamed"}var ZR=t=>t.name==="event_stream_tracer",qR=class extends Un{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;runInfoMap=new Map;tappedPromises=new Map;transformStream;writer;receiveStream;name="event_stream_tracer";lc_prefer_streaming=!0;constructor(t){super({_awaitHandler:!0,...t}),this.autoClose=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=br.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){let e=t.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(t.runType)),this.includeTags!==void 0&&(r=r||e.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(t.runType)),this.excludeTags!==void 0&&(r=r&&e.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(t,e){let r=await e.next();if(r.done)return;let n=this.runInfoMap.get(t);if(n===void 0){yield r.value;return}function o(s,a){return s==="llm"&&typeof a=="string"?new go({text:a}):a}let i=this.tappedPromises.get(t);if(i===void 0){let s;i=new Promise(a=>{s=a}),this.tappedPromises.set(t,i);try{let a={event:`on_${n.runType}_stream`,run_id:t,name:n.name,tags:n.tags,metadata:n.metadata,data:{}};await this.send({...a,data:{chunk:o(n.runType,r.value)}},n),yield r.value;for await(let c of e)n.runType!=="tool"&&n.runType!=="retriever"&&await this.send({...a,data:{chunk:o(n.runType,c)}},n),yield c}finally{s?.()}}else{yield r.value;for await(let s of e)yield s}}async send(t,e){this._includeRun(e)&&await this.writer.write(t)}async sendEndEvent(t,e){let r=this.tappedPromises.get(t.run_id);r!==void 0?r.then(()=>{this.send(t,e)}):await this.send(t,e)}async onLLMStart(t){let e=ag(t),r=t.inputs.messages!==void 0?"chat_model":"llm",n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:r,inputs:t.inputs};this.runInfoMap.set(t.id,n);let o=`on_${r}_start`;await this.send({event:o,data:{input:t.inputs},name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onLLMNewToken(t,e,r){let n=this.runInfoMap.get(t.id),o,i;if(n===void 0)throw new Error(`onLLMNewToken: Run ID ${t.id} not found in run map.`);if(this.runInfoMap.size!==1){if(n.runType==="chat_model")i="on_chat_model_stream",r?.chunk===void 0?o=new Dt({content:e,id:`run-${t.id}`}):o=r.chunk.message;else if(n.runType==="llm")i="on_llm_stream",r?.chunk===void 0?o=new go({text:e}):o=r.chunk;else throw new Error(`Unexpected run type ${n.runType}`);await this.send({event:i,data:{chunk:o},run_id:t.id,name:n.name,tags:n.tags,metadata:n.metadata},n)}}async onLLMEnd(t){let e=this.runInfoMap.get(t.id);this.runInfoMap.delete(t.id);let r;if(e===void 0)throw new Error(`onLLMEnd: Run ID ${t.id} not found in run map.`);let n=t.outputs?.generations,o;if(e.runType==="chat_model"){for(let i of n??[]){if(o!==void 0)break;o=i[0]?.message}r="on_chat_model_end"}else if(e.runType==="llm")o={generations:n?.map(i=>i.map(s=>({text:s.text,generationInfo:s.generationInfo}))),llmOutput:t.outputs?.llmOutput??{}},r="on_llm_end";else throw new Error(`onLLMEnd: Unexpected run type: ${e.runType}`);await this.sendEndEvent({event:r,data:{output:o,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async onChainStart(t){let e=ag(t),r=t.run_type??"chain",n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:t.run_type},o={};t.inputs.input===""&&Object.keys(t.inputs).length===1?(o={},n.inputs={}):t.inputs.input!==void 0?(o.input=t.inputs.input,n.inputs=t.inputs.input):(o.input=t.inputs,n.inputs=t.inputs),this.runInfoMap.set(t.id,n),await this.send({event:`on_${r}_start`,data:o,name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onChainEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onChainEnd: Run ID ${t.id} not found in run map.`);let r=`on_${t.run_type}_end`,n=t.inputs??e.inputs??{},i={output:t.outputs?.output??t.outputs,input:n};n.input&&Object.keys(n).length===1&&(i.input=n.input,e.inputs=n.input),await this.sendEndEvent({event:r,data:i,run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata??{}},e)}async onToolStart(t){let e=ag(t),r={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:"tool",inputs:t.inputs??{}};this.runInfoMap.set(t.id,r),await this.send({event:"on_tool_start",data:{input:t.inputs??{}},name:e,run_id:t.id,tags:t.tags??[],metadata:t.extra?.metadata??{}},r)}async onToolEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onToolEnd: Run ID ${t.id} not found in run map.`);if(e.inputs===void 0)throw new Error(`onToolEnd: Run ID ${t.id} is a tool call, and is expected to have traced inputs.`);let r=t.outputs?.output===void 0?t.outputs:t.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:r,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async onRetrieverStart(t){let e=ag(t),n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:"retriever",inputs:{query:t.inputs.query}};this.runInfoMap.set(t.id,n),await this.send({event:"on_retriever_start",data:{input:{query:t.inputs.query}},name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onRetrieverEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onRetrieverEnd: Run ID ${t.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:t.outputs?.documents??t.outputs,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async handleCustomEvent(t,e,r){let n=this.runInfoMap.get(r);if(n===void 0)throw new Error(`handleCustomEvent: Run ID ${r} not found in run map.`);await this.send({event:"on_custom_event",run_id:r,name:t,tags:n.tags,metadata:n.metadata,data:e},n)}async finish(){let t=[...this.tappedPromises.values()];Promise.all(t).finally(()=>{this.writer.close()})}};var pV=Object.prototype.toString,fV=t=>pV.call(t)==="[object Error]",mV=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function VR(t){if(!(t&&fV(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:mV.has(r)}function hV(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function cg(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(_),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},_=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&_.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function Kd(t,e={}){if(e={...e},hV(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,cg("factor",e.factor,{min:0,allowInfinity:!1}),cg("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),cg("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),cg("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await yV({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var ug=mn(Sh(),1),vV={};G(vV,{AsyncCaller:()=>Xo});var bV=[400,401,402,403,404,405,406,407,409],wV=t=>{if(t.message.startsWith("Cancel")||t.message.startsWith("AbortError")||t.name==="AbortError"||t?.code==="ECONNABORTED")throw t;let e=t?.response?.status??t?.status;if(e&&bV.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},Xo=class{maxConcurrency;maxRetries;onFailedAttempt;queue;constructor(t){this.maxConcurrency=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??6,this.onFailedAttempt=t.onFailedAttempt??wV;let e="default"in ug.default?ug.default.default:ug.default;this.queue=new e({concurrency:this.maxConcurrency})}async call(t,...e){return this.queue.add(()=>Kd(()=>t(...e).catch(r=>{throw r instanceof Error?r:new Error(r)}),{onFailedAttempt:({error:r})=>this.onFailedAttempt?.(r),retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(t,e,...r){if(t.signal){let n;return Promise.race([this.call(e,...r),new Promise((o,i)=>{n=()=>{i(Bi(t.signal))},t.signal?.addEventListener("abort",n)})]).finally(()=>{t.signal&&n&&t.signal.removeEventListener("abort",n)})}return this.call(e,...r)}fetch(...t){return this.call(()=>fetch(...t).then(e=>e.ok?e:Promise.reject(e)))}};var y0=class extends Un{name="RootListenersTracer";rootId;config;argOnStart;argOnEnd;argOnError;constructor({config:t,onStart:e,onEnd:r,onError:n}){super({_awaitHandler:!0}),this.config=t,this.argOnStart=e,this.argOnEnd=r,this.argOnError=n}persistRun(t){return Promise.resolve()}async onRunCreate(t){this.rootId||(this.rootId=t.id,this.argOnStart&&await this.argOnStart(t,this.config))}async onRunUpdate(t){t.id===this.rootId&&(t.error?this.argOnError&&await this.argOnError(t,this.config):this.argOnEnd&&await this.argOnEnd(t,this.config))}};function Hd(t){return t?t.lc_runnable:!1}var KR=class{includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;constructor(t){this.includeNames=t.includeNames,this.includeTypes=t.includeTypes,this.includeTags=t.includeTags,this.excludeNames=t.excludeNames,this.excludeTypes=t.excludeTypes,this.excludeTags=t.excludeTags}includeEvent(t,e){let r=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,n=t.tags??[];return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(e)),this.includeTags!==void 0&&(r=r||n.some(o=>this.includeTags?.includes(o))),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(e)),this.excludeTags!==void 0&&(r=r&&n.every(o=>!this.excludeTags?.includes(o))),r}},HR=t=>btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");var nn={};gi(nn,{$ZodAny:()=>a_,$ZodArray:()=>l_,$ZodAsyncError:()=>Fn,$ZodBase64:()=>Xg,$ZodBase64URL:()=>Yg,$ZodBigInt:()=>cp,$ZodBigIntFormat:()=>n_,$ZodBoolean:()=>ku,$ZodCIDRv4:()=>Wg,$ZodCIDRv6:()=>Jg,$ZodCUID:()=>jg,$ZodCUID2:()=>Dg,$ZodCatch:()=>S_,$ZodCheck:()=>Je,$ZodCheckBigIntFormat:()=>s$,$ZodCheckEndsWith:()=>y$,$ZodCheckGreaterThan:()=>Sg,$ZodCheckIncludes:()=>g$,$ZodCheckLengthEquals:()=>p$,$ZodCheckLessThan:()=>Ig,$ZodCheckLowerCase:()=>m$,$ZodCheckMaxLength:()=>l$,$ZodCheckMaxSize:()=>a$,$ZodCheckMimeType:()=>b$,$ZodCheckMinLength:()=>d$,$ZodCheckMinSize:()=>c$,$ZodCheckMultipleOf:()=>o$,$ZodCheckNumberFormat:()=>i$,$ZodCheckOverwrite:()=>w$,$ZodCheckProperty:()=>v$,$ZodCheckRegex:()=>f$,$ZodCheckSizeEquals:()=>u$,$ZodCheckStartsWith:()=>_$,$ZodCheckStringFormat:()=>Su,$ZodCheckUpperCase:()=>h$,$ZodCodec:()=>Au,$ZodCustom:()=>R_,$ZodCustomStringFormat:()=>t_,$ZodDate:()=>u_,$ZodDefault:()=>w_,$ZodDiscriminatedUnion:()=>d_,$ZodE164:()=>Qg,$ZodEmail:()=>Rg,$ZodEmoji:()=>zg,$ZodEncodeError:()=>Gi,$ZodEnum:()=>g_,$ZodError:()=>np,$ZodFile:()=>y_,$ZodFunction:()=>O_,$ZodGUID:()=>Pg,$ZodIPv4:()=>Gg,$ZodIPv6:()=>Kg,$ZodISODate:()=>Zg,$ZodISODateTime:()=>Bg,$ZodISODuration:()=>Vg,$ZodISOTime:()=>qg,$ZodIntersection:()=>p_,$ZodJWT:()=>e_,$ZodKSUID:()=>Fg,$ZodLazy:()=>C_,$ZodLiteral:()=>__,$ZodMAC:()=>Hg,$ZodMap:()=>m_,$ZodNaN:()=>k_,$ZodNanoID:()=>Mg,$ZodNever:()=>Eu,$ZodNonOptional:()=>$_,$ZodNull:()=>s_,$ZodNullable:()=>b_,$ZodNumber:()=>ap,$ZodNumberFormat:()=>r_,$ZodObject:()=>S$,$ZodObjectJIT:()=>k$,$ZodOptional:()=>xa,$ZodPipe:()=>T_,$ZodPrefault:()=>x_,$ZodPromise:()=>P_,$ZodReadonly:()=>E_,$ZodRealError:()=>Rr,$ZodRecord:()=>f_,$ZodRegistry:()=>Pu,$ZodSet:()=>h_,$ZodString:()=>Yi,$ZodStringFormat:()=>He,$ZodSuccess:()=>I_,$ZodSymbol:()=>o_,$ZodTemplateLiteral:()=>A_,$ZodTransform:()=>v_,$ZodTuple:()=>lp,$ZodType:()=>ye,$ZodULID:()=>Lg,$ZodURL:()=>Ng,$ZodUUID:()=>Cg,$ZodUndefined:()=>i_,$ZodUnion:()=>up,$ZodUnknown:()=>Tu,$ZodVoid:()=>c_,$ZodXID:()=>Ug,$brand:()=>Jd,$constructor:()=>$,$input:()=>D_,$output:()=>j_,Doc:()=>sp,JSONSchema:()=>$z,JSONSchemaGenerator:()=>zp,NEVER:()=>lg,TimePrecision:()=>B_,_any:()=>uy,_array:()=>T$,_base64:()=>Op,_base64url:()=>Pp,_bigint:()=>ry,_boolean:()=>ey,_catch:()=>j5,_check:()=>xz,_cidrv4:()=>Ep,_cidrv6:()=>Ap,_coercedBigint:()=>ny,_coercedBoolean:()=>ty,_coercedDate:()=>py,_coercedNumber:()=>H_,_coercedString:()=>U_,_cuid:()=>wp,_cuid2:()=>xp,_custom:()=>by,_date:()=>dy,_decode:()=>gg,_decodeAsync:()=>yg,_default:()=>N5,_discriminatedUnion:()=>x5,_e164:()=>Cp,_email:()=>mp,_emoji:()=>vp,_encode:()=>hg,_encodeAsync:()=>_g,_endsWith:()=>Bu,_enum:()=>E5,_file:()=>vy,_float32:()=>J_,_float64:()=>X_,_gt:()=>yo,_gte:()=>ir,_guid:()=>Cu,_includes:()=>Uu,_int:()=>W_,_int32:()=>Y_,_int64:()=>oy,_intersection:()=>$5,_ipv4:()=>kp,_ipv6:()=>Tp,_isoDate:()=>q_,_isoDateTime:()=>Z_,_isoDuration:()=>G_,_isoTime:()=>V_,_jwt:()=>Rp,_ksuid:()=>Sp,_lazy:()=>F5,_length:()=>Sa,_literal:()=>O5,_lowercase:()=>Du,_lt:()=>_o,_lte:()=>zr,_mac:()=>F_,_map:()=>k5,_max:()=>zr,_maxLength:()=>Ia,_maxSize:()=>$a,_mime:()=>Zu,_min:()=>ir,_minLength:()=>Qo,_minSize:()=>es,_multipleOf:()=>Qi,_nan:()=>fy,_nanoid:()=>bp,_nativeEnum:()=>A5,_negative:()=>hy,_never:()=>zu,_nonnegative:()=>_y,_nonoptional:()=>z5,_nonpositive:()=>gy,_normalize:()=>qu,_null:()=>cy,_nullable:()=>R5,_number:()=>K_,_optional:()=>C5,_overwrite:()=>Zn,_parse:()=>bu,_parseAsync:()=>wu,_pipe:()=>D5,_positive:()=>my,_promise:()=>B5,_property:()=>yy,_readonly:()=>L5,_record:()=>S5,_refine:()=>wy,_regex:()=>ju,_safeDecode:()=>bg,_safeDecodeAsync:()=>xg,_safeEncode:()=>vg,_safeEncodeAsync:()=>wg,_safeParse:()=>xu,_safeParseAsync:()=>$u,_set:()=>T5,_size:()=>Mu,_slugify:()=>Np,_startsWith:()=>Fu,_string:()=>L_,_stringFormat:()=>ka,_stringbool:()=>Sy,_success:()=>M5,_superRefine:()=>xy,_symbol:()=>sy,_templateLiteral:()=>U5,_toLowerCase:()=>Gu,_toUpperCase:()=>Ku,_transform:()=>P5,_trim:()=>Vu,_tuple:()=>I5,_uint32:()=>Q_,_uint64:()=>iy,_ulid:()=>$p,_undefined:()=>ay,_union:()=>w5,_unknown:()=>Nu,_uppercase:()=>Lu,_url:()=>Ru,_uuid:()=>hp,_uuidv4:()=>gp,_uuidv6:()=>_p,_uuidv7:()=>yp,_void:()=>ly,_xid:()=>Ip,clone:()=>Qe,config:()=>yt,decode:()=>tN,decodeAsync:()=>nN,describe:()=>$y,encode:()=>eN,encodeAsync:()=>rN,flattenError:()=>yu,formatError:()=>vu,globalConfig:()=>Wd,globalRegistry:()=>Ge,isValidBase64:()=>I$,isValidBase64URL:()=>IN,isValidJWT:()=>SN,locales:()=>Ou,meta:()=>Iy,parse:()=>Bn,parseAsync:()=>Yo,prettifyError:()=>mg,regexes:()=>Nr,registry:()=>fp,safeDecode:()=>iN,safeDecodeAsync:()=>aN,safeEncode:()=>oN,safeEncodeAsync:()=>sN,safeParse:()=>ba,safeParseAsync:()=>Iu,toDotPath:()=>QR,toJSONSchema:()=>vo,treeifyError:()=>fg,util:()=>M,version:()=>x$});var lg=Object.freeze({status:"aborted"});function $(t,e,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let u=s.prototype,l=Object.keys(u);for(let d=0;dr?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var Jd=Symbol("zod_brand"),Fn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Gi=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Wd={};function yt(t){return t&&Object.assign(Wd,t),Wd}var M={};gi(M,{BIGINT_FORMAT_RANGES:()=>E0,Class:()=>b0,NUMBER_FORMAT_RANGES:()=>T0,aborted:()=>Xi,allowsEval:()=>$0,assert:()=>kV,assertEqual:()=>xV,assertIs:()=>IV,assertNever:()=>SV,assertNotEqual:()=>$V,assignProp:()=>Hi,base64ToUint8Array:()=>JR,base64urlToUint8Array:()=>ZV,cached:()=>gu,captureStackTrace:()=>pg,cleanEnum:()=>BV,cleanRegex:()=>Qd,clone:()=>Qe,cloneDef:()=>EV,createTransparentProxy:()=>NV,defineLazy:()=>Me,esc:()=>dg,escapeRegex:()=>bn,extend:()=>jV,finalizeIssue:()=>rn,floatSafeRemainder:()=>w0,getElementAtPath:()=>AV,getEnumValues:()=>Yd,getLengthableOrigin:()=>rp,getParsedType:()=>RV,getSizableOrigin:()=>tp,hexToUint8Array:()=>VV,isObject:()=>va,isPlainObject:()=>Ji,issue:()=>_u,joinValues:()=>E,jsonStringifyReplacer:()=>hu,merge:()=>LV,mergeDefs:()=>Wi,normalizeParams:()=>D,nullish:()=>Ki,numKeys:()=>CV,objectClone:()=>TV,omit:()=>MV,optionalKeys:()=>k0,partial:()=>UV,pick:()=>zV,prefixIssues:()=>tn,primitiveTypes:()=>S0,promiseAllObject:()=>OV,propertyKeyTypes:()=>ep,randomString:()=>PV,required:()=>FV,safeExtend:()=>DV,shallowClone:()=>I0,slugify:()=>x0,stringifyPrimitive:()=>j,uint8ArrayToBase64:()=>XR,uint8ArrayToBase64url:()=>qV,uint8ArrayToHex:()=>GV,unwrapMessage:()=>Xd});function xV(t){return t}function $V(t){return t}function IV(t){}function SV(t){throw new Error}function kV(t){}function Yd(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function E(t,e="|"){return t.map(r=>j(r)).join(e)}function hu(t,e){return typeof e=="bigint"?e.toString():e}function gu(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ki(t){return t==null}function Qd(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function w0(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,s=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return s%a/10**i}var WR=Symbol("evaluating");function Me(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==WR)return n===void 0&&(n=WR,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function TV(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Hi(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Wi(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function EV(t){return Wi(t._zod.def)}function AV(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function OV(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i{};function va(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var $0=gu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Ji(t){if(va(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(va(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function I0(t){return Ji(t)?{...t}:Array.isArray(t)?[...t]:t}function CV(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var RV=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},ep=new Set(["string","number","symbol"]),S0=new Set(["string","number","bigint","boolean","symbol","undefined"]);function bn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qe(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function D(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function NV(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function j(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function k0(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var T0={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},E0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zV(t,e){let r=t._zod.def,n=Wi(t._zod.def,{get shape(){let o={};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&(o[i]=r.shape[i])}return Hi(this,"shape",o),o},checks:[]});return Qe(t,n)}function MV(t,e){let r=t._zod.def,n=Wi(t._zod.def,{get shape(){let o={...t._zod.def.shape};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&delete o[i]}return Hi(this,"shape",o),o},checks:[]});return Qe(t,n)}function jV(t,e){if(!Ji(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let o=Wi(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return Hi(this,"shape",i),i},checks:[]});return Qe(t,o)}function DV(t,e){if(!Ji(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return Hi(this,"shape",n),n},checks:t._zod.def.checks};return Qe(t,r)}function LV(t,e){let r=Wi(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return Hi(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Qe(t,r)}function UV(t,e,r){let n=Wi(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=t?new t({type:"optional",innerType:o[s]}):o[s])}else for(let s in o)i[s]=t?new t({type:"optional",innerType:o[s]}):o[s];return Hi(this,"shape",i),i},checks:[]});return Qe(e,n)}function FV(t,e,r){let n=Wi(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new t({type:"nonoptional",innerType:o[s]}))}else for(let s in o)i[s]=new t({type:"nonoptional",innerType:o[s]});return Hi(this,"shape",i),i},checks:[]});return Qe(e,n)}function Xi(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Xd(t){return typeof t=="string"?t:t?.message}function rn(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=Xd(t.inst?._zod.def?.error?.(t))??Xd(e?.error?.(t))??Xd(r.customError?.(t))??Xd(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function tp(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function rp(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function _u(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function BV(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function JR(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;ne.toString(16).padStart(2,"0")).join("")}var b0=class{constructor(...e){}};var YR=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,hu,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},np=$("$ZodError",YR),Rr=$("$ZodError",YR,{Parent:Error});function yu(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function vu(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>n({issues:s}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let s=r,a=0;for(;ar.message){let r={errors:[]},n=(o,i=[])=>{var s,a;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>n({issues:u},c.path));else if(c.code==="invalid_key")n({issues:c.issues},c.path);else if(c.code==="invalid_element")n({issues:c.issues},c.path);else{let u=[...i,...c.path];if(u.length===0){r.errors.push(e(c));continue}let l=r,d=0;for(;dtypeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function mg(t){let e=[],r=[...t.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${QR(n.path)}`);return e.join(` +`)}var bu=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Fn;if(s.issues.length){let a=new(o?.Err??t)(s.issues.map(c=>rn(c,i,yt())));throw pg(a,o?.callee),a}return s.value},Bn=bu(Rr),wu=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(o?.Err??t)(s.issues.map(c=>rn(c,i,yt())));throw pg(a,o?.callee),a}return s.value},Yo=wu(Rr),xu=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Fn;return i.issues.length?{success:!1,error:new(t??np)(i.issues.map(s=>rn(s,o,yt())))}:{success:!0,data:i.value}},ba=xu(Rr),$u=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(s=>rn(s,o,yt())))}:{success:!0,data:i.value}},Iu=$u(Rr),hg=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return bu(t)(e,r,o)},eN=hg(Rr),gg=t=>(e,r,n)=>bu(t)(e,r,n),tN=gg(Rr),_g=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wu(t)(e,r,o)},rN=_g(Rr),yg=t=>async(e,r,n)=>wu(t)(e,r,n),nN=yg(Rr),vg=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return xu(t)(e,r,o)},oN=vg(Rr),bg=t=>(e,r,n)=>xu(t)(e,r,n),iN=bg(Rr),wg=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return $u(t)(e,r,o)},sN=wg(Rr),xg=t=>async(e,r,n)=>$u(t)(e,r,n),aN=xg(Rr);var Nr={};gi(Nr,{base64:()=>q0,base64url:()=>$g,bigint:()=>J0,boolean:()=>Q0,browserEmail:()=>t3,cidrv4:()=>B0,cidrv6:()=>Z0,cuid:()=>A0,cuid2:()=>O0,date:()=>G0,datetime:()=>H0,domain:()=>o3,duration:()=>z0,e164:()=>V0,email:()=>j0,emoji:()=>D0,extendedDuration:()=>HV,guid:()=>M0,hex:()=>i3,hostname:()=>n3,html5Email:()=>YV,idnEmail:()=>e3,integer:()=>X0,ipv4:()=>L0,ipv6:()=>U0,ksuid:()=>R0,lowercase:()=>r$,mac:()=>F0,md5_base64:()=>a3,md5_base64url:()=>c3,md5_hex:()=>s3,nanoid:()=>N0,null:()=>e$,number:()=>Y0,rfc5322Email:()=>QV,sha1_base64:()=>l3,sha1_base64url:()=>d3,sha1_hex:()=>u3,sha256_base64:()=>f3,sha256_base64url:()=>m3,sha256_hex:()=>p3,sha384_base64:()=>g3,sha384_base64url:()=>_3,sha384_hex:()=>h3,sha512_base64:()=>v3,sha512_base64url:()=>b3,sha512_hex:()=>y3,string:()=>W0,time:()=>K0,ulid:()=>P0,undefined:()=>t$,unicodeEmail:()=>cN,uppercase:()=>n$,uuid:()=>wa,uuid4:()=>WV,uuid6:()=>JV,uuid7:()=>XV,xid:()=>C0});var A0=/^[cC][^\s-]{8,}$/,O0=/^[0-9a-z]+$/,P0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,C0=/^[0-9a-vA-V]{20}$/,R0=/^[A-Za-z0-9]{27}$/,N0=/^[a-zA-Z0-9_-]{21}$/,z0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,HV=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,M0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,wa=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,WV=wa(4),JV=wa(6),XV=wa(7),j0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,YV=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,QV=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,cN=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,e3=cN,t3=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,r3="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function D0(){return new RegExp(r3,"u")}var L0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,U0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,F0=t=>{let e=bn(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},B0=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Z0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,q0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$g=/^[A-Za-z0-9_-]*$/,n3=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,o3=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,V0=/^\+(?:[0-9]){6,14}[0-9]$/,uN="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",G0=new RegExp(`^${uN}$`);function lN(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function K0(t){return new RegExp(`^${lN(t)}$`)}function H0(t){let e=lN({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${uN}T(?:${n})$`)}var W0=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},J0=/^-?\d+n?$/,X0=/^-?\d+$/,Y0=/^-?\d+(?:\.\d+)?/,Q0=/^(?:true|false)$/i,e$=/^null$/i;var t$=/^undefined$/i;var r$=/^[^A-Z]*$/,n$=/^[^a-z]*$/,i3=/^[0-9a-fA-F]*$/;function op(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function ip(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var s3=/^[0-9a-fA-F]{32}$/,a3=op(22,"=="),c3=ip(22),u3=/^[0-9a-fA-F]{40}$/,l3=op(27,"="),d3=ip(27),p3=/^[0-9a-fA-F]{64}$/,f3=op(43,"="),m3=ip(43),h3=/^[0-9a-fA-F]{96}$/,g3=op(64,""),_3=ip(64),y3=/^[0-9a-fA-F]{128}$/,v3=op(86,"=="),b3=ip(86);var Je=$("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),pN={number:"number",bigint:"bigint",object:"date"},Ig=$("$ZodCheckLessThan",(t,e)=>{Je.init(t,e);let r=pN[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?n.value<=e.value:n.value{Je.init(t,e);let r=pN[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),o$=$("$ZodCheckMultipleOf",(t,e)=>{Je.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):w0(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),i$=$("$ZodCheckNumberFormat",(t,e)=>{Je.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=T0[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=o,a.maximum=i,r&&(a.pattern=X0)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}ai&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:t})}}),s$=$("$ZodCheckBigIntFormat",(t,e)=>{Je.init(t,e);let[r,n]=E0[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;in&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inst:t})}}),a$=$("$ZodCheckMaxSize",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=n.value;o.size<=e.maximum||n.issues.push({origin:tp(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),c$=$("$ZodCheckMinSize",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:tp(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),u$=$("$ZodCheckSizeEquals",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let s=i>e.size;n.issues.push({origin:tp(o),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),l$=$("$ZodCheckMaxLength",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=n.value;if(o.length<=e.maximum)return;let s=rp(o);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),d$=$("$ZodCheckMinLength",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let s=rp(o);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),p$=$("$ZodCheckLengthEquals",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let s=rp(o),a=i>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Su=$("$ZodCheckStringFormat",(t,e)=>{var r,n;Je.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),f$=$("$ZodCheckRegex",(t,e)=>{Su.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),m$=$("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=r$),Su.init(t,e)}),h$=$("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=n$),Su.init(t,e)}),g$=$("$ZodCheckIncludes",(t,e)=>{Je.init(t,e);let r=bn(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),_$=$("$ZodCheckStartsWith",(t,e)=>{Je.init(t,e);let r=new RegExp(`^${bn(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),y$=$("$ZodCheckEndsWith",(t,e)=>{Je.init(t,e);let r=new RegExp(`.*${bn(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function dN(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues))}var v$=$("$ZodCheckProperty",(t,e)=>{Je.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>dN(o,r,e.property));dN(n,r,e.property)}}),b$=$("$ZodCheckMimeType",(t,e)=>{Je.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),w$=$("$ZodCheckOverwrite",(t,e)=>{Je.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var sp=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(` +`).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,o.join(` +`))}};var x$={major:4,minor:1,patch:13};var ye=$("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=x$;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(s,a,c)=>{let u=Xi(s),l;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(u)continue;let f=s.issues.length,p=d._zod.check(s);if(p instanceof Promise&&c?.async===!1)throw new Fn;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,s.issues.length!==f&&(u||(u=Xi(s,f)))});else{if(s.issues.length===f)continue;u||(u=Xi(s,f))}}return l?l.then(()=>s):s},i=(s,a,c)=>{if(Xi(s))return s.aborted=!0,s;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new Fn;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let u=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,s,a)):i(u,s,a)}let c=t._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Fn;return c.then(u=>o(u,n,a))}return o(c,n,a)}}t["~standard"]={validate:o=>{try{let i=ba(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Iu(t,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),Yi=$("$ZodString",(t,e)=>{ye.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??W0(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),He=$("$ZodStringFormat",(t,e)=>{Su.init(t,e),Yi.init(t,e)}),Pg=$("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=M0),He.init(t,e)}),Cg=$("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=wa(n))}else e.pattern??(e.pattern=wa());He.init(t,e)}),Rg=$("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=j0),He.init(t,e)}),Ng=$("$ZodURL",(t,e)=>{He.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),zg=$("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=D0()),He.init(t,e)}),Mg=$("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=N0),He.init(t,e)}),jg=$("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=A0),He.init(t,e)}),Dg=$("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=O0),He.init(t,e)}),Lg=$("$ZodULID",(t,e)=>{e.pattern??(e.pattern=P0),He.init(t,e)}),Ug=$("$ZodXID",(t,e)=>{e.pattern??(e.pattern=C0),He.init(t,e)}),Fg=$("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=R0),He.init(t,e)}),Bg=$("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=H0(e)),He.init(t,e)}),Zg=$("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=G0),He.init(t,e)}),qg=$("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=K0(e)),He.init(t,e)}),Vg=$("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=z0),He.init(t,e)}),Gg=$("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=L0),He.init(t,e),t._zod.bag.format="ipv4"}),Kg=$("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=U0),He.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Hg=$("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=F0(e.delimiter)),He.init(t,e),t._zod.bag.format="mac"}),Wg=$("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=B0),He.init(t,e)}),Jg=$("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Z0),He.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function I$(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Xg=$("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=q0),He.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{I$(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function IN(t){if(!$g.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return I$(r)}var Yg=$("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=$g),He.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{IN(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Qg=$("$ZodE164",(t,e)=>{e.pattern??(e.pattern=V0),He.init(t,e)});function SN(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var e_=$("$ZodJWT",(t,e)=>{He.init(t,e),t._zod.check=r=>{SN(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),t_=$("$ZodCustomStringFormat",(t,e)=>{He.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),ap=$("$ZodNumber",(t,e)=>{ye.init(t,e),t._zod.pattern=t._zod.bag.pattern??Y0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),r_=$("$ZodNumberFormat",(t,e)=>{i$.init(t,e),ap.init(t,e)}),ku=$("$ZodBoolean",(t,e)=>{ye.init(t,e),t._zod.pattern=Q0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),cp=$("$ZodBigInt",(t,e)=>{ye.init(t,e),t._zod.pattern=J0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),n_=$("$ZodBigIntFormat",(t,e)=>{s$.init(t,e),cp.init(t,e)}),o_=$("$ZodSymbol",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),i_=$("$ZodUndefined",(t,e)=>{ye.init(t,e),t._zod.pattern=t$,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),s_=$("$ZodNull",(t,e)=>{ye.init(t,e),t._zod.pattern=e$,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),a_=$("$ZodAny",(t,e)=>{ye.init(t,e),t._zod.parse=r=>r}),Tu=$("$ZodUnknown",(t,e)=>{ye.init(t,e),t._zod.parse=r=>r}),Eu=$("$ZodNever",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),c_=$("$ZodVoid",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),u_=$("$ZodDate",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});function mN(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues)),e.value[r]=t.value}var l_=$("$ZodArray",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let s=0;smN(u,r,s))):mN(c,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function Og(t,e,r,n){t.issues.length&&e.issues.push(...tn(r,t.issues)),t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function kN(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=k0(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function TN(t,e,r,n,o,i){let s=[],a=o.keySet,c=o.catchall._zod,u=c.def.type;for(let l in e){if(a.has(l))continue;if(u==="never"){s.push(l);continue}let d=c.run({value:e[l],issues:[]},n);d instanceof Promise?t.push(d.then(f=>Og(f,r,l,e))):Og(d,r,l,e)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var S$=$("$ZodObject",(t,e)=>{if(ye.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=gu(()=>kN(e));Me(t._zod,"propValues",()=>{let a=e.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=va,i=e.catchall,s;t._zod.parse=(a,c)=>{s??(s=n.value);let u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),a;a.value={};let l=[],d=s.shape;for(let f of s.keys){let m=d[f]._zod.run({value:u[f],issues:[]},c);m instanceof Promise?l.push(m.then(h=>Og(h,a,f,u))):Og(m,a,f,u)}return i?TN(l,u,a,c,n.value,t):l.length?Promise.all(l).then(()=>a):a}}),k$=$("$ZodObjectJIT",(t,e)=>{S$.init(t,e);let r=t._zod.parse,n=gu(()=>kN(e)),o=f=>{let p=new sp(["shape","payload","ctx"]),m=n.value,h=x=>{let k=dg(x);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};p.write("const input = payload.value;");let _=Object.create(null),v=0;for(let x of m.keys)_[x]=`key_${v++}`;p.write("const newResult = {};");for(let x of m.keys){let k=_[x],T=dg(x);p.write(`const ${k} = ${h(x)};`),p.write(` + if (${k}.issues.length) { + payload.issues = payload.issues.concat(${k}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${T}, ...iss.path] : [${T}] + }))); + } + + + if (${k}.value === undefined) { + if (${T} in input) { + newResult[${T}] = undefined; + } + } else { + newResult[${T}] = ${k}.value; + } + + `)}p.write("payload.value = newResult;"),p.write("return payload;");let b=p.compile();return(x,k)=>b(f,x,k)},i,s=va,a=!Wd.jitless,u=a&&$0.value,l=e.catchall,d;t._zod.parse=(f,p)=>{d??(d=n.value);let m=f.value;return s(m)?a&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(e.shape)),f=i(f,p),l?TN([],m,f,p,d,t):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function hN(t,e,r,n){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let o=t.filter(i=>!Xi(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(s=>rn(s,n,yt())))}),e)}var up=$("$ZodUnion",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Me(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Me(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),Me(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Qd(i.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1,a=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}return s?Promise.all(a).then(c=>hN(c,o,t,i)):hN(a,o,t,i)}}),d_=$("$ZodDiscriminatedUnion",(t,e)=>{up.init(t,e);let r=t._zod.parse;Me(t._zod,"propValues",()=>{let o={};for(let i of e.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=gu(()=>{let o=e.options,i=new Map;for(let s of o){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});t._zod.parse=(o,i)=>{let s=o.value;if(!va(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),o;let a=n.value.get(s?.[e.discriminator]);return a?a._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:s,path:[e.discriminator],inst:t}),o)}}),p_=$("$ZodIntersection",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),s=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>gN(r,c,u)):gN(r,i,s)}});function $$(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Ji(t)&&Ji(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let s=$$(t[i],e[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n{ye.init(t,e);let r=e.items;t._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let s=[],a=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=a===-1?0:r.length-a;if(!e.rest){let l=i.length>r.length,d=i.length=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?s.push(d.then(f=>kg(f,n,u))):kg(d,n,u)}if(e.rest){let l=i.slice(r.length);for(let d of l){u++;let f=e.rest._zod.run({value:d,issues:[]},o);f instanceof Promise?s.push(f.then(p=>kg(p,n,u))):kg(f,n,u)}}return s.length?Promise.all(s).then(()=>n):n}});function kg(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues)),e.value[r]=t.value}var f_=$("$ZodRecord",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Ji(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...tn(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...tn(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let c=e.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(l=>rn(l,n,yt())),input:a,path:[a],inst:t}),r.value[c.value]=c.value;continue}let u=e.valueType._zod.run({value:o[a],issues:[]},n);u instanceof Promise?i.push(u.then(l=>{l.issues.length&&r.issues.push(...tn(a,l.issues)),r.value[c.value]=l.value})):(u.issues.length&&r.issues.push(...tn(a,u.issues)),r.value[c.value]=u.value)}}return i.length?Promise.all(i).then(()=>r):r}}),m_=$("$ZodMap",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[s,a]of o){let c=e.keyType._zod.run({value:s,issues:[]},n),u=e.valueType._zod.run({value:a,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{_N(l,d,r,s,o,t,n)})):_N(c,u,r,s,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});function _N(t,e,r,n,o,i,s){t.issues.length&&(ep.has(typeof n)?r.issues.push(...tn(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(a=>rn(a,s,yt()))})),e.issues.length&&(ep.has(typeof n)?r.issues.push(...tn(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(a=>rn(a,s,yt()))})),r.value.set(t.value,e.value)}var h_=$("$ZodSet",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of o){let a=e.valueType._zod.run({value:s,issues:[]},n);a instanceof Promise?i.push(a.then(c=>yN(c,r))):yN(a,r)}return i.length?Promise.all(i).then(()=>r):r}});function yN(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var g_=$("$ZodEnum",(t,e)=>{ye.init(t,e);let r=Yd(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>ep.has(typeof o)).map(o=>typeof o=="string"?bn(o):o.toString()).join("|")})$`),t._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:t}),o}}),__=$("$ZodLiteral",(t,e)=>{if(ye.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?bn(n):n?bn(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),y_=$("$ZodFile",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),v_=$("$ZodTransform",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new Fn;return r.value=o,r}});function vN(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var xa=$("$ZodOptional",(t,e)=>{ye.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Me(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Me(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qd(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>vN(i,r.value)):vN(o,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),b_=$("$ZodNullable",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.innerType._zod.optin),Me(t._zod,"optout",()=>e.innerType._zod.optout),Me(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qd(r.source)}|null)$`):void 0}),Me(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),w_=$("$ZodDefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>bN(i,e)):bN(o,e)}});function bN(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var x_=$("$ZodPrefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),$_=$("$ZodNonOptional",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>wN(i,t)):wN(o,t)}});function wN(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var I_=$("$ZodSuccess",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi("ZodSuccess");let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),S_=$("$ZodCatch",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.innerType._zod.optin),Me(t._zod,"optout",()=>e.innerType._zod.optout),Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(s=>rn(s,n,yt()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>rn(i,n,yt()))},input:r.value}),r.issues=[]),r)}}),k_=$("$ZodNaN",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),T_=$("$ZodPipe",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>e.in._zod.values),Me(t._zod,"optin",()=>e.in._zod.optin),Me(t._zod,"optout",()=>e.out._zod.optout),Me(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Tg(s,e.in,n)):Tg(i,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Tg(i,e.out,n)):Tg(o,e.out,n)}});function Tg(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var Au=$("$ZodCodec",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>e.in._zod.values),Me(t._zod,"optin",()=>e.in._zod.optin),Me(t._zod,"optout",()=>e.out._zod.optout),Me(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(s=>Eg(s,e,n)):Eg(i,e,n)}else{let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Eg(s,e,n)):Eg(i,e,n)}}});function Eg(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(i=>Ag(t,i,e.out,r)):Ag(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(i=>Ag(t,i,e.in,r)):Ag(t,o,e.in,r)}}function Ag(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}var E_=$("$ZodReadonly",(t,e)=>{ye.init(t,e),Me(t._zod,"propValues",()=>e.innerType._zod.propValues),Me(t._zod,"values",()=>e.innerType._zod.values),Me(t._zod,"optin",()=>e.innerType?._zod?.optin),Me(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(xN):xN(o)}});function xN(t){return t.value=Object.freeze(t.value),t}var A_=$("$ZodTemplateLiteral",(t,e)=>{ye.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,s=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,s))}else if(n===null||S0.has(typeof n))r.push(bn(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"template_literal",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),O_=$("$ZodFunction",(t,e)=>(ye.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=t._def.input?Bn(t._def.input,n):n,i=Reflect.apply(r,this,o);return t._def.output?Bn(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=t._def.input?await Yo(t._def.input,n):n,i=await Reflect.apply(r,this,o);return t._def.output?await Yo(t._def.output,i):i}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new lp({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),P_=$("$ZodPromise",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),C_=$("$ZodLazy",(t,e)=>{ye.init(t,e),Me(t._zod,"innerType",()=>e.getter()),Me(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),Me(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),Me(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),Me(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),R_=$("$ZodCustom",(t,e)=>{Je.init(t,e),ye.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>$N(i,r,n,t));$N(o,r,n,t)}});function $N(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(_u(o))}}var Ou={};gi(Ou,{ar:()=>EN,az:()=>AN,be:()=>PN,bg:()=>CN,ca:()=>RN,cs:()=>NN,da:()=>zN,de:()=>MN,en:()=>N_,eo:()=>jN,es:()=>DN,fa:()=>LN,fi:()=>UN,fr:()=>FN,frCA:()=>BN,he:()=>ZN,hu:()=>qN,id:()=>VN,is:()=>GN,it:()=>KN,ja:()=>HN,ka:()=>WN,kh:()=>JN,km:()=>z_,ko:()=>XN,lt:()=>QN,mk:()=>ez,ms:()=>tz,nl:()=>rz,no:()=>nz,ota:()=>oz,pl:()=>sz,ps:()=>iz,pt:()=>az,ru:()=>uz,sl:()=>lz,sv:()=>dz,ta:()=>pz,th:()=>fz,tr:()=>mz,ua:()=>hz,uk:()=>M_,ur:()=>gz,vi:()=>_z,yo:()=>bz,zhCN:()=>yz,zhTW:()=>vz});var x3=()=>{let t={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return o=>{switch(o.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${j(o.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${o.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${n[i.format]??o.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${o.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${o.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${o.keys.length>1?"\u0629":""}: ${E(o.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function EN(){return{localeError:x3()}}var $3=()=>{let t={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o.expected}, daxil olan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${j(o.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${n[i.format]??o.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${o.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${o.keys.length>1?"lar":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${o.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function AN(){return{localeError:$3()}}function ON(t,e,r,n){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?n:i===1?e:i>=2&&i<=4?r:n}var I3=()=>{let t={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0456\u045E";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${j(o.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),c=ON(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${o.maximum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),c=ON(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${o.minimum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${o.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${o.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function PN(){return{localeError:I3()}}var S3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(t))return"\u043C\u0430\u0441\u0438\u0432";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},k3=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function e(n){return t[n]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"};return n=>{switch(n.code){case"invalid_type":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${S3(n.input)}`;case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${j(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.maximum.toString()} ${i.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.minimum.toString()} ${i.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;if(o.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${o.prefix}"`;if(o.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${o.suffix}"`;if(o.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${o.includes}"`;if(o.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${o.pattern}`;let i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return o.format==="emoji"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="datetime"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="date"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),o.format==="time"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="duration"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${i} ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${E(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function CN(){return{localeError:k3()}}var T3=()=>{let t={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${o.expected}, s'ha rebut ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Valor inv\xE0lid: s'esperava ${j(o.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${E(o.values," o ")}`;case"too_big":{let i=o.inclusive?"com a m\xE0xim":"menys de",s=e(o.origin);return s?`Massa gran: s'esperava que ${o.origin??"el valor"} contingu\xE9s ${i} ${o.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${o.origin??"el valor"} fos ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"com a m\xEDnim":"m\xE9s de",s=e(o.origin);return s?`Massa petit: s'esperava que ${o.origin} contingu\xE9s ${i} ${o.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${o.origin} fos ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${n[i.format]??o.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${o.divisor}`;case"unrecognized_keys":return`Clau${o.keys.length>1?"s":""} no reconeguda${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${o.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${o.origin}`;default:return"Entrada inv\xE0lida"}}};function RN(){return{localeError:T3()}}var E3=()=>{let t={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(o))return"pole";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return o=>{switch(o.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o.expected}, obdr\u017Eeno ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${j(o.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${n[i.format]??o.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${o.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${E(o.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${o.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${o.origin}`;default:return"Neplatn\xFD vstup"}}};function NN(){return{localeError:E3()}}var A3=()=>{let t={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},e={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};function r(s){return t[s]??null}function n(s){return e[s]??s}let o=s=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"tal";case"object":return Array.isArray(s)?"liste":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype&&s.constructor?s.constructor.name:"objekt"}return a},i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return s=>{switch(s.code){case"invalid_type":return`Ugyldigt input: forventede ${n(s.expected)}, fik ${n(o(s.input))}`;case"invalid_value":return s.values.length===1?`Ugyldig v\xE6rdi: forventede ${j(s.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${E(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=r(s.origin),u=n(s.origin);return c?`For stor: forventede ${u??"value"} ${c.verb} ${a} ${s.maximum.toString()} ${c.unit??"elementer"}`:`For stor: forventede ${u??"value"} havde ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=r(s.origin),u=n(s.origin);return c?`For lille: forventede ${u} ${c.verb} ${a} ${s.minimum.toString()} ${c.unit}`:`For lille: forventede ${u} havde ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Ugyldig streng: skal starte med "${a.prefix}"`:a.format==="ends_with"?`Ugyldig streng: skal ende med "${a.suffix}"`:a.format==="includes"?`Ugyldig streng: skal indeholde "${a.includes}"`:a.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${a.pattern}`:`Ugyldig ${i[a.format]??s.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${s.divisor}`;case"unrecognized_keys":return`${s.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${E(s.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${s.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${s.origin}`;default:return"Ugyldigt input"}}};function zN(){return{localeError:A3()}}var O3=()=>{let t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"Zahl";case"object":{if(Array.isArray(o))return"Array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return o=>{switch(o.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${o.expected}, erhalten ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ung\xFCltige Eingabe: erwartet ${j(o.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ist`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ist`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${o.divisor} sein`;case"unrecognized_keys":return`${o.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${o.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${o.origin}`;default:return"Ung\xFCltige Eingabe"}}};function MN(){return{localeError:O3()}}var P3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},C3=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${P3(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${j(n.values[0])}`:`Invalid option: expected one of ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function N_(){return{localeError:C3()}}var R3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"nombro";case"object":{if(Array.isArray(t))return"tabelo";if(t===null)return"senvalora";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},N3=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(n){return t[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return n=>{switch(n.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${n.expected}, ricevi\u011Dis ${R3(n.input)}`;case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${j(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()} ${i.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${o}${n.minimum.toString()} ${i.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${r[o.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function jN(){return{localeError:N3()}}var z3=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},e={string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};function r(s){return t[s]??null}function n(s){return e[s]??s}let o=s=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"number";case"object":return Array.isArray(s)?"array":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype?s.constructor.name:"object"}return a},i={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return s=>{switch(s.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${n(s.expected)}, recibido ${n(o(s.input))}`;case"invalid_value":return s.values.length===1?`Entrada inv\xE1lida: se esperaba ${j(s.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${E(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=r(s.origin),u=n(s.origin);return c?`Demasiado grande: se esperaba que ${u??"valor"} tuviera ${a}${s.maximum.toString()} ${c.unit??"elementos"}`:`Demasiado grande: se esperaba que ${u??"valor"} fuera ${a}${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=r(s.origin),u=n(s.origin);return c?`Demasiado peque\xF1o: se esperaba que ${u} tuviera ${a}${s.minimum.toString()} ${c.unit}`:`Demasiado peque\xF1o: se esperaba que ${u} fuera ${a}${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${a.prefix}"`:a.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${a.suffix}"`:a.format==="includes"?`Cadena inv\xE1lida: debe incluir "${a.includes}"`:a.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${a.pattern}`:`Inv\xE1lido ${i[a.format]??s.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${s.divisor}`;case"unrecognized_keys":return`Llave${s.keys.length>1?"s":""} desconocida${s.keys.length>1?"s":""}: ${E(s.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${n(s.origin)}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${n(s.origin)}`;default:return"Entrada inv\xE1lida"}}};function DN(){return{localeError:z3()}}var M3=()=>{let t={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0622\u0631\u0627\u06CC\u0647";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return o=>{switch(o.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${r(o.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":return o.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${j(o.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${E(o.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${n[i.format]??o.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${o.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${o.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${E(o.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${o.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${o.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function LN(){return{localeError:M3()}}var j3=()=>{let t={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return o=>{switch(o.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${o.expected}, oli ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${j(o.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${i}${o.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${i}${o.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${n[i.format]??o.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${o.divisor} monikerta`;case"unrecognized_keys":return`${o.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${E(o.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function UN(){return{localeError:j3()}}var D3=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombre";case"object":{if(Array.isArray(o))return"tableau";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : ${o.expected} attendu, ${r(o.input)} re\xE7u`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : ${j(o.values[0])} attendu`:`Option invalide : une valeur parmi ${E(o.values,"|")} attendue`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Trop grand : ${o.origin??"valeur"} doit ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o.origin??"valeur"} doit \xEAtre ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Trop petit : ${o.origin} doit ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Trop petit : ${o.origin} doit \xEAtre ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${E(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function FN(){return{localeError:D3()}}var L3=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${o.expected}, re\xE7u ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : attendu ${j(o.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u2264":"<",s=e(o.origin);return s?`Trop grand : attendu que ${o.origin??"la valeur"} ait ${i}${o.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${o.origin??"la valeur"} soit ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u2265":">",s=e(o.origin);return s?`Trop petit : attendu que ${o.origin} ait ${i}${o.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${o.origin} soit ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${E(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function BN(){return{localeError:L3()}}var U3=()=>{let t={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},e={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=u=>u?t[u]:void 0,n=u=>{let l=r(u);return l?l.label:u??t.unknown.label},o=u=>`\u05D4${n(u)}`,i=u=>(r(u)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",s=u=>u?e[u]??null:null,a=u=>{let l=typeof u;switch(l){case"number":return Number.isNaN(u)?"NaN":"number";case"object":return Array.isArray(u)?"array":u===null?"null":Object.getPrototypeOf(u)!==Object.prototype&&u.constructor?u.constructor.name:"object";default:return l}},c={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}};return u=>{switch(u.code){case"invalid_type":{let l=u.expected,d=n(l),f=a(u.input),p=t[f]?.label??f;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`}case"invalid_value":{if(u.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${j(u.values[0])}`;let l=u.values.map(p=>j(p));if(u.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l[0]} \u05D0\u05D5 ${l[1]}`;let d=l[l.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let l=s(u.origin),d=o(u.origin??"value");if(u.origin==="string")return`${l?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${u.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=u.inclusive?`${u.maximum} ${l?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${l?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?"<=":"<",p=i(u.origin??"value");return l?.unit?`${l.longLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()} ${l.unit}`:`${l?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()}`}case"too_small":{let l=s(u.origin),d=o(u.origin??"value");if(u.origin==="string")return`${l?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${u.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let _=(u.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${_}`}let h=u.inclusive?`${u.minimum} ${l?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${l?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?">=":">",p=i(u.origin??"value");return l?.unit?`${l.shortLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()} ${l.unit}`:`${l?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()}`}case"invalid_format":{let l=u;if(l.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${l.prefix}"`;if(l.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${l.suffix}"`;if(l.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${l.includes}"`;if(l.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${l.pattern}`;let d=c[l.format],f=d?.label??l.format,m=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${f} \u05DC\u05D0 ${m}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${u.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${u.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${u.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${E(u.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${o(u.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function ZN(){return{localeError:U3()}}var F3=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(o))return"t\xF6mb";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return o=>{switch(o.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o.expected}, a kapott \xE9rt\xE9k ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${j(o.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`T\xFAl nagy: ${o.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${o.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${o.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} m\xE9rete t\xFAl kicsi ${i}${o.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} t\xFAl kicsi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${n[i.format]??o.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${o.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${o.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${o.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function qN(){return{localeError:F3()}}var B3=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak valid: diharapkan ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak valid: diharapkan ${j(o.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: diharapkan ${o.origin??"value"} memiliki ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${o.origin??"value"} menjadi ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: diharapkan ${o.origin} memiliki ${i}${o.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${o.origin} menjadi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${n[i.format]??o.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${o.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${o.origin}`;default:return"Input tidak valid"}}};function VN(){return{localeError:B3()}}var Z3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"n\xFAmer";case"object":{if(Array.isArray(t))return"fylki";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},q3=()=>{let t={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function e(n){return t[n]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"};return n=>{switch(n.code){case"invalid_type":return`Rangt gildi: \xDE\xFA sl\xF3st inn ${Z3(n.input)} \xFEar sem \xE1 a\xF0 vera ${n.expected}`;case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${j(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${o}${n.maximum.toString()} ${i.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${o}${n.minimum.toString()} ${i.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${o.prefix}"`:o.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${o.suffix}"`:o.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${o.includes}"`:o.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${o.pattern}`:`Rangt ${r[o.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${E(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}};function GN(){return{localeError:q3()}}var V3=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numero";case"object":{if(Array.isArray(o))return"vettore";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input non valido: atteso ${o.expected}, ricevuto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input non valido: atteso ${j(o.values[0])}`:`Opzione non valida: atteso uno tra ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Troppo grande: ${o.origin??"valore"} deve avere ${i}${o.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${o.origin??"valore"} deve essere ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Troppo piccolo: ${o.origin} deve avere ${i}${o.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${o.origin} deve essere ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${o.divisor}`;case"unrecognized_keys":return`Chiav${o.keys.length>1?"i":"e"} non riconosciut${o.keys.length>1?"e":"a"}: ${E(o.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${o.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${o.origin}`;default:return"Input non valido"}}};function KN(){return{localeError:V3()}}var G3=()=>{let t={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(o))return"\u914D\u5217";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${o.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${r(o.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":return o.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${j(o.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${E(o.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=o.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=e(o.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${s.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=o.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=e(o.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${s.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${o.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${o.keys.length>1?"\u7FA4":""}: ${E(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function HN(){return{localeError:G3()}}var K3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8";case"object":{if(Array.isArray(t))return"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return{string:"\u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0"}[e]??e},H3=()=>{let t={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function e(n){return t[n]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",json_string:"JSON \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"};return n=>{switch(n.code){case"invalid_type":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${K3(n.input)}`;case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${j(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${E(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${i.verb} ${o}${n.maximum.toString()} ${i.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${i.verb} ${o}${n.minimum.toString()} ${i.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.prefix}"-\u10D8\u10D7`:o.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.suffix}"-\u10D8\u10D7`:o.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${o.includes}"-\u10E1`:o.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${o.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${E(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function WN(){return{localeError:H3()}}var W3=()=>{let t={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(o))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(o===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return o=>{switch(o.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${j(o.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${o.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${E(o.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function z_(){return{localeError:W3()}}function JN(){return z_()}var J3=()=>{let t={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return o=>{switch(o.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${r(o.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":return o.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${j(o.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${E(o.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=o.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),c=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()}${c} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()} ${i}${s}`}case"too_small":{let i=o.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),c=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()}${c} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${n[i.format]??o.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${o.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${E(o.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${o.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${o.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function XN(){return{localeError:J3()}}var X3=t=>pp(typeof t,t),pp=(t,e=void 0)=>{switch(t){case"number":return Number.isNaN(e)?"NaN":"skai\u010Dius";case"bigint":return"sveikasis skai\u010Dius";case"string":return"eilut\u0117";case"boolean":return"login\u0117 reik\u0161m\u0117";case"undefined":case"void":return"neapibr\u0117\u017Eta reik\u0161m\u0117";case"function":return"funkcija";case"symbol":return"simbolis";case"object":return e===void 0?"ne\u017Einomas objektas":e===null?"nulin\u0117 reik\u0161m\u0117":Array.isArray(e)?"masyvas":Object.getPrototypeOf(e)!==Object.prototype&&e.constructor?e.constructor.name:"objektas";case"null":return"nulin\u0117 reik\u0161m\u0117"}return t},dp=t=>t.charAt(0).toUpperCase()+t.slice(1);function YN(t){let e=Math.abs(t),r=e%10,n=e%100;return n>=11&&n<=19||r===0?"many":r===1?"one":"few"}var Y3=()=>{let t={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function e(n,o,i,s){let a=t[n]??null;return a===null?a:{unit:a.unit[o],verb:a.verb[s][i?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"};return n=>{switch(n.code){case"invalid_type":return`Gautas tipas ${X3(n.input)}, o tik\u0117tasi - ${pp(n.expected)}`;case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${j(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${E(n.values,"|")} pasirinkim\u0173`;case"too_big":{let o=pp(n.origin),i=e(n.origin,YN(Number(n.maximum)),n.inclusive??!1,"smaller");if(i?.verb)return`${dp(o??n.origin??"reik\u0161m\u0117")} ${i.verb} ${n.maximum.toString()} ${i.unit??"element\u0173"}`;let s=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${dp(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.maximum.toString()} ${i?.unit}`}case"too_small":{let o=pp(n.origin),i=e(n.origin,YN(Number(n.minimum)),n.inclusive??!1,"bigger");if(i?.verb)return`${dp(o??n.origin??"reik\u0161m\u0117")} ${i.verb} ${n.minimum.toString()} ${i.unit??"element\u0173"}`;let s=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${dp(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.minimum.toString()} ${i?.unit}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${o.prefix}"`:o.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${o.includes}"`:o.format==="regex"?`Eilut\u0117 privalo atitikti ${o.pattern}`:`Neteisingas ${r[o.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${E(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let o=pp(n.origin);return`${dp(o??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function QN(){return{localeError:Y3()}}var Q3=()=>{let t={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(o))return"\u043D\u0438\u0437\u0430";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return o=>{switch(o.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${j(o.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${o.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${o.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function ez(){return{localeError:Q3()}}var e5=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombor";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak sah: dijangka ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak sah: dijangka ${j(o.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: dijangka ${o.origin??"nilai"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${o.origin??"nilai"} adalah ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: dijangka ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${o.origin} adalah ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${n[i.format]??o.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${E(o.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${o.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${o.origin}`;default:return"Input tidak sah"}}};function tz(){return{localeError:e5()}}var t5=()=>{let t={string:{unit:"tekens",verb:"te hebben"},file:{unit:"bytes",verb:"te hebben"},array:{unit:"elementen",verb:"te hebben"},set:{unit:"elementen",verb:"te hebben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"getal";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return o=>{switch(o.code){case"invalid_type":return`Ongeldige invoer: verwacht ${o.expected}, ontving ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ongeldige invoer: verwacht ${j(o.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Te groot: verwacht dat ${o.origin??"waarde"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"elementen"}`:`Te groot: verwacht dat ${o.origin??"waarde"} ${i}${o.maximum.toString()} is`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Te klein: verwacht dat ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Te klein: verwacht dat ${o.origin} ${i}${o.minimum.toString()} is`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${o.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${o.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${o.origin}`;default:return"Ongeldige invoer"}}};function rz(){return{localeError:t5()}}var r5=()=>{let t={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"tall";case"object":{if(Array.isArray(o))return"liste";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Ugyldig input: forventet ${o.expected}, fikk ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ugyldig verdi: forventet ${j(o.values[0])}`:`Ugyldig valg: forventet en av ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${n[i.format]??o.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${o.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${o.origin}`;default:return"Ugyldig input"}}};function nz(){return{localeError:r5()}}var n5=()=>{let t={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numara";case"object":{if(Array.isArray(o))return"saf";if(o===null)return"gayb";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return o=>{switch(o.code){case"invalid_type":return`F\xE2sit giren: umulan ${o.expected}, al\u0131nan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`F\xE2sit giren: umulan ${j(o.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=o;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${n[i.format]??o.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${o.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${o.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function oz(){return{localeError:n5()}}var o5=()=>{let t={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0627\u0631\u06D0";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return o=>{switch(o.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${r(o.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":return o.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${j(o.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${E(o.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0648\u064A`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${n[i.format]??o.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${o.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${o.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${o.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${o.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function iz(){return{localeError:o5()}}var i5=()=>{let t={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"liczba";case"object":{if(Array.isArray(o))return"tablica";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return o=>{switch(o.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o.expected}, otrzymano ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${j(o.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${n[i.format]??o.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${o.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${o.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${o.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function sz(){return{localeError:i5()}}var s5=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(o))return"array";if(o===null)return"nulo";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${o.expected}, recebido ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: esperado ${j(o.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Muito grande: esperado que ${o.origin??"valor"} tivesse ${i}${o.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${o.origin??"valor"} fosse ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Muito pequeno: esperado que ${o.origin} tivesse ${i}${o.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${o.origin} fosse ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`:i.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inv\xE1lido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`:`${n[i.format]??o.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${o.divisor}`;case"unrecognized_keys":return`Chave${o.keys.length>1?"s":""} desconhecida${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${o.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${o.origin}`;default:return"Campo inv\xE1lido"}}};function az(){return{localeError:s5()}}function cz(t,e,r,n){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?n:i===1?e:i>=2&&i<=4?r:n}var a5=()=>{let t={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${j(o.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),c=cz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.maximum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),c=cz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.minimum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${o.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0438":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${o.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function uz(){return{localeError:a5()}}var c5=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(o))return"tabela";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return o=>{switch(o.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${o.expected}, prejeto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${j(o.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} imelo ${i}${o.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${o.origin} imelo ${i}${o.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${n[i.format]??o.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${o.divisor}`;case"unrecognized_keys":return`Neprepoznan${o.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${E(o.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${o.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${o.origin}`;default:return"Neveljaven vnos"}}};function lz(){return{localeError:c5()}}var u5=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"antal";case"object":{if(Array.isArray(o))return"lista";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return o=>{switch(o.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${o.expected}, fick ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${j(o.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${n[i.format]??o.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${o.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${o.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function dz(){return{localeError:u5()}}var l5=()=>{let t={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(o))return"\u0B85\u0BA3\u0BBF";if(o===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${j(o.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${E(o.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${o.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${o.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function pz(){return{localeError:l5()}}var d5=()=>{let t={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(o))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(o===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return o=>{switch(o.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${j(o.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=e(o.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=e(o.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${o.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${E(o.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function fz(){return{localeError:d5()}}var p5=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},f5=()=>{let t={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(n){return t[n]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return n=>{switch(n.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${n.expected}, al\u0131nan ${p5(n.input)}`;case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${j(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()} ${i.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()} ${i.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[o.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function mz(){return{localeError:f5()}}var m5=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${j(o.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} \u0431\u0443\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0456":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${o.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function M_(){return{localeError:m5()}}function hz(){return M_()}var h5=()=>{let t={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(o))return"\u0622\u0631\u06D2";if(o===null)return"\u0646\u0644";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return o=>{switch(o.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${r(o.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":return o.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${j(o.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${E(o.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${o.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u06D2 ${i}${o.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u0627 ${i}${o.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${o.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${o.keys.length>1?"\u0632":""}: ${E(o.keys,"\u060C ")}`;case"invalid_key":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function gz(){return{localeError:h5()}}var g5=()=>{let t={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(o))return"m\u1EA3ng";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return o=>{switch(o.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${j(o.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${n[i.format]??o.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${o.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${E(o.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function _z(){return{localeError:g5()}}var _5=()=>{let t={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(o))return"\u6570\u7EC4";if(o===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${j(o.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${n[i.format]??o.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${o.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${o.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function yz(){return{localeError:_5()}}var y5=()=>{let t={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o.expected}\uFF0C\u4F46\u6536\u5230 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${j(o.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${o.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${o.keys.length>1?"\u5011":""}\uFF1A${E(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function vz(){return{localeError:y5()}}var v5=()=>{let t={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\u1ECD\u0301mb\xE0";case"object":{if(Array.isArray(o))return"akop\u1ECD";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"};return o=>{switch(o.code){case"invalid_type":return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${o.expected}, \xE0m\u1ECD\u0300 a r\xED ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${j(o.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin??"iye"} ${s.verb} ${i}${o.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${o.maximum}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin} ${s.verb} ${i}${o.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${o.minimum}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`:i.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`:i.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`:i.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`:`A\u1E63\xEC\u1E63e: ${n[i.format]??o.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${o.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${E(o.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function bz(){return{localeError:v5()}}var wz,j_=Symbol("ZodOutput"),D_=Symbol("ZodInput"),Pu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function fp(){return new Pu}(wz=globalThis).__zod_globalRegistry??(wz.__zod_globalRegistry=fp());var Ge=globalThis.__zod_globalRegistry;function L_(t,e){return new t({type:"string",...D(e)})}function U_(t,e){return new t({type:"string",coerce:!0,...D(e)})}function mp(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...D(e)})}function Cu(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...D(e)})}function hp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...D(e)})}function gp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(e)})}function _p(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(e)})}function yp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(e)})}function Ru(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...D(e)})}function vp(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...D(e)})}function bp(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(e)})}function wp(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...D(e)})}function xp(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(e)})}function $p(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...D(e)})}function Ip(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...D(e)})}function Sp(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(e)})}function kp(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(e)})}function Tp(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(e)})}function F_(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...D(e)})}function Ep(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(e)})}function Ap(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(e)})}function Op(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...D(e)})}function Pp(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...D(e)})}function Cp(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...D(e)})}function Rp(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...D(e)})}var B_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Z_(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(e)})}function q_(t,e){return new t({type:"string",format:"date",check:"string_format",...D(e)})}function V_(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...D(e)})}function G_(t,e){return new t({type:"string",format:"duration",check:"string_format",...D(e)})}function K_(t,e){return new t({type:"number",checks:[],...D(e)})}function H_(t,e){return new t({type:"number",coerce:!0,checks:[],...D(e)})}function W_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...D(e)})}function J_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...D(e)})}function X_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...D(e)})}function Y_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...D(e)})}function Q_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...D(e)})}function ey(t,e){return new t({type:"boolean",...D(e)})}function ty(t,e){return new t({type:"boolean",coerce:!0,...D(e)})}function ry(t,e){return new t({type:"bigint",...D(e)})}function ny(t,e){return new t({type:"bigint",coerce:!0,...D(e)})}function oy(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...D(e)})}function iy(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...D(e)})}function sy(t,e){return new t({type:"symbol",...D(e)})}function ay(t,e){return new t({type:"undefined",...D(e)})}function cy(t,e){return new t({type:"null",...D(e)})}function uy(t){return new t({type:"any"})}function Nu(t){return new t({type:"unknown"})}function zu(t,e){return new t({type:"never",...D(e)})}function ly(t,e){return new t({type:"void",...D(e)})}function dy(t,e){return new t({type:"date",...D(e)})}function py(t,e){return new t({type:"date",coerce:!0,...D(e)})}function fy(t,e){return new t({type:"nan",...D(e)})}function _o(t,e){return new Ig({check:"less_than",...D(e),value:t,inclusive:!1})}function zr(t,e){return new Ig({check:"less_than",...D(e),value:t,inclusive:!0})}function yo(t,e){return new Sg({check:"greater_than",...D(e),value:t,inclusive:!1})}function ir(t,e){return new Sg({check:"greater_than",...D(e),value:t,inclusive:!0})}function my(t){return yo(0,t)}function hy(t){return _o(0,t)}function gy(t){return zr(0,t)}function _y(t){return ir(0,t)}function Qi(t,e){return new o$({check:"multiple_of",...D(e),value:t})}function $a(t,e){return new a$({check:"max_size",...D(e),maximum:t})}function es(t,e){return new c$({check:"min_size",...D(e),minimum:t})}function Mu(t,e){return new u$({check:"size_equals",...D(e),size:t})}function Ia(t,e){return new l$({check:"max_length",...D(e),maximum:t})}function Qo(t,e){return new d$({check:"min_length",...D(e),minimum:t})}function Sa(t,e){return new p$({check:"length_equals",...D(e),length:t})}function ju(t,e){return new f$({check:"string_format",format:"regex",...D(e),pattern:t})}function Du(t){return new m$({check:"string_format",format:"lowercase",...D(t)})}function Lu(t){return new h$({check:"string_format",format:"uppercase",...D(t)})}function Uu(t,e){return new g$({check:"string_format",format:"includes",...D(e),includes:t})}function Fu(t,e){return new _$({check:"string_format",format:"starts_with",...D(e),prefix:t})}function Bu(t,e){return new y$({check:"string_format",format:"ends_with",...D(e),suffix:t})}function yy(t,e,r){return new v$({check:"property",property:t,schema:e,...D(r)})}function Zu(t,e){return new b$({check:"mime_type",mime:t,...D(e)})}function Zn(t){return new w$({check:"overwrite",tx:t})}function qu(t){return Zn(e=>e.normalize(t))}function Vu(){return Zn(t=>t.trim())}function Gu(){return Zn(t=>t.toLowerCase())}function Ku(){return Zn(t=>t.toUpperCase())}function Np(){return Zn(t=>x0(t))}function T$(t,e,r){return new t({type:"array",element:e,...D(r)})}function w5(t,e,r){return new t({type:"union",options:e,...D(r)})}function x5(t,e,r,n){return new t({type:"union",options:r,discriminator:e,...D(n)})}function $5(t,e,r){return new t({type:"intersection",left:e,right:r})}function I5(t,e,r,n){let o=r instanceof ye,i=o?n:r,s=o?r:null;return new t({type:"tuple",items:e,rest:s,...D(i)})}function S5(t,e,r,n){return new t({type:"record",keyType:e,valueType:r,...D(n)})}function k5(t,e,r,n){return new t({type:"map",keyType:e,valueType:r,...D(n)})}function T5(t,e,r){return new t({type:"set",valueType:e,...D(r)})}function E5(t,e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new t({type:"enum",entries:n,...D(r)})}function A5(t,e,r){return new t({type:"enum",entries:e,...D(r)})}function O5(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...D(r)})}function vy(t,e){return new t({type:"file",...D(e)})}function P5(t,e){return new t({type:"transform",transform:e})}function C5(t,e){return new t({type:"optional",innerType:e})}function R5(t,e){return new t({type:"nullable",innerType:e})}function N5(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():I0(r)}})}function z5(t,e,r){return new t({type:"nonoptional",innerType:e,...D(r)})}function M5(t,e){return new t({type:"success",innerType:e})}function j5(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function D5(t,e,r){return new t({type:"pipe",in:e,out:r})}function L5(t,e){return new t({type:"readonly",innerType:e})}function U5(t,e,r){return new t({type:"template_literal",parts:e,...D(r)})}function F5(t,e){return new t({type:"lazy",getter:e})}function B5(t,e){return new t({type:"promise",innerType:e})}function by(t,e,r){let n=D(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function wy(t,e,r){return new t({type:"custom",check:"custom",fn:e,...D(r)})}function xy(t){let e=xz(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(_u(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(_u(o))}},t(r.value,r)));return e}function xz(t,e){let r=new Je({check:"custom",...D(e)});return r._zod.check=t,r}function $y(t){let e=new Je({check:"describe"});return e._zod.onattach=[r=>{let n=Ge.get(r)??{};Ge.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function Iy(t){let e=new Je({check:"meta"});return e._zod.onattach=[r=>{let n=Ge.get(r)??{};Ge.add(r,{...n,...t})}],e._zod.check=()=>{},e}function Sy(t,e){let r=D(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(n),s=new Set(o),a=t.Codec??Au,c=t.Boolean??ku,u=t.String??Yi,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new a({type:"pipe",in:l,out:d,transform:((p,m)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:s.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((p,m)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return f}function ka(t,e,r,n={}){let o=D(n),i={...D(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:a=>r.test(a),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}var zp=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Ge,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},f=e._zod.parent;if(f)a.ref=f,this.process(f,d),this.seen.get(f).isParent=!0;else{let p=a.schema;switch(o.type){case"string":{let m=p;m.type="string";let{minimum:h,maximum:_,format:v,patterns:b,contentEncoding:x}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof _=="number"&&(m.maxLength=_),v&&(m.format=i[v]??v,m.format===""&&delete m.format),x&&(m.contentEncoding=x),b&&b.size>0){let k=[...b];k.length===1?m.pattern=k[0].source:k.length>1&&(a.schema.allOf=[...k.map(T=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:T.source}))])}break}case"number":{let m=p,{minimum:h,maximum:_,format:v,multipleOf:b,exclusiveMaximum:x,exclusiveMinimum:k}=e._zod.bag;typeof v=="string"&&v.includes("int")?m.type="integer":m.type="number",typeof k=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.minimum=k,m.exclusiveMinimum=!0):m.exclusiveMinimum=k),typeof h=="number"&&(m.minimum=h,typeof k=="number"&&this.target!=="draft-4"&&(k>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof x=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.maximum=x,m.exclusiveMaximum=!0):m.exclusiveMaximum=x),typeof _=="number"&&(m.maximum=_,typeof x=="number"&&this.target!=="draft-4"&&(x<=_?delete m.maximum:delete m.exclusiveMaximum)),typeof b=="number"&&(m.multipleOf=b);break}case"boolean":{let m=p;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{this.target==="openapi-3.0"?(p.type="string",p.nullable=!0,p.enum=[null]):p.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{p.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let m=p,{minimum:h,maximum:_}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof _=="number"&&(m.maxItems=_),m.type="array",m.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let m=p;m.type="object",m.properties={};let h=o.shape;for(let b in h)m.properties[b]=this.process(h[b],{...d,path:[...d.path,"properties",b]});let _=new Set(Object.keys(h)),v=new Set([..._].filter(b=>{let x=o.shape[b]._zod;return this.io==="input"?x.optin===void 0:x.optout===void 0}));v.size>0&&(m.required=Array.from(v)),o.catchall?._zod.def.type==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{let m=p,h=o.discriminator!==void 0,_=o.options.map((v,b)=>this.process(v,{...d,path:[...d.path,h?"oneOf":"anyOf",b]}));h?m.oneOf=_:m.anyOf=_;break}case"intersection":{let m=p,h=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),_=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),v=x=>"allOf"in x&&Object.keys(x).length===1,b=[...v(h)?h.allOf:[h],...v(_)?_.allOf:[_]];m.allOf=b;break}case"tuple":{let m=p;m.type="array";let h=this.target==="draft-2020-12"?"prefixItems":"items",_=this.target==="draft-2020-12"||this.target==="openapi-3.0"?"items":"additionalItems",v=o.items.map((T,F)=>this.process(T,{...d,path:[...d.path,h,F]})),b=o.rest?this.process(o.rest,{...d,path:[...d.path,_,...this.target==="openapi-3.0"?[o.items.length]:[]]}):null;this.target==="draft-2020-12"?(m.prefixItems=v,b&&(m.items=b)):this.target==="openapi-3.0"?(m.items={anyOf:v},b&&m.items.anyOf.push(b),m.minItems=v.length,b||(m.maxItems=v.length)):(m.items=v,b&&(m.additionalItems=b));let{minimum:x,maximum:k}=e._zod.bag;typeof x=="number"&&(m.minItems=x),typeof k=="number"&&(m.maxItems=k);break}case"record":{let m=p;m.type="object",(this.target==="draft-7"||this.target==="draft-2020-12")&&(m.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]})),m.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=p,h=Yd(o.entries);h.every(_=>typeof _=="number")&&(m.type="number"),h.every(_=>typeof _=="string")&&(m.type="string"),m.enum=h;break}case"literal":{let m=p,h=[];for(let _ of o.values)if(_===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof _=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(_))}else h.push(_);if(h.length!==0)if(h.length===1){let _=h[0];m.type=_===null?"null":typeof _,this.target==="draft-4"||this.target==="openapi-3.0"?m.enum=[_]:m.const=_}else h.every(_=>typeof _=="number")&&(m.type="number"),h.every(_=>typeof _=="string")&&(m.type="string"),h.every(_=>typeof _=="boolean")&&(m.type="string"),h.every(_=>_===null)&&(m.type="null"),m.enum=h;break}case"file":{let m=p,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:_,maximum:v,mime:b}=e._zod.bag;_!==void 0&&(h.minLength=_),v!==void 0&&(h.maxLength=v),b?b.length===1?(h.contentMediaType=b[0],Object.assign(m,h)):m.anyOf=b.map(x=>({...h,contentMediaType:x})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,d);this.target==="openapi-3.0"?(a.ref=o.innerType,p.nullable=!0):p.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"success":{let m=p;m.type="boolean";break}case"default":{this.process(o.innerType,d),a.ref=o.innerType,p.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),a.ref=o.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),a.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}p.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=p,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,d),a.ref=m;break}case"readonly":{this.process(o.innerType,d),a.ref=o.innerType,p.readOnly=!0;break}case"promise":{this.process(o.innerType,d),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,d),a.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&xr(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let h=n.external.registry.get(l[0])?.id,_=n.external.uri??(b=>b);if(h)return{ref:_(h)};let v=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=v,{defId:v,ref:`${_("__shared")}#/${d}/${v}`}}if(l[1]===o)return{ref:"#"};let p=`#/${d}/`,m=l[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:p+m}},s=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:f,defId:p}=i(l);d.def={...d.schema},p&&(d.defId=p);let m=d.schema;for(let h in m)delete m[h];m.$ref=f};if(n.cycles==="throw")for(let l of this.seen.entries()){let d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/ + +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(e===l[0]){s(l);continue}if(n.external){let p=n.external.registry.get(l[0])?.id;if(e!==l[0]&&p){s(l);continue}}if(this.metadataRegistry.get(l[0])?.id){s(l);continue}if(d.cycle){s(l);continue}if(d.count>1&&n.reused==="ref"){s(l);continue}}let a=(l,d)=>{let f=this.seen.get(l),p=f.def??f.schema,m={...p};if(f.ref===null)return;let h=f.ref;if(f.ref=null,h){a(h,d);let _=this.seen.get(h).schema;_.$ref&&(d.target==="draft-7"||d.target==="draft-4"||d.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(_)):(Object.assign(p,_),Object.assign(p,m))}f.isParent||this.override({zodSchema:l,jsonSchema:p,path:f.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?c.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,o.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let d=l[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function vo(t,e){if(t instanceof Pu){let n=new zp(e),o={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let i={},s={registry:t,uri:e?.uri,defs:o};for(let a of t._idmap.entries()){let[c,u]=a;i[c]=n.emit(u,{...e,external:s})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}let r=new zp(e);return r.process(t),r.emit(t,e)}function xr(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return xr(n.element,r);if(n.type==="set")return xr(n.valueType,r);if(n.type==="lazy")return xr(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return xr(n.innerType,r);if(n.type==="intersection")return xr(n.left,r)||xr(n.right,r);if(n.type==="record"||n.type==="map")return xr(n.keyType,r)||xr(n.valueType,r);if(n.type==="pipe")return xr(n.in,r)||xr(n.out,r);if(n.type==="object"){for(let o in n.shape)if(xr(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(xr(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(xr(o,r))return!0;return!!(n.rest&&xr(n.rest,r))}return!1}var $z={};function nt(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_zod"in e))return!1;let r=e._zod;return typeof r=="object"&&r!==null&&"def"in r}function vt(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_def"in e)||"_zod"in e)return!1;let r=e._def;return typeof r=="object"&&r!=null&&"typeName"in r}function Iz(t){return nt(t)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),vt(t)}function on(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(nt(t)||vt(t))}function E$(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodLiteral"}function A$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="literal":!1}function Sz(t){return!!(E$(t)||A$(t))}async function Ey(t,e){if(nt(t))try{return{success:!0,data:await Yo(t,e)}}catch(r){return{success:!1,error:r}}if(vt(t))return await t.safeParseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function ts(t,e){if(nt(t))return await Yo(t,e);if(vt(t))return await t.parseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function kz(t,e){if(nt(t))try{return{success:!0,data:Bn(t,e)}}catch(r){return{success:!1,error:r}}if(vt(t))return t.safeParse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Tz(t,e){if(nt(t))return Bn(t,e);if(vt(t))return t.parse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function rs(t){if(nt(t))return Ge.get(t)?.description;if(vt(t)||"description"in t&&typeof t.description=="string")return t.description}function Ez(t){if(!on(t))return!1;if(vt(t)){let e=t._def;if(e.typeName==="ZodObject"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.typeName==="ZodRecord")return!0}if(nt(t)){let e=t._zod.def;if(e.type==="object"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.type==="record")return!0}return typeof t=="object"&&t!==null&&!("shape"in t)}function Wu(t){return on(t)?vt(t)?t._def.typeName==="ZodString":nt(t)?t._zod.def.type==="string":!1:!1}function Ay(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodObject"}function wn(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="object":!1}function Mp(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="array":!1}function O$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="optional":!1}function P$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="nullable":!1}function Az(t){return!!(Ay(t)||wn(t))}function ky(t){if(vt(t))return t.shape;if(nt(t))return t._zod.def.shape;throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Oz(t,e){if(vt(t))return t.extend(e);if(nt(t))return M.extend(t,e);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Pz(t){if(vt(t))return t.partial();if(nt(t))return M.partial(xa,t,void 0);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Hu(t,e=!1){if(vt(t))return t.strict();if(wn(t)){let r=t._zod.def.shape;if(e)for(let[i,s]of Object.entries(t._zod.def.shape)){if(wn(s)){let c=Hu(s,e);r[i]=c}else if(Mp(s)){let c=s._zod.def.element;wn(c)&&(c=Hu(c,e)),r[i]=Qe(s,{...s._zod.def,element:c})}else r[i]=s;let a=Ge.get(s);a&&Ge.add(r[i],a)}let n=Qe(t,{...t._zod.def,shape:r,catchall:zu(Eu)}),o=Ge.get(t);return o&&Ge.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Ty(t,e=!1){if(Ay(t))return t.passthrough();if(wn(t)){let r=t._zod.def.shape;if(e)for(let[i,s]of Object.entries(t._zod.def.shape)){if(wn(s)){let c=Ty(s,e);r[i]=c}else if(Mp(s)){let c=s._zod.def.element;wn(c)&&(c=Ty(c,e)),r[i]=Qe(s,{...s._zod.def,element:c})}else r[i]=s;let a=Ge.get(s);a&&Ge.add(r[i],a)}let n=Qe(t,{...t._zod.def,shape:r,catchall:Nu(Tu)}),o=Ge.get(t);return o&&Ge.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Cz(t){if(vt(t))try{let e=t.parse(void 0);return()=>e}catch{return}if(nt(t))try{let e=Bn(t,void 0);return()=>e}catch{return}}function Z5(t){return vt(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function q5(t){return nt(t)&&t._zod.def.type==="pipe"}function Ta(t,e,r){let n=r.get(t);if(n!==void 0)return n;if(vt(t))return Z5(t)?Ta(t._def.schema,e,r):t;if(nt(t)){let o=t;if(q5(t)&&(o=Ta(t._zod.def.in,e,r)),e){if(wn(o)){let s=o._zod.def.shape;for(let[a,c]of Object.entries(o._zod.def.shape))s[a]=Ta(c,e,r);o=Qe(o,{...o._zod.def,shape:s})}else if(Mp(o)){let s=Ta(o._zod.def.element,e,r);o=Qe(o,{...o._zod.def,element:s})}else if(O$(o)){let s=Ta(o._zod.def.innerType,e,r);o=Qe(o,{...o._zod.def,innerType:s})}else if(P$(o)){let s=Ta(o._zod.def.innerType,e,r);o=Qe(o,{...o._zod.def,innerType:s})}}let i=Ge.get(t);return i&&Ge.add(o,i),r.set(t,o),o}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Oy(t,e=!1){return Ta(t,e,new WeakMap)}function Rz(t,e){if(vt(t)){let r=ky(t),n={};for(let[o,i]of Object.entries(r))e(o,i)?n[o]=i.optional():n[o]=i;return t.extend(n)}if(nt(t)){let r=ky(t),n={...t._zod.def.shape};for(let[s,a]of Object.entries(r))e(s,a)&&(n[s]=new xa({type:"optional",innerType:a}));let o=Qe(t,{...t._zod.def,shape:n}),i=Ge.get(t);return i&&Ge.add(o,i),o}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Py(t){return t instanceof Error&&(t.constructor.name==="ZodError"||t.constructor.name==="$ZodError")}function C$(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}var V5=["*","_","`"];function G5(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n}; +`;return e}function Nz(t,e,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:s=!0,curveStyle:a="linear",wrapLabelNWords:c=9}=r??{},u=s?`%%{init: {'flowchart': {'curve': '${a}'}}}%% +graph TD; +`:`graph TD; +`;if(s){let p="default",m={[p]:"{0}({1})"};n!==void 0&&(m[n]="{0}([{1}]):::first"),o!==void 0&&(m[o]="{0}([{1}]):::last");for(let[h,_]of Object.entries(t)){let v=_.name.split(":").pop()??"",x=V5.some(T=>v.startsWith(T)&&v.endsWith(T))?`

${v}

`:v;Object.keys(_.metadata??{}).length&&(x+=`
${Object.entries(_.metadata??{}).map(([T,F])=>`${T} = ${F}`).join(` +`)}`);let k=(m[h]??m[p]).replace("{0}",C$(h)).replace("{1}",x);u+=` ${k} +`}}let l={};for(let p of e){let m=p.source.split(":"),h=p.target.split(":"),_=m.filter((v,b)=>v===h[b]).join(":");l[_]||(l[_]=[]),l[_].push(p)}let d=new Set;function f(p,m){let h=p.length===1&&p[0].source===p[0].target;if(m&&!h){let _=m.split(":").pop();if(d.has(_))throw new Error(`Found duplicate subgraph '${_}' -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);d.add(_),u+=` subgraph ${_} +`}for(let _ of p){let{source:v,target:b,data:x,conditional:k}=_,T="";if(x!==void 0){let F=x,J=F.split(" ");J.length>c&&(F=Array.from({length:Math.ceil(J.length/c)},(w,Z)=>J.slice(Z*c,(Z+1)*c).join(" ")).join(" 
 ")),T=k?` -.  ${F}  .-> `:` --  ${F}  --> `}else T=k?" -.-> ":" --> ";u+=` ${C$(v)}${T}${C$(b)}; +`}for(let _ in l)_.startsWith(`${m}:`)&&_!==m&&f(l[_],_);m&&!h&&(u+=` end +`)}f(l[""]??[],"");for(let p in l)!p.includes(":")&&p!==""&&f(l[p],p);return s&&(u+=G5(i??{})),u}async function zz(t,e){let r=e?.backgroundColor??"white",n=e?.imageType??"png",o=HR(t);r!==void 0&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(r)||(r=`!${r}`));let i=`https://mermaid.ink/img/${o}?bgColor=${r}&type=${n}`,s=await fetch(i);if(!s.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${s.status}`,`Status text: ${s.statusText}`].join(` +`));return await s.blob()}var jz=Symbol("Let zodToJsonSchema decide on which parser to use"),Mz={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Dz=t=>typeof t=="string"?{...Mz,name:t}:{...Mz,...t};var Lz=t=>{let e=Dz(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};var Cy=(t,e)=>{let r=0;for(;ryG,DIRTY:()=>Ea,EMPTY_PATH:()=>J5,INVALID:()=>pe,NEVER:()=>tK,OK:()=>sr,ParseStatus:()=>Gt,Schema:()=>Ee,ZodAny:()=>is,ZodArray:()=>ni,ZodBigInt:()=>Oa,ZodBoolean:()=>Pa,ZodBranded:()=>Dp,ZodCatch:()=>Ba,ZodDate:()=>Ca,ZodDefault:()=>Fa,ZodDiscriminatedUnion:()=>zy,ZodEffects:()=>In,ZodEnum:()=>La,ZodError:()=>Mr,ZodFirstPartyTypeKind:()=>N,ZodFunction:()=>jy,ZodIntersection:()=>Ma,ZodIssueCode:()=>z,ZodLazy:()=>ja,ZodLiteral:()=>Da,ZodMap:()=>tl,ZodNaN:()=>nl,ZodNativeEnum:()=>Ua,ZodNever:()=>qn,ZodNull:()=>Na,ZodNullable:()=>xo,ZodNumber:()=>Aa,ZodObject:()=>jr,ZodOptional:()=>xn,ZodParsedType:()=>W,ZodPipeline:()=>Lp,ZodPromise:()=>ss,ZodReadonly:()=>Za,ZodRecord:()=>My,ZodSchema:()=>Ee,ZodSet:()=>rl,ZodString:()=>os,ZodSymbol:()=>Qu,ZodTransformer:()=>In,ZodTuple:()=>wo,ZodType:()=>Ee,ZodUndefined:()=>Ra,ZodUnion:()=>za,ZodUnknown:()=>ri,ZodVoid:()=>el,addIssueToContext:()=>B,any:()=>TG,array:()=>PG,bigint:()=>xG,boolean:()=>Jz,coerce:()=>eK,custom:()=>Kz,date:()=>$G,datetimeRegex:()=>Vz,defaultErrorMap:()=>ei,discriminatedUnion:()=>NG,effect:()=>GG,enum:()=>ZG,function:()=>UG,getErrorMap:()=>Ju,getParsedType:()=>bo,instanceof:()=>bG,intersection:()=>zG,isAborted:()=>Ry,isAsync:()=>Xu,isDirty:()=>Ny,isValid:()=>ns,late:()=>vG,lazy:()=>FG,literal:()=>BG,makeIssue:()=>jp,map:()=>DG,nan:()=>wG,nativeEnum:()=>qG,never:()=>AG,null:()=>kG,nullable:()=>HG,number:()=>Wz,object:()=>Xz,objectUtil:()=>N$,oboolean:()=>QG,onumber:()=>YG,optional:()=>KG,ostring:()=>XG,pipeline:()=>JG,preprocess:()=>WG,promise:()=>VG,quotelessJson:()=>K5,record:()=>jG,set:()=>LG,setErrorMap:()=>W5,strictObject:()=>CG,string:()=>Hz,symbol:()=>IG,transformer:()=>GG,tuple:()=>MG,undefined:()=>SG,union:()=>RG,unknown:()=>EG,util:()=>je,void:()=>OG});var je;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(je||(je={}));var N$;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(N$||(N$={}));var W=je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bo=t=>{switch(typeof t){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(t)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(t)?W.array:t===null?W.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?W.promise:typeof Map<"u"&&t instanceof Map?W.map:typeof Set<"u"&&t instanceof Set?W.set:typeof Date<"u"&&t instanceof Date?W.date:W.object;default:return W.unknown}};var z=je.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),K5=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Mr=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;cr.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Mr.create=t=>new Mr(t);var H5=(t,e)=>{let r;switch(t.code){case z.invalid_type:t.received===W.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,je.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${je.joinValues(t.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${je.joinValues(t.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${je.joinValues(t.options)}, received '${t.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:je.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case z.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case z.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=e.defaultError,je.assertNever(t)}return{message:r}},ei=H5;var Uz=ei;function W5(t){Uz=t}function Ju(){return Uz}var jp=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}},J5=[];function B(t,e){let r=Ju(),n=jp({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ei?void 0:ei].filter(o=>!!o)});t.common.issues.push(n)}var Gt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return pe;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return pe;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}},pe=Object.freeze({status:"aborted"}),Ea=t=>({status:"dirty",value:t}),sr=t=>({status:"valid",value:t}),Ry=t=>t.status==="aborted",Ny=t=>t.status==="dirty",ns=t=>t.status==="valid",Xu=t=>typeof Promise<"u"&&t instanceof Promise;var ne;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ne||(ne={}));var $n=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Fz=(t,e)=>{if(ns(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Mr(t.common.issues);return this._error=r,this._error}}};function Se(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var Ee=class{get description(){return this._def.description}_getType(e){return bo(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Gt,ctx:{common:e.parent.common,data:e.data,parsedType:bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Xu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Fz(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return ns(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>ns(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Xu(o)?o:Promise.resolve(o));return Fz(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:z.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new In({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return xn.create(this,this._def)}nullable(){return xo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ni.create(this)}promise(){return ss.create(this,this._def)}or(e){return za.create([this,e],this._def)}and(e){return Ma.create(this,e,this._def)}transform(e){return new In({...Se(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Fa({...Se(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new Dp({typeName:N.ZodBranded,type:this,...Se(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Ba({...Se(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Lp.create(this,e)}readonly(){return Za.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},X5=/^c[^\s-]{8,}$/i,Y5=/^[0-9a-z]+$/,Q5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,eG=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tG=/^[a-z0-9_-]{21}$/i,rG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,nG=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",z$,sG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,aG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,cG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,uG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zz="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",pG=new RegExp(`^${Zz}$`);function qz(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function fG(t){return new RegExp(`^${qz(t)}$`)}function Vz(t){let e=`${Zz}T${qz(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function mG(t,e){return!!((e==="v4"||!e)&&sG.test(t)||(e==="v6"||!e)&&cG.test(t))}function hG(t,e){if(!rG.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function gG(t,e){return!!((e==="v4"||!e)&&aG.test(t)||(e==="v6"||!e)&&uG.test(t))}var os=class t extends Ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.string,received:i.parsedType}),pe}let n=new Gt,o;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(o=this._getOrReturnCtx(e,o),B(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.lengthe.test(o),{validation:r,code:z.invalid_string,...ne.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ne.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ne.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ne.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ne.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ne.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ne.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ne.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ne.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ne.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ne.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ne.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ne.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ne.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ne.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ne.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ne.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ne.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ne.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ne.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ne.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ne.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ne.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ne.errToObj(r)})}nonempty(e){return this.min(1,ne.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew os({checks:[],typeName:N.ZodString,coerce:t?.coerce??!1,...Se(t)});function _G(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var Aa=class t extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==W.number){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.number,received:i.parsedType}),pe}let n,o=new Gt;for(let i of this._def.checks)i.kind==="int"?je.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?_G(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_finite,message:i.message}),o.dirty()):je.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ne.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ne.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ne.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ne.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ne.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ne.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ne.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ne.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ne.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ne.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&je.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew Aa({checks:[],typeName:N.ZodNumber,coerce:t?.coerce||!1,...Se(t)});var Oa=class t extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==W.bigint)return this._getInvalidInput(e);let n,o=new Gt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):je.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return B(r,{code:z.invalid_type,expected:W.bigint,received:r.parsedType}),pe}gte(e,r){return this.setLimit("min",e,!0,ne.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ne.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ne.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ne.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ne.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ne.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Oa({checks:[],typeName:N.ZodBigInt,coerce:t?.coerce??!1,...Se(t)});var Pa=class extends Ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.boolean,received:n.parsedType}),pe}return sr(e.data)}};Pa.create=t=>new Pa({typeName:N.ZodBoolean,coerce:t?.coerce||!1,...Se(t)});var Ca=class t extends Ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.date,received:i.parsedType}),pe}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_date}),pe}let n=new Gt,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(o=this._getOrReturnCtx(e,o),B(o,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):je.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ne.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ne.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ca({checks:[],coerce:t?.coerce||!1,typeName:N.ZodDate,...Se(t)});var Qu=class extends Ee{_parse(e){if(this._getType(e)!==W.symbol){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.symbol,received:n.parsedType}),pe}return sr(e.data)}};Qu.create=t=>new Qu({typeName:N.ZodSymbol,...Se(t)});var Ra=class extends Ee{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.undefined,received:n.parsedType}),pe}return sr(e.data)}};Ra.create=t=>new Ra({typeName:N.ZodUndefined,...Se(t)});var Na=class extends Ee{_parse(e){if(this._getType(e)!==W.null){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.null,received:n.parsedType}),pe}return sr(e.data)}};Na.create=t=>new Na({typeName:N.ZodNull,...Se(t)});var is=class extends Ee{constructor(){super(...arguments),this._any=!0}_parse(e){return sr(e.data)}};is.create=t=>new is({typeName:N.ZodAny,...Se(t)});var ri=class extends Ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return sr(e.data)}};ri.create=t=>new ri({typeName:N.ZodUnknown,...Se(t)});var qn=class extends Ee{_parse(e){let r=this._getOrReturnCtx(e);return B(r,{code:z.invalid_type,expected:W.never,received:r.parsedType}),pe}};qn.create=t=>new qn({typeName:N.ZodNever,...Se(t)});var el=class extends Ee{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.void,received:n.parsedType}),pe}return sr(e.data)}};el.create=t=>new el({typeName:N.ZodVoid,...Se(t)});var ni=class t extends Ee{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==W.array)return B(r,{code:z.invalid_type,expected:W.array,received:r.parsedType}),pe;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.lengtho.maxLength.value&&(B(r,{code:z.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new $n(r,s,r.path,a)))).then(s=>Gt.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new $n(r,s,r.path,a)));return Gt.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:ne.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:ne.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:ne.toString(r)}})}nonempty(e){return this.min(1,e)}};ni.create=(t,e)=>new ni({type:t,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...Se(e)});function Yu(t){if(t instanceof jr){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=xn.create(Yu(n))}return new jr({...t._def,shape:()=>e})}else return t instanceof ni?new ni({...t._def,type:Yu(t.element)}):t instanceof xn?xn.create(Yu(t.unwrap())):t instanceof xo?xo.create(Yu(t.unwrap())):t instanceof wo?wo.create(t.items.map(e=>Yu(e))):t}var jr=class t extends Ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=je.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==W.object){let u=this._getOrReturnCtx(e);return B(u,{code:z.invalid_type,expected:W.object,received:u.parsedType}),pe}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof qn&&this._def.unknownKeys==="strip"))for(let u in o.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new $n(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof qn){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(B(o,{code:z.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new $n(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Gt.mergeObjectSync(n,u)):Gt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return ne.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ne.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of je.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of je.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Yu(this)}partial(e){let r={};for(let n of je.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of je.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof xn;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Gz(je.objectKeys(this.shape))}};jr.create=(t,e)=>new jr({shape:()=>t,unknownKeys:"strip",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});jr.strictCreate=(t,e)=>new jr({shape:()=>t,unknownKeys:"strict",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});jr.lazycreate=(t,e)=>new jr({shape:t,unknownKeys:"strip",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});var za=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new Mr(a.ctx.common.issues));return B(r,{code:z.invalid_union,unionErrors:s}),pe}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new Mr(c));return B(r,{code:z.invalid_union,unionErrors:a}),pe}}get options(){return this._def.options}};za.create=(t,e)=>new za({options:t,typeName:N.ZodUnion,...Se(e)});var ti=t=>t instanceof ja?ti(t.schema):t instanceof In?ti(t.innerType()):t instanceof Da?[t.value]:t instanceof La?t.options:t instanceof Ua?je.objectValues(t.enum):t instanceof Fa?ti(t._def.innerType):t instanceof Ra?[void 0]:t instanceof Na?[null]:t instanceof xn?[void 0,...ti(t.unwrap())]:t instanceof xo?[null,...ti(t.unwrap())]:t instanceof Dp||t instanceof Za?ti(t.unwrap()):t instanceof Ba?ti(t._def.innerType):[],zy=class t extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.object)return B(r,{code:z.invalid_type,expected:W.object,received:r.parsedType}),pe;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(B(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=ti(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Se(n)})}};function M$(t,e){let r=bo(t),n=bo(e);if(t===e)return{valid:!0,data:t};if(r===W.object&&n===W.object){let o=je.objectKeys(e),i=je.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let c=M$(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===W.array&&n===W.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i{if(Ry(i)||Ry(s))return pe;let a=M$(i.value,s.value);return a.valid?((Ny(i)||Ny(s))&&r.dirty(),{status:r.value,value:a.data}):(B(n,{code:z.invalid_intersection_types}),pe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ma.create=(t,e,r)=>new Ma({left:t,right:e,typeName:N.ZodIntersection,...Se(r)});var wo=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.array)return B(n,{code:z.invalid_type,expected:W.array,received:n.parsedType}),pe;if(n.data.lengththis._def.items.length&&(B(n,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new $n(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>Gt.mergeArray(r,s)):Gt.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};wo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wo({items:t,typeName:N.ZodTuple,rest:null,...Se(e)})};var My=class t extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.object)return B(n,{code:z.invalid_type,expected:W.object,received:n.parsedType}),pe;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new $n(n,a,n.path,a)),value:s._parse(new $n(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Gt.mergeObjectAsync(r,o):Gt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ee?new t({keyType:e,valueType:r,typeName:N.ZodRecord,...Se(n)}):new t({keyType:os.create(),valueType:e,typeName:N.ZodRecord,...Se(r)})}},tl=class extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.map)return B(n,{code:z.invalid_type,expected:W.map,received:n.parsedType}),pe;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new $n(n,a,n.path,[u,"key"])),value:i._parse(new $n(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return pe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return pe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};tl.create=(t,e,r)=>new tl({valueType:e,keyType:t,typeName:N.ZodMap,...Se(r)});var rl=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.set)return B(n,{code:z.invalid_type,expected:W.set,received:n.parsedType}),pe;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&(B(n,{code:z.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return pe;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>i._parse(new $n(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:ne.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:ne.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};rl.create=(t,e)=>new rl({valueType:t,minSize:null,maxSize:null,typeName:N.ZodSet,...Se(e)});var jy=class t extends Ee{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.function)return B(r,{code:z.invalid_type,expected:W.function,received:r.parsedType}),pe;function n(a,c){return jp({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ju(),ei].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function o(a,c){return jp({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ju(),ei].filter(u=>!!u),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof ss){let a=this;return sr(async function(...c){let u=new Mr([]),l=await a._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(o(d,p)),u})})}else{let a=this;return sr(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new Mr([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new Mr([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:wo.create(e).rest(ri.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||wo.create([]).rest(ri.create()),returns:r||ri.create(),typeName:N.ZodFunction,...Se(n)})}},ja=class extends Ee{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ja.create=(t,e)=>new ja({getter:t,typeName:N.ZodLazy,...Se(e)});var Da=class extends Ee{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return B(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}};Da.create=(t,e)=>new Da({value:t,typeName:N.ZodLiteral,...Se(e)});function Gz(t,e){return new La({values:t,typeName:N.ZodEnum,...Se(e)})}var La=class t extends Ee{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{expected:je.joinValues(n),received:r.parsedType,code:z.invalid_type}),pe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{received:r.data,code:z.invalid_enum_value,options:n}),pe}return sr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};La.create=Gz;var Ua=class extends Ee{_parse(e){let r=je.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==W.string&&n.parsedType!==W.number){let o=je.objectValues(r);return B(n,{expected:je.joinValues(o),received:n.parsedType,code:z.invalid_type}),pe}if(this._cache||(this._cache=new Set(je.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=je.objectValues(r);return B(n,{received:n.data,code:z.invalid_enum_value,options:o}),pe}return sr(e.data)}get enum(){return this._def.values}};Ua.create=(t,e)=>new Ua({values:t,typeName:N.ZodNativeEnum,...Se(e)});var ss=class extends Ee{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.promise&&r.common.async===!1)return B(r,{code:z.invalid_type,expected:W.promise,received:r.parsedType}),pe;let n=r.parsedType===W.promise?r.data:Promise.resolve(r.data);return sr(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ss.create=(t,e)=>new ss({type:t,typeName:N.ZodPromise,...Se(e)});var In=class extends Ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{B(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return pe;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?pe:c.status==="dirty"?Ea(c.value):r.value==="dirty"?Ea(c.value):c});{if(r.value==="aborted")return pe;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?pe:a.status==="dirty"?Ea(a.value):r.value==="dirty"?Ea(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?pe:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?pe:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ns(s))return pe;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>ns(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):pe);je.assertNever(o)}};In.create=(t,e,r)=>new In({schema:t,typeName:N.ZodEffects,effect:e,...Se(r)});In.createWithPreprocess=(t,e,r)=>new In({schema:e,effect:{type:"preprocess",transform:t},typeName:N.ZodEffects,...Se(r)});var xn=class extends Ee{_parse(e){return this._getType(e)===W.undefined?sr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xn.create=(t,e)=>new xn({innerType:t,typeName:N.ZodOptional,...Se(e)});var xo=class extends Ee{_parse(e){return this._getType(e)===W.null?sr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xo.create=(t,e)=>new xo({innerType:t,typeName:N.ZodNullable,...Se(e)});var Fa=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===W.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Fa.create=(t,e)=>new Fa({innerType:t,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Se(e)});var Ba=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Xu(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Se(e)});var nl=class extends Ee{_parse(e){if(this._getType(e)!==W.nan){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.nan,received:n.parsedType}),pe}return{status:"valid",value:e.data}}};nl.create=t=>new nl({typeName:N.ZodNaN,...Se(t)});var yG=Symbol("zod_brand"),Dp=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Lp=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?pe:i.status==="dirty"?(r.dirty(),Ea(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?pe:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:N.ZodPipeline})}},Za=class extends Ee{_parse(e){let r=this._def.innerType._parse(e),n=o=>(ns(o)&&(o.value=Object.freeze(o.value)),o);return Xu(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Za.create=(t,e)=>new Za({innerType:t,typeName:N.ZodReadonly,...Se(e)});function Bz(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Kz(t,e={},r){return t?is.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=Bz(e,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!i){let s=Bz(e,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):is.create()}var vG={object:jr.lazycreate},N;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(N||(N={}));var bG=(t,e={message:`Input not instance of ${t.name}`})=>Kz(r=>r instanceof t,e),Hz=os.create,Wz=Aa.create,wG=nl.create,xG=Oa.create,Jz=Pa.create,$G=Ca.create,IG=Qu.create,SG=Ra.create,kG=Na.create,TG=is.create,EG=ri.create,AG=qn.create,OG=el.create,PG=ni.create,Xz=jr.create,CG=jr.strictCreate,RG=za.create,NG=zy.create,zG=Ma.create,MG=wo.create,jG=My.create,DG=tl.create,LG=rl.create,UG=jy.create,FG=ja.create,BG=Da.create,ZG=La.create,qG=Ua.create,VG=ss.create,GG=In.create,KG=xn.create,HG=xo.create,WG=In.createWithPreprocess,JG=Lp.create,XG=()=>Hz().optional(),YG=()=>Wz().optional(),QG=()=>Jz().optional(),eK={string:(t=>os.create({...t,coerce:!0})),number:(t=>Aa.create({...t,coerce:!0})),boolean:(t=>Pa.create({...t,coerce:!0})),bigint:(t=>Oa.create({...t,coerce:!0})),date:(t=>Ca.create({...t,coerce:!0}))};var tK=pe;function Yz(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==N.ZodAny&&(r.items=he(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&De(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&De(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(De(r,"minItems",t.exactLength.value,t.exactLength.message,e),De(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Qz(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?De(r,"minimum",n.value,n.message,e):De(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),De(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?De(r,"maximum",n.value,n.message,e):De(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),De(r,"maximum",n.value,n.message,e));break;case"multipleOf":De(r,"multipleOf",n.value,n.message,e);break}return r}function e1(){return{type:"boolean"}}function Dy(t,e){return he(t.type._def,e)}var t1=(t,e)=>he(t.innerType._def,e);function j$(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map(o=>j$(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return nK(t,e)}}var nK=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":De(r,"minimum",n.value,n.message,e);break;case"max":De(r,"maximum",n.value,n.message,e);break}return r};function r1(t,e){return{...he(t.innerType._def,e),default:t.defaultValue()}}function n1(t,e){return e.effectStrategy==="input"?he(t.schema._def,e):pt(e)}function o1(t){return{type:"string",enum:Array.from(t.values)}}var oK=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function i1(t,e){let r=[he(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),he(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(oK(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...c}=i;s=c}else n=void 0;o.push(s)}}),o.length?{allOf:o,...n}:void 0}function s1(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var D$,Vn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(D$===void 0&&(D$=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),D$),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Ly(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":De(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":De(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Gn(r,"email",n.message,e);break;case"format:idn-email":Gn(r,"idn-email",n.message,e);break;case"pattern:zod":Ir(r,Vn.email,n.message,e);break}break;case"url":Gn(r,"uri",n.message,e);break;case"uuid":Gn(r,"uuid",n.message,e);break;case"regex":Ir(r,n.regex,n.message,e);break;case"cuid":Ir(r,Vn.cuid,n.message,e);break;case"cuid2":Ir(r,Vn.cuid2,n.message,e);break;case"startsWith":Ir(r,RegExp(`^${L$(n.value,e)}`),n.message,e);break;case"endsWith":Ir(r,RegExp(`${L$(n.value,e)}$`),n.message,e);break;case"datetime":Gn(r,"date-time",n.message,e);break;case"date":Gn(r,"date",n.message,e);break;case"time":Gn(r,"time",n.message,e);break;case"duration":Gn(r,"duration",n.message,e);break;case"length":De(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),De(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":Ir(r,RegExp(L$(n.value,e)),n.message,e);break;case"ip":n.version!=="v6"&&Gn(r,"ipv4",n.message,e),n.version!=="v4"&&Gn(r,"ipv6",n.message,e);break;case"base64url":Ir(r,Vn.base64url,n.message,e);break;case"jwt":Ir(r,Vn.jwt,n.message,e);break;case"cidr":n.version!=="v6"&&Ir(r,Vn.ipv4Cidr,n.message,e),n.version!=="v4"&&Ir(r,Vn.ipv6Cidr,n.message,e);break;case"emoji":Ir(r,Vn.emoji(),n.message,e);break;case"ulid":Ir(r,Vn.ulid,n.message,e);break;case"base64":switch(e.base64Strategy){case"format:binary":Gn(r,"binary",n.message,e);break;case"contentEncoding:base64":De(r,"contentEncoding","base64",n.message,e);break;case"pattern:zod":Ir(r,Vn.base64,n.message,e);break}break;case"nanoid":Ir(r,Vn.nanoid,n.message,e);break;case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function L$(t,e){return e.patternStrategy==="escape"?sK(t):t}var iK=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function sK(t){let e="";for(let r=0;ro.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):De(t,"format",e,r,n)}function Ir(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:a1(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):De(t,"pattern",a1(e,n),r,n)}function a1(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",i=!1,s=!1,a=!1;for(let c=0;c({...n,[o]:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??pt(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===N.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=Ly(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===N.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===N.ZodBranded&&t.keyType._def.type._def.typeName===N.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=Dy(t.keyType._def,e);return{...r,propertyNames:o}}}return r}function c1(t,e){if(e.mapStrategy==="record")return Uy(t,e);let r=he(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||pt(e),n=he(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||pt(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function u1(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function l1(t){return t.target==="openAi"?void 0:{not:pt({...t,currentPath:[...t.currentPath,"not"]})}}function d1(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Up={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function f1(t,e){if(e.target==="openApi3")return p1(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Up&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let s=Up[i._def.typeName];return s&&!o.includes(s)?[...o,s]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,i)=>{let s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];case"bigint":return[...o,"integer"];case"object":return i._def.value===null?[...o,"null"]:o;case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((i,s,a)=>a.indexOf(i)===s);return{type:o.length>1?o:o[0],enum:r.reduce((i,s)=>i.includes(s._def.value)?i:[...i,s._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return p1(t,e)}var p1=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>he(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function m1(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Up[t.innerType._def.typeName],nullable:!0}:{type:[Up[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=he(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function h1(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",R$(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?De(r,"minimum",n.value,n.message,e):De(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),De(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?De(r,"maximum",n.value,n.message,e):De(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),De(r,"maximum",n.value,n.message,e));break;case"multipleOf":De(r,"multipleOf",n.value,n.message,e);break}return r}function g1(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},o=[],i=t.shape();for(let a in i){let c=i[a];if(c===void 0||c._def===void 0)continue;let u=cK(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=he(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||o.push(a))}o.length&&(n.required=o);let s=aK(t,e);return s!==void 0&&(n.additionalProperties=s),n}function aK(t,e){if(t.catchall._def.typeName!=="ZodNever")return he(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function cK(t){try{return t.isOptional()}catch{return!0}}var _1=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return he(t.innerType._def,e);let r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:pt(e)},r]}:pt(e)};var y1=(t,e)=>{if(e.pipeStrategy==="input")return he(t.in._def,e);if(e.pipeStrategy==="output")return he(t.out._def,e);let r=he(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=he(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function v1(t,e){return he(t.type._def,e)}function b1(t,e){let n={type:"array",uniqueItems:!0,items:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&De(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&De(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function w1(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>he(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:he(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>he(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function x1(t){return{not:pt(t)}}function $1(t){return pt(t)}var I1=(t,e)=>he(t.innerType._def,e);var S1=(t,e,r)=>{switch(e){case N.ZodString:return Ly(t,r);case N.ZodNumber:return h1(t,r);case N.ZodObject:return g1(t,r);case N.ZodBigInt:return Qz(t,r);case N.ZodBoolean:return e1();case N.ZodDate:return j$(t,r);case N.ZodUndefined:return x1(r);case N.ZodNull:return d1(r);case N.ZodArray:return Yz(t,r);case N.ZodUnion:case N.ZodDiscriminatedUnion:return f1(t,r);case N.ZodIntersection:return i1(t,r);case N.ZodTuple:return w1(t,r);case N.ZodRecord:return Uy(t,r);case N.ZodLiteral:return s1(t,r);case N.ZodEnum:return o1(t);case N.ZodNativeEnum:return u1(t);case N.ZodNullable:return m1(t,r);case N.ZodOptional:return _1(t,r);case N.ZodMap:return c1(t,r);case N.ZodSet:return b1(t,r);case N.ZodLazy:return()=>t.getter()._def;case N.ZodPromise:return v1(t,r);case N.ZodNaN:case N.ZodNever:return l1(r);case N.ZodEffects:return n1(t,r);case N.ZodAny:return pt(r);case N.ZodUnknown:return $1(r);case N.ZodDefault:return r1(t,r);case N.ZodBranded:return Dy(t,r);case N.ZodReadonly:return I1(t,r);case N.ZodCatch:return t1(t,r);case N.ZodPipeline:return y1(t,r);case N.ZodFunction:case N.ZodVoid:case N.ZodSymbol:return;default:return(n=>{})(e)}};function he(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==jz)return a}if(n&&!r){let a=uK(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=S1(t,t.typeName,e),s=typeof i=="function"?he(i(),e):i;if(s&&lK(t,e,s),e.postProcess){let a=e.postProcess(s,t,e);return o.jsonSchema=s,a}return o.jsonSchema=s,s}var uK=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Cy(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),pt(e)):e.$refStrategy==="seen"?pt(e):void 0}},lK=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var k1=(t,e)=>{let r=Lz(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:he(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??pt(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=he(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??pt(r),s=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;s!==void 0&&(i.title=s),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=o===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function $o(t,e){let r=typeof t;if(r!==typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let n=t.length;if(n!==e.length)return!1;for(let o=0;o1?e[s.href]=t:(s.hash="",n===""?r=s:Kn(t,e,r))}}else if(t!==!0&&t!==!1)return e;let o=r.href+(n?"#"+n:"");if(e[o]!==void 0)throw new Error(`Duplicate schema URI "${o}".`);if(e[o]=t,t===!0||t===!1)return e;if(t.__absolute_uri__===void 0&&Object.defineProperty(t,"__absolute_uri__",{enumerable:!1,value:o}),t.$ref&&t.__absolute_ref__===void 0){let i=new URL(t.$ref,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_ref__",{enumerable:!1,value:i.href})}if(t.$recursiveRef&&t.__absolute_recursive_ref__===void 0){let i=new URL(t.$recursiveRef,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(t.$anchor){let i=new URL("#"+t.$anchor,r.href);e[i.href]=t}for(let i in t){if(mK[i])continue;let s=`${n}/${sn(i)}`,a=t[i];if(Array.isArray(a)){if(pK[i]){let c=a.length;for(let u=0;u%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,xK=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,$K=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,IK=/^(?:\/(?:[^~/]|~0|~1)*)*$/,SK=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,kK=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,TK=t=>{if(t[0]==='"')return!1;let[e,r,...n]=t.split("@");return!e||!r||n.length!==0||e.length>64||r.length>253||e[0]==="."||e.endsWith(".")||e.includes("..")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(e)?!1:r.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},EK=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,AK=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,OK=t=>t.length>1&&t.length<80&&(/^P\d+([.,]\d+)?W$/.test(t)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(t)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(t));function Io(t){return t.test.bind(t)}var U$={date:T1,time:E1.bind(void 0,!1),"date-time":RK,duration:OK,uri:MK,"uri-reference":Io(bK),"uri-template":Io(wK),url:Io(xK),email:TK,hostname:Io(vK),ipv4:Io(EK),ipv6:Io(AK),regex:DK,uuid:Io($K),"json-pointer":Io(IK),"json-pointer-uri-fragment":Io(SK),"relative-json-pointer":Io(kK)};function PK(t){return t%4===0&&(t%100!==0||t%400===0)}function T1(t){let e=t.match(gK);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&PK(r)?29:_K[n])}function E1(t,e){let r=e.match(yK);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3],s=!!r[5];return(n<=23&&o<=59&&i<=59||n==23&&o==59&&i==60)&&(!t||s)}var CK=/t|\s/i;function RK(t){let e=t.split(CK);return e.length==2&&T1(e[0])&&E1(!0,e[1])}var NK=/\/|:/,zK=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function MK(t){return NK.test(t)&&zK.test(t)}var jK=/[^\\]\\Z/;function DK(t){if(jK.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var A1;(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(A1||(A1={}));function O1(t){let e=0,r=t.length,n=0,o;for(;n=55296&&o<=56319&&n$o(t,ge))||H.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`}):_.some(ge=>t===ge)||H.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`})),b!==void 0){let ge=`${a}/not`;ot(t,b,r,n,o,i,s,ge).valid&&H.push({instanceLocation:s,keyword:"not",keywordLocation:ge,error:'Instance matched "not" schema.'})}let Ts=[];if(x!==void 0){let ge=`${a}/anyOf`,le=H.length,xe=!1;for(let ee=0;ee{let ve=Object.create(c),_e=ot(t,ee,r,n,o,p===!0?i:null,s,`${ge}/${q}`,ve);return H.push(..._e.errors),_e.valid&&Ts.push(ve),_e.valid}).length;xe===1?H.length=le:H.splice(le,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:ge,error:`Instance does not match exactly one subschema (${xe} matches).`})}if((l==="object"||l==="array")&&Object.assign(c,...Ts),F!==void 0){let ge=`${a}/if`;if(ot(t,F,r,n,o,i,s,ge,c).valid){if(J!==void 0){let xe=ot(t,J,r,n,o,i,s,`${a}/then`,c);xe.valid||H.push({instanceLocation:s,keyword:"if",keywordLocation:ge,error:'Instance does not match "then" schema.'},...xe.errors)}}else if(w!==void 0){let xe=ot(t,w,r,n,o,i,s,`${a}/else`,c);xe.valid||H.push({instanceLocation:s,keyword:"if",keywordLocation:ge,error:'Instance does not match "else" schema.'},...xe.errors)}}if(l==="object"){if(v!==void 0)for(let ee of v)ee in t||H.push({instanceLocation:s,keyword:"required",keywordLocation:`${a}/required`,error:`Instance does not have required property "${ee}".`});let ge=Object.keys(t);if(pn!==void 0&&ge.lengthNo&&H.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${No} properties.`}),qe!==void 0){let ee=`${a}/propertyNames`;for(let q in t){let ve=`${s}/${sn(q)}`,_e=ot(q,qe,r,n,o,i,ve,ee);_e.valid||H.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:ee,error:`Property name "${q}" does not match schema.`},..._e.errors)}}if(Ul!==void 0){let ee=`${a}/dependantRequired`;for(let q in Ul)if(q in t){let ve=Ul[q];for(let _e of ve)_e in t||H.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:ee,error:`Instance has "${q}" but does not have "${_e}".`})}}if(Ss!==void 0)for(let ee in Ss){let q=`${a}/dependentSchemas`;if(ee in t){let ve=ot(t,Ss[ee],r,n,o,i,s,`${q}/${sn(ee)}`,c);ve.valid||H.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:q,error:`Instance has "${ee}" but does not match dependant schema.`},...ve.errors)}}if(ks!==void 0){let ee=`${a}/dependencies`;for(let q in ks)if(q in t){let ve=ks[q];if(Array.isArray(ve))for(let _e of ve)_e in t||H.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ee,error:`Instance has "${q}" but does not have "${_e}".`});else{let _e=ot(t,ve,r,n,o,i,s,`${ee}/${sn(q)}`);_e.valid||H.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ee,error:`Instance has "${q}" but does not match dependant schema.`},..._e.errors)}}}let le=Object.create(null),xe=!1;if(oe!==void 0){let ee=`${a}/properties`;for(let q in oe){if(!(q in t))continue;let ve=`${s}/${sn(q)}`,_e=ot(t[q],oe[q],r,n,o,i,ve,`${ee}/${sn(q)}`);if(_e.valid)c[q]=le[q]=!0;else if(xe=o,H.push({instanceLocation:s,keyword:"properties",keywordLocation:ee,error:`Property "${q}" does not match schema.`},..._e.errors),xe)break}}if(!xe&&Q!==void 0){let ee=`${a}/patternProperties`;for(let q in Q){let ve=new RegExp(q,"u"),_e=Q[q];for(let Er in t){if(!ve.test(Er))continue;let ET=`${s}/${sn(Er)}`,AT=ot(t[Er],_e,r,n,o,i,ET,`${ee}/${sn(q)}`);AT.valid?c[Er]=le[Er]=!0:(xe=o,H.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:ee,error:`Property "${Er}" matches pattern "${q}" but does not match associated schema.`},...AT.errors))}}}if(!xe&&wt!==void 0){let ee=`${a}/additionalProperties`;for(let q in t){if(le[q])continue;let ve=`${s}/${sn(q)}`,_e=ot(t[q],wt,r,n,o,i,ve,ee);_e.valid?c[q]=!0:(xe=o,H.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:ee,error:`Property "${q}" does not match additional properties schema.`},..._e.errors))}}else if(!xe&&dn!==void 0){let ee=`${a}/unevaluatedProperties`;for(let q in t)if(!c[q]){let ve=`${s}/${sn(q)}`,_e=ot(t[q],dn,r,n,o,i,ve,ee);_e.valid?c[q]=!0:H.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:ee,error:`Property "${q}" does not match unevaluated properties schema.`},..._e.errors)}}}else if(l==="array"){R!==void 0&&t.length>R&&H.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${t.length} > ${R}).`}),g!==void 0&&t.length=(Cn||0)&&(H.length=q),Cn===void 0&&y===void 0&&ve===0?H.splice(q,0,{instanceLocation:s,keyword:"contains",keywordLocation:ee,error:"Array does not contain item matching schema."}):Cn!==void 0&&vey&&H.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${y} items matching schema. ${ve} items were found.`})}if(!xe&&Bl!==void 0){let ee=`${a}/unevaluatedItems`;for(le;le=Ye||t>Ye)&&H.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${Tt?"or equal to ":""} ${Ye}.`})):(ze!==void 0&&tYe&&H.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${Ye}.`}),it!==void 0&&t<=it&&H.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${a}/exclusiveMinimum`,error:`${t} is less than ${it}.`}),Tt!==void 0&&t>=Tt&&H.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${a}/exclusiveMaximum`,error:`${t} is greater than or equal to ${Tt}.`})),Bt!==void 0){let ge=t%Bt;Math.abs(0-ge)>=11920929e-14&&Math.abs(Bt-ge)>=11920929e-14&&H.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${a}/multipleOf`,error:`${t} is not a multiple of ${Bt}.`})}}else if(l==="string"){let ge=Rn===void 0&&ht===void 0?0:O1(t);Rn!==void 0&&geht&&H.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${a}/maxLength`,error:`String is too long (${ge} > ${ht}).`}),fn!==void 0&&!new RegExp(fn,"u").test(t)&&H.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${a}/pattern`,error:"String does not match pattern."}),Z!==void 0&&U$[Z]&&!U$[Z](t)&&H.push({instanceLocation:s,keyword:"format",keywordLocation:`${a}/format`,error:`String does not match format "${Z}".`})}return{valid:H.length===0,errors:H}}var Fy=class{schema;draft;shortCircuit;lookup;constructor(e,r="2019-09",n=!0){this.schema=e,this.draft=r,this.shortCircuit=n,this.lookup=Kn(e)}validate(e){return ot(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,r){r&&(e={...e,$id:r}),Kn(e,this.lookup)}};var LK={};G(LK,{Validator:()=>Fy,deepCompareStrict:()=>$o,toJsonSchema:()=>an,validatesOnlyStrings:()=>ol});function an(t){if(nt(t)){let e=Oy(t,!0);if(wn(e)){let r=Hu(e,!0);return vo(r)}else return vo(t)}return vt(t)?k1(t):t}function ol(t){if(!t||typeof t!="object"||Object.keys(t).length===0||Array.isArray(t))return!1;if("type"in t)return typeof t.type=="string"?t.type==="string":Array.isArray(t.type)?t.type.every(e=>e==="string"):!1;if("enum"in t)return Array.isArray(t.enum)&&t.enum.length>0&&t.enum.every(e=>typeof e=="string");if("const"in t)return typeof t.const=="string";if("allOf"in t&&Array.isArray(t.allOf))return t.allOf.some(e=>ol(e));if("anyOf"in t&&Array.isArray(t.anyOf)||"oneOf"in t&&Array.isArray(t.oneOf)){let e="anyOf"in t?t.anyOf:t.oneOf;return e.length>0&&e.every(r=>ol(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=Kn(t);return r[e]?ol(r[e]):!1}return!1}var UK={};G(UK,{Graph:()=>By});function FK(t,e){if(t!==void 0&&!Ui(t))return t;if(Hd(e))try{let r=e.getName();return r=r.startsWith("Runnable")?r.slice(8):r,r}catch{return e.getName()}else return e.name??"UnknownSchema"}function BK(t){return Hd(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...an(t.data.schema),title:t.data.name}}}var By=class R1{nodes={};edges=[];constructor(e){this.nodes=e?.nodes??this.nodes,this.edges=e?.edges??this.edges}toJSON(){let e={};return Object.values(this.nodes).forEach((r,n)=>{e[r.id]=Ui(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...BK(r)})),edges:this.edges.map(r=>{let n={source:e[r.source],target:e[r.target]};return typeof r.data<"u"&&(n.data=r.data),typeof r.conditional<"u"&&(n.conditional=r.conditional),n})}}addNode(e,r,n){if(r!==void 0&&this.nodes[r]!==void 0)throw new Error(`Node with id ${r} already exists`);let o=r??Et(),i={id:o,data:e,name:FK(r,e),metadata:n};return this.nodes[o]=i,i}removeNode(e){delete this.nodes[e.id],this.edges=this.edges.filter(r=>r.source!==e.id&&r.target!==e.id)}addEdge(e,r,n,o){if(this.nodes[e.id]===void 0)throw new Error(`Source node ${e.id} not in graph`);if(this.nodes[r.id]===void 0)throw new Error(`Target node ${r.id} not in graph`);let i={source:e.id,target:r.id,data:n,conditional:o};return this.edges.push(i),i}firstNode(){return P1(this)}lastNode(){return C1(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(u=>u.id).every(Ui)&&(n="");let i=u=>n?`${n}:${u}`:u;Object.entries(e.nodes).forEach(([u,l])=>{this.nodes[i(u)]={...l,id:i(u)}});let s=e.edges.map(u=>({...u,source:i(u.source),target:i(u.target)}));this.edges=[...this.edges,...s];let a=e.firstNode(),c=e.lastNode();return[a?{id:i(a.id),data:a.data}:void 0,c?{id:i(c.id),data:c.data}:void 0]}trimFirstNode(){let e=this.firstNode();e&&P1(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&C1(this,[e.id])&&this.removeNode(e)}reid(){let e=Object.fromEntries(Object.values(this.nodes).map(o=>[o.id,o.name])),r=new Map;Object.values(e).forEach(o=>{r.set(o,(r.get(o)||0)+1)});let n=o=>{let i=e[o];return Ui(o)&&r.get(i)===1?i:o};return new R1({nodes:Object.fromEntries(Object.entries(this.nodes).map(([o,i])=>[n(o),{...i,id:n(o)}])),edges:this.edges.map(o=>({...o,source:n(o.source),target:n(o.target)}))})}drawMermaid(e){let{withStyles:r,curveStyle:n,nodeColors:o={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=e??{},s=this.reid(),a=s.firstNode(),c=s.lastNode();return Nz(s.nodes,s.edges,{firstNode:a?.id,lastNode:c?.id,withStyles:r,curveStyle:n,nodeColors:o,wrapLabelNWords:i})}async drawMermaidPng(e){let r=this.drawMermaid(e);return zz(r,{backgroundColor:e?.backgroundColor})}};function P1(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.source)).map(o=>o.target)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function C1(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.target)).map(o=>o.source)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function N1(t){let e=new TextEncoder,r=new ReadableStream({async start(n){for await(let o of t)n.enqueue(e.encode(`event: data +data: ${JSON.stringify(o)} + +`));n.enqueue(e.encode(`event: end + +`)),n.close()}});return br.fromReadableStream(r)}function F$(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}var z1=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function";function Zy(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*B$(t,e){for(;;){let{value:r,done:n}=Lt.runWithConfig(vr(t),e.next.bind(e),!0);if(n)break;yield r}}async function*qy(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Lt.runWithConfig(vr(t),r.next.bind(e),!0);if(o)break;yield n}}function Ot(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}var Ze=class extends uo{lc_runnable=!0;name;getName(t){let e=this.name??this.constructor.lc_name()??this.constructor.name;return t?`${e}${t}`:e}withRetry(t){return new Gy({bound:this,kwargs:{},config:{},maxAttemptNumber:t?.stopAfterAttempt,...t})}withConfig(t){return new as({bound:this,config:t,kwargs:{}})}withFallbacks(t){let e=Array.isArray(t)?t:t.fallbacks;return new Z$({runnable:this,fallbacks:e})}_getOptionsList(t,e=0){if(Array.isArray(t)&&t.length!==e)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${t.length} options for ${e} inputs`);if(Array.isArray(t))return t.map(Pe);if(e>1&&!Array.isArray(t)&&t.runId){console.warn("Provided runId will be used only for the first element of the batch.");let r=Object.fromEntries(Object.entries(t).filter(([n])=>n!=="runId"));return Array.from({length:e},(n,o)=>Pe(o===0?t:r))}return Array.from({length:e},()=>Pe(t))}async batch(t,e,r){let n=this._getOptionsList(e??{},t.length),o=n[0]?.maxConcurrency??r?.maxConcurrency,i=new Xo({maxConcurrency:o,onFailedAttempt:a=>{throw a}}),s=t.map((a,c)=>i.call(async()=>{try{return await this.invoke(a,n[c])}catch(u){if(r?.returnExceptions)return u;throw u}}));return Promise.all(s)}async*_streamIterator(t,e){yield this.invoke(t,e)}async stream(t,e){let r=Pe(e),n=new Zi({generator:this._streamIterator(t,r),config:r});return await n.setup,br.fromAsyncGenerator(n)}_separateRunnableConfigFromCallOptions(t){let e;t===void 0?e=Pe(t):e=Pe({callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,runName:t.runName,configurable:t.configurable,recursionLimit:t.recursionLimit,maxConcurrency:t.maxConcurrency,runId:t.runId,timeout:t.timeout,signal:t.signal});let r={...t};return delete r.callbacks,delete r.tags,delete r.metadata,delete r.runName,delete r.configurable,delete r.recursionLimit,delete r.maxConcurrency,delete r.runId,delete r.timeout,delete r.signal,[e,r]}async _callWithConfig(t,e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),Ot(e,"input"),n.runId,n?.runType,void 0,void 0,n?.runName??this.getName());delete n.runId;let s;try{let a=t.call(this,e,n,i);s=await vn(a,r?.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(Ot(s,"output")),s}async _batchWithConfig(t,e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(or)),s=await Promise.all(i.map(async(c,u)=>{let l=await c?.handleChainStart(this.toJSON(),Ot(e[u],"input"),o[u].runId,o[u].runType,void 0,void 0,o[u].runName??this.getName());return delete o[u].runId,l})),a;try{let c=t.call(this,e,o,s,n);a=await vn(c,o?.[0]?.signal)}catch(c){throw await Promise.all(s.map(u=>u?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(Ot(a,"output")))),a}_concatOutputChunks(t,e){return en(t,e)}async*_transformStreamWithConfig(t,e,r){let n,o=!0,i,s=!0,a=Pe(r),c=await or(a),u=this;async function*l(){for await(let f of t){if(o)if(n===void 0)n=f;else try{n=u._concatOutputChunks(n,f)}catch{n=void 0,o=!1}yield f}}let d;try{let f=await m0(e.bind(this),l(),async()=>c?.handleChainStart(this.toJSON(),{input:""},a.runId,a.runType,void 0,void 0,a.runName??this.getName()),r?.signal,a);delete a.runId,d=f.setup;let p=d?.handlers.find(ZR),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(_0);h!==void 0&&d!==void 0&&(m=h.tapOutputIterable(d.runId,m));for await(let _ of m)if(yield _,s)if(i===void 0)i=_;else try{i=this._concatOutputChunks(i,_)}catch{i=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:Ot(n,"input")}),f}await d?.handleChainEnd(i??{},void 0,void 0,void 0,{inputs:Ot(n,"input")})}getGraph(t){let e=new By,r=e.addNode({name:`${this.getName()}Input`,schema:$r.any()}),n=e.addNode(this),o=e.addNode({name:`${this.getName()}Output`,schema:$r.any()});return e.addEdge(r,n),e.addEdge(n,o),e}pipe(t){return new cs({first:this,last:cn(t)})}pick(t){return this.pipe(new q$(t))}assign(t){return this.pipe(new Bp(new us({steps:t})))}async*transform(t,e){let r;for await(let n of t)r===void 0?r=n:r=this._concatOutputChunks(r,n);yield*this._streamIterator(r,Pe(e))}async*streamLog(t,e,r){let n=new sg({...r,autoClose:!1,_schemaFormat:"original"}),o=Pe(e);yield*this._streamLog(t,n,o)}async*_streamLog(t,e,r){let{callbacks:n}=r;if(n===void 0)r.callbacks=[e];else if(Array.isArray(n))r.callbacks=n.concat([e]);else{let a=n.copy();a.addHandler(e,!0),r.callbacks=a}let o=this.stream(t,r);async function i(){try{let a=await o;for await(let c of a){let u=new ho({ops:[{op:"add",path:"/streamed_output/-",value:c}]});await e.writer.write(u)}}finally{await e.writer.close()}}let s=i();try{for await(let a of e)yield a}finally{await s}}streamEvents(t,e,r){let n;if(e.version==="v1")n=this._streamEventsV1(t,e,r);else if(e.version==="v2")n=this._streamEventsV2(t,e,r);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return e.encoding==="text/event-stream"?N1(n):br.fromAsyncGenerator(n)}async*_streamEventsV2(t,e,r){let n=new qR({...r,autoClose:!1}),o=Pe(e),i=o.runId??Et();o.runId=i;let s=o.callbacks;if(s===void 0)o.callbacks=[n];else if(Array.isArray(s))o.callbacks=s.concat(n);else{let p=s.copy();p.addHandler(n,!0),o.callbacks=p}let a=new AbortController,c=this;async function u(){let p,m=null;try{e?.signal?"any"in AbortSignal?p=AbortSignal.any([a.signal,e.signal]):(p=e.signal,m=()=>{a.abort()},e.signal.addEventListener("abort",m,{once:!0})):p=a.signal;let h=await c.stream(t,{...o,signal:p}),_=n.tapOutputIterable(i,h);for await(let v of _)if(a.signal.aborted)break}finally{await n.finish(),p&&m&&p.removeEventListener("abort",m)}}let l=u(),d=!1,f;try{for await(let p of n){if(!d){p.data.input=t,d=!0,f=p.run_id,yield p;continue}p.run_id===f&&p.event.endsWith("_end")&&p.data?.input&&delete p.data.input,yield p}}finally{a.abort(),await l}}async*_streamEventsV1(t,e,r){let n,o=!1,i=Pe(e),s=i.tags??[],a=i.metadata??{},c=i.runName??this.getName(),u=new sg({...r,autoClose:!1,_schemaFormat:"streaming_events"}),l=new KR({...r}),d=this._streamLog(t,u,i);for await(let p of d){if(n?n=n.concat(p):n=ig.fromRunLogPatch(p),n.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!o){o=!0;let v={...n.state},b={run_id:v.id,event:`on_${v.type}_start`,name:c,tags:s,metadata:a,data:{input:t}};l.includeEvent(b,v.type)&&(yield b)}let m=p.ops.filter(v=>v.path.startsWith("/logs/")).map(v=>v.path.split("/")[2]),h=[...new Set(m)];for(let v of h){let b,x={},k=n.state.logs[v];if(k.end_time===void 0?k.streamed_output.length>0?b="stream":b="start":b="end",b==="start")k.inputs!==void 0&&(x.input=k.inputs);else if(b==="end")k.inputs!==void 0&&(x.input=k.inputs),x.output=k.final_output;else if(b==="stream"){let T=k.streamed_output.length;if(T!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${T} instead. Encountered in: "${k.name}"`);x={chunk:k.streamed_output[0]},k.streamed_output=[]}yield{event:`on_${k.type}_${b}`,name:k.name,run_id:k.id,tags:k.tags,metadata:k.metadata,data:x}}let{state:_}=n;if(_.streamed_output.length>0){let v=_.streamed_output.length;if(v!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${v} instead. Encountered in: "${_.name}"`);let b={chunk:_.streamed_output[0]};_.streamed_output=[];let x={event:`on_${_.type}_stream`,run_id:_.id,tags:s,metadata:a,name:c,data:b};l.includeEvent(x,_.type)&&(yield x)}}let f=n?.state;if(f!==void 0){let p={event:`on_${f.type}_end`,name:c,run_id:f.id,tags:s,metadata:a,data:{output:f.final_output}};l.includeEvent(p,f.type)&&(yield p)}}static isRunnable(t){return Hd(t)}withListeners({onStart:t,onEnd:e,onError:r}){return new as({bound:this,config:{},configFactories:[n=>({callbacks:[new y0({config:n,onStart:t,onEnd:e,onError:r})]})]})}asTool(t){return VK(this,t)}},as=class M1 extends Ze{static lc_name(){return"RunnableBinding"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;bound;config;kwargs;configFactories;constructor(e){super(e),this.bound=e.bound,this.kwargs=e.kwargs,this.config=e.config,this.configFactories=e.configFactories}getName(e){return this.bound.getName(e)}async _mergeConfig(...e){let r=ga(this.config,...e);return ga(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new Gy({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:e?.stopAfterAttempt,...e})}async invoke(e,r){return this.bound.invoke(e,await this._mergeConfig(r,this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(Pe(i),this.kwargs))):await this._mergeConfig(Pe(r),this.kwargs);return this.bound.batch(e,o,n)}_concatOutputChunks(e,r){return this.bound._concatOutputChunks(e,r)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(Pe(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(Pe(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(Pe(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(Pe(r),o.kwargs),version:r.version},n)};return br.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&Ze.isRunnable(e.bound)}withListeners({onStart:e,onEnd:r,onError:n}){return new M1({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[o=>({callbacks:[new y0({config:o,onStart:e,onEnd:r,onError:n})]})]})}},j1=class D1 extends Ze{static lc_name(){return"RunnableEach"}lc_serializable=!0;lc_namespace=["langchain_core","runnables"];bound;constructor(e){super(e),this.bound=e.bound}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _invoke(e,r,n){return this.bound.batch(e,Ve(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new D1({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},Gy=class extends as{static lc_name(){return"RunnableRetry"}lc_namespace=["langchain_core","runnables"];maxAttemptNumber=3;onFailedAttempt=()=>{};constructor(t){super(t),this.maxAttemptNumber=t.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=t.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(t,e,r){let n=t>1?`retry:attempt:${t}`:void 0;return Ve(e,{callbacks:r?.getChild(n)})}async _invoke(t,e,r){return Kd(n=>super.invoke(t,this._patchConfigForRetry(n,e,r)),{onFailedAttempt:({error:n})=>this.onFailedAttempt(n,t),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(t,e){return this._callWithConfig(this._invoke.bind(this),t,e)}async _batch(t,e,r,n){let o={};try{await Kd(async i=>{let s=t.map((d,f)=>f).filter(d=>o[d.toString()]===void 0||o[d.toString()]instanceof Error),a=s.map(d=>t[d]),c=s.map(d=>this._patchConfigForRetry(i,e?.[d],r?.[d])),u=await super.batch(a,c,{...n,returnExceptions:!0}),l;for(let d=0;dthis.onFailedAttempt(i,i.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(i){if(n?.returnExceptions!==!0)throw i}return Object.keys(o).sort((i,s)=>parseInt(i,10)-parseInt(s,10)).map(i=>o[parseInt(i,10)])}async batch(t,e,r){return this._batchWithConfig(this._batch.bind(this),t,e,r)}},cs=class Fp extends Ze{static lc_name(){return"RunnableSequence"}first;middle=[];last;omitSequenceTags=!1;lc_serializable=!0;lc_namespace=["langchain_core","runnables"];constructor(e){super(e),this.first=e.first,this.middle=e.middle??this.middle,this.last=e.last,this.name=e.name,this.omitSequenceTags=e.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),Ot(e,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let s=e,a;try{let c=[this.first,...this.middle];for(let u=0;u{let l=await c?.handleChainStart(this.toJSON(),Ot(e[u],"input"),o[u].runId,void 0,void 0,void 0,o[u].runName);return delete o[u].runId,l})),a=e;try{for(let c=0;c{let p=d?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`);return Ve(o[f],{callbacks:p})}),n);a=await vn(l,o[0]?.signal)}}catch(c){throw await Promise.all(s.map(u=>u?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(Ot(a,"output")))),a}_concatOutputChunks(e,r){return this.last._concatOutputChunks(e,r)}async*_streamIterator(e,r){let n=await or(r),{runId:o,...i}=r??{},s=await n?.handleChainStart(this.toJSON(),Ot(e,"input"),o,void 0,void 0,void 0,i?.runName),a=[this.first,...this.middle,this.last],c=!0,u;async function*l(){yield e}try{let d=a[0].transform(l(),Ve(i,{callbacks:s?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let f=1;f{let s=o.getGraph(e);i!==0&&s.trimFirstNode(),i!==this.steps.length-1&&s.trimLastNode(),r.extend(s);let a=s.firstNode();if(!a)throw new Error(`Runnable ${o} has no first node`);n&&r.addEdge(n,a),n=s.lastNode()}),r}pipe(e){return Fp.isRunnableSequence(e)?new Fp({first:this.first,middle:this.middle.concat([this.last,e.first,...e.middle]),last:e.last,name:this.name??e.name}):new Fp({first:this.first,middle:[...this.middle,this.last],last:cn(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&Ze.isRunnable(e)}static from([e,...r],n){let o={};return typeof n=="string"?o.name=n:n!==void 0&&(o=n),new Fp({...o,first:cn(e),middle:r.slice(0,-1).map(cn),last:cn(r[r.length-1])})}},us=class L1 extends Ze{static lc_name(){return"RunnableMap"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;steps;getStepsKeys(){return Object.keys(this.steps)}constructor(e){super(e),this.steps={};for(let[r,n]of Object.entries(e.steps))this.steps[r]=cn(n)}static from(e){return new L1({steps:e})}async invoke(e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),{input:e},n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let s={};try{let a=Object.entries(this.steps).map(async([c,u])=>{s[c]=await u.invoke(e,Ve(n,{callbacks:i?.getChild(`map:key:${c}`)}))});await vn(Promise.all(a),r?.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(s),s}async*_transform(e,r,n){let o={...this.steps},i=Jh(e,Object.keys(o).length),s=new Map(Object.entries(o).map(([a,c],u)=>{let l=c.transform(i[u],Ve(n,{callbacks:r?.getChild(`map:key:${a}`)}));return[a,l.next().then(d=>({key:a,gen:l,result:d}))]}));for(;s.size;){let a=Promise.race(s.values()),{key:c,result:u,gen:l}=await vn(a,n?.signal);s.delete(c),u.done||(yield{[c]:u.value},s.set(c,l.next().then(d=>({key:c,gen:l,result:d}))))}}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Pe(r),i=new Zi({generator:this.transform(n(),o),config:o});return await i.setup,br.fromAsyncGenerator(i)}},ZK=class U1 extends Ze{lc_serializable=!1;lc_namespace=["langchain_core","runnables"];func;constructor(e){if(super(e),!Kh(e.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=e.func}async invoke(e,r){let[n]=this._getOptionsList(r??{},1),o=await or(n),i=this.func(Ve(n,{callbacks:o}),e);return vn(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(Zy(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(z1(o)){for(;;){n?.signal?.throwIfAborted();let i=o.next();if(i.done)break;yield i.value}return}yield o}static from(e){return new U1({func:e})}};function qK(t){if(Kh(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}var Dr=class F1 extends Ze{static lc_name(){return"RunnableLambda"}lc_namespace=["langchain_core","runnables"];func;constructor(e){if(Kh(e.func))return ZK.from(e.func);super(e),qK(e.func),this.func=e.func}static from(e){return new F1({func:e})}async _invoke(e,r,n){return new Promise((o,i)=>{let s=Ve(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??Wh)-1});Lt.runWithConfig(vr(s),async()=>{try{let a=await this.func(e,{...s});if(a&&Ze.isRunnable(a)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");a=await a.invoke(e,{...s,recursionLimit:(s.recursionLimit??Wh)-1})}else if(Zy(a)){let c;for await(let u of qy(s,a))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}a=c}else if(F$(a)){let c;for(let u of B$(s,a))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}a=c}o(a)}catch(a){i(a)}})})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async*_transform(e,r,n){let o;for await(let a of e)if(o===void 0)o=a;else try{o=this._concatOutputChunks(o,a)}catch{o=a}let i=Ve(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??Wh)-1}),s=await new Promise((a,c)=>{Lt.runWithConfig(vr(i),async()=>{try{let u=await this.func(o,{...i,config:i});a(u)}catch(u){c(u)}})});if(s&&Ze.isRunnable(s)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");let a=await s.stream(o,i);for await(let c of a)yield c}else if(Zy(s))for await(let a of qy(i,s))n?.signal?.throwIfAborted(),yield a;else if(F$(s))for(let a of B$(i,s))n?.signal?.throwIfAborted(),yield a;else yield s}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Pe(r),i=new Zi({generator:this.transform(n(),o),config:o});return await i.setup,br.fromAsyncGenerator(i)}},B1=class extends us{},Z$=class extends Ze{static lc_name(){return"RunnableWithFallbacks"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnable;fallbacks;constructor(t){super(t),this.runnable=t.runnable,this.fallbacks=t.fallbacks}*runnables(){yield this.runnable;for(let t of this.fallbacks)yield t}async invoke(t,e){let r=Pe(e),n=await or(r),{runId:o,...i}=r,s=await n?.handleChainStart(this.toJSON(),Ot(t,"input"),o,void 0,void 0,void 0,i?.runName),a=Ve(i,{callbacks:s?.getChild()});return await Lt.runWithConfig(a,async()=>{let u;for(let l of this.runnables()){r?.signal?.throwIfAborted();try{let d=await l.invoke(t,a);return await s?.handleChainEnd(Ot(d,"output")),d}catch(d){u===void 0&&(u=d)}}throw u===void 0?new Error("No error stored at end of fallback."):(await s?.handleChainError(u),u)})}async*_streamIterator(t,e){let r=Pe(e),n=await or(r),{runId:o,...i}=r,s=await n?.handleChainStart(this.toJSON(),Ot(t,"input"),o,void 0,void 0,void 0,i?.runName),a,c;for(let l of this.runnables()){r?.signal?.throwIfAborted();let d=Ve(i,{callbacks:s?.getChild()});try{let f=await l.stream(t,d);c=qy(d,f);break}catch(f){a===void 0&&(a=f)}}if(c===void 0){let l=a??new Error("No error stored at end of fallback.");throw await s?.handleChainError(l),l}let u;try{for await(let l of c){yield l;try{u=u===void 0?u:this._concatOutputChunks(u,l)}catch{u=void 0}}}catch(l){throw await s?.handleChainError(l),l}await s?.handleChainEnd(Ot(u,"output"))}async batch(t,e,r){if(r?.returnExceptions)throw new Error("Not implemented.");let n=this._getOptionsList(e??{},t.length),o=await Promise.all(n.map(a=>or(a))),i=await Promise.all(o.map(async(a,c)=>{let u=await a?.handleChainStart(this.toJSON(),Ot(t[c],"input"),n[c].runId,void 0,void 0,void 0,n[c].runName);return delete n[c].runId,u})),s;for(let a of this.runnables()){n[0].signal?.throwIfAborted();try{let c=await a.batch(t,i.map((u,l)=>Ve(n[l],{callbacks:u?.getChild()})),r);return await Promise.all(i.map((u,l)=>u?.handleChainEnd(Ot(c[l],"output")))),c}catch(c){s===void 0&&(s=c)}}throw s?(await Promise.all(i.map(a=>a?.handleChainError(s))),s):new Error("No error stored at end of fallbacks.")}};function cn(t){if(typeof t=="function")return new Dr({func:t});if(Ze.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=cn(n);return new us({steps:e})}else throw new Error(`Expected a Runnable, function or object. +Instead got an unsupported type.`)}var Bp=class extends Ze{static lc_name(){return"RunnableAssign"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;mapper;constructor(t){t instanceof us&&(t={mapper:t}),super(t),this.mapper=t.mapper}async invoke(t,e){let r=await this.mapper.invoke(t,e);return{...t,...r}}async*_transform(t,e,r){let n=this.mapper.getStepsKeys(),[o,i]=Jh(t),s=this.mapper.transform(i,Ve(r,{callbacks:e?.getChild()})),a=s.next();for await(let c of o){if(typeof c!="object"||Array.isArray(c))throw new Error(`RunnableAssign can only be used with objects as input, got ${typeof c}`);let u=Object.fromEntries(Object.entries(c).filter(([l])=>!n.includes(l)));Object.keys(u).length>0&&(yield u)}yield(await a).value;for await(let c of s)yield c}transform(t,e){return this._transformStreamWithConfig(t,this._transform.bind(this),e)}async stream(t,e){async function*r(){yield t}let n=Pe(e),o=new Zi({generator:this.transform(r(),n),config:n});return await o.setup,br.fromAsyncGenerator(o)}},q$=class extends Ze{static lc_name(){return"RunnablePick"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;keys;constructor(t){(typeof t=="string"||Array.isArray(t))&&(t={keys:t}),super(t),this.keys=t.keys}async _pick(t){if(typeof this.keys=="string")return t[this.keys];{let e=this.keys.map(r=>[r,t[r]]).filter(r=>r[1]!==void 0);return e.length===0?void 0:Object.fromEntries(e)}}async invoke(t,e){return this._callWithConfig(this._pick.bind(this),t,e)}async*_transform(t){for await(let e of t){let r=await this._pick(e);r!==void 0&&(yield r)}}transform(t,e){return this._transformStreamWithConfig(t,this._transform.bind(this),e)}async stream(t,e){async function*r(){yield t}let n=Pe(e),o=new Zi({generator:this.transform(r(),n),config:n});return await o.setup,br.fromAsyncGenerator(o)}},Vy=class extends as{name;description;schema;constructor(t){let e=cs.from([Dr.from(async r=>{let n;if(Mi(r))try{n=await ts(this.schema,r.args)}catch{throw new su("Received tool input did not match expected schema",JSON.stringify(r.args))}else n=r;return n}).withConfig({runName:`${t.name}:parse_input`}),t.bound]).withConfig({runName:t.name});super({bound:e,config:t.config??{}}),this.name=t.name,this.description=t.description,this.schema=t.schema}static lc_name(){return"RunnableToolLike"}};function VK(t,e){let r=e.name??t.getName(),n=e.description??rs(e.schema);return Wu(e.schema)?new Vy({name:r,description:n,schema:$r.object({input:$r.string()}).transform(o=>o.input),bound:t}):new Vy({name:r,description:n,schema:e.schema,bound:t})}var Ky=(t,e)=>{let r=[...new Set(e?.map(o=>{if(typeof o=="string")return o;let i=new o({});if(!("getType"in i)||typeof i.getType!="function")throw new Error("Invalid type provided.");return i.getType()}))],n=t.getType();return r.some(o=>o===n)};function K1(t,e){return Array.isArray(t)?Z1(t,e):Dr.from(r=>Z1(r,t))}function Z1(t,e={}){let{includeNames:r,excludeNames:n,includeTypes:o,excludeTypes:i,includeIds:s,excludeIds:a}=e,c=[];for(let u of t)if(!(n&&u.name&&n.includes(u.name))){{if(i&&Ky(u,i))continue;if(a&&u.id&&a.includes(u.id))continue}o||s||r?(r&&u.name&&r.some(l=>l===u.name)||o&&Ky(u,o)||s&&u.id&&s.some(l=>l===u.id))&&c.push(u):c.push(u)}return c}function H1(t){return Array.isArray(t)?q1(t):Dr.from(q1)}function q1(t){if(!t.length)return[];let e=[];for(let r of t){let n=r,o=e.pop();if(!o)e.push(n);else if(n.getType()==="tool"||n.getType()!==o.getType())e.push(o,n);else{let i=ca(o),s=ca(n),a=i.concat(s);typeof i.content=="string"&&typeof s.content=="string"&&(a.content=`${i.content} +${s.content}`),e.push(KK(a))}}return e}function W1(t,e){if(Array.isArray(t)){let r=t;if(!e)throw new Error("Options parameter is required when providing messages.");return V1(r,e)}else{let r=t;return Dr.from(n=>V1(n,r)).withConfig({runName:"trim_messages"})}}async function V1(t,e){let{maxTokens:r,tokenCounter:n,strategy:o="last",allowPartial:i=!1,endOn:s,startOn:a,includeSystem:c=!1,textSplitter:u}=e;if(a&&o==="first")throw new Error("`startOn` should only be specified if `strategy` is 'last'.");if(c&&o==="first")throw new Error("`includeSystem` should only be specified if `strategy` is 'last'.");let l;"getNumTokens"in n?l=async f=>(await Promise.all(f.map(m=>n.getNumTokens(m.content)))).reduce((m,h)=>m+h,0):l=async f=>n(f);let d=G$;if(u&&("splitText"in u?d=u.splitText:d=async f=>u(f)),o==="first")return J1(t,{maxTokens:r,tokenCounter:l,textSplitter:d,partialStrategy:i?"first":void 0,endOn:s});if(o==="last")return GK(t,{maxTokens:r,tokenCounter:l,textSplitter:d,allowPartial:i,includeSystem:c,startOn:a,endOn:s});throw new Error(`Unrecognized strategy: '${o}'. Must be one of 'first' or 'last'.`)}async function J1(t,e){let{maxTokens:r,tokenCounter:n,textSplitter:o,partialStrategy:i,endOn:s}=e,a=[...t],c=0;for(let u=0;u0?a.slice(0,-u):a;if(await n(l)<=r){c=a.length-u;break}}if(cb!=="type"&&!b.startsWith("lc_"))),_=V$(l.getType(),{...h,content:m}),v=[...a.slice(0,c),_];if(await n(v)<=r)a=v,c+=1,u=!0;else break}u&&i==="last"&&(l.content=[...f].reverse())}if(!u){let l=a[c],d;if(Array.isArray(l.content)&&l.content.some(f=>typeof f=="string"||f.type==="text")?d=l.content.find(p=>p.type==="text"&&p.text)?.text:typeof l.content=="string"&&(d=l.content),d){let f=await o(d),p=f.length;i==="last"&&f.reverse();for(let m=0;m0&&!Ky(a[c-1],u);)c-=1}return a.slice(0,c)}async function GK(t,e){let{allowPartial:r=!1,includeSystem:n=!1,endOn:o,startOn:i,...s}=e,a=t.map(l=>{let d=Object.fromEntries(Object.entries(l).filter(([f])=>f!=="type"&&!f.startsWith("lc_")));return V$(l.getType(),d,iu(l))});if(o){let l=Array.isArray(o)?o:[o];for(;a.length>0&&!Ky(a[a.length-1],l);)a=a.slice(0,-1)}let c=n&&a[0]?.getType()==="system",u=c?a.slice(0,1).concat(a.slice(1).reverse()):a.reverse();return u=await J1(u,{...s,partialStrategy:r?"last":void 0,endOn:i}),c?[u[0],...u.slice(1).reverse()]:u.reverse()}var G1={human:{message:mr,messageChunk:zi},ai:{message:jt,messageChunk:Dt},system:{message:hn,messageChunk:lo},developer:{message:hn,messageChunk:lo},tool:{message:Or,messageChunk:na},function:{message:oa,messageChunk:Ni},generic:{message:jn,messageChunk:Ri},remove:{message:ia,messageChunk:ia}};function V$(t,e,r){let n,o;switch(t){case"human":r?n=new zi(e):o=new mr(e);break;case"ai":if(r){let i={...e};"tool_calls"in i&&(i={...i,tool_call_chunks:i.tool_calls?.map(s=>({...s,type:"tool_call_chunk",index:void 0,args:JSON.stringify(s.args)}))}),n=new Dt(i)}else o=new jt(e);break;case"system":r?n=new lo(e):o=new hn(e);break;case"developer":r?n=new lo({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}}):o=new hn({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in e)r?n=new na(e):o=new Or(e);else throw new Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(r)n=new Ni(e);else{if(!e.name)throw new Error("FunctionMessage must have a 'name' field");o=new oa(e)}break;case"generic":if("role"in e)r?n=new Ri(e):o=new jn(e);else throw new Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw new Error(`Unrecognized message type ${t}`)}if(r&&n)return n;if(o)return o;throw new Error(`Unrecognized message type ${t}`)}function KK(t){let e=t.getType(),r,n=Object.fromEntries(Object.entries(t).filter(([o])=>!["type","tool_call_chunks"].includes(o)&&!o.startsWith("lc_")));if(e in G1&&(r=V$(e,n)),!r)throw new Error(`Unrecognized message chunk class ${e}. Supported classes are ${Object.keys(G1)}`);return r}function G$(t){let e=t.split(` +`);return Promise.resolve([...e.slice(0,-1).map(r=>`${r} +`),e[e.length-1]])}var X1=["tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result"];var Y1=["image","video","audio","text-plain","file"];var Q1=["text","reasoning",...X1,...Y1];var HK={};G(HK,{AIMessage:()=>jt,AIMessageChunk:()=>Dt,BaseMessage:()=>qt,BaseMessageChunk:()=>fr,ChatMessage:()=>jn,ChatMessageChunk:()=>Ri,FunctionMessage:()=>oa,FunctionMessageChunk:()=>Ni,HumanMessage:()=>mr,HumanMessageChunk:()=>zi,KNOWN_BLOCK_TYPES:()=>Q1,RemoveMessage:()=>ia,SystemMessage:()=>hn,SystemMessageChunk:()=>lo,ToolMessage:()=>Or,ToolMessageChunk:()=>na,_isMessageFieldWithRole:()=>ih,_mergeDicts:()=>dt,_mergeLists:()=>ra,_mergeObj:()=>oh,_mergeStatus:()=>nh,coerceMessageLikeToMessage:()=>ji,collapseToolCallChunks:()=>lh,convertToChunk:()=>ca,convertToOpenAIImageBlock:()=>Xm,convertToProviderContentBlock:()=>$d,defaultTextSplitter:()=>G$,defaultToolCallParser:()=>Sd,filterMessages:()=>K1,getBufferString:()=>au,iife:()=>Xw,isAIMessage:()=>aa,isAIMessageChunk:()=>Td,isBase64ContentBlock:()=>ou,isBaseMessage:()=>Yr,isBaseMessageChunk:()=>iu,isChatMessage:()=>WA,isChatMessageChunk:()=>JA,isDataContentBlock:()=>Jr,isDirectToolOutput:()=>Id,isFunctionMessage:()=>XA,isFunctionMessageChunk:()=>YA,isHumanMessage:()=>QA,isHumanMessageChunk:()=>eO,isIDContentBlock:()=>Jm,isMessage:()=>Qm,isOpenAIToolCallArray:()=>VA,isPlainTextContentBlock:()=>bA,isSystemMessage:()=>tO,isSystemMessageChunk:()=>rO,isToolMessage:()=>Gw,isToolMessageChunk:()=>Kw,isURLContentBlock:()=>nu,mapChatMessagesToStoredMessages:()=>dO,mapStoredMessageToChatMessage:()=>Ed,mapStoredMessagesToChatMessages:()=>lO,mergeContent:()=>er,mergeMessageRuns:()=>H1,mergeResponseMetadata:()=>sh,mergeUsageMetadata:()=>ah,parseBase64DataUrl:()=>ta,parseMimeType:()=>Ym,trimMessages:()=>W1});function Zp(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function qp(t){return t!==void 0&&Ze.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function Vp(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(on(t.schema)||t.schema!=null&&typeof t.schema=="object"&&"type"in t.schema&&typeof t.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(t.schema.type))}function qa(t){return Vp(t)||qp(t)||Zp(t)}var JK={};G(JK,{convertToOpenAIFunction:()=>eM,convertToOpenAITool:()=>tM,isLangChainTool:()=>qa,isRunnableToolLike:()=>qp,isStructuredTool:()=>Zp,isStructuredToolParams:()=>Vp});function eM(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:an(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function tM(t,e){let r=typeof e=="number"?void 0:e,n;return qa(t)?n={type:"function",function:eM(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var XK={};G(XK,{extendInteropZodObject:()=>Oz,getInteropZodDefaultGetter:()=>Cz,getInteropZodObjectShape:()=>ky,getSchemaDescription:()=>rs,interopParse:()=>Tz,interopParseAsync:()=>ts,interopSafeParse:()=>kz,interopSafeParseAsync:()=>Ey,interopZodObjectMakeFieldsOptional:()=>Rz,interopZodObjectPartial:()=>Pz,interopZodObjectPassthrough:()=>Ty,interopZodObjectStrict:()=>Hu,interopZodTransformInputSchema:()=>Oy,isInteropZodError:()=>Py,isInteropZodLiteral:()=>Sz,isInteropZodObject:()=>Az,isInteropZodSchema:()=>on,isShapelessZodSchema:()=>Ez,isSimpleStringZodSchema:()=>Wu,isZodArrayV4:()=>Mp,isZodLiteralV3:()=>E$,isZodLiteralV4:()=>A$,isZodNullableV4:()=>P$,isZodObjectV3:()=>Ay,isZodObjectV4:()=>wn,isZodOptionalV4:()=>O$,isZodSchema:()=>Iz,isZodSchemaV3:()=>vt,isZodSchemaV4:()=>nt});var av={};gi(av,{$brand:()=>Jd,$input:()=>D_,$output:()=>j_,NEVER:()=>lg,TimePrecision:()=>B_,ZodAny:()=>cM,ZodArray:()=>pM,ZodBase64:()=>$I,ZodBase64URL:()=>II,ZodBigInt:()=>Xp,ZodBigIntFormat:()=>TI,ZodBoolean:()=>Jp,ZodCIDRv4:()=>wI,ZodCIDRv6:()=>xI,ZodCUID:()=>mI,ZodCUID2:()=>hI,ZodCatch:()=>AM,ZodCodec:()=>zI,ZodCustom:()=>iv,ZodCustomStringFormat:()=>Hp,ZodDate:()=>rv,ZodDefault:()=>$M,ZodDiscriminatedUnion:()=>fM,ZodE164:()=>SI,ZodEmail:()=>dI,ZodEmoji:()=>pI,ZodEnum:()=>Gp,ZodError:()=>QK,ZodFile:()=>bM,ZodFirstPartyTypeKind:()=>jI,ZodFunction:()=>DM,ZodGUID:()=>Yy,ZodIPv4:()=>vI,ZodIPv6:()=>bI,ZodISODate:()=>Wy,ZodISODateTime:()=>Hy,ZodISODuration:()=>Xy,ZodISOTime:()=>Jy,ZodIntersection:()=>mM,ZodIssueCode:()=>aW,ZodJWT:()=>kI,ZodKSUID:()=>yI,ZodLazy:()=>zM,ZodLiteral:()=>vM,ZodMAC:()=>oM,ZodMap:()=>_M,ZodNaN:()=>PM,ZodNanoID:()=>fI,ZodNever:()=>lM,ZodNonOptional:()=>RI,ZodNull:()=>aM,ZodNullable:()=>xM,ZodNumber:()=>Wp,ZodNumberFormat:()=>sl,ZodObject:()=>nv,ZodOptional:()=>CI,ZodPipe:()=>NI,ZodPrefault:()=>SM,ZodPromise:()=>jM,ZodReadonly:()=>CM,ZodRealError:()=>Lr,ZodRecord:()=>OI,ZodSet:()=>yM,ZodString:()=>Kp,ZodStringFormat:()=>et,ZodSuccess:()=>EM,ZodSymbol:()=>iM,ZodTemplateLiteral:()=>NM,ZodTransform:()=>wM,ZodTuple:()=>hM,ZodType:()=>Ae,ZodULID:()=>gI,ZodURL:()=>tv,ZodUUID:()=>oi,ZodUndefined:()=>sM,ZodUnion:()=>AI,ZodUnknown:()=>uM,ZodVoid:()=>dM,ZodXID:()=>_I,_ZodString:()=>lI,_default:()=>IM,_function:()=>eW,any:()=>DH,array:()=>Re,base64:()=>wH,base64url:()=>xH,bigint:()=>RH,boolean:()=>Nt,catch:()=>OM,check:()=>tW,cidrv4:()=>vH,cidrv6:()=>bH,clone:()=>Qe,codec:()=>XH,coerce:()=>DI,config:()=>yt,core:()=>nn,cuid:()=>dH,cuid2:()=>pH,custom:()=>MI,date:()=>UH,decode:()=>rI,decodeAsync:()=>oI,describe:()=>rW,discriminatedUnion:()=>ov,e164:()=>$H,email:()=>tH,emoji:()=>uH,encode:()=>tI,encodeAsync:()=>nI,endsWith:()=>Bu,enum:()=>zt,file:()=>KH,flattenError:()=>yu,float32:()=>AH,float64:()=>OH,formatError:()=>vu,function:()=>eW,getErrorMap:()=>uW,globalRegistry:()=>Ge,gt:()=>yo,gte:()=>ir,guid:()=>rH,hash:()=>EH,hex:()=>TH,hostname:()=>kH,httpUrl:()=>cH,includes:()=>Uu,instanceof:()=>oW,int:()=>uI,int32:()=>PH,int64:()=>NH,intersection:()=>Qp,ipv4:()=>gH,ipv6:()=>yH,iso:()=>il,json:()=>sW,jwt:()=>IH,keyof:()=>FH,ksuid:()=>hH,lazy:()=>MM,length:()=>Sa,literal:()=>se,locales:()=>Ou,looseObject:()=>un,lowercase:()=>Du,lt:()=>_o,lte:()=>zr,mac:()=>_H,map:()=>qH,maxLength:()=>Ia,maxSize:()=>$a,meta:()=>nW,mime:()=>Zu,minLength:()=>Qo,minSize:()=>es,multipleOf:()=>Qi,nan:()=>JH,nanoid:()=>lH,nativeEnum:()=>GH,negative:()=>hy,never:()=>EI,nonnegative:()=>_y,nonoptional:()=>TM,nonpositive:()=>gy,normalize:()=>qu,null:()=>Yp,nullable:()=>Qy,nullish:()=>HH,number:()=>We,object:()=>U,optional:()=>ie,overwrite:()=>Zn,parse:()=>X$,parseAsync:()=>Y$,partialRecord:()=>ZH,pipe:()=>ev,positive:()=>my,prefault:()=>kM,preprocess:()=>sv,prettifyError:()=>mg,promise:()=>QH,property:()=>yy,readonly:()=>RM,record:()=>bt,refine:()=>LM,regex:()=>ju,regexes:()=>Nr,registry:()=>fp,safeDecode:()=>sI,safeDecodeAsync:()=>cI,safeEncode:()=>iI,safeEncodeAsync:()=>aI,safeParse:()=>Q$,safeParseAsync:()=>eI,set:()=>VH,setErrorMap:()=>cW,size:()=>Mu,slugify:()=>Np,startsWith:()=>Fu,strictObject:()=>BH,string:()=>A,stringFormat:()=>SH,stringbool:()=>iW,success:()=>WH,superRefine:()=>UM,symbol:()=>MH,templateLiteral:()=>YH,toJSONSchema:()=>vo,toLowerCase:()=>Gu,toUpperCase:()=>Ku,transform:()=>PI,treeifyError:()=>fg,trim:()=>Vu,tuple:()=>gM,uint32:()=>CH,uint64:()=>zH,ulid:()=>fH,undefined:()=>jH,union:()=>tt,unknown:()=>ft,uppercase:()=>Lu,url:()=>aH,util:()=>M,uuid:()=>nH,uuidv4:()=>oH,uuidv6:()=>iH,uuidv7:()=>sH,void:()=>LH,xid:()=>mH});var il={};gi(il,{ZodISODate:()=>Wy,ZodISODateTime:()=>Hy,ZodISODuration:()=>Xy,ZodISOTime:()=>Jy,date:()=>H$,datetime:()=>K$,duration:()=>J$,time:()=>W$});var Hy=$("ZodISODateTime",(t,e)=>{Bg.init(t,e),et.init(t,e)});function K$(t){return Z_(Hy,t)}var Wy=$("ZodISODate",(t,e)=>{Zg.init(t,e),et.init(t,e)});function H$(t){return q_(Wy,t)}var Jy=$("ZodISOTime",(t,e)=>{qg.init(t,e),et.init(t,e)});function W$(t){return V_(Jy,t)}var Xy=$("ZodISODuration",(t,e)=>{Vg.init(t,e),et.init(t,e)});function J$(t){return G_(Xy,t)}var nM=(t,e)=>{np.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>vu(t,r)},flatten:{value:r=>yu(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,hu,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,hu,2)}},isEmpty:{get(){return t.issues.length===0}}})},QK=$("ZodError",nM),Lr=$("ZodError",nM,{Parent:Error});var X$=bu(Lr),Y$=wu(Lr),Q$=xu(Lr),eI=$u(Lr),tI=hg(Lr),rI=gg(Lr),nI=_g(Lr),oI=yg(Lr),iI=vg(Lr),sI=bg(Lr),aI=wg(Lr),cI=xg(Lr);var Ae=$("ZodType",(t,e)=>(ye.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(M.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>Qe(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>X$(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Q$(t,r,n),t.parseAsync=async(r,n)=>Y$(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>eI(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>tI(t,r,n),t.decode=(r,n)=>rI(t,r,n),t.encodeAsync=async(r,n)=>nI(t,r,n),t.decodeAsync=async(r,n)=>oI(t,r,n),t.safeEncode=(r,n)=>iI(t,r,n),t.safeDecode=(r,n)=>sI(t,r,n),t.safeEncodeAsync=async(r,n)=>aI(t,r,n),t.safeDecodeAsync=async(r,n)=>cI(t,r,n),t.refine=(r,n)=>t.check(LM(r,n)),t.superRefine=r=>t.check(UM(r)),t.overwrite=r=>t.check(Zn(r)),t.optional=()=>ie(t),t.nullable=()=>Qy(t),t.nullish=()=>ie(Qy(t)),t.nonoptional=r=>TM(t,r),t.array=()=>Re(t),t.or=r=>tt([t,r]),t.and=r=>Qp(t,r),t.transform=r=>ev(t,PI(r)),t.default=r=>IM(t,r),t.prefault=r=>kM(t,r),t.catch=r=>OM(t,r),t.pipe=r=>ev(t,r),t.readonly=()=>RM(t),t.describe=r=>{let n=t.clone();return Ge.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ge.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ge.get(t);let n=t.clone();return Ge.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),lI=$("_ZodString",(t,e)=>{Yi.init(t,e),Ae.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(ju(...n)),t.includes=(...n)=>t.check(Uu(...n)),t.startsWith=(...n)=>t.check(Fu(...n)),t.endsWith=(...n)=>t.check(Bu(...n)),t.min=(...n)=>t.check(Qo(...n)),t.max=(...n)=>t.check(Ia(...n)),t.length=(...n)=>t.check(Sa(...n)),t.nonempty=(...n)=>t.check(Qo(1,...n)),t.lowercase=n=>t.check(Du(n)),t.uppercase=n=>t.check(Lu(n)),t.trim=()=>t.check(Vu()),t.normalize=(...n)=>t.check(qu(...n)),t.toLowerCase=()=>t.check(Gu()),t.toUpperCase=()=>t.check(Ku()),t.slugify=()=>t.check(Np())}),Kp=$("ZodString",(t,e)=>{Yi.init(t,e),lI.init(t,e),t.email=r=>t.check(mp(dI,r)),t.url=r=>t.check(Ru(tv,r)),t.jwt=r=>t.check(Rp(kI,r)),t.emoji=r=>t.check(vp(pI,r)),t.guid=r=>t.check(Cu(Yy,r)),t.uuid=r=>t.check(hp(oi,r)),t.uuidv4=r=>t.check(gp(oi,r)),t.uuidv6=r=>t.check(_p(oi,r)),t.uuidv7=r=>t.check(yp(oi,r)),t.nanoid=r=>t.check(bp(fI,r)),t.guid=r=>t.check(Cu(Yy,r)),t.cuid=r=>t.check(wp(mI,r)),t.cuid2=r=>t.check(xp(hI,r)),t.ulid=r=>t.check($p(gI,r)),t.base64=r=>t.check(Op($I,r)),t.base64url=r=>t.check(Pp(II,r)),t.xid=r=>t.check(Ip(_I,r)),t.ksuid=r=>t.check(Sp(yI,r)),t.ipv4=r=>t.check(kp(vI,r)),t.ipv6=r=>t.check(Tp(bI,r)),t.cidrv4=r=>t.check(Ep(wI,r)),t.cidrv6=r=>t.check(Ap(xI,r)),t.e164=r=>t.check(Cp(SI,r)),t.datetime=r=>t.check(K$(r)),t.date=r=>t.check(H$(r)),t.time=r=>t.check(W$(r)),t.duration=r=>t.check(J$(r))});function A(t){return L_(Kp,t)}var et=$("ZodStringFormat",(t,e)=>{He.init(t,e),lI.init(t,e)}),dI=$("ZodEmail",(t,e)=>{Rg.init(t,e),et.init(t,e)});function tH(t){return mp(dI,t)}var Yy=$("ZodGUID",(t,e)=>{Pg.init(t,e),et.init(t,e)});function rH(t){return Cu(Yy,t)}var oi=$("ZodUUID",(t,e)=>{Cg.init(t,e),et.init(t,e)});function nH(t){return hp(oi,t)}function oH(t){return gp(oi,t)}function iH(t){return _p(oi,t)}function sH(t){return yp(oi,t)}var tv=$("ZodURL",(t,e)=>{Ng.init(t,e),et.init(t,e)});function aH(t){return Ru(tv,t)}function cH(t){return Ru(tv,{protocol:/^https?$/,hostname:Nr.domain,...M.normalizeParams(t)})}var pI=$("ZodEmoji",(t,e)=>{zg.init(t,e),et.init(t,e)});function uH(t){return vp(pI,t)}var fI=$("ZodNanoID",(t,e)=>{Mg.init(t,e),et.init(t,e)});function lH(t){return bp(fI,t)}var mI=$("ZodCUID",(t,e)=>{jg.init(t,e),et.init(t,e)});function dH(t){return wp(mI,t)}var hI=$("ZodCUID2",(t,e)=>{Dg.init(t,e),et.init(t,e)});function pH(t){return xp(hI,t)}var gI=$("ZodULID",(t,e)=>{Lg.init(t,e),et.init(t,e)});function fH(t){return $p(gI,t)}var _I=$("ZodXID",(t,e)=>{Ug.init(t,e),et.init(t,e)});function mH(t){return Ip(_I,t)}var yI=$("ZodKSUID",(t,e)=>{Fg.init(t,e),et.init(t,e)});function hH(t){return Sp(yI,t)}var vI=$("ZodIPv4",(t,e)=>{Gg.init(t,e),et.init(t,e)});function gH(t){return kp(vI,t)}var oM=$("ZodMAC",(t,e)=>{Hg.init(t,e),et.init(t,e)});function _H(t){return F_(oM,t)}var bI=$("ZodIPv6",(t,e)=>{Kg.init(t,e),et.init(t,e)});function yH(t){return Tp(bI,t)}var wI=$("ZodCIDRv4",(t,e)=>{Wg.init(t,e),et.init(t,e)});function vH(t){return Ep(wI,t)}var xI=$("ZodCIDRv6",(t,e)=>{Jg.init(t,e),et.init(t,e)});function bH(t){return Ap(xI,t)}var $I=$("ZodBase64",(t,e)=>{Xg.init(t,e),et.init(t,e)});function wH(t){return Op($I,t)}var II=$("ZodBase64URL",(t,e)=>{Yg.init(t,e),et.init(t,e)});function xH(t){return Pp(II,t)}var SI=$("ZodE164",(t,e)=>{Qg.init(t,e),et.init(t,e)});function $H(t){return Cp(SI,t)}var kI=$("ZodJWT",(t,e)=>{e_.init(t,e),et.init(t,e)});function IH(t){return Rp(kI,t)}var Hp=$("ZodCustomStringFormat",(t,e)=>{t_.init(t,e),et.init(t,e)});function SH(t,e,r={}){return ka(Hp,t,e,r)}function kH(t){return ka(Hp,"hostname",Nr.hostname,t)}function TH(t){return ka(Hp,"hex",Nr.hex,t)}function EH(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=Nr[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return ka(Hp,n,o,e)}var Wp=$("ZodNumber",(t,e)=>{ap.init(t,e),Ae.init(t,e),t.gt=(n,o)=>t.check(yo(n,o)),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.lt=(n,o)=>t.check(_o(n,o)),t.lte=(n,o)=>t.check(zr(n,o)),t.max=(n,o)=>t.check(zr(n,o)),t.int=n=>t.check(uI(n)),t.safe=n=>t.check(uI(n)),t.positive=n=>t.check(yo(0,n)),t.nonnegative=n=>t.check(ir(0,n)),t.negative=n=>t.check(_o(0,n)),t.nonpositive=n=>t.check(zr(0,n)),t.multipleOf=(n,o)=>t.check(Qi(n,o)),t.step=(n,o)=>t.check(Qi(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function We(t){return K_(Wp,t)}var sl=$("ZodNumberFormat",(t,e)=>{r_.init(t,e),Wp.init(t,e)});function uI(t){return W_(sl,t)}function AH(t){return J_(sl,t)}function OH(t){return X_(sl,t)}function PH(t){return Y_(sl,t)}function CH(t){return Q_(sl,t)}var Jp=$("ZodBoolean",(t,e)=>{ku.init(t,e),Ae.init(t,e)});function Nt(t){return ey(Jp,t)}var Xp=$("ZodBigInt",(t,e)=>{cp.init(t,e),Ae.init(t,e),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.gt=(n,o)=>t.check(yo(n,o)),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.lt=(n,o)=>t.check(_o(n,o)),t.lte=(n,o)=>t.check(zr(n,o)),t.max=(n,o)=>t.check(zr(n,o)),t.positive=n=>t.check(yo(BigInt(0),n)),t.negative=n=>t.check(_o(BigInt(0),n)),t.nonpositive=n=>t.check(zr(BigInt(0),n)),t.nonnegative=n=>t.check(ir(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(Qi(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function RH(t){return ry(Xp,t)}var TI=$("ZodBigIntFormat",(t,e)=>{n_.init(t,e),Xp.init(t,e)});function NH(t){return oy(TI,t)}function zH(t){return iy(TI,t)}var iM=$("ZodSymbol",(t,e)=>{o_.init(t,e),Ae.init(t,e)});function MH(t){return sy(iM,t)}var sM=$("ZodUndefined",(t,e)=>{i_.init(t,e),Ae.init(t,e)});function jH(t){return ay(sM,t)}var aM=$("ZodNull",(t,e)=>{s_.init(t,e),Ae.init(t,e)});function Yp(t){return cy(aM,t)}var cM=$("ZodAny",(t,e)=>{a_.init(t,e),Ae.init(t,e)});function DH(){return uy(cM)}var uM=$("ZodUnknown",(t,e)=>{Tu.init(t,e),Ae.init(t,e)});function ft(){return Nu(uM)}var lM=$("ZodNever",(t,e)=>{Eu.init(t,e),Ae.init(t,e)});function EI(t){return zu(lM,t)}var dM=$("ZodVoid",(t,e)=>{c_.init(t,e),Ae.init(t,e)});function LH(t){return ly(dM,t)}var rv=$("ZodDate",(t,e)=>{u_.init(t,e),Ae.init(t,e),t.min=(n,o)=>t.check(ir(n,o)),t.max=(n,o)=>t.check(zr(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function UH(t){return dy(rv,t)}var pM=$("ZodArray",(t,e)=>{l_.init(t,e),Ae.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Qo(r,n)),t.nonempty=r=>t.check(Qo(1,r)),t.max=(r,n)=>t.check(Ia(r,n)),t.length=(r,n)=>t.check(Sa(r,n)),t.unwrap=()=>t.element});function Re(t,e){return T$(pM,t,e)}function FH(t){let e=t._zod.def.shape;return zt(Object.keys(e))}var nv=$("ZodObject",(t,e)=>{k$.init(t,e),Ae.init(t,e),M.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>zt(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ft()}),t.loose=()=>t.clone({...t._zod.def,catchall:ft()}),t.strict=()=>t.clone({...t._zod.def,catchall:EI()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>M.extend(t,r),t.safeExtend=r=>M.safeExtend(t,r),t.merge=r=>M.merge(t,r),t.pick=r=>M.pick(t,r),t.omit=r=>M.omit(t,r),t.partial=(...r)=>M.partial(CI,t,r[0]),t.required=(...r)=>M.required(RI,t,r[0])});function U(t,e){let r={type:"object",shape:t??{},...M.normalizeParams(e)};return new nv(r)}function BH(t,e){return new nv({type:"object",shape:t,catchall:EI(),...M.normalizeParams(e)})}function un(t,e){return new nv({type:"object",shape:t,catchall:ft(),...M.normalizeParams(e)})}var AI=$("ZodUnion",(t,e)=>{up.init(t,e),Ae.init(t,e),t.options=e.options});function tt(t,e){return new AI({type:"union",options:t,...M.normalizeParams(e)})}var fM=$("ZodDiscriminatedUnion",(t,e)=>{AI.init(t,e),d_.init(t,e)});function ov(t,e,r){return new fM({type:"union",options:e,discriminator:t,...M.normalizeParams(r)})}var mM=$("ZodIntersection",(t,e)=>{p_.init(t,e),Ae.init(t,e)});function Qp(t,e){return new mM({type:"intersection",left:t,right:e})}var hM=$("ZodTuple",(t,e)=>{lp.init(t,e),Ae.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});function gM(t,e,r){let n=e instanceof ye,o=n?r:e,i=n?e:null;return new hM({type:"tuple",items:t,rest:i,...M.normalizeParams(o)})}var OI=$("ZodRecord",(t,e)=>{f_.init(t,e),Ae.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function bt(t,e,r){return new OI({type:"record",keyType:t,valueType:e,...M.normalizeParams(r)})}function ZH(t,e,r){let n=Qe(t);return n._zod.values=void 0,new OI({type:"record",keyType:n,valueType:e,...M.normalizeParams(r)})}var _M=$("ZodMap",(t,e)=>{m_.init(t,e),Ae.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function qH(t,e,r){return new _M({type:"map",keyType:t,valueType:e,...M.normalizeParams(r)})}var yM=$("ZodSet",(t,e)=>{h_.init(t,e),Ae.init(t,e),t.min=(...r)=>t.check(es(...r)),t.nonempty=r=>t.check(es(1,r)),t.max=(...r)=>t.check($a(...r)),t.size=(...r)=>t.check(Mu(...r))});function VH(t,e){return new yM({type:"set",valueType:t,...M.normalizeParams(e)})}var Gp=$("ZodEnum",(t,e)=>{g_.init(t,e),Ae.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Gp({...e,checks:[],...M.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Gp({...e,checks:[],...M.normalizeParams(o),entries:i})}});function zt(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Gp({type:"enum",entries:r,...M.normalizeParams(e)})}function GH(t,e){return new Gp({type:"enum",entries:t,...M.normalizeParams(e)})}var vM=$("ZodLiteral",(t,e)=>{__.init(t,e),Ae.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function se(t,e){return new vM({type:"literal",values:Array.isArray(t)?t:[t],...M.normalizeParams(e)})}var bM=$("ZodFile",(t,e)=>{y_.init(t,e),Ae.init(t,e),t.min=(r,n)=>t.check(es(r,n)),t.max=(r,n)=>t.check($a(r,n)),t.mime=(r,n)=>t.check(Zu(Array.isArray(r)?r:[r],n))});function KH(t){return vy(bM,t)}var wM=$("ZodTransform",(t,e)=>{v_.init(t,e),Ae.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(M.issue(i,r.value,e));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(M.issue(s))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function PI(t){return new wM({type:"transform",transform:t})}var CI=$("ZodOptional",(t,e)=>{xa.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function ie(t){return new CI({type:"optional",innerType:t})}var xM=$("ZodNullable",(t,e)=>{b_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Qy(t){return new xM({type:"nullable",innerType:t})}function HH(t){return ie(Qy(t))}var $M=$("ZodDefault",(t,e)=>{w_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function IM(t,e){return new $M({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var SM=$("ZodPrefault",(t,e)=>{x_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function kM(t,e){return new SM({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var RI=$("ZodNonOptional",(t,e)=>{$_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function TM(t,e){return new RI({type:"nonoptional",innerType:t,...M.normalizeParams(e)})}var EM=$("ZodSuccess",(t,e)=>{I_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function WH(t){return new EM({type:"success",innerType:t})}var AM=$("ZodCatch",(t,e)=>{S_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function OM(t,e){return new AM({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var PM=$("ZodNaN",(t,e)=>{k_.init(t,e),Ae.init(t,e)});function JH(t){return fy(PM,t)}var NI=$("ZodPipe",(t,e)=>{T_.init(t,e),Ae.init(t,e),t.in=e.in,t.out=e.out});function ev(t,e){return new NI({type:"pipe",in:t,out:e})}var zI=$("ZodCodec",(t,e)=>{NI.init(t,e),Au.init(t,e)});function XH(t,e,r){return new zI({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var CM=$("ZodReadonly",(t,e)=>{E_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function RM(t){return new CM({type:"readonly",innerType:t})}var NM=$("ZodTemplateLiteral",(t,e)=>{A_.init(t,e),Ae.init(t,e)});function YH(t,e){return new NM({type:"template_literal",parts:t,...M.normalizeParams(e)})}var zM=$("ZodLazy",(t,e)=>{C_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.getter()});function MM(t){return new zM({type:"lazy",getter:t})}var jM=$("ZodPromise",(t,e)=>{P_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function QH(t){return new jM({type:"promise",innerType:t})}var DM=$("ZodFunction",(t,e)=>{O_.init(t,e),Ae.init(t,e)});function eW(t){return new DM({type:"function",input:Array.isArray(t?.input)?gM(t?.input):t?.input??Re(ft()),output:t?.output??ft()})}var iv=$("ZodCustom",(t,e)=>{R_.init(t,e),Ae.init(t,e)});function tW(t){let e=new Je({check:"custom"});return e._zod.check=t,e}function MI(t,e){return by(iv,t??(()=>!0),e)}function LM(t,e={}){return wy(iv,t,e)}function UM(t){return xy(t)}var rW=$y,nW=Iy;function oW(t,e={error:`Input not instance of ${t.name}`}){let r=new iv({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...M.normalizeParams(e)});return r._zod.bag.Class=t,r}var iW=(...t)=>Sy({Codec:zI,Boolean:Jp,String:Kp},...t);function sW(t){let e=MM(()=>tt([A(t),We(),Nt(),Yp(),Re(e),bt(A(),e)]));return e}function sv(t,e){return ev(PI(t),e)}var aW={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function cW(t){yt({customError:t})}function uW(){return yt().customError}var jI;jI||(jI={});var DI={};gi(DI,{bigint:()=>fW,boolean:()=>pW,date:()=>mW,number:()=>dW,string:()=>lW});function lW(t){return U_(Kp,t)}function dW(t){return H_(Wp,t)}function pW(t){return ty(Jp,t)}function fW(t){return ny(Xp,t)}function mW(t){return py(rv,t)}yt(N_());var hW=Symbol("Let zodToJsonSchema decide on which parser to use");var bW={};G(bW,{BasePromptValue:()=>cv,ChatPromptValue:()=>UI,ImagePromptValue:()=>wW,StringPromptValue:()=>LI});var cv=class extends uo{},LI=class extends cv{static lc_name(){return"StringPromptValue"}lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;value;constructor(t){super({value:t}),this.value=t}toString(){return this.value}toChatMessages(){return[new mr(this.value)]}},UI=class extends cv{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ChatPromptValue"}messages;constructor(t){Array.isArray(t)&&(t={messages:t}),super(t),this.messages=t.messages}toString(){return au(this.messages)}toChatMessages(){return this.messages}},wW=class extends cv{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ImagePromptValue"}imageUrl;value;constructor(t){"imageUrl"in t||(t={imageUrl:t}),super(t),this.imageUrl=t.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new mr({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}};var te="0123456789abcdef".split(""),xW=[-2147483648,8388608,32768,128],Hn=[24,16,8,0],uv=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Ut=[];function Wn(t,e){e?(Ut[0]=Ut[16]=Ut[1]=Ut[2]=Ut[3]=Ut[4]=Ut[5]=Ut[6]=Ut[7]=Ut[8]=Ut[9]=Ut[10]=Ut[11]=Ut[12]=Ut[13]=Ut[14]=Ut[15]=0,this.blocks=Ut):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}Wn.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if(r!=="string"){if(r==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);e=!0}for(var n,o=0,i,s=t.length,a=this.blocks;o>>2]|=t[o]<>>2]|=n<>>2]|=(192|n>>>6)<>>2]|=(128|n&63)<=57344?(a[i>>>2]|=(224|n>>>12)<>>2]|=(128|n>>>6&63)<>>2]|=(128|n&63)<>>2]|=(240|n>>>18)<>>2]|=(128|n>>>12&63)<>>2]|=(128|n>>>6&63)<>>2]|=(128|n&63)<=64?(this.block=a[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};Wn.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=xW[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}};Wn.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=this.blocks,u,l,d,f,p,m,h,_,v,b,x;for(u=16;u<64;++u)p=c[u-15],l=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=c[u-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,c[u]=c[u-16]+l+c[u-7]+d<<0;for(x=e&r,u=0;u<64;u+=4)this.first?(this.is224?(_=300032,p=c[0]-1413257819,a=p-150054599<<0,n=p+24177077<<0):(_=704751109,p=c[0]-210244248,a=p-1521486534<<0,n=p+143694565<<0),this.first=!1):(l=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),_=t&e,f=_^t&r^x,h=o&i^~o&s,p=a+d+h+uv[u]+c[u],m=l+f,a=n+p<<0,n=p+m<<0),l=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),v=n&t,f=v^n&e^_,h=s&a^~s&o,p=i+d+h+uv[u+1]+c[u+1],m=l+f,s=r+p<<0,r=p+m<<0,l=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=r&n,f=b^r&t^v,h=i&s^~i&a,p=o+d+h+uv[u+2]+c[u+2],m=l+f,i=e+p<<0,e=p+m<<0,l=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),x=e&r,f=x^e&n^b,h=i&s^~i&a,p=o+d+h+uv[u+3]+c[u+3],m=l+f,o=t+p<<0,t=p+m<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0,this.h5=this.h5+i<<0,this.h6=this.h6+s<<0,this.h7=this.h7+a<<0};Wn.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=te[t>>>28&15]+te[t>>>24&15]+te[t>>>20&15]+te[t>>>16&15]+te[t>>>12&15]+te[t>>>8&15]+te[t>>>4&15]+te[t&15]+te[e>>>28&15]+te[e>>>24&15]+te[e>>>20&15]+te[e>>>16&15]+te[e>>>12&15]+te[e>>>8&15]+te[e>>>4&15]+te[e&15]+te[r>>>28&15]+te[r>>>24&15]+te[r>>>20&15]+te[r>>>16&15]+te[r>>>12&15]+te[r>>>8&15]+te[r>>>4&15]+te[r&15]+te[n>>>28&15]+te[n>>>24&15]+te[n>>>20&15]+te[n>>>16&15]+te[n>>>12&15]+te[n>>>8&15]+te[n>>>4&15]+te[n&15]+te[o>>>28&15]+te[o>>>24&15]+te[o>>>20&15]+te[o>>>16&15]+te[o>>>12&15]+te[o>>>8&15]+te[o>>>4&15]+te[o&15]+te[i>>>28&15]+te[i>>>24&15]+te[i>>>20&15]+te[i>>>16&15]+te[i>>>12&15]+te[i>>>8&15]+te[i>>>4&15]+te[i&15]+te[s>>>28&15]+te[s>>>24&15]+te[s>>>20&15]+te[s>>>16&15]+te[s>>>12&15]+te[s>>>8&15]+te[s>>>4&15]+te[s&15];return this.is224||(c+=te[a>>>28&15]+te[a>>>24&15]+te[a>>>20&15]+te[a>>>16&15]+te[a>>>12&15]+te[a>>>8&15]+te[a>>>4&15]+te[a&15]),c};Wn.prototype.toString=Wn.prototype.hex;Wn.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=[t>>>24&255,t>>>16&255,t>>>8&255,t&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255];return this.is224||c.push(a>>>24&255,a>>>16&255,a>>>8&255,a&255),c};Wn.prototype.array=Wn.prototype.digest;Wn.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};var lv=(...t)=>new Wn(!1,!0).update(t.join("")).hex();var $W={};G($W,{sha256:()=>lv});var IW={};G(IW,{BaseCache:()=>ZM,InMemoryCache:()=>FI,defaultHashKeyEncoder:()=>BM,deserializeStoredGeneration:()=>SW,serializeGeneration:()=>kW});var BM=(...t)=>lv(t.join("_"));function SW(t){return t.message!==void 0?{text:t.text,message:Ed(t.message)}:{text:t.text}}function kW(t){let e={text:t.text};return t.message!==void 0&&(e.message=t.message.toDict()),e}var ZM=class{keyEncoder=BM;makeDefaultKeyEncoder(t){this.keyEncoder=t}},TW=new Map,FI=class qM extends ZM{cache;constructor(e){super(),this.cache=e??new Map}lookup(e,r){return Promise.resolve(this.cache.get(this.keyEncoder(e,r))??null)}async update(e,r,n){this.cache.set(this.keyEncoder(e,r),n)}static global(){return new qM(TW)}};var HM=mn(KM(),1),zW=Object.defineProperty,MW=(t,e,r)=>e in t?zW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jW=(t,e,r)=>(MW(t,typeof e!="symbol"?e+"":e,r),r);function DW(t,e){let r=Array.from({length:t.length},(n,o)=>({start:o,end:o+1}));for(;r.length>1;){let n=null;for(let o=0;oe.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function UW(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}var ZI=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(t,e){this.patStr=t.pat_str;let r=t.bpe_ranks.split(` +`).filter(Boolean).reduce((n,o)=>{let[i,s,...a]=o.split(" "),c=Number.parseInt(s,10);return a.forEach((u,l)=>n[u]=c+l),n},{});for(let[n,o]of Object.entries(r)){let i=HM.default.toByteArray(n);this.rankMap.set(i.join(","),o),this.textMap.set(o,i)}this.specialTokens={...t.special_tokens,...e},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((n,[o,i])=>(n[i]=this.textEncoder.encode(o),n),{})}encode(t,e=[],r="all"){let n=new RegExp(this.patStr,"ug"),o=ZI.specialTokenRegex(Object.keys(this.specialTokens)),i=[],s=new Set(e==="all"?Object.keys(this.specialTokens):e),a=new Set(r==="all"?Object.keys(this.specialTokens).filter(u=>!s.has(u)):r);if(a.size>0){let u=ZI.specialTokenRegex([...a]),l=t.match(u);if(l!=null)throw new Error(`The text contains a special token that is not allowed: ${l[0]}`)}let c=0;for(;;){let u=null,l=c;for(;o.lastIndex=l,u=o.exec(t),!(u==null||s.has(u[0]));)l=u.index+1;let d=u?.index??t.length;for(let p of t.substring(c,d).matchAll(n)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){i.push(h);continue}i.push(...LW(m,this.rankMap))}if(u==null)break;let f=this.specialTokens[u[0]];i.push(f),c=u.index+u[0].length}return i}decode(t){let e=[],r=0;for(let i=0;inew RegExp(t.map(e=>UW(e)).join("|"),"g"));function qI(t){switch(t){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw new Error("Unknown model")}}var FW={};G(FW,{encodingForModel:()=>mv,getEncoding:()=>WM});var fv={},BW=new Xo({});async function WM(t){return t in fv||(fv[t]=BW.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new pv(e)).catch(e=>{throw delete fv[t],e})),await fv[t]}async function mv(t){return WM(qI(t))}var ZW={};G(ZW,{BaseLangChain:()=>_v,BaseLanguageModel:()=>tf,calculateMaxTokens:()=>XM,getEmbeddingContextSize:()=>qW,getModelContextSize:()=>JM,getModelNameForTiktoken:()=>hv,isOpenAITool:()=>gv});var hv=t=>t.startsWith("gpt-5")?"gpt-5":t.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":t.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":t.startsWith("gpt-4-32k")?"gpt-4-32k":t.startsWith("gpt-4-")?"gpt-4":t.startsWith("gpt-4o")?"gpt-4o":t,qW=t=>{switch(t){case"text-embedding-ada-002":return 8191;default:return 2046}},JM=t=>{switch(hv(t)){case"gpt-5":case"gpt-5-turbo":case"gpt-5-turbo-preview":return 4e5;case"gpt-4o":case"gpt-4o-mini":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":return 128e3;case"gpt-4-turbo":case"gpt-4-turbo-preview":case"gpt-4-turbo-2024-04-09":case"gpt-4-0125-preview":case"gpt-4-1106-preview":return 128e3;case"gpt-4-32k":case"gpt-4-32k-0314":case"gpt-4-32k-0613":return 32768;case"gpt-4":case"gpt-4-0314":case"gpt-4-0613":return 8192;case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-16k-0613":return 16384;case"gpt-3.5-turbo":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-1106":case"gpt-3.5-turbo-0125":return 4096;case"text-davinci-003":case"text-davinci-002":return 4097;case"text-davinci-001":return 2049;case"text-curie-001":case"text-babbage-001":case"text-ada-001":return 2048;case"code-davinci-002":case"code-davinci-001":return 8e3;case"code-cushman-001":return 2048;case"claude-3-5-sonnet-20241022":case"claude-3-5-sonnet-20240620":case"claude-3-opus-20240229":case"claude-3-sonnet-20240229":case"claude-3-haiku-20240307":case"claude-2.1":return 2e5;case"claude-2.0":case"claude-instant-1.2":return 1e5;case"gemini-1.5-pro":case"gemini-1.5-pro-latest":case"gemini-1.5-flash":case"gemini-1.5-flash-latest":return 1e6;case"gemini-pro":case"gemini-pro-vision":return 32768;default:return 4097}};function gv(t){return typeof t!="object"||!t?!1:!!("type"in t&&t.type==="function"&&"function"in t&&typeof t.function=="object"&&t.function&&"name"in t.function&&"parameters"in t.function)}var XM=async({prompt:t,modelName:e})=>{let r;try{r=(await mv(hv(e))).encode(t).length}catch{console.warn("Failed to calculate number of tokens, falling back to approximate count"),r=Math.ceil(t.length/4)}return JM(e)-r},VW=()=>!1,_v=class extends Ze{verbose;callbacks;tags;metadata;get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(t){super(t),this.verbose=t.verbose??VW(),this.callbacks=t.callbacks,this.tags=t.tags??[],this.metadata=t.metadata??{}}},tf=class extends _v{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}caller;cache;constructor({callbacks:t,callbackManager:e,...r}){let{cache:n,...o}=r;super({callbacks:t??e,...o}),typeof n=="object"?this.cache=n:n?this.cache=FI.global():this.cache=void 0,this.caller=new Xo(r??{})}_encoding;async getNumTokens(t){let e;typeof t=="string"?e=t:e=t.map(n=>typeof n=="string"?n:n.type==="text"&&"text"in n?n.text:"").join("");let r=Math.ceil(e.length/4);if(!this._encoding)try{this._encoding=await mv("modelName"in this?hv(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(e).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(t){return typeof t=="string"?new LI(t):Array.isArray(t)?new UI(t.map(ji)):t}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:t,...e}){let r={...this._identifyingParams(),...e,_type:this._llmType(),_model:this._modelType()};return Object.entries(r).filter(([i,s])=>s!==void 0).map(([i,s])=>`${i}:${JSON.stringify(s)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(t){throw new Error("Use .toJSON() instead")}get profile(){return{}}};var ii=class extends Ze{static lc_name(){return"RunnablePassthrough"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;func;constructor(t){super(t),t&&(this.func=t.func)}async invoke(t,e){let r=Pe(e);return this.func&&await this.func(t,r),this._callWithConfig(n=>Promise.resolve(n),t,r)}async*transform(t,e){let r=Pe(e),n,o=!0;for await(let i of this._transformStreamWithConfig(t,s=>s,r))if(yield i,o)if(n===void 0)n=i;else try{n=en(n,i)}catch{n=void 0,o=!1}this.func&&n!==void 0&&await this.func(n,r)}static assign(t){return new Bp(new us({steps:t}))}};var YM=t=>t();function yv(t){let e=t.constructor;return new e({...t,content:t.contentBlocks,response_metadata:{...t.response_metadata,output_version:"v1"}})}var GW={};G(GW,{BaseChatModel:()=>vv,SimpleChatModel:()=>KW});function VI(t){let e=[];for(let r of t){let n=r;if(Array.isArray(r.content))for(let o=0;o{let r=e.outputVersion??It("LC_OUTPUT_VERSION");return r&&["v0","v1"].includes(r)?r:"v0"})}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async invoke(e,r){let n=Ga._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].message}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}async*_streamIterator(e,r){if(this._streamResponseChunks===Ga.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(e,r);else{let o=Ga._convertInputToPromptValue(e).toChatMessages(),[i,s]=this._separateRunnableConfigFromCallOptionsCompat(r),a={...i.metadata,...this.getLsParams(s)},c=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,a,this.metadata,{verbose:this.verbose}),u={options:s,invocation_params:this?.invocationParams(s),batch_size:1},l=s.outputVersion??this.outputVersion,d=await c?.handleChatModelStart(this.toJSON(),[VI(o)],i.runId,void 0,u,void 0,void 0,i.runName),f,p;try{for await(let m of this._streamResponseChunks(o,s,d?.[0])){if(m.message.id==null){let h=d?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}m.message.response_metadata={...m.generationInfo,...m.message.response_metadata},l==="v1"?yield yv(m.message):yield m.message,f?f=f.concat(m):f=m,Td(m.message)&&m.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:m.message.usage_metadata.input_tokens,completionTokens:m.message.usage_metadata.output_tokens,totalTokens:m.message.usage_metadata.total_tokens}})}}catch(m){throw await Promise.all((d??[]).map(h=>h?.handleLLMError(m))),m}await Promise.all((d??[]).map(m=>m?.handleLLMEnd({generations:[[f]],llmOutput:p})))}}getLsParams(e){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:r}}async _generateUncached(e,r,n,o){let i=e.map(f=>f.map(ji)),s;if(o!==void 0&&o.length===i.length)s=o;else{let f={...n.metadata,...this.getLsParams(r)},p=await St.configure(n.callbacks,this.callbacks,n.tags,this.tags,f,this.metadata,{verbose:this.verbose}),m={options:r,invocation_params:this?.invocationParams(r),batch_size:1};s=await p?.handleChatModelStart(this.toJSON(),i.map(VI),n.runId,void 0,m,void 0,void 0,n.runName)}let a=r.outputVersion??this.outputVersion,c=[],u=[];if(!!s?.[0].handlers.find(Od)&&!this.disableStreaming&&i.length===1&&this._streamResponseChunks!==Ga.prototype._streamResponseChunks)try{let f=await this._streamResponseChunks(i[0],r,s?.[0]),p,m;for await(let h of f){if(h.message.id==null){let _=s?.at(0)?.runId;_!=null&&h.message._updateId(`run-${_}`)}p===void 0?p=h:p=en(p,h),Td(h.message)&&h.message.usage_metadata!==void 0&&(m={tokenUsage:{promptTokens:h.message.usage_metadata.input_tokens,completionTokens:h.message.usage_metadata.output_tokens,totalTokens:h.message.usage_metadata.total_tokens}})}if(p===void 0)throw new Error("Received empty response from chat model call.");c.push([p]),await s?.[0].handleLLMEnd({generations:c,llmOutput:m})}catch(f){throw await s?.[0].handleLLMError(f),f}else{let f=await Promise.allSettled(i.map(async(p,m)=>{let h=await this._generate(p,{...r,promptIndex:m},s?.[m]);if(a==="v1")for(let _ of h.generations)_.message=yv(_.message);return h}));await Promise.all(f.map(async(p,m)=>{if(p.status==="fulfilled"){let h=p.value;for(let _ of h.generations){if(_.message.id==null){let v=s?.at(0)?.runId;v!=null&&_.message._updateId(`run-${v}`)}_.message.response_metadata={..._.generationInfo,..._.message.response_metadata}}return h.generations.length===1&&(h.generations[0].message.response_metadata={...h.llmOutput,...h.generations[0].message.response_metadata}),c[m]=h.generations,u[m]=h.llmOutput,s?.[m]?.handleLLMEnd({generations:[h.generations],llmOutput:h.llmOutput})}else return await s?.[m]?.handleLLMError(p.reason),Promise.reject(p.reason)}))}let d={generations:c,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(d,ya,{value:s?{runIds:s?.map(f=>f.runId)}:void 0,configurable:!0}),d}async _generateCached({messages:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i}){let s=e.map(v=>v.map(ji)),a={...i.metadata,...this.getLsParams(o)},c=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,a,this.metadata,{verbose:this.verbose}),u={options:o,invocation_params:this?.invocationParams(o),batch_size:1},l=await c?.handleChatModelStart(this.toJSON(),s.map(VI),i.runId,void 0,u,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(s.map(async(v,b)=>{let x=Ga._convertInputToPromptValue(v).toString(),k=await r.lookup(x,n);return k==null&&d.push(b),k}))).map((v,b)=>({result:v,runManager:l?.[b]})).filter(({result:v})=>v.status==="fulfilled"&&v.value!=null||v.status==="rejected"),m=o.outputVersion??this.outputVersion,h=[];await Promise.all(p.map(async({result:v,runManager:b},x)=>{if(v.status==="fulfilled"){let k=v.value;return h[x]=k.map(T=>("message"in T&&Yr(T.message)&&aa(T.message)&&(T.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},m==="v1"&&(T.message=yv(T.message))),T.generationInfo={...T.generationInfo,tokenUsage:{}},T)),k.length&&await b?.handleLLMNewToken(k[0].text),b?.handleLLMEnd({generations:[k]},void 0,void 0,void 0,{cached:!0})}else return await b?.handleLLMError(v.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(v.reason)}));let _={generations:h,missingPromptIndices:d,startedRunManagers:l};return Object.defineProperty(_,ya,{value:l?{runIds:l?.map(v=>v.runId)}:void 0,configurable:!0}),_}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(m=>m.map(ji)),[s,a]=this._separateRunnableConfigFromCallOptionsCompat(o);if(s.callbacks=s.callbacks??n,!this.cache)return this._generateUncached(i,a,s);let{cache:c}=this,u=this._getSerializedCacheKeyParametersForCall(a),{generations:l,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:i,cache:c,llmStringKey:u,parsedOptions:a,handledOptions:s}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>i[h]),a,s,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,_)=>{let v=d[_];l[v]=h;let b=Ga._convertInputToPromptValue(i[v]).toString();return c.update(b,u,h)})),p=m.llmOutput??{}}return{generations:l,llmOutput:p}}invocationParams(e){return{}}_modelType(){return"base_chat_model"}async generatePrompt(e,r,n){let o=e.map(i=>i.toChatMessages());return this.generate(o,r,n)}withStructuredOutput(e,r){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(r?.strict)throw new Error('"strict" mode is not supported for this model by default.');let n=e,o=r?.name,i=rs(n)??"A function available to call.",s=r?.method,a=r?.includeRaw;if(s==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let c=o??"extract",u;on(n)?u=[{type:"function",function:{name:c,description:i,parameters:an(n)}}]:("name"in n&&(c=n.name),u=[{type:"function",function:{name:c,description:i,parameters:n}}]);let l=this.bindTools(u),d=Dr.from(h=>{if(!Dt.isInstance(h))throw new Error("Input is not an AIMessageChunk.");if(!h.tool_calls||h.tool_calls.length===0)throw new Error("No tool calls found in the response.");let _=h.tool_calls.find(v=>v.name===c);if(!_)throw new Error(`No tool call found with name ${c}.`);return _.args});if(!a)return l.pipe(d).withConfig({runName:"StructuredOutput"});let f=ii.assign({parsed:(h,_)=>d.invoke(h.raw,_)}),p=ii.assign({parsed:()=>null}),m=f.withFallbacks({fallbacks:[p]});return cs.from([{raw:l},m]).withConfig({runName:"StructuredOutputRunnable"})}},KW=class extends vv{async _generate(t,e,r){let n=await this._call(t,e,r),o=new jt(n);if(typeof o.content!="string")throw new Error("Cannot generate with a simple chat model when output is not a string.");return{generations:[{text:o.content,message:o}]}}};var QM=class extends Ze{static lc_name(){return"RouterRunnable"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnables;constructor(t){super(t),this.runnables=t.runnables}async invoke(t,e){let{key:r,input:n}=t,o=this.runnables[r];if(o===void 0)throw new Error(`No runnable associated with key "${r}".`);return o.invoke(n,Pe(e))}async batch(t,e,r){let n=t.map(d=>d.key),o=t.map(d=>d.input);if(n.find(d=>this.runnables[d]===void 0)!==void 0)throw new Error("One or more keys do not have a corresponding runnable.");let s=n.map(d=>this.runnables[d]),a=this._getOptionsList(e??{},t.length),c=a[0]?.maxConcurrency??r?.maxConcurrency,u=c&&c>0?c:t.length,l=[];for(let d=0;ds[h].invoke(m,a[h])),p=await Promise.all(f);l.push(p)}return l.flat()}async stream(t,e){let{key:r,input:n}=t,o=this.runnables[r];if(o===void 0)throw new Error(`No runnable associated with key "${r}".`);return o.stream(n,e)}};var ej=class extends Ze{static lc_name(){return"RunnableBranch"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;default;branches;constructor(t){super(t),this.branches=t.branches,this.default=t.default}static from(t){if(t.length<1)throw new Error("RunnableBranch requires at least one branch");let r=t.slice(0,-1).map(([o,i])=>[cn(o),cn(i)]),n=cn(t[t.length-1]);return new this({branches:r,default:n})}async _invoke(t,e,r){let n;for(let o=0;othis._enterHistory(i,s??{})).withConfig({runName:"loadHistory"}),r=t.historyMessagesKey??t.inputMessagesKey;r&&(e=ii.assign({[r]:e}).withConfig({runName:"insertHistory"}));let n=e.pipe(t.runnable.withListeners({onEnd:(i,s)=>this._exitHistory(i,s??{})})).withConfig({runName:"RunnableWithMessageHistory"}),o=t.config??{};super({...t,config:o,bound:n}),this.runnable=t.runnable,this.getMessageHistory=t.getMessageHistory,this.inputMessagesKey=t.inputMessagesKey,this.outputMessagesKey=t.outputMessagesKey,this.historyMessagesKey=t.historyMessagesKey}_getInputMessages(t){let e;if(typeof t=="object"&&!Array.isArray(t)&&!Yr(t)){let r;this.inputMessagesKey?r=this.inputMessagesKey:Object.keys(t).length===1?r=Object.keys(t)[0]:r="input",Array.isArray(t[r])&&Array.isArray(t[r][0])?e=t[r][0]:e=t[r]}else e=t;if(typeof e=="string")return[new mr(e)];if(Array.isArray(e))return e;if(Yr(e))return[e];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. +Got ${JSON.stringify(e,null,2)}`)}_getOutputMessages(t){let e;if(!Array.isArray(t)&&!Yr(t)&&typeof t!="string"){let r;this.outputMessagesKey!==void 0?r=this.outputMessagesKey:Object.keys(t).length===1?r=Object.keys(t)[0]:r="output",t.generations!==void 0?e=t.generations[0][0].message:e=t[r]}else e=t;if(typeof e=="string")return[new jt(e)];if(Array.isArray(e))return e;if(Yr(e))return[e];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. Received: ${JSON.stringify(e,null,2)}`)}async _enterHistory(t,e){let n=await(e?.configurable?.messageHistory).getMessages();return this.historyMessagesKey===void 0?n.concat(this._getInputMessages(t)):n}async _exitHistory(t,e){let r=e.configurable?.messageHistory,n;Array.isArray(t.inputs)&&Array.isArray(t.inputs[0])?n=t.inputs[0]:n=t.inputs;let o=this._getInputMessages(n);if(this.historyMessagesKey===void 0){let a=await r.getMessages();o=o.slice(a.length)}let i=t.outputs;if(!i)throw new Error(`Output values from 'Run' undefined. Run: ${JSON.stringify(t,null,2)}`);let s=this._getOutputMessages(i);await r.addMessages([...o,...s])}async _mergeConfig(...t){let e=await super._mergeConfig(...t);if(!e.configurable||!e.configurable.sessionId){let n={[this.inputMessagesKey??"input"]:"foo"},o={configurable:{sessionId:"123"}};throw new Error(`sessionId is required. Pass it in as part of the config argument to .invoke() or .stream() +eg. chain.invoke(${JSON.stringify(n)}, ${JSON.stringify(o)})`)}let{sessionId:r}=e.configurable;return e.configurable.messageHistory=await this.getMessageHistory(r),e}};var HW={};G(HW,{RouterRunnable:()=>QM,Runnable:()=>Ze,RunnableAssign:()=>Bp,RunnableBinding:()=>as,RunnableBranch:()=>ej,RunnableEach:()=>j1,RunnableLambda:()=>Dr,RunnableMap:()=>us,RunnableParallel:()=>B1,RunnablePassthrough:()=>ii,RunnablePick:()=>q$,RunnableRetry:()=>Gy,RunnableSequence:()=>cs,RunnableToolLike:()=>Vy,RunnableWithFallbacks:()=>Z$,RunnableWithMessageHistory:()=>tj,_coerceToRunnable:()=>cn,ensureConfig:()=>Pe,getCallbackManagerForConfig:()=>or,mergeConfigs:()=>ga,patchConfig:()=>Ve,pickRunnableConfigKeys:()=>vr,raceWithSignal:()=>vn});var GI=class extends Ze{parseResultWithPrompt(t,e,r){return this.parseResult(t,r)}_baseMessageToString(t){return typeof t.content=="string"?t.content:this._baseMessageContentToString(t.content)}_baseMessageContentToString(t){return JSON.stringify(t)}async invoke(t,e){return typeof t=="string"?this._callWithConfig(async(r,n)=>this.parseResult([{text:r}],n?.callbacks),t,{...e,runType:"parser"}):this._callWithConfig(async(r,n)=>this.parseResult([{message:r,text:this._baseMessageToString(r)}],n?.callbacks),t,{...e,runType:"parser"})}},Ka=class extends GI{parseResult(t,e){return this.parse(t[0].text,e)}async parseWithPrompt(t,e,r){return this.parse(t,r)}_type(){throw new Error("_type not implemented")}},ln=class extends Error{llmOutput;observation;sendToLLM;constructor(t,e,r,n=!1){if(super(t),this.llmOutput=e,this.observation=r,this.sendToLLM=n,n&&(r===void 0||e===void 0))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");uh(this,"OUTPUT_PARSING_FAILURE")}};var si=class extends Ka{async*_transform(t){for await(let e of t)typeof e=="string"?yield this.parseResult([{text:e}]):yield this.parseResult([{message:e,text:this._baseMessageToString(e)}])}async*transform(t,e){yield*this._transformStreamWithConfig(t,this._transform.bind(this),{...e,runType:"parser"})}},ls=class extends si{diff=!1;constructor(t){super(t),this.diff=t?.diff??this.diff}async*_transform(t){let e,r;for await(let n of t){if(typeof n!="string"&&typeof n.content!="string")throw new Error("Cannot handle non-string output.");let o;if(iu(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");o=new Vi({message:n,text:n.content})}else if(Yr(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");o=new Vi({message:ca(n),text:n.content})}else o=new go({text:n});r===void 0?r=o:r=r.concat(o);let i=await this.parsePartialResult([r]);i!=null&&!$o(i,e)&&(this.diff?yield this._diff(e,i):yield i,e=i)}}getFormatInstructions(){return""}};var WW={};G(WW,{applyPatch:()=>qi,compare:()=>mu});var KI=class extends ls{static lc_name(){return"JsonOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_concatOutputChunks(t,e){return this.diff?super._concatOutputChunks(t,e):e}_diff(t,e){if(e)return t?mu(t,e):[{op:"replace",path:"",value:e}]}async parsePartialResult(t){return kd(t[0].text)}async parse(t){return kd(t,JSON.parse)}getFormatInstructions(){return""}};var rj=class extends si{static lc_name(){return"BytesOutputParser"}lc_namespace=["langchain_core","output_parsers","bytes"];lc_serializable=!0;textEncoder=new TextEncoder;parse(t){return Promise.resolve(this.textEncoder.encode(t))}getFormatInstructions(){return""}};var al=class extends si{re;async*_transform(t){let e="";for await(let r of t)if(typeof r=="string"?e+=r:e+=r.content,this.re){let n=[...e.matchAll(this.re)];if(n.length>1){let o=0;for(let i of n.slice(0,-1))yield[i[1]],o+=(i.index??0)+i[0].length;e=e.slice(o)}}else{let n=await this.parse(e);if(n.length>1){for(let o of n.slice(0,-1))yield[o];e=n[n.length-1]}}for(let r of await this.parse(e))yield[r]}},nj=class extends al{static lc_name(){return"CommaSeparatedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;async parse(t){try{return t.trim().split(",").map(e=>e.trim())}catch{throw new ln(`Could not parse output: ${t}`,t)}}getFormatInstructions(){return"Your response should be a list of comma separated values, eg: `foo, bar, baz`"}},oj=class extends al{lc_namespace=["langchain_core","output_parsers","list"];length;separator;constructor({length:t,separator:e}){super(...arguments),this.length=t,this.separator=e||","}async parse(t){try{let e=t.trim().split(this.separator).map(r=>r.trim());if(this.length!==void 0&&e.length!==this.length)throw new ln(`Incorrect number of items. Expected ${this.length}, got ${e.length}.`);return e}catch(e){throw Object.getPrototypeOf(e)===ln.prototype?e:new ln(`Could not parse output: ${t}`)}}getFormatInstructions(){return`Your response should be a list of ${this.length===void 0?"":`${this.length} `}items separated by "${this.separator}" (eg: \`foo${this.separator} bar${this.separator} baz\`)`}},ij=class extends al{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example: + +1. foo + +2. bar + +3. baz`}re=/\d+\.\s([^\n]+)/g;async parse(t){return[...t.matchAll(this.re)??[]].map(e=>e[1])}},sj=class extends al{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example: + +1. foo + +2. bar + +3. baz`}re=/^\s*[-*]\s([^\n]+)$/gm;async parse(t){return[...t.matchAll(this.re)??[]].map(e=>e[1])}};var aj=class extends si{static lc_name(){return"StrOutputParser"}lc_namespace=["langchain_core","output_parsers","string"];lc_serializable=!0;parse(t){return Promise.resolve(t)}getFormatInstructions(){return""}_textContentToString(t){return t.text}_imageUrlContentToString(t){throw new Error('Cannot coerce a multimodal "image_url" message part into a string.')}_messageContentToString(t){switch(t.type){case"text":case"text_delta":if("text"in t)return this._textContentToString(t);break;case"image_url":if("image_url"in t)return this._imageUrlContentToString(t);break;default:throw new Error(`Cannot coerce "${t.type}" message part into a string.`)}throw new Error(`Invalid content type: ${t.type}`)}_baseMessageContentToString(t){return t.reduce((e,r)=>e+this._messageContentToString(r),"")}};var bv=class extends Ka{static lc_name(){return"StructuredOutputParser"}lc_namespace=["langchain","output_parsers","structured"];toJSON(){return this.toJSONNotImplemented()}constructor(t){super(t),this.schema=t}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=$r.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,$r.string().describe(n)])));return new this(e)}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance. + +"JSON Schema" is a declarative language that allows you to annotate and validate JSON documents. + +For example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}} +would match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings. +Thus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted. + +Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas! + +Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock: +\`\`\`json +${JSON.stringify(an(this.schema))} +\`\`\` +`}async parse(t){try{let e=t.trim(),n=(e.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||e.match(/```json\s*([\s\S]*?)```/)?.[1]||e).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(o,i)=>`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await ts(this.schema,JSON.parse(n))}catch(e){throw new ln(`Failed to parse. Text: "${t}". Error: ${e}`,t)}}},HI=class extends bv{static lc_name(){return"JsonMarkdownStructuredOutputParser"}getFormatInstructions(t){let e=t?.interpolationDepth??1;if(e<1)throw new Error("f string interpolation depth must be at least 1");return`Return a markdown code snippet with a JSON object formatted to look like: +\`\`\`json +${this._schemaToInstruction(an(this.schema)).replaceAll("{","{".repeat(e)).replaceAll("}","}".repeat(e))} +\`\`\``}_schemaToInstruction(t,e=2){let r=t;if("type"in r){let n=!1,o;if(Array.isArray(r.type)){let a=r.type.findIndex(c=>c==="null");a!==-1&&(n=!0,r.type.splice(a,1)),o=r.type.join(" | ")}else o=r.type;if(r.type==="object"&&r.properties){let a=r.description?` // ${r.description}`:"";return`{ +${Object.entries(r.properties).map(([u,l])=>{let d=r.required?.includes(u)?"":" (optional)";return`${" ".repeat(e)}"${u}": ${this._schemaToInstruction(l,e+2)}${d}`}).join(` +`)} +${" ".repeat(e-2)}}${a}`}if(r.type==="array"&&r.items){let a=r.description?` // ${r.description}`:"";return`array[ +${" ".repeat(e)}${this._schemaToInstruction(r.items,e+2)} +${" ".repeat(e-2)}] ${a}`}let i=n?" (nullable)":"",s=r.description?` // ${r.description}`:"";return`${o}${s}${i}`}if("anyOf"in r)return r.anyOf.map(n=>this._schemaToInstruction(n,e)).join(` +${" ".repeat(e-2)}`);throw new Error("unsupported schema type")}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=$r.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,$r.string().describe(n)])));return new this(e)}},cj=class extends Ka{structuredInputParser;constructor({inputSchema:t}){super(...arguments),this.structuredInputParser=new HI(t)}async parse(t){let e;try{e=await this.structuredInputParser.parse(t)}catch(r){throw new ln(`Failed to parse. Text: "${t}". Error: ${r}`,t)}return this.outputProcessor(e)}getFormatInstructions(){return this.structuredInputParser.getFormatInstructions()}};var JW=function(){let t={};t.parser=function(y,g){return new r(y,g)},t.SAXParser=r,t.SAXStream=u,t.createStream=c,t.MAX_BUFFER_LENGTH=65536;let e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(y,g){if(!(this instanceof r))return new r(y,g);var R=this;o(R),R.q=R.c="",R.bufferCheckPosition=t.MAX_BUFFER_LENGTH,R.opt=g||{},R.opt.lowercase=R.opt.lowercase||R.opt.lowercasetags,R.looseCase=R.opt.lowercase?"toLowerCase":"toUpperCase",R.tags=[],R.closed=R.closedRoot=R.sawRoot=!1,R.tag=R.error=null,R.strict=!!y,R.noscript=!!(y||R.opt.noscript),R.state=w.BEGIN,R.strictEntities=R.opt.strictEntities,R.ENTITIES=R.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),R.attribList=[],R.opt.xmlns&&(R.ns=Object.create(m)),R.trackPosition=R.opt.position!==!1,R.trackPosition&&(R.position=R.line=R.column=0),oe(R,"onready")}Object.create||(Object.create=function(y){function g(){}g.prototype=y;var R=new g;return R}),Object.keys||(Object.keys=function(y){var g=[];for(var R in y)y.hasOwnProperty(R)&&g.push(R);return g});function n(y){for(var g=Math.max(t.MAX_BUFFER_LENGTH,10),R=0,I=0,ze=e.length;Ig)switch(e[I]){case"textNode":wt(y);break;case"cdata":Q(y,"oncdata",y.cdata),y.cdata="";break;case"script":Q(y,"onscript",y.script),y.script="";break;default:pn(y,"Max buffer length exceeded: "+e[I])}R=Math.max(R,Ye)}var it=t.MAX_BUFFER_LENGTH-R;y.bufferCheckPosition=it+y.position}function o(y){for(var g=0,R=e.length;g"||x(y)}function F(y,g){return y.test(g)}function J(y,g){return!F(y,g)}var w=0;t.STATE={BEGIN:w++,BEGIN_WHITESPACE:w++,TEXT:w++,TEXT_ENTITY:w++,OPEN_WAKA:w++,SGML_DECL:w++,SGML_DECL_QUOTED:w++,DOCTYPE:w++,DOCTYPE_QUOTED:w++,DOCTYPE_DTD:w++,DOCTYPE_DTD_QUOTED:w++,COMMENT_STARTING:w++,COMMENT:w++,COMMENT_ENDING:w++,COMMENT_ENDED:w++,CDATA:w++,CDATA_ENDING:w++,CDATA_ENDING_2:w++,PROC_INST:w++,PROC_INST_BODY:w++,PROC_INST_ENDING:w++,OPEN_TAG:w++,OPEN_TAG_SLASH:w++,ATTRIB:w++,ATTRIB_NAME:w++,ATTRIB_NAME_SAW_WHITE:w++,ATTRIB_VALUE:w++,ATTRIB_VALUE_QUOTED:w++,ATTRIB_VALUE_CLOSED:w++,ATTRIB_VALUE_UNQUOTED:w++,ATTRIB_VALUE_ENTITY_Q:w++,ATTRIB_VALUE_ENTITY_U:w++,CLOSE_TAG:w++,CLOSE_TAG_SAW_WHITE:w++,SCRIPT:w++,SCRIPT_ENDING:w++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(y){var g=t.ENTITIES[y],R=typeof g=="number"?String.fromCharCode(g):g;t.ENTITIES[y]=R});for(var Z in t.STATE)t.STATE[t.STATE[Z]]=Z;w=t.STATE;function oe(y,g,R){y[g]&&y[g](R)}function Q(y,g,R){y.textNode&&wt(y),oe(y,g,R)}function wt(y){y.textNode=dn(y.opt,y.textNode),y.textNode&&oe(y,"ontext",y.textNode),y.textNode=""}function dn(y,g){return y.trim&&(g=g.trim()),y.normalize&&(g=g.replace(/\s+/g," ")),g}function pn(y,g){return wt(y),y.trackPosition&&(g+=` +Line: `+y.line+` +Column: `+y.column+` +Char: `+y.c),g=new Error(g),y.error=g,oe(y,"onerror",g),y}function No(y){return y.sawRoot&&!y.closedRoot&&qe(y,"Unclosed root tag"),y.state!==w.BEGIN&&y.state!==w.BEGIN_WHITESPACE&&y.state!==w.TEXT&&pn(y,"Unexpected end"),wt(y),y.c="",y.closed=!0,oe(y,"onend"),r.call(y,y.strict,y.opt),y}function qe(y,g){if(typeof y!="object"||!(y instanceof r))throw new Error("bad call to strictFail");y.strict&&pn(y,g)}function Ul(y){y.strict||(y.tagName=y.tagName[y.looseCase]());var g=y.tags[y.tags.length-1]||y,R=y.tag={name:y.tagName,attributes:{}};y.opt.xmlns&&(R.ns=g.ns),y.attribList.length=0,Q(y,"onopentagstart",R)}function Ss(y,g){var R=y.indexOf(":"),I=R<0?["",y]:y.split(":"),ze=I[0],Ye=I[1];return g&&y==="xmlns"&&(ze="xmlns",Ye=""),{prefix:ze,local:Ye}}function ks(y){if(y.strict||(y.attribName=y.attribName[y.looseCase]()),y.attribList.indexOf(y.attribName)!==-1||y.tag.attributes.hasOwnProperty(y.attribName)){y.attribName=y.attribValue="";return}if(y.opt.xmlns){var g=Ss(y.attribName,!0),R=g.prefix,I=g.local;if(R==="xmlns")if(I==="xml"&&y.attribValue!==f)qe(y,"xml: prefix must be bound to "+f+` +Actual: `+y.attribValue);else if(I==="xmlns"&&y.attribValue!==p)qe(y,"xmlns: prefix must be bound to "+p+` +Actual: `+y.attribValue);else{var ze=y.tag,Ye=y.tags[y.tags.length-1]||y;ze.ns===Ye.ns&&(ze.ns=Object.create(Ye.ns)),ze.ns[I]=y.attribValue}y.attribList.push([y.attribName,y.attribValue])}else y.tag.attributes[y.attribName]=y.attribValue,Q(y,"onattribute",{name:y.attribName,value:y.attribValue});y.attribName=y.attribValue=""}function Pn(y,g){if(y.opt.xmlns){var R=y.tag,I=Ss(y.tagName);R.prefix=I.prefix,R.local=I.local,R.uri=R.ns[I.prefix]||"",R.prefix&&!R.uri&&(qe(y,"Unbound namespace prefix: "+JSON.stringify(y.tagName)),R.uri=I.prefix);var ze=y.tags[y.tags.length-1]||y;R.ns&&ze.ns!==R.ns&&Object.keys(R.ns).forEach(function(Ts){Q(y,"onopennamespace",{prefix:Ts,uri:R.ns[Ts]})});for(var Ye=0,it=y.attribList.length;Ye",y.tagName="",y.state=w.SCRIPT;return}Q(y,"onscript",y.script),y.script=""}var g=y.tags.length,R=y.tagName;y.strict||(R=R[y.looseCase]());for(var I=R;g--;){var ze=y.tags[g];if(ze.name!==I)qe(y,"Unexpected close tag");else break}if(g<0){qe(y,"Unmatched closing tag: "+y.tagName),y.textNode+="",y.state=w.TEXT;return}y.tagName=R;for(var Ye=y.tags.length;Ye-- >g;){var it=y.tag=y.tags.pop();y.tagName=y.tag.name,Q(y,"onclosetag",y.tagName);var Tt={};for(var Bt in it.ns)Tt[Bt]=it.ns[Bt];var Rn=y.tags[y.tags.length-1]||y;y.opt.xmlns&&it.ns!==Rn.ns&&Object.keys(it.ns).forEach(function(ht){var fn=it.ns[ht];Q(y,"onclosenamespace",{prefix:ht,uri:fn})})}g===0&&(y.closedRoot=!0),y.tagName=y.attribValue=y.attribName="",y.attribList.length=0,y.state=w.TEXT}function Fl(y){var g=y.entity,R=g.toLowerCase(),I,ze="";return y.ENTITIES[g]?y.ENTITIES[g]:y.ENTITIES[R]?y.ENTITIES[R]:(g=R,g.charAt(0)==="#"&&(g.charAt(1)==="x"?(g=g.slice(2),I=parseInt(g,16),ze=I.toString(16)):(g=g.slice(1),I=parseInt(g,10),ze=I.toString(10))),g=g.replace(/^0+/,""),isNaN(I)||ze.toLowerCase()!==g?(qe(y,"Invalid character entity"),"&"+y.entity+";"):String.fromCodePoint(I))}function Bl(y,g){g==="<"?(y.state=w.OPEN_WAKA,y.startTagPosition=y.position):x(g)||(qe(y,"Non-whitespace before first tag."),y.textNode=g,y.state=w.TEXT)}function Zl(y,g){var R="";return g"?(Q(g,"onsgmldeclaration",g.sgmlDecl),g.sgmlDecl="",g.state=w.TEXT):(k(I)&&(g.state=w.SGML_DECL_QUOTED),g.sgmlDecl+=I);continue;case w.SGML_DECL_QUOTED:I===g.q&&(g.state=w.SGML_DECL,g.q=""),g.sgmlDecl+=I;continue;case w.DOCTYPE:I===">"?(g.state=w.TEXT,Q(g,"ondoctype",g.doctype),g.doctype=!0):(g.doctype+=I,I==="["?g.state=w.DOCTYPE_DTD:k(I)&&(g.state=w.DOCTYPE_QUOTED,g.q=I));continue;case w.DOCTYPE_QUOTED:g.doctype+=I,I===g.q&&(g.q="",g.state=w.DOCTYPE);continue;case w.DOCTYPE_DTD:g.doctype+=I,I==="]"?g.state=w.DOCTYPE:k(I)&&(g.state=w.DOCTYPE_DTD_QUOTED,g.q=I);continue;case w.DOCTYPE_DTD_QUOTED:g.doctype+=I,I===g.q&&(g.state=w.DOCTYPE_DTD,g.q="");continue;case w.COMMENT:I==="-"?g.state=w.COMMENT_ENDING:g.comment+=I;continue;case w.COMMENT_ENDING:I==="-"?(g.state=w.COMMENT_ENDED,g.comment=dn(g.opt,g.comment),g.comment&&Q(g,"oncomment",g.comment),g.comment=""):(g.comment+="-"+I,g.state=w.COMMENT);continue;case w.COMMENT_ENDED:I!==">"?(qe(g,"Malformed comment"),g.comment+="--"+I,g.state=w.COMMENT):g.state=w.TEXT;continue;case w.CDATA:I==="]"?g.state=w.CDATA_ENDING:g.cdata+=I;continue;case w.CDATA_ENDING:I==="]"?g.state=w.CDATA_ENDING_2:(g.cdata+="]"+I,g.state=w.CDATA);continue;case w.CDATA_ENDING_2:I===">"?(g.cdata&&Q(g,"oncdata",g.cdata),Q(g,"onclosecdata"),g.cdata="",g.state=w.TEXT):I==="]"?g.cdata+="]":(g.cdata+="]]"+I,g.state=w.CDATA);continue;case w.PROC_INST:I==="?"?g.state=w.PROC_INST_ENDING:x(I)?g.state=w.PROC_INST_BODY:g.procInstName+=I;continue;case w.PROC_INST_BODY:if(!g.procInstBody&&x(I))continue;I==="?"?g.state=w.PROC_INST_ENDING:g.procInstBody+=I;continue;case w.PROC_INST_ENDING:I===">"?(Q(g,"onprocessinginstruction",{name:g.procInstName,body:g.procInstBody}),g.procInstName=g.procInstBody="",g.state=w.TEXT):(g.procInstBody+="?"+I,g.state=w.PROC_INST_BODY);continue;case w.OPEN_TAG:F(_,I)?g.tagName+=I:(Ul(g),I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:(x(I)||qe(g,"Invalid character in tag name"),g.state=w.ATTRIB));continue;case w.OPEN_TAG_SLASH:I===">"?(Pn(g,!0),zo(g)):(qe(g,"Forward-slash in opening tag not followed by >"),g.state=w.ATTRIB);continue;case w.ATTRIB:if(x(I))continue;I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:F(h,I)?(g.attribName=I,g.attribValue="",g.state=w.ATTRIB_NAME):qe(g,"Invalid attribute name");continue;case w.ATTRIB_NAME:I==="="?g.state=w.ATTRIB_VALUE:I===">"?(qe(g,"Attribute without value"),g.attribValue=g.attribName,ks(g),Pn(g)):x(I)?g.state=w.ATTRIB_NAME_SAW_WHITE:F(_,I)?g.attribName+=I:qe(g,"Invalid attribute name");continue;case w.ATTRIB_NAME_SAW_WHITE:if(I==="=")g.state=w.ATTRIB_VALUE;else{if(x(I))continue;qe(g,"Attribute without value"),g.tag.attributes[g.attribName]="",g.attribValue="",Q(g,"onattribute",{name:g.attribName,value:""}),g.attribName="",I===">"?Pn(g):F(h,I)?(g.attribName=I,g.state=w.ATTRIB_NAME):(qe(g,"Invalid attribute name"),g.state=w.ATTRIB)}continue;case w.ATTRIB_VALUE:if(x(I))continue;k(I)?(g.q=I,g.state=w.ATTRIB_VALUE_QUOTED):(qe(g,"Unquoted attribute value"),g.state=w.ATTRIB_VALUE_UNQUOTED,g.attribValue=I);continue;case w.ATTRIB_VALUE_QUOTED:if(I!==g.q){I==="&"?g.state=w.ATTRIB_VALUE_ENTITY_Q:g.attribValue+=I;continue}ks(g),g.q="",g.state=w.ATTRIB_VALUE_CLOSED;continue;case w.ATTRIB_VALUE_CLOSED:x(I)?g.state=w.ATTRIB:I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:F(h,I)?(qe(g,"No whitespace between attributes"),g.attribName=I,g.attribValue="",g.state=w.ATTRIB_NAME):qe(g,"Invalid attribute name");continue;case w.ATTRIB_VALUE_UNQUOTED:if(!T(I)){I==="&"?g.state=w.ATTRIB_VALUE_ENTITY_U:g.attribValue+=I;continue}ks(g),I===">"?Pn(g):g.state=w.ATTRIB;continue;case w.CLOSE_TAG:if(g.tagName)I===">"?zo(g):F(_,I)?g.tagName+=I:g.script?(g.script+=""?zo(g):qe(g,"Invalid characters in closing tag");continue;case w.TEXT_ENTITY:case w.ATTRIB_VALUE_ENTITY_Q:case w.ATTRIB_VALUE_ENTITY_U:var it,Tt;switch(g.state){case w.TEXT_ENTITY:it=w.TEXT,Tt="textNode";break;case w.ATTRIB_VALUE_ENTITY_Q:it=w.ATTRIB_VALUE_QUOTED,Tt="attribValue";break;case w.ATTRIB_VALUE_ENTITY_U:it=w.ATTRIB_VALUE_UNQUOTED,Tt="attribValue";break}if(I===";")if(g.opt.unparsedEntities){var Bt=Fl(g);g.entity="",g.state=it,g.write(Bt)}else g[Tt]+=Fl(g),g.entity="",g.state=it;else F(g.entity.length?b:v,I)?g.entity+=I:(qe(g,"Invalid character in entity name"),g[Tt]+="&"+g.entity+I,g.entity="",g.state=it);continue;default:throw new Error(g,"Unknown state: "+g.state)}return g.position>=g.bufferCheckPosition&&n(g),g}return String.fromCodePoint||(function(){var y=String.fromCharCode,g=Math.floor,R=function(){var I=16384,ze=[],Ye,it,Tt=-1,Bt=arguments.length;if(!Bt)return"";for(var Rn="";++Tt1114111||g(ht)!==ht)throw RangeError("Invalid code point: "+ht);ht<=65535?ze.push(ht):(ht-=65536,Ye=(ht>>10)+55296,it=ht%1024+56320,ze.push(Ye,it)),(Tt+1===Bt||ze.length>I)&&(Rn+=y.apply(null,ze),ze.length=0)}return Rn};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:R,configurable:!0,writable:!0}):String.fromCodePoint=R})(),t},uj=JW();var wv=`The output should be formatted as a XML file. +1. Output should conform to the tags below. +2. If tags are not given, make them on your own. +3. Remember to always open and close all the tags. + +As an example, for the tags ["foo", "bar", "baz"]: +1. String " + + + +" is a well-formatted instance of the schema. +2. String " + + " is a badly-formatted instance. +3. String " + + +" is a badly-formatted instance. + +Here are the output tags: +\`\`\` +{tags} +\`\`\``,lj=class extends ls{tags;constructor(t){super(t),this.tags=t?.tags}static lc_name(){return"XMLOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_diff(t,e){if(e)return t?mu(t,e):[{op:"replace",path:"",value:e}]}async parsePartialResult(t){return xv(t[0].text)}async parse(t){return xv(t)}getFormatInstructions(){return!!(this.tags&&this.tags.length>0)?wv.replace("{tags}",this.tags?.join(", ")??""):wv}},XW=t=>t.split(` +`).map(e=>e.replace(/^\s+/,"")).join(` +`).trim(),dj=t=>{if(Object.keys(t).length===0)return{};let e={};return t.children.length>0?(e[t.name]=t.children.map(dj),e):(e[t.name]=t.text??void 0,e)};function xv(t){let e=XW(t),r=uj.parser(!0),n={},o=[];r.onopentag=a=>{let c={name:a.name,attributes:a.attributes,children:[],text:"",isSelfClosing:a.isSelfClosing};o.length>0?o[o.length-1].children.push(c):n=c,a.isSelfClosing||o.push(c)},r.onclosetag=()=>{if(o.length>0){let a=o.pop();o.length===0&&a&&(n=a)}},r.ontext=a=>{if(o.length>0){let c=o[o.length-1];c.text+=a}},r.onattribute=a=>{if(o.length>0){let c=o[o.length-1];c.attributes[a.name]=a.value}};let i=/```(xml)?(.*)```/s.exec(e),s=i?i[2]:e;return r.write(s).close(),n&&n.name==="?xml"&&(n=n.children[0]),dj(n)}var YW={};G(YW,{AsymmetricStructuredOutputParser:()=>cj,BaseCumulativeTransformOutputParser:()=>ls,BaseLLMOutputParser:()=>GI,BaseOutputParser:()=>Ka,BaseTransformOutputParser:()=>si,BytesOutputParser:()=>rj,CommaSeparatedListOutputParser:()=>nj,CustomListOutputParser:()=>oj,JsonMarkdownStructuredOutputParser:()=>HI,JsonOutputParser:()=>KI,ListOutputParser:()=>al,MarkdownListOutputParser:()=>sj,NumberedListOutputParser:()=>ij,OutputParserException:()=>ln,StringOutputParser:()=>aj,StructuredOutputParser:()=>bv,XMLOutputParser:()=>lj,XML_FORMAT_INSTRUCTIONS:()=>wv,parseJsonMarkdown:()=>kd,parsePartialJson:()=>sa,parseXMLMarkdown:()=>xv});function rf(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=sa(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new ln([`Function "${t.function.name}" arguments:`,"",t.function.arguments,"","are not valid JSON.",`Error: ${o.message}`].join(` +`))}let n={name:t.function.name,args:r,type:"tool_call"};return e?.returnId&&(n.id=t.id),n}function WI(t){if(t.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:t.id,type:"function",function:{name:t.name,arguments:JSON.stringify(t.args)}}}function $v(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var JI=class extends ls{static lc_name(){return"JsonOutputToolsParser"}returnId=!1;lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;constructor(t){super(t),this.returnId=t?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(t){return await this.parsePartialResult(t,!1)}async parsePartialResult(t,e=!0){let r=t[0].message,n;if(aa(r)&&r.tool_calls?.length?n=r.tool_calls.map(i=>{let{id:s,...a}=i;return this.returnId?{id:s,...a}:a}):r.additional_kwargs.tool_calls!==void 0&&(n=JSON.parse(JSON.stringify(r.additional_kwargs.tool_calls)).map(s=>rf(s,{returnId:this.returnId,partial:e}))),!n)return[];let o=[];for(let i of n)if(i!==void 0){let s={type:i.name,args:i.args,id:i.id};o.push(s)}return o}},XI=class extends JI{static lc_name(){return"JsonOutputKeyToolsParser"}lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(t){super(t),this.keyName=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){if(this.zodSchema===void 0)return t;let e=await Ey(this.zodSchema,t);if(e.success)return e.data;throw new ln(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(e.error?.issues)}`,JSON.stringify(t,null,2))}async parsePartialResult(t){let r=(await super.parsePartialResult(t)).filter(o=>o.type===this.keyName),n=r;if(r.length)return this.returnId||(n=r.map(o=>o.args)),this.returnSingle?n[0]:n}async parseResult(t){let r=(await super.parsePartialResult(t,!1)).filter(i=>i.type===this.keyName),n=r;return r.length?(this.returnId||(n=r.map(i=>i.args)),this.returnSingle?this._validateResult(n[0]):await Promise.all(n.map(i=>this._validateResult(i)))):void 0}};var QW={};G(QW,{JsonOutputKeyToolsParser:()=>XI,JsonOutputToolsParser:()=>JI,convertLangChainToolCallToOpenAI:()=>WI,makeInvalidToolCall:()=>$v,parseToolCall:()=>rf});var p8={};G(p8,{BaseLLM:()=>tS,LLM:()=>f8});var tS=class of extends tf{lc_namespace=["langchain","llms",this._llmType()];async invoke(e,r){let n=of._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].text}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async*_streamIterator(e,r){if(this._streamResponseChunks===of.prototype._streamResponseChunks)yield this.invoke(e,r);else{let n=of._convertInputToPromptValue(e),[o,i]=this._separateRunnableConfigFromCallOptionsCompat(r),s=await St.configure(o.callbacks,this.callbacks,o.tags,this.tags,o.metadata,this.metadata,{verbose:this.verbose}),a={options:i,invocation_params:this?.invocationParams(i),batch_size:1},c=await s?.handleLLMStart(this.toJSON(),[n.toString()],o.runId,void 0,a,void 0,void 0,o.runName),u=new go({text:""});try{for await(let l of this._streamResponseChunks(n.toString(),i,c?.[0]))u?u=u.concat(l):u=l,typeof l.text=="string"&&(yield l.text)}catch(l){throw await Promise.all((c??[]).map(d=>d?.handleLLMError(l))),l}await Promise.all((c??[]).map(l=>l?.handleLLMEnd({generations:[[u]]})))}}async generatePrompt(e,r,n){let o=e.map(i=>i.toString());return this.generate(o,r,n)}invocationParams(e){return{}}_flattenLLMResult(e){let r=[];for(let n=0;nd?.handleLLMError(l))),l}let u=this._flattenLLMResult(a);await Promise.all((i??[]).map((l,d)=>l?.handleLLMEnd(u[d])))}let c=i?.map(u=>u.runId)||void 0;return Object.defineProperty(a,ya,{value:c?{runIds:c}:void 0,configurable:!0}),a}async _generateCached({prompts:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i,runId:s}){let a=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,i.metadata,this.metadata,{verbose:this.verbose}),c={options:o,invocation_params:this?.invocationParams(o),batch_size:e.length},u=await a?.handleLLMStart(this.toJSON(),e,s,void 0,c,void 0,void 0,i?.runName),l=[],f=(await Promise.allSettled(e.map(async(h,_)=>{let v=await r.lookup(h,n);return v==null&&l.push(_),v}))).map((h,_)=>({result:h,runManager:u?.[_]})).filter(({result:h})=>h.status==="fulfilled"&&h.value!=null||h.status==="rejected"),p=[];await Promise.all(f.map(async({result:h,runManager:_},v)=>{if(h.status==="fulfilled"){let b=h.value;return p[v]=b.map(x=>(x.generationInfo={...x.generationInfo,tokenUsage:{}},x)),b.length&&await _?.handleLLMNewToken(b[0].text),_?.handleLLMEnd({generations:[b]},void 0,void 0,void 0,{cached:!0})}else return await _?.handleLLMError(h.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(h.reason)}));let m={generations:p,missingPromptIndices:l,startedRunManagers:u};return Object.defineProperty(m,ya,{value:u?{runIds:u?.map(h=>h.runId)}:void 0,configurable:!0}),m}async generate(e,r,n){if(!Array.isArray(e))throw new Error("Argument 'prompts' is expected to be a string[]");let o;Array.isArray(r)?o={stop:r}:o=r;let[i,s]=this._separateRunnableConfigFromCallOptionsCompat(o);if(i.callbacks=i.callbacks??n,!this.cache)return this._generateUncached(e,s,i);let{cache:a}=this,c=this._getSerializedCacheKeyParametersForCall(s),{generations:u,missingPromptIndices:l,startedRunManagers:d}=await this._generateCached({prompts:e,cache:a,llmStringKey:c,parsedOptions:s,handledOptions:i,runId:i.runId}),f={};if(l.length>0){let p=await this._generateUncached(l.map(m=>e[m]),s,i,d!==void 0?l.map(m=>d?.[m]):void 0);await Promise.all(p.generations.map(async(m,h)=>{let _=l[h];return u[_]=m,a.update(e[_],c,m)})),f=p.llmOutput??{}}return{generations:u,llmOutput:f}}_identifyingParams(){return{}}_modelType(){return"base_llm"}},f8=class extends tS{async _generate(t,e,r){return{generations:await Promise.all(t.map((o,i)=>this._call(o,{...e,promptIndex:i},r).then(s=>[{text:s}])))}}};var m8={};G(m8,{chunkArray:()=>rS});var rS=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),s=r[i]||[];return r[i]=s.concat([n]),r},[]);var g8={};G(g8,{Embeddings:()=>nS});var nS=class{caller;constructor(t){this.caller=new Xo(t??{})}};var y8={};G(y8,{BaseToolkit:()=>v8,DynamicStructuredTool:()=>xj,DynamicTool:()=>sS,StructuredTool:()=>oS,Tool:()=>iS,ToolInputParsingException:()=>su,isLangChainTool:()=>qa,isRunnableToolLike:()=>qp,isStructuredTool:()=>Zp,isStructuredToolParams:()=>Vp,tool:()=>b8});var oS=class extends _v{extras;returnDirect=!1;verboseParsingErrors=!1;get lc_namespace(){return["langchain","tools"]}responseFormat="content";defaultConfig;constructor(t){super(t??{}),this.verboseParsingErrors=t?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=t?.responseFormat??this.responseFormat,this.defaultConfig=t?.defaultConfig??this.defaultConfig,this.metadata=t?.metadata??this.metadata,this.extras=t?.extras??this.extras}async invoke(t,e){let r,n=Pe(ga(this.defaultConfig,e));return Mi(t)?(r=t.args,n={...n,toolCall:t}):r=t,this.call(r,n)}async call(t,e,r){let n=Mi(t)?t.args:t,o;if(on(this.schema))try{o=await ts(this.schema,n)}catch(p){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m} +Details: ${p.message}`),Py(p)&&(m=`${m} + +${av.prettifyError(p)}`),new su(m,JSON.stringify(t))}else{let p=ot(n,this.schema);if(!p.valid){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m} +Details: ${p.errors.map(h=>`${h.keywordLocation}: ${h.error}`).join(` +`)}`),new su(m,JSON.stringify(t))}o=n}let i=ha(e),a=await St.configure(i.callbacks,this.callbacks,i.tags||r,this.tags,i.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof t=="string"?t:JSON.stringify(t),i.runId,void 0,void 0,void 0,i.runName);delete i.runId;let c;try{c=await this._call(o,a,i)}catch(p){throw await a?.handleToolError(p),p}let u,l;if(this.responseFormat==="content_and_artifact")if(Array.isArray(c)&&c.length===2)[u,l]=c;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple. +Result: ${JSON.stringify(c)}`);else u=c;let d;Mi(t)&&(d=t.id),!d&&nO(i)&&(d=i.toolCall.id);let f=w8({content:u,artifact:l,toolCallId:d,name:this.name,metadata:this.metadata});return await a?.handleToolEnd(f),f}},iS=class extends oS{schema=$r.object({input:$r.string().optional()}).transform(t=>t.input);constructor(t){super(t)}call(t,e){let r=typeof t=="string"||t==null?{input:t}:t;return super.call(r,e)}},sS=class extends iS{static lc_name(){return"DynamicTool"}name;description;func;constructor(t){super(t),this.name=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect}async call(t,e){let r=ha(e);return r.runName===void 0&&(r.runName=this.name),super.call(t,r)}async _call(t,e,r){return this.func(t,e,r)}},xj=class extends oS{static lc_name(){return"DynamicStructuredTool"}name;description;func;schema;constructor(t){super(t),this.name=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect,this.schema=t.schema}async call(t,e,r){let n=ha(e);return n.runName===void 0&&(n.runName=this.name),super.call(t,n,r)}_call(t,e,r){return this.func(t,e,r)}},v8=class{getTools(){return this.tools}};function b8(t,e){let r=Wu(e.schema),n=ol(e.schema);if(!e.schema||r||n)return new sS({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(s,a,c)=>new Promise((u,l)=>{let d=Ve(c,{callbacks:a?.getChild()});Lt.runWithConfig(vr(d),async()=>{try{u(t(s,d))}catch(f){l(f)}})})});let o=e.schema,i=e.description??e.schema.description??`${e.name} tool`;return new xj({...e,description:i,schema:o,func:async(s,a,c)=>new Promise((u,l)=>{let d,f=()=>{c?.signal&&d&&c.signal.removeEventListener("abort",d)};c?.signal&&(d=()=>{f(),l(Bi(c.signal))},c.signal.addEventListener("abort",d));let p=Ve(c,{callbacks:a?.getChild()});Lt.runWithConfig(vr(p),async()=>{try{let m=await t(s,p);if(c?.signal?.aborted){f();return}f(),u(m)}catch(m){f(),l(m)}})})})}function w8(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!Id(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new Or({status:"success",content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new Or({status:"success",content:x8(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function x8(t){try{return JSON.stringify(t,null,2)??""}catch{return`${t}`}}import{BedrockRuntimeClient as G1e,ConverseCommand as K1e,ConverseStreamCommand as H1e}from"@aws-sdk/client-bedrock-runtime";import{defaultProvider as Y1e}from"@aws-sdk/credential-provider-node";import{BedrockAgentRuntimeClient as lMe,RetrieveCommand as dMe}from"@aws-sdk/client-bedrock-agent-runtime";var I8={};G(I8,{BaseRetriever:()=>aS});var aS=class extends Ze{callbacks;tags;metadata;verbose;constructor(t){super(t),this.callbacks=t?.callbacks,this.tags=t?.tags??[],this.metadata=t?.metadata??{},this.verbose=t?.verbose??!1}_getRelevantDocuments(t,e){throw new Error("Not implemented!")}async invoke(t,e){let r=Pe(ha(e)),o=await(await St.configure(r.callbacks,this.callbacks,r.tags,this.tags,r.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),t,r.runId,void 0,void 0,void 0,r.runName);try{let i=await this._getRelevantDocuments(t,o);return await o?.handleRetrieverEnd(i),i}catch(i){throw await o?.handleRetrieverError(i),i}}};import{KendraClient as kMe,QueryCommand as TMe,RetrieveCommand as EMe}from"@aws-sdk/client-kendra";var cS=class{pageContent;metadata;id;constructor(t){this.pageContent=t.pageContent!==void 0?t.pageContent.toString():"",this.metadata=t.metadata??{},this.id=t.id}};var uS=class extends Ze{lc_namespace=["langchain_core","documents","transformers"];invoke(t,e){return this.transformDocuments(t)}},$j=class extends uS{async transformDocuments(t){let e=[];for(let r of t){let n=await this._transformDocument(r);e.push(n)}return e}};var S8={};G(S8,{BaseDocumentTransformer:()=>uS,Document:()=>cS,MappingDocumentTransformer:()=>$j});import{BedrockRuntimeClient as MMe,InvokeModelCommand as jMe}from"@aws-sdk/client-bedrock-runtime";var ll=class{uri;bucketOwner;constructor(e){this.uri=e.uri,e.bucketOwner!==void 0&&(this.bucketOwner=e.bucketOwner)}},sf=class{type="imageBlock";format;source;constructor(e){this.format=e.format,this.source=this._convertSource(e.source)}_convertSource(e){if("bytes"in e)return{type:"imageSourceBytes",bytes:e.bytes};if("url"in e)return{type:"imageSourceUrl",url:e.url};if("s3Location"in e)return{type:"imageSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid image source")}},af=class{type="videoBlock";format;source;constructor(e){this.format=e.format,this.source=this._convertSource(e.source)}_convertSource(e){if("bytes"in e)return{type:"videoSourceBytes",bytes:e.bytes};if("s3Location"in e)return{type:"videoSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid video source")}},cf=class{type="documentBlock";name;format;source;citations;context;constructor(e){this.name=e.name,this.format=e.format,this.source=this._convertSource(e.source),e.citations!==void 0&&(this.citations=e.citations),e.context!==void 0&&(this.context=e.context)}_convertSource(e){if("bytes"in e)return{type:"documentSourceBytes",bytes:e.bytes};if("text"in e)return{type:"documentSourceText",text:e.text};if("content"in e)return{type:"documentSourceContentBlock",content:e.content.map(r=>new mt(r.text))};if("s3Location"in e)return{type:"documentSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid document source")}};var Sr=class t{type="message";role;content;constructor(e){this.role=e.role,this.content=e.content}static fromMessageData(e){let r=e.content.map(Iv);return new t({role:e.role,content:r})}},mt=class{type="textBlock";text;constructor(e){this.text=e}},dl=class{type="toolUseBlock";name;toolUseId;input;constructor(e){this.name=e.name,this.toolUseId=e.toolUseId,this.input=e.input}},Ht=class{type="toolResultBlock";toolUseId;status;content;error;constructor(e){this.toolUseId=e.toolUseId,this.status=e.status,this.content=e.content,e.error!==void 0&&(this.error=e.error)}},pl=class{type="reasoningBlock";text;signature;redactedContent;constructor(e){e.text!==void 0&&(this.text=e.text),e.signature!==void 0&&(this.signature=e.signature),e.redactedContent!==void 0&&(this.redactedContent=e.redactedContent)}},uf=class{type="cachePointBlock";cacheType;constructor(e){this.cacheType=e.cacheType}},Ha=class{type="jsonBlock";json;constructor(e){this.json=e.json}};function Ij(t){return typeof t=="string"?t:t.map(e=>{if("type"in e)return e;if("cachePoint"in e)return new uf(e.cachePoint);if("guardContent"in e)return new lf(e.guardContent);if("text"in e)return new mt(e.text);throw new Error("Unknown SystemContentBlockData type")})}var lf=class{type="guardContentBlock";text;image;constructor(e){if(!e.text&&!e.image)throw new Error("GuardContentBlock must have either text or image content");if(e.text&&e.image)throw new Error("GuardContentBlock cannot have both text and image content");e.text&&(this.text=e.text),e.image&&(this.image=e.image)}};function Iv(t){if("text"in t)return new mt(t.text);if("toolUse"in t)return new dl(t.toolUse);if("toolResult"in t)return new Ht({toolUseId:t.toolResult.toolUseId,status:t.toolResult.status,content:t.toolResult.content.map(e=>{if("text"in e)return new mt(e.text);if("json"in e)return new Ha(e);throw new Error("Unknown ToolResultContentData type")})});if("reasoning"in t)return new pl(t.reasoning);if("cachePoint"in t)return new uf(t.cachePoint);if("guardContent"in t)return new lf(t.guardContent);if("image"in t)return new sf(t.image);if("video"in t)return new af(t.video);if("document"in t)return new cf(t.document);throw new Error("Unknown ContentBlockData type")}var ds=class extends Error{constructor(e){super(e),this.name="ContextWindowOverflowError"}},df=class extends Error{partialMessage;constructor(e,r){super(e),this.name="MaxTokensError",this.partialMessage=r}},ps=class extends Error{constructor(e){super(e),this.name="JsonValidationError"}},pf=class extends Error{constructor(e){super(e),this.name="ConcurrentInvocationError"}};function ai(t){return t instanceof Error?t:new Error(String(t))}var ff=class extends Error{constructor(e){super(`Item with id '${e}' not found`),this.name="ItemNotFoundError"}},mf=class extends Error{constructor(e){super(`An item with the ID '${e}' already exists.`),this.name="DuplicateItemError"}},Ft=class extends Error{constructor(e){super(e),this.name="ValidationError"}},hf=class{_items;constructor(e){this._items=new Map,e&&this.addAll(e)}get(e){return this._items.get(e)}find(e){for(let r of this._items.values())if(e(r))return r}keys(){return Array.from(this._items.keys())}values(){return Array.from(this._items.values())}pairs(){return Array.from(this._items.entries())}clear(){this._items.clear()}add(e){this.validate(e);let r=this.generateId(e);if(this._items.has(r))throw new mf(r);return this._items.set(r,e),r}addAll(e){return e.map(r=>this.add(r))}remove(e){let r=this._items.get(e);if(r===void 0)throw new ff(e);return this._items.delete(e),r}removeAll(e){return e.map(r=>this.remove(r))}findRemove(e){for(let[r,n]of this._items.entries())if(e(n))return this._items.delete(r),n}};if(import.meta.vitest){let{describe:t,it:e,expect:r,beforeEach:n,vi:o}=import.meta.vitest;class i extends hf{nextId=1;generateId(){return this.nextId++}validate(a){if(a.length===0)throw new Ft("Item cannot be an empty string.")}}t("Error Classes",()=>{e("ItemNotFoundError should have the correct name and message",()=>{let s=new ff(123);r(s.name).toBe("ItemNotFoundError"),r(s.message).toBe("Item with id '123' not found")}),e("DuplicateItemError should have the correct name and message",()=>{let s=new mf("abc");r(s.name).toBe("DuplicateItemError"),r(s.message).toBe("An item with the ID 'abc' already exists.")}),e("ValidationError should have the correct name and message",()=>{let s=new Ft("Invalid item");r(s.name).toBe("ValidationError"),r(s.message).toBe("Invalid item")})}),t("Registry",()=>{let s;n(()=>{s=new i}),e("should register an item and return a new ID",()=>{let a=s.add("test-item");r(a).toBe(1),r(s.get(1)).toBe("test-item")}),e("should throw DuplicateItemError when registering with an existing ID",()=>{let a=o.spyOn(s,"generateId").mockReturnValue(1);s.add("test-item"),r(()=>s.add("another-item")).toThrow(mf),a.mockRestore()}),e("should deregister an item and return it",()=>{let a=s.add("test-item"),c=s.remove(a);r(c).toBe("test-item"),r(s.get(a)).toBeUndefined()}),e("should throw ItemNotFoundError when deregistering a non-existent item",()=>{r(()=>s.remove(999)).toThrow(ff)}),e("should get an item by its ID",()=>{let a=s.add("test-item"),c=s.get(a);r(c).toBe("test-item")}),e("should return undefined when getting a non-existent item",()=>{let a=s.get(999);r(a).toBeUndefined()}),e("should find an item using a predicate",()=>{s.add("item-a"),s.add("item-b");let a=s.find(c=>c.includes("b"));r(a).toBe("item-b")}),e("should return undefined when no item matches the predicate",()=>{s.add("item-a");let a=s.find(c=>c.includes("c"));r(a).toBeUndefined()}),e("should return all keys",()=>{s.add("item-1"),s.add("item-2"),r(s.keys()).toEqual([1,2])}),e("should return all values",()=>{s.add("item-1"),s.add("item-2"),r(s.values()).toEqual(["item-1","item-2"])}),e("should return all key-value pairs",()=>{s.add("item-1"),s.add("item-2"),r(s.pairs()).toEqual([[1,"item-1"],[2,"item-2"]])}),e("should clear all items from the registry",()=>{s.add("item-1"),s.clear(),r(s.keys()).toEqual([]),r(s.values()).toEqual([])}),e("should register multiple items",()=>{let a=s.addAll(["item-a","item-b"]);r(a).toEqual([1,2]),r(s.values()).toEqual(["item-a","item-b"])}),e("should deregister multiple items",()=>{let a=s.addAll(["item-a","item-b","item-c"]),c=s.removeAll([a[0],a[2]]);r(c).toEqual(["item-a","item-c"]),r(s.values()).toEqual(["item-b"])}),e("should find and deregister an item",()=>{s.add("item-a"),s.add("item-b");let a=s.findRemove(c=>c.includes("a"));r(a).toBe("item-a"),r(s.values()).toEqual(["item-b"])}),e("should return undefined from findRemove if no item matches",()=>{let a=s.findRemove(c=>c.includes("c"));r(a).toBeUndefined()}),e("should call the validate method on register",()=>{let a=o.spyOn(s,"validate");s.add("a-valid-item"),r(a).toHaveBeenCalledWith("a-valid-item"),a.mockRestore()}),e("should throw a validation error for an invalid item",()=>{r(()=>s.add("")).toThrow(Ft)})})}var gf=class{type="toolStreamEvent";data;constructor(e){e.data!==void 0&&(this.data=e.data)}},fl=class{};function lS(t,e){let r=ai(t);return new Ht({toolUseId:e,status:"error",content:[new mt(`Error: ${r.message}`)],error:r})}var _f=class extends hf{generateId(e){return e}validate(e){if(typeof e.name!="string")throw new Ft("Tool name must be a string");if(e.name.length<1||e.name.length>64)throw new Ft("Tool name must be between 1 and 64 characters");if(!/^[a-zA-Z0-9_-]+$/.test(e.name))throw new Ft("Tool name must contain only alphanumeric characters, hyphens, and underscores");if(e.description!==void 0&&e.description!==null&&(typeof e.description!="string"||e.description.length<1))throw new Ft("Tool description must be a non-empty string");if(this.values().some(n=>n.name===e.name))throw new Ft(`Tool with name '${e.name}' already registered`)}getByName(e){return this.values().find(r=>r.name===e)}removeByName(e){this.findRemove(r=>r.name===e)}};if(import.meta.vitest){let{describe:t,it:e,expect:r,beforeEach:n}=import.meta.vitest,o=(i={})=>({name:"valid-tool",description:"A valid tool description.",toolSpec:{name:"valid-tool",description:"A valid tool description.",inputSchema:{type:"object",properties:{}}},stream:async function*(){return yield new gf({data:"mock data"}),new Ht({toolUseId:"",status:"success",content:[]})},...i});t("ToolRegistry",()=>{let i;n(()=>{i=new _f}),e("should register a valid tool successfully",()=>{let s=o();r(()=>i.add(s)).not.toThrow(),r(i.values()).toHaveLength(1),r(i.values()[0]?.name).toBe("valid-tool")}),e("should throw ValidationError for a duplicate tool name",()=>{let s=o({name:"duplicate-name"}),a=o({name:"duplicate-name"});i.add(s),r(()=>i.add(a)).toThrow(Ft),r(()=>i.add(a)).toThrow("Tool with name 'duplicate-name' already registered")}),e("should throw ValidationError for an invalid tool name pattern",()=>{let s=o({name:"invalid name!"});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must contain only alphanumeric characters, hyphens, and underscores")}),e("should throw ValidationError for a tool name that is too long",()=>{let s="a".repeat(65),a=o({name:s});r(()=>i.add(a)).toThrow(Ft),r(()=>i.add(a)).toThrow("Tool name must be between 1 and 64 characters")}),e("should throw ValidationError for a tool name that is too short",()=>{let s=o({name:""});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must be between 1 and 64 characters")}),e("should throw ValidationError for an invalid description",()=>{let s=o({description:123});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool description must be a non-empty string")}),e("should throw ValidationError for an empty string description",()=>{let s=o({description:""});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool description must be a non-empty string")}),e("should allow a tool with a null or undefined description",()=>{let s=o();s.description=void 0;let a=o();a.name="another-valid-tool",a.description=null,r(()=>i.add(s)).not.toThrow(),r(()=>i.add(a)).not.toThrow()}),e("should retrieve a tool by its name",()=>{let s=o({name:"find-me"});i.add(s);let a=i.getByName("find-me");r(a).toBe(s)}),e("should return undefined when getting a tool by a name that does not exist",()=>{let s=i.getByName("non-existent");r(s).toBeUndefined()}),e("should remove a tool by its name",()=>{let s=o({name:"remove-me"});i.add(s),r(i.getByName("remove-me")).toBeDefined(),i.removeByName("remove-me"),r(i.getByName("remove-me")).toBeUndefined()}),e("should not throw when removing a tool by a name that does not exist",()=>{r(()=>i.removeByName("non-existent")).not.toThrow()}),e("should generate a valid ToolIdentifier",()=>{let s=o(),a=i.generateId(s);r(a).toBe(s)}),e("should register a tool with a name at the maximum length",()=>{let s="a".repeat(64),a=o({name:s});r(()=>i.add(a)).not.toThrow()}),e("should throw ValidationError for a non-string tool name",()=>{let s=o({name:123});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must be a string")})})}function Sv(t){try{return JSON.parse(JSON.stringify(t))}catch(e){let r=e instanceof Error?e.message:String(e);throw new Error(`Unable to serialize tool result: ${r}`)}}function dS(t,e="value"){let r=[],n=(o,i)=>{let s=e;if(o!==""&&(/^\d+$/.test(o)?s=r.length>0?`${r[r.length-1]}[${o}]`:`${e}[${o}]`:s=r.length>0?`${r[r.length-1]}.${o}`:`${e}.${o}`),typeof i=="function")throw new ps(`${s} contains a function which cannot be serialized`);if(typeof i=="symbol")throw new ps(`${s} contains a symbol which cannot be serialized`);if(i===void 0)throw new ps(`${s} is undefined which cannot be serialized`);return i!==null&&typeof i=="object"&&r.push(s),i};try{let o=JSON.stringify(t,n);return JSON.parse(o)}catch(o){if(o instanceof ps)throw o;let i=o instanceof Error?o.message:String(o);throw new Error(`Unable to serialize value: ${i}`)}}var kv=class{_state;constructor(e){e!==void 0?this._state=dS(e,"initialState"):this._state={}}get(e){if(e==null)throw new Error("key is required");let r=this._state[e];if(r!==void 0)return Sv(r)}set(e,r){this._state[e]=dS(r,`value for key "${e}"`)}delete(e){delete this._state[e]}clear(){this._state={}}getAll(){return Sv(this._state)}keys(){return Object.keys(this._state)}};function Sj(){return typeof process<"u"&&process.stdout?.write?t=>process.stdout.write(t):t=>console.log(t)}var Tv=class{_appender;_inReasoningBlock=!1;_toolCount=0;_needReasoningIndent=!1;constructor(e){this._appender=e}write(e){this._appender(e)}processEvent(e){switch(e.type){case"modelContentBlockDeltaEvent":this.handleContentBlockDelta(e);break;case"modelContentBlockStartEvent":this.handleContentBlockStart(e);break;case"modelContentBlockStopEvent":this.handleContentBlockStop();break;case"toolResultBlock":this.handleToolResult(e);break;default:break}}handleContentBlockDelta(e){let{delta:r}=e;r.type==="textDelta"?r.text&&r.text.length>0&&this.write(r.text):r.type==="reasoningContentDelta"&&(this._inReasoningBlock||(this._inReasoningBlock=!0,this._needReasoningIndent=!0,this.write(` +\u{1F4AD} Reasoning: +`)),r.text&&r.text.length>0&&this.writeReasoningText(r.text))}writeReasoningText(e){let r="";for(let n=0;n{this.applyManagement(r.agent.messages)}),e.addCallback(ui,r=>{r.error instanceof ds&&(this.reduceContext(r.agent.messages,r.error),r.retryModelCall=!0)})}applyManagement(e){e.length<=this._windowSize||this.reduceContext(e)}reduceContext(e,r){let n=this.findLastMessageWithToolResults(e);if(r&&n!==void 0&&this._shouldTruncateResults&&this.truncateToolResults(e,n))return;let o=e.length<=this._windowSize?2:e.length-this._windowSize;for(;oc.type==="toolResultBlock")){o++;continue}if(i.content.some(c=>c.type==="toolUseBlock")){let c=e[o+1];if(!(c&&c.content.some(l=>l.type==="toolResultBlock"))){o++;continue}}break}if(o>=e.length)throw new ds("Unable to trim conversation context!");e.splice(0,o)}truncateToolResults(e,r){if(r>=e.length||r<0)return!1;let n=e[r];if(!n)return!1;let o="The tool result was too large!",i=!1;for(let a of n.content)if(a.type==="toolResultBlock"){let c=a,u=c.content[0],l=u&&u.type==="textBlock"?u.text:"";if(c.status==="error"&&l===o)return!1;i=!0;break}if(!i)return!1;let s=n.content.map(a=>{if(a.type==="toolResultBlock"){let c=a;return new Ht({toolUseId:c.toolUseId,status:"error",content:[new mt(o)]})}return a});return e[r]=new Sr({role:n.role,content:s}),!0}findLastMessageWithToolResults(e){for(let r=e.length-1;r>=0;r--)if(e[r].content.some(i=>i.type==="toolResultBlock"))return r}};var vl=class{_callbacks;_currentProvider;constructor(){this._callbacks=new Map,this._currentProvider=void 0}addCallback(e,r){let n={callback:r,source:this._currentProvider},o=this._callbacks.get(e)??[];return o.push(n),this._callbacks.set(e,o),()=>{let i=this._callbacks.get(e);if(!i)return;let s=i.indexOf(n);s!==-1&&i.splice(s,1)}}addHook(e){this._currentProvider=e;try{e.registerCallbacks(this)}finally{this._currentProvider=void 0}}addAllHooks(e){for(let r of e)this.addHook(r)}removeHook(e){for(let[r,n]of this._callbacks.entries()){let o=n.filter(i=>i.source!==e);o.length===0?this._callbacks.delete(r):o.length!==n.length&&this._callbacks.set(r,o)}}async invokeCallbacks(e){let r=this.getCallbacksFor(e);for(let n of r)await n(e);return e}getCallbacksFor(e){let n=(this._callbacks.get(e.constructor)??[]).map(o=>o.callback);return e._shouldReverseCallbacks()?[...n].reverse():n}};var E8=function(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e},A8=(function(t){return function(e){function r(s){e.error=e.hasError?new t(s,e.error,"An error was suppressed during disposal."):s,e.hasError=!0}var n,o=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&o===1)return o=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return o|=2,Promise.resolve(s).then(i,function(a){return r(a),i()})}else o|=1}catch(a){r(a)}if(o===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}})(typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n}),bf=class{messages;state;conversationManager;hooks;model;systemPrompt;_toolRegistry;_mcpClients;_initialized;_isInvoking=!1;_printer;constructor(e){this.messages=(e?.messages??[]).map(i=>i instanceof Sr?i:Sr.fromMessageData(i)),this.state=new kv(e?.state),this.conversationManager=e?.conversationManager??new vf({windowSize:40}),this.hooks=new vl,this.hooks.addHook(this.conversationManager),this.hooks.addAllHooks(e?.hooks??[]),typeof e?.model=="string"?this.model=new ms({modelId:e.model}):this.model=e?.model??new ms;let{tools:r,mcpClients:n}=kj(e?.tools??[]);this._toolRegistry=new _f(r),this._mcpClients=n,e?.systemPrompt!==void 0&&(this.systemPrompt=Ij(e.systemPrompt)),(e?.printer??!0)&&(this._printer=new Tv(Sj())),this._initialized=!1}async initialize(){this._initialized||(await Promise.all(this._mcpClients.map(async e=>{let r=await e.listTools();this._toolRegistry.addAll(r)})),this._initialized=!0)}acquireLock(){if(this._isInvoking)throw new pf("Agent is already processing an invocation. Wait for the current invoke() or stream() call to complete before invoking again.");return this._isInvoking=!0,{[Symbol.dispose]:()=>{this._isInvoking=!1}}}get tools(){return this._toolRegistry.values()}get toolRegistry(){return this._toolRegistry}async invoke(e){let r=this.stream(e),n=await r.next();for(;!n.done;)n=await r.next();return n.value}async*stream(e){let r={stack:[],error:void 0,hasError:!1};try{let n=E8(r,this.acquireLock(),!1);await this.initialize();let o=this._stream(e),i=await o.next();for(;!i.done;){let s=i.value;s instanceof ar&&!(s instanceof Wa)&&await this.hooks.invokeCallbacks(s),this._printer?.processEvent(s),yield s,i=await o.next()}return yield i.value,i.value}catch(n){r.error=n,r.hasError=!0}finally{A8(r)}}async*_stream(e){let r=e;yield new ml({agent:this});try{for(;;){let n=yield*this.invokeModel(r);if(r=void 0,n.stopReason!=="toolUse")return yield await this._appendMessage(n.message),new wf({stopReason:n.stopReason,lastMessage:n.message});let o=yield*this.executeTools(n.message,this._toolRegistry);yield await this._appendMessage(n.message),yield await this._appendMessage(o)}}finally{yield new fs({agent:this})}}_normalizeInput(e){if(e!==void 0){if(typeof e=="string")return[new Sr({role:"user",content:[new mt(e)]})];if(Array.isArray(e)&&e.length>0){let r=e[0];if("role"in r&&typeof r.role=="string")return r instanceof Sr?e:e.map(n=>Sr.fromMessageData(n));{let n;return"type"in r&&typeof r.type=="string"?n=e:n=e.map(Iv),[new Sr({role:"user",content:n})]}}}return[]}async*invokeModel(e){let r=this._normalizeInput(e);for(let i of r)yield await this._appendMessage(i);let o={toolSpecs:this._toolRegistry.values().map(i=>i.toolSpec)};this.systemPrompt!==void 0&&(o.systemPrompt=this.systemPrompt),yield new gl({agent:this});try{let{message:i,stopReason:s}=yield*this._streamFromModel(this.messages,o);return yield new ui({agent:this,stopData:{message:i,stopReason:s}}),{message:i,stopReason:s}}catch(i){let s=ai(i),a=new ui({agent:this,error:s});if(yield a,a.retryModelCall)return yield*this.invokeModel(e);throw i}}async*_streamFromModel(e,r){let n=this.model.streamAggregated(e,r),o=await n.next();for(;!o.done;){let i=o.value;yield new yf({agent:this,event:i}),yield i,o=await n.next()}return o.value}async*executeTools(e,r){yield new _l({agent:this,message:e});let n=e.content.filter(s=>s.type==="toolUseBlock");if(n.length===0)throw new Error("Model indicated toolUse but no tool use blocks found in message");let o=[];for(let s of n){let a=yield*this.executeTool(s,r);o.push(a),yield a}let i=new Sr({role:"user",content:o});return yield new yl({agent:this,message:i}),i}async*executeTool(e,r){let n=r.find(s=>s.name===e.name),o={name:e.name,toolUseId:e.toolUseId,input:e.input};if(yield new hl({agent:this,toolUse:o,tool:n}),!n){let s=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(`Tool '${e.name}' not found in registry`)]});return yield new ci({agent:this,toolUse:o,tool:n,result:s}),s}let i={toolUse:{name:e.name,toolUseId:e.toolUseId,input:e.input},agent:this};try{let a=yield*n.stream(i);if(!a){let c=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(`Tool '${e.name}' did not return a result`)]});return yield new ci({agent:this,toolUse:o,tool:n,result:c}),c}return yield new ci({agent:this,toolUse:o,tool:n,result:a}),a}catch(s){let a=ai(s),c=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(a.message)],error:a});return yield new ci({agent:this,toolUse:o,tool:n,result:c,error:a}),c}}async _appendMessage(e){this.messages.push(e);let r=new Wa({agent:this,message:e});return await this.hooks.invokeCallbacks(r),r}};function kj(t){let e=[],r=[];for(let n of t)if(Array.isArray(n)){let{tools:o,mcpClients:i}=kj(n);e.push(...o),r.push(...i)}else n instanceof xf?r.push(n):e.push(n);return{tools:e,mcpClients:r}}var wf=class{type="agentResult";stopReason;lastMessage;constructor(e){this.stopReason=e.stopReason,this.lastMessage=e.lastMessage}toString(){let e=[];for(let r of this.lastMessage.content)switch(r.type){case"textBlock":e.push(r.text);break;case"reasoningBlock":if(r.text){let n=r.text.replace(/\n/g,` + `);e.push(`\u{1F4AD} Reasoning: + ${n}`)}break;default:console.debug(`Skipping content block type: ${r.type}`);break}return e.join(` +`)}};import{BedrockRuntimeClient as C8,ConverseCommand as R8,ConverseStreamCommand as N8}from"@aws-sdk/client-bedrock-runtime";var Ev=class{type="modelMessageStartEvent";role;constructor(e){this.role=e.role}},Av=class{type="modelContentBlockStartEvent";start;constructor(e){e.start!==void 0&&(this.start=e.start)}},Ov=class{type="modelContentBlockDeltaEvent";contentBlockIndex;delta;constructor(e){this.delta=e.delta}},Pv=class{type="modelContentBlockStopEvent";constructor(e){}},Cv=class{type="modelMessageStopEvent";stopReason;additionalModelResponseFields;constructor(e){this.stopReason=e.stopReason,e.additionalModelResponseFields!==void 0&&(this.additionalModelResponseFields=e.additionalModelResponseFields)}},Rv=class{type="modelMetadataEvent";usage;metrics;trace;constructor(e){e.usage!==void 0&&(this.usage=e.usage),e.metrics!==void 0&&(this.metrics=e.metrics),e.trace!==void 0&&(this.trace=e.trace)}};var Nv=class{_convert_to_class_event(e){switch(e.type){case"modelMessageStartEvent":return new Ev(e);case"modelContentBlockStartEvent":return new Av(e);case"modelContentBlockDeltaEvent":return new Ov(e);case"modelContentBlockStopEvent":return new Pv(e);case"modelMessageStopEvent":return new Cv(e);case"modelMetadataEvent":return new Rv(e);default:throw new Error(`Unsupported event type: ${e}`)}}async*streamAggregated(e,r){let n=null,o=[],i="",s="",a="",c="",u={},l,d=null,f=null,p;for await(let h of this.stream(e,r)){let _=this._convert_to_class_event(h);switch(yield _,_.type){case"modelMessageStartEvent":n=_.role,o.length=0;break;case"modelContentBlockStartEvent":_.start?.type==="toolUseStart"&&(a=_.start.name,c=_.start.toolUseId),s="",i="",u={};break;case"modelContentBlockDeltaEvent":switch(_.delta.type){case"textDelta":i+=_.delta.text;break;case"toolUseInputDelta":s+=_.delta.input;break;case"reasoningContentDelta":_.delta.text&&(u.text=(u.text??"")+_.delta.text),_.delta.signature&&(u.signature=_.delta.signature),_.delta.redactedContent&&(u.redactedContent=_.delta.redactedContent);break}break;case"modelContentBlockStopEvent":{let v;try{c?(v=new dl({name:a,toolUseId:c,input:s?JSON.parse(s):{}}),c="",a=""):Object.keys(u).length>0?v=new pl({...u}):v=new mt(i),o.push(v),yield v}catch(b){b instanceof SyntaxError&&(console.error("Unable to parse JSON string."),l=b)}break}case"modelMessageStopEvent":n&&(d=new Sr({role:n,content:[...o]}),f=_.stopReason);break;case"modelMetadataEvent":p=_;break;default:break}}if(!d||!f)throw new Error("Stream ended without completing a message",{cause:l});if(f==="maxTokens"){let h=new df("Model reached maximum token limit. This is an unrecoverable state that requires intervention.",d);l!==void 0?l.cause=h:l=h}if(l!==void 0)throw l;let m={message:d,stopReason:f};return p!==void 0&&(m.metadata=p),m}};function ct(t,e){if(t==null)throw new Error(`Expected ${e} to be defined, but got ${t}`);return t}var P8={debug:()=>{},info:()=>{},warn:(...t)=>console.warn(...t),error:(...t)=>console.error(...t)},hs=P8;var z8="global.anthropic.claude-sonnet-4-5-20250929-v1:0",M8="us-west-2",j8=!1,D8=["anthropic.claude"],L8=["Input is too long for requested model","input length and `max_tokens` exceed context limit","too many total text bytes"],Tj={end_turn:"endTurn",tool_use:"toolUse",max_tokens:"maxTokens",stop_sequence:"stopSequence",content_filtered:"contentFiltered",guardrail_intervened:"guardrailIntervened"};function U8(t){return t.replace(/_([a-z])/g,(e,r)=>r.toUpperCase())}var ms=class extends Nv{_config;_client;constructor(e){super();let{region:r,clientConfig:n,...o}=e??{};this._config={modelId:z8,...o};let i=n?.customUserAgent?`${n.customUserAgent} strands-agents-ts-sdk`:"strands-agents-ts-sdk";this._client=new C8({...n??{},...r?{region:r}:{},customUserAgent:i}),F8(this._client.config)}updateConfig(e){this._config={...this._config,...e}}getConfig(){return this._config}async*stream(e,r){try{let n=this._formatRequest(e,r);if(this._config.stream!==!1){let o=new N8(n),i=await this._client.send(o);if(i.stream)for await(let s of i.stream){let a=this._mapStreamedBedrockEventToSDKEvent(s);for(let c of a)yield c}}else{let o=new R8(n),i=await this._client.send(o);for(let s of this._mapBedrockEventToSDKEvent(i))yield s}}catch(n){let o=ai(n);throw L8.some(i=>o.message.includes(i))?new ds(o.message):o}}_formatRequest(e,r){let n={modelId:this._config.modelId,messages:this._formatMessages(e)};if(r?.systemPrompt!==void 0)if(typeof r.systemPrompt=="string"){let i=[{text:r.systemPrompt}];this._config.cachePrompt&&i.push({cachePoint:{type:this._config.cachePrompt}}),n.system=i}else r.systemPrompt.length>0&&(this._config.cachePrompt&&hs.warn("cachePrompt config is ignored when systemPrompt is an array, use explicit cache points instead"),n.system=r.systemPrompt.map(i=>this._formatContentBlock(i)));if(r?.toolSpecs&&r.toolSpecs.length>0){let i=r.toolSpecs.map(a=>({toolSpec:{name:a.name,description:a.description,inputSchema:{json:a.inputSchema}}}));this._config.cacheTools&&i.push({cachePoint:{type:this._config.cacheTools}});let s={tools:i};r.toolChoice&&(s.toolChoice=r.toolChoice),n.toolConfig=s}let o={};return this._config.maxTokens!==void 0&&(o.maxTokens=this._config.maxTokens),this._config.temperature!==void 0&&(o.temperature=this._config.temperature),this._config.topP!==void 0&&(o.topP=this._config.topP),this._config.stopSequences!==void 0&&(o.stopSequences=this._config.stopSequences),Object.keys(o).length>0&&(n.inferenceConfig=o),this._config.additionalRequestFields&&(n.additionalModelRequestFields=this._config.additionalRequestFields),this._config.additionalResponseFieldPaths&&(n.additionalModelResponseFieldPaths=this._config.additionalResponseFieldPaths),this._config.additionalArgs&&Object.assign(n,this._config.additionalArgs),n}_formatMessages(e){return e.reduce((r,n)=>{let o=n.content.map(i=>this._formatContentBlock(i)).filter(i=>i!==void 0);return o.length>0&&r.push({role:n.role,content:o}),r},[])}_shouldIncludeToolResultStatus(){let e=this._config.includeToolResultStatus??"auto";if(e===!0)return!0;if(e===!1)return!1;let r=D8.some(n=>this._config.modelId?.includes(n));return hs.debug(`model_id=<${this._config.modelId}>, include_tool_result_status=<${r}> | auto-detected includeToolResultStatus`),r}_formatContentBlock(e){switch(e.type){case"textBlock":return{text:e.text};case"toolUseBlock":return{toolUse:{toolUseId:e.toolUseId,name:e.name,input:e.input}};case"toolResultBlock":{let r=e.content.map(n=>{switch(n.type){case"textBlock":return{text:n.text};case"jsonBlock":return{json:n.json}}});return{toolResult:{toolUseId:e.toolUseId,content:r,...this._shouldIncludeToolResultStatus()&&{status:e.status}}}}case"reasoningBlock":{if(e.text)return{reasoningContent:{reasoningText:{text:e.text,signature:e.signature}}};if(e.redactedContent)return{reasoningContent:{redactedContent:e.redactedContent}};throw Error("reasoning content format incorrect. Either 'text' or 'redactedContent' must be set.")}case"cachePointBlock":return{cachePoint:{type:e.cacheType}};case"imageBlock":return{image:{format:e.format,source:this._formatMediaSource(e.source)}};case"videoBlock":return{video:{format:e.format==="3gp"?"three_gp":e.format,source:this._formatMediaSource(e.source)}};case"documentBlock":return{document:{name:e.name,format:e.format,source:this._formatDocumentSource(e.source),...e.citations&&{citations:e.citations},...e.context&&{context:e.context}}};case"guardContentBlock":{if(e.text)return{guardContent:{text:{text:e.text.text,qualifiers:e.text.qualifiers}}};if(e.image)return{guardContent:{image:{format:e.image.format,source:{bytes:e.image.source.bytes}}}};throw new Error("guardContent must have either text or image")}}}_formatMediaSource(e){switch(e.type){case"imageSourceBytes":case"videoSourceBytes":return{bytes:e.bytes};case"imageSourceUrl":if(e.url.startsWith("s3://"))return{s3Location:{uri:e.url}};console.warn("Ignoring imageSourceUrl content block as its not supported by bedrock");return;case"imageSourceS3Location":case"videoSourceS3Location":return{s3Location:{uri:e.s3Location.uri,...e.s3Location.bucketOwner&&{bucketOwner:e.s3Location.bucketOwner}}};default:throw new Error("Invalid media source")}}_formatDocumentSource(e){switch(e.type){case"documentSourceBytes":return{bytes:e.bytes};case"documentSourceText":return{bytes:new TextEncoder().encode(e.text)};case"documentSourceContentBlock":return{content:e.content.map(r=>({text:r.text}))};case"documentSourceS3Location":return{s3Location:{uri:e.s3Location.uri,...e.s3Location.bucketOwner&&{bucketOwner:e.s3Location.bucketOwner}}};default:throw new Error("Invalid document source")}}_mapBedrockEventToSDKEvent(e){let r=[],n=ct(e.output,"event.output"),o=ct(n.message,"output.message"),i=ct(o.role,"message.role");r.push({type:"modelMessageStartEvent",role:i});let s={text:d=>{r.push({type:"modelContentBlockStartEvent"}),r.push({type:"modelContentBlockDeltaEvent",delta:{type:"textDelta",text:d}}),r.push({type:"modelContentBlockStopEvent"})},toolUse:d=>{r.push({type:"modelContentBlockStartEvent",start:{type:"toolUseStart",name:ct(d.name,"toolUse.name"),toolUseId:ct(d.toolUseId,"toolUse.toolUseId")}}),r.push({type:"modelContentBlockDeltaEvent",delta:{type:"toolUseInputDelta",input:JSON.stringify(ct(d.input,"toolUse.input"))}}),r.push({type:"modelContentBlockStopEvent"})},reasoningContent:d=>{if(!d)return;r.push({type:"modelContentBlockStartEvent"});let f={type:"reasoningContentDelta"};d.reasoningText?(f.text=ct(d.reasoningText.text,"reasoningText.text"),d.reasoningText.signature&&(f.signature=d.reasoningText.signature)):d.redactedContent&&(f.redactedContent=d.redactedContent),Object.keys(f).length>1&&r.push({type:"modelContentBlockDeltaEvent",delta:f}),r.push({type:"modelContentBlockStopEvent"})}};ct(o.content,"message.content").forEach(d=>{for(let f in d)if(f in s){let p=f;s[p](d[p])}else hs.warn(`block_key=<${f}> | skipping unsupported block key`)});let c=ct(e.stopReason,"event.stopReason");r.push({type:"modelMessageStopEvent",stopReason:this._transformStopReason(c,e)});let u=ct(e.usage,"output.usage"),l={type:"modelMetadataEvent",usage:{inputTokens:ct(u.inputTokens,"usage.inputTokens"),outputTokens:ct(u.outputTokens,"usage.outputTokens"),totalTokens:ct(u.totalTokens,"usage.totalTokens")}};return e.metrics&&(l.metrics={latencyMs:ct(e.metrics.latencyMs,"metrics.latencyMs")}),r.push(l),r}_mapStreamedBedrockEventToSDKEvent(e){let r=[],n=ct(Object.keys(e)[0],"eventType"),o=e[n];switch(n){case"messageStart":{let i=o;r.push({type:"modelMessageStartEvent",role:ct(i.role,"messageStart.role")});break}case"contentBlockStart":{let i=o,s={type:"modelContentBlockStartEvent"};if(i.start?.toolUse){let a=i.start.toolUse;s.start={type:"toolUseStart",name:ct(a.name,"toolUse.name"),toolUseId:ct(a.toolUseId,"toolUse.toolUseId")}}r.push(s);break}case"contentBlockDelta":{let s=ct(o.delta,"contentBlockDelta.delta"),a={text:c=>{r.push({type:"modelContentBlockDeltaEvent",delta:{type:"textDelta",text:c}})},toolUse:c=>{c?.input&&r.push({type:"modelContentBlockDeltaEvent",delta:{type:"toolUseInputDelta",input:c.input}})},reasoningContent:c=>{if(!c)return;let u={type:"reasoningContentDelta"};c.text&&(u.text=c.text),c.signature&&(u.signature=c.signature),c.redactedContent&&(u.redactedContent=c.redactedContent),Object.keys(u).length>1&&r.push({type:"modelContentBlockDeltaEvent",delta:u})}};for(let c in s)if(c in a){let u=c;a[u](s[u])}else hs.warn(`delta_key=<${c}> | skipping unsupported delta key`);break}case"contentBlockStop":{r.push({type:"modelContentBlockStopEvent"});break}case"messageStop":{let i=o,s=ct(i.stopReason,"messageStop.stopReason"),a={type:"modelMessageStopEvent",stopReason:this._transformStopReason(s,i)};i.additionalModelResponseFields&&(a.additionalModelResponseFields=i.additionalModelResponseFields),r.push(a);break}case"metadata":{let i=o,s={type:"modelMetadataEvent"};if(i.usage){let a=i.usage,c={inputTokens:ct(a.inputTokens,"usage.inputTokens"),outputTokens:ct(a.outputTokens,"usage.outputTokens"),totalTokens:ct(a.totalTokens,"usage.totalTokens")};a.cacheReadInputTokens!==void 0&&(c.cacheReadInputTokens=a.cacheReadInputTokens),a.cacheWriteInputTokens!==void 0&&(c.cacheWriteInputTokens=a.cacheWriteInputTokens),s.usage=c}i.metrics&&(s.metrics={latencyMs:ct(i.metrics.latencyMs,"metrics.latencyMs")}),i.trace&&(s.trace=i.trace),r.push(s);break}case"internalServerException":case"modelStreamErrorException":case"serviceUnavailableException":case"validationException":case"throttlingException":throw o;default:hs.warn(`event_type=<${n}> | unsupported bedrock event type`);break}return r}_transformStopReason(e,r){let n;if(e in Tj)n=Tj[e];else{let o=U8(e);hs.warn(`stop_reason=<${e}>, fallback=<${o}> | unknown stop reason, converting to camelCase`),n=o}return n==="endTurn"&&r&&"output"in r&&r.output?.message?.content?.some(o=>"toolUse"in o)&&(n="toolUse",hs.warn("stop_reason= | adjusting to tool_use due to tool use in content blocks")),n}};function F8(t){let e=t.region.bind(t);t.region=async()=>{try{return await e()}catch(n){if(ai(n).message==="Region is missing")return M8;throw n}};let r=t.useFipsEndpoint.bind(t);t.useFipsEndpoint=async()=>{try{return await r()}catch(n){if(ai(n).message==="Region is missing")return j8;throw n}}}function bl(t){return!!t._zod}function Jn(t,e){return bl(t)?ba(t,e):t.safeParse(e)}function zv(t){var e,r;if(!t)return;let n;if(bl(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function Oj(t){var e;if(bl(t)){let s=(e=t._zod)===null||e===void 0?void 0:e.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let o=t.value;if(o!==void 0)return o}var fS="2025-11-25";var Pj=[fS,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],To="io.modelcontextprotocol/related-task",jv="2.0",ko=MI(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Cj=tt([A(),We().int()]),Rj=A(),G8=un({ttl:tt([We(),Yp()]).optional(),pollInterval:We().optional()}),mS=un({taskId:A()}),K8=un({progressToken:Cj.optional(),[To]:mS.optional()}),Ur=un({task:G8.optional(),_meta:K8.optional()}),Wt=U({method:A(),params:Ur.optional()}),Ja=un({_meta:U({[To]:ie(mS)}).passthrough().optional()}),kn=U({method:A(),params:Ja.optional()}),cr=un({_meta:un({[To]:mS.optional()}).optional()}),Dv=tt([A(),We().int()]),Nj=U({jsonrpc:se(jv),id:Dv,...Wt.shape}).strict(),hS=t=>Nj.safeParse(t).success,zj=U({jsonrpc:se(jv),...kn.shape}).strict(),Mj=t=>zj.safeParse(t).success,jj=U({jsonrpc:se(jv),id:Dv,result:cr}).strict(),$f=t=>jj.safeParse(t).success,be;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(be||(be={}));var Dj=U({jsonrpc:se(jv),id:Dv,error:U({code:We().int(),message:A(),data:ie(ft())})}).strict(),Lj=t=>Dj.safeParse(t).success,BDe=tt([Nj,zj,jj,Dj]),Xa=cr.strict(),H8=Ja.extend({requestId:Dv,reason:A().optional()}),Lv=kn.extend({method:se("notifications/cancelled"),params:H8}),W8=U({src:A(),mimeType:A().optional(),sizes:Re(A()).optional()}),If=U({icons:Re(W8).optional()}),wl=U({name:A(),title:A().optional()}),Uj=wl.extend({...wl.shape,...If.shape,version:A(),websiteUrl:A().optional()}),J8=Qp(U({applyDefaults:Nt().optional()}),bt(A(),ft())),X8=sv(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Qp(U({form:J8.optional(),url:ko.optional()}),bt(A(),ft()).optional())),Y8=U({list:ie(U({}).passthrough()),cancel:ie(U({}).passthrough()),requests:ie(U({sampling:ie(U({createMessage:ie(U({}).passthrough())}).passthrough()),elicitation:ie(U({create:ie(U({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),Q8=U({list:ie(U({}).passthrough()),cancel:ie(U({}).passthrough()),requests:ie(U({tools:ie(U({call:ie(U({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),eJ=U({experimental:bt(A(),ko).optional(),sampling:U({context:ko.optional(),tools:ko.optional()}).optional(),elicitation:X8.optional(),roots:U({listChanged:Nt().optional()}).optional(),tasks:ie(Y8)}),tJ=Ur.extend({protocolVersion:A(),capabilities:eJ,clientInfo:Uj}),rJ=Wt.extend({method:se("initialize"),params:tJ});var nJ=U({experimental:bt(A(),ko).optional(),logging:ko.optional(),completions:ko.optional(),prompts:ie(U({listChanged:ie(Nt())})),resources:U({subscribe:Nt().optional(),listChanged:Nt().optional()}).optional(),tools:U({listChanged:Nt().optional()}).optional(),tasks:ie(Q8)}).passthrough(),gS=cr.extend({protocolVersion:A(),capabilities:nJ,serverInfo:Uj,instructions:A().optional()}),oJ=kn.extend({method:se("notifications/initialized")});var Uv=Wt.extend({method:se("ping")}),iJ=U({progress:We(),total:ie(We()),message:ie(A())}),sJ=U({...Ja.shape,...iJ.shape,progressToken:Cj}),Fv=kn.extend({method:se("notifications/progress"),params:sJ}),aJ=Ur.extend({cursor:Rj.optional()}),Sf=Wt.extend({params:aJ.optional()}),kf=cr.extend({nextCursor:ie(Rj)}),Tf=U({taskId:A(),status:zt(["working","input_required","completed","failed","cancelled"]),ttl:tt([We(),Yp()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:ie(We()),statusMessage:ie(A())}),Ya=cr.extend({task:Tf}),cJ=Ja.merge(Tf),Ef=kn.extend({method:se("notifications/tasks/status"),params:cJ}),Bv=Wt.extend({method:se("tasks/get"),params:Ur.extend({taskId:A()})}),Zv=cr.merge(Tf),qv=Wt.extend({method:se("tasks/result"),params:Ur.extend({taskId:A()})}),Vv=Sf.extend({method:se("tasks/list")}),Gv=kf.extend({tasks:Re(Tf)}),Fj=Wt.extend({method:se("tasks/cancel"),params:Ur.extend({taskId:A()})}),Bj=cr.merge(Tf),Zj=U({uri:A(),mimeType:ie(A()),_meta:bt(A(),ft()).optional()}),qj=Zj.extend({text:A()}),_S=A().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Vj=Zj.extend({blob:_S}),xl=U({audience:Re(zt(["user","assistant"])).optional(),priority:We().min(0).max(1).optional(),lastModified:il.datetime({offset:!0}).optional()}),Gj=U({...wl.shape,...If.shape,uri:A(),description:ie(A()),mimeType:ie(A()),annotations:xl.optional(),_meta:ie(un({}))}),uJ=U({...wl.shape,...If.shape,uriTemplate:A(),description:ie(A()),mimeType:ie(A()),annotations:xl.optional(),_meta:ie(un({}))}),lJ=Sf.extend({method:se("resources/list")}),yS=kf.extend({resources:Re(Gj)}),dJ=Sf.extend({method:se("resources/templates/list")}),vS=kf.extend({resourceTemplates:Re(uJ)}),bS=Ur.extend({uri:A()}),pJ=bS,fJ=Wt.extend({method:se("resources/read"),params:pJ}),wS=cr.extend({contents:Re(tt([qj,Vj]))}),mJ=kn.extend({method:se("notifications/resources/list_changed")}),hJ=bS,gJ=Wt.extend({method:se("resources/subscribe"),params:hJ}),_J=bS,yJ=Wt.extend({method:se("resources/unsubscribe"),params:_J}),vJ=Ja.extend({uri:A()}),bJ=kn.extend({method:se("notifications/resources/updated"),params:vJ}),wJ=U({name:A(),description:ie(A()),required:ie(Nt())}),xJ=U({...wl.shape,...If.shape,description:ie(A()),arguments:ie(Re(wJ)),_meta:ie(un({}))}),$J=Sf.extend({method:se("prompts/list")}),xS=kf.extend({prompts:Re(xJ)}),IJ=Ur.extend({name:A(),arguments:bt(A(),A()).optional()}),SJ=Wt.extend({method:se("prompts/get"),params:IJ}),$S=U({type:se("text"),text:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),IS=U({type:se("image"),data:_S,mimeType:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),SS=U({type:se("audio"),data:_S,mimeType:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),kJ=U({type:se("tool_use"),name:A(),id:A(),input:U({}).passthrough(),_meta:ie(U({}).passthrough())}).passthrough(),TJ=U({type:se("resource"),resource:tt([qj,Vj]),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),EJ=Gj.extend({type:se("resource_link")}),kS=tt([$S,IS,SS,EJ,TJ]),AJ=U({role:zt(["user","assistant"]),content:kS}),TS=cr.extend({description:ie(A()),messages:Re(AJ)}),OJ=kn.extend({method:se("notifications/prompts/list_changed")}),PJ=U({title:A().optional(),readOnlyHint:Nt().optional(),destructiveHint:Nt().optional(),idempotentHint:Nt().optional(),openWorldHint:Nt().optional()}),CJ=U({taskSupport:zt(["required","optional","forbidden"]).optional()}),Kj=U({...wl.shape,...If.shape,description:A().optional(),inputSchema:U({type:se("object"),properties:bt(A(),ko).optional(),required:Re(A()).optional()}).catchall(ft()),outputSchema:U({type:se("object"),properties:bt(A(),ko).optional(),required:Re(A()).optional()}).catchall(ft()).optional(),annotations:ie(PJ),execution:ie(CJ),_meta:bt(A(),ft()).optional()}),RJ=Sf.extend({method:se("tools/list")}),ES=kf.extend({tools:Re(Kj)}),$l=cr.extend({content:Re(kS).default([]),structuredContent:bt(A(),ft()).optional(),isError:ie(Nt())}),ZDe=$l.or(cr.extend({toolResult:ft()})),NJ=Ur.extend({name:A(),arguments:ie(bt(A(),ft()))}),zJ=Wt.extend({method:se("tools/call"),params:NJ}),MJ=kn.extend({method:se("notifications/tools/list_changed")}),Hj=zt(["debug","info","notice","warning","error","critical","alert","emergency"]),jJ=Ur.extend({level:Hj}),DJ=Wt.extend({method:se("logging/setLevel"),params:jJ}),LJ=Ja.extend({level:Hj,logger:A().optional(),data:ft()}),UJ=kn.extend({method:se("notifications/message"),params:LJ}),FJ=U({name:A().optional()}),BJ=U({hints:ie(Re(FJ)),costPriority:ie(We().min(0).max(1)),speedPriority:ie(We().min(0).max(1)),intelligencePriority:ie(We().min(0).max(1))}),ZJ=U({mode:ie(zt(["auto","required","none"]))}),qJ=U({type:se("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:Re(kS).default([]),structuredContent:U({}).passthrough().optional(),isError:ie(Nt()),_meta:ie(U({}).passthrough())}).passthrough(),VJ=ov("type",[$S,IS,SS]),Mv=ov("type",[$S,IS,SS,kJ,qJ]),GJ=U({role:zt(["user","assistant"]),content:tt([Mv,Re(Mv)]),_meta:ie(U({}).passthrough())}).passthrough(),KJ=Ur.extend({messages:Re(GJ),modelPreferences:BJ.optional(),systemPrompt:A().optional(),includeContext:zt(["none","thisServer","allServers"]).optional(),temperature:We().optional(),maxTokens:We().int(),stopSequences:Re(A()).optional(),metadata:ko.optional(),tools:ie(Re(Kj)),toolChoice:ie(ZJ)}),AS=Wt.extend({method:se("sampling/createMessage"),params:KJ}),OS=cr.extend({model:A(),stopReason:ie(zt(["endTurn","stopSequence","maxTokens"]).or(A())),role:zt(["user","assistant"]),content:VJ}),HJ=cr.extend({model:A(),stopReason:ie(zt(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:zt(["user","assistant"]),content:tt([Mv,Re(Mv)])}),WJ=U({type:se("boolean"),title:A().optional(),description:A().optional(),default:Nt().optional()}),JJ=U({type:se("string"),title:A().optional(),description:A().optional(),minLength:We().optional(),maxLength:We().optional(),format:zt(["email","uri","date","date-time"]).optional(),default:A().optional()}),XJ=U({type:zt(["number","integer"]),title:A().optional(),description:A().optional(),minimum:We().optional(),maximum:We().optional(),default:We().optional()}),YJ=U({type:se("string"),title:A().optional(),description:A().optional(),enum:Re(A()),default:A().optional()}),QJ=U({type:se("string"),title:A().optional(),description:A().optional(),oneOf:Re(U({const:A(),title:A()})),default:A().optional()}),e7=U({type:se("string"),title:A().optional(),description:A().optional(),enum:Re(A()),enumNames:Re(A()).optional(),default:A().optional()}),t7=tt([YJ,QJ]),r7=U({type:se("array"),title:A().optional(),description:A().optional(),minItems:We().optional(),maxItems:We().optional(),items:U({type:se("string"),enum:Re(A())}),default:Re(A()).optional()}),n7=U({type:se("array"),title:A().optional(),description:A().optional(),minItems:We().optional(),maxItems:We().optional(),items:U({anyOf:Re(U({const:A(),title:A()}))}),default:Re(A()).optional()}),o7=tt([r7,n7]),i7=tt([e7,t7,o7]),s7=tt([i7,WJ,JJ,XJ]),a7=Ur.extend({mode:se("form").optional(),message:A(),requestedSchema:U({type:se("object"),properties:bt(A(),s7),required:Re(A()).optional()})}),c7=Ur.extend({mode:se("url"),message:A(),elicitationId:A(),url:A().url()}),u7=tt([a7,c7]),PS=Wt.extend({method:se("elicitation/create"),params:u7}),l7=Ja.extend({elicitationId:A()}),d7=kn.extend({method:se("notifications/elicitation/complete"),params:l7}),CS=cr.extend({action:zt(["accept","decline","cancel"]),content:sv(t=>t===null?void 0:t,bt(A(),tt([A(),We(),Nt(),Re(A())])).optional())}),p7=U({type:se("ref/resource"),uri:A()});var f7=U({type:se("ref/prompt"),name:A()}),m7=Ur.extend({ref:tt([f7,p7]),argument:U({name:A(),value:A()}),context:U({arguments:bt(A(),A()).optional()}).optional()}),h7=Wt.extend({method:se("completion/complete"),params:m7});var RS=cr.extend({completion:un({values:Re(A()).max(100),total:ie(We().int()),hasMore:ie(Nt())})}),g7=U({uri:A().startsWith("file://"),name:A().optional(),_meta:bt(A(),ft()).optional()}),_7=Wt.extend({method:se("roots/list")}),y7=cr.extend({roots:Re(g7)}),v7=kn.extend({method:se("notifications/roots/list_changed")}),qDe=tt([Uv,rJ,h7,DJ,SJ,$J,lJ,dJ,fJ,gJ,yJ,zJ,RJ,Bv,qv,Vv]),VDe=tt([Lv,Fv,oJ,v7,Ef]),GDe=tt([Xa,OS,HJ,CS,y7,Zv,Gv,Ya]),KDe=tt([Uv,AS,PS,_7,Bv,qv,Vv]),HDe=tt([Lv,Fv,UJ,bJ,mJ,MJ,OJ,Ef,d7]),WDe=tt([Xa,gS,RS,TS,xS,yS,vS,wS,$l,ES,Zv,Gv,Ya]),de=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===be.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new pS(o.elicitations,r)}return new t(e,r,n)}},pS=class extends de{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(be.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}};function gs(t){return t==="completed"||t==="failed"||t==="cancelled"}var b7=Symbol("Let zodToJsonSchema decide on which parser to use");var ALe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function NS(t){let e=zv(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Oj(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function zS(t,e){let r=Jn(t,e);if(!r.success)throw r.error;return r.data}var k7=6e4,Kv=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Lv,r=>{this._oncancel(r)}),this.setNotificationHandler(Fv,r=>{this._onprogress(r)}),this.setRequestHandler(Uv,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Bv,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new de(be.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(qv,async(r,n)=>{let o=async()=>{var i;let s=r.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(c.type==="response"||c.type==="error"){let u=c.message,l=u.id,d=this._requestResolvers.get(l);if(d)if(this._requestResolvers.delete(l),c.type==="response")d(u);else{let f=u,p=new de(f.error.code,f.error.message,f.error.data);d(p)}else{let f=c.type==="response"?"Response":"Error";this._onerror(new Error(`${f} handler missing for request ${l}`))}continue}await((i=this._transport)===null||i===void 0?void 0:i.send(c.message,{relatedRequestId:n.requestId}))}}let a=await this._taskStore.getTask(s,n.sessionId);if(!a)throw new de(be.InvalidParams,`Task not found: ${s}`);if(!gs(a.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(gs(a.status)){let c=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...c,_meta:{...c._meta,[To]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(Vv,async(r,n)=>{var o;try{let{tasks:i,nextCursor:s}=await this._taskStore.listTasks((o=r.params)===null||o===void 0?void 0:o.cursor,n.sessionId);return{tasks:i,nextCursor:s,_meta:{}}}catch(i){throw new de(be.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Fj,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new de(be.InvalidParams,`Task not found: ${r.params.taskId}`);if(gs(o.status))throw new de(be.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new de(be.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof de?o:new de(be.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){let r=this._requestHandlerAbortControllers.get(e.params.requestId);r?.abort(e.params.reason)}_setupTimeout(e,r,n,o,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),de.fromError(be.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,o;this._transport=e;let i=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};let s=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{s?.(c),this._onerror(c)};let a=(o=this._transport)===null||o===void 0?void 0:o.onmessage;this._transport.onmessage=(c,u)=>{a?.(c,u),$f(c)||Lj(c)?this._onresponse(c):hS(c)?this._onrequest(c,u):Mj(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let n=de.fromError(be.ConnectionClosed,"Connection closed");this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);for(let o of r.values())o(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){var n,o,i,s,a,c;let u=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,l=this._transport,d=(s=(i=(o=e.params)===null||o===void 0?void 0:o._meta)===null||i===void 0?void 0:i[To])===null||s===void 0?void 0:s.taskId;if(u===void 0){let _={jsonrpc:"2.0",id:e.id,error:{code:be.MethodNotFound,message:"Method not found"}};d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:_,timestamp:Date.now()},l?.sessionId).catch(v=>this._onerror(new Error(`Failed to enqueue error response: ${v}`))):l?.send(_).catch(v=>this._onerror(new Error(`Failed to send an error response: ${v}`)));return}let f=new AbortController;this._requestHandlerAbortControllers.set(e.id,f);let p=(a=e.params)===null||a===void 0?void 0:a.task,m=this._taskStore?this.requestTaskStore(e,l?.sessionId):void 0,h={signal:f.signal,sessionId:l?.sessionId,_meta:(c=e.params)===null||c===void 0?void 0:c._meta,sendNotification:async _=>{let v={relatedRequestId:e.id};d&&(v.relatedTask={taskId:d}),await this.notification(_,v)},sendRequest:async(_,v,b)=>{var x,k;let T={...b,relatedRequestId:e.id};d&&!T.relatedTask&&(T.relatedTask={taskId:d});let F=(k=(x=T.relatedTask)===null||x===void 0?void 0:x.taskId)!==null&&k!==void 0?k:d;return F&&m&&await m.updateTaskStatus(F,"input_required"),await this.request(_,v,T)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:d,taskStore:m,taskRequestedTtl:p?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{p&&this.assertTaskHandlerCapability(e.method)}).then(()=>u(e,h)).then(async _=>{if(f.signal.aborted)return;let v={result:_,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:v,timestamp:Date.now()},l?.sessionId):await l?.send(v)},async _=>{var v;if(f.signal.aborted)return;let b={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(_.code)?_.code:be.InternalError,message:(v=_.message)!==null&&v!==void 0?v:"Internal error",..._.data!==void 0&&{data:_.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:b,timestamp:Date.now()},l?.sessionId):await l?.send(b)}).catch(_=>this._onerror(new Error(`Failed to send response: ${_}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),$f(e))n(e);else{let s=new de(e.error.code,e.error.message,e.error.data);n(s)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if($f(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(i=!0,this._taskProgressTokens.set(a.taskId,r))}}if(i||this._progressHandlers.delete(r),$f(e))o(e);else{let s=de.fromError(e.error.code,e.error.message,e.error.data);o(s)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}async*requestStream(e,r,n){var o,i,s,a;let{task:c}=n??{};if(!c){try{yield{type:"result",result:await this.request(e,r,n)}}catch(l){yield{type:"error",error:l instanceof de?l:new de(be.InternalError,String(l))}}return}let u;try{let l=await this.request(e,Ya,n);if(l.task)u=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new de(be.InternalError,"Task creation did not return a task");for(;;){let d=await this.getTask({taskId:u},n);if(yield{type:"taskStatus",task:d},gs(d.status)){d.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)}:d.status==="failed"?yield{type:"error",error:new de(be.InternalError,`Task ${u} failed`)}:d.status==="cancelled"&&(yield{type:"error",error:new de(be.InternalError,`Task ${u} was cancelled`)});return}if(d.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)};return}let f=(s=(o=d.pollInterval)!==null&&o!==void 0?o:(i=this._options)===null||i===void 0?void 0:i.defaultTaskPollInterval)!==null&&s!==void 0?s:1e3;await new Promise(p=>setTimeout(p,f)),(a=n?.signal)===null||a===void 0||a.throwIfAborted()}}catch(l){yield{type:"error",error:l instanceof de?l:new de(be.InternalError,String(l))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{var d,f,p,m,h,_,v;let b=Z=>{l(Z)};if(!this._transport){b(new Error("Not connected"));return}if(((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(Z){b(Z);return}(f=n?.signal)===null||f===void 0||f.throwIfAborted();let x=this._requestMessageId++,k={...e,jsonrpc:"2.0",id:x};n?.onprogress&&(this._progressHandlers.set(x,n.onprogress),k.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:x}}),a&&(k.params={...k.params,task:a}),c&&(k.params={...k.params,_meta:{...((m=k.params)===null||m===void 0?void 0:m._meta)||{},[To]:c}});let T=Z=>{var oe;this._responseHandlers.delete(x),this._progressHandlers.delete(x),this._cleanupTimeout(x),(oe=this._transport)===null||oe===void 0||oe.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:x,reason:String(Z)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(wt=>this._onerror(new Error(`Failed to send cancellation: ${wt}`)));let Q=Z instanceof de?Z:new de(be.RequestTimeout,String(Z));l(Q)};this._responseHandlers.set(x,Z=>{var oe;if(!(!((oe=n?.signal)===null||oe===void 0)&&oe.aborted)){if(Z instanceof Error)return l(Z);try{let Q=Jn(r,Z.result);Q.success?u(Q.data):l(Q.error)}catch(Q){l(Q)}}}),(h=n?.signal)===null||h===void 0||h.addEventListener("abort",()=>{var Z;T((Z=n?.signal)===null||Z===void 0?void 0:Z.reason)});let F=(_=n?.timeout)!==null&&_!==void 0?_:k7,J=()=>T(de.fromError(be.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(x,F,n?.maxTotalTimeout,J,(v=n?.resetTimeoutOnProgress)!==null&&v!==void 0?v:!1);let w=c?.taskId;if(w){let Z=oe=>{let Q=this._responseHandlers.get(x);Q?Q(oe):this._onerror(new Error(`Response handler missing for side-channeled request ${x}`))};this._requestResolvers.set(x,Z),this._enqueueTaskMessage(w,{type:"request",message:k,timestamp:Date.now()}).catch(oe=>{this._cleanupTimeout(x),l(oe)})}else this._transport.send(k,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(Z=>{this._cleanupTimeout(x),l(Z)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Zv,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Gv,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Bj,r)}async notification(e,r){var n,o,i,s,a;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let c=(n=r?.relatedTask)===null||n===void 0?void 0:n.taskId;if(c){let f={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...((o=e.params)===null||o===void 0?void 0:o._meta)||{},[To]:r.relatedTask}}};await this._enqueueTaskMessage(c,{type:"notification",message:f,timestamp:Date.now()});return}if(((s=(i=this._options)===null||i===void 0?void 0:i.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var f,p;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let m={...e,jsonrpc:"2.0"};r?.relatedTask&&(m={...m,params:{...m.params,_meta:{...((f=m.params)===null||f===void 0?void 0:f._meta)||{},[To]:r.relatedTask}}}),(p=this._transport)===null||p===void 0||p.send(m,r).catch(h=>this._onerror(h))});return}let d={...e,jsonrpc:"2.0"};r?.relatedTask&&(d={...d,params:{...d.params,_meta:{...((a=d.params)===null||a===void 0?void 0:a._meta)||{},[To]:r.relatedTask}}}),await this._transport.send(d,r)}setRequestHandler(e,r){let n=NS(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let s=zS(e,o);return Promise.resolve(r(s,i))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=NS(e);this._notificationHandlers.set(n,o=>{let i=zS(e,o);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){var o;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=(o=this._options)===null||o===void 0?void 0:o.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,i)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&hS(o.message)){let i=o.message.id,s=this._requestResolvers.get(i);s?(s(new de(be.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){var n,o,i;let s=(o=(n=this._options)===null||n===void 0?void 0:n.defaultTaskPollInterval)!==null&&o!==void 0?o:1e3;try{let a=await((i=this._taskStore)===null||i===void 0?void 0:i.getTask(e));a?.pollInterval&&(s=a.pollInterval)}catch{}return new Promise((a,c)=>{if(r.aborted){c(new de(be.InvalidRequest,"Request cancelled"));return}let u=setTimeout(a,s);r.addEventListener("abort",()=>{clearTimeout(u),c(new de(be.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new de(be.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await n.storeTaskResult(o,i,s,r);let a=await n.getTask(o,r);if(a){let c=Ef.parse({method:"notifications/tasks/status",params:a});await this.notification(c),gs(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,s)=>{let a=await n.getTask(o,r);if(!a)throw new de(be.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(gs(a.status))throw new de(be.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,s,r);let c=await n.getTask(o,r);if(c){let u=Ef.parse({method:"notifications/tasks/status",params:c});await this.notification(u),gs(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Wj(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Jj(t,e){let r={...t};for(let n in e){let o=n,i=e[o];if(i===void 0)continue;let s=r[o];Wj(s)&&Wj(i)?r[o]={...s,...i}:r[o]=i}return r}var MU=mn(bT(),1),jU=mn(zU(),1);function gre(){let t=new MU.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,jU.default)(t),t}var Ob=class{constructor(e){this._ajv=e??gre()}getValidator(e){var r;let n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return o=>n(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Pb=class{constructor(e){this._client=e}async*callToolStream(e,r=$l,n){var o;let i=this._client,s={...n,task:(o=n?.task)!==null&&o!==void 0?o:i.isToolTask(e.name)?{}:void 0},a=i.requestStream({method:"tools/call",params:e},r,s),c=i.getToolOutputValidator(e.name);for await(let u of a){if(u.type==="result"&&c){let l=u.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new de(be.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{let d=c(l.structuredContent);if(!d.valid){yield{type:"error",error:new de(be.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof de){yield{type:"error",error:d};return}yield{type:"error",error:new de(be.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield u}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function DU(t,e,r){var n;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!(!((n=t.tools)===null||n===void 0)&&n.call))throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function LU(t,e,r){var n,o;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!(!((n=t.sampling)===null||n===void 0)&&n.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!(!((o=t.elicitation)===null||o===void 0)&&o.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function Cb(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let o of Object.keys(n)){let i=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[o]=i.default),r[o]!==void 0&&Cb(i,r[o])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)Cb(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)Cb(r,e)}}function _re(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var Rb=class extends Kv{constructor(e,r){var n,o;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._jsonSchemaValidator=(o=r?.jsonSchemaValidator)!==null&&o!==void 0?o:new Ob}get experimental(){return this._experimental||(this._experimental={tasks:new Pb(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Jj(this._capabilities,e)}setRequestHandler(e,r){var n,o,i;let s=zv(e),a=s?.method;if(!a)throw new Error("Schema is missing a method literal");let c;if(bl(a)){let l=a,d=(n=l._zod)===null||n===void 0?void 0:n.def;c=(o=d?.value)!==null&&o!==void 0?o:l.value}else{let l=a,d=l._def;c=(i=d?.value)!==null&&i!==void 0?i:l.value}if(typeof c!="string")throw new Error("Schema method literal must be a string");let u=c;if(u==="elicitation/create"){let l=async(d,f)=>{var p,m,h;let _=Jn(PS,d);if(!_.success){let Z=_.error instanceof Error?_.error.message:String(_.error);throw new de(be.InvalidParams,`Invalid elicitation request: ${Z}`)}let{params:v}=_.data,b=(p=v.mode)!==null&&p!==void 0?p:"form",{supportsFormMode:x,supportsUrlMode:k}=_re(this._capabilities.elicitation);if(b==="form"&&!x)throw new de(be.InvalidParams,"Client does not support form-mode elicitation requests");if(b==="url"&&!k)throw new de(be.InvalidParams,"Client does not support URL-mode elicitation requests");let T=await Promise.resolve(r(d,f));if(v.task){let Z=Jn(Ya,T);if(!Z.success){let oe=Z.error instanceof Error?Z.error.message:String(Z.error);throw new de(be.InvalidParams,`Invalid task creation result: ${oe}`)}return Z.data}let F=Jn(CS,T);if(!F.success){let Z=F.error instanceof Error?F.error.message:String(F.error);throw new de(be.InvalidParams,`Invalid elicitation result: ${Z}`)}let J=F.data,w=b==="form"?v.requestedSchema:void 0;if(b==="form"&&J.action==="accept"&&J.content&&w&&!((h=(m=this._capabilities.elicitation)===null||m===void 0?void 0:m.form)===null||h===void 0)&&h.applyDefaults)try{Cb(w,J.content)}catch{}return J};return super.setRequestHandler(e,l)}if(u==="sampling/createMessage"){let l=async(d,f)=>{let p=Jn(AS,d);if(!p.success){let v=p.error instanceof Error?p.error.message:String(p.error);throw new de(be.InvalidParams,`Invalid sampling request: ${v}`)}let{params:m}=p.data,h=await Promise.resolve(r(d,f));if(m.task){let v=Jn(Ya,h);if(!v.success){let b=v.error instanceof Error?v.error.message:String(v.error);throw new de(be.InvalidParams,`Invalid task creation result: ${b}`)}return v.data}let _=Jn(OS,h);if(!_.success){let v=_.error instanceof Error?_.error.message:String(_.error);throw new de(be.InvalidParams,`Invalid sampling result: ${v}`)}return _.data};return super.setRequestHandler(e,l)}return super.setRequestHandler(e,r)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:fS,capabilities:this._capabilities,clientInfo:this._clientInfo}},gS,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!Pj.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,o,i,s;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){var r,n;DU((n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests,e,"Server")}assertTaskHandlerCapability(e){var r;this._capabilities&&LU((r=this._capabilities.tasks)===null||r===void 0?void 0:r.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Xa,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},RS,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Xa,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},TS,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},xS,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},yS,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},vS,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},wS,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Xa,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Xa,r)}async callTool(e,r=$l,n){if(this.isToolTaskRequired(e.name))throw new de(be.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},r,n),i=this.getToolOutputValidator(e.name);if(i){if(!o.structuredContent&&!o.isError)throw new de(be.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let s=i(o.structuredContent);if(!s.valid)throw new de(be.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof de?s:new de(be.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return o}isToolTask(e){var r,n,o,i;return!((i=(o=(n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests)===null||o===void 0?void 0:o.tools)===null||i===void 0)&&i.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){var r;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let n of e){if(n.outputSchema){let i=this._jsonSchemaValidator.getValidator(n.outputSchema);this._cachedToolOutputValidators.set(n.name,i)}let o=(r=n.execution)===null||r===void 0?void 0:r.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(n.name),o==="required"&&this._cachedRequiredTaskTools.add(n.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},ES,r);return this.cacheToolMetadata(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Nb=class extends fl{name;description;toolSpec;mcpClient;constructor(e){super(),this.name=e.name,this.description=e.description,this.toolSpec={name:e.name,description:e.description,inputSchema:e.inputSchema},this.mcpClient=e.client}async*stream(e){let{toolUseId:r,input:n}=e.toolUse;try{let o=await this.mcpClient.callTool(this,n);if(!this._isMcpToolResult(o))throw new Error("Invalid tool result from MCP Client: missing content array");let i=o.content.map(s=>this._isMcpTextContent(s)?new mt(s.text):new Ha({json:s}));return i.length===0&&i.push(new mt("Tool execution completed successfully with no output.")),new Ht({toolUseId:r,status:o.isError?"error":"success",content:i})}catch(o){return lS(o,r)}}_isMcpToolResult(e){return typeof e!="object"||e===null?!1:Array.isArray(e.content)}_isMcpTextContent(e){if(typeof e!="object"||e===null)return!1;let r=e;return r.type==="text"&&typeof r.text=="string"}};var xf=class{_clientName;_clientVersion;_transport;_connected;_client;constructor(e){this._clientName=e.applicationName||"strands-agents-ts-sdk",this._clientVersion=e.applicationVersion||"0.0.1",this._transport=e.transport,this._connected=!1,this._client=new Rb({name:this._clientName,version:this._clientVersion})}get client(){return this._client}async connect(e=!1){this._connected&&!e||(this._connected&&e&&(await this._client.close(),this._connected=!1),await this._client.connect(this._transport),this._connected=!0)}async disconnect(){await this._client.close(),await this._transport.close(),this._connected=!1}async listTools(){return await this.connect(),(await this._client.listTools()).tools.map(r=>new Nb({name:r.name,description:r.description??"",inputSchema:r.inputSchema,client:this}))}async callTool(e,r){if(await this.connect(),r==null)return await this.callTool(e,{});if(typeof r!="object"||Array.isArray(r))throw new Error(`MCP Protocol Error: Tool arguments must be a JSON Object (named parameters). Received: ${Array.isArray(r)?"Array":typeof r}`);return await this._client.callTool({name:e.name,arguments:r})}};var UU=({model:t})=>{let e=new ms({region:"us-east-1",modelId:t,maxTokens:4096,temperature:.7});return new bf({model:e})};var yre=async({message:t="\u3053\u3093\u306B\u3061\u306F\uFF01",model:e="us.amazon.nova-micro-v1:0"},r)=>{let n=UU({model:e});for await(let o of n.stream(t))o.type==="modelContentBlockDeltaEvent"&&o.delta.type==="textDelta"&&r.write(o.delta.text)},vre=awslambda.streamifyResponse(async(t,e)=>{wm.debug("event",{event:t});let{message:r,model:n}=t.body?JSON.parse(t.body):{message:"\u3042\u306A\u305F\u306F\u8AB0\uFF1F",model:"gpt"};await yre({message:r,model:n},e),e.end()}),EBe=vre;export{EBe as default,yre as handle,vre as handler}; +/*! Bundled license information: + +@aws-lambda-powertools/logger/lib/esm/logBuffer.js: + (* v8 ignore next -- @preserve *) + +@langchain/core/dist/utils/fast-json-patch/src/helpers.js: + (*! + * https://github.com/Starcounter-Jack/JSON-Patch + * (c) 2017-2022 Joachim Wester + * MIT licensed + *) + +@langchain/core/dist/utils/sax-js/sax.js: + (*! http://mths.be/fromcodepoint v0.1.0 by @mathias *) +*/ diff --git a/agents/agent-strands/cdk.out/asset.60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321/index.mjs b/agents/agent-strands/cdk.out/asset.60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321/index.mjs new file mode 100644 index 00000000..6de2943d --- /dev/null +++ b/agents/agent-strands/cdk.out/asset.60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321/index.mjs @@ -0,0 +1,238 @@ +import { createRequire } from 'module';const require = createRequire(import.meta.url); +var FU=Object.create;var zb=Object.defineProperty;var BU=Object.getOwnPropertyDescriptor;var ZU=Object.getOwnPropertyNames;var qU=Object.getPrototypeOf,VU=Object.prototype.hasOwnProperty;var P=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),gi=(t,e)=>{for(var r in e)zb(t,r,{get:e[r],enumerable:!0})},GU=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ZU(e))!VU.call(t,o)&&o!==r&&zb(t,o,{get:()=>e[o],enumerable:!(n=BU(e,o))||n.enumerable});return t};var mn=(t,e,r)=>(r=t!=null?FU(qU(t)):{},GU(e||!t||!t.__esModule?zb(r,"default",{value:t,enumerable:!0}):r,t));var Xb=P((Kl,lc)=>{var JU=200,GT="__lodash_hash_undefined__",XU=800,YU=16,KT=9007199254740991,HT="[object Arguments]",QU="[object Array]",e4="[object AsyncFunction]",t4="[object Boolean]",r4="[object Date]",n4="[object Error]",WT="[object Function]",o4="[object GeneratorFunction]",i4="[object Map]",s4="[object Number]",a4="[object Null]",JT="[object Object]",c4="[object Proxy]",u4="[object RegExp]",l4="[object Set]",d4="[object String]",p4="[object Undefined]",f4="[object WeakMap]",m4="[object ArrayBuffer]",h4="[object DataView]",g4="[object Float32Array]",_4="[object Float64Array]",y4="[object Int8Array]",v4="[object Int16Array]",b4="[object Int32Array]",w4="[object Uint8Array]",x4="[object Uint8ClampedArray]",$4="[object Uint16Array]",I4="[object Uint32Array]",S4=/[\\^$.*+?()[\]{}|]/g,k4=/^\[object .+?Constructor\]$/,T4=/^(?:0|[1-9]\d*)$/,st={};st[g4]=st[_4]=st[y4]=st[v4]=st[b4]=st[w4]=st[x4]=st[$4]=st[I4]=!0;st[HT]=st[QU]=st[m4]=st[t4]=st[h4]=st[r4]=st[n4]=st[WT]=st[i4]=st[s4]=st[JT]=st[u4]=st[l4]=st[d4]=st[f4]=!1;var XT=typeof global=="object"&&global&&global.Object===Object&&global,E4=typeof self=="object"&&self&&self.Object===Object&&self,Jl=XT||E4||Function("return this")(),YT=typeof Kl=="object"&&Kl&&!Kl.nodeType&&Kl,Hl=YT&&typeof lc=="object"&&lc&&!lc.nodeType&&lc,QT=Hl&&Hl.exports===YT,Fb=QT&&XT.process,jT=(function(){try{var t=Hl&&Hl.require&&Hl.require("util").types;return t||Fb&&Fb.binding&&Fb.binding("util")}catch{}})(),DT=jT&&jT.isTypedArray;function A4(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function O4(t,e){for(var r=-1,n=Array(t);++r-1}function Y4(t,e){var r=this.__data__,n=pm(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}jo.prototype.clear=H4;jo.prototype.delete=W4;jo.prototype.get=J4;jo.prototype.has=X4;jo.prototype.set=Y4;function dc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(i=t.length>3&&typeof i=="function"?(o--,i):void 0,s&&T2(r[0],r[1],s)&&(i=o<3?void 0:i,o=1),e=Object(e);++n-1&&t%1==0&&t0){if(++e>=XU)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function z2(t){if(t!=null){try{return dm.call(t)}catch{}try{return t+""}catch{}}return""}function hm(t,e){return t===e||t!==t&&e!==e}var Vb=VT((function(){return arguments})())?VT:function(t){return Xl(t)&&Mo.call(t,"callee")&&!D4.call(t,"callee")},Gb=Array.isArray;function Wb(t){return t!=null&&aE(t.length)&&!Jb(t)}function M2(t){return Xl(t)&&Wb(t)}var sE=U4||F2;function Jb(t){if(!Ps(t))return!1;var e=fm(t);return e==WT||e==o4||e==e4||e==c4}function aE(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=KT}function Ps(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Xl(t){return t!=null&&typeof t=="object"}function j2(t){if(!Xl(t)||fm(t)!=JT)return!1;var e=tE(t);if(e===null)return!0;var r=Mo.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&dm.call(r)==M4}var cE=DT?P4(DT):f2;function D2(t){return x2(t,uE(t))}function uE(t){return Wb(t)?u2(t,!0):m2(t)}var L2=$2(function(t,e,r){nE(t,e,r)});function U2(t){return function(){return t}}function lE(t){return t}function F2(){return!1}lc.exports=L2});var xA=P((_de,wA)=>{"use strict";wA.exports=function(t,e){if(typeof t!="string")throw new TypeError("Expected a string");return e=typeof e>"u"?"_":e,t.replace(/([a-z\d])([A-Z])/g,"$1"+e+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+e+"$2").toLowerCase()}});var AA=P((yde,Zw)=>{"use strict";var dB=/[\p{Lu}]/u,pB=/[\p{Ll}]/u,$A=/^[\p{Lu}](?![\p{Lu}])/gu,kA=/([\p{Alpha}\p{N}_]|$)/u,TA=/[_.\- ]+/,fB=new RegExp("^"+TA.source),IA=new RegExp(TA.source+kA.source,"gu"),SA=new RegExp("\\d+"+kA.source,"gu"),mB=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let s=0;s($A.lastIndex=0,t.replace($A,r=>e(r))),gB=(t,e)=>(IA.lastIndex=0,SA.lastIndex=0,t.replace(IA,(r,n)=>e(n)).replace(SA,r=>e(r))),EA=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(t)?t=t.map(i=>i.trim()).filter(i=>i.length).join("-"):t=t.trim(),t.length===0)return"";let r=e.locale===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(e.locale),n=e.locale===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(e.locale);return t.length===1?e.pascalCase?n(t):r(t):(t!==r(t)&&(t=mB(t,r,n)),t=t.replace(fB,""),e.preserveConsecutiveUppercase?t=hB(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),gB(t,n))};Zw.exports=EA;Zw.exports.default=EA});var cP=P((ime,Ix)=>{"use strict";var v6=Object.prototype.hasOwnProperty,hr="~";function Cd(){}Object.create&&(Cd.prototype=Object.create(null),new Cd().__proto__||(hr=!1));function b6(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function aP(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new b6(r,n||t,o),s=hr?hr+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],i]:t._events[s].push(i):(t._events[s]=i,t._eventsCount++),t}function wh(t,e){--t._eventsCount===0?t._events=new Cd:delete t._events[e]}function tr(){this._events=new Cd,this._eventsCount=0}tr.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)v6.call(r,n)&&e.push(hr?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};tr.prototype.listeners=function(e){var r=hr?hr+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,s=new Array(i);o{"use strict";uP.exports=(t,e)=>(e=e||(()=>{}),t.then(r=>new Promise(n=>{n(e())}).then(()=>r),r=>new Promise(n=>{n(e())}).then(()=>{throw r})))});var pP=P((ame,$h)=>{"use strict";var w6=lP(),xh=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},dP=(t,e,r)=>new Promise((n,o)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){n(t);return}let i=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(c){o(c)}return}let s=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,a=r instanceof Error?r:new xh(s);typeof t.cancel=="function"&&t.cancel(),o(a)},e);w6(t.then(n,o),()=>{clearTimeout(i)})});$h.exports=dP;$h.exports.default=dP;$h.exports.TimeoutError=xh});var fP=P(Sx=>{"use strict";Object.defineProperty(Sx,"__esModule",{value:!0});function x6(t,e,r){let n=0,o=t.length;for(;o>0;){let i=o/2|0,s=n+i;r(t[s],e)<=0?(n=++s,o-=i+1):o=i}return n}Sx.default=x6});var mP=P(Tx=>{"use strict";Object.defineProperty(Tx,"__esModule",{value:!0});var $6=fP(),kx=class{constructor(){this._queue=[]}enqueue(e,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let o=$6.default(this._queue,n,(i,s)=>s.priority-i.priority);this._queue.splice(o,0,n)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this._queue.length}};Tx.default=kx});var Sh=P(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:!0});var I6=cP(),hP=pP(),S6=mP(),Ih=()=>{},k6=new hP.TimeoutError,Ex=class extends I6{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Ih,this._resolveIdle=Ih,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:S6.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(i=(o=e.interval)===null||o===void 0?void 0:o.toString())!==null&&i!==void 0?i:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||e.interval===0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=e.throwOnTimeout===!0,this._isPaused=e.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),e&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,r={}){return new Promise((n,o)=>{let i=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&r.timeout===void 0?e():hP.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(k6)});n(await s)}catch(s){o(s)}this._next()};this._queue.enqueue(i,r),this._tryToStartAnother(),this.emit("add")})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(e=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}};Ax.default=Ex});var Nd=P((mme,gP)=>{"use strict";var E6="2.0.0",A6=Number.MAX_SAFE_INTEGER||9007199254740991,O6=16,P6=250,C6=["major","premajor","minor","preminor","patch","prepatch","prerelease"];gP.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:O6,MAX_SAFE_BUILD_LENGTH:P6,MAX_SAFE_INTEGER:A6,RELEASE_TYPES:C6,SEMVER_SPEC_VERSION:E6,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var zd=P((hme,_P)=>{"use strict";var R6=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};_P.exports=R6});var lu=P((fo,yP)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Cx,MAX_SAFE_BUILD_LENGTH:N6,MAX_LENGTH:z6}=Nd(),M6=zd();fo=yP.exports={};var j6=fo.re=[],D6=fo.safeRe=[],X=fo.src=[],L6=fo.safeSrc=[],Y=fo.t={},U6=0,Rx="[a-zA-Z0-9-]",F6=[["\\s",1],["\\d",z6],[Rx,N6]],B6=t=>{for(let[e,r]of F6)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Ie=(t,e,r)=>{let n=B6(e),o=U6++;M6(t,o,e),Y[t]=o,X[o]=e,L6[o]=n,j6[o]=new RegExp(e,r?"g":void 0),D6[o]=new RegExp(n,r?"g":void 0)};Ie("NUMERICIDENTIFIER","0|[1-9]\\d*");Ie("NUMERICIDENTIFIERLOOSE","\\d+");Ie("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Rx}*`);Ie("MAINVERSION",`(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})`);Ie("MAINVERSIONLOOSE",`(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})`);Ie("PRERELEASEIDENTIFIER",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIER]})`);Ie("PRERELEASEIDENTIFIERLOOSE",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIERLOOSE]})`);Ie("PRERELEASE",`(?:-(${X[Y.PRERELEASEIDENTIFIER]}(?:\\.${X[Y.PRERELEASEIDENTIFIER]})*))`);Ie("PRERELEASELOOSE",`(?:-?(${X[Y.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${X[Y.PRERELEASEIDENTIFIERLOOSE]})*))`);Ie("BUILDIDENTIFIER",`${Rx}+`);Ie("BUILD",`(?:\\+(${X[Y.BUILDIDENTIFIER]}(?:\\.${X[Y.BUILDIDENTIFIER]})*))`);Ie("FULLPLAIN",`v?${X[Y.MAINVERSION]}${X[Y.PRERELEASE]}?${X[Y.BUILD]}?`);Ie("FULL",`^${X[Y.FULLPLAIN]}$`);Ie("LOOSEPLAIN",`[v=\\s]*${X[Y.MAINVERSIONLOOSE]}${X[Y.PRERELEASELOOSE]}?${X[Y.BUILD]}?`);Ie("LOOSE",`^${X[Y.LOOSEPLAIN]}$`);Ie("GTLT","((?:<|>)?=?)");Ie("XRANGEIDENTIFIERLOOSE",`${X[Y.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Ie("XRANGEIDENTIFIER",`${X[Y.NUMERICIDENTIFIER]}|x|X|\\*`);Ie("XRANGEPLAIN",`[v=\\s]*(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:${X[Y.PRERELEASE]})?${X[Y.BUILD]}?)?)?`);Ie("XRANGEPLAINLOOSE",`[v=\\s]*(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:${X[Y.PRERELEASELOOSE]})?${X[Y.BUILD]}?)?)?`);Ie("XRANGE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAIN]}$`);Ie("XRANGELOOSE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAINLOOSE]}$`);Ie("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Cx}})(?:\\.(\\d{1,${Cx}}))?(?:\\.(\\d{1,${Cx}}))?`);Ie("COERCE",`${X[Y.COERCEPLAIN]}(?:$|[^\\d])`);Ie("COERCEFULL",X[Y.COERCEPLAIN]+`(?:${X[Y.PRERELEASE]})?(?:${X[Y.BUILD]})?(?:$|[^\\d])`);Ie("COERCERTL",X[Y.COERCE],!0);Ie("COERCERTLFULL",X[Y.COERCEFULL],!0);Ie("LONETILDE","(?:~>?)");Ie("TILDETRIM",`(\\s*)${X[Y.LONETILDE]}\\s+`,!0);fo.tildeTrimReplace="$1~";Ie("TILDE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAIN]}$`);Ie("TILDELOOSE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAINLOOSE]}$`);Ie("LONECARET","(?:\\^)");Ie("CARETTRIM",`(\\s*)${X[Y.LONECARET]}\\s+`,!0);fo.caretTrimReplace="$1^";Ie("CARET",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAIN]}$`);Ie("CARETLOOSE",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAINLOOSE]}$`);Ie("COMPARATORLOOSE",`^${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]})$|^$`);Ie("COMPARATOR",`^${X[Y.GTLT]}\\s*(${X[Y.FULLPLAIN]})$|^$`);Ie("COMPARATORTRIM",`(\\s*)${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]}|${X[Y.XRANGEPLAIN]})`,!0);fo.comparatorTrimReplace="$1$2$3";Ie("HYPHENRANGE",`^\\s*(${X[Y.XRANGEPLAIN]})\\s+-\\s+(${X[Y.XRANGEPLAIN]})\\s*$`);Ie("HYPHENRANGELOOSE",`^\\s*(${X[Y.XRANGEPLAINLOOSE]})\\s+-\\s+(${X[Y.XRANGEPLAINLOOSE]})\\s*$`);Ie("STAR","(<|>)?=?\\s*\\*");Ie("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Ie("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Th=P((gme,vP)=>{"use strict";var Z6=Object.freeze({loose:!0}),q6=Object.freeze({}),V6=t=>t?typeof t!="object"?Z6:t:q6;vP.exports=V6});var Nx=P((_me,xP)=>{"use strict";var bP=/^[0-9]+$/,wP=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:twP(e,t);xP.exports={compareIdentifiers:wP,rcompareIdentifiers:G6}});var rr=P((yme,IP)=>{"use strict";var Eh=zd(),{MAX_LENGTH:$P,MAX_SAFE_INTEGER:Ah}=Nd(),{safeRe:Oh,t:Ph}=lu(),K6=Th(),{compareIdentifiers:zx}=Nx(),Mx=class t{constructor(e,r){if(r=K6(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>$P)throw new TypeError(`version is longer than ${$P} characters`);Eh("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Oh[Ph.LOOSE]:Oh[Ph.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Ah||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ah||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ah||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let i=+o;if(i>=0&&ie.major?1:this.minore.minor?1:this.patche.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(Eh("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return zx(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(Eh("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return zx(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?Oh[Ph.PRERELEASELOOSE]:Oh[Ph.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let i=[r,o];n===!1&&(i=[r]),zx(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};IP.exports=Mx});var pa=P((vme,kP)=>{"use strict";var SP=rr(),H6=(t,e,r=!1)=>{if(t instanceof SP)return t;try{return new SP(t,e)}catch(n){if(!r)return null;throw n}};kP.exports=H6});var EP=P((bme,TP)=>{"use strict";var W6=pa(),J6=(t,e)=>{let r=W6(t,e);return r?r.version:null};TP.exports=J6});var OP=P((wme,AP)=>{"use strict";var X6=pa(),Y6=(t,e)=>{let r=X6(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};AP.exports=Y6});var RP=P((xme,CP)=>{"use strict";var PP=rr(),Q6=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new PP(t instanceof PP?t.version:t,r).inc(e,n,o).version}catch{return null}};CP.exports=Q6});var MP=P(($me,zP)=>{"use strict";var NP=pa(),eZ=(t,e)=>{let r=NP(t,null,!0),n=NP(e,null,!0),o=r.compare(n);if(o===0)return null;let i=o>0,s=i?r:n,a=i?n:r,c=!!s.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0)return a.minor&&!a.patch?"minor":"patch"}let l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};zP.exports=eZ});var DP=P((Ime,jP)=>{"use strict";var tZ=rr(),rZ=(t,e)=>new tZ(t,e).major;jP.exports=rZ});var UP=P((Sme,LP)=>{"use strict";var nZ=rr(),oZ=(t,e)=>new nZ(t,e).minor;LP.exports=oZ});var BP=P((kme,FP)=>{"use strict";var iZ=rr(),sZ=(t,e)=>new iZ(t,e).patch;FP.exports=sZ});var qP=P((Tme,ZP)=>{"use strict";var aZ=pa(),cZ=(t,e)=>{let r=aZ(t,e);return r&&r.prerelease.length?r.prerelease:null};ZP.exports=cZ});var gn=P((Eme,GP)=>{"use strict";var VP=rr(),uZ=(t,e,r)=>new VP(t,r).compare(new VP(e,r));GP.exports=uZ});var HP=P((Ame,KP)=>{"use strict";var lZ=gn(),dZ=(t,e,r)=>lZ(e,t,r);KP.exports=dZ});var JP=P((Ome,WP)=>{"use strict";var pZ=gn(),fZ=(t,e)=>pZ(t,e,!0);WP.exports=fZ});var Ch=P((Pme,YP)=>{"use strict";var XP=rr(),mZ=(t,e,r)=>{let n=new XP(t,r),o=new XP(e,r);return n.compare(o)||n.compareBuild(o)};YP.exports=mZ});var eC=P((Cme,QP)=>{"use strict";var hZ=Ch(),gZ=(t,e)=>t.sort((r,n)=>hZ(r,n,e));QP.exports=gZ});var rC=P((Rme,tC)=>{"use strict";var _Z=Ch(),yZ=(t,e)=>t.sort((r,n)=>_Z(n,r,e));tC.exports=yZ});var Md=P((Nme,nC)=>{"use strict";var vZ=gn(),bZ=(t,e,r)=>vZ(t,e,r)>0;nC.exports=bZ});var Rh=P((zme,oC)=>{"use strict";var wZ=gn(),xZ=(t,e,r)=>wZ(t,e,r)<0;oC.exports=xZ});var jx=P((Mme,iC)=>{"use strict";var $Z=gn(),IZ=(t,e,r)=>$Z(t,e,r)===0;iC.exports=IZ});var Dx=P((jme,sC)=>{"use strict";var SZ=gn(),kZ=(t,e,r)=>SZ(t,e,r)!==0;sC.exports=kZ});var Nh=P((Dme,aC)=>{"use strict";var TZ=gn(),EZ=(t,e,r)=>TZ(t,e,r)>=0;aC.exports=EZ});var zh=P((Lme,cC)=>{"use strict";var AZ=gn(),OZ=(t,e,r)=>AZ(t,e,r)<=0;cC.exports=OZ});var Lx=P((Ume,uC)=>{"use strict";var PZ=jx(),CZ=Dx(),RZ=Md(),NZ=Nh(),zZ=Rh(),MZ=zh(),jZ=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return PZ(t,r,n);case"!=":return CZ(t,r,n);case">":return RZ(t,r,n);case">=":return NZ(t,r,n);case"<":return zZ(t,r,n);case"<=":return MZ(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};uC.exports=jZ});var dC=P((Fme,lC)=>{"use strict";var DZ=rr(),LZ=pa(),{safeRe:Mh,t:jh}=lu(),UZ=(t,e)=>{if(t instanceof DZ)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Mh[jh.COERCEFULL]:Mh[jh.COERCE]);else{let c=e.includePrerelease?Mh[jh.COERCERTLFULL]:Mh[jh.COERCERTL],u;for(;(u=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",i=r[4]||"0",s=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return LZ(`${n}.${o}.${i}${s}${a}`,e)};lC.exports=UZ});var fC=P((Bme,pC)=>{"use strict";var Ux=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};pC.exports=Ux});var _n=P((Zme,_C)=>{"use strict";var FZ=/\s+/g,Fx=class t{constructor(e,r){if(r=ZZ(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Bx)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(FZ," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(o=>!hC(o[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&JZ(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&HZ)|(this.options.loose&&WZ))+":"+e,o=mC.get(n);if(o)return o;let i=this.options.loose,s=i?gr[nr.HYPHENRANGELOOSE]:gr[nr.HYPHENRANGE];e=e.replace(s,s9(this.options.includePrerelease)),at("hyphen replace",e),e=e.replace(gr[nr.COMPARATORTRIM],VZ),at("comparator trim",e),e=e.replace(gr[nr.TILDETRIM],GZ),at("tilde trim",e),e=e.replace(gr[nr.CARETTRIM],KZ),at("caret trim",e);let a=e.split(" ").map(d=>XZ(d,this.options)).join(" ").split(/\s+/).map(d=>i9(d,this.options));i&&(a=a.filter(d=>(at("loose invalid filter",d,this.options),!!d.match(gr[nr.COMPARATORLOOSE])))),at("range list",a);let c=new Map,u=a.map(d=>new Bx(d,this.options));for(let d of u){if(hC(d))return[d];c.set(d.value,d)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return mC.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>gC(n,r)&&e.set.some(o=>gC(o,r)&&n.every(i=>o.every(s=>i.intersects(s,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new qZ(e,this.options)}catch{return!1}for(let r=0;rt.value==="<0.0.0-0",JZ=t=>t.value==="",gC=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(i=>o.intersects(i,e)),o=n.pop();return r},XZ=(t,e)=>(t=t.replace(gr[nr.BUILD],""),at("comp",t,e),t=e9(t,e),at("caret",t),t=YZ(t,e),at("tildes",t),t=r9(t,e),at("xrange",t),t=o9(t,e),at("stars",t),t),_r=t=>!t||t.toLowerCase()==="x"||t==="*",YZ=(t,e)=>t.trim().split(/\s+/).map(r=>QZ(r,e)).join(" "),QZ=(t,e)=>{let r=e.loose?gr[nr.TILDELOOSE]:gr[nr.TILDE];return t.replace(r,(n,o,i,s,a)=>{at("tilde",t,n,o,i,s,a);let c;return _r(o)?c="":_r(i)?c=`>=${o}.0.0 <${+o+1}.0.0-0`:_r(s)?c=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:a?(at("replaceTilde pr",a),c=`>=${o}.${i}.${s}-${a} <${o}.${+i+1}.0-0`):c=`>=${o}.${i}.${s} <${o}.${+i+1}.0-0`,at("tilde return",c),c})},e9=(t,e)=>t.trim().split(/\s+/).map(r=>t9(r,e)).join(" "),t9=(t,e)=>{at("caret",t,e);let r=e.loose?gr[nr.CARETLOOSE]:gr[nr.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,s,a,c)=>{at("caret",t,o,i,s,a,c);let u;return _r(i)?u="":_r(s)?u=`>=${i}.0.0${n} <${+i+1}.0.0-0`:_r(a)?i==="0"?u=`>=${i}.${s}.0${n} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.0${n} <${+i+1}.0.0-0`:c?(at("replaceCaret pr",c),i==="0"?s==="0"?u=`>=${i}.${s}.${a}-${c} <${i}.${s}.${+a+1}-0`:u=`>=${i}.${s}.${a}-${c} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.${a}-${c} <${+i+1}.0.0-0`):(at("no pr"),i==="0"?s==="0"?u=`>=${i}.${s}.${a}${n} <${i}.${s}.${+a+1}-0`:u=`>=${i}.${s}.${a}${n} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.${a} <${+i+1}.0.0-0`),at("caret return",u),u})},r9=(t,e)=>(at("replaceXRanges",t,e),t.split(/\s+/).map(r=>n9(r,e)).join(" ")),n9=(t,e)=>{t=t.trim();let r=e.loose?gr[nr.XRANGELOOSE]:gr[nr.XRANGE];return t.replace(r,(n,o,i,s,a,c)=>{at("xRange",t,n,o,i,s,a,c);let u=_r(i),l=u||_r(s),d=l||_r(a),f=d;return o==="="&&f&&(o=""),c=e.includePrerelease?"-0":"",u?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&f?(l&&(s=0),a=0,o===">"?(o=">=",l?(i=+i+1,s=0,a=0):(s=+s+1,a=0)):o==="<="&&(o="<",l?i=+i+1:s=+s+1),o==="<"&&(c="-0"),n=`${o+i}.${s}.${a}${c}`):l?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${s}.0${c} <${i}.${+s+1}.0-0`),at("xRange return",n),n})},o9=(t,e)=>(at("replaceStars",t,e),t.trim().replace(gr[nr.STAR],"")),i9=(t,e)=>(at("replaceGTE0",t,e),t.trim().replace(gr[e.includePrerelease?nr.GTE0PRE:nr.GTE0],"")),s9=t=>(e,r,n,o,i,s,a,c,u,l,d,f)=>(_r(n)?r="":_r(o)?r=`>=${n}.0.0${t?"-0":""}`:_r(i)?r=`>=${n}.${o}.0${t?"-0":""}`:s?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,_r(u)?c="":_r(l)?c=`<${+u+1}.0.0-0`:_r(d)?c=`<${u}.${+l+1}.0-0`:f?c=`<=${u}.${l}.${d}-${f}`:t?c=`<${u}.${l}.${+d+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),a9=(t,e,r)=>{for(let n=0;n0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var jd=P((qme,$C)=>{"use strict";var Dd=Symbol("SemVer ANY"),Vx=class t{static get ANY(){return Dd}constructor(e,r){if(r=yC(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),qx("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Dd?this.value="":this.value=this.operator+this.semver.version,qx("comp",this)}parse(e){let r=this.options.loose?vC[bC.COMPARATORLOOSE]:vC[bC.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new wC(n[2],this.options.loose):this.semver=Dd}toString(){return this.value}test(e){if(qx("Comparator.test",e,this.options.loose),this.semver===Dd||e===Dd)return!0;if(typeof e=="string")try{e=new wC(e,this.options)}catch{return!1}return Zx(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new xC(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new xC(this.value,r).test(e.semver):(r=yC(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Zx(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Zx(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};$C.exports=Vx;var yC=Th(),{safeRe:vC,t:bC}=lu(),Zx=Lx(),qx=zd(),wC=rr(),xC=_n()});var Ld=P((Vme,IC)=>{"use strict";var c9=_n(),u9=(t,e,r)=>{try{e=new c9(e,r)}catch{return!1}return e.test(t)};IC.exports=u9});var kC=P((Gme,SC)=>{"use strict";var l9=_n(),d9=(t,e)=>new l9(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));SC.exports=d9});var EC=P((Kme,TC)=>{"use strict";var p9=rr(),f9=_n(),m9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new f9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===-1)&&(n=s,o=new p9(n,r))}),n};TC.exports=m9});var OC=P((Hme,AC)=>{"use strict";var h9=rr(),g9=_n(),_9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new g9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===1)&&(n=s,o=new h9(n,r))}),n};AC.exports=_9});var RC=P((Wme,CC)=>{"use strict";var Gx=rr(),y9=_n(),PC=Md(),v9=(t,e)=>{t=new y9(t,e);let r=new Gx("0.0.0");if(t.test(r)||(r=new Gx("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n{let a=new Gx(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||PC(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),i&&(!r||PC(r,i))&&(r=i)}return r&&t.test(r)?r:null};CC.exports=v9});var zC=P((Jme,NC)=>{"use strict";var b9=_n(),w9=(t,e)=>{try{return new b9(t,e).range||"*"}catch{return null}};NC.exports=w9});var Dh=P((Xme,LC)=>{"use strict";var x9=rr(),DC=jd(),{ANY:$9}=DC,I9=_n(),S9=Ld(),MC=Md(),jC=Rh(),k9=zh(),T9=Nh(),E9=(t,e,r,n)=>{t=new x9(t,n),e=new I9(e,n);let o,i,s,a,c;switch(r){case">":o=MC,i=k9,s=jC,a=">",c=">=";break;case"<":o=jC,i=T9,s=MC,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(S9(t,e,n))return!1;for(let u=0;u{p.semver===$9&&(p=new DC(">=0.0.0")),d=d||p,f=f||p,o(p.semver,d.semver,n)?d=p:s(p.semver,f.semver,n)&&(f=p)}),d.operator===a||d.operator===c||(!f.operator||f.operator===a)&&i(t,f.semver))return!1;if(f.operator===c&&s(t,f.semver))return!1}return!0};LC.exports=E9});var FC=P((Yme,UC)=>{"use strict";var A9=Dh(),O9=(t,e,r)=>A9(t,e,">",r);UC.exports=O9});var ZC=P((Qme,BC)=>{"use strict";var P9=Dh(),C9=(t,e,r)=>P9(t,e,"<",r);BC.exports=C9});var GC=P((ehe,VC)=>{"use strict";var qC=_n(),R9=(t,e,r)=>(t=new qC(t,r),e=new qC(e,r),t.intersects(e,r));VC.exports=R9});var HC=P((the,KC)=>{"use strict";var N9=Ld(),z9=gn();KC.exports=(t,e,r)=>{let n=[],o=null,i=null,s=t.sort((l,d)=>z9(l,d,r));for(let l of s)N9(l,e,r)?(i=l,o||(o=l)):(i&&n.push([o,i]),i=null,o=null);o&&n.push([o,null]);let a=[];for(let[l,d]of n)l===d?a.push(l):!d&&l===s[0]?a.push("*"):d?l===s[0]?a.push(`<=${d}`):a.push(`${l} - ${d}`):a.push(`>=${l}`);let c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length{"use strict";var WC=_n(),Hx=jd(),{ANY:Kx}=Hx,Ud=Ld(),Wx=gn(),M9=(t,e,r={})=>{if(t===e)return!0;t=new WC(t,r),e=new WC(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let s=D9(o,i,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},j9=[new Hx(">=0.0.0-0")],JC=[new Hx(">=0.0.0")],D9=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Kx){if(e.length===1&&e[0].semver===Kx)return!0;r.includePrerelease?t=j9:t=JC}if(e.length===1&&e[0].semver===Kx){if(r.includePrerelease)return!0;e=JC}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=XC(o,p,r):p.operator==="<"||p.operator==="<="?i=YC(i,p,r):n.add(p.semver);if(n.size>1)return null;let s;if(o&&i){if(s=Wx(o.semver,i.semver,r),s>0)return null;if(s===0&&(o.operator!==">="||i.operator!=="<="))return null}for(let p of n){if(o&&!Ud(p,String(o),r)||i&&!Ud(p,String(i),r))return null;for(let m of e)if(!Ud(p,String(m),r))return!1;return!0}let a,c,u,l,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of e){if(l=l||p.operator===">"||p.operator===">=",u=u||p.operator==="<"||p.operator==="<=",o){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator===">"||p.operator===">="){if(a=XC(o,p,r),a===p&&a!==o)return!1}else if(o.operator===">="&&!Ud(o.semver,String(p),r))return!1}if(i){if(d&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===d.major&&p.semver.minor===d.minor&&p.semver.patch===d.patch&&(d=!1),p.operator==="<"||p.operator==="<="){if(c=YC(i,p,r),c===p&&c!==i)return!1}else if(i.operator==="<="&&!Ud(i.semver,String(p),r))return!1}if(!p.operator&&(i||o)&&s!==0)return!1}return!(o&&u&&!i&&s!==0||i&&l&&!o&&s!==0||f||d)},XC=(t,e,r)=>{if(!t)return e;let n=Wx(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},YC=(t,e,r)=>{if(!t)return e;let n=Wx(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};QC.exports=M9});var oR=P((nhe,nR)=>{"use strict";var Jx=lu(),tR=Nd(),L9=rr(),rR=Nx(),U9=pa(),F9=EP(),B9=OP(),Z9=RP(),q9=MP(),V9=DP(),G9=UP(),K9=BP(),H9=qP(),W9=gn(),J9=HP(),X9=JP(),Y9=Ch(),Q9=eC(),eq=rC(),tq=Md(),rq=Rh(),nq=jx(),oq=Dx(),iq=Nh(),sq=zh(),aq=Lx(),cq=dC(),uq=jd(),lq=_n(),dq=Ld(),pq=kC(),fq=EC(),mq=OC(),hq=RC(),gq=zC(),_q=Dh(),yq=FC(),vq=ZC(),bq=GC(),wq=HC(),xq=eR();nR.exports={parse:U9,valid:F9,clean:B9,inc:Z9,diff:q9,major:V9,minor:G9,patch:K9,prerelease:H9,compare:W9,rcompare:J9,compareLoose:X9,compareBuild:Y9,sort:Q9,rsort:eq,gt:tq,lt:rq,eq:nq,neq:oq,gte:iq,lte:sq,cmp:aq,coerce:cq,Comparator:uq,Range:lq,satisfies:dq,toComparators:pq,maxSatisfying:fq,minSatisfying:mq,minVersion:hq,validRange:gq,outside:_q,gtr:yq,ltr:vq,intersects:bq,simplifyRange:wq,subset:xq,SemVer:L9,re:Jx.re,src:Jx.src,tokens:Jx.t,SEMVER_SPEC_VERSION:tR.SEMVER_SPEC_VERSION,RELEASE_TYPES:tR.RELEASE_TYPES,compareIdentifiers:rR.compareIdentifiers,rcompareIdentifiers:rR.rcompareIdentifiers}});var IR=P((Ghe,$R)=>{"use strict";var wR=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,xR=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function qq(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",e.color.ansi256=wR(),e.color.ansi16m=xR(),e.bgColor.ansi256=wR(10),e.bgColor.ansi16m=xR(10),Object.defineProperties(e,{rgbToAnsi256:{value:(r,n,o)=>r===n&&n===o?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:o}=n.groups;o.length===3&&(o=o.split("").map(s=>s+s).join(""));let i=Number.parseInt(o,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:r=>e.rgbToAnsi256(...e.hexToRgb(r)),enumerable:!1}}),e}Object.defineProperty($R,"exports",{enumerable:!0,get:qq})});var KM=P(dv=>{"use strict";dv.byteLength=AW;dv.toByteArray=PW;dv.fromByteArray=NW;var So=[],Sn=[],EW=typeof Uint8Array<"u"?Uint8Array:Array,BI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Va=0,VM=BI.length;Va0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function AW(t){var e=GM(t),r=e[0],n=e[1];return(r+n)*3/4-n}function OW(t,e,r){return(e+r)*3/4-r}function PW(t){var e,r=GM(t),n=r[0],o=r[1],i=new EW(OW(t,n,o)),s=0,a=o>0?n-4:n,c;for(c=0;c>16&255,i[s++]=e>>8&255,i[s++]=e&255;return o===2&&(e=Sn[t.charCodeAt(c)]<<2|Sn[t.charCodeAt(c+1)]>>4,i[s++]=e&255),o===1&&(e=Sn[t.charCodeAt(c)]<<10|Sn[t.charCodeAt(c+1)]<<4|Sn[t.charCodeAt(c+2)]>>2,i[s++]=e>>8&255,i[s++]=e&255),i}function CW(t){return So[t>>18&63]+So[t>>12&63]+So[t>>6&63]+So[t&63]}function RW(t,e,r){for(var n,o=[],i=e;ia?a:s+i));return n===1?(e=t[r-1],o.push(So[e>>2]+So[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(So[e>>10]+So[e>>4&63]+So[e<<2&63]+"=")),o.join("")}});var Cf=P(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.regexpCode=Fe.getEsmExportName=Fe.getProperty=Fe.safeStringify=Fe.stringify=Fe.strConcat=Fe.addCodeArg=Fe.str=Fe._=Fe.nil=Fe._Code=Fe.Name=Fe.IDENTIFIER=Fe._CodeOrName=void 0;var Of=class{};Fe._CodeOrName=Of;Fe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Qa=class extends Of{constructor(e){if(super(),!Fe.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Fe.Name=Qa;var Tn=class extends Of{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Qa&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Fe._Code=Tn;Fe.nil=new Tn("");function Xj(t,...e){let r=[t[0]],n=0;for(;n{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.ValueScope=Br.ValueScopeName=Br.Scope=Br.varKinds=Br.UsedValueState=void 0;var Fr=Cf(),DS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Hv;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Hv||(Br.UsedValueState=Hv={}));Br.varKinds={const:new Fr.Name("const"),let:new Fr.Name("let"),var:new Fr.Name("var")};var Wv=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Fr.Name?e:this.name(e)}name(e){return new Fr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Br.Scope=Wv;var Jv=class extends Fr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Fr._)`.${new Fr.Name(r)}[${n}]`}};Br.ValueScopeName=Jv;var z7=(0,Fr._)`\n`,LS=class extends Wv{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?z7:Fr.nil}}get(){return this._scope}name(e){return new Jv(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:i}=o,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[i];if(a){let l=a.get(s);if(l)return l}else a=this._values[i]=new Map;a.set(s,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Fr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let i=Fr.nil;for(let s in e){let a=e[s];if(!a)continue;let c=n[s]=n[s]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Hv.Started);let l=r(u);if(l){let d=this.opts.es5?Br.varKinds.var:Br.varKinds.const;i=(0,Fr._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Fr._)`${i}${l}${this.opts._n}`;else throw new DS(u);c.set(u,Hv.Completed)})}return i}};Br.ValueScope=LS});var Oe=P(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.or=Ce.and=Ce.not=Ce.CodeGen=Ce.operators=Ce.varKinds=Ce.ValueScopeName=Ce.ValueScope=Ce.Scope=Ce.Name=Ce.regexpCode=Ce.stringify=Ce.getProperty=Ce.nil=Ce.strConcat=Ce.str=Ce._=void 0;var Le=Cf(),Xn=US(),_s=Cf();Object.defineProperty(Ce,"_",{enumerable:!0,get:function(){return _s._}});Object.defineProperty(Ce,"str",{enumerable:!0,get:function(){return _s.str}});Object.defineProperty(Ce,"strConcat",{enumerable:!0,get:function(){return _s.strConcat}});Object.defineProperty(Ce,"nil",{enumerable:!0,get:function(){return _s.nil}});Object.defineProperty(Ce,"getProperty",{enumerable:!0,get:function(){return _s.getProperty}});Object.defineProperty(Ce,"stringify",{enumerable:!0,get:function(){return _s.stringify}});Object.defineProperty(Ce,"regexpCode",{enumerable:!0,get:function(){return _s.regexpCode}});Object.defineProperty(Ce,"Name",{enumerable:!0,get:function(){return _s.Name}});var eb=US();Object.defineProperty(Ce,"Scope",{enumerable:!0,get:function(){return eb.Scope}});Object.defineProperty(Ce,"ValueScope",{enumerable:!0,get:function(){return eb.ValueScope}});Object.defineProperty(Ce,"ValueScopeName",{enumerable:!0,get:function(){return eb.ValueScopeName}});Object.defineProperty(Ce,"varKinds",{enumerable:!0,get:function(){return eb.varKinds}});Ce.operators={GT:new Le._Code(">"),GTE:new Le._Code(">="),LT:new Le._Code("<"),LTE:new Le._Code("<="),EQ:new Le._Code("==="),NEQ:new Le._Code("!=="),NOT:new Le._Code("!"),OR:new Le._Code("||"),AND:new Le._Code("&&"),ADD:new Le._Code("+")};var di=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},FS=class extends di{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Xn.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Sl(this.rhs,e,r)),this}get names(){return this.rhs instanceof Le._CodeOrName?this.rhs.names:{}}},Xv=class extends di{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Le.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Sl(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Le.Name?{}:{...this.lhs.names};return Qv(e,this.rhs)}},BS=class extends Xv{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},ZS=class extends di{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qS=class extends di{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},VS=class extends di{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},GS=class extends di{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Sl(this.code,e,r),this}get names(){return this.code instanceof Le._CodeOrName?this.code.names:{}}},Rf=class extends di{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(e,r)||(M7(e,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rc(e,r.names),{})}},pi=class extends Rf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},KS=class extends Rf{},Il=class extends pi{};Il.kind="else";var ec=class t extends pi{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Il(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Qj(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Sl(this.condition,e,r),this}get names(){let e=super.names;return Qv(e,this.condition),this.else&&rc(e,this.else.names),e}};ec.kind="if";var tc=class extends pi{};tc.kind="for";var HS=class extends tc{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Sl(this.iteration,e,r),this}get names(){return rc(super.names,this.iteration.names)}},WS=class extends tc{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?Xn.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=Qv(super.names,this.from);return Qv(e,this.to)}},Yv=class extends tc{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Sl(this.iterable,e,r),this}get names(){return rc(super.names,this.iterable.names)}},Nf=class extends pi{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Nf.kind="func";var zf=class extends Rf{render(e){return"return "+super.render(e)}};zf.kind="return";var JS=class extends pi{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rc(e,this.catch.names),this.finally&&rc(e,this.finally.names),e}},Mf=class extends pi{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Mf.kind="catch";var jf=class extends pi{render(e){return"finally"+super.render(e)}};jf.kind="finally";var XS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?` +`:""},this._extScope=e,this._scope=new Xn.Scope({parent:e}),this._nodes=[new KS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new FS(e,i,n)),i}const(e,r,n){return this._def(Xn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Xn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Xn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Xv(e,r,n))}add(e,r){return this._leafNode(new BS(e,Ce.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Le.nil&&this._leafNode(new GS(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Le.addCodeArg)(r,o));return r.push("}"),new Le._Code(r)}if(e,r,n){if(this._blockNode(new ec(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ec(e))}else(){return this._elseNode(new Il)}endIf(){return this._endBlockNode(ec,Il)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new HS(e),r)}forRange(e,r,n,o,i=this.opts.es5?Xn.varKinds.var:Xn.varKinds.let){let s=this._scope.toName(e);return this._for(new WS(i,s,r,n),()=>o(s))}forOf(e,r,n,o=Xn.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let s=r instanceof Le.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Le._)`${s}.length`,a=>{this.var(i,(0,Le._)`${s}[${a}]`),n(i)})}return this._for(new Yv("of",o,i,r),()=>n(i))}forIn(e,r,n,o=this.opts.es5?Xn.varKinds.var:Xn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Le._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new Yv("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(tc)}label(e){return this._leafNode(new ZS(e))}break(e){return this._leafNode(new qS(e))}return(e){let r=new zf;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(zf)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new JS;if(this._blockNode(o),this.code(e),r){let i=this.name("e");this._currNode=o.catch=new Mf(i),r(i)}return n&&(this._currNode=o.finally=new jf,this.code(n)),this._endBlockNode(Mf,jf)}throw(e){return this._leafNode(new VS(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Le.nil,n,o){return this._blockNode(new Nf(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Nf)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof ec))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ce.CodeGen=XS;function rc(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Qv(t,e){return e instanceof Le._CodeOrName?rc(t,e.names):t}function Sl(t,e,r){if(t instanceof Le.Name)return n(t);if(!o(t))return t;return new Le._Code(t._items.reduce((i,s)=>(s instanceof Le.Name&&(s=n(s)),s instanceof Le._Code?i.push(...s._items):i.push(s),i),[]));function n(i){let s=r[i.str];return s===void 0||e[i.str]!==1?i:(delete e[i.str],s)}function o(i){return i instanceof Le._Code&&i._items.some(s=>s instanceof Le.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function M7(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Qj(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Le._)`!${YS(t)}`}Ce.not=Qj;var j7=eD(Ce.operators.AND);function D7(...t){return t.reduce(j7)}Ce.and=D7;var L7=eD(Ce.operators.OR);function U7(...t){return t.reduce(L7)}Ce.or=U7;function eD(t){return(e,r)=>e===Le.nil?r:r===Le.nil?e:(0,Le._)`${YS(e)} ${t} ${YS(r)}`}function YS(t){return t instanceof Le.Name?t:(0,Le._)`(${t})`}});var Be=P(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.checkStrictMode=Ne.getErrorPath=Ne.Type=Ne.useFunc=Ne.setEvaluated=Ne.evaluatedPropsToName=Ne.mergeEvaluated=Ne.eachItem=Ne.unescapeJsonPointer=Ne.escapeJsonPointer=Ne.escapeFragment=Ne.unescapeFragment=Ne.schemaRefOrVal=Ne.schemaHasRulesButRef=Ne.schemaHasRules=Ne.checkUnknownRules=Ne.alwaysValidSchema=Ne.toHash=void 0;var rt=Oe(),F7=Cf();function B7(t){let e={};for(let r of t)e[r]=!0;return e}Ne.toHash=B7;function Z7(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(nD(t,e),!oD(e,t.self.RULES.all))}Ne.alwaysValidSchema=Z7;function nD(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let i in e)o[i]||aD(t,`unknown keyword: "${i}"`)}Ne.checkUnknownRules=nD;function oD(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Ne.schemaHasRules=oD;function q7(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Ne.schemaHasRulesButRef=q7;function V7({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,rt._)`${r}`}return(0,rt._)`${t}${e}${(0,rt.getProperty)(n)}`}Ne.schemaRefOrVal=V7;function G7(t){return iD(decodeURIComponent(t))}Ne.unescapeFragment=G7;function K7(t){return encodeURIComponent(ek(t))}Ne.escapeFragment=K7;function ek(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Ne.escapeJsonPointer=ek;function iD(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Ne.unescapeJsonPointer=iD;function H7(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Ne.eachItem=H7;function tD({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,i,s,a)=>{let c=s===void 0?i:s instanceof rt.Name?(i instanceof rt.Name?t(o,i,s):e(o,i,s),s):i instanceof rt.Name?(e(o,s,i),i):r(i,s);return a===rt.Name&&!(c instanceof rt.Name)?n(o,c):c}}Ne.mergeEvaluated={props:tD({mergeNames:(t,e,r)=>t.if((0,rt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,rt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,rt._)`${r} || {}`).code((0,rt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,rt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,rt._)`${r} || {}`),tk(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:sD}),items:tD({mergeNames:(t,e,r)=>t.if((0,rt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,rt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,rt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,rt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function sD(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,rt._)`{}`);return e!==void 0&&tk(t,r,e),r}Ne.evaluatedPropsToName=sD;function tk(t,e,r){Object.keys(r).forEach(n=>t.assign((0,rt._)`${e}${(0,rt.getProperty)(n)}`,!0))}Ne.setEvaluated=tk;var rD={};function W7(t,e){return t.scopeValue("func",{ref:e,code:rD[e.code]||(rD[e.code]=new F7._Code(e.code))})}Ne.useFunc=W7;var QS;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(QS||(Ne.Type=QS={}));function J7(t,e,r){if(t instanceof rt.Name){let n=e===QS.Num;return r?n?(0,rt._)`"[" + ${t} + "]"`:(0,rt._)`"['" + ${t} + "']"`:n?(0,rt._)`"/" + ${t}`:(0,rt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,rt.getProperty)(t).toString():"/"+ek(t)}Ne.getErrorPath=J7;function aD(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Ne.checkStrictMode=aD});var fi=P(rk=>{"use strict";Object.defineProperty(rk,"__esModule",{value:!0});var ur=Oe(),X7={data:new ur.Name("data"),valCxt:new ur.Name("valCxt"),instancePath:new ur.Name("instancePath"),parentData:new ur.Name("parentData"),parentDataProperty:new ur.Name("parentDataProperty"),rootData:new ur.Name("rootData"),dynamicAnchors:new ur.Name("dynamicAnchors"),vErrors:new ur.Name("vErrors"),errors:new ur.Name("errors"),this:new ur.Name("this"),self:new ur.Name("self"),scope:new ur.Name("scope"),json:new ur.Name("json"),jsonPos:new ur.Name("jsonPos"),jsonLen:new ur.Name("jsonLen"),jsonPart:new ur.Name("jsonPart")};rk.default=X7});var Df=P(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.extendErrors=lr.resetErrorsCount=lr.reportExtraError=lr.reportError=lr.keyword$DataError=lr.keywordError=void 0;var Ue=Oe(),tb=Be(),kr=fi();lr.keywordError={message:({keyword:t})=>(0,Ue.str)`must pass "${t}" keyword validation`};lr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ue.str)`"${t}" keyword must be ${e} ($data)`:(0,Ue.str)`"${t}" keyword is invalid ($data)`};function Y7(t,e=lr.keywordError,r,n){let{it:o}=t,{gen:i,compositeRule:s,allErrors:a}=o,c=lD(t,e,r);n??(s||a)?cD(i,c):uD(o,(0,Ue._)`[${c}]`)}lr.reportError=Y7;function Q7(t,e=lr.keywordError,r){let{it:n}=t,{gen:o,compositeRule:i,allErrors:s}=n,a=lD(t,e,r);cD(o,a),i||s||uD(n,kr.default.vErrors)}lr.reportExtraError=Q7;function eX(t,e){t.assign(kr.default.errors,e),t.if((0,Ue._)`${kr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ue._)`${kr.default.vErrors}.length`,e),()=>t.assign(kr.default.vErrors,null)))}lr.resetErrorsCount=eX;function tX({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",o,kr.default.errors,a=>{t.const(s,(0,Ue._)`${kr.default.vErrors}[${a}]`),t.if((0,Ue._)`${s}.instancePath === undefined`,()=>t.assign((0,Ue._)`${s}.instancePath`,(0,Ue.strConcat)(kr.default.instancePath,i.errorPath))),t.assign((0,Ue._)`${s}.schemaPath`,(0,Ue.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,Ue._)`${s}.schema`,r),t.assign((0,Ue._)`${s}.data`,n))})}lr.extendErrors=tX;function cD(t,e){let r=t.const("err",e);t.if((0,Ue._)`${kr.default.vErrors} === null`,()=>t.assign(kr.default.vErrors,(0,Ue._)`[${r}]`),(0,Ue._)`${kr.default.vErrors}.push(${r})`),t.code((0,Ue._)`${kr.default.errors}++`)}function uD(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,Ue._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ue._)`${n}.errors`,e),r.return(!1))}var nc={keyword:new Ue.Name("keyword"),schemaPath:new Ue.Name("schemaPath"),params:new Ue.Name("params"),propertyName:new Ue.Name("propertyName"),message:new Ue.Name("message"),schema:new Ue.Name("schema"),parentSchema:new Ue.Name("parentSchema")};function lD(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Ue._)`{}`:rX(t,e,r)}function rX(t,e,r={}){let{gen:n,it:o}=t,i=[nX(o,r),oX(t,r)];return iX(t,e,i),n.object(...i)}function nX({errorPath:t},{instancePath:e}){let r=e?(0,Ue.str)`${t}${(0,tb.getErrorPath)(e,tb.Type.Str)}`:t;return[kr.default.instancePath,(0,Ue.strConcat)(kr.default.instancePath,r)]}function oX({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,Ue.str)`${e}/${t}`;return r&&(o=(0,Ue.str)`${o}${(0,tb.getErrorPath)(r,tb.Type.Str)}`),[nc.schemaPath,o]}function iX(t,{params:e,message:r},n){let{keyword:o,data:i,schemaValue:s,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([nc.keyword,o],[nc.params,typeof e=="function"?e(t):e||(0,Ue._)`{}`]),c.messages&&n.push([nc.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([nc.schema,s],[nc.parentSchema,(0,Ue._)`${l}${d}`],[kr.default.data,i]),u&&n.push([nc.propertyName,u])}});var pD=P(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.boolOrEmptySchema=kl.topBoolOrEmptySchema=void 0;var sX=Df(),aX=Oe(),cX=fi(),uX={message:"boolean schema is false"};function lX(t){let{gen:e,schema:r,validateName:n}=t;r===!1?dD(t,!1):typeof r=="object"&&r.$async===!0?e.return(cX.default.data):(e.assign((0,aX._)`${n}.errors`,null),e.return(!0))}kl.topBoolOrEmptySchema=lX;function dX(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),dD(t)):r.var(e,!0)}kl.boolOrEmptySchema=dX;function dD(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,sX.reportError)(o,uX,void 0,e)}});var nk=P(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.getRules=Tl.isJSONType=void 0;var pX=["string","number","integer","boolean","null","object","array"],fX=new Set(pX);function mX(t){return typeof t=="string"&&fX.has(t)}Tl.isJSONType=mX;function hX(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Tl.getRules=hX});var ok=P(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.shouldUseRule=ys.shouldUseGroup=ys.schemaHasRulesForType=void 0;function gX({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&fD(t,n)}ys.schemaHasRulesForType=gX;function fD(t,e){return e.rules.some(r=>mD(t,r))}ys.shouldUseGroup=fD;function mD(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ys.shouldUseRule=mD});var Lf=P(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.reportTypeError=dr.checkDataTypes=dr.checkDataType=dr.coerceAndCheckDataType=dr.getJSONTypes=dr.getSchemaTypes=dr.DataType=void 0;var _X=nk(),yX=ok(),vX=Df(),Te=Oe(),hD=Be(),El;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(El||(dr.DataType=El={}));function bX(t){let e=gD(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}dr.getSchemaTypes=bX;function gD(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(_X.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}dr.getJSONTypes=gD;function wX(t,e){let{gen:r,data:n,opts:o}=t,i=xX(e,o.coerceTypes),s=e.length>0&&!(i.length===0&&e.length===1&&(0,yX.schemaHasRulesForType)(t,e[0]));if(s){let a=sk(e,n,o.strictNumbers,El.Wrong);r.if(a,()=>{i.length?$X(t,e,i):ak(t)})}return s}dr.coerceAndCheckDataType=wX;var _D=new Set(["string","number","integer","boolean","null"]);function xX(t,e){return e?t.filter(r=>_D.has(r)||e==="array"&&r==="array"):[]}function $X(t,e,r){let{gen:n,data:o,opts:i}=t,s=n.let("dataType",(0,Te._)`typeof ${o}`),a=n.let("coerced",(0,Te._)`undefined`);i.coerceTypes==="array"&&n.if((0,Te._)`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,Te._)`${o}[0]`).assign(s,(0,Te._)`typeof ${o}`).if(sk(e,o,i.strictNumbers),()=>n.assign(a,o))),n.if((0,Te._)`${a} !== undefined`);for(let u of r)(_D.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),ak(t),n.endIf(),n.if((0,Te._)`${a} !== undefined`,()=>{n.assign(o,a),IX(t,a)});function c(u){switch(u){case"string":n.elseIf((0,Te._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,Te._)`"" + ${o}`).elseIf((0,Te._)`${o} === null`).assign(a,(0,Te._)`""`);return;case"number":n.elseIf((0,Te._)`${s} == "boolean" || ${o} === null + || (${s} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,Te._)`+${o}`);return;case"integer":n.elseIf((0,Te._)`${s} === "boolean" || ${o} === null + || (${s} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,Te._)`+${o}`);return;case"boolean":n.elseIf((0,Te._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,Te._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,Te._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,Te._)`${s} === "string" || ${s} === "number" + || ${s} === "boolean" || ${o} === null`).assign(a,(0,Te._)`[${o}]`)}}}function IX({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Te._)`${e} !== undefined`,()=>t.assign((0,Te._)`${e}[${r}]`,n))}function ik(t,e,r,n=El.Correct){let o=n===El.Correct?Te.operators.EQ:Te.operators.NEQ,i;switch(t){case"null":return(0,Te._)`${e} ${o} null`;case"array":i=(0,Te._)`Array.isArray(${e})`;break;case"object":i=(0,Te._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=s((0,Te._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=s();break;default:return(0,Te._)`typeof ${e} ${o} ${t}`}return n===El.Correct?i:(0,Te.not)(i);function s(a=Te.nil){return(0,Te.and)((0,Te._)`typeof ${e} == "number"`,a,r?(0,Te._)`isFinite(${e})`:Te.nil)}}dr.checkDataType=ik;function sk(t,e,r,n){if(t.length===1)return ik(t[0],e,r,n);let o,i=(0,hD.toHash)(t);if(i.array&&i.object){let s=(0,Te._)`typeof ${e} != "object"`;o=i.null?s:(0,Te._)`!${e} || ${s}`,delete i.null,delete i.array,delete i.object}else o=Te.nil;i.number&&delete i.integer;for(let s in i)o=(0,Te.and)(o,ik(s,e,r,n));return o}dr.checkDataTypes=sk;var SX={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Te._)`{type: ${t}}`:(0,Te._)`{type: ${e}}`};function ak(t){let e=kX(t);(0,vX.reportError)(e,SX)}dr.reportTypeError=ak;function kX(t){let{gen:e,data:r,schema:n}=t,o=(0,hD.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var vD=P(rb=>{"use strict";Object.defineProperty(rb,"__esModule",{value:!0});rb.assignDefaults=void 0;var Al=Oe(),TX=Be();function EX(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)yD(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,i)=>yD(t,i,o.default))}rb.assignDefaults=EX;function yD(t,e,r){let{gen:n,compositeRule:o,data:i,opts:s}=t;if(r===void 0)return;let a=(0,Al._)`${i}${(0,Al.getProperty)(e)}`;if(o){(0,TX.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Al._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,Al._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Al._)`${a} = ${(0,Al.stringify)(r)}`)}});var En=P(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.validateUnion=Xe.validateArray=Xe.usePattern=Xe.callValidateCode=Xe.schemaProperties=Xe.allSchemaProperties=Xe.noPropertyInData=Xe.propertyInData=Xe.isOwnProperty=Xe.hasPropFunc=Xe.reportMissingProp=Xe.checkMissingProp=Xe.checkReportMissingProp=void 0;var ut=Oe(),ck=Be(),vs=fi(),AX=Be();function OX(t,e){let{gen:r,data:n,it:o}=t;r.if(lk(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,ut._)`${e}`},!0),t.error()})}Xe.checkReportMissingProp=OX;function PX({gen:t,data:e,it:{opts:r}},n,o){return(0,ut.or)(...n.map(i=>(0,ut.and)(lk(t,e,i,r.ownProperties),(0,ut._)`${o} = ${i}`)))}Xe.checkMissingProp=PX;function CX(t,e){t.setParams({missingProperty:e},!0),t.error()}Xe.reportMissingProp=CX;function bD(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ut._)`Object.prototype.hasOwnProperty`})}Xe.hasPropFunc=bD;function uk(t,e,r){return(0,ut._)`${bD(t)}.call(${e}, ${r})`}Xe.isOwnProperty=uk;function RX(t,e,r,n){let o=(0,ut._)`${e}${(0,ut.getProperty)(r)} !== undefined`;return n?(0,ut._)`${o} && ${uk(t,e,r)}`:o}Xe.propertyInData=RX;function lk(t,e,r,n){let o=(0,ut._)`${e}${(0,ut.getProperty)(r)} === undefined`;return n?(0,ut.or)(o,(0,ut.not)(uk(t,e,r))):o}Xe.noPropertyInData=lk;function wD(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Xe.allSchemaProperties=wD;function NX(t,e){return wD(e).filter(r=>!(0,ck.alwaysValidSchema)(t,e[r]))}Xe.schemaProperties=NX;function zX({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:s},a,c,u){let l=u?(0,ut._)`${t}, ${e}, ${n}${o}`:e,d=[[vs.default.instancePath,(0,ut.strConcat)(vs.default.instancePath,i)],[vs.default.parentData,s.parentData],[vs.default.parentDataProperty,s.parentDataProperty],[vs.default.rootData,vs.default.rootData]];s.opts.dynamicRef&&d.push([vs.default.dynamicAnchors,vs.default.dynamicAnchors]);let f=(0,ut._)`${l}, ${r.object(...d)}`;return c!==ut.nil?(0,ut._)`${a}.call(${c}, ${f})`:(0,ut._)`${a}(${f})`}Xe.callValidateCode=zX;var MX=(0,ut._)`new RegExp`;function jX({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,i=o(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ut._)`${o.code==="new RegExp"?MX:(0,AX.useFunc)(t,o)}(${r}, ${n})`})}Xe.usePattern=jX;function DX(t){let{gen:e,data:r,keyword:n,it:o}=t,i=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(i,!0),s(()=>e.break()),i;function s(a){let c=e.const("len",(0,ut._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:ck.Type.Num},i),e.if((0,ut.not)(i),a)})}}Xe.validateArray=DX;function LX(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,ck.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(s,(0,ut._)`${s} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,ut.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}Xe.validateUnion=LX});var ID=P(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.validateKeywordUsage=Eo.validSchemaType=Eo.funcKeywordCode=Eo.macroKeywordCode=void 0;var Tr=Oe(),oc=fi(),UX=En(),FX=Df();function BX(t,e){let{gen:r,keyword:n,schema:o,parentSchema:i,it:s}=t,a=e.macro.call(s.self,o,i,s),c=$D(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:Tr.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Eo.macroKeywordCode=BX;function ZX(t,e){var r;let{gen:n,keyword:o,schema:i,parentSchema:s,$data:a,it:c}=t;VX(c,e);let u=!a&&e.compile?e.compile.call(c.self,i,s,c):e.validate,l=$D(n,o,u),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&xD(t),_(()=>t.error());else{let v=e.async?p():m();e.modifying&&xD(t),_(()=>qX(t,v))}}function p(){let v=n.let("ruleErrs",null);return n.try(()=>h((0,Tr._)`await `),b=>n.assign(d,!1).if((0,Tr._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,Tr._)`${b}.errors`),()=>n.throw(b))),v}function m(){let v=(0,Tr._)`${l}.errors`;return n.assign(v,null),h(Tr.nil),v}function h(v=e.async?(0,Tr._)`await `:Tr.nil){let b=c.opts.passContext?oc.default.this:oc.default.self,x=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Tr._)`${v}${(0,UX.callValidateCode)(t,l,b,x)}`,e.modifying)}function _(v){var b;n.if((0,Tr.not)((b=e.valid)!==null&&b!==void 0?b:d),v)}}Eo.funcKeywordCode=ZX;function xD(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Tr._)`${n.parentData}[${n.parentDataProperty}]`))}function qX(t,e){let{gen:r}=t;r.if((0,Tr._)`Array.isArray(${e})`,()=>{r.assign(oc.default.vErrors,(0,Tr._)`${oc.default.vErrors} === null ? ${e} : ${oc.default.vErrors}.concat(${e})`).assign(oc.default.errors,(0,Tr._)`${oc.default.vErrors}.length`),(0,FX.extendErrors)(t)},()=>t.error())}function VX({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function $D(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Tr.stringify)(r)})}function GX(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Eo.validSchemaType=GX;function KX({schema:t,opts:e,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let s=o.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Eo.validateKeywordUsage=KX});var kD=P(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.extendSubschemaMode=bs.extendSubschemaData=bs.getSubschema=void 0;var Ao=Oe(),SD=Be();function HX(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ao._)`${t.schemaPath}${(0,Ao.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ao._)`${t.schemaPath}${(0,Ao.getProperty)(e)}${(0,Ao.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,SD.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:s,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}bs.getSubschema=HX;function WX(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:s}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,f=a.let("data",(0,Ao._)`${e.data}${(0,Ao.getProperty)(r)}`,!0);c(f),t.errorPath=(0,Ao.str)`${u}${(0,SD.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ao._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Ao.Name?o:a.let("data",o,!0);c(u),s!==void 0&&(t.propertyName=s)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}bs.extendSubschemaData=WX;function JX(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}bs.extendSubschemaMode=JX});var dk=P((Z2e,TD)=>{"use strict";TD.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var s=i[o];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var AD=P((q2e,ED)=>{"use strict";var ws=ED.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};nb(e,n,o,t,"",t)};ws.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ws.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ws.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ws.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function nb(t,e,r,n,o,i,s,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,i,s,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ws.arrayKeywords)for(var f=0;f{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.getSchemaRefs=Zr.resolveUrl=Zr.normalizeId=Zr._getFullPath=Zr.getFullPath=Zr.inlineRef=void 0;var YX=Be(),QX=dk(),eY=AD(),tY=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function rY(t,e=!0){return typeof t=="boolean"?!0:e===!0?!pk(t):e?OD(t)<=e:!1}Zr.inlineRef=rY;var nY=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function pk(t){for(let e in t){if(nY.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(pk)||typeof r=="object"&&pk(r))return!0}return!1}function OD(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!tY.has(r)&&(typeof t[r]=="object"&&(0,YX.eachItem)(t[r],n=>e+=OD(n)),e===1/0))return 1/0}return e}function PD(t,e="",r){r!==!1&&(e=Ol(e));let n=t.parse(e);return CD(t,n)}Zr.getFullPath=PD;function CD(t,e){return t.serialize(e).split("#")[0]+"#"}Zr._getFullPath=CD;var oY=/#\/?$/;function Ol(t){return t?t.replace(oY,""):""}Zr.normalizeId=Ol;function iY(t,e,r){return r=Ol(r),t.resolve(e,r)}Zr.resolveUrl=iY;var sY=/^[a-z_][-a-z0-9._]*$/i;function aY(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Ol(t[r]||e),i={"":o},s=PD(n,o,!1),a={},c=new Set;return eY(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=s+f,_=i[m];typeof d[r]=="string"&&(_=v.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),i[f]=_;function v(x){let k=this.opts.uriResolver.resolve;if(x=Ol(_?k(_,x):x),c.has(x))throw l(x);c.add(x);let T=this.refs[x];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?u(d,T.schema,x):x!==Ol(h)&&(x[0]==="#"?(u(d,a[x],x),a[x]=d):this.refs[x]=h),x}function b(x){if(typeof x=="string"){if(!sY.test(x))throw new Error(`invalid anchor "${x}"`);v.call(this,`#${x}`)}}}),a;function u(d,f,p){if(f!==void 0&&!QX(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Zr.getSchemaRefs=aY});var Zf=P(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.getData=xs.KeywordCxt=xs.validateFunctionCode=void 0;var jD=pD(),RD=Lf(),mk=ok(),ob=Lf(),cY=vD(),Bf=ID(),fk=kD(),ae=Oe(),we=fi(),uY=Uf(),mi=Be(),Ff=Df();function lY(t){if(UD(t)&&(FD(t),LD(t))){fY(t);return}DD(t,()=>(0,jD.topBoolOrEmptySchema)(t))}xs.validateFunctionCode=lY;function DD({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,ae._)`${we.default.data}, ${we.default.valCxt}`,n.$async,()=>{t.code((0,ae._)`"use strict"; ${ND(r,o)}`),pY(t,o),t.code(i)}):t.func(e,(0,ae._)`${we.default.data}, ${dY(o)}`,n.$async,()=>t.code(ND(r,o)).code(i))}function dY(t){return(0,ae._)`{${we.default.instancePath}="", ${we.default.parentData}, ${we.default.parentDataProperty}, ${we.default.rootData}=${we.default.data}${t.dynamicRef?(0,ae._)`, ${we.default.dynamicAnchors}={}`:ae.nil}}={}`}function pY(t,e){t.if(we.default.valCxt,()=>{t.var(we.default.instancePath,(0,ae._)`${we.default.valCxt}.${we.default.instancePath}`),t.var(we.default.parentData,(0,ae._)`${we.default.valCxt}.${we.default.parentData}`),t.var(we.default.parentDataProperty,(0,ae._)`${we.default.valCxt}.${we.default.parentDataProperty}`),t.var(we.default.rootData,(0,ae._)`${we.default.valCxt}.${we.default.rootData}`),e.dynamicRef&&t.var(we.default.dynamicAnchors,(0,ae._)`${we.default.valCxt}.${we.default.dynamicAnchors}`)},()=>{t.var(we.default.instancePath,(0,ae._)`""`),t.var(we.default.parentData,(0,ae._)`undefined`),t.var(we.default.parentDataProperty,(0,ae._)`undefined`),t.var(we.default.rootData,we.default.data),e.dynamicRef&&t.var(we.default.dynamicAnchors,(0,ae._)`{}`)})}function fY(t){let{schema:e,opts:r,gen:n}=t;DD(t,()=>{r.$comment&&e.$comment&&ZD(t),yY(t),n.let(we.default.vErrors,null),n.let(we.default.errors,0),r.unevaluated&&mY(t),BD(t),wY(t)})}function mY(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,ae._)`${r}.evaluated`),e.if((0,ae._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ae._)`${t.evaluated}.props`,(0,ae._)`undefined`)),e.if((0,ae._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ae._)`${t.evaluated}.items`,(0,ae._)`undefined`))}function ND(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,ae._)`/*# sourceURL=${r} */`:ae.nil}function hY(t,e){if(UD(t)&&(FD(t),LD(t))){gY(t,e);return}(0,jD.boolOrEmptySchema)(t,e)}function LD({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function UD(t){return typeof t.schema!="boolean"}function gY(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&ZD(t),vY(t),bY(t);let i=n.const("_errs",we.default.errors);BD(t,i),n.var(e,(0,ae._)`${i} === ${we.default.errors}`)}function FD(t){(0,mi.checkUnknownRules)(t),_Y(t)}function BD(t,e){if(t.opts.jtd)return zD(t,[],!1,e);let r=(0,RD.getSchemaTypes)(t.schema),n=(0,RD.coerceAndCheckDataType)(t,r);zD(t,r,!n,e)}function _Y(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,mi.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function yY(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,mi.checkStrictMode)(t,"default is ignored in the schema root")}function vY(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,uY.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function bY(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function ZD({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,ae._)`${we.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let s=(0,ae.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,ae._)`${we.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function wY(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=t;r.$async?e.if((0,ae._)`${we.default.errors} === 0`,()=>e.return(we.default.data),()=>e.throw((0,ae._)`new ${o}(${we.default.vErrors})`)):(e.assign((0,ae._)`${n}.errors`,we.default.vErrors),i.unevaluated&&xY(t),e.return((0,ae._)`${we.default.errors} === 0`))}function xY({gen:t,evaluated:e,props:r,items:n}){r instanceof ae.Name&&t.assign((0,ae._)`${e}.props`,r),n instanceof ae.Name&&t.assign((0,ae._)`${e}.items`,n)}function zD(t,e,r,n){let{gen:o,schema:i,data:s,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,mi.schemaHasRulesButRef)(i,l))){o.block(()=>VD(t,"$ref",l.all.$ref.definition));return}c.jtd||$Y(t,e),o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,mk.shouldUseGroup)(i,f)&&(f.type?(o.if((0,ob.checkDataType)(f.type,s,c.strictNumbers)),MD(t,f),e.length===1&&e[0]===f.type&&r&&(o.else(),(0,ob.reportTypeError)(t)),o.endIf()):MD(t,f),a||o.if((0,ae._)`${we.default.errors} === ${n||0}`))}}function MD(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,cY.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,mk.shouldUseRule)(n,i)&&VD(t,i.keyword,i.definition,e.type)})}function $Y(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(IY(t,e),t.opts.allowUnionTypes||SY(t,e),kY(t,t.dataTypes))}function IY(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{qD(t.dataTypes,r)||hk(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),EY(t,e)}}function SY(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&hk(t,"use allowUnionTypes to allow union type keyword")}function kY(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,mk.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(s=>TY(e,s))&&hk(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function TY(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function qD(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function EY(t,e){let r=[];for(let n of t.dataTypes)qD(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function hk(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,mi.checkStrictMode)(t,e,t.opts.strictTypes)}var ib=class{constructor(e,r,n){if((0,Bf.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,mi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",GD(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Bf.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",we.default.errors))}result(e,r,n){this.failResult((0,ae.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,ae.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,ae._)`${r} !== undefined && (${(0,ae.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Ff.reportExtraError:Ff.reportError)(this,this.def.error,r)}$dataError(){(0,Ff.reportError)(this,this.def.$dataError||Ff.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ff.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=ae.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=ae.nil,r=ae.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:s}=this;n.if((0,ae.or)((0,ae._)`${o} === undefined`,r)),e!==ae.nil&&n.assign(e,!0),(i.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==ae.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,ae.or)(s(),a());function s(){if(n.length){if(!(r instanceof ae.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,ae._)`${(0,ob.checkDataTypes)(c,r,i.opts.strictNumbers,ob.DataType.Wrong)}`}return ae.nil}function a(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,ae._)`!${c}(${r})`}return ae.nil}}subschema(e,r){let n=(0,fk.getSubschema)(this.it,e);(0,fk.extendSubschemaData)(n,this.it,e),(0,fk.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return hY(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=mi.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=mi.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,ae.Name)),!0}};xs.KeywordCxt=ib;function VD(t,e,r,n){let o=new ib(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Bf.funcKeywordCode)(o,r):"macro"in r?(0,Bf.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Bf.funcKeywordCode)(o,r)}var AY=/^\/(?:[^~]|~0|~1)*$/,OY=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function GD(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return we.default.rootData;if(t[0]==="/"){if(!AY.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=we.default.rootData}else{let u=OY.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!o)return i}let s=i,a=o.split("/");for(let u of a)u&&(i=(0,ae._)`${i}${(0,ae.getProperty)((0,mi.unescapeJsonPointer)(u))}`,s=(0,ae._)`${s} && ${i}`);return s;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}xs.getData=GD});var sb=P(_k=>{"use strict";Object.defineProperty(_k,"__esModule",{value:!0});var gk=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};_k.default=gk});var qf=P(bk=>{"use strict";Object.defineProperty(bk,"__esModule",{value:!0});var yk=Uf(),vk=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,yk.resolveUrl)(e,r,n),this.missingSchema=(0,yk.normalizeId)((0,yk.getFullPath)(e,this.missingRef))}};bk.default=vk});var cb=P(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.resolveSchema=An.getCompilingSchema=An.resolveRef=An.compileSchema=An.SchemaEnv=void 0;var Yn=Oe(),PY=sb(),ic=fi(),Qn=Uf(),KD=Be(),CY=Zf(),Pl=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Qn.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};An.SchemaEnv=Pl;function xk(t){let e=HD.call(this,t);if(e)return e;let r=(0,Qn.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,s=new Yn.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),a;t.$async&&(a=s.scopeValue("Error",{ref:PY.default,code:(0,Yn._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");t.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:ic.default.data,parentData:ic.default.parentData,parentDataProperty:ic.default.parentDataProperty,dataNames:[ic.default.data],dataPathArr:[Yn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Yn.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Yn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Yn._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,CY.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let d=s.toString();l=`${s.scopeRefs(ic.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let p=new Function(`${ic.default.self}`,`${ic.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=u;p.evaluated={props:m instanceof Yn.Name?void 0:m,items:h instanceof Yn.Name?void 0:h,dynamicProps:m instanceof Yn.Name,dynamicItems:h instanceof Yn.Name},p.source&&(p.source.evaluated=(0,Yn.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}An.compileSchema=xk;function RY(t,e,r){var n;r=(0,Qn.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let i=MY.call(this,t,r);if(i===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(i=new Pl({schema:s,schemaId:a,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=NY.call(this,i)}An.resolveRef=RY;function NY(t){return(0,Qn.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:xk.call(this,t)}function HD(t){for(let e of this._compilations)if(zY(e,t))return e}An.getCompilingSchema=HD;function zY(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function MY(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||ab.call(this,t,e)}function ab(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Qn._getFullPath)(this.opts.uriResolver,r),o=(0,Qn.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return wk.call(this,r,t);let i=(0,Qn.normalizeId)(n),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){let a=ab.call(this,t,s);return typeof a?.schema!="object"?void 0:wk.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||xk.call(this,s),i===(0,Qn.normalizeId)(e)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,Qn.resolveUrl)(this.opts.uriResolver,o,u)),new Pl({schema:a,schemaId:c,root:t,baseId:o})}return wk.call(this,r,s)}}An.resolveSchema=ab;var jY=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function wk(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,KD.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!jY.has(a)&&u&&(e=(0,Qn.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,KD.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Qn.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=ab.call(this,n,a)}let{schemaId:s}=this.opts;if(i=i||new Pl({schema:r,schemaId:s,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var WD=P((J2e,DY)=>{DY.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Ik=P((X2e,QD)=>{"use strict";var LY=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),XD=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function $k(t){let e="",r=0,n=0;for(n=0;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var UY=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function JD(t){return t.length=0,!0}function FY(t,e,r){if(t.length){let n=$k(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function BY(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,s=!1,a=FY;for(let c=0;c7){r.error=!0;break}c>0&&t[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=JD}else{o.push(u);continue}}return o.length&&(a===JD?r.zone=o.join(""):s?n.push(o.join("")):n.push($k(o))),r.address=n.join(""),r}function YD(t){if(ZY(t,":")<2)return{host:t,isIPV6:!1};let e=BY(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function ZY(t,e){let r=0;for(let n=0;n{"use strict";var{isUUID:KY}=Ik(),HY=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,WY=["http","https","ws","wss","urn","urn:uuid"];function JY(t){return WY.indexOf(t)!==-1}function Sk(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function eL(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function tL(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function XY(t){return t.secure=Sk(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function YY(t){if((t.port===(Sk(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function QY(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(HY);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,i=kk(o);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function eQ(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,i=kk(o);i&&(t=i.serialize(t,e));let s=t,a=t.nss;return s.path=`${n||e.nid}:${a}`,e.skipEscape=!0,s}function tQ(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!KY(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function rQ(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var rL={scheme:"http",domainHost:!0,parse:eL,serialize:tL},nQ={scheme:"https",domainHost:rL.domainHost,parse:eL,serialize:tL},ub={scheme:"ws",domainHost:!0,parse:XY,serialize:YY},oQ={scheme:"wss",domainHost:ub.domainHost,parse:ub.parse,serialize:ub.serialize},iQ={scheme:"urn",parse:QY,serialize:eQ,skipNormalize:!0},sQ={scheme:"urn:uuid",parse:tQ,serialize:rQ,skipNormalize:!0},lb={http:rL,https:nQ,ws:ub,wss:oQ,urn:iQ,"urn:uuid":sQ};Object.setPrototypeOf(lb,null);function kk(t){return t&&(lb[t]||lb[t.toLowerCase()])||void 0}nL.exports={wsIsSecure:Sk,SCHEMES:lb,isValidSchemeName:JY,getSchemeHandler:kk}});var aL=P((Q2e,pb)=>{"use strict";var{normalizeIPv6:aQ,removeDotSegments:Vf,recomposeAuthority:cQ,normalizeComponentEncoding:db,isIPv4:uQ,nonSimpleDomain:lQ}=Ik(),{SCHEMES:dQ,getSchemeHandler:iL}=oL();function pQ(t,e){return typeof t=="string"?t=Oo(hi(t,e),e):typeof t=="object"&&(t=hi(Oo(t,e),e)),t}function fQ(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=sL(hi(t,n),hi(e,n),n,!0);return n.skipEscape=!0,Oo(o,n)}function sL(t,e,r,n){let o={};return n||(t=hi(Oo(t,r),r),e=hi(Oo(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Vf(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Vf(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=Vf(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=Vf(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function mQ(t,e,r){return typeof t=="string"?(t=unescape(t),t=Oo(db(hi(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Oo(db(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Oo(db(hi(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Oo(db(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Oo(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],i=iL(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let s=cQ(r);if(s!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(s),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(a=Vf(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var hQ=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function hi(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(hQ);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(uQ(n.host)===!1){let c=aQ(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let s=iL(r.scheme||n.scheme);if(!r.unicodeSupport&&(!s||!s.unicodeSupport)&&n.host&&(r.domainHost||s&&s.domainHost)&&o===!1&&lQ(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!s||s&&!s.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),s&&s.parse&&s.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Tk={SCHEMES:dQ,normalize:pQ,resolve:fQ,resolveComponent:sL,equal:mQ,serialize:Oo,parse:hi};pb.exports=Tk;pb.exports.default=Tk;pb.exports.fastUri=Tk});var uL=P(Ek=>{"use strict";Object.defineProperty(Ek,"__esModule",{value:!0});var cL=aL();cL.code='require("ajv/dist/runtime/uri").default';Ek.default=cL});var _L=P(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.CodeGen=Xt.Name=Xt.nil=Xt.stringify=Xt.str=Xt._=Xt.KeywordCxt=void 0;var gQ=Zf();Object.defineProperty(Xt,"KeywordCxt",{enumerable:!0,get:function(){return gQ.KeywordCxt}});var Cl=Oe();Object.defineProperty(Xt,"_",{enumerable:!0,get:function(){return Cl._}});Object.defineProperty(Xt,"str",{enumerable:!0,get:function(){return Cl.str}});Object.defineProperty(Xt,"stringify",{enumerable:!0,get:function(){return Cl.stringify}});Object.defineProperty(Xt,"nil",{enumerable:!0,get:function(){return Cl.nil}});Object.defineProperty(Xt,"Name",{enumerable:!0,get:function(){return Cl.Name}});Object.defineProperty(Xt,"CodeGen",{enumerable:!0,get:function(){return Cl.CodeGen}});var _Q=sb(),mL=qf(),yQ=nk(),Gf=cb(),vQ=Oe(),Kf=Uf(),fb=Lf(),Ok=Be(),lL=WD(),bQ=uL(),hL=(t,e)=>new RegExp(t,e);hL.code="new RegExp";var wQ=["removeAdditional","useDefaults","coerceTypes"],xQ=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),$Q={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},IQ={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},dL=200;function SQ(t){var e,r,n,o,i,s,a,c,u,l,d,f,p,m,h,_,v,b,x,k,T,F,J,w,Z;let oe=t.strict,Q=(e=t.code)===null||e===void 0?void 0:e.optimize,wt=Q===!0||Q===void 0?1:Q||0,dn=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:hL,pn=(o=t.uriResolver)!==null&&o!==void 0?o:bQ.default;return{strictSchema:(s=(i=t.strictSchema)!==null&&i!==void 0?i:oe)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:oe)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:oe)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:oe)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:oe)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:wt,regExp:dn}:{optimize:wt,regExp:dn},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:dL,loopEnum:(_=t.loopEnum)!==null&&_!==void 0?_:dL,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(x=t.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(k=t.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(F=t.validateSchema)!==null&&F!==void 0?F:!0,validateFormats:(J=t.validateFormats)!==null&&J!==void 0?J:!0,unicodeRegExp:(w=t.unicodeRegExp)!==null&&w!==void 0?w:!0,int32range:(Z=t.int32range)!==null&&Z!==void 0?Z:!0,uriResolver:pn}}var Hf=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...SQ(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new vQ.ValueScope({scope:{},prefixes:xQ,es5:r,lines:n}),this.logger=PQ(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,yQ.getRules)(),pL.call(this,$Q,e,"NOT SUPPORTED"),pL.call(this,IQ,e,"DEPRECATED","warn"),this._metaOpts=AQ.call(this),e.formats&&TQ.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&EQ.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),kQ.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=lL;n==="id"&&(o={...lL},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await i.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||s.call(this,f)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof mL.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,o);return this}let i;if(typeof e=="object"){let{schemaId:s}=this.opts;if(i=e[s],i!==void 0&&typeof i!="string")throw new Error(`schema ${s} must be string`)}return r=(0,Kf.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(e){let r;for(;typeof(r=fL.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Gf.SchemaEnv({schema:{},schemaId:n});if(r=Gf.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=fL.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Kf.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(RQ.call(this,n,r),!r)return(0,Ok.eachItem)(n,i=>Ak.call(this,i)),this;zQ.call(this,r);let o={...r,type:(0,fb.getJSONTypes)(r.type),schemaType:(0,fb.getJSONTypes)(r.schemaType)};return(0,Ok.eachItem)(n,o.type.length===0?i=>Ak.call(this,i,o):i=>o.type.forEach(s=>Ak.call(this,i,o,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let i=o.split("/").slice(1),s=e;for(let a of i)s=s[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=s[a];u&&l&&(s[a]=gL(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Kf.normalizeId)(s||n);let u=Kf.getSchemaRefs.call(this,e,n);return c=new Gf.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Gf.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Gf.compileSchema.call(this,e)}finally{this.opts=r}}};Hf.ValidationError=_Q.default;Hf.MissingRefError=mL.default;Xt.default=Hf;function pL(t,e,r,n="error"){for(let o in t){let i=o;i in e&&this.logger[n](`${r}: option ${o}. ${t[i]}`)}}function fL(t){return t=(0,Kf.normalizeId)(t),this.schemas[t]||this.refs[t]}function kQ(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function TQ(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function EQ(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function AQ(){let t={...this.opts};for(let e of wQ)delete t[e];return t}var OQ={log(){},warn(){},error(){}};function PQ(t){if(t===!1)return OQ;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var CQ=/^[a-z_$][a-z0-9_$:-]*$/i;function RQ(t,e){let{RULES:r}=this;if((0,Ok.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!CQ.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Ak(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=o?i.post:i.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,fb.getJSONTypes)(e.type),schemaType:(0,fb.getJSONTypes)(e.schemaType)}};e.before?NQ.call(this,s,a,e.before):s.rules.push(a),i.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function NQ(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function zQ(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=gL(e)),t.validateSchema=this.compile(e,!0))}var MQ={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function gL(t){return{anyOf:[t,MQ]}}});var yL=P(Pk=>{"use strict";Object.defineProperty(Pk,"__esModule",{value:!0});var jQ={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Pk.default=jQ});var xL=P(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.callRef=sc.getValidate=void 0;var DQ=qf(),vL=En(),qr=Oe(),Rl=fi(),bL=cb(),mb=Be(),LQ={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:i,validateName:s,opts:a,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=bL.resolveRef.call(c,u,o,r);if(l===void 0)throw new DQ.default(n.opts.uriResolver,o,r);if(l instanceof bL.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return hb(t,s,i,i.$async);let m=e.scopeValue("root",{ref:u});return hb(t,(0,qr._)`${m}.validate`,u,u.$async)}function f(m){let h=wL(t,m);hb(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,qr.stringify)(m)}:{ref:m}),_=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:qr.nil,topSchemaRef:h,errSchemaPath:r},_);t.mergeEvaluated(v),t.ok(_)}}};function wL(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,qr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}sc.getValidate=wL;function hb(t,e,r,n){let{gen:o,it:i}=t,{allErrors:s,schemaEnv:a,opts:c}=i,u=c.passContext?Rl.default.this:qr.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{o.code((0,qr._)`await ${(0,vL.callValidateCode)(t,e,u)}`),p(e),s||o.assign(m,!0)},h=>{o.if((0,qr._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),f(h),s||o.assign(m,!1)}),t.ok(m)}function d(){t.result((0,vL.callValidateCode)(t,e,u),()=>p(e),()=>f(e))}function f(m){let h=(0,qr._)`${m}.errors`;o.assign(Rl.default.vErrors,(0,qr._)`${Rl.default.vErrors} === null ? ${h} : ${Rl.default.vErrors}.concat(${h})`),o.assign(Rl.default.errors,(0,qr._)`${Rl.default.vErrors}.length`)}function p(m){var h;if(!i.opts.unevaluated)return;let _=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(i.props=mb.mergeEvaluated.props(o,_.props,i.props));else{let v=o.var("props",(0,qr._)`${m}.evaluated.props`);i.props=mb.mergeEvaluated.props(o,v,i.props,qr.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=mb.mergeEvaluated.items(o,_.items,i.items));else{let v=o.var("items",(0,qr._)`${m}.evaluated.items`);i.items=mb.mergeEvaluated.items(o,v,i.items,qr.Name)}}}sc.callRef=hb;sc.default=LQ});var $L=P(Ck=>{"use strict";Object.defineProperty(Ck,"__esModule",{value:!0});var UQ=yL(),FQ=xL(),BQ=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",UQ.default,FQ.default];Ck.default=BQ});var IL=P(Rk=>{"use strict";Object.defineProperty(Rk,"__esModule",{value:!0});var gb=Oe(),$s=gb.operators,_b={maximum:{okStr:"<=",ok:$s.LTE,fail:$s.GT},minimum:{okStr:">=",ok:$s.GTE,fail:$s.LT},exclusiveMaximum:{okStr:"<",ok:$s.LT,fail:$s.GTE},exclusiveMinimum:{okStr:">",ok:$s.GT,fail:$s.LTE}},ZQ={message:({keyword:t,schemaCode:e})=>(0,gb.str)`must be ${_b[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,gb._)`{comparison: ${_b[t].okStr}, limit: ${e}}`},qQ={keyword:Object.keys(_b),type:"number",schemaType:"number",$data:!0,error:ZQ,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,gb._)`${r} ${_b[e].fail} ${n} || isNaN(${r})`)}};Rk.default=qQ});var SL=P(Nk=>{"use strict";Object.defineProperty(Nk,"__esModule",{value:!0});var Wf=Oe(),VQ={message:({schemaCode:t})=>(0,Wf.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Wf._)`{multipleOf: ${t}}`},GQ={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:VQ,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,i=o.opts.multipleOfPrecision,s=e.let("res"),a=i?(0,Wf._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:(0,Wf._)`${s} !== parseInt(${s})`;t.fail$data((0,Wf._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};Nk.default=GQ});var TL=P(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});function kL(t){let e=t.length,r=0,n=0,o;for(;n=55296&&o<=56319&&n{"use strict";Object.defineProperty(Mk,"__esModule",{value:!0});var ac=Oe(),KQ=Be(),HQ=TL(),WQ={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,ac.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,ac._)`{limit: ${t}}`},JQ={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:WQ,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,i=e==="maxLength"?ac.operators.GT:ac.operators.LT,s=o.opts.unicode===!1?(0,ac._)`${r}.length`:(0,ac._)`${(0,KQ.useFunc)(t.gen,HQ.default)}(${r})`;t.fail$data((0,ac._)`${s} ${i} ${n}`)}};Mk.default=JQ});var AL=P(jk=>{"use strict";Object.defineProperty(jk,"__esModule",{value:!0});var XQ=En(),yb=Oe(),YQ={message:({schemaCode:t})=>(0,yb.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,yb._)`{pattern: ${t}}`},QQ={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:YQ,code(t){let{data:e,$data:r,schema:n,schemaCode:o,it:i}=t,s=i.opts.unicodeRegExp?"u":"",a=r?(0,yb._)`(new RegExp(${o}, ${s}))`:(0,XQ.usePattern)(t,n);t.fail$data((0,yb._)`!${a}.test(${e})`)}};jk.default=QQ});var OL=P(Dk=>{"use strict";Object.defineProperty(Dk,"__esModule",{value:!0});var Jf=Oe(),eee={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Jf.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Jf._)`{limit: ${t}}`},tee={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:eee,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Jf.operators.GT:Jf.operators.LT;t.fail$data((0,Jf._)`Object.keys(${r}).length ${o} ${n}`)}};Dk.default=tee});var PL=P(Lk=>{"use strict";Object.defineProperty(Lk,"__esModule",{value:!0});var Xf=En(),Yf=Oe(),ree=Be(),nee={message:({params:{missingProperty:t}})=>(0,Yf.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Yf._)`{missingProperty: ${t}}`},oee={keyword:"required",type:"object",schemaType:"array",$data:!0,error:nee,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:i,it:s}=t,{opts:a}=s;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?u():l(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let _=s.schemaEnv.baseId+s.errSchemaPath,v=`required property "${h}" is not defined at "${_}" (strictRequired)`;(0,ree.checkStrictMode)(s,v,s.opts.strictRequired)}}function u(){if(c||i)t.block$data(Yf.nil,d);else for(let p of r)(0,Xf.checkReportMissingProp)(t,p)}function l(){let p=e.let("missing");if(c||i){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,Xf.checkMissingProp)(t,r,p)),(0,Xf.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Xf.noPropertyInData)(e,o,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,Xf.propertyInData)(e,o,p,a.ownProperties)),e.if((0,Yf.not)(m),()=>{t.error(),e.break()})},Yf.nil)}}};Lk.default=oee});var CL=P(Uk=>{"use strict";Object.defineProperty(Uk,"__esModule",{value:!0});var Qf=Oe(),iee={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Qf.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Qf._)`{limit: ${t}}`},see={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:iee,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Qf.operators.GT:Qf.operators.LT;t.fail$data((0,Qf._)`${r}.length ${o} ${n}`)}};Uk.default=see});var vb=P(Fk=>{"use strict";Object.defineProperty(Fk,"__esModule",{value:!0});var RL=dk();RL.code='require("ajv/dist/runtime/equal").default';Fk.default=RL});var NL=P(Zk=>{"use strict";Object.defineProperty(Zk,"__esModule",{value:!0});var Bk=Lf(),Yt=Oe(),aee=Be(),cee=vb(),uee={message:({params:{i:t,j:e}})=>(0,Yt.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Yt._)`{i: ${t}, j: ${e}}`},lee={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:uee,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:i,schemaCode:s,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=i.items?(0,Bk.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Yt._)`${s} === false`),t.ok(c);function l(){let m=e.let("i",(0,Yt._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,Yt._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,h){let _=e.name("item"),v=(0,Bk.checkDataTypes)(u,_,a.opts.strictNumbers,Bk.DataType.Wrong),b=e.const("indices",(0,Yt._)`{}`);e.for((0,Yt._)`;${m}--;`,()=>{e.let(_,(0,Yt._)`${r}[${m}]`),e.if(v,(0,Yt._)`continue`),u.length>1&&e.if((0,Yt._)`typeof ${_} == "string"`,(0,Yt._)`${_} += "_"`),e.if((0,Yt._)`typeof ${b}[${_}] == "number"`,()=>{e.assign(h,(0,Yt._)`${b}[${_}]`),t.error(),e.assign(c,!1).break()}).code((0,Yt._)`${b}[${_}] = ${m}`)})}function p(m,h){let _=(0,aee.useFunc)(e,cee.default),v=e.name("outer");e.label(v).for((0,Yt._)`;${m}--;`,()=>e.for((0,Yt._)`${h} = ${m}; ${h}--;`,()=>e.if((0,Yt._)`${_}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Zk.default=lee});var zL=P(Vk=>{"use strict";Object.defineProperty(Vk,"__esModule",{value:!0});var qk=Oe(),dee=Be(),pee=vb(),fee={message:"must be equal to constant",params:({schemaCode:t})=>(0,qk._)`{allowedValue: ${t}}`},mee={keyword:"const",$data:!0,error:fee,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,qk._)`!${(0,dee.useFunc)(e,pee.default)}(${r}, ${o})`):t.fail((0,qk._)`${i} !== ${r}`)}};Vk.default=mee});var ML=P(Gk=>{"use strict";Object.defineProperty(Gk,"__esModule",{value:!0});var em=Oe(),hee=Be(),gee=vb(),_ee={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,em._)`{allowedValues: ${t}}`},yee={keyword:"enum",schemaType:"array",$data:!0,error:_ee,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:s}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=s.opts.loopEnum,c,u=()=>c??(c=(0,hee.useFunc)(e,gee.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let p=e.const("vSchema",i);l=(0,em.or)(...o.map((m,h)=>f(p,h)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,p=>e.if((0,em._)`${u()}(${r}, ${p})`,()=>e.assign(l,!0).break()))}function f(p,m){let h=o[m];return typeof h=="object"&&h!==null?(0,em._)`${u()}(${r}, ${p}[${m}])`:(0,em._)`${r} === ${h}`}}};Gk.default=yee});var jL=P(Kk=>{"use strict";Object.defineProperty(Kk,"__esModule",{value:!0});var vee=IL(),bee=SL(),wee=EL(),xee=AL(),$ee=OL(),Iee=PL(),See=CL(),kee=NL(),Tee=zL(),Eee=ML(),Aee=[vee.default,bee.default,wee.default,xee.default,$ee.default,Iee.default,See.default,kee.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Tee.default,Eee.default];Kk.default=Aee});var Wk=P(tm=>{"use strict";Object.defineProperty(tm,"__esModule",{value:!0});tm.validateAdditionalItems=void 0;var cc=Oe(),Hk=Be(),Oee={message:({params:{len:t}})=>(0,cc.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,cc._)`{limit: ${t}}`},Pee={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Oee,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Hk.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}DL(t,n)}};function DL(t,e){let{gen:r,schema:n,data:o,keyword:i,it:s}=t;s.items=!0;let a=r.const("len",(0,cc._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,cc._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Hk.alwaysValidSchema)(s,n)){let u=r.var("valid",(0,cc._)`${a} <= ${e.length}`);r.if((0,cc.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:Hk.Type.Num},u),s.allErrors||r.if((0,cc.not)(u),()=>r.break())})}}tm.validateAdditionalItems=DL;tm.default=Pee});var Jk=P(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});rm.validateTuple=void 0;var LL=Oe(),bb=Be(),Cee=En(),Ree={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return UL(t,"additionalItems",e);r.items=!0,!(0,bb.alwaysValidSchema)(r,e)&&t.ok((0,Cee.validateArray)(t))}};function UL(t,e,r=t.schema){let{gen:n,parentSchema:o,data:i,keyword:s,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=bb.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,LL._)`${i}.length`);r.forEach((d,f)=>{(0,bb.alwaysValidSchema)(a,d)||(n.if((0,LL._)`${u} > ${f}`,()=>t.subschema({keyword:s,schemaProp:f,dataProp:f},c)),t.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let _=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,bb.checkStrictMode)(a,_,f.strictTuples)}}}rm.validateTuple=UL;rm.default=Ree});var FL=P(Xk=>{"use strict";Object.defineProperty(Xk,"__esModule",{value:!0});var Nee=Jk(),zee={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Nee.validateTuple)(t,"items")};Xk.default=zee});var ZL=P(Yk=>{"use strict";Object.defineProperty(Yk,"__esModule",{value:!0});var BL=Oe(),Mee=Be(),jee=En(),Dee=Wk(),Lee={message:({params:{len:t}})=>(0,BL.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,BL._)`{limit: ${t}}`},Uee={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Lee,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,Mee.alwaysValidSchema)(n,e)&&(o?(0,Dee.validateAdditionalItems)(t,o):t.ok((0,jee.validateArray)(t)))}};Yk.default=Uee});var qL=P(Qk=>{"use strict";Object.defineProperty(Qk,"__esModule",{value:!0});var On=Oe(),wb=Be(),Fee={message:({params:{min:t,max:e}})=>e===void 0?(0,On.str)`must contain at least ${t} valid item(s)`:(0,On.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,On._)`{minContains: ${t}}`:(0,On._)`{minContains: ${t}, maxContains: ${e}}`},Bee={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Fee,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t,s,a,{minContains:c,maxContains:u}=n;i.opts.next?(s=c===void 0?1:c,a=u):s=1;let l=e.const("len",(0,On._)`${o}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,wb.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,wb.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,wb.alwaysValidSchema)(i,r)){let h=(0,On._)`${l} >= ${s}`;a!==void 0&&(h=(0,On._)`${h} && ${l} <= ${a}`),t.pass(h);return}i.items=!0;let d=e.name("valid");a===void 0&&s===1?p(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,On._)`${o}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),_=e.let("count",0);p(h,()=>e.if(h,()=>m(_)))}function p(h,_){e.forRange("i",0,l,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:wb.Type.Num,compositeRule:!0},h),_()})}function m(h){e.code((0,On._)`${h}++`),a===void 0?e.if((0,On._)`${h} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,On._)`${h} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,On._)`${h} >= ${s}`,()=>e.assign(d,!0)))}}};Qk.default=Bee});var KL=P(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.validateSchemaDeps=Po.validatePropertyDeps=Po.error=void 0;var eT=Oe(),Zee=Be(),nm=En();Po.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,eT.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,eT._)`{property: ${t}, + missingProperty: ${n}, + depsCount: ${e}, + deps: ${r}}`};var qee={keyword:"dependencies",type:"object",schemaType:"object",error:Po.error,code(t){let[e,r]=Vee(t);VL(t,e),GL(t,r)}};function Vee({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function VL(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let c=(0,nm.propertyInData)(r,n,s,o.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,nm.checkReportMissingProp)(t,u)}):(r.if((0,eT._)`${c} && (${(0,nm.checkMissingProp)(t,a,i)})`),(0,nm.reportMissingProp)(t,i),r.else())}}Po.validatePropertyDeps=VL;function GL(t,e=t.schema){let{gen:r,data:n,keyword:o,it:i}=t,s=r.name("valid");for(let a in e)(0,Zee.alwaysValidSchema)(i,e[a])||(r.if((0,nm.propertyInData)(r,n,a,i.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},s);t.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),t.ok(s))}Po.validateSchemaDeps=GL;Po.default=qee});var WL=P(tT=>{"use strict";Object.defineProperty(tT,"__esModule",{value:!0});var HL=Oe(),Gee=Be(),Kee={message:"property name must be valid",params:({params:t})=>(0,HL._)`{propertyName: ${t.propertyName}}`},Hee={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Kee,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,Gee.alwaysValidSchema)(o,r))return;let i=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),e.if((0,HL.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};tT.default=Hee});var nT=P(rT=>{"use strict";Object.defineProperty(rT,"__esModule",{value:!0});var xb=En(),eo=Oe(),Wee=fi(),$b=Be(),Jee={message:"must NOT have additional properties",params:({params:t})=>(0,eo._)`{additionalProperty: ${t.additionalProperty}}`},Xee={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Jee,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,$b.alwaysValidSchema)(s,r))return;let u=(0,xb.allSchemaProperties)(n.properties),l=(0,xb.allSchemaProperties)(n.patternProperties);d(),t.ok((0,eo._)`${i} === ${Wee.default.errors}`);function d(){e.forIn("key",o,_=>{!u.length&&!l.length?m(_):e.if(f(_),()=>m(_))})}function f(_){let v;if(u.length>8){let b=(0,$b.schemaRefOrVal)(s,n.properties,"properties");v=(0,xb.isOwnProperty)(e,b,_)}else u.length?v=(0,eo.or)(...u.map(b=>(0,eo._)`${_} === ${b}`)):v=eo.nil;return l.length&&(v=(0,eo.or)(v,...l.map(b=>(0,eo._)`${(0,xb.usePattern)(t,b)}.test(${_})`))),(0,eo.not)(v)}function p(_){e.code((0,eo._)`delete ${o}[${_}]`)}function m(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(_);return}if(r===!1){t.setParams({additionalProperty:_}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,$b.alwaysValidSchema)(s,r)){let v=e.name("valid");c.removeAdditional==="failing"?(h(_,v,!1),e.if((0,eo.not)(v),()=>{t.reset(),p(_)})):(h(_,v),a||e.if((0,eo.not)(v),()=>e.break()))}}function h(_,v,b){let x={keyword:"additionalProperties",dataProp:_,dataPropType:$b.Type.Str};b===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,v)}}};rT.default=Xee});var YL=P(iT=>{"use strict";Object.defineProperty(iT,"__esModule",{value:!0});var Yee=Zf(),JL=En(),oT=Be(),XL=nT(),Qee={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&XL.default.code(new Yee.KeywordCxt(i,XL.default,"additionalProperties"));let s=(0,JL.allSchemaProperties)(r);for(let d of s)i.definedProperties.add(d);i.opts.unevaluated&&s.length&&i.props!==!0&&(i.props=oT.mergeEvaluated.props(e,(0,oT.toHash)(s),i.props));let a=s.filter(d=>!(0,oT.alwaysValidSchema)(i,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,JL.propertyInData)(e,o,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};iT.default=Qee});var rU=P(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0});var QL=En(),Ib=Oe(),eU=Be(),tU=Be(),ete={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:i}=t,{opts:s}=i,a=(0,QL.allSchemaProperties)(r),c=a.filter(h=>(0,eU.alwaysValidSchema)(i,r[h]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&o.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof Ib.Name)&&(i.props=(0,tU.evaluatedPropsToName)(e,i.props));let{props:d}=i;f();function f(){for(let h of a)u&&p(h),i.allErrors?m(h):(e.var(l,!0),m(h),e.if(l))}function p(h){for(let _ in u)new RegExp(h).test(_)&&(0,eU.checkStrictMode)(i,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,_=>{e.if((0,Ib._)`${(0,QL.usePattern)(t,h)}.test(${_})`,()=>{let v=c.includes(h);v||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:tU.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,Ib._)`${d}[${_}]`,!0):!v&&!i.allErrors&&e.if((0,Ib.not)(l),()=>e.break())})})}}};sT.default=ete});var nU=P(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});var tte=Be(),rte={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,tte.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};aT.default=rte});var oU=P(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});var nte=En(),ote={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:nte.validateUnion,error:{message:"must match a schema in anyOf"}};cT.default=ote});var iU=P(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});var Sb=Oe(),ite=Be(),ste={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Sb._)`{passingSchemas: ${t.passing}}`},ate={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:ste,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,s=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(s,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let f;(0,ite.alwaysValidSchema)(o,l)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Sb._)`${c} && ${s}`).assign(s,!1).assign(a,(0,Sb._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(s,!0),e.assign(a,d),f&&t.mergeEvaluated(f,Sb.Name)})})}}};uT.default=ate});var sU=P(lT=>{"use strict";Object.defineProperty(lT,"__esModule",{value:!0});var cte=Be(),ute={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((i,s)=>{if((0,cte.alwaysValidSchema)(n,i))return;let a=t.subschema({keyword:"allOf",schemaProp:s},o);t.ok(o),t.mergeEvaluated(a)})}};lT.default=ute});var uU=P(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0});var kb=Oe(),cU=Be(),lte={message:({params:t})=>(0,kb.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,kb._)`{failingKeyword: ${t.ifClause}}`},dte={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:lte,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,cU.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=aU(n,"then"),i=aU(n,"else");if(!o&&!i)return;let s=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else o?e.if(a,u("then")):e.if((0,kb.not)(a),u("else"));t.pass(s,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let f=t.subschema({keyword:l},a);e.assign(s,a),t.mergeValidEvaluated(f,s),d?e.assign(d,(0,kb._)`${l}`):t.setParams({ifClause:l})}}}};function aU(t,e){let r=t.schema[e];return r!==void 0&&!(0,cU.alwaysValidSchema)(t,r)}dT.default=dte});var lU=P(pT=>{"use strict";Object.defineProperty(pT,"__esModule",{value:!0});var pte=Be(),fte={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,pte.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};pT.default=fte});var dU=P(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});var mte=Wk(),hte=FL(),gte=Jk(),_te=ZL(),yte=qL(),vte=KL(),bte=WL(),wte=nT(),xte=YL(),$te=rU(),Ite=nU(),Ste=oU(),kte=iU(),Tte=sU(),Ete=uU(),Ate=lU();function Ote(t=!1){let e=[Ite.default,Ste.default,kte.default,Tte.default,Ete.default,Ate.default,bte.default,wte.default,vte.default,xte.default,$te.default];return t?e.push(hte.default,_te.default):e.push(mte.default,gte.default),e.push(yte.default),e}fT.default=Ote});var pU=P(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});var kt=Oe(),Pte={message:({schemaCode:t})=>(0,kt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,kt._)`{format: ${t}}`},Cte={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Pte,code(t,e){let{gen:r,data:n,$data:o,schema:i,schemaCode:s,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,kt._)`${m}[${s}]`),_=r.let("fType"),v=r.let("format");r.if((0,kt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(_,(0,kt._)`${h}.type || "string"`).assign(v,(0,kt._)`${h}.validate`),()=>r.assign(_,(0,kt._)`"string"`).assign(v,h)),t.fail$data((0,kt.or)(b(),x()));function b(){return c.strictSchema===!1?kt.nil:(0,kt._)`${s} && !${v}`}function x(){let k=l.$async?(0,kt._)`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,kt._)`${v}(${n})`,T=(0,kt._)`(typeof ${v} == "function" ? ${k} : ${v}.test(${n}))`;return(0,kt._)`${v} && ${v} !== true && ${_} === ${e} && !${T}`}}function p(){let m=d.formats[i];if(!m){b();return}if(m===!0)return;let[h,_,v]=x(m);h===e&&t.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function x(T){let F=T instanceof RegExp?(0,kt.regexpCode)(T):c.code.formats?(0,kt._)`${c.code.formats}${(0,kt.getProperty)(i)}`:void 0,J=r.scopeValue("formats",{key:i,ref:T,code:F});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,kt._)`${J}.validate`]:["string",T,J]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,kt._)`await ${v}(${n})`}return typeof _=="function"?(0,kt._)`${v}(${n})`:(0,kt._)`${v}.test(${n})`}}}};mT.default=Cte});var fU=P(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});var Rte=pU(),Nte=[Rte.default];hT.default=Nte});var mU=P(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.contentVocabulary=Nl.metadataVocabulary=void 0;Nl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Nl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var gU=P(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});var zte=$L(),Mte=jL(),jte=dU(),Dte=fU(),hU=mU(),Lte=[zte.default,Mte.default,(0,jte.default)(),Dte.default,hU.metadataVocabulary,hU.contentVocabulary];gT.default=Lte});var yU=P(Tb=>{"use strict";Object.defineProperty(Tb,"__esModule",{value:!0});Tb.DiscrError=void 0;var _U;(function(t){t.Tag="tag",t.Mapping="mapping"})(_U||(Tb.DiscrError=_U={}))});var bU=P(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});var zl=Oe(),_T=yU(),vU=cb(),Ute=qf(),Fte=Be(),Bte={message:({params:{discrError:t,tagName:e}})=>t===_T.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,zl._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},Zte={keyword:"discriminator",type:"object",schemaType:"object",error:Bte,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:i}=t,{oneOf:s}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,zl._)`${r}${(0,zl.getProperty)(a)}`);e.if((0,zl._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:_T.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,zl._)`${u} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:_T.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(h,zl.Name),m}function f(){var p;let m={},h=v(o),_=!0;for(let k=0;k{qte.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var bT=P((lt,vT)=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.MissingRefError=lt.ValidationError=lt.CodeGen=lt.Name=lt.nil=lt.stringify=lt.str=lt._=lt.KeywordCxt=lt.Ajv=void 0;var Vte=_L(),Gte=gU(),Kte=bU(),xU=wU(),Hte=["/properties"],Eb="http://json-schema.org/draft-07/schema",Ml=class extends Vte.default{_addVocabularies(){super._addVocabularies(),Gte.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Kte.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(xU,Hte):xU;this.addMetaSchema(e,Eb,!1),this.refs["http://json-schema.org/schema"]=Eb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Eb)?Eb:void 0)}};lt.Ajv=Ml;vT.exports=lt=Ml;vT.exports.Ajv=Ml;Object.defineProperty(lt,"__esModule",{value:!0});lt.default=Ml;var Wte=Zf();Object.defineProperty(lt,"KeywordCxt",{enumerable:!0,get:function(){return Wte.KeywordCxt}});var jl=Oe();Object.defineProperty(lt,"_",{enumerable:!0,get:function(){return jl._}});Object.defineProperty(lt,"str",{enumerable:!0,get:function(){return jl.str}});Object.defineProperty(lt,"stringify",{enumerable:!0,get:function(){return jl.stringify}});Object.defineProperty(lt,"nil",{enumerable:!0,get:function(){return jl.nil}});Object.defineProperty(lt,"Name",{enumerable:!0,get:function(){return jl.Name}});Object.defineProperty(lt,"CodeGen",{enumerable:!0,get:function(){return jl.CodeGen}});var Jte=sb();Object.defineProperty(lt,"ValidationError",{enumerable:!0,get:function(){return Jte.default}});var Xte=qf();Object.defineProperty(lt,"MissingRefError",{enumerable:!0,get:function(){return Xte.default}})});var OU=P(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.formatNames=Ro.fastFormats=Ro.fullFormats=void 0;function Co(t,e){return{validate:t,compare:e}}Ro.fullFormats={date:Co(kU,IT),time:Co(xT(!0),ST),"date-time":Co($U(!0),EU),"iso-time":Co(xT(),TU),"iso-date-time":Co($U(),AU),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:nre,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:lre,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:ore,int32:{type:"number",validate:are},int64:{type:"number",validate:cre},float:{type:"number",validate:SU},double:{type:"number",validate:SU},password:!0,binary:!0};Ro.fastFormats={...Ro.fullFormats,date:Co(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,IT),time:Co(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ST),"date-time":Co(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,EU),"iso-time":Co(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,TU),"iso-date-time":Co(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,AU),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Ro.formatNames=Object.keys(Ro.fullFormats);function Yte(t){return t%4===0&&(t%100!==0||t%400===0)}var Qte=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,ere=[0,31,28,31,30,31,30,31,31,30,31,30,31];function kU(t){let e=Qte.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&Yte(r)?29:ere[n])}function IT(t,e){if(t&&e)return t>e?1:t23||l>59||t&&!a)return!1;if(o<=23&&i<=59&&s<60)return!0;let d=i-l*c,f=o-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&s<61}}function ST(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function TU(t,e){if(!(t&&e))return;let r=wT.exec(t),n=wT.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t=ire}function cre(t){return Number.isInteger(t)}function SU(){return!0}var ure=/[^\\]\\Z/;function lre(t){if(ure.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var PU=P(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.formatLimitDefinition=void 0;var dre=bT(),to=Oe(),Is=to.operators,Ab={formatMaximum:{okStr:"<=",ok:Is.LTE,fail:Is.GT},formatMinimum:{okStr:">=",ok:Is.GTE,fail:Is.LT},formatExclusiveMaximum:{okStr:"<",ok:Is.LT,fail:Is.GTE},formatExclusiveMinimum:{okStr:">",ok:Is.GT,fail:Is.LTE}},pre={message:({keyword:t,schemaCode:e})=>(0,to.str)`should be ${Ab[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,to._)`{comparison: ${Ab[t].okStr}, limit: ${e}}`};Dl.formatLimitDefinition={keyword:Object.keys(Ab),type:"string",schemaType:"string",$data:!0,error:pre,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:i}=t,{opts:s,self:a}=i;if(!s.validateFormats)return;let c=new dre.KeywordCxt(i,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),p=e.const("fmt",(0,to._)`${f}[${c.schemaCode}]`);t.fail$data((0,to.or)((0,to._)`typeof ${p} != "object"`,(0,to._)`${p} instanceof RegExp`,(0,to._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${f}" does not define "compare" function`);let m=e.scopeValue("formats",{key:f,ref:p,code:s.code.formats?(0,to._)`${s.code.formats}${(0,to.getProperty)(f)}`:void 0});t.fail$data(d(m))}function d(f){return(0,to._)`${f}.compare(${r}, ${n}) ${Ab[o].fail} 0`}},dependencies:["format"]};var fre=t=>(t.addKeyword(Dl.formatLimitDefinition),t);Dl.default=fre});var zU=P((om,NU)=>{"use strict";Object.defineProperty(om,"__esModule",{value:!0});var Ll=OU(),mre=PU(),kT=Oe(),CU=new kT.Name("fullFormats"),hre=new kT.Name("fastFormats"),TT=(t,e={keywords:!0})=>{if(Array.isArray(e))return RU(t,e,Ll.fullFormats,CU),t;let[r,n]=e.mode==="fast"?[Ll.fastFormats,hre]:[Ll.fullFormats,CU],o=e.formats||Ll.formatNames;return RU(t,o,r,n),e.keywords&&(0,mre.default)(t),t};TT.get=(t,e="full")=>{let n=(e==="fast"?Ll.fastFormats:Ll.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function RU(t,e,r,n){var o,i;(o=(i=t.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,kT._)`require("ajv-formats/dist/formats").${n}`);for(let s of e)t.addFormat(s,r[s])}NU.exports=om=TT;Object.defineProperty(om,"__esModule",{value:!0});om.default=TT});var Mb={PRETTY:4,COMPACT:0};var Ke={TRACE:6,DEBUG:8,INFO:12,WARN:16,ERROR:20,CRITICAL:24,SILENT:28},OT=["level","message","sampling_rate","service","timestamp"],PT="Uncaught error detected, flushing log buffer before exit";var ql={REQUEST_ID:Symbol.for("_AWS_LAMBDA_REQUEST_ID"),X_RAY_TRACE_ID:Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),TENANT_ID:Symbol.for("_AWS_LAMBDA_TENANT_ID")},jb=["true","1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??"");jb||(globalThis.awslambda=globalThis.awslambda||{});var sm=class{static PROTECTED_KEYS=ql;isProtectedKey(e){return Object.values(ql).includes(e)}getRequestId(){return this.get(ql.REQUEST_ID)??"-"}getXRayTraceId(){return this.get(ql.X_RAY_TRACE_ID)}getTenantId(){return this.get(ql.TENANT_ID)}},Db=class extends sm{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==void 0}get(e){return this.currentContext?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);this.currentContext=this.currentContext||{},this.currentContext[e]=r}run(e,r){this.currentContext=e;try{return r()}finally{this.currentContext=void 0}}},Lb=class t extends sm{als;static async create(){let e=new t,r=await import("node:async_hooks");return e.als=new r.AsyncLocalStorage,e}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==void 0}get(e){return this.als.getStore()?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);let n=this.als.getStore();if(!n)throw new Error("No context available");n[e]=r}run(e,r){return this.als.run(e,r)}},CT;(function(t){let e=null;async function r(){return e||(e=(async()=>{let o="AWS_LAMBDA_MAX_CONCURRENCY"in process.env?await Lb.create():new Db;return!jb&&globalThis.awslambda?.InvokeStore?globalThis.awslambda.InvokeStore:(!jb&&globalThis.awslambda&&(globalThis.awslambda.InvokeStore=o),o)})()),e}t.getInstanceAsync=r,t._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE==="1"?{reset:()=>{e=null,globalThis.awslambda?.InvokeStore&&delete globalThis.awslambda.InvokeStore,globalThis.awslambda={}}}:void 0})(CT||(CT={}));var RT="AWS_LAMBDA_MAX_CONCURRENCY",NT="POWERTOOLS_DEV";var zT="_X_AMZN_TRACE_ID";var Vr=({key:t,defaultValue:e,errorMessage:r})=>{let n=process.env[t];if(n===void 0){if(e!==void 0)return e;throw r?new Error(r):new Error(`Environment variable ${t} is required`)}return n.trim()},MT=({key:t,defaultValue:e,errorMessage:r})=>{let n=Vr({key:t,defaultValue:String(e),errorMessage:r}),o=Number(n);if(Number.isNaN(o))throw new TypeError(`Environment variable ${t} must be a number`);return o},KU=new Set(["1","y","yes","t","true","on"]),HU=new Set(["0","n","no","f","false","off"]),Ub=({key:t,defaultValue:e,errorMessage:r,extendedParsing:n})=>{let i=Vr({key:t,defaultValue:String(e),errorMessage:r}).toLowerCase();if(n){if(KU.has(i))return!0;if(HU.has(i))return!1}if(i!=="true"&&i!=="false")throw new Error(`Environment variable ${t} must be a boolean`);return i==="true"},Vl=()=>{try{return Ub({key:NT,extendedParsing:!0})}catch{return!1}};var WU=()=>{let t=globalThis.awslambda?.InvokeStore?.getXRayTraceId()??Vr({key:zT,defaultValue:""});if(t==="")return;if(!t.includes("="))return{Root:t};let e={};for(let r of t.split(";")){let[n,o]=r.split("=");e[n]=o}return e};var am=()=>Vr({key:RT,defaultValue:""})!=="",Gl=()=>WU()?.Root;var Es=class{formatError(e){let{name:r,message:n,stack:o,cause:i,...s}=e,a={name:r,location:this.getCodeLocation(e.stack),message:n,stack:Vl()&&typeof o=="string"?o?.split(` +`):o,cause:i instanceof Error?this.formatError(i):i};for(let c in e)typeof c=="string"&&!["name","message","stack","cause"].includes(c)&&(a[c]=s[c]);return a}formatTimestamp(e){let n=Vr({key:"TZ",defaultValue:""});return n&&!n.includes("UTC")?this.#r(e,n):e.toISOString()}getCodeLocation(e){if(!e)return"";let r=e.split(` +`),n=/\(([^()]*?):(\d+?):(\d+?)\)\\?$/;for(let o of r){let i=n.exec(o);if(Array.isArray(i))return`${i[1]}:${Number(i[2])}`}return""}#e=e=>{let r="2-digit",n=Intl.supportedValuesOf("timeZone").includes(e)?e:"UTC";return new Intl.DateTimeFormat("en",{hourCycle:"h23",year:"numeric",month:r,day:r,hour:r,minute:r,second:r,timeZone:n})};#r(e,r){let{year:n,month:o,day:i,hour:s,minute:a,second:c}=this.#e(r).formatToParts(e).reduce((_,v)=>(_[v.type]=v.value,_),{}),u=`${n}-${o}-${i}T${s}:${a}:${c}`,l=-e.getTimezoneOffset(),d=l>=0?"+":"-",f=Math.abs(Math.floor(l/60)).toString().padStart(2,"0"),p=Math.abs(l%60).toString().padStart(2,"0"),m=e.getMilliseconds().toString().padStart(3,"0"),h=`${d}${f}:${p}`;return`${u}.${m}${h}`}};var dE=mn(Xb(),1),_i=class{attributes={};constructor(e){this.setAttributes(e.attributes)}addAttributes(e){return(0,dE.default)(this.attributes,e),this}getAttributes(){return this.attributes}prepareForPrint(){this.attributes=this.removeEmptyKeys(this.getAttributes())}removeEmptyKeys(e){let r={};for(let n in e)e[n]!==void 0&&e[n]!==""&&e[n]!==null&&(r[n]=e[n]);return r}setAttributes(e){this.attributes=e}};import{Console as B2}from"node:console";import{randomInt as Z2}from"node:crypto";var Yl="2.29.0";var Rre=process.env.AWS_EXECUTION_ENV||"NA";var gm="powertools-for-aws",pE=`${gm}.tracer`,fE=`${gm}.metrics`,mE=`${gm}.logger`,hE=`${gm}.idempotency`;var Yb=t=>typeof t=="string";var gE=t=>Object.is(t,null),Qb=t=>gE(t)||Object.is(t,void 0);var Ql=class{#e;coldStart=!0;defaultServiceName="service_undefined";constructor(){this.#e=this.getInitializationType(),this.#e!=="on-demand"&&(this.coldStart=!1)}getInitializationType(){let e=process.env.AWS_LAMBDA_INITIALIZATION_TYPE?.trim();return e==="on-demand"?"on-demand":e==="provisioned-concurrency"?"provisioned-concurrency":"unknown"}getColdStart(){return this.#e!=="on-demand"?!1:this.coldStart?(this.coldStart=!1,!0):!1}isValidServiceName(e){return typeof e=="string"&&e.trim().length>0}};var _E=process.env.AWS_EXECUTION_ENV||"NA";process.env.AWS_SDK_UA_APP_ID?process.env.AWS_SDK_UA_APP_ID=`${process.env.AWS_SDK_UA_APP_ID}/PT/NO-OP/${Yl}/PTEnv/${_E}`:process.env.AWS_SDK_UA_APP_ID=`PT/NO-OP/${Yl}/PTEnv/${_E}`;var bm=mn(Xb(),1);var _m=class extends Es{#e;constructor(e){super(),this.#e=e?.logRecordOrder}formatAttributes(e,r){let n={level:e.logLevel,message:e.message,timestamp:this.formatTimestamp(e.timestamp),service:e.serviceName,cold_start:e.lambdaContext?.coldStart,function_arn:e.lambdaContext?.invokedFunctionArn,function_memory_size:e.lambdaContext?.memoryLimitInMB,function_name:e.lambdaContext?.functionName,function_request_id:e.lambdaContext?.awsRequestId,sampling_rate:e.sampleRateValue,xray_trace_id:e.xRayTraceId};if(this.#e===void 0)return new _i({attributes:n}).addAttributes(r);let o={};for(let s of this.#e)s in n&&!(s in o)?o[s]=n[s]:s in r&&!(s in o)&&(o[s]=r[s]);for(let s in n)s in o||(o[s]=n[s]);for(let s in r)s in o||(o[s]=r[s]);return new _i({attributes:o})}};var ym=class{#e=Symbol("powertools.logger.temporaryAttributes");#r=Symbol("powertools.logger.keys");#i={};#c=new Map;#n={};#o(){if(!am())return this.#i;if(globalThis.awslambda?.InvokeStore===void 0)throw new Error("InvokeStore is not available");let e=globalThis.awslambda.InvokeStore,r=e.get(this.#e);return r==null&&(r={},e.set(this.#e,r)),r}#t(){if(!am())return this.#c;if(globalThis.awslambda?.InvokeStore===void 0)throw new Error("InvokeStore is not available");let e=globalThis.awslambda.InvokeStore,r=e.get(this.#r);return r==null&&(r=new Map,e.set(this.#r,r)),r}appendTemporaryKeys(e){let r=this.#o(),n=this.#t();for(let[o,i]of Object.entries(e))r[o]=i,n.set(o,"temp")}removeTemporaryKeys(e){let r=this.#o(),n=this.#t();for(let o of e)r[o]=void 0,this.#n[o]?n.set(o,"persistent"):n.delete(o)}getTemporaryAttributes(){return{...this.#o()}}clearTemporaryAttributes(){let e=this.#o(),r=this.#t();for(let n of Object.keys(e))this.#n[n]?r.set(n,"persistent"):r.delete(n);if(!am()){this.#i={};return}globalThis.awslambda.InvokeStore?.set(this.#e,{})}setPersistentAttributes(e){let r=this.#t();this.#n={...e};for(let n of Object.keys(e))r.set(n,"persistent")}getPersistentAttributes(){return{...this.#n}}getAllAttributes(){let e={},r=this.#o(),n=this.#t();for(let[o,i]of Object.entries(this.#n))i!==void 0&&(e[o]=i);for(let[o,i]of n.entries())i==="temp"&&r[o]!==void 0&&(e[o]=r[o]);return e}removePersistentKeys(e){let r=this.#t(),n=this.#o();for(let o of e)this.#n[o]=void 0,n[o]?r.set(o,"temp"):r.delete(o)}};var ew=class{value;logLevel;byteSize;constructor(e,r){if(!Yb(e))throw new Error("Value should be a string");this.value=e,this.logLevel=r,this.byteSize=Buffer.byteLength(e)}},tw=class extends Set{currentBytesSize=0;hasEvictedLog=!1;add(e){return this.currentBytesSize+=e.byteSize,super.add(e),this}delete(e){let r=super.delete(e);return r&&(this.currentBytesSize-=e.byteSize),r}clear(){super.clear(),this.currentBytesSize=0}shift(){let e=this.values().next().value;return e&&this.delete(e),e}},vm=class extends Map{#e;#r;constructor({maxBytesSize:e,onBufferOverflow:r}){super(),this.#e=e,this.#r=r}setItem(e,r,n){let o=new ew(r,n);if(o.byteSize>this.#e)throw new Error("Item too big");let i=this.get(e)||new tw;return i.currentBytesSize!==0&&i.currentBytesSize+o.byteSize>=this.#e&&(this.#i(i,o),this.#r&&this.#r()),i.add(o),super.set(e,i),this}#i(e,r){for(;e.size!==0&&e.currentBytesSize+r.byteSize>=this.#e;)e.shift(),e.hasEvictedLog=!0}};var ed=class t extends Ql{console;customConfigService;logEvent=!1;logFormatter;logIndentation=Mb.COMPACT;logLevel=Ke.INFO;#e;powertoolsLogData={sampleRateValue:0};#r=new ym;#i=[];#c=!1;#n=Ke.INFO;#o;#t={enabled:!1,flushOnErrorLog:!0,maxBytes:20480,bufferAtVerbosity:Ke.DEBUG};#s;#u;#a={sampleRateValue:0,refreshedTimes:0};#p=new Map;get level(){return this.logLevel}constructor(e={}){super();let{customConfigService:r,...n}=e;this.customConfigService=r||void 0,this.setOptions(n),this.#c=!0;for(let[o,i]of this.#i)this.printLog(o,this.createAndPopulateLogItem(...i));this.#i=[]}addContext(e){this.addToPowertoolsLogData({lambdaContext:{invokedFunctionArn:e.invokedFunctionArn,coldStart:this.getColdStart(),awsRequestId:e.awsRequestId,memoryLimitInMB:e.memoryLimitInMB,functionName:e.functionName,functionVersion:e.functionVersion}})}addPersistentLogAttributes(e){this.appendPersistentKeys(e)}appendKeys(e){this.#m(e,"temp")}appendPersistentKeys(e){this.#m(e,"persistent")}createChild(e={}){let r="persistentLogAttributes"in e&&!("persistentKeys"in e)?"persistentLogAttributes":"persistentKeys",n=this.createLogger((0,bm.default)({},{logLevel:this.getLevelName(),serviceName:this.powertoolsLogData.serviceName,sampleRateValue:this.#a.sampleRateValue,logFormatter:this.getLogFormatter(),customConfigService:this.getCustomConfigService(),environment:this.powertoolsLogData.environment,[r]:this.#r.getPersistentAttributes(),jsonReplacerFn:this.#o,correlationIdSearchFn:this.#u,...this.#t.enabled&&{logBufferOptions:{maxBytes:this.#t.maxBytes,bufferAtVerbosity:this.getLogLevelNameFromNumber(this.#t.bufferAtVerbosity),flushOnErrorLog:this.#t.flushOnErrorLog}}},e));this.powertoolsLogData.lambdaContext&&n.addContext(this.powertoolsLogData.lambdaContext);let o=this.#r.getTemporaryAttributes();return Object.keys(o).length>0&&n.appendKeys(o),n}critical(e,...r){this.processLogItem(Ke.CRITICAL,e,r)}debug(e,...r){this.processLogItem(Ke.DEBUG,e,r)}error(e,...r){this.#t.enabled&&this.#t.flushOnErrorLog&&this.flushBuffer(),this.processLogItem(Ke.ERROR,e,r)}getLevelName(){return this.getLogLevelNameFromNumber(this.logLevel)}getLogEvent(){return this.logEvent}getPersistentLogAttributes(){return this.#r.getPersistentAttributes()}info(e,...r){this.processLogItem(Ke.INFO,e,r)}injectLambdaContext(e){return(r,n,o)=>{let i=o.value,s=this;o.value=async function(...a){s.refreshSampleRateCalculation(),s.addContext(a[1]),s.logEventIfEnabled(a[0],e?.logEvent),e?.correlationIdPath&&s.setCorrelationId(a[0],e?.correlationIdPath);try{return await i.apply(this,a)}catch(c){throw e?.flushBufferOnUncaughtError&&(s.flushBuffer(),s.error({message:PT,error:c})),c}finally{(e?.clearState||e?.resetKeys)&&s.resetKeys(),s.clearBuffer()}}}}static injectLambdaContextAfterOrOnError(e,r,n){n&&(n.clearState||n?.resetKeys)&&e.resetKeys()}static injectLambdaContextBefore(e,r,n,o){e.addContext(n),e.logEventIfEnabled(r,o?.logEvent)}logEventIfEnabled(e,r){this.shouldLogEvent(r)&&this.info("Lambda invocation event",{event:e})}refreshSampleRateCalculation(){if(this.#a.refreshedTimes===0){this.#a.refreshedTimes++;return}this.#h()&&this.logLevel>Ke.TRACE?(this.setLogLevel("DEBUG"),this.debug("Setting log level to DEBUG due to sampling rate")):this.setLogLevel(this.getLogLevelNameFromNumber(this.#n))}removeKeys(e){this.#r.removeTemporaryKeys(e)}removePersistentKeys(e){this.#r.removePersistentKeys(e)}removePersistentLogAttributes(e){this.removePersistentKeys(e)}resetKeys(){this.#r.clearTemporaryAttributes()}setLogLevel(e){if(!this.awsLogLevelShortCircuit(e))if(this.isValidLogLevel(e))this.logLevel=Ke[e];else throw new Error(`Invalid log level: ${e}`)}setPersistentLogAttributes(e){let r=this.#f(e);this.#r.setPersistentAttributes(r)}get persistentLogAttributes(){return this.#r.getPersistentAttributes()}shouldLogEvent(e){return typeof e=="boolean"?e:this.getLogEvent()}trace(e,...r){this.processLogItem(Ke.TRACE,e,r)}warn(e,...r){this.processLogItem(Ke.WARN,e,r)}#l(e){this.#p.has(e)||(this.#p.set(e,!0),this.warn(e))}createLogger(e){return new t(e)}getJsonReplacer(){let e=new WeakSet;return(r,n)=>{let o=n;if(this.#o&&(o=this.#o?.(r,o)),o instanceof Error&&(o=this.getLogFormatter().formatError(o)),typeof o=="bigint")return o.toString();if(typeof o=="object"&&o!==null){if(e.has(o))return;e.add(o)}return o}}addToPowertoolsLogData(e){(0,bm.default)(this.powertoolsLogData,e)}#f(e){let r={};for(let[n,o]of Object.entries(e))this.#d(n)||(r[n]=o);return r}#m(e,r){let n=this.#f(e);if(r==="temp")this.#r.appendTemporaryKeys(n);else{let o=this.#r.getPersistentAttributes();this.#r.setPersistentAttributes((0,bm.default)(o,n))}}awsLogLevelShortCircuit(e){return this.#e!==void 0?(this.logLevel=Ke[this.#e],this.isValidLogLevel(e)&&this.logLevel>Ke[e]&&this.#l(`Current log level (${e}) does not match AWS Lambda Advanced Logging Controls minimum log level (${this.#e}). This can lead to data loss, consider adjusting them.`),!0):!1}createAndPopulateLogItem(e,r,n){let o={logLevel:this.getLogLevelNameFromNumber(e),timestamp:new Date,xRayTraceId:Gl(),...this.getPowertoolsLogData(),message:""},i=this.#r.getAllAttributes();return this.#g(r,o,i),this.#_(n,i),this.getLogFormatter().formatAttributes(o,i)}#g(e,r,n){if(typeof e=="string"){r.message=e;return}let{message:o,...i}=e;r.message=o;for(let[s,a]of Object.entries(i))this.#d(s)||(n[s]=a)}#_(e,r){for(let n of e)Qb(n)||(n instanceof Error?r.error=n:typeof n=="string"?r.extra=n:this.#y(n,r))}#y(e,r){for(let[n,o]of Object.entries(e))this.#d(n)||(r[n]=o)}#h(){return this.#a.sampleRateValue&&Z2(0,100)/100<=this.#a.sampleRateValue}#d(e){return OT.includes(e)?(this.warn(`The key "${e}" is a reserved key and will be dropped.`),!0):!1}getCustomConfigService(){return this.customConfigService}getLogFormatter(){return this.logFormatter}getLogLevelNameFromNumber(e){let r;for(let[n,o]of Object.entries(Ke))if(o===e){r=n;break}return r}getPowertoolsLogData(){return this.powertoolsLogData}isValidLogLevel(e){return typeof e=="string"&&e in Ke}isValidSampleRate(e){return typeof e=="number"&&0<=e&&e<=1}printLog(e,r){r.prepareForPrint();let n=e===Ke.CRITICAL?"error":this.getLogLevelNameFromNumber(e).toLowerCase();this.console[n](JSON.stringify(r.getAttributes(),this.getJsonReplacer(),this.logIndentation))}processLogItem(e,r,n){let o=Gl();if(o!==void 0&&this.shouldBufferLog(o,e)){try{this.bufferLogItem(o,this.createAndPopulateLogItem(e,r,n),e)}catch(i){this.printLog(Ke.WARN,this.createAndPopulateLogItem(Ke.WARN,`Unable to buffer log: ${i.message}`,[i])),this.printLog(e,this.createAndPopulateLogItem(e,r,n))}return}e>=this.logLevel&&(this.#c?this.printLog(e,this.createAndPopulateLogItem(e,r,n)):this.#i.push([e,[e,r,n]]))}setConsole(){Vl()?this.console=console:this.console=new B2({stdout:process.stdout,stderr:process.stderr}),this.console.trace=(e,...r)=>{this.console.log(e,...r)}}setInitialLogLevel(e){let r=e?.toUpperCase();if(this.awsLogLevelShortCircuit(r)){this.#n=this.logLevel;return}if(this.isValidLogLevel(r)){this.logLevel=Ke[r],this.#n=this.logLevel;return}let n=this.getCustomConfigService()?.getLogLevel()?.toUpperCase();if(this.isValidLogLevel(n)){this.logLevel=Ke[n],this.#n=this.logLevel;return}let o=Vr({key:"POWERTOOLS_LOG_LEVEL",defaultValue:""}),i=Vr({key:"LOG_LEVEL",defaultValue:""}),s=o!==""?o:i;this.isValidLogLevel(s)&&(this.logLevel=Ke[s],this.#n=this.logLevel)}setInitialSampleRate(e){let r=e,n=this.getCustomConfigService()?.getSampleRateValue(),o=MT({key:"POWERTOOLS_LOGGER_SAMPLE_RATE",defaultValue:0});for(let i of[r,n,o])if(this.isValidSampleRate(i)){this.#a.sampleRateValue=i,this.powertoolsLogData.sampleRateValue=i,this.#h()&&this.logLevel>Ke.TRACE&&(this.setLogLevel("DEBUG"),this.debug("Setting log level to DEBUG due to sampling rate"));break}}setLogEvent(){this.logEvent=Ub({key:"POWERTOOLS_LOGGER_LOG_EVENT",defaultValue:!1})}setLogFormatter(e,r){this.logFormatter=e??new _m({logRecordOrder:r})}setLogIndentation(){Vl()&&(this.logIndentation=Mb.PRETTY)}setOptions(e){let{logLevel:r,serviceName:n,sampleRateValue:o,logFormatter:i,persistentKeys:s,persistentLogAttributes:a,environment:c,jsonReplacerFn:u,logRecordOrder:l,logBufferOptions:d,correlationIdSearchFn:f}=e;a&&Object.keys(a).length>0&&s&&Object.keys(s).length>0&&this.warn("Both persistentLogAttributes and persistentKeys options were provided. Using persistentKeys as persistentLogAttributes is deprecated and will be removed in future releases"),this.setPowertoolsLogData(n,c,s||a);let p=Vr({key:"AWS_LAMBDA_LOG_LEVEL",defaultValue:""}),m=p==="FATAL"?"CRITICAL":p;return this.isValidLogLevel(m)&&(this.#e=m),this.setLogEvent(),this.setInitialLogLevel(r),this.setInitialSampleRate(o),this.setLogFormatter(i,l),this.setConsole(),this.setLogIndentation(),this.#o=u,this.#v(d),this.#u=f,this}setPowertoolsLogData(e,r,n){this.addToPowertoolsLogData({awsRegion:Vr({key:"AWS_REGION",defaultValue:""}),environment:r||this.getCustomConfigService()?.getCurrentEnvironment()||Vr({key:"ENVIRONMENT",defaultValue:""}),serviceName:e||this.getCustomConfigService()?.getServiceName()||Vr({key:"POWERTOOLS_SERVICE_NAME",defaultValue:""})||this.defaultServiceName}),n&&this.appendPersistentKeys(n)}#v(e){if(e===void 0||(this.#t.enabled=e?.enabled!==!1,this.#t.enabled===!1))return;e?.maxBytes!==void 0&&(this.#t.maxBytes=e.maxBytes),this.#s=new vm({maxBytesSize:this.#t.maxBytes}),e?.flushOnErrorLog===!1&&(this.#t.flushOnErrorLog=!1);let r=e?.bufferAtVerbosity?.toUpperCase();this.isValidLogLevel(r)&&(this.#t.bufferAtVerbosity=Ke[r]),this.#e!==void 0&&Ke[this.#e]>this.#t.bufferAtVerbosity&&this.#l("Advanced Loggging Controls (ALC) Log Level is less verbose than Log Buffering Log Level. Buffered logs will be filtered by ALC")}bufferLogItem(e,r,n){r.prepareForPrint(),this.#s?.has(e)===!1&&this.#s?.clear(),this.#s?.setItem(e,JSON.stringify(r.getAttributes(),this.getJsonReplacer(),this.logIndentation),n)}flushBuffer(){let e=Gl();if(e===void 0)return;let r=this.#s?.get(e);if(r!==void 0){for(let n of r){let o=this.getLogLevelNameFromNumber(n.logLevel).toLowerCase();this.console[o](n.value)}r.hasEvictedLog&&this.printLog(Ke.WARN,this.createAndPopulateLogItem(Ke.WARN,"Some logs are not displayed because they were evicted from the buffer. Increase buffer size to store more logs in the buffer",[])),this.#e!==void 0&&Ke[this.#e]>this.#t.bufferAtVerbosity&&this.#l("Advanced Loggging Controls (ALC) Log Level is less verbose than Log Buffering Log Level. Some logs might be missing."),this.#s?.delete(e)}}clearBuffer(){let e=Gl();e!==void 0&&this.#s?.delete(e)}shouldBufferLog(e,r){return this.#t.enabled&&e!==void 0&&r<=this.#t.bufferAtVerbosity}setCorrelationId(e,r){if(typeof r=="string"){if(!this.#u){this.#l("correlationIdPath is set but no search function was provided. The correlation ID will not be added to the log attributes.");return}let n=this.#u(r,e);n&&this.appendKeys({correlation_id:n});return}this.appendKeys({correlation_id:e})}getCorrelationId(){return this.#r.getTemporaryAttributes().correlation_id}};var rw=class extends Es{formatAttributes(e,r){let n={logLevel:e.logLevel,timestamp:this.formatTimestamp(e.timestamp),message:e.message},o=new _i({attributes:n});return o.addAttributes(r),o}},wm=new ed({logFormatter:new rw});function ce(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function S(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var nw=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return nw=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function td(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var rd=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var V=class extends Error{},Pt=class t extends V{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("x-request-id"),this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new yi({message:n,cause:rd(r)});let i=r?.error;return e===400?new fc(e,i,n,o):e===401?new mc(e,i,n,o):e===403?new hc(e,i,n,o):e===404?new gc(e,i,n,o):e===409?new _c(e,i,n,o):e===422?new yc(e,i,n,o):e===429?new vc(e,i,n,o):e>=500?new bc(e,i,n,o):new t(e,i,n,o)}},xt=class extends Pt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},yi=class extends Pt{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Do=class extends yi{constructor({message:e}={}){super({message:e??"Request timed out."})}},fc=class extends Pt{},mc=class extends Pt{},hc=class extends Pt{},gc=class extends Pt{},_c=class extends Pt{},yc=class extends Pt{},vc=class extends Pt{},bc=class extends Pt{},wc=class extends V{constructor(){super("Could not parse response content as the length limit was reached")}},xc=class extends V{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},ro=class extends Error{constructor(e){super(e)}};var V2=/^[a-z][a-z0-9+.-]*:/i,yE=t=>V2.test(t),Qt=t=>(Qt=Array.isArray,Qt(t)),ow=Qt;function iw(t){return typeof t!="object"?{}:t??{}}function vE(t){if(!t)return!0;for(let e in t)return!1;return!0}function bE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function nd(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var wE=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new V(`${t} must be an integer`);if(e<0)throw new V(`${t} must be a positive integer`);return e};var xE=t=>{try{return JSON.parse(t)}catch{return}};var no=t=>new Promise(e=>setTimeout(e,t));var vi="6.10.0";var kE=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function G2(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var K2=()=>{let t=G2();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":IE(Deno.build.os),"X-Stainless-Arch":$E(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":IE(globalThis.process.platform??"unknown"),"X-Stainless-Arch":$E(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=H2();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function H2(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,s=n[3]||0;return{browser:e,version:`${o}.${i}.${s}`}}}return null}var $E=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",IE=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),SE,TE=()=>SE??(SE=K2());function EE(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function sw(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function xm(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return sw({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function aw(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function AE(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var OE=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var $m="RFC3986",cw=t=>String(t),Im={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:cw},uw="RFC1738";var Sm=(t,e)=>(Sm=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Sm(t,e)),oo=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var lw=1024,PE=(t,e,r,n,o)=>{if(t.length===0)return t;let i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a=lw?i.slice(a,a+lw):i,u=[];for(let l=0;l=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===uw&&(d===40||d===41)){u[u.length]=c.charAt(l);continue}if(d<128){u[u.length]=oo[d];continue}if(d<2048){u[u.length]=oo[192|d>>6]+oo[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=oo[224|d>>12]+oo[128|d>>6&63]+oo[128|d&63];continue}l+=1,d=65536+((d&1023)<<10|c.charCodeAt(l)&1023),u[u.length]=oo[240|d>>18]+oo[128|d>>12&63]+oo[128|d>>6&63]+oo[128|d&63]}s+=u.join("")}return s};function CE(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function dw(t,e){if(Qt(t)){let r=[];for(let n=0;n"u"&&(k=0)}if(typeof u=="function"?b=u(e,b):b instanceof Date?b=f?.(b):r==="comma"&&Qt(b)&&(b=dw(b,function(oe){return oe instanceof Date?f?.(oe):oe})),b===null){if(i)return c&&!h?c(e,Ct.encoder,_,"key",p):e;b=""}if(X2(b)||CE(b)){if(c){let oe=h?e:c(e,Ct.encoder,_,"key",p);return[m?.(oe)+"="+m?.(c(b,Ct.encoder,_,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let F=[];if(typeof b>"u")return F;let J;if(r==="comma"&&Qt(b))h&&c&&(b=dw(b,c)),J=[{value:b.length>0?b.join(",")||null:void 0}];else if(Qt(u))J=u;else{let oe=Object.keys(b);J=l?oe.sort(l):oe}let w=a?String(e).replace(/\./g,"%2E"):String(e),Z=n&&Qt(b)&&b.length===1?w+"[]":w;if(o&&Qt(b)&&b.length===0)return Z+"[]";for(let oe=0;oe"u"?t.encodeDotInKeys?!0:Ct.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Ct.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Ct.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Ct.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Ct.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Ct.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Ct.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Ct.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Ct.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Ct.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Ct.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Ct.strictNullHandling}}function fw(t,e={}){let r=t,n=Y2(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Qt(n.filter)&&(i=n.filter,o=i);let s=[];if(typeof r!="object"||r===null)return"";let a=NE[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);let u=new WeakMap;for(let f=0;f0?d+l:""}function LE(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}var jE;function $c(t){let e;return(jE??(e=new globalThis.TextEncoder,jE=e.encode.bind(e)))(t)}var DE;function mw(t){let e;return(DE??(e=new globalThis.TextDecoder,DE=e.decode.bind(e)))(t)}var Gr,Kr,Cs=class{constructor(){Gr.set(this,void 0),Kr.set(this,void 0),ce(this,Gr,new Uint8Array,"f"),ce(this,Kr,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?$c(e):e;ce(this,Gr,LE([S(this,Gr,"f"),r]),"f");let n=[],o;for(;(o=eF(S(this,Gr,"f"),S(this,Kr,"f")))!=null;){if(o.carriage&&S(this,Kr,"f")==null){ce(this,Kr,o.index,"f");continue}if(S(this,Kr,"f")!=null&&(o.index!==S(this,Kr,"f")+1||o.carriage)){n.push(mw(S(this,Gr,"f").subarray(0,S(this,Kr,"f")-1))),ce(this,Gr,S(this,Gr,"f").subarray(S(this,Kr,"f")),"f"),ce(this,Kr,null,"f");continue}let i=S(this,Kr,"f")!==null?o.preceding-1:o.preceding,s=mw(S(this,Gr,"f").subarray(0,i));n.push(s),ce(this,Gr,S(this,Gr,"f").subarray(o.index),"f"),ce(this,Kr,null,"f")}return n}flush(){return S(this,Gr,"f").length?this.decode(` +`):[]}};Gr=new WeakMap,Kr=new WeakMap;Cs.NEWLINE_CHARS=new Set([` +`,"\r"]);Cs.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function eF(t,e){for(let o=e??0;o{if(t){if(bE(Tm,t))return t;$t(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Tm))}`)}};function od(){}function km(t,e,r){return!e||Tm[t]>Tm[r]?od:e[t].bind(e)}var tF={error:od,warn:od,info:od,debug:od},FE=new WeakMap;function $t(t){let e=t.logger,r=t.logLevel??"off";if(!e)return tF;let n=FE.get(e);if(n&&n[0]===r)return n[1];let o={error:km("error",e,r),warn:km("warn",e,r),info:km("info",e,r),debug:km("debug",e,r)};return FE.set(e,[r,o]),o}var Lo=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var id,io=class t{constructor(e,r,n){this.iterator=e,id.set(this,void 0),this.controller=r,ce(this,id,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?$t(n):console;async function*s(){if(o)throw new V("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let c of rF(e,r))if(!a){if(c.data.startsWith("[DONE]")){a=!0;continue}if(c.event===null||!c.event.startsWith("thread.")){let u;try{u=JSON.parse(c.data)}catch(l){throw i.error("Could not parse message into JSON:",c.data),i.error("From chunk:",c.raw),l}if(u&&u.error)throw new Pt(void 0,u.error,void 0,e.headers);yield u}else{let u;try{u=JSON.parse(c.data)}catch(l){throw console.error("Could not parse message into JSON:",c.data),console.error("From chunk:",c.raw),l}if(c.event=="error")throw new Pt(void 0,u.error,u.message,void 0);yield{event:c.event,data:u}}}a=!0}catch(c){if(td(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*i(){let a=new Cs,c=aw(e);for await(let u of c)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*s(){if(o)throw new V("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let c of i())a||c&&(yield JSON.parse(c));a=!0}catch(c){if(td(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}[(id=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let s=n.next();e.push(s),r.push(s)}return i.shift()}});return[new t(()=>o(e),this.controller,S(this,id,"f")),new t(()=>o(r),this.controller,S(this,id,"f"))]}toReadableStream(){let e=this,r;return sw({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:i}=await r.next();if(i)return n.close();let s=$c(JSON.stringify(o)+` +`);n.enqueue(s)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};async function*rF(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new V("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new V("Attempted to iterate over a response with no body");let r=new gw,n=new Cs,o=aw(t.body);for await(let i of nF(o))for(let s of n.decode(i)){let a=r.decode(s);a&&(yield a)}for(let i of n.flush()){let s=r.decode(i);s&&(yield s)}}async function*nF(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?$c(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=UE(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var gw=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(` +`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=oF(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function oF(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function Em(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,s=await(async()=>{if(e.options.stream)return $t(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):io.fromSSEResponse(r,e.controller,t);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let c=r.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){let d=await r.json();return _w(d,r)}return await r.text()})();return $t(t).debug(`[${n}] response parsed`,Lo({retryOfRequestLogID:o,url:r.url,status:r.status,body:s,durationMs:Date.now()-i})),s}function _w(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var sd,Rs=class t extends Promise{constructor(e,r,n=Em){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,sd.set(this,void 0),ce(this,sd,e,"f")}_thenUnwrap(e){return new t(S(this,sd,"f"),this.responsePromise,async(r,n)=>_w(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(S(this,sd,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};sd=new WeakMap;var Am,ad=class{constructor(e,r,n,o){Am.set(this,void 0),ce(this,Am,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new V("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await S(this,Am,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Am=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},cd=class extends Rs{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await Em(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},so=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},ke=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),r=e[e.length-1]?.id;return r?{...this.options,query:{...iw(this.options.query),after:r}}:null}},Uo=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1,this.last_id=n.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.last_id;return e?{...this.options,query:{...iw(this.options.query),after:e}}:null}};var bw=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Ic(t,e,r){return bw(),new File(t,e??"unknown_file",r)}function ud(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}var Om=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",ww=async(t,e)=>yw(t.body)?{...t,body:await ZE(t.body,e)}:t,Hr=async(t,e)=>({...t,body:await ZE(t.body,e)}),BE=new WeakMap;function sF(t){let e=typeof t=="function"?t:t.fetch,r=BE.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new o(i).text()}catch{return!0}})();return BE.set(e,n),n}var ZE=async(t,e)=>{if(!await sF(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>vw(r,n,o))),r},qE=t=>t instanceof Blob&&"name"in t,aF=t=>typeof t=="object"&&t!==null&&(t instanceof Response||Om(t)||qE(t)),yw=t=>{if(aF(t))return!0;if(Array.isArray(t))return t.some(yw);if(t&&typeof t=="object"){for(let e in t)if(yw(t[e]))return!0}return!1},vw=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response)t.append(e,Ic([await r.blob()],ud(r)));else if(Om(r))t.append(e,Ic([await new Response(xm(r)).blob()],ud(r)));else if(qE(r))t.append(e,r,ud(r));else if(Array.isArray(r))await Promise.all(r.map(n=>vw(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>vw(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var VE=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",cF=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&VE(t),uF=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";async function ld(t,e,r){if(bw(),t=await t,cF(t))return t instanceof File?t:Ic([await t.arrayBuffer()],t.name);if(uF(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),Ic(await xw(o),e,r)}let n=await xw(t);if(e||(e=ud(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return Ic(n,e,r)}async function xw(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(VE(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(Om(t))for await(let r of t)e.push(...await xw(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${lF(t)}`)}return e}function lF(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var C=class{constructor(e){this._client=e}};function KE(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var GE=Object.freeze(Object.create(null)),pF=(t=KE)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],s=r.reduce((l,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=n[f],m=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??GE)??GE)?.toString)&&(m=p+"",i.push({start:l.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),l+d+(f===n.length?"":m)},""),a=s.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,u;for(;(u=c.exec(a))!==null;)i.push({start:u.index,length:u[0].length,error:`Value "${u[0]}" can't be safely passed as a path parameter`});if(i.sort((l,d)=>l.start-d.start),i.length>0){let l=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-l),h="^".repeat(p.length);return l=p.start+p.length,f+m+h},"");throw new V(`Path parameters result in path with invalid segments: +${i.map(f=>f.error).join(` +`)} +${s} +${d}`)}return s},O=pF(KE);var Ns=class extends C{list(e,r={},n){return this._client.getAPIList(O`/chat/completions/${e}/messages`,ke,{query:r,...n})}};function dd(t){return t!==void 0&&"function"in t&&t.function!==void 0}function pd(t){return t?.$brand==="auto-parseable-response-format"}function zs(t){return t?.$brand==="auto-parseable-tool"}function HE(t,e){return!e||!$w(e)?{...t,choices:t.choices.map(r=>(JE(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:fd(t,e)}function fd(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new wc;if(n.finish_reason==="content_filter")throw new xc;return JE(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>gF(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?hF(e,n.message.content):null}}});return{...t,choices:r}}function hF(t,e){return t.response_format?.type!=="json_schema"?null:t.response_format?.type==="json_schema"?"$parseRaw"in t.response_format?t.response_format.$parseRaw(e):JSON.parse(e):null}function gF(t,e){let r=t.tools?.find(n=>dd(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:zs(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function WE(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>dd(n)&&n.function?.name===e.function.name);return dd(r)&&(zs(r)||r?.function.strict||!1)}function $w(t){return pd(t.response_format)?!0:t.tools?.some(e=>zs(e)||e.type==="function"&&e.function.strict===!0)??!1}function JE(t){for(let e of t||[])if(e.type!=="function")throw new V(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function XE(t){for(let e of t??[]){if(e.type!=="function")throw new V(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new V(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Sc=t=>t?.role==="assistant",Iw=t=>t?.role==="tool";var Sw,Pm,Cm,md,hd,Rm,gd,Fo,_d,Nm,zm,kc,YE,bi=class{constructor(){Sw.add(this),this.controller=new AbortController,Pm.set(this,void 0),Cm.set(this,()=>{}),md.set(this,()=>{}),hd.set(this,void 0),Rm.set(this,()=>{}),gd.set(this,()=>{}),Fo.set(this,{}),_d.set(this,!1),Nm.set(this,!1),zm.set(this,!1),kc.set(this,!1),ce(this,Pm,new Promise((e,r)=>{ce(this,Cm,e,"f"),ce(this,md,r,"f")}),"f"),ce(this,hd,new Promise((e,r)=>{ce(this,Rm,e,"f"),ce(this,gd,r,"f")}),"f"),S(this,Pm,"f").catch(()=>{}),S(this,hd,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},S(this,Sw,"m",YE).bind(this))},0)}_connected(){this.ended||(S(this,Cm,"f").call(this),this._emit("connect"))}get ended(){return S(this,_d,"f")}get errored(){return S(this,Nm,"f")}get aborted(){return S(this,zm,"f")}abort(){this.controller.abort()}on(e,r){return(S(this,Fo,"f")[e]||(S(this,Fo,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=S(this,Fo,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(S(this,Fo,"f")[e]||(S(this,Fo,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ce(this,kc,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ce(this,kc,!0,"f"),await S(this,hd,"f")}_emit(e,...r){if(S(this,_d,"f"))return;e==="end"&&(ce(this,_d,!0,"f"),S(this,Rm,"f").call(this));let n=S(this,Fo,"f")[e];if(n&&(S(this,Fo,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!S(this,kc,"f")&&!n?.length&&Promise.reject(o),S(this,md,"f").call(this,o),S(this,gd,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!S(this,kc,"f")&&!n?.length&&Promise.reject(o),S(this,md,"f").call(this,o),S(this,gd,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Pm=new WeakMap,Cm=new WeakMap,md=new WeakMap,hd=new WeakMap,Rm=new WeakMap,gd=new WeakMap,Fo=new WeakMap,_d=new WeakMap,Nm=new WeakMap,zm=new WeakMap,kc=new WeakMap,Sw=new WeakSet,YE=function(e){if(ce(this,Nm,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new xt),e instanceof xt)return ce(this,zm,!0,"f"),this._emit("abort",e);if(e instanceof V)return this._emit("error",e);if(e instanceof Error){let r=new V(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new V(String(e)))};function QE(t){return typeof t.parse=="function"}var pr,kw,Mm,Tw,Ew,Aw,eA,tA,_F=10,Tc=class extends bi{constructor(){super(...arguments),pr.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let r=e.choices[0]?.message;return r&&this._addMessage(r),e}_addMessage(e,r=!0){if("content"in e||(e.content=null),this.messages.push(e),r){if(this._emit("message",e),Iw(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(Sc(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionToolCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new V("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),S(this,pr,"m",kw).call(this)}async finalMessage(){return await this.done(),S(this,pr,"m",Mm).call(this)}async finalFunctionToolCall(){return await this.done(),S(this,pr,"m",Tw).call(this)}async finalFunctionToolCallResult(){return await this.done(),S(this,pr,"m",Ew).call(this)}async totalUsage(){return await this.done(),S(this,pr,"m",Aw).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=S(this,pr,"m",Mm).call(this);r&&this._emit("finalMessage",r);let n=S(this,pr,"m",kw).call(this);n&&this._emit("finalContent",n);let o=S(this,pr,"m",Tw).call(this);o&&this._emit("finalFunctionToolCall",o);let i=S(this,pr,"m",Ew).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(s=>s.usage)&&this._emit("totalUsage",S(this,pr,"m",Aw).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,pr,"m",eA).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(fd(i,r))}async _runChatCompletion(e,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,r,n)}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:s,...a}=r,c=typeof i!="string"&&i.type==="function"&&i?.function?.name,{maxChatCompletions:u=_F}=n||{},l=r.tools.map(p=>{if(zs(p)){if(!p.$callback)throw new V("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of l)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?l.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;pJSON.stringify(Z)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:v,content:w});continue}let T;try{T=QE(k)?await k.parse(x):x}catch(w){let Z=w instanceof Error?w.message:String(w);this._addMessage({role:o,tool_call_id:v,content:Z});continue}let F=await k.function(T,this),J=S(this,pr,"m",tA).call(this,F);if(this._addMessage({role:o,tool_call_id:v,content:J}),c)return}}}};pr=new WeakSet,kw=function(){return S(this,pr,"m",Mm).call(this).content??null},Mm=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(Sc(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new V("stream ended without producing a ChatCompletionMessage with role=assistant")},Tw=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Sc(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},Ew=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Iw(r)&&r.content!=null&&typeof r.content=="string"&&this.messages.some(n=>n.role==="assistant"&&n.tool_calls?.some(o=>o.type==="function"&&o.id===r.tool_call_id)))return r.content}},Aw=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:r}of this._chatCompletions)r&&(e.completion_tokens+=r.completion_tokens,e.prompt_tokens+=r.prompt_tokens,e.total_tokens+=r.total_tokens);return e},eA=function(e){if(e.n!=null&&e.n>1)throw new V("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},tA=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};var yd=class t extends Tc{static runTools(e,r,n){let o=new t,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}_addMessage(e,r=!0){super._addMessage(e,r),Sc(e)&&e.content&&this._emit("content",e.content)}};var Mt={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511},Ow=class extends Error{},Pw=class extends Error{};function yF(t,e=Mt.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return vF(t.trim(),e)}var vF=(t,e)=>{let r=t.length,n=0,o=f=>{throw new Ow(`${f} at position ${n}`)},i=f=>{throw new Pw(`${f} at position ${n}`)},s=()=>(d(),n>=r&&o("Unexpected end of input"),t[n]==='"'?a():t[n]==="{"?c():t[n]==="["?u():t.substring(n,n+4)==="null"||Mt.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Mt.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Mt.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Mt.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Mt.MINUS_INFINITY&e&&1{let f=n,p=!1;for(n++;n{n++,d();let f={};try{for(;t[n]!=="}";){if(d(),n>=r&&Mt.OBJ&e)return f;let p=a();d(),n++;try{let m=s();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(Mt.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Mt.OBJ&e)return f;o("Expected '}' at end of object")}return n++,f},u=()=>{n++;let f=[];try{for(;t[n]!=="]";)f.push(s()),d(),t[n]===","&&n++}catch{if(Mt.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},l=()=>{if(n===0){t==="-"&&Mt.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Mt.NUM&e)try{return t[t.length-1]==="."?JSON.parse(t.substring(0,t.lastIndexOf("."))):JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch{}i(String(p))}}let f=n;for(t[n]==="-"&&n++;t[n]&&!",]}".includes(t[n]);)n++;n==r&&!(Mt.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Mt.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;nyF(t,Mt.ALL^Mt.NUM);var Rt,Bo,Ec,wi,Rw,jm,Nw,zw,Mw,Dm,jw,rA,Ms=class t extends Tc{constructor(e){super(),Rt.add(this),Bo.set(this,void 0),Ec.set(this,void 0),wi.set(this,void 0),ce(this,Bo,e,"f"),ce(this,Ec,[],"f")}get currentChatCompletionSnapshot(){return S(this,wi,"f")}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createChatCompletion(e,r,n){let o=new t(r);return o._run(()=>o._runChatCompletion(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(e,r,n){super._createChatCompletion;let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,Rt,"m",Rw).call(this);let i=await e.chat.completions.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let s of i)S(this,Rt,"m",Nw).call(this,s);if(i.controller.signal?.aborted)throw new xt;return this._addChatCompletion(S(this,Rt,"m",Dm).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),S(this,Rt,"m",Rw).call(this),this._connected();let o=io.fromReadableStream(e,this.controller),i;for await(let s of o)i&&i!==s.id&&this._addChatCompletion(S(this,Rt,"m",Dm).call(this)),S(this,Rt,"m",Nw).call(this,s),i=s.id;if(o.controller.signal?.aborted)throw new xt;return this._addChatCompletion(S(this,Rt,"m",Dm).call(this))}[(Bo=new WeakMap,Ec=new WeakMap,wi=new WeakMap,Rt=new WeakSet,Rw=function(){this.ended||ce(this,wi,void 0,"f")},jm=function(r){let n=S(this,Ec,"f")[r.index];return n||(n={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},S(this,Ec,"f")[r.index]=n,n)},Nw=function(r){if(this.ended)return;let n=S(this,Rt,"m",rA).call(this,r);this._emit("chunk",r,n);for(let o of r.choices){let i=n.choices[o.index];o.delta.content!=null&&i.message?.role==="assistant"&&i.message?.content&&(this._emit("content",o.delta.content,i.message.content),this._emit("content.delta",{delta:o.delta.content,snapshot:i.message.content,parsed:i.message.parsed})),o.delta.refusal!=null&&i.message?.role==="assistant"&&i.message?.refusal&&this._emit("refusal.delta",{delta:o.delta.refusal,snapshot:i.message.refusal}),o.logprobs?.content!=null&&i.message?.role==="assistant"&&this._emit("logprobs.content.delta",{content:o.logprobs?.content,snapshot:i.logprobs?.content??[]}),o.logprobs?.refusal!=null&&i.message?.role==="assistant"&&this._emit("logprobs.refusal.delta",{refusal:o.logprobs?.refusal,snapshot:i.logprobs?.refusal??[]});let s=S(this,Rt,"m",jm).call(this,i);i.finish_reason&&(S(this,Rt,"m",Mw).call(this,i),s.current_tool_call_index!=null&&S(this,Rt,"m",zw).call(this,i,s.current_tool_call_index));for(let a of o.delta.tool_calls??[])s.current_tool_call_index!==a.index&&(S(this,Rt,"m",Mw).call(this,i),s.current_tool_call_index!=null&&S(this,Rt,"m",zw).call(this,i,s.current_tool_call_index)),s.current_tool_call_index=a.index;for(let a of o.delta.tool_calls??[]){let c=i.message.tool_calls?.[a.index];c?.type&&(c?.type==="function"?this._emit("tool_calls.function.arguments.delta",{name:c.function?.name,index:a.index,arguments:c.function.arguments,parsed_arguments:c.function.parsed_arguments,arguments_delta:a.function?.arguments??""}):(c?.type,void 0))}}},zw=function(r,n){if(S(this,Rt,"m",jm).call(this,r).done_tool_calls.has(n))return;let i=r.message.tool_calls?.[n];if(!i)throw new Error("no tool call snapshot");if(!i.type)throw new Error("tool call snapshot missing `type`");if(i.type==="function"){let s=S(this,Bo,"f")?.tools?.find(a=>dd(a)&&a.function.name===i.function.name);this._emit("tool_calls.function.arguments.done",{name:i.function.name,index:n,arguments:i.function.arguments,parsed_arguments:zs(s)?s.$parseRaw(i.function.arguments):s?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Mw=function(r){let n=S(this,Rt,"m",jm).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=S(this,Rt,"m",jw).call(this);this._emit("content.done",{content:r.message.content,parsed:o?o.$parseRaw(r.message.content):null})}r.message.refusal&&!n.refusal_done&&(n.refusal_done=!0,this._emit("refusal.done",{refusal:r.message.refusal})),r.logprobs?.content&&!n.logprobs_content_done&&(n.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:r.logprobs.content})),r.logprobs?.refusal&&!n.logprobs_refusal_done&&(n.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:r.logprobs.refusal}))},Dm=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");let r=S(this,wi,"f");if(!r)throw new V("request ended without sending any chunks");return ce(this,wi,void 0,"f"),ce(this,Ec,[],"f"),bF(r,S(this,Bo,"f"))},jw=function(){let r=S(this,Bo,"f")?.response_format;return pd(r)?r:null},rA=function(r){var n,o,i,s;let a=S(this,wi,"f"),{choices:c,...u}=r;a?Object.assign(a,u):a=ce(this,wi,{...u,choices:[]},"f");for(let{delta:l,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=a.choices[f];if(h||(h=a.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:F,refusal:J,...w}=p;Object.assign(h.logprobs,w),F&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...F)),J&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...J))}if(d&&(h.finish_reason=d,S(this,Bo,"f")&&$w(S(this,Bo,"f")))){if(d==="length")throw new wc;if(d==="content_filter")throw new xc}if(Object.assign(h,m),!l)continue;let{content:_,refusal:v,function_call:b,role:x,tool_calls:k,...T}=l;if(Object.assign(h.message,T),v&&(h.message.refusal=(h.message.refusal||"")+v),x&&(h.message.role=x),b&&(h.message.function_call?(b.name&&(h.message.function_call.name=b.name),b.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=b.arguments)):h.message.function_call=b),_&&(h.message.content=(h.message.content||"")+_,!h.message.refusal&&S(this,Rt,"m",jw).call(this)&&(h.message.parsed=Cw(h.message.content))),k){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:F,id:J,type:w,function:Z,...oe}of k){let Q=(s=h.message.tool_calls)[F]??(s[F]={});Object.assign(Q,oe),J&&(Q.id=J),w&&(Q.type=w),Z&&(Q.function??(Q.function={name:Z.name??"",arguments:""})),Z?.name&&(Q.function.name=Z.name),Z?.arguments&&(Q.function.arguments+=Z.arguments,WE(S(this,Bo,"f"),Q)&&(Q.function.parsed_arguments=Cw(Q.function.arguments)))}}}return a},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("chunk",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new io(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function bF(t,e){let{id:r,choices:n,created:o,model:i,system_fingerprint:s,...a}=t,c={...a,id:r,choices:n.map(({message:u,finish_reason:l,index:d,logprobs:f,...p})=>{if(!l)throw new V(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:_,...v}=u,b=u.role;if(!b)throw new V(`missing role for choice ${d}`);if(h){let{arguments:x,name:k}=h;if(x==null)throw new V(`missing function_call.arguments for choice ${d}`);if(!k)throw new V(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:x,name:k},role:b,refusal:u.refusal??null},finish_reason:l,index:d,logprobs:f}}return _?{...p,index:d,finish_reason:l,logprobs:f,message:{...v,role:b,content:m,refusal:u.refusal??null,tool_calls:_.map((x,k)=>{let{function:T,type:F,id:J,...w}=x,{arguments:Z,name:oe,...Q}=T||{};if(J==null)throw new V(`missing choices[${d}].tool_calls[${k}].id +${Lm(t)}`);if(F==null)throw new V(`missing choices[${d}].tool_calls[${k}].type +${Lm(t)}`);if(oe==null)throw new V(`missing choices[${d}].tool_calls[${k}].function.name +${Lm(t)}`);if(Z==null)throw new V(`missing choices[${d}].tool_calls[${k}].function.arguments +${Lm(t)}`);return{...w,id:J,type:F,function:{...Q,name:oe,arguments:Z}}})}}:{...p,message:{...v,content:m,role:b,refusal:u.refusal??null},finish_reason:l,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...s?{system_fingerprint:s}:{}};return HE(c,e)}function Lm(t){return JSON.stringify(t)}var vd=class t extends Ms{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runTools(e,r,n){let o=new t(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}};var Zo=class extends C{constructor(){super(...arguments),this.messages=new Ns(this._client)}create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1})}retrieve(e,r){return this._client.get(O`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(O`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/chat/completions/${e}`,r)}parse(e,r){return XE(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>fd(n,e))}runTools(e,r){return e.stream?vd.runTools(this._client,e,r):yd.runTools(this._client,e,r)}stream(e,r){return Ms.createChatCompletion(this._client,e,r)}};Zo.Messages=Ns;var xi=class extends C{constructor(){super(...arguments),this.completions=new Zo(this._client)}};xi.Completions=Zo;var nA=Symbol("brand.privateNullableHeaders");function*xF(t){if(!t)return;if(nA in t){let{values:n,nulls:o}=t;yield*n.entries();for(let i of o)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():ow(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=ow(n[1])?n[1]:[n[1]],s=!1;for(let a of i)a!==void 0&&(e&&!s&&(s=!0,yield[o,null]),yield[o,a])}}var L=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,s]of xF(n)){let a=i.toLowerCase();o.has(a)||(e.delete(i),o.add(a)),s===null?(e.delete(i),r.add(a)):(e.append(i,s),r.delete(a))}}return{[nA]:!0,values:e,nulls:r}};var Ac=class extends C{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:L([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}};var Oc=class extends C{create(e,r){return this._client.post("/audio/transcriptions",Hr({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}};var Pc=class extends C{create(e,r){return this._client.post("/audio/translations",Hr({body:e,...r,__metadata:{model:e.model}},this._client))}};var ao=class extends C{constructor(){super(...arguments),this.transcriptions=new Oc(this._client),this.translations=new Pc(this._client),this.speech=new Ac(this._client)}};ao.Transcriptions=Oc;ao.Translations=Pc;ao.Speech=Ac;var js=class extends C{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(O`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",ke,{query:e,...r})}cancel(e,r){return this._client.post(O`/batches/${e}/cancel`,r)}};var Cc=class extends C{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/assistants/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/assistants/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",ke,{query:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(O`/assistants/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var Rc=class extends C{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var Nc=class extends C{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var $i=class extends C{constructor(){super(...arguments),this.sessions=new Rc(this._client),this.transcriptionSessions=new Nc(this._client)}};$i.Sessions=Rc;$i.TranscriptionSessions=Nc;var zc=class extends C{create(e,r){return this._client.post("/chatkit/sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}cancel(e,r){return this._client.post(O`/chatkit/sessions/${e}/cancel`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}};var Mc=class extends C{retrieve(e,r){return this._client.get(O`/chatkit/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}list(e={},r){return this._client.getAPIList("/chatkit/threads",Uo,{query:e,...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}delete(e,r){return this._client.delete(O`/chatkit/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}listItems(e,r={},n){return this._client.getAPIList(O`/chatkit/threads/${e}/items`,Uo,{query:r,...n,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers])})}};var Ii=class extends C{constructor(){super(...arguments),this.sessions=new zc(this._client),this.threads=new Mc(this._client)}};Ii.Sessions=zc;Ii.Threads=Mc;var jc=class extends C{create(e,r,n){return this._client.post(O`/threads/${e}/messages`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(O`/threads/${o}/messages/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/messages/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/threads/${e}/messages`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(O`/threads/${o}/messages/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var Dc=class extends C{retrieve(e,r,n){let{thread_id:o,run_id:i,...s}=r;return this._client.get(O`/threads/${o}/runs/${i}/steps/${e}`,{query:s,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r,n){let{thread_id:o,...i}=r;return this._client.getAPIList(O`/threads/${o}/runs/${e}/steps`,ke,{query:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var oA=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()};var Zt,Ls,Dw,co,Um,Nn,Us,Lc,Ds,Zm,Wr,Fm,Bm,xd,bd,wd,iA,sA,aA,cA,uA,lA,dA,qo=class extends bi{constructor(){super(...arguments),Zt.add(this),Dw.set(this,[]),co.set(this,{}),Um.set(this,{}),Nn.set(this,void 0),Us.set(this,void 0),Lc.set(this,void 0),Ds.set(this,void 0),Zm.set(this,void 0),Wr.set(this,void 0),Fm.set(this,void 0),Bm.set(this,void 0),xd.set(this,void 0)}[(Dw=new WeakMap,co=new WeakMap,Um=new WeakMap,Nn=new WeakMap,Us=new WeakMap,Lc=new WeakMap,Ds=new WeakMap,Zm=new WeakMap,Wr=new WeakMap,Fm=new WeakMap,Bm=new WeakMap,xd=new WeakMap,Zt=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new Ls;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=io.fromReadableStream(e,this.controller);for await(let i of o)S(this,Zt,"m",bd).call(this,i);if(o.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}toReadableStream(){return new io(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new Ls;return i._run(()=>i._runToolAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...n,stream:!0},a=await e.submitToolOutputs(r,s,{...o,signal:this.controller.signal});this._connected();for await(let c of a)S(this,Zt,"m",bd).call(this,c);if(a.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}static createThreadAssistantStream(e,r,n){let o=new Ls;return o._run(()=>o._threadAssistantStream(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,r,n,o){let i=new Ls;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return S(this,Fm,"f")}currentRun(){return S(this,Bm,"f")}currentMessageSnapshot(){return S(this,Nn,"f")}currentRunStepSnapshot(){return S(this,xd,"f")}async finalRunSteps(){return await this.done(),Object.values(S(this,co,"f"))}async finalMessages(){return await this.done(),Object.values(S(this,Um,"f"))}async finalRun(){if(await this.done(),!S(this,Us,"f"))throw Error("Final run was not received.");return S(this,Us,"f")}async _createThreadAssistantStream(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));let i={...r,stream:!0},s=await e.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let a of s)S(this,Zt,"m",bd).call(this,a);if(s.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}async _createAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...n,stream:!0},a=await e.create(r,s,{...o,signal:this.controller.signal});this._connected();for await(let c of a)S(this,Zt,"m",bd).call(this,c);if(a.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}static accumulateDelta(e,r){for(let[n,o]of Object.entries(r)){if(!e.hasOwnProperty(n)){e[n]=o;continue}let i=e[n];if(i==null){e[n]=o;continue}if(n==="index"||n==="type"){e[n]=o;continue}if(typeof i=="string"&&typeof o=="string")i+=o;else if(typeof i=="number"&&typeof o=="number")i+=o;else if(nd(i)&&nd(o))i=this.accumulateDelta(i,o);else if(Array.isArray(i)&&Array.isArray(o)){if(i.every(s=>typeof s=="string"||typeof s=="number")){i.push(...o);continue}for(let s of o){if(!nd(s))throw new Error(`Expected array delta entry to be an object but got: ${s}`);let a=s.index;if(a==null)throw console.error(s),new Error("Expected array delta entry to have an `index` property");if(typeof a!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${a}`);let c=i[a];c==null?i.push(s):i[a]=this.accumulateDelta(c,s)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${o}, accValue: ${i}`);e[n]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,r,n){return await this._createThreadAssistantStream(r,e,n)}async _runAssistantStream(e,r,n,o){return await this._createAssistantStream(r,e,n,o)}async _runToolAssistantStream(e,r,n,o){return await this._createToolAssistantStream(r,e,n,o)}};Ls=qo,bd=function(e){if(!this.ended)switch(ce(this,Fm,e,"f"),S(this,Zt,"m",aA).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":S(this,Zt,"m",dA).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":S(this,Zt,"m",sA).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":S(this,Zt,"m",iA).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},wd=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");if(!S(this,Us,"f"))throw Error("Final run has not been received");return S(this,Us,"f")},iA=function(e){let[r,n]=S(this,Zt,"m",uA).call(this,e,S(this,Nn,"f"));ce(this,Nn,r,"f"),S(this,Um,"f")[r.id]=r;for(let o of n){let i=r.content[o.index];i?.type=="text"&&this._emit("textCreated",i.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,r),e.data.delta.content)for(let o of e.data.delta.content){if(o.type=="text"&&o.text){let i=o.text,s=r.content[o.index];if(s&&s.type=="text")this._emit("textDelta",i,s.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(o.index!=S(this,Lc,"f")){if(S(this,Ds,"f"))switch(S(this,Ds,"f").type){case"text":this._emit("textDone",S(this,Ds,"f").text,S(this,Nn,"f"));break;case"image_file":this._emit("imageFileDone",S(this,Ds,"f").image_file,S(this,Nn,"f"));break}ce(this,Lc,o.index,"f")}ce(this,Ds,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(S(this,Lc,"f")!==void 0){let o=e.data.content[S(this,Lc,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,S(this,Nn,"f"));break;case"text":this._emit("textDone",o.text,S(this,Nn,"f"));break}}S(this,Nn,"f")&&this._emit("messageDone",e.data),ce(this,Nn,void 0,"f")}},sA=function(e){let r=S(this,Zt,"m",cA).call(this,e);switch(ce(this,xd,r,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let n=e.data.delta;if(n.step_details&&n.step_details.type=="tool_calls"&&n.step_details.tool_calls&&r.step_details.type=="tool_calls")for(let i of n.step_details.tool_calls)i.index==S(this,Zm,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(S(this,Wr,"f")&&this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Zm,i.index,"f"),ce(this,Wr,r.step_details.tool_calls[i.index],"f"),S(this,Wr,"f")&&this._emit("toolCallCreated",S(this,Wr,"f")));this._emit("runStepDelta",e.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":ce(this,xd,void 0,"f"),e.data.step_details.type=="tool_calls"&&S(this,Wr,"f")&&(this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Wr,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},aA=function(e){S(this,Dw,"f").push(e),this._emit("event",e)},cA=function(e){switch(e.event){case"thread.run.step.created":return S(this,co,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=S(this,co,"f")[e.data.id];if(!r)throw Error("Received a RunStepDelta before creation of a snapshot");let n=e.data;if(n.delta){let o=Ls.accumulateDelta(r,n.delta);S(this,co,"f")[e.data.id]=o}return S(this,co,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":S(this,co,"f")[e.data.id]=e.data;break}if(S(this,co,"f")[e.data.id])return S(this,co,"f")[e.data.id];throw new Error("No snapshot available")},uA=function(e,r){let n=[];switch(e.event){case"thread.message.created":return[e.data,n];case"thread.message.delta":if(!r)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let o=e.data;if(o.delta.content)for(let i of o.delta.content)if(i.index in r.content){let s=r.content[i.index];r.content[i.index]=S(this,Zt,"m",lA).call(this,i,s)}else r.content[i.index]=i,n.push(i);return[r,n];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(r)return[r,n];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},lA=function(e,r){return Ls.accumulateDelta(r,e)},dA=function(e){switch(ce(this,Bm,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":ce(this,Us,e.data,"f"),S(this,Wr,"f")&&(this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Wr,void 0,"f"));break;case"thread.run.cancelling":break}};var Fs=class extends C{constructor(){super(...arguments),this.steps=new Dc(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(O`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(O`/threads/${o}/runs/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/runs/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/threads/${e}/runs`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(O`/threads/${o}/runs/${e}/cancel`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(o.id,{thread_id:e},n)}createAndStream(e,r,n){return qo.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(e,r,{...n,headers:{...n?.headers,...o}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return qo.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}async submitToolOutputsAndPoll(e,r,n){let o=await this.submitToolOutputs(e,r,n);return await this.poll(o.id,r,n)}submitToolOutputsStream(e,r,n){return qo.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};Fs.Steps=Dc;var ki=class extends C{constructor(){super(...arguments),this.runs=new Fs(this._client),this.messages=new jc(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/threads/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete(O`/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:e.stream??!1})}async createAndRunPoll(e,r){let n=await this.createAndRun(e,r);return await this.runs.poll(n.id,{thread_id:n.thread_id},r)}createAndRunStream(e,r){return qo.createThreadAssistantStream(e,this._client.beta.threads,r)}};ki.Runs=Fs;ki.Messages=jc;var zn=class extends C{constructor(){super(...arguments),this.realtime=new $i(this._client),this.chatkit=new Ii(this._client),this.assistants=new Cc(this._client),this.threads=new ki(this._client)}};zn.Realtime=$i;zn.ChatKit=Ii;zn.Assistants=Cc;zn.Threads=ki;var Bs=class extends C{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}};var Uc=class extends C{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(O`/containers/${o}/files/${e}/content`,{...n,headers:L([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}};var Zs=class extends C{constructor(){super(...arguments),this.content=new Uc(this._client)}create(e,r,n){return this._client.post(O`/containers/${e}/files`,Hr({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(O`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList(O`/containers/${e}/files`,ke,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(O`/containers/${o}/files/${e}`,{...n,headers:L([{Accept:"*/*"},n?.headers])})}};Zs.Content=Uc;var Ti=class extends C{constructor(){super(...arguments),this.files=new Zs(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get(O`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/containers/${e}`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}};Ti.Files=Zs;var Fc=class extends C{create(e,r,n){let{include:o,...i}=r;return this._client.post(O`/conversations/${e}/items`,{query:{include:o},body:i,...n})}retrieve(e,r,n){let{conversation_id:o,...i}=r;return this._client.get(O`/conversations/${o}/items/${e}`,{query:i,...n})}list(e,r={},n){return this._client.getAPIList(O`/conversations/${e}/items`,Uo,{query:r,...n})}delete(e,r,n){let{conversation_id:o}=r;return this._client.delete(O`/conversations/${o}/items/${e}`,n)}};var Ei=class extends C{constructor(){super(...arguments),this.items=new Fc(this._client)}create(e={},r){return this._client.post("/conversations",{body:e,...r})}retrieve(e,r){return this._client.get(O`/conversations/${e}`,r)}update(e,r,n){return this._client.post(O`/conversations/${e}`,{body:r,...n})}delete(e,r){return this._client.delete(O`/conversations/${e}`,r)}};Ei.Items=Fc;var qs=class extends C{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&$t(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:($t(this._client).debug("embeddings/decoding base64 embeddings from base64"),i._thenUnwrap(s=>(s&&s.data&&s.data.forEach(a=>{let c=a.embedding;a.embedding=oA(c)}),s)))}};var Bc=class extends C{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get(O`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList(O`/evals/${o}/runs/${e}/output_items`,ke,{query:i,...n})}};var Vs=class extends C{constructor(){super(...arguments),this.outputItems=new Bc(this._client)}create(e,r,n){return this._client.post(O`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(O`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList(O`/evals/${e}/runs`,ke,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(O`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(O`/evals/${o}/runs/${e}`,n)}};Vs.OutputItems=Bc;var Ai=class extends C{constructor(){super(...arguments),this.runs=new Vs(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(O`/evals/${e}`,r)}update(e,r,n){return this._client.post(O`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/evals/${e}`,r)}};Ai.Runs=Vs;var Gs=class extends C{create(e,r){return this._client.post("/files",Hr({body:e,...r},this._client))}retrieve(e,r){return this._client.get(O`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/files/${e}`,r)}content(e,r){return this._client.get(O`/files/${e}/content`,{...r,headers:L([{Accept:"application/binary"},r?.headers]),__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:n=1800*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),s=await this.retrieve(e);for(;!s.status||!o.has(s.status);)if(await no(r),s=await this.retrieve(e),Date.now()-i>n)throw new Do({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return s}};var Zc=class extends C{};var qc=class extends C{run(e,r){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...r})}validate(e,r){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...r})}};var Ks=class extends C{constructor(){super(...arguments),this.graders=new qc(this._client)}};Ks.Graders=qc;var Vc=class extends C{create(e,r,n){return this._client.getAPIList(O`/fine_tuning/checkpoints/${e}/permissions`,so,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get(O`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(O`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}};var Hs=class extends C{constructor(){super(...arguments),this.permissions=new Vc(this._client)}};Hs.Permissions=Vc;var Gc=class extends C{list(e,r={},n){return this._client.getAPIList(O`/fine_tuning/jobs/${e}/checkpoints`,ke,{query:r,...n})}};var Ws=class extends C{constructor(){super(...arguments),this.checkpoints=new Gc(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(O`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",ke,{query:e,...r})}cancel(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList(O`/fine_tuning/jobs/${e}/events`,ke,{query:r,...n})}pause(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/resume`,r)}};Ws.Checkpoints=Gc;var Mn=class extends C{constructor(){super(...arguments),this.methods=new Zc(this._client),this.jobs=new Ws(this._client),this.checkpoints=new Hs(this._client),this.alpha=new Ks(this._client)}};Mn.Methods=Zc;Mn.Jobs=Ws;Mn.Checkpoints=Hs;Mn.Alpha=Ks;var Kc=class extends C{};var Oi=class extends C{constructor(){super(...arguments),this.graderModels=new Kc(this._client)}};Oi.GraderModels=Kc;var Js=class extends C{createVariation(e,r){return this._client.post("/images/variations",Hr({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",Hr({body:e,...r,stream:e.stream??!1},this._client))}generate(e,r){return this._client.post("/images/generations",{body:e,...r,stream:e.stream??!1})}};var Xs=class extends C{retrieve(e,r){return this._client.get(O`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",so,e)}delete(e,r){return this._client.delete(O`/models/${e}`,r)}};var Ys=class extends C{create(e,r){return this._client.post("/moderations",{body:e,...r})}};var Hc=class extends C{accept(e,r,n){return this._client.post(O`/realtime/calls/${e}/accept`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}hangup(e,r){return this._client.post(O`/realtime/calls/${e}/hangup`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}refer(e,r,n){return this._client.post(O`/realtime/calls/${e}/refer`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}reject(e,r={},n){return this._client.post(O`/realtime/calls/${e}/reject`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}};var Wc=class extends C{create(e,r){return this._client.post("/realtime/client_secrets",{body:e,...r})}};var Vo=class extends C{constructor(){super(...arguments),this.clientSecrets=new Wc(this._client),this.calls=new Hc(this._client)}};Vo.ClientSecrets=Wc;Vo.Calls=Hc;function pA(t,e){return!e||!QF(e)?{...t,output_parsed:null,output:t.output.map(r=>r.type==="function_call"?{...r,parsed_arguments:null}:r.type==="message"?{...r,content:r.content.map(n=>({...n,parsed:null}))}:r)}:Lw(t,e)}function Lw(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:rB(e,o)};if(o.type==="message"){let i=o.content.map(s=>s.type==="output_text"?{...s,parsed:YF(e,s.text)}:s);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||qm(n),Object.defineProperty(n,"output_parsed",{enumerable:!0,get(){for(let o of n.output)if(o.type==="message"){for(let i of o.content)if(i.type==="output_text"&&i.parsed!==null)return i.parsed}return null}}),n}function YF(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function QF(t){return!!pd(t.text?.format)}function eB(t){return t?.$brand==="auto-parseable-tool"}function tB(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function rB(t,e){let r=tB(t.tools??[],e.name);return{...e,...e,parsed_arguments:eB(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function qm(t){let e=[];for(let r of t.output)if(r.type==="message")for(let n of r.content)n.type==="output_text"&&e.push(n.text);t.output_text=e.join("")}var Jc,Vm,Pi,Gm,fA,mA,hA,gA,Km=class t extends bi{constructor(e){super(),Jc.add(this),Vm.set(this,void 0),Pi.set(this,void 0),Gm.set(this,void 0),ce(this,Vm,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createOrRetrieveResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createOrRetrieveResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,Jc,"m",fA).call(this);let i,s=null;"response_id"in r?(i=await e.responses.retrieve(r.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),s=r.starting_after??null):i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(let a of i)S(this,Jc,"m",mA).call(this,a,s);if(i.controller.signal?.aborted)throw new xt;return S(this,Jc,"m",hA).call(this)}[(Vm=new WeakMap,Pi=new WeakMap,Gm=new WeakMap,Jc=new WeakSet,fA=function(){this.ended||ce(this,Pi,void 0,"f")},mA=function(r,n){if(this.ended)return;let o=(s,a)=>{(n==null||a.sequence_number>n)&&this._emit(s,a)},i=S(this,Jc,"m",gA).call(this,r);switch(o("event",r),r.type){case"response.output_text.delta":{let s=i.output[r.output_index];if(!s)throw new V(`missing output at index ${r.output_index}`);if(s.type==="message"){let a=s.content[r.content_index];if(!a)throw new V(`missing content at index ${r.content_index}`);if(a.type!=="output_text")throw new V(`expected content to be 'output_text', got ${a.type}`);o("response.output_text.delta",{...r,snapshot:a.text})}break}case"response.function_call_arguments.delta":{let s=i.output[r.output_index];if(!s)throw new V(`missing output at index ${r.output_index}`);s.type==="function_call"&&o("response.function_call_arguments.delta",{...r,snapshot:s.arguments});break}default:o(r.type,r);break}},hA=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");let r=S(this,Pi,"f");if(!r)throw new V("request ended without sending any events");ce(this,Pi,void 0,"f");let n=nB(r,S(this,Vm,"f"));return ce(this,Gm,n,"f"),n},gA=function(r){let n=S(this,Pi,"f");if(!n){if(r.type!=="response.created")throw new V(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=ce(this,Pi,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);let i=o.type,s=r.part;i==="message"&&s.type!=="reasoning_text"?o.content.push(s):i==="reasoning"&&s.type==="reasoning_text"&&(o.content||(o.content=[]),o.content.push(s));break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new V(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new V(`expected content to be 'output_text', got ${i.type}`);i.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.reasoning_text.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);if(o.type==="reasoning"){let i=o.content?.[r.content_index];if(!i)throw new V(`missing content at index ${r.content_index}`);if(i.type!=="reasoning_text")throw new V(`expected content to be 'reasoning_text', got ${i.type}`);i.text+=r.delta}break}case"response.completed":{ce(this,Pi,r.response,"f");break}}return n},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=S(this,Gm,"f");if(!e)throw new V("stream ended without producing a ChatCompletion");return e}};function nB(t,e){return pA(t,e)}var Xc=class extends C{list(e,r={},n){return this._client.getAPIList(O`/responses/${e}/input_items`,ke,{query:r,...n})}};var Yc=class extends C{count(e={},r){return this._client.post("/responses/input_tokens",{body:e,...r})}};var Go=class extends C{constructor(){super(...arguments),this.inputItems=new Xc(this._client),this.inputTokens=new Yc(this._client)}create(e,r){return this._client.post("/responses",{body:e,...r,stream:e.stream??!1})._thenUnwrap(n=>("object"in n&&n.object==="response"&&qm(n),n))}retrieve(e,r={},n){return this._client.get(O`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&qm(o),o))}delete(e,r){return this._client.delete(O`/responses/${e}`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>Lw(n,e))}stream(e,r){return Km.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(O`/responses/${e}/cancel`,r)}compact(e={},r){return this._client.post("/responses/compact",{body:e,...r})}};Go.InputItems=Xc;Go.InputTokens=Yc;var Qc=class extends C{create(e,r,n){return this._client.post(O`/uploads/${e}/parts`,Hr({body:r,...n},this._client))}};var Ci=class extends C{constructor(){super(...arguments),this.parts=new Qc(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(O`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(O`/uploads/${e}/complete`,{body:r,...n})}};Ci.Parts=Qc;var _A=async t=>{let e=await Promise.allSettled(t),r=e.filter(o=>o.status==="rejected");if(r.length){for(let o of r)console.error(o.reason);throw new Error(`${r.length} promise(s) failed - see the above errors`)}let n=[];for(let o of e)o.status==="fulfilled"&&n.push(o.value);return n};var eu=class extends C{create(e,r,n){return this._client.post(O`/vector_stores/${e}/file_batches`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(O`/vector_stores/${o}/file_batches/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{vector_store_id:o}=r;return this._client.post(O`/vector_stores/${o}/file_batches/${e}/cancel`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r);return await this.poll(e,o.id,n)}listFiles(e,r,n){let{vector_store_id:o,...i}=r;return this._client.getAPIList(O`/vector_stores/${o}/file_batches/${e}/files`,ke,{query:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse();switch(i.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,s=Math.min(i,r.length),a=this._client,c=r.values(),u=[...n];async function l(f){for(let p of f){let m=await a.files.create({file:p,purpose:"assistants"},o);u.push(m.id)}}let d=Array(s).fill(c).map(l);return await _A(d),await this.createAndPoll(e,{file_ids:u})}};var tu=class extends C{create(e,r,n){return this._client.post(O`/vector_stores/${e}/files`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(O`/vector_stores/${o}/files/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{vector_store_id:o,...i}=r;return this._client.post(O`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/vector_stores/${e}/files`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{vector_store_id:o}=r;return this._client.delete(O`/vector_stores/${o}/files/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse(),s=i.data;switch(s.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=i.response.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"failed":case"completed":return s}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}content(e,r,n){let{vector_store_id:o}=r;return this._client.getAPIList(O`/vector_stores/${o}/files/${e}/content`,so,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var Ko=class extends C{constructor(){super(...arguments),this.files=new tu(this._client),this.fileBatches=new eu(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/vector_stores/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/vector_stores/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",ke,{query:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(O`/vector_stores/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList(O`/vector_stores/${e}/search`,so,{body:r,method:"post",...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};Ko.Files=tu;Ko.FileBatches=eu;var Qs=class extends C{create(e,r){return this._client.post("/videos",ww({body:e,...r},this._client))}retrieve(e,r){return this._client.get(O`/videos/${e}`,r)}list(e={},r){return this._client.getAPIList("/videos",Uo,{query:e,...r})}delete(e,r){return this._client.delete(O`/videos/${e}`,r)}downloadContent(e,r={},n){return this._client.get(O`/videos/${e}/content`,{query:r,...n,headers:L([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}remix(e,r,n){return this._client.post(O`/videos/${e}/remix`,ww({body:r,...n},this._client))}};var ru,yA,Hm,ea=class extends C{constructor(){super(...arguments),ru.add(this)}async unwrap(e,r,n=this._client.webhookSecret,o=300){return await this.verifySignature(e,r,n,o),JSON.parse(e)}async verifySignature(e,r,n=this._client.webhookSecret,o=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");S(this,ru,"m",yA).call(this,n);let i=L([r]).values,s=S(this,ru,"m",Hm).call(this,i,"webhook-signature"),a=S(this,ru,"m",Hm).call(this,i,"webhook-timestamp"),c=S(this,ru,"m",Hm).call(this,i,"webhook-id"),u=parseInt(a,10);if(isNaN(u))throw new ro("Invalid webhook timestamp format");let l=Math.floor(Date.now()/1e3);if(l-u>o)throw new ro("Webhook timestamp is too old");if(u>l+o)throw new ro("Webhook timestamp is too new");let d=s.split(" ").map(h=>h.startsWith("v1,")?h.substring(3):h),f=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),p=c?`${c}.${a}.${e}`:`${a}.${e}`,m=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let h of d)try{let _=Buffer.from(h,"base64");if(await crypto.subtle.verify("HMAC",m,_,new TextEncoder().encode(p)))return}catch{continue}throw new ro("The given webhook signature does not match the expected signature")}};ru=new WeakSet,yA=function(e){if(typeof e!="string"||e.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},Hm=function(e,r){if(!e)throw new Error("Headers are required");let n=e.get(r);if(n==null)throw new Error(`Missing required header: ${r}`);return n};var Uw,Fw,Wm,vA,fe=class{constructor({baseURL:e=Si("OPENAI_BASE_URL"),apiKey:r=Si("OPENAI_API_KEY"),organization:n=Si("OPENAI_ORG_ID")??null,project:o=Si("OPENAI_PROJECT_ID")??null,webhookSecret:i=Si("OPENAI_WEBHOOK_SECRET")??null,...s}={}){if(Uw.add(this),Wm.set(this,void 0),this.completions=new Bs(this),this.chat=new xi(this),this.embeddings=new qs(this),this.files=new Gs(this),this.images=new Js(this),this.audio=new ao(this),this.moderations=new Ys(this),this.models=new Xs(this),this.fineTuning=new Mn(this),this.graders=new Oi(this),this.vectorStores=new Ko(this),this.webhooks=new ea(this),this.beta=new zn(this),this.batches=new js(this),this.uploads=new Ci(this),this.responses=new Go(this),this.realtime=new Vo(this),this.conversations=new Ei(this),this.evals=new Ai(this),this.containers=new Ti(this),this.videos=new Qs(this),r===void 0)throw new V("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");let a={apiKey:r,organization:n,project:o,webhookSecret:i,...s,baseURL:e||"https://api.openai.com/v1"};if(!a.dangerouslyAllowBrowser&&kE())throw new V(`It looks like you're running in a browser-like environment. + +This is disabled by default, as it risks exposing your secret API credentials to attackers. +If you understand the risks and have appropriate mitigations in place, +you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g., + +new OpenAI({ apiKey, dangerouslyAllowBrowser: true }); + +https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety +`);this.baseURL=a.baseURL,this.timeout=a.timeout??Fw.DEFAULT_TIMEOUT,this.logger=a.logger??console;let c="warn";this.logLevel=c,this.logLevel=hw(a.logLevel,"ClientOptions.logLevel",this)??hw(Si("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??c,this.fetchOptions=a.fetchOptions,this.maxRetries=a.maxRetries??2,this.fetch=a.fetch??EE(),ce(this,Wm,OE,"f"),this._options=a,this.apiKey=typeof r=="string"?r:"Missing Key",this.organization=n,this.project=o,this.webhookSecret=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return L([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return fw(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${vi}`}defaultIdempotencyKey(){return`stainless-node-retry-${nw()}`}makeStatusError(e,r,n,o){return Pt.generate(e,r,n,o)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(n){throw n instanceof V?n:new V(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new V(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let o=!S(this,Uw,"m",vA).call(this)&&n||this.baseURL,i=yE(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery();return vE(s)||(r={...s,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}async prepareOptions(e){await this._callApiKey()}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(o=>({method:e,path:r,...o})))}request(e,r=null){return new Rs(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,i=o.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(o);let{req:s,url:a,timeout:c}=await this.buildRequest(o,{retryCount:i-r});await this.prepareRequest(s,{url:a,options:o});let u="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),l=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if($t(this).debug(`[${u}] sending request`,Lo({retryOfRequestLogID:n,method:o.method,url:a,options:o,headers:s.headers})),o.signal?.aborted)throw new xt;let f=new AbortController,p=await this.fetchWithTimeout(a,s,c,f).catch(rd),m=Date.now();if(p instanceof globalThis.Error){let v=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new xt;let b=td(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return $t(this).info(`[${u}] connection ${b?"timed out":"failed"} - ${v}`),$t(this).debug(`[${u}] connection ${b?"timed out":"failed"} (${v})`,Lo({retryOfRequestLogID:n,url:a,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??u);throw $t(this).info(`[${u}] connection ${b?"timed out":"failed"} - error; no more retries left`),$t(this).debug(`[${u}] connection ${b?"timed out":"failed"} (error; no more retries left)`,Lo({retryOfRequestLogID:n,url:a,durationMs:m-d,message:p.message})),b?new Do:new yi({cause:p})}let h=[...p.headers.entries()].filter(([v])=>v==="x-request-id").map(([v,b])=>", "+v+": "+JSON.stringify(b)).join(""),_=`[${u}${l}${h}] ${s.method} ${a} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let v=await this.shouldRetry(p);if(r&&v){let J=`retrying, ${r} attempts remaining`;return await AE(p.body),$t(this).info(`${_} - ${J}`),$t(this).debug(`[${u}] response error (${J})`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??u,p.headers)}let b=v?"error; no more retries left":"error; not retryable";$t(this).info(`${_} - ${b}`);let x=await p.text().catch(J=>rd(J).message),k=xE(x),T=k?void 0:x;throw $t(this).debug(`[${u}] response error (${b})`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:T,durationMs:Date.now()-d})),this.makeStatusError(p.status,k,T,p.headers)}return $t(this).info(_),$t(this).debug(`[${u}] response start`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),{response:p,options:o,controller:f,requestLogID:u,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new cd(this,n,e)}async fetchWithTimeout(e,r,n,o){let{signal:i,method:s,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let c=setTimeout(()=>o.abort(),n),u=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,l={signal:o.signal,...u?{duplex:"half"}:{},method:"GET",...a};s&&(l.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,l)}finally{clearTimeout(c)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,o){let i,s=o?.get("retry-after-ms");if(s){let c=parseFloat(s);Number.isNaN(c)||(i=c)}let a=o?.get("retry-after");if(a&&!i){let c=parseFloat(a);Number.isNaN(c)?i=Date.parse(a)-Date.now():i=c*1e3}if(!(i&&0<=i&&i<60*1e3)){let c=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,c)}return await no(i),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,s=Math.min(.5*Math.pow(2,i),8),a=1-Math.random()*.25;return s*a*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:s,defaultBaseURL:a}=n,c=this.buildURL(i,s,a);"timeout"in n&&wE("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:u,body:l}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:u,retryCount:r});return{req:{method:o,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:c,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let s=L([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...TE(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=L([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:xm(e)}:S(this,Wm,"f").call(this,{body:e,headers:n})}};Fw=fe,Wm=new WeakMap,Uw=new WeakSet,vA=function(){return this.baseURL!=="https://api.openai.com/v1"};fe.OpenAI=Fw;fe.DEFAULT_TIMEOUT=6e5;fe.OpenAIError=V;fe.APIError=Pt;fe.APIConnectionError=yi;fe.APIConnectionTimeoutError=Do;fe.APIUserAbortError=xt;fe.NotFoundError=gc;fe.ConflictError=_c;fe.RateLimitError=vc;fe.BadRequestError=fc;fe.AuthenticationError=mc;fe.InternalServerError=bc;fe.PermissionDeniedError=hc;fe.UnprocessableEntityError=yc;fe.InvalidWebhookSignatureError=ro;fe.toFile=ld;fe.Completions=Bs;fe.Chat=xi;fe.Embeddings=qs;fe.Files=Gs;fe.Images=Js;fe.Audio=ao;fe.Moderations=Ys;fe.Models=Xs;fe.FineTuning=Mn;fe.Graders=Oi;fe.VectorStores=Ko;fe.Webhooks=ea;fe.Beta=zn;fe.Batches=js;fe.Uploads=Ci;fe.Responses=Go;fe.Realtime=Vo;fe.Conversations=Ei;fe.Evals=Ai;fe.Containers=Ti;fe.Videos=Qs;var lB=Object.defineProperty,G=(t,e)=>{for(var r in e)lB(t,r,{get:e[r],enumerable:!0})};function Jr(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function nu(t){return Jr(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function ou(t){return Jr(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function bA(t){return Jr(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function Jm(t){return Jr(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function Xm(t){if(Jr(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function Ym(t){let e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);let r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);let o={};for(let i of t.split(";").slice(1)){let s=i.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);let a=s[0].trim(),c=s[1].trim();if(a==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);o[a]=c}return{type:r,subtype:n,parameters:o}}function ta({dataUrl:t,asTypedArray:e=!1}){let r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let o=e?Uint8Array.from(atob(r[2]),i=>i.charCodeAt(0)):r[2];return{mime_type:n,data:o}}}function $d(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}function Qm(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var OA=mn(xA(),1),_B=mn(AA(),1);function PA(t,e){return e?.[t]||(0,OA.default)(t)}function CA(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var yB={};G(yB,{Serializable:()=>uo,get_lc_unique_name:()=>eh});function RA(t){return Array.isArray(t)?[...t]:{...t}}function vB(t,e){let r=RA(t);for(let[n,o]of Object.entries(e)){let[i,...s]=n.split(".").reverse(),a=r;for(let c of s.reverse()){if(a[c]===void 0)break;a[c]=RA(a[c]),a=a[c]}a[i]!==void 0&&(a[i]={lc:1,type:"secret",id:[o]})}return r}function eh(t){let e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var uo=class NA{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eh(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof NA||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((o,i)=>(o[i]=i in this?this[i]:this.lc_kwargs[i],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(e,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));return Object.keys(r).forEach(o=>{let i=this,s=n,[a,...c]=o.split(".").reverse();for(let u of c.reverse()){if(!(u in i)||i[u]===void 0)return;(!(u in s)||s[u]===void 0)&&(typeof i[u]=="object"&&i[u]!=null?s[u]={}:Array.isArray(i[u])&&(s[u]=[])),i=i[u],s=s[u]}a in i&&i[a]!==void 0&&(s[a]=s[a]||i[a])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:CA(Object.keys(r).length?vB(n,r):n,PA,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function re(t,e){return me(t)&&t.type===e}function me(t){return typeof t=="object"&&t!==null}function Ar(t){return Array.isArray(t)}function K(t){return typeof t=="string"}function Xr(t){return typeof t=="number"}function th(t){return t instanceof Uint8Array}function qw(t){try{return JSON.parse(t)}catch{return}}var Ho=t=>t();function bB(t){if(t.type==="char_location"&&K(t.document_title)&&Xr(t.start_char_index)&&Xr(t.end_char_index)&&K(t.cited_text)){let{document_title:e,start_char_index:r,end_char_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"char",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="page_location"&&K(t.document_title)&&Xr(t.start_page_number)&&Xr(t.end_page_number)&&K(t.cited_text)){let{document_title:e,start_page_number:r,end_page_number:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"page",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="content_block_location"&&K(t.document_title)&&Xr(t.start_block_index)&&Xr(t.end_block_index)&&K(t.cited_text)){let{document_title:e,start_block_index:r,end_block_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"block",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="web_search_result_location"&&K(t.url)&&K(t.title)&&K(t.encrypted_index)&&K(t.cited_text)){let{url:e,title:r,encrypted_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"url",url:e,title:r,startIndex:Number(n),endIndex:Number(n),citedText:o}}if(t.type==="search_result_location"&&K(t.source)&&K(t.title)&&Xr(t.start_block_index)&&Xr(t.end_block_index)&&K(t.cited_text)){let{source:e,title:r,start_block_index:n,end_block_index:o,cited_text:i,...s}=t;return{...s,type:"citation",source:"search",url:e,title:r??void 0,startIndex:n,endIndex:o,citedText:i}}}function MA(t){if(re(t,"document")&&me(t.source)&&"type"in t.source){if(t.source.type==="base64"&&K(t.source.media_type)&&K(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&K(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&K(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&K(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(re(t,"image")&&me(t.source)&&"type"in t.source){if(t.source.type==="base64"&&K(t.source.media_type)&&K(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&K(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&K(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function jA(t){function*e(){for(let r of t){let n=MA(r);n?yield n:yield r}}return Array.from(e())}function zA(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"text")&&K(n.text)){let{text:o,citations:i,...s}=n;if(Ar(i)&&i.length){let a=i.reduce((c,u)=>{let l=bB(u);return l?[...c,l]:c},[]);yield{...s,type:"text",text:o,annotations:a};continue}else{yield{...s,type:"text",text:o};continue}}else if(re(n,"thinking")&&K(n.thinking)){let{thinking:o,signature:i,...s}=n;yield{...s,type:"reasoning",reasoning:o,signature:i};continue}else if(re(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(re(n,"tool_use")&&K(n.name)&&K(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(re(n,"input_json_delta")){if(wB(t)&&t.tool_call_chunks?.length){let o=t.tool_call_chunks[0];yield{type:"tool_call_chunk",id:o.id,name:o.name,args:o.args,index:o.index};continue}}else if(re(n,"server_tool_use")&&K(n.name)&&K(n.id)){let{name:o,id:i}=n;if(o==="web_search"){let s=Ho(()=>{if(typeof n.input=="string")return n.input;if(me(n.input)&&K(n.input.query))return n.input.query;if(K(n.partial_json)){let a=qw(n.partial_json);if(a?.query)return a.query}return""});yield{id:i,type:"server_tool_call",name:"web_search",args:{query:s}};continue}else if(n.name==="code_execution"){let s=Ho(()=>{if(typeof n.input=="string")return n.input;if(me(n.input)&&K(n.input.code))return n.input.code;if(K(n.partial_json)){let a=qw(n.partial_json);if(a?.code)return a.code}return""});yield{id:i,type:"server_tool_call",name:"code_execution",args:{code:s}};continue}}else if(re(n,"web_search_tool_result")&&K(n.tool_use_id)&&Ar(n.content)){let{content:o,tool_use_id:i}=n,s=o.reduce((a,c)=>re(c,"web_search_result")?[...a,c.url]:a,[]);yield{type:"server_tool_call_result",name:"web_search",toolCallId:i,status:"success",output:{urls:s}};continue}else if(re(n,"code_execution_tool_result")&&K(n.tool_use_id)&&me(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(re(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(re(n,"mcp_tool_result")&&K(n.tool_use_id)&&me(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(re(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(re(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(re(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let o=MA(n);if(o){yield o;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var DA={translateContent:zA,translateContentChunk:zA};function wB(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}function xB(t){return nu(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:ou(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:Jm(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function LA(t){return t.map(xB)}function UA(t){return!!(re(t,"image_url")&&me(t.image_url)||re(t,"input_audio")&&me(t.input_audio)||re(t,"file")&&me(t.file))}function FA(t){if(re(t,"image_url")&&me(t.image_url)&&K(t.image_url.url)){let e=ta({dataUrl:t.image_url.url});return e?{type:"image",mimeType:e.mime_type,data:e.data}:{type:"image",url:t.image_url.url}}else{if(re(t,"input_audio")&&me(t.input_audio)&&K(t.input_audio.data)&&K(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(re(t,"file")&&me(t.file)&&K(t.file.data)){let e=ta({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(K(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}function $B(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...rh(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function IB(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...rh(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function rh(t){let e=[];for(let r of t)UA(r)?e.push(FA(r)):e.push(r);return e}function SB(t){if(t.type==="url_citation"){let{url:e,title:r,start_index:n,end_index:o}=t;return{type:"citation",url:e,title:r,startIndex:n,endIndex:o}}if(t.type==="file_citation"){let{file_id:e,filename:r,index:n}=t;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:e}}return t}function BA(t){function*e(){me(t.additional_kwargs?.reasoning)&&Ar(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((o,i)=>me(i)&&K(i.text)?`${o}${i.text}`:o,"")});let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r)if(re(n,"text")){let{text:o,annotations:i,...s}=n;Array.isArray(i)?yield{...s,type:"text",text:String(o),annotations:i.map(SB)}:yield{...s,type:"text",text:String(o)}}for(let n of t.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(me(t.additional_kwargs)&&Ar(t.additional_kwargs.tool_outputs))for(let n of t.additional_kwargs.tool_outputs){if(re(n,"web_search_call")){yield{id:n.id,type:"server_tool_call",name:"web_search",args:{query:n.query}};continue}else if(re(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{query:n.query}};continue}else if(re(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(re(n,"code_interpreter_call")){if(K(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),Ar(n.outputs)){let o=Ho(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(let i of n.outputs)if(re(i,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:o??0,stderr:[0,void 0].includes(o)?void 0:String(i.logs),stdout:[0,void 0].includes(o)?String(i.logs):void 0}};continue}}continue}else if(re(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(re(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(re(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(re(n,"image_generation_call")){yield{type:"non_standard",value:n};continue}me(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function kB(t){function*e(){yield*BA(t);for(let r of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(e())}var ZA={translateContent:t=>typeof t.content=="string"?$B(t):BA(t),translateContentChunk:t=>typeof t.content=="string"?IB(t):kB(t)};function qA(t,e="pretty"){return e==="pretty"?TB(t):JSON.stringify(t)}function TB(t){let e=[],r=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),o="=".repeat(n),i=r.length%2===0?o:`${o}=`;if(e.push(`${o}${r}${i}`),t.type==="ai"){let s=t;if(s.tool_calls&&s.tool_calls.length>0){e.push("Tool Calls:");for(let a of s.tool_calls){e.push(` ${a.name} (${a.id})`),e.push(` Call ID: ${a.id}`),e.push(" Args:");for(let[c,u]of Object.entries(a.args))e.push(` ${c}: ${u}`)}}}if(t.type==="tool"){let s=t;s.name&&e.push(`Name: ${s.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(` +`)}var Vw=Symbol.for("langchain.message");function er(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.length===0?t:Array.isArray(e)&&e.some(r=>Jr(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?ra(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>Jr(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function nh(t,e){return t==="error"||e==="error"?"error":"success"}function EB(t,e){function r(n,o){if(typeof n!="object"||n===null||n===void 0)return n;if(o>=e)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(s=>r(s,o+1));let i={};for(let s of Object.keys(n))i[s]=r(n[s],o+1);return i}return JSON.stringify(r(t,0),null,2)}var qt=class extends uo{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[Vw]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(t){let e=typeof t=="string"||Array.isArray(t)?{content:t}:t;e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),this.name=e.name,e.content===void 0&&e.contentBlocks!==void 0?(this.content=e.contentBlocks,this.response_metadata={output_version:"v1",...e.response_metadata}):e.content!==void 0?(this.content=e.content??[],this.response_metadata=e.response_metadata):(this.content=[],this.response_metadata=e.response_metadata),this.additional_kwargs=e.additional_kwargs,this.id=e.id}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(t=>typeof t=="string"?t:t.type==="text"?t.text:"").join(""):""}get contentBlocks(){let t=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[LA,rh,jA].reduce((n,o)=>o(n),t)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(t){return typeof t=="object"&&t!==null&&Vw in t&&t[Vw]===!0&&Qm(t)}_updateId(t){this.id=t,this.lc_kwargs.id=t}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](t){if(t===null)return this;let e=EB(this._printableFields,Math.max(4,t));return`${this.constructor.lc_name()} ${e}`}toFormattedString(t="pretty"){return qA(this,t)}};function VA(t){return Array.isArray(t)&&t.every(e=>typeof e.index=="number")}function dt(t={},e={}){let r={...t};for(let[n,o]of Object.entries(e))if(r[n]==null)r[n]=o;else{if(o==null)continue;if(typeof r[n]!=typeof o||Array.isArray(r[n])!==Array.isArray(o))throw new Error(`field[${n}] already exists in the message chunk, but with a different type.`);if(typeof r[n]=="string"){if(n==="type")continue;["id","name","output_version","model_provider"].includes(n)?o&&(r[n]=o):r[n]+=o}else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=dt(r[n],o);else if(Array.isArray(r[n]))r[n]=ra(r[n],o);else{if(r[n]===o)continue;console.warn(`field[${n}] already exists in this message chunk and value has unsupported type.`)}}return r}function ra(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)return t||e;{let r=[...t];for(let n of e)if(typeof n=="object"&&n!==null&&"index"in n&&typeof n.index=="number"){let o=r.findIndex(i=>{let s=typeof i=="object",a="index"in i&&i.index===n.index,c="id"in i&&"id"in n&&i?.id===n?.id,u=!("id"in i)||!i?.id||!("id"in n)||!n?.id;return s&&a&&(c||u)});o!==-1&&typeof r[o]=="object"&&r[o]!==null?r[o]=dt(r[o],n):r.push(n)}else{if(typeof n=="object"&&n!==null&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function oh(t,e){if(!t&&!e)throw new Error("Cannot merge two undefined objects.");if(!t||!e)return t||e;if(typeof t!=typeof e)throw new Error(`Cannot merge objects of different types. +Left ${typeof t} +Right ${typeof e}`);if(typeof t=="string"&&typeof e=="string")return t+e;if(Array.isArray(t)&&Array.isArray(e))return ra(t,e);if(typeof t=="object"&&typeof e=="object")return dt(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types. +Left ${t} +Right ${e}`)}var fr=class GA extends qt{static isInstance(e){if(!super.isInstance(e))return!1;let r=Object.getPrototypeOf(e);for(;r!==null;){if(r===GA.prototype)return!0;r=Object.getPrototypeOf(r)}return!1}};function ih(t){return typeof t.role=="string"}function Yr(t){return typeof t?._getType=="function"}function iu(t){return fr.isInstance(t)}function sh(t,e){return dt(t??{},e??{})}function KA(t,e){let r={};return(t?.audio!==void 0||e?.audio!==void 0)&&(r.audio=(t?.audio??0)+(e?.audio??0)),(t?.image!==void 0||e?.image!==void 0)&&(r.image=(t?.image??0)+(e?.image??0)),(t?.video!==void 0||e?.video!==void 0)&&(r.video=(t?.video??0)+(e?.video??0)),(t?.document!==void 0||e?.document!==void 0)&&(r.document=(t?.document??0)+(e?.document??0)),(t?.text!==void 0||e?.text!==void 0)&&(r.text=(t?.text??0)+(e?.text??0)),r}function AB(t,e){let r={...KA(t,e)};return(t?.cache_read!==void 0||e?.cache_read!==void 0)&&(r.cache_read=(t?.cache_read??0)+(e?.cache_read??0)),(t?.cache_creation!==void 0||e?.cache_creation!==void 0)&&(r.cache_creation=(t?.cache_creation??0)+(e?.cache_creation??0)),r}function OB(t,e){let r={...KA(t,e)};return(t?.reasoning!==void 0||e?.reasoning!==void 0)&&(r.reasoning=(t?.reasoning??0)+(e?.reasoning??0)),r}function ah(t,e){return{input_tokens:(t?.input_tokens??0)+(e?.input_tokens??0),output_tokens:(t?.output_tokens??0)+(e?.output_tokens??0),total_tokens:(t?.total_tokens??0)+(e?.total_tokens??0),input_token_details:AB(t?.input_token_details,e?.input_token_details),output_token_details:OB(t?.output_token_details,e?.output_token_details)}}var PB={};G(PB,{ToolMessage:()=>Or,ToolMessageChunk:()=>na,defaultToolCallParser:()=>Sd,isDirectToolOutput:()=>Id,isToolMessage:()=>Gw,isToolMessageChunk:()=>Kw});function Id(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}var Or=class extends qt{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}lc_direct_tool_output=!0;type="tool";status;tool_call_id;metadata;artifact;constructor(t,e,r){let n=typeof t=="string"||Array.isArray(t)?{content:t,name:r,tool_call_id:e}:t;super(n),this.tool_call_id=n.tool_call_id,this.artifact=n.artifact,this.status=n.status,this.metadata=n.metadata}static isInstance(t){return super.isInstance(t)&&t.type==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},na=class extends fr{type="tool";tool_call_id;status;artifact;constructor(t){super(t),this.tool_call_id=t.tool_call_id,this.artifact=t.artifact,this.status=t.status}static lc_name(){return"ToolMessageChunk"}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),artifact:oh(this.artifact,t.artifact),tool_call_id:this.tool_call_id,id:this.id??t.id,status:nh(this.status,t.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}};function Sd(t){let e=[],r=[];for(let n of t)if(n.function){let o=n.function.name;try{let i=JSON.parse(n.function.arguments);e.push({name:o||"",args:i||{},id:n.id})}catch{r.push({name:o,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[e,r]}function Gw(t){return typeof t=="object"&&t!==null&&"getType"in t&&typeof t.getType=="function"&&t.getType()==="tool"}function Kw(t){return t._getType()==="tool"}var jn=class HA extends qt{static lc_name(){return"ChatMessage"}type="generic";role;static _chatMessageClass(){return HA}constructor(e,r){(typeof e=="string"||Array.isArray(e))&&(e={content:e,role:r}),super(e),this.role=e.role}static isInstance(e){return super.isInstance(e)&&e.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},Ri=class extends fr{static lc_name(){return"ChatMessageChunk"}type="generic";role;constructor(t,e){(typeof t=="string"||Array.isArray(t))&&(t={content:t,role:e}),super(t),this.role=t.role}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),role:this.role,id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}};function WA(t){return t._getType()==="generic"}function JA(t){return t._getType()==="generic"}var oa=class extends qt{static lc_name(){return"FunctionMessage"}type="function";name;constructor(t){super(t),this.name=t.name}},Ni=class extends fr{static lc_name(){return"FunctionMessageChunk"}type="function";concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),name:this.name??"",id:this.id??t.id})}};function XA(t){return t._getType()==="function"}function YA(t){return t._getType()==="function"}var mr=class extends qt{static lc_name(){return"HumanMessage"}type="human";constructor(t){super(t)}static isInstance(t){return super.isInstance(t)&&t.type==="human"}},zi=class extends fr{static lc_name(){return"HumanMessageChunk"}type="human";constructor(t){super(t)}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="human"}};function QA(t){return t.getType()==="human"}function eO(t){return t.getType()==="human"}var ia=class extends qt{type="remove";id;constructor(t){super({...t,content:[]}),this.id=t.id}get _printableFields(){return{...super._printableFields,id:this.id}}static isInstance(t){return super.isInstance(t)&&t.type==="remove"}};var hn=class ch extends qt{static lc_name(){return"SystemMessage"}type="system";constructor(e){super(e)}concat(e){if(typeof e=="string")return new ch({...this,content:er(this.content,e)});if(ch.isInstance(e))return new ch({...this,additional_kwargs:{...this.additional_kwargs,...e.additional_kwargs},response_metadata:{...this.response_metadata,...e.response_metadata},content:er(this.content,e.content)});throw new Error("Unexpected chunk type for system message")}static isInstance(e){return super.isInstance(e)&&e.type==="system"}},lo=class extends fr{static lc_name(){return"SystemMessageChunk"}type="system";constructor(t){super(t)}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="system"}};function tO(t){return t._getType()==="system"}function rO(t){return t._getType()==="system"}function uh(t,e){return t.lc_error_code=e,t.message=`${t.message} + +Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/ +`,t}function Mi(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function nO(t){return!!(t&&typeof t=="object"&&"toolCall"in t&&t.toolCall!=null&&typeof t.toolCall=="object"&&"id"in t.toolCall&&typeof t.toolCall.id=="string")}var su=class extends Error{output;constructor(t,e){super(t),this.output=e}};function kd(t,e=sa){t=t.trim();let r=t.indexOf("```");if(r===-1)return e(t);let n=t.substring(r+3);n.startsWith(`json +`)?n=n.substring(5):n.startsWith("json")?n=n.substring(4):n.startsWith(` +`)&&(n=n.substring(1));let o=n.indexOf("```"),i=n;return o!==-1&&(i=n.substring(0,o)),e(i.trim())}function CB(t){try{return JSON.parse(t)}catch{}let e=t.trim();if(e.length===0)throw new Error("Unexpected end of JSON input");let r=0;function n(){for(;r="0"&&e[r]<="9"))throw new Error(`Invalid number at position ${l}`);if(r="1"&&e[r]<="9")for(;r="0"&&e[r]<="9";)d+=e[r],r+=1;if(r="0"&&e[r]<="9";)d+=e[r],r+=1;if(r="0"&&e[r]<="9";)d+=e[r],r+=1;if(d==="-")return-0;let f=Number.parseFloat(d);if(Number.isNaN(f))throw r=l,new Error(`Invalid number '${d}' at position ${l}`);return f}function s(){if(n(),r>=e.length)throw new Error(`Unexpected end of input at position ${r}`);let l=e[r];if(l==="{")return c();if(l==="[")return a();if(l==='"')return o();if("null".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),null;if("true".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),!0;if("false".startsWith(e.substring(r,r+5)))return r+=Math.min(5,e.length-r),!1;if(l==="-"||l>="0"&&l<="9")return i();throw new Error(`Unexpected character '${l}' at position ${r}`)}function a(){if(e[r]!=="[")throw new Error(`Expected '[' at position ${r}, got '${e[r]}'`);let l=[];if(r+=1,n(),r>=e.length)return l;if(e[r]==="]")return r+=1,l;for(;r=e.length||(l.push(s()),n(),r>=e.length))return l;if(e[r]==="]")return r+=1,l;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or ']' at position ${r}, got '${e[r]}'`)}return l}function c(){if(e[r]!=="{")throw new Error(`Expected '{' at position ${r}, got '${e[r]}'`);let l={};if(r+=1,n(),r>=e.length)return l;if(e[r]==="}")return r+=1,l;for(;r=e.length)return l;let d=o();if(n(),r>=e.length)return l;if(e[r]!==":")throw new Error(`Expected ':' at position ${r}, got '${e[r]}'`);if(r+=1,n(),r>=e.length||(l[d]=s(),n(),r>=e.length))return l;if(e[r]==="}")return r+=1,l;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or '}' at position ${r}, got '${e[r]}'`)}return l}let u=s();if(n(),r"u"?null:CB(t)}catch{return null}}function Hw(t){switch(t){case"csv":return"text/csv";case"doc":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"html":return"text/html";case"md":return"text/markdown";case"pdf":return"application/pdf";case"txt":return"text/plain";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"gif":return"image/gif";case"jpeg":return"image/jpeg";case"jpg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"flv":return"video/flv";case"mkv":return"video/mkv";case"mov":return"video/mov";case"mp4":return"video/mp4";case"mpeg":return"video/mpeg";case"mpg":return"video/mpg";case"three_gp":return"video/three_gp";case"webm":return"video/webm";case"wmv":return"video/wmv";default:return"application/octet-stream"}}function RB(t){if(me(t.document)&&me(t.document.source)){let e=me(t.document)&&K(t.document.format)?t.document.format:"",r=Hw(e);if(me(t.document.source)){if(me(t.document.source.s3Location)&&K(t.document.source.s3Location.uri))return{type:"file",mimeType:r,fileId:t.document.source.s3Location.uri};if(th(t.document.source.bytes))return{type:"file",mimeType:r,data:t.document.source.bytes};if(K(t.document.source.text))return{type:"file",mimeType:r,data:Buffer.from(t.document.source.text).toString("base64")};if(Ar(t.document.source.content)){let n=t.document.source.content.reduce((o,i)=>me(i)&&K(i.text)?o+i.text:o,"");return{type:"file",mimeType:r,data:n}}}}return{type:"non_standard",value:t}}function NB(t){if(re(t,"image")&&me(t.image)){let e=me(t.image)&&K(t.image.format)?t.image.format:"",r=Hw(e);if(me(t.image.source)){if(me(t.image.source.s3Location)&&K(t.image.source.s3Location.uri))return{type:"image",mimeType:r,fileId:t.image.source.s3Location.uri};if(th(t.image.source.bytes))return{type:"image",mimeType:r,data:t.image.source.bytes}}}return{type:"non_standard",value:t}}function zB(t){if(re(t,"video")&&me(t.video)){let e=me(t.video)&&K(t.video.format)?t.video.format:"",r=Hw(e);if(me(t.video.source)){if(me(t.video.source.s3Location)&&K(t.video.source.s3Location.uri))return{type:"video",mimeType:r,fileId:t.video.source.s3Location.uri};if(th(t.video.source.bytes))return{type:"video",mimeType:r,data:t.video.source.bytes}}}return{type:"non_standard",value:t}}function oO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"cache_point")){yield{type:"non_standard",value:n};continue}else if(re(n,"citations_content")&&me(n.citationsContent)){let o=Ar(n.citationsContent.content)?n.citationsContent.content.reduce((s,a)=>me(a)&&K(a.text)?s+a.text:s,""):"",i=Ar(n.citationsContent.citations)?n.citationsContent.citations.reduce((s,a)=>{if(me(a)){let c=Ar(a.sourceContent)?a.sourceContent.reduce((l,d)=>me(d)&&K(d.text)?l+d.text:l,""):"",u=Ho(()=>{if(me(a.location)){let l=a.location.documentChar||a.location.documentPage||a.location.documentChunk;if(me(l))return{source:Xr(l.documentIndex)?l.documentIndex.toString():void 0,startIndex:Xr(l.start)?l.start:void 0,endIndex:Xr(l.end)?l.end:void 0}}return{}});s.push({type:"citation",citedText:c,...u})}return s},[]):[];yield{type:"text",text:o,annotations:i};continue}else if(re(n,"document")&&me(n.document)){yield RB(n);continue}else if(re(n,"guard_content")){yield{type:"non_standard",value:n};continue}else if(re(n,"image")&&me(n.image)){yield NB(n);continue}else if(re(n,"reasoning_content")&&K(n.reasoningText)){yield{type:"reasoning",reasoning:n.reasoningText};continue}else if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"tool_result")){yield{type:"non_standard",value:n};continue}else{if(re(n,"tool_call"))continue;if(re(n,"video")&&me(n.video)){yield zB(n);continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var iO={translateContent:oO,translateContentChunk:oO};function sO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"inlineData")&&me(n.inlineData)&&K(n.inlineData.mimeType)&&K(n.inlineData.data)){yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data};continue}else if(re(n,"functionCall")&&me(n.functionCall)&&K(n.functionCall.name)&&me(n.functionCall.args)){yield{type:"tool_call",id:t.id,name:n.functionCall.name,args:n.functionCall.args};continue}else if(re(n,"functionResponse")){yield{type:"non_standard",value:n};continue}else if(re(n,"fileData")&&me(n.fileData)&&K(n.fileData.mimeType)&&K(n.fileData.fileUri)){yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri};continue}else if(re(n,"executableCode")){yield{type:"non_standard",value:n};continue}else if(re(n,"codeExecutionResult")){yield{type:"non_standard",value:n};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var aO={translateContent:sO,translateContentChunk:sO};function cO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"reasoning")&&K(n.reasoning)){let o=Ho(()=>{let i=r.indexOf(n);if(Ar(t.additional_kwargs?.signatures)&&i>=0)return t.additional_kwargs.signatures.at(i)});K(o)?yield{type:"reasoning",reasoning:n.reasoning,signature:o}:yield{type:"reasoning",reasoning:n.reasoning};continue}else if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"image_url")){if(K(n.image_url))if(n.image_url.startsWith("data:")){let o=/^data:([^;]+);base64,(.+)$/,i=n.image_url.match(o);i?yield{type:"image",data:i[2],mimeType:i[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url};continue}else if(re(n,"media")&&K(n.mimeType)&&K(n.data)){yield{type:"file",mimeType:n.mimeType,data:n.data};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var uO={translateContent:cO,translateContentChunk:cO};globalThis.lc_block_translators_registry??=new Map([["anthropic",DA],["bedrock-converse",iO],["google-genai",aO],["google-vertexai",uO],["openai",ZA]]);function Ww(t){return globalThis.lc_block_translators_registry.get(t)}var jt=class extends qt{type="ai";tool_calls=[];invalid_tool_calls=[];usage_metadata;get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls"}}constructor(t){let e;if(typeof t=="string"||Array.isArray(t))e={content:t,tool_calls:[],invalid_tool_calls:[],additional_kwargs:{}};else{e=t;let r=e.additional_kwargs?.tool_calls,n=e.tool_calls;r!=null&&r.length>0&&(n===void 0||n.length===0)&&console.warn(["New LangChain packages are available that more efficiently handle",`tool calling. + +Please upgrade your packages to versions that set`,"message tool calls. e.g., `pnpm install @langchain/anthropic`,","pnpm install @langchain/openai`, etc."].join(" "));try{if(r!=null&&n===void 0){let[o,i]=Sd(r);e.tool_calls=o??[],e.invalid_tool_calls=i??[]}else e.tool_calls=e.tool_calls??[],e.invalid_tool_calls=e.invalid_tool_calls??[]}catch{e.tool_calls=[],e.invalid_tool_calls=[]}if(e.response_metadata!==void 0&&"output_version"in e.response_metadata&&e.response_metadata.output_version==="v1"&&(e.contentBlocks=e.content,e.content=void 0),e.contentBlocks!==void 0){e.contentBlocks.push(...e.tool_calls.map(i=>({type:"tool_call",id:i.id,name:i.name,args:i.args})));let o=e.contentBlocks.filter(i=>i.type==="tool_call").filter(i=>!e.tool_calls?.some(s=>s.id===i.id&&s.name===i.name));o.length>0&&(e.tool_calls=o.map(i=>({type:"tool_call",id:i.id,name:i.name,args:i.args})))}}super(e),typeof e!="string"&&(this.tool_calls=e.tool_calls??this.tool_calls,this.invalid_tool_calls=e.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=e.usage_metadata}static lc_name(){return"AIMessage"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let e=Ww(this.response_metadata.model_provider);if(e)return e.translateContent(this)}let t=super.contentBlocks;if(this.tool_calls){let e=this.tool_calls.filter(r=>!t.some(n=>n.id===r.id&&n.name===r.name));t.push(...e.map(r=>({...r,type:"tool_call",id:r.id,name:r.name,args:r.args})))}return t}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}static isInstance(t){return super.isInstance(t)&&t.type==="ai"}};function aa(t){return t._getType()==="ai"}function Td(t){return t._getType()==="ai"}var Dt=class extends fr{type="ai";tool_calls=[];invalid_tool_calls=[];tool_call_chunks=[];usage_metadata;constructor(t){let e;typeof t=="string"||Array.isArray(t)?e={content:t,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]}:t.tool_call_chunks===void 0||t.tool_call_chunks.length===0?e={...t,tool_calls:t.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:t.usage_metadata!==void 0?t.usage_metadata:void 0}:e={...t,...lh(t.tool_call_chunks??[]),usage_metadata:t.usage_metadata!==void 0?t.usage_metadata:void 0},super(e),this.tool_call_chunks=e.tool_call_chunks??this.tool_call_chunks,this.tool_calls=e.tool_calls??this.tool_calls,this.invalid_tool_calls=e.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=e.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks"}}static lc_name(){return"AIMessageChunk"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let e=Ww(this.response_metadata.model_provider);if(e)return e.translateContent(this)}let t=super.contentBlocks;if(this.tool_calls&&typeof this.content!="string"){let e=this.content.filter(r=>r.type==="tool_call").map(r=>r.id);for(let r of this.tool_calls)r.id&&!e.includes(r.id)&&t.push({...r,type:"tool_call",id:r.id,name:r.name,args:r.args})}return t}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(t){let e={content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:sh(this.response_metadata,t.response_metadata),tool_call_chunks:[],id:this.id??t.id};if(this.tool_call_chunks!==void 0||t.tool_call_chunks!==void 0){let n=ra(this.tool_call_chunks,t.tool_call_chunks);n!==void 0&&n.length>0&&(e.tool_call_chunks=n)}(this.usage_metadata!==void 0||t.usage_metadata!==void 0)&&(e.usage_metadata=ah(this.usage_metadata,t.usage_metadata));let r=this.constructor;return new r(e)}static isInstance(t){return super.isInstance(t)&&t.type==="ai"}};var Xw=t=>t();function MB(t){return Mi(t)?t:typeof t.id=="string"&&t.type==="function"&&typeof t.function=="object"&&t.function!==null&&"arguments"in t.function&&typeof t.function.arguments=="string"&&"name"in t.function&&typeof t.function.name=="string"?{id:t.id,args:JSON.parse(t.function.arguments),name:t.function.name,type:"tool_call"}:t}function jB(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function Jw(t){let e,r;if(jB(t)){let n=t.id.at(-1);n==="HumanMessage"||n==="HumanMessageChunk"?e="user":n==="AIMessage"||n==="AIMessageChunk"?e="assistant":n==="SystemMessage"||n==="SystemMessageChunk"?e="system":n==="FunctionMessage"||n==="FunctionMessageChunk"?e="function":n==="ToolMessage"||n==="ToolMessageChunk"?e="tool":e="unknown",r=t.kwargs}else{let{type:n,...o}=t;e=n,r=o}if(e==="human"||e==="user")return new mr(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new jt(r);let i=n.map(MB);return new jt({...o,tool_calls:i})}else{if(e==="system")return new hn(r);if(e==="developer")return new hn({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new Or({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});if(e==="remove"&&"id"in r&&typeof r.id=="string")return new ia({...r,id:r.id});throw uh(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported. + +Received: ${JSON.stringify(t,null,2)}`),"MESSAGE_COERCION_FAILURE")}}function ji(t){if(typeof t=="string")return new mr(t);if(Yr(t))return t;if(Array.isArray(t)){let[e,r]=t;return Jw({type:e,content:r})}else if(ih(t)){let{role:e,...r}=t;return Jw({...r,type:e})}else return Jw(t)}function au(t,e="Human",r="AI"){let n=[];for(let o of t){let i;if(o._getType()==="human")i=e;else if(o._getType()==="ai")i=r;else if(o._getType()==="system")i="System";else if(o._getType()==="tool")i="Tool";else if(o._getType()==="generic")i=o.role;else throw new Error(`Got unsupported message type: ${o._getType()}`);let s=o.name?`${o.name}, `:"",a=typeof o.content=="string"?o.content:JSON.stringify(o.content,null,2);n.push(`${i}: ${s}${a}`)}return n.join(` +`)}function DB(t){if(t.data!==void 0)return t;{let e=t;return{type:e.type,data:{content:e.text,role:e.role,name:void 0,tool_call_id:void 0}}}}function Ed(t){let e=DB(t);switch(e.type){case"human":return new mr(e.data);case"ai":return new jt(e.data);case"system":return new hn(e.data);case"function":if(e.data.name===void 0)throw new Error("Name must be defined for function messages");return new oa(e.data);case"tool":if(e.data.tool_call_id===void 0)throw new Error("Tool call ID must be defined for tool messages");return new Or(e.data);case"generic":if(e.data.role===void 0)throw new Error("Role must be defined for chat messages");return new jn(e.data);default:throw new Error(`Got unexpected type: ${e.type}`)}}function lO(t){return t.map(Ed)}function dO(t){return t.map(e=>e.toDict())}function ca(t){let e=t._getType();if(e==="human")return new zi({...t});if(e==="ai"){let r={...t};return"tool_calls"in r&&(r={...r,tool_call_chunks:r.tool_calls?.map(n=>({...n,type:"tool_call_chunk",index:void 0,args:JSON.stringify(n.args)}))}),new Dt({...r})}else{if(e==="system")return new lo({...t});if(e==="function")return new Ni({...t});if(jn.isInstance(t))return new Ri({...t});throw new Error("Unknown message type.")}}function lh(t){let e=t.reduce((o,i)=>{let s=o.findIndex(([a])=>"id"in i&&i.id&&"index"in i&&i.index!==void 0?i.id===a.id&&i.index===a.index:"id"in i&&i.id?i.id===a.id:"index"in i&&i.index!==void 0?i.index===a.index:!1);return s!==-1?o[s].push(i):o.push([i]),o},[]),r=[],n=[];for(let o of e){let i=null,s=o[0]?.name??"",a=o.map(l=>l.args||"").join("").trim(),c=a.length?a:"{}",u=o[0]?.id;try{if(i=sa(c),!u||i===null||typeof i!="object"||Array.isArray(i))throw new Error("Malformed tool call chunk args.");r.push({name:s,args:i,id:u,type:"tool_call"})}catch{n.push({name:s,args:c,id:u,error:"Malformed args.",type:"invalid_tool_call"})}}return{tool_call_chunks:t,tool_calls:r,invalid_tool_calls:n}}var pO=Symbol.for("ls:tracing_async_local_storage"),Di=Symbol.for("lc:context_variables"),fO=t=>{globalThis[pO]=t},Li=()=>globalThis[pO];var LB={};G(LB,{getEnv:()=>Qw,getEnvironmentVariable:()=>It,getRuntimeEnvironment:()=>ex,isBrowser:()=>mO,isDeno:()=>dh,isJsDom:()=>gO,isNode:()=>_O,isWebWorker:()=>hO});var mO=()=>typeof window<"u"&&typeof window.document<"u",hO=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",gO=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),dh=()=>typeof Deno<"u",_O=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!dh(),Qw=()=>{let t;return mO()?t="browser":_O()?t="node":hO()?t="webworker":gO()?t="jsdom":dh()?t="deno":t="other",t},Yw;function ex(){return Yw===void 0&&(Yw={library:"langchain-js",runtime:Qw()}),Yw}function It(t){try{return typeof process<"u"?process.env?.[t]:dh()?Deno?.env.get(t):void 0}catch{return}}var yO=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function UB(t){return typeof t=="string"&&yO.test(t)}var Ui=UB;function FB(t){if(!Ui(t))throw TypeError("Invalid UUID");let e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var vO=FB;var Vt=[];for(let t=0;t<256;++t)Vt.push((t+256).toString(16).slice(1));function cu(t,e=0){return(Vt[t[e+0]]+Vt[t[e+1]]+Vt[t[e+2]]+Vt[t[e+3]]+"-"+Vt[t[e+4]]+Vt[t[e+5]]+"-"+Vt[t[e+6]]+Vt[t[e+7]]+"-"+Vt[t[e+8]]+Vt[t[e+9]]+"-"+Vt[t[e+10]]+Vt[t[e+11]]+Vt[t[e+12]]+Vt[t[e+13]]+Vt[t[e+14]]+Vt[t[e+15]]).toLowerCase()}import BB from"node:crypto";var fh=new Uint8Array(256),ph=fh.length;function Ad(){return ph>fh.length-16&&(BB.randomFillSync(fh),ph=0),fh.slice(ph,ph+=16)}function ZB(t){t=unescape(encodeURIComponent(t));let e=[];for(let r=0;rDn&&t.msecs===void 0&&(Dn=s,a!==null&&(c=null,u=null)),a!==null&&(a>2147483647&&(a=2147483647),c=a>>>19&4095,u=a&524287),(c===null||u===null)&&(c=i[6]&127,c=c<<8|i[7],u=i[8]&63,u=u<<8|i[9],u=u<<5|i[10]>>>3),s+1e4>Dn&&a===null?++u>524287&&(u=0,++c>4095&&(c=0,Dn++)):Dn=s,xO=c,wO=u,o[n++]=Dn/1099511627776&255,o[n++]=Dn/4294967296&255,o[n++]=Dn/16777216&255,o[n++]=Dn/65536&255,o[n++]=Dn/256&255,o[n++]=Dn&255,o[n++]=c>>>4&15|112,o[n++]=c&255,o[n++]=u>>>13&63|128,o[n++]=u>>>5&255,o[n++]=u<<3&255|i[10]&7,o[n++]=i[11],o[n++]=i[12],o[n++]=i[13],o[n++]=i[14],o[n++]=i[15],e||cu(o)}var nx=XB;var YB={};G(YB,{BaseCallbackHandler:()=>la,callbackHandlerPrefersStreaming:()=>Od,isBaseCallbackHandler:()=>ox});var QB=class{};function Od(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var la=class extends QB{lc_serializable=!1;get lc_namespace(){return["langchain_core","callbacks",this.name]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eh(this.constructor)]}lc_kwargs;ignoreLLM=!1;ignoreChain=!1;ignoreAgent=!1;ignoreRetriever=!1;ignoreCustomEvent=!1;raiseError=!1;awaitHandlers=It("LANGCHAIN_CALLBACKS_BACKGROUND")==="false";constructor(t){super(),this.lc_kwargs=t||{},t&&(this.ignoreLLM=t.ignoreLLM??this.ignoreLLM,this.ignoreChain=t.ignoreChain??this.ignoreChain,this.ignoreAgent=t.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=t.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=t.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=t.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(t._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return uo.prototype.toJSON.call(this)}toJSONNotImplemented(){return uo.prototype.toJSONNotImplemented.call(this)}static fromMethods(t){class e extends la{name=Et();constructor(){super(),Object.assign(this,t)}}return new e}},ox=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"};var IO="gen_ai.operation.name",SO="gen_ai.system",ix="gen_ai.request.model",kO="gen_ai.response.model",sx="gen_ai.usage.input_tokens",ax="gen_ai.usage.output_tokens",cx="gen_ai.usage.total_tokens",TO="gen_ai.request.max_tokens",EO="gen_ai.request.temperature",AO="gen_ai.request.top_p",OO="gen_ai.request.frequency_penalty",PO="gen_ai.request.presence_penalty",CO="gen_ai.response.finish_reasons",RO="gen_ai.prompt",NO="gen_ai.completion",zO="gen_ai.request.extra_query",MO="gen_ai.request.extra_body",jO="gen_ai.serialized.name",DO="gen_ai.serialized.signature",LO="gen_ai.serialized.doc",UO="gen_ai.response.id",FO="gen_ai.response.service_tier",BO="gen_ai.response.system_fingerprint",ZO="gen_ai.usage.input_token_details",qO="gen_ai.usage.output_token_details",VO="langsmith.trace.session_id",GO="langsmith.trace.session_name",KO="langsmith.span.kind",HO="langsmith.trace.name",WO="langsmith.metadata",ux="langsmith.span.tags";var JO="langsmith.request.streaming",XO="langsmith.request.headers";var t6=(...t)=>fetch(...t),YO=Symbol.for("ls:fetch_implementation");var QO=()=>{let t=globalThis[YO];return t?typeof t=="function"&&"Headers"in t&&"Request"in t&&"Response"in t:!1},eP=t=>async(...e)=>{if(t||At("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[YO]??t6)(...e);return(t||At("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r};var Pd=()=>At("PROJECT")??Qr("LANGCHAIN_SESSION")??"default";var tP={};function uu(t){tP[t]||(console.warn(t),tP[t]=!0)}var r6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function $e(t,e){if(!r6.test(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}function mh(t){let e=typeof t=="string"?Date.parse(t):t;return nx({msecs:e,seq:0})}var hh="0.3.82";var po,n6=()=>typeof window<"u"&&typeof window.document<"u",o6=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",i6=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),rP=()=>typeof Deno<"u",s6=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!rP(),px=()=>po||(typeof Bun<"u"?po="bun":n6()?po="browser":s6()?po="node":o6()?po="webworker":i6()?po="jsdom":rP()?po="deno":po="other",po),lx;function gh(){if(lx===void 0){let t=px(),e=c6();lx={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:hh,...e}}return lx}function fx(){let t=a6(),e={},r=["LANGCHAIN_API_KEY","LANGCHAIN_ENDPOINT","LANGCHAIN_TRACING_V2","LANGCHAIN_PROJECT","LANGCHAIN_SESSION","LANGSMITH_API_KEY","LANGSMITH_ENDPOINT","LANGSMITH_TRACING_V2","LANGSMITH_PROJECT","LANGSMITH_SESSION"];for(let[n,o]of Object.entries(t))typeof o=="string"&&!r.includes(n)&&!n.toLowerCase().includes("key")&&!n.toLowerCase().includes("secret")&&!n.toLowerCase().includes("token")&&(n==="LANGCHAIN_REVISION_ID"?e.revision_id=o:e[n]=o);return e}function a6(){let t={};try{if(typeof process<"u"&&process.env)for(let[e,r]of Object.entries(process.env))(e.startsWith("LANGCHAIN_")||e.startsWith("LANGSMITH_"))&&r!=null&&((e.toLowerCase().includes("key")||e.toLowerCase().includes("secret")||e.toLowerCase().includes("token"))&&typeof r=="string"?t[e]=r.slice(0,2)+"*".repeat(r.length-4)+r.slice(-2):t[e]=r)}catch{}return t}function Qr(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function At(t){return Qr(`LANGSMITH_${t}`)||Qr(`LANGCHAIN_${t}`)}var dx;function c6(){if(dx!==void 0)return dx;let t=["VERCEL_GIT_COMMIT_SHA","NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA","COMMIT_REF","RENDER_GIT_COMMIT","CI_COMMIT_SHA","CIRCLE_SHA1","CF_PAGES_COMMIT_SHA","REACT_APP_GIT_SHA","SOURCE_VERSION","GITHUB_SHA","TRAVIS_COMMIT","GIT_COMMIT","BUILD_VCS_NUMBER","bamboo_planRepository_revision","Build.SourceVersion","BITBUCKET_COMMIT","DRONE_COMMIT_SHA","SEMAPHORE_GIT_SHA","BUILDKITE_COMMIT"],e={};for(let r of t){let n=Qr(r);n!==void 0&&(e[r]=n)}return dx=e,e}function _h(){return Qr("OTEL_ENABLED")==="true"||At("OTEL_ENABLED")==="true"}var gx=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&_h()&&(console.warn('You have enabled OTEL export via the `OTEL_ENABLED` or `LANGSMITH_OTEL_ENABLED` environment variable, but have not initialized the required OTEL instances. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0);let n;if(r.length===1&&typeof r[0]=="function"?n=r[0]:r.length===2&&typeof r[1]=="function"?n=r[1]:r.length===3&&typeof r[2]=="function"&&(n=r[2]),typeof n=="function")return n()}},_x=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new gx})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},yx=class{active(){return{}}with(e,r){return r()}},mx=Symbol.for("ls:otel_trace"),hx=Symbol.for("ls:otel_context"),nP=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),u6=new _x,l6=new yx,vx=class{getTraceInstance(){return globalThis[mx]??u6}getContextInstance(){return globalThis[hx]??l6}initializeGlobalInstances(e){globalThis[mx]===void 0&&(globalThis[mx]=e.trace),globalThis[hx]===void 0&&(globalThis[hx]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[nP]=e}getDefaultOTLPTracerComponents(){return globalThis[nP]??void 0}},bx=new vx;function yh(){return bx.getTraceInstance()}function oP(){return bx.getContextInstance()}function iP(){return bx.getDefaultOTLPTracerComponents()}var d6={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};function p6(t){return d6[t]||t}var vh=class{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(e,r){for(let n of e)try{if(!n.run)continue;if(n.operation==="post"){let o=this.createSpanForRun(n,n.run,r.get(n.id));o&&!n.run.end_time&&this.spans.set(n.id,o)}else this.updateSpanForRun(n,n.run)}catch(o){console.error(`Error processing operation ${n.id}:`,o)}}createSpanForRun(e,r,n){let o=n&&yh().getSpan(n);if(o)try{return this.finishSpanSetup(o,r,e)}catch(i){console.error(`Failed to create span for run ${e.id}:`,i);return}}finishSpanSetup(e,r,n){return this.setSpanAttributes(e,r,n),r.error?(e.setStatus({code:2}),e.recordException(new Error(r.error))):e.setStatus({code:1}),r.end_time&&e.end(new Date(r.end_time)),e}updateSpanForRun(e,r){try{let n=this.spans.get(e.id);if(!n){console.debug(`No span found for run ${e.id} during update`);return}this.setSpanAttributes(n,r,e),r.error?(n.setStatus({code:2}),n.recordException(new Error(r.error))):n.setStatus({code:1});let o=r.end_time;o&&(n.end(new Date(o)),this.spans.delete(e.id))}catch(n){console.error(`Failed to update span for run ${e.id}:`,n)}}extractModelName(e){if(e.extra?.metadata){let r=e.extra.metadata;if(r.ls_model_name)return r.ls_model_name;if(r.invocation_params){let n=r.invocation_params;if(n.model)return n.model;if(n.model_name)return n.model_name}}}setSpanAttributes(e,r,n){if("run_type"in r&&r.run_type){e.setAttribute(KO,r.run_type);let a=p6(r.run_type||"chain");e.setAttribute(IO,a)}"name"in r&&r.name&&e.setAttribute(HO,r.name),"session_id"in r&&r.session_id&&e.setAttribute(VO,r.session_id),"session_name"in r&&r.session_name&&e.setAttribute(GO,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute(ix,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute(sx,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(ax,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(cx,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[a,c]of Object.entries(i))c!=null&&e.setAttribute(`${WO}.${a}`,String(c));let s=r.tags;if(s&&Array.isArray(s)?e.setAttribute(ux,s.join(", ")):s&&e.setAttribute(ux,String(s)),"serialized"in r&&typeof r.serialized=="object"){let a=r.serialized;a.name&&e.setAttribute(jO,String(a.name)),a.signature&&e.setAttribute(DO,String(a.signature)),a.doc&&e.setAttribute(LO,String(a.doc))}this.setIOAttributes(e,n)}setGenAiSystem(e,r){let n="langchain",o=this.extractModelName(r);if(o){let i=o.toLowerCase();i.includes("anthropic")||i.startsWith("claude")?n="anthropic":i.includes("bedrock")?n="aws.bedrock":i.includes("azure")&&i.includes("openai")?n="az.ai.openai":i.includes("azure")&&i.includes("inference")?n="az.ai.inference":i.includes("cohere")?n="cohere":i.includes("deepseek")?n="deepseek":i.includes("gemini")?n="gemini":i.includes("groq")?n="groq":i.includes("watson")||i.includes("ibm")?n="ibm.watsonx.ai":i.includes("mistral")?n="mistral_ai":i.includes("gpt")||i.includes("openai")?n="openai":i.includes("perplexity")||i.includes("sonar")?n="perplexity":i.includes("vertex")?n="vertex_ai":(i.includes("xai")||i.includes("grok"))&&(n="xai")}e.setAttribute(SO,n)}setInvocationParameters(e,r){if(!r.extra?.metadata?.invocation_params)return;let n=r.extra.metadata.invocation_params;n.max_tokens!==void 0&&e.setAttribute(TO,n.max_tokens),n.temperature!==void 0&&e.setAttribute(EO,n.temperature),n.top_p!==void 0&&e.setAttribute(AO,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(OO,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute(PO,n.presence_penalty)}setIOAttributes(e,r){if(r.run.inputs)try{let n=r.run.inputs;typeof n=="object"&&n!==null&&(n.model&&Array.isArray(n.messages)&&e.setAttribute(ix,n.model),n.stream!==void 0&&e.setAttribute(JO,n.stream),n.extra_headers&&e.setAttribute(XO,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute(zO,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(MO,JSON.stringify(n.extra_body))),e.setAttribute(RO,JSON.stringify(n))}catch(n){console.debug(`Failed to process inputs for run ${r.id}`,n)}if(r.run.outputs)try{let n=r.run.outputs,o=this.getUnifiedRunTokens(n);if(o&&(e.setAttribute(sx,o[0]),e.setAttribute(ax,o[1]),e.setAttribute(cx,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(kO,String(n.model)),n.id&&e.setAttribute(UO,n.id),n.choices&&Array.isArray(n.choices)){let i=n.choices.map(s=>s.finish_reason).filter(s=>s).map(String);i.length>0&&e.setAttribute(CO,i.join(", "))}if(n.service_tier&&e.setAttribute(FO,n.service_tier),n.system_fingerprint&&e.setAttribute(BO,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let i=n.usage_metadata;i.input_token_details&&e.setAttribute(ZO,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(qO,JSON.stringify(i.output_token_details))}}e.setAttribute(NO,JSON.stringify(n))}catch(n){console.debug(`Failed to process outputs for run ${r.id}`,n)}}getUnifiedRunTokens(e){if(!e)return null;let r=this.extractUnifiedRunTokens(e.usage_metadata);if(r)return r;let n=Object.keys(e);for(let s of n){let a=e[s];if(!(!a||typeof a!="object")&&(r=this.extractUnifiedRunTokens(a.usage_metadata),r||a.lc===1&&a.kwargs&&typeof a.kwargs=="object"&&(r=this.extractUnifiedRunTokens(a.kwargs.usage_metadata),r)))return r}let o=e.generations||[];if(!Array.isArray(o))return null;let i=Array.isArray(o[0])?o.flat():o;for(let s of i)if(typeof s=="object"&&s.message&&typeof s.message=="object"&&s.message.kwargs&&typeof s.message.kwargs=="object"&&(r=this.extractUnifiedRunTokens(s.message.kwargs.usage_metadata),r))return r;return null}extractUnifiedRunTokens(e){return!e||typeof e!="object"||typeof e.input_tokens!="number"||typeof e.output_tokens!="number"?null:[e.input_tokens,e.output_tokens]}};var f6=Object.prototype.toString,m6=t=>f6.call(t)==="[object Error]",h6=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function wx(t){if(!(t&&m6(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:h6.has(r)}function g6(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function bh(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(_),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},_=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&_.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function $x(t,e={}){if(e={...e},g6(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,bh("factor",e.factor,{min:0,allowInfinity:!1}),bh("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),bh("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),bh("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await y6({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var kh=mn(Sh(),1),T6=[408,425,429,500,502,503,504],Rd=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxQueueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.maxQueueSizeBytes=e.maxQueueSizeBytes,"default"in kh.default?this.queue=new kh.default.default({concurrency:this.maxConcurrency}):this.queue=new kh.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){return this.callWithOptions({},e,...r)}callWithOptions(e,r,...n){let o=e.sizeBytes??0;if(this.maxQueueSizeBytes!==void 0&&o>0&&this.queueSizeBytes+o>this.maxQueueSizeBytes)return Promise.reject(new Error(`Queue size limit (${this.maxQueueSizeBytes} bytes) exceeded. Current queue size: ${this.queueSizeBytes} bytes, attempted addition: ${o} bytes.`));o>0&&(this.queueSizeBytes+=o);let i=this.onFailedResponseHook,s=this.queue.add(()=>$x(()=>r(...n).catch(a=>{throw a instanceof Error?a:new Error(a)}),{async onFailedAttempt({error:a}){if(a.message.startsWith("Cancel")||a.message.startsWith("TimeoutError")||a.name==="TimeoutError"||a.message.startsWith("AbortError")||a?.code==="ECONNABORTED")throw a;let c=a?.response;if(i&&await i(c))return;let u=c?.status??a?.status;if(u&&!T6.includes(+u))throw a},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0});return o>0&&(s=s.finally(()=>{this.queueSizeBytes-=o})),e.signal?Promise.race([s,new Promise((a,c)=>{e.signal?.addEventListener("abort",()=>{c(new Error("AbortError"))})})]):s}};function Ox(t){return typeof t?._getType=="function"}function Px(t){let e={type:t._getType(),data:{content:t.content}};return t?.additional_kwargs&&Object.keys(t.additional_kwargs).length>0&&(e.data.additional_kwargs={...t.additional_kwargs}),e}var $q=mn(oR(),1);function Wo(t){if(!t||t.split("/").length>2||t.startsWith("/")||t.endsWith("/")||t.split(":").length>2)throw new Error(`Invalid identifier format: ${t}`);let[e,r]=t.split(":"),n=r||"latest";if(e.includes("/")){let[o,i]=e.split("/",2);if(!o||!i)throw new Error(`Invalid identifier format: ${t}`);return[o,i,n]}else{if(!e)throw new Error(`Invalid identifier format: ${t}`);return["-",e,n]}}var Xx=class extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}};async function ue(t,e,r){let n;if(t.ok){r&&(n=await t.text());return}if(t.status===403)try{(await t.json())?.error==="org_scoped_key_requires_workspace"&&(n="This API key is org-scoped and requires workspace specification. Please provide 'workspaceId' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.")}catch{let a=new Error(`${t.status} ${t.statusText}`);throw a.status=t?.status,a}if(n===void 0)try{n=await t.text()}catch{n=""}let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Message: ${n}`;if(t.status===409)throw new Xx(o);let i=new Error(o);throw i.status=t.status,i}var iR="ERR_CONFLICTING_ENDPOINTS",Lh=class extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:iR}),this.name="ConflictingEndpointsError"}};function sR(t){return typeof t=="object"&&t!==null&&t.code===iR}var aR="[...]",Iq={result:"[Circular]"},Fh=[],du=[],Sq=new TextEncoder;function kq(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Uh(t){return Sq.encode(t)}function cR(t){if(t&&typeof t=="object"&&t!==null){if(t instanceof Map)return Object.fromEntries(t);if(t instanceof Set)return Array.from(t);if(t instanceof Date)return t.toISOString();if(t instanceof RegExp)return t.toString();if(t instanceof Error)return{name:t.name,message:t.message}}else if(typeof t=="bigint")return t.toString();return t}function Tq(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return cR(r)}}function Pr(t,e,r,n,o){try{let i=JSON.stringify(t,Tq(r),n);return Uh(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?` +Context: ${e}`:""}`),Uh("[Unserializable]");At("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?` +Context: ${e}`:""}`),typeof o>"u"&&(o=kq()),Qx(t,"",0,[],void 0,0,o);let s;try{du.length===0?s=JSON.stringify(t,r,n):s=JSON.stringify(t,Eq(r),n)}catch{return Uh("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Fh.length!==0;){let a=Fh.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return Uh(s)}}function Yx(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),Fh.push([n,r,e,o])):du.push([e,r,t]):(n[r]=t,Fh.push([n,r,e]))}function Qx(t,e,r,n,o,i,s){i+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;as.depthLimit){Yx(aR,t,e,o);return}if(typeof s.edgesLimit<"u"&&r+1>s.edgesLimit){Yx(aR,t,e,o);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n{let e=t?.toString()??At("TRACING_SAMPLING_RATE");if(e===void 0)return;let r=parseFloat(e);if(r<0||r>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${r}`);return r},Oq=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};async function Pq(t){let e=[];for await(let r of t)e.push(r);return e}function Bh(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}var Cq=async t=>{if(t?.status===429){let e=parseInt(t.headers.get("retry-after")??"10",10)*1e3;if(e>0)return await new Promise(r=>setTimeout(r,e)),!0}return!1};function lR(t){return typeof t=="number"?Number(t.toFixed(4)):t}var Rq=24*1024*1024,fR=1024*1024*1024,Nq=1e4,zq=100,dR="https://api.smith.langchain.com",e0=class{constructor(e){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSizeBytes=e??fR}peek(){return this.items[0]}push(e){let r,n=new Promise(i=>{r=i}),o=Pr(e.item,`Serializing run with id: ${e.item.id}`).length;return this.sizeBytes+o>this.maxSizeBytes&&this.items.length>0?(console.warn(`AutoBatchQueue size limit (${this.maxSizeBytes} bytes) exceeded. Dropping run with id: ${e.item.id}. Current queue size: ${this.sizeBytes} bytes, attempted addition: ${o} bytes.`),r(),n):(this.items.push({action:e.action,payload:e.item,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n)}pop({upToSizeBytes:e,upToSize:r}){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let n=[],o=0;for(;o+(this.peek()?.size??0)0&&n.length0){let i=this.items.shift();n.push(i),o+=i.size,this.sizeBytes-=i.size}return[n.map(i=>({action:i.action,item:i.payload,otelContext:i.otelContext,apiKey:i.apiKey,apiUrl:i.apiUrl,size:i.size})),()=>n.forEach(i=>i.itemPromiseResolve())]}},da=class t{get _fetch(){return this.fetchImplementation||eP(this.debug)}constructor(e={}){Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"webUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"workspaceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchIngestCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout_ms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tenantId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filteredPostUuids",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchAggregationDelayMs",{enumerable:!0,configurable:!0,writable:!0,value:250}),Object.defineProperty(this,"batchSizeBytesLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSizeLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"blockOnRootRunFinalization",{enumerable:!0,configurable:!0,writable:!0,value:Qr("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"langSmithToOTELTranslator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchImplementation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cachedLSEnvVarsForMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Qr("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=Aq(e.tracingSamplingRate),this.apiUrl=Bh(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=Bh(e.apiKey??r.apiKey),this.webUrl=Bh(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=Bh(e.workspaceId??At("WORKSPACE_ID")),this.timeout_ms=e.timeout_ms??9e4,this.caller=new Rd({...e.callerOptions??{},maxRetries:4,debug:e.debug??this.debug}),this.traceBatchConcurrency=e.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.debug=e.debug??this.debug,this.fetchImplementation=e.fetchImplementation;let n=e.maxIngestMemoryBytes??fR;this.batchIngestCaller=new Rd({maxRetries:4,maxConcurrency:this.traceBatchConcurrency,maxQueueSizeBytes:n,...e.callerOptions??{},onFailedResponseHook:Cq,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.autoBatchQueue=new e0(n),this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.batchSizeLimit=e.batchSizeLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode,_h()&&(this.langSmithToOTELTranslator=new vh),this.cachedLSEnvVarsForMetadata=fx()}static getDefaultClientConfig(){let e=At("API_KEY"),r=At("ENDPOINT")??dR,n=At("HIDE_INPUTS")==="true",o=At("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:Oq(this.apiUrl)?(this.webUrl="http://localhost:3000",this.webUrl):this.apiUrl.endsWith("/api/v1")?(this.webUrl=this.apiUrl.replace("/api/v1",""),this.webUrl):this.apiUrl.includes("/api")&&!this.apiUrl.split(".",1)[0].endsWith("api")?(this.webUrl=this.apiUrl.replace("/api",""),this.webUrl):this.apiUrl.split(".",1)[0].includes("dev")?(this.webUrl="https://dev.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("eu")?(this.webUrl="https://eu.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("beta")?(this.webUrl="https://beta.smith.langchain.com",this.webUrl):(this.webUrl="https://smith.langchain.com",this.webUrl)}get headers(){let e={"User-Agent":`langsmith-js/${hh}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),this.workspaceId&&(e["x-tenant-id"]=this.workspaceId),e}_getPlatformEndpointPath(e){return this.apiUrl.slice(-3)!=="/v1"&&this.apiUrl.slice(-4)!=="/v1/"?`/v1/platform/${e}`:`/platform/${e}`}async processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}async processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}async prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`;return await this.caller.call(async()=>{let s=await this._fetch(o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,`fetch ${e}`),s})}async _get(e,r){return(await this._getResponse(e,r)).json()}async*_getPaginated(e,r=new URLSearchParams,n){let o=Number(r.get("offset"))||0,i=Number(r.get("limit"))||100;for(;;){r.set("offset",String(o)),r.set("limit",String(i));let s=`${this.apiUrl}${e}?${r}`,a=await this.caller.call(async()=>{let u=await this._fetch(s,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(u,`fetch ${e}`),u}),c=n?n(await a.json()):await a.json();if(c.length===0||(yield c,c.length{let l=await this._fetch(`${this.apiUrl}${e}`,{method:n,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(l,`fetch ${e}`),l})).json();if(!c||!c[o])break;yield c[o];let u=c.cursors;if(!u||!u.next)break;i.cursor=u.next}}_shouldSample(){return this.tracingSampleRate===void 0?!0:Math.random()0;){let[o,i]=this.autoBatchQueue.pop({upToSizeBytes:e,upToSize:r});if(!o.length){i();break}let s=o.reduce((u,l)=>{let d=l.apiUrl??this.apiUrl,f=l.apiKey??this.apiKey,m=l.apiKey===this.apiKey&&l.apiUrl===this.apiUrl?"default":`${d}|${f}`;return u[m]||(u[m]=[]),u[m].push(l),u},{}),a=[];for(let[u,l]of Object.entries(s)){let d=this._processBatch(l,{apiUrl:u==="default"?void 0:u.split("|")[0],apiKey:u==="default"?void 0:u.split("|")[1]});a.push(d)}let c=Promise.all(a).finally(i);n.push(c)}return Promise.all(n)}async _processBatch(e,r){if(!e.length)return;let n=e.reduce((o,i)=>o+(i.size??0),0);try{if(this.langSmithToOTELTranslator!==void 0)this._sendBatchToOTELTranslator(e);else{let o={runCreates:e.filter(s=>s.action==="create").map(s=>s.item),runUpdates:e.filter(s=>s.action==="update").map(s=>s.item)},i=await this._ensureServerInfo();if(i?.batch_ingest_config?.use_multipart_endpoint){let s=i?.instance_flags?.gzip_body_enabled;await this.multipartIngestRuns(o,{...r,useGzip:s,sizeBytes:n})}else await this.batchIngestRuns(o,{...r,sizeBytes:n})}}catch(o){console.error("Error exporting batch:",o)}}_sendBatchToOTELTranslator(e){if(this.langSmithToOTELTranslator!==void 0){let r=new Map,n=[];for(let o of e)o.item.id&&o.otelContext&&(r.set(o.item.id,o.otelContext),o.action==="create"?n.push({operation:"post",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}):n.push({operation:"patch",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}));this.langSmithToOTELTranslator.exportBatch(n,r)}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.item=uR(e.item,this.cachedLSEnvVarsForMetadata);let r=this.autoBatchQueue.push(e);if(this.manualFlushMode)return r;let n=await this._getBatchSizeLimitBytes(),o=await this._getBatchSizeLimit();return(this.autoBatchQueue.sizeBytes>n||this.autoBatchQueue.items.length>o)&&this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o}),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o})},this.autoBatchAggregationDelayMs)),r}async _getServerInfo(){let r=await(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(Nq),...this.fetchOptions});return await ue(n,"get server info"),n})).json();return this.debug&&console.log(` +=== LangSmith Server Configuration === +`+JSON.stringify(r,null,2)+` +`),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch(e){console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${e.status??"Unspecified status code"} ${e.message}`)}return this._serverInfo??{}})()),this._getServerInfoPromise.then(e=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),e))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let e=await this._getBatchSizeLimitBytes(),r=await this._getBatchSizeLimit();await this.drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:r})}_cloneCurrentOTELContext(){let e=yh(),r=oP();if(this.langSmithToOTELTranslator!==void 0){let n=e.getActiveSpan();if(n)return e.setSpan(r.active(),n)}}async createRun(e,r){if(!this._filterForSampling([e]).length)return;let n={...this.headers,"Content-Type":"application/json"},o=e.project_name;delete e.project_name;let i=await this.prepareRunCreateOrUpdateInputs({session_name:o,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&i.trace_id!==void 0&&i.dotted_order!==void 0){let c=this._cloneCurrentOTELContext();this.processRunOperation({action:"create",item:i,otelContext:c,apiKey:r?.apiKey,apiUrl:r?.apiUrl}).catch(console.error);return}let s=uR(i,this.cachedLSEnvVarsForMetadata);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),r?.workspaceId!==void 0&&(n["x-tenant-id"]=r.workspaceId);let a=Pr(s,`Creating run with id: ${s.id}`);await this.caller.call(async()=>{let c=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"create run",!0),c})}async batchIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o=await Promise.all(e?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]),i=await Promise.all(r?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]);if(o.length>0&&i.length>0){let c=o.reduce((l,d)=>(d.id&&(l[d.id]=d),l),{}),u=[];for(let l of i)l.id!==void 0&&c[l.id]?c[l.id]={...c[l.id],...l}:u.push(l);o=Object.values(c),i=u}let s={post:o,patch:i};if(!s.post.length&&!s.patch.length)return;let a={post:[],patch:[]};for(let c of["post","patch"]){let u=c,l=s[u].reverse(),d=l.pop();for(;d!==void 0;)a[u].push(d),d=l.pop()}if(a.post.length>0||a.patch.length>0){let c=a.post.map(u=>u.id).concat(a.patch.map(u=>u.id)).join(",");await this._postBatchIngestRuns(Pr(a,`Ingesting runs with ids: ${c}`),n)}}async _postBatchIngestRuns(e,r){let n={...this.headers,"Content-Type":"application/json",Accept:"application/json"};r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),await this.batchIngestCaller.callWithOptions({sizeBytes:r?.sizeBytes},async()=>{let o=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:e});return await ue(o,"batch create run",!0),o})}async multipartIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o={},i=[];for(let d of e??[]){let f=await this.prepareRunCreateOrUpdateInputs(d);f.id!==void 0&&f.attachments!==void 0&&(o[f.id]=f.attachments),delete f.attachments,i.push(f)}let s=[];for(let d of r??[])s.push(await this.prepareRunCreateOrUpdateInputs(d));if(i.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(s.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(i.length>0&&s.length>0){let d=i.reduce((p,m)=>(m.id&&(p[m.id]=m),p),{}),f=[];for(let p of s)p.id!==void 0&&d[p.id]?d[p.id]={...d[p.id],...p}:f.push(p);i=Object.values(d),s=f}if(i.length===0&&s.length===0)return;let u=[],l=[];for(let[d,f]of[["post",i],["patch",s]])for(let p of f){let{inputs:m,outputs:h,events:_,extra:v,error:b,serialized:x,attachments:k,...T}=p,F={inputs:m,outputs:h,events:_,extra:v,error:b,serialized:x},J=Pr(T,`Serializing for multipart ingestion of run with id: ${T.id}`);l.push({name:`${d}.${T.id}`,payload:new Blob([J],{type:`application/json; length=${J.length}`})});for(let[w,Z]of Object.entries(F)){if(Z===void 0)continue;let oe=Pr(Z,`Serializing ${w} for multipart ingestion of run with id: ${T.id}`);l.push({name:`${d}.${T.id}.${w}`,payload:new Blob([oe],{type:`application/json; length=${oe.length}`})})}if(T.id!==void 0){let w=o[T.id];if(w){delete o[T.id];for(let[Z,oe]of Object.entries(w)){let Q,wt;if(Array.isArray(oe)?[Q,wt]=oe:(Q=oe.mimeType,wt=oe.data),Z.includes(".")){console.warn(`Skipping attachment '${Z}' for run ${T.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}l.push({name:`attachment.${T.id}.${Z}`,payload:new Blob([wt],{type:`${Q}; length=${wt.byteLength}`})})}}}u.push(`trace=${T.trace_id},id=${T.id}`)}await this._sendMultipartRequest(l,u.join("; "),n)}async _createNodeFetchBody(e,r){let n=[];for(let s of e)n.push(new Blob([`--${r}\r +`])),n.push(new Blob([`Content-Disposition: form-data; name="${s.name}"\r +`,`Content-Type: ${s.payload.type}\r +\r +`])),n.push(s.payload),n.push(new Blob([`\r +`]));return n.push(new Blob([`--${r}--\r +`])),await new Blob(n).arrayBuffer()}async _createMultipartStream(e,r){let n=new TextEncoder;return new ReadableStream({async start(i){let s=async a=>{typeof a=="string"?i.enqueue(n.encode(a)):i.enqueue(a)};for(let a of e){await s(`--${r}\r +`),await s(`Content-Disposition: form-data; name="${a.name}"\r +`),await s(`Content-Type: ${a.payload.type}\r +\r +`);let u=a.payload.stream().getReader();try{let l;for(;!(l=await u.read()).done;)i.enqueue(l.value)}finally{u.releaseLock()}await s(`\r +`)}await s(`--${r}--\r +`),i.close()}})}async _sendMultipartRequest(e,r,n){let o="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),i=QO(),s=()=>this._createNodeFetchBody(e,o),a=()=>this._createMultipartStream(e,o),c=async u=>this.batchIngestCaller.callWithOptions({sizeBytes:n?.sizeBytes},async()=>{let l=await u(),d={...this.headers,"Content-Type":`multipart/form-data; boundary=${o}`};n?.apiKey!==void 0&&(d["x-api-key"]=n.apiKey);let f=l;n?.useGzip&&typeof l=="object"&&"pipeThrough"in l&&(f=l.pipeThrough(new CompressionStream("gzip")),d["Content-Encoding"]="gzip");let p=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:d,body:f,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(p,"Failed to send multipart request",!0),p});try{let u,l=!1;!i&&!this.multipartStreamingDisabled&&px()!=="bun"?(l=!0,u=await c(a)):u=await c(s),(!this.multipartStreamingDisabled||l)&&u.status===422&&(n?.apiUrl??this.apiUrl)!==dR&&(console.warn(`Streaming multipart upload to ${n?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${r}".`),this.multipartStreamingDisabled=!0,u=await c(s))}catch(u){console.warn(`${u.message.trim()} + +Context: ${r}`)}}async updateRun(e,r,n){$e(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let o={...r,id:e};if(!this._filterForSampling([o],!0).length)return;if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){let a=this._cloneCurrentOTELContext();if(r.end_time!==void 0&&o.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}else this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}let i={...this.headers,"Content-Type":"application/json"};n?.apiKey!==void 0&&(i["x-api-key"]=n.apiKey),n?.workspaceId!==void 0&&(i["x-tenant-id"]=n.workspaceId);let s=Pr(r,`Serializing payload to update run with id: ${e}`);await this.caller.call(async()=>{let a=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(a,"update run",!0),a})}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){$e(e);let n=await this._get(`/runs/${e}`);return r&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:r,projectOpts:n}){if(r!==void 0){let o;r.session_id?o=r.session_id:n?.projectName?o=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?o=n?.projectId:o=(await this.readProject({projectName:At("PROJECT")||"default"})).id;let i=await this._getTenantId();return`${this.getHostUrl()}/o/${i}/projects/p/${o}/r/${r.id}?poll=true`}else if(e!==void 0){let o=await this.readRun(e);if(!o.app_path)throw new Error(`Run ${e} has no app_path`);return`${this.getHostUrl()}${o.app_path}`}else throw new Error("Must provide either runId or run")}async _loadChildRuns(e){let r=await Pq(this.listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),n={},o={};r.sort((i,s)=>(i?.dotted_order??"").localeCompare(s?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.dotted_order?.startsWith(e.dotted_order??"")&&i.id!==e.id&&(i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i)}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:s,startTime:a,executionOrder:c,isRoot:u,runType:l,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:_,limit:v,select:b,order:x}=e,k=[];if(r&&(k=Array.isArray(r)?r:[r]),n){let w=Array.isArray(n)?n:[n],Z=await Promise.all(w.map(oe=>this.readProject({projectName:oe}).then(Q=>Q.id)));k.push(...Z)}let T=["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],F={session:k.length?k:null,run_type:l,reference_example:s,query:p,filter:m,trace_filter:h,tree_filter:_,execution_order:c,parent_run:o,start_time:a?a.toISOString():null,error:d,id:f,limit:v,trace:i,select:b||T,is_root:u,order:x};F.select.includes("child_run_ids")&&uu("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let J=0;for await(let w of this._getCursorPaginatedList("/runs/query",F))if(v){if(J>=v)break;if(w.length+J>v){yield*w.slice(0,v-J);break}J+=w.length,yield*w}else yield*w}async*listGroupRuns(e){let{projectId:r,projectName:n,groupBy:o,filter:i,startTime:s,endTime:a,limit:c,offset:u}=e,d={session_id:r||(await this.readProject({projectName:n})).id,group_by:o,filter:i,start_time:s?s.toISOString():null,end_time:a?a.toISOString():null,limit:Number(c)||100},f=Number(u)||0,p="/runs/group",m=`${this.apiUrl}${p}`;for(;;){let h={...d,offset:f},_=Object.fromEntries(Object.entries(h).filter(([F,J])=>J!==void 0)),v=JSON.stringify(_),x=await(await this.caller.call(async()=>{let F=await this._fetch(m,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:v});return await ue(F,`Failed to fetch ${p}`),F})).json(),{groups:k,total:T}=x;if(k.length===0)break;for(let F of k)yield F;if(f+=k.length,f>=T)break}}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:s,referenceExampleIds:a,startTime:c,endTime:u,error:l,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:_}){let v=s||[];i&&(v=[...s||[],...await Promise.all(i.map(J=>this.readProject({projectName:J}).then(w=>w.id)))]);let x=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:v,reference_example:a,start_time:c,end_time:u,error:l,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:_}).filter(([J,w])=>w!==void 0)),k=JSON.stringify(x);return await(await this.caller.call(async()=>{let J=await this._fetch(`${this.apiUrl}/runs/stats`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:k});return await ue(J,"get run stats"),J})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||Et()};$e(e);let o=JSON.stringify(n),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ue(a,"share run"),a})).json();if(s===null||!("share_token"in s))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${s.share_token}/r`}async unshareRun(e){$e(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"unshare run",!0),r})}async readRunSharedLink(e){$e(e);let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"read run shared link"),o})).json();if(!(n===null||!("share_token"in n)))return`${this.getHostUrl()}/public/${n.share_token}/r`}async listSharedRuns(e,{runIds:r}={}){let n=new URLSearchParams({share_token:e});if(r!==void 0)for(let s of r)n.append("id",s);return $e(e),await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"list shared runs"),s})).json()}async readDatasetSharedSchema(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id),$e(e);let o=await(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,"read dataset shared schema"),i})).json();return o.url=`${this.getHostUrl()}/public/${o.share_token}/d`,o}async shareDataset(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id);let n={dataset_id:e};$e(e);let o=JSON.stringify(n),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ue(a,"share dataset"),a})).json();return s.url=`${this.getHostUrl()}/public/${s.share_token}/d`,s}async unshareDataset(e){$e(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"unshare dataset",!0),r})}async readSharedDataset(e){return $e(e),await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"read shared dataset"),o})).json()}async listSharedExamples(e,r){let n={};r?.exampleIds&&(n.id=r.exampleIds);let o=new URLSearchParams;Object.entries(n).forEach(([a,c])=>{Array.isArray(c)?c.forEach(u=>o.append(a,u)):o.append(a,c)});let i=await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/public/${e}/examples?${o.toString()}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(a,"list shared examples"),a}),s=await i.json();if(!i.ok)throw"detail"in s?new Error(`Failed to list shared examples. +Status: ${i.status} +Message: ${Array.isArray(s.detail)?s.detail.join(` +`):"Unspecified error"}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return s.map(a=>({...a,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:r=null,metadata:n=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:s=null}){let a=o?"?upsert=true":"",c=`${this.apiUrl}/sessions${a}`,u=i||{};n&&(u.metadata=n);let l={name:e,extra:u,description:r};s!==null&&(l.reference_dataset_id=s);let d=JSON.stringify(l);return await(await this.caller.call(async()=>{let m=await this._fetch(c,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:d});return await ue(m,"create project"),m})).json()}async updateProject(e,{name:r=null,description:n=null,metadata:o=null,projectExtra:i=null,endTime:s=null}){let a=`${this.apiUrl}/sessions/${e}`,c=i;o&&(c={...c||{},metadata:o});let u=JSON.stringify({name:r,extra:c,description:n,end_time:s?new Date(s).toISOString():null});return await(await this.caller.call(async()=>{let f=await this._fetch(a,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"update project"),f})).json()}async hasProject({projectId:e,projectName:r}){let n="/sessions",o=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)$e(e),n+=`/${e}`;else if(r!==void 0)o.append("name",r);else throw new Error("Must provide projectName or projectId");let i=await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${n}?${o}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"has project"),s});try{let s=await i.json();return i.ok?Array.isArray(s)?s.length>0:!0:!1}catch{return!1}}async readProject({projectId:e,projectName:r,includeStats:n}){let o="/sessions",i=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)$e(e),o+=`/${e}`;else if(r!==void 0)i.append("name",r);else throw new Error("Must provide projectName or projectId");n!==void 0&&i.append("include_stats",n.toString());let s=await this._get(o,i),a;if(Array.isArray(s)){if(s.length===0)throw new Error(`Project[id=${e}, name=${r}] not found`);a=s[0]}else a=s;return a}async getProjectUrl({projectId:e,projectName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either projectName or projectId");let n=await this.readProject({projectId:e,projectName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/projects/p/${n.id}`}async getDatasetUrl({datasetId:e,datasetName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");let n=await this.readDataset({datasetId:e,datasetName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/datasets/${n.id}`}async _getTenantId(){if(this._tenantId!==null)return this._tenantId;let e=new URLSearchParams({limit:"1"});for await(let r of this._getPaginated("/sessions",e))return this._tenantId=r[0].tenant_id,r[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:e,name:r,nameContains:n,referenceDatasetId:o,referenceDatasetName:i,includeStats:s,datasetVersion:a,referenceFree:c,metadata:u}={}){let l=new URLSearchParams;if(e!==void 0)for(let d of e)l.append("id",d);if(r!==void 0&&l.append("name",r),n!==void 0&&l.append("name_contains",n),o!==void 0)l.append("reference_dataset",o);else if(i!==void 0){let d=await this.readDataset({datasetName:i});l.append("reference_dataset",d.id)}s!==void 0&&l.append("include_stats",s.toString()),a!==void 0&&l.append("dataset_version",a),c!==void 0&&l.append("reference_free",c.toString()),u!==void 0&&l.append("metadata",JSON.stringify(u));for await(let d of this._getPaginated("/sessions",l))yield*d}async deleteProject({projectId:e,projectName:r}){let n;if(e===void 0&&r===void 0)throw new Error("Must provide projectName or projectId");if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");e===void 0?n=(await this.readProject({projectName:r})).id:n=e,$e(n),await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,`delete session ${n} (${r})`,!0),o})}async uploadCsv({csvFile:e,fileName:r,inputKeys:n,outputKeys:o,description:i,dataType:s,name:a}){let c=`${this.apiUrl}/datasets/upload`,u=new FormData;return u.append("file",e,r),n.forEach(f=>{u.append("input_keys",f)}),o.forEach(f=>{u.append("output_keys",f)}),i&&u.append("description",i),s&&u.append("data_type",s),a&&u.append("name",a),await(await this.caller.call(async()=>{let f=await this._fetch(c,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"upload CSV"),f})).json()}async createDataset(e,{description:r,dataType:n,inputsSchema:o,outputsSchema:i,metadata:s}={}){let a={name:e,description:r,extra:s?{metadata:s}:void 0};n&&(a.data_type=n),o&&(a.inputs_schema_definition=o),i&&(a.outputs_schema_definition=i);let c=JSON.stringify(a);return await(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(d,"create dataset"),d})).json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e&&r)throw new Error("Must provide either datasetName or datasetId, not both");if(e)$e(e),n+=`/${e}`;else if(r)o.append("name",r);else throw new Error("Must provide datasetName or datasetId");let i=await this._get(n,o),s;if(Array.isArray(i)){if(i.length===0)throw new Error(`Dataset[id=${e}, name=${r}] not found`);s=i[0]}else s=i;return s}async hasDataset({datasetId:e,datasetName:r}){try{return await this.readDataset({datasetId:e,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:r,fromVersion:n,toVersion:o}){let i=e;if(i===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:r})).id);let s=new URLSearchParams({from_version:typeof n=="string"?n:n.toISOString(),to_version:typeof o=="string"?o:o.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,s)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:r}){let n="/datasets";if(e===void 0)if(r!==void 0)e=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide either datasetName or datasetId");return(await(await this._getResponse(`${n}/${e}/openai_ft`)).text()).trim().split(` +`).map(a=>JSON.parse(a))}async*listDatasets({limit:e=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:s}={}){let a="/datasets",c=new URLSearchParams({limit:e.toString(),offset:r.toString()});if(n!==void 0)for(let u of n)c.append("id",u);o!==void 0&&c.append("name",o),i!==void 0&&c.append("name_contains",i),s!==void 0&&c.append("metadata",JSON.stringify(s));for await(let u of this._getPaginated(a,c))yield*u}async updateDataset(e){let{datasetId:r,datasetName:n,...o}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;$e(i);let s=JSON.stringify(o);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${i}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"update dataset"),c})).json()}async updateDatasetTag(e){let{datasetId:r,datasetName:n,asOf:o,tag:i}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let s=r??(await this.readDataset({datasetName:n})).id;$e(s);let a=JSON.stringify({as_of:typeof o=="string"?o:o.toISOString(),tag:i});await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${s}/tags`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"update dataset tags",!0),c})}async deleteDataset({datasetId:e,datasetName:r}){let n="/datasets",o=e;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(r!==void 0&&(o=(await this.readDataset({datasetName:r})).id),o!==void 0)$e(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");await this.caller.call(async()=>{let i=await this._fetch(this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,`delete ${n}`,!0),i})}async indexDataset({datasetId:e,datasetName:r,tag:n}){let o=e;if(!o&&!r)throw new Error("Must provide either datasetName or datasetId");if(o&&r)throw new Error("Must provide either datasetName or datasetId, not both");o||(o=(await this.readDataset({datasetName:r})).id),$e(o);let s=JSON.stringify({tag:n});await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${o}/index`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"index dataset"),c})).json()}async similarExamples(e,r,n,{filter:o}={}){let i={limit:n,inputs:e};o!==void 0&&(i.filter=o),$e(r);let s=JSON.stringify(i);return(await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${r}/search`,{headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,method:"POST",body:s});return await ue(u,"fetch similar examples"),u})).json()).examples}async createExample(e,r,n){if(pR(e)&&(r!==void 0||n!==void 0))throw new Error("Cannot provide outputs or options when using ExampleCreate object");let o=r?n?.datasetId:e.dataset_id,i=r?n?.datasetName:e.dataset_name;if(o===void 0&&i===void 0)throw new Error("Must provide either datasetName or datasetId");if(o!==void 0&&i!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");o===void 0&&(o=(await this.readDataset({datasetName:i})).id);let s=(r?n?.createdAt:e.created_at)||new Date,a;pR(e)?a=e:a={inputs:e,outputs:r,created_at:s?.toISOString(),id:n?.exampleId,metadata:n?.metadata,split:n?.split,source_run_id:n?.sourceRunId,use_source_run_io:n?.useSourceRunIO,use_source_run_attachments:n?.useSourceRunAttachments,attachments:n?.attachments};let c=await this._uploadExamplesMultipart(o,[a]);return await this.readExample(c.example_ids?.[0]??Et())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let b=e,x=b[0].dataset_id,k=b[0].dataset_name;if(x===void 0&&k===void 0)throw new Error("Must provide either datasetName or datasetId");if(x!==void 0&&k!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");x===void 0&&(x=(await this.readDataset({datasetName:k})).id);let T=await this._uploadExamplesMultipart(x,b);return await Promise.all(T.example_ids.map(J=>this.readExample(J)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:s,useSourceRunIOs:a,useSourceRunAttachments:c,attachments:u,exampleIds:l,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((b,x)=>({dataset_id:p,inputs:b,outputs:n?.[x],metadata:o?.[x],split:i?.[x],id:l?.[x],attachments:u?.[x],source_run_id:s?.[x],use_source_run_io:a?.[x],use_source_run_attachments:c?.[x]})),_=await this._uploadExamplesMultipart(p,h);return await Promise.all(_.example_ids.map(b=>this.readExample(b)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(s=>Ox(s)?Px(s):s),i=Ox(r)?Px(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){$e(e);let r=`/examples/${e}`,n=await this._get(r),{attachment_urls:o,...i}=n,s=i;return o&&(s.attachments=Object.entries(o).reduce((a,[c,u])=>(a[c.slice(11)]={presigned_url:u.presigned_url,mime_type:u.mime_type},a),{})),s}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:s,metadata:a,limit:c,offset:u,filter:l,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=o?typeof o=="string"?o:o?.toISOString():void 0;m&&p.append("as_of",m);let h=s??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let v of n)p.append("id",v);if(i!==void 0)for(let v of i)p.append("splits",v);if(a!==void 0){let v=JSON.stringify(a);p.append("metadata",v)}c!==void 0&&p.append("limit",c.toString()),u!==void 0&&p.append("offset",u.toString()),l!==void 0&&p.append("filter",l),d===!0&&["attachment_urls","outputs","metadata"].forEach(v=>p.append("select",v));let _=0;for await(let v of this._getPaginated("/examples",p)){for(let b of v){let{attachment_urls:x,...k}=b,T=k;x&&(T.attachments=Object.entries(x).reduce((F,[J,w])=>(F[J.slice(11)]={presigned_url:w.presigned_url,mime_type:w.mime_type||void 0},F),{})),yield T,_++}if(c!==void 0&&_>=c)break}}async deleteExample(e){$e(e);let r=`/examples/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,`delete ${r}`,!0),n})}async updateExample(e,r){let n;r?n=e:n=e.id,$e(n);let o;r?o={id:n,...r}:o=e;let i;return o.dataset_id!==void 0?i=o.dataset_id:i=(await this.readExample(n)).dataset_id,this._updateExamplesMultipart(i,[o])}async updateExamples(e){let r;return e[0].dataset_id===void 0?r=(await this.readExample(e[0].id)).dataset_id:r=e[0].dataset_id,this._updateExamplesMultipart(r,e)}async readDatasetVersion({datasetId:e,datasetName:r,asOf:n,tag:o}){let i;if(e?i=e:i=(await this.readDataset({datasetName:r})).id,$e(i),n&&o||!n&&!o)throw new Error("Exactly one of asOf and tag must be specified.");let s=new URLSearchParams;return n!==void 0&&s.append("as_of",typeof n=="string"?n:n.toISOString()),o!==void 0&&s.append("tag",o),await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${i}/version?${s.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(c,"read dataset version"),c})).json()}async listDatasetSplits({datasetId:e,datasetName:r,asOf:n}){let o;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?o=(await this.readDataset({datasetName:r})).id:o=e,$e(o);let i=new URLSearchParams,s=n?typeof n=="string"?n:n?.toISOString():void 0;return s&&i.append("as_of",s),await this._get(`/datasets/${o}/splits`,i)}async updateDatasetSplits({datasetId:e,datasetName:r,splitName:n,exampleIds:o,remove:i=!1}){let s;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?s=(await this.readDataset({datasetName:r})).id:s=e,$e(s);let a={split_name:n,examples:o.map(u=>($e(u),u)),remove:i},c=JSON.stringify(a);await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${s}/splits`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(u,"update dataset splits",!0),u})}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){uu("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let s;if(typeof e=="string")s=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)s=e;else throw new Error(`Invalid run type: ${typeof e}`);s.reference_example_id!==null&&s.reference_example_id!==void 0&&(i=await this.readExample(s.reference_example_id));let a=await r.evaluateRun(s,i),[c,u]=await this._logEvaluationFeedback(a,s,n);return u[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:s,sourceInfo:a,feedbackSourceType:c="api",sourceRunId:u,feedbackId:l,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:c??"api",metadata:a??{}};u!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:u}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&$e(m.metadata.__run.run_id);let h={id:l??Et(),run_id:e,key:r,score:lR(n),value:o,correction:i,comment:s,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},_=JSON.stringify(h),v=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{let b=await this._fetch(v,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:_});return await ue(b,"create feedback",!0),b}),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let s={};r!=null&&(s.score=lR(r)),n!=null&&(s.value=n),o!=null&&(s.correction=o),i!=null&&(s.comment=i),$e(e);let a=JSON.stringify(s);await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"update feedback",!0),c})}async readFeedback(e){$e(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){$e(e);let r=`/feedback/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,`delete ${r}`,!0),n})}async*listFeedback({runIds:e,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(e)for(let i of e)$e(i),o.append("run",i);if(r)for(let i of r)o.append("key",i);if(n)for(let i of n)o.append("source",i);for await(let i of this._getPaginated("/feedback",o))yield*i}async createPresignedFeedbackToken(e,r,{expiration:n,feedbackConfig:o}={}){let i={run_id:e,feedback_key:r,feedback_config:o};n?typeof n=="string"?i.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(i.expires_in=n):i.expires_in={hours:3};let s=JSON.stringify(i);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"create presigned feedback token"),c})).json()}async createComparativeExperiment({name:e,experimentIds:r,referenceDatasetId:n,createdAt:o,description:i,metadata:s,id:a}){if(r.length===0)throw new Error("At least one experiment is required");if(n||(n=(await this.readProject({projectId:r[0]})).reference_dataset_id),!n==null)throw new Error("A reference dataset is required");let c={id:a,name:e,experiment_ids:r,reference_dataset_id:n,description:i,created_at:(o??new Date)?.toISOString(),extra:{}};s&&(c.extra.metadata=s);let u=JSON.stringify(c);return(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(d,"create comparative experiment"),d})).json()}async*listPresignedFeedbackTokens(e){$e(e);let r=new URLSearchParams({run_id:e});for await(let n of this._getPaginated("/feedback/tokens",r))yield*n}_selectEvalResults(e){let r;return"results"in e?r=e.results:Array.isArray(e)?r=e:r=[e],r}async _logEvaluationFeedback(e,r,n){let o=this._selectEvalResults(e),i=[];for(let s of o){let a=n||{};s.evaluatorInfo&&(a={...s.evaluatorInfo,...a});let c=null;s.targetRunId?c=s.targetRunId:r&&(c=r.id),i.push(await this.createFeedback(c,s.key,{score:s.score,value:s.value,comment:s.comment,correction:s.correction,sourceInfo:a,sourceRunId:s.sourceRunId,feedbackConfig:s.feedbackConfig,feedbackSourceType:"model"}))}return[o,i]}async logEvaluationFeedback(e,r,n){let[o]=await this._logEvaluationFeedback(e,r,n);return o}async*listAnnotationQueues(e={}){let{queueIds:r,name:n,nameContains:o,limit:i}=e,s=new URLSearchParams;r&&r.forEach((c,u)=>{$e(c,`queueIds[${u}]`),s.append("ids",c)}),n&&s.append("name",n),o&&s.append("name_contains",o),s.append("limit",(i!==void 0?Math.min(i,100):100).toString());let a=0;for await(let c of this._getPaginated("/annotation-queues",s))if(yield*c,a++,i!==void 0&&a>=i)break}async createAnnotationQueue(e){let{name:r,description:n,queueId:o,rubricInstructions:i}=e,s={name:r,description:n,id:o||Et(),rubric_instructions:i},a=JSON.stringify(Object.fromEntries(Object.entries(s).filter(([u,l])=>l!==void 0)));return(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(u,"create annotation queue"),u})).json()}async readAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"read annotation queue"),n})).json()}async updateAnnotationQueue(e,r){let{name:n,description:o,rubricInstructions:i}=r,s=JSON.stringify({name:n,description:o,rubric_instructions:i});await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(a,"update annotation queue",!0),a})}async deleteAnnotationQueue(e){await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"delete annotation queue",!0),r})}async addRunsToAnnotationQueue(e,r){let n=JSON.stringify(r.map((o,i)=>$e(o,`runIds[${i}]`).toString()));await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(o,"add runs to annotation queue",!0),o})}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${$e(e,"queueId")}/run`;return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,"get run from annotation queue"),i})).json()}async deleteRunFromAnnotationQueue(e,r){await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/runs/${$e(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"delete run from annotation queue",!0),n})}async getSizeFromAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"get size from annotation queue"),n})).json()}async _currentTenantIsOwner(e){let r=await this._getSettings();return e=="-"||r.tenant_handle===e}async _ownerConflictError(e,r){let n=await this._getSettings();return new Error(`Cannot ${e} for another tenant. + + Current tenant: ${n.tenant_handle} + + Requested tenant: ${r}`)}async _getLatestCommitHash(e){let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/commits/${e}/?limit=1&offset=0`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"get latest commit hash"),o})).json();if(n.commits.length!==0)return n.commits[0].commit_hash}async _likeOrUnlikePrompt(e,r){let[n,o,i]=Wo(e),s=JSON.stringify({like:r});return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/likes/${n}/${o}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,`${r?"like":"unlike"} prompt`),c})).json()}async _getPromptUrl(e){let[r,n,o]=Wo(e);if(await this._currentTenantIsOwner(r)){let i=await this._getSettings();return o!=="latest"?`${this.getHostUrl()}/prompts/${n}/${o.substring(0,8)}?organizationId=${i.id}`:`${this.getHostUrl()}/prompts/${n}?organizationId=${i.id}`}else return o!=="latest"?`${this.getHostUrl()}/hub/${r}/${n}/${o.substring(0,8)}`:`${this.getHostUrl()}/hub/${r}/${n}`}async promptExists(e){return!!await this.getPrompt(e)}async likePrompt(e){return this._likeOrUnlikePrompt(e,!0)}async unlikePrompt(e){return this._likeOrUnlikePrompt(e,!1)}async*listCommits(e){for await(let r of this._getPaginated(`/commits/${e}/`,new URLSearchParams,n=>n.commits))yield*r}async*listPrompts(e){let r=new URLSearchParams;r.append("sort_field",e?.sortField??"updated_at"),r.append("sort_direction","desc"),r.append("is_archived",(!!e?.isArchived).toString()),e?.isPublic!==void 0&&r.append("is_public",e.isPublic.toString()),e?.query&&r.append("query",e.query);for await(let n of this._getPaginated("/repos",r,o=>o.repos))yield*n}async getPrompt(e){let[r,n,o]=Wo(e),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return a?.status===404?null:(await ue(a,"get prompt"),a)}))?.json();return s?.repo?s.repo:null}async createPrompt(e,r){let n=await this._getSettings();if(r?.isPublic&&!n.tenant_handle)throw new Error(`Cannot create a public prompt without first + + creating a LangChain Hub handle. + You can add a handle by creating a public prompt at: + + https://smith.langchain.com/prompts`);let[o,i,s]=Wo(e);if(!await this._currentTenantIsOwner(o))throw await this._ownerConflictError("create a prompt",o);let a={repo_handle:i,...r?.description&&{description:r.description},...r?.readme&&{readme:r.readme},...r?.tags&&{tags:r.tags},is_public:!!r?.isPublic},c=JSON.stringify(a),u=await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(d,"create prompt"),d}),{repo:l}=await u.json();return l}async createCommit(e,r,n){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[o,i,s]=Wo(e),a=n?.parentCommitHash==="latest"||!n?.parentCommitHash?await this._getLatestCommitHash(`${o}/${i}`):n?.parentCommitHash,c={manifest:JSON.parse(JSON.stringify(r)),parent_commit:a},u=JSON.stringify(c),d=await(await this.caller.call(async()=>{let f=await this._fetch(`${this.apiUrl}/commits/${o}/${i}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"create commit"),f})).json();return this._getPromptUrl(`${o}/${i}${d.commit_hash?`:${d.commit_hash}`:""}`)}async updateExamplesMultipart(e,r=[]){return this._updateExamplesMultipart(e,r)}async _updateExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let s of r){let a=s.id,c={...s.metadata&&{metadata:s.metadata},...s.split&&{split:s.split}},u=Pr(c,`Serializing body for example with id: ${a}`),l=new Blob([u],{type:"application/json"});if(n.append(a,l),s.inputs){let d=Pr(s.inputs,`Serializing inputs for example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.inputs`,f)}if(s.outputs){let d=Pr(s.outputs,`Serializing outputs whle updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.outputs`,f)}if(s.attachments)for(let[d,f]of Object.entries(s.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${a}.attachment.${d}`,h)}if(s.attachments_operations){let d=Pr(s.attachments_operations,`Serializing attachments while updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.attachments_operations`,f)}}let o=e??r[0]?.dataset_id;return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${o}/examples`)}`,{method:"PATCH",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(s,"update examples"),s})).json()}async uploadExamplesMultipart(e,r=[]){return this._uploadExamplesMultipart(e,r)}async _uploadExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let i of r){let s=(i.id??Et()).toString(),a={created_at:i.created_at,...i.metadata&&{metadata:i.metadata},...i.split&&{split:i.split},...i.source_run_id&&{source_run_id:i.source_run_id},...i.use_source_run_io&&{use_source_run_io:i.use_source_run_io},...i.use_source_run_attachments&&{use_source_run_attachments:i.use_source_run_attachments}},c=Pr(a,`Serializing body for uploaded example with id: ${s}`),u=new Blob([c],{type:"application/json"});if(n.append(s,u),i.inputs){let l=Pr(i.inputs,`Serializing inputs for uploaded example with id: ${s}`),d=new Blob([l],{type:"application/json"});n.append(`${s}.inputs`,d)}if(i.outputs){let l=Pr(i.outputs,`Serializing outputs for uploaded example with id: ${s}`),d=new Blob([l],{type:"application/json"});n.append(`${s}.outputs`,d)}if(i.attachments)for(let[l,d]of Object.entries(i.attachments)){let f,p;Array.isArray(d)?[f,p]=d:(f=d.mimeType,p=d.data);let m=new Blob([p],{type:`${f}; length=${p.byteLength}`});n.append(`${s}.attachment.${l}`,m)}}return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(i,"upload examples"),i})).json()}async updatePrompt(e,r){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[n,o]=Wo(e);if(!await this._currentTenantIsOwner(n))throw await this._ownerConflictError("update a prompt",n);let i={};if(r?.description!==void 0&&(i.description=r.description),r?.readme!==void 0&&(i.readme=r.readme),r?.tags!==void 0&&(i.tags=r.tags),r?.isPublic!==void 0&&(i.is_public=r.isPublic),r?.isArchived!==void 0&&(i.is_archived=r.isArchived),Object.keys(i).length===0)throw new Error("No valid update options provided");let s=JSON.stringify(i);return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/repos/${n}/${o}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"update prompt"),c})).json()}async deletePrompt(e){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[r,n,o]=Wo(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"delete prompt"),s})).json()}async pullPromptCommit(e,r){let[n,o,i]=Wo(e),a=await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/commits/${n}/${o}/${i}${r?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(c,"pull prompt commit"),c})).json();return{owner:n,repo:o,commit_hash:a.commit_hash,manifest:a.manifest,examples:a.examples}}async _pullPrompt(e,r){let n=await this.pullPromptCommit(e,{includeModel:r?.includeModel});return JSON.stringify(n.manifest)}async pushPrompt(e,r){return await this.promptExists(e)?r&&Object.keys(r).some(o=>o!=="object")&&await this.updatePrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}):await this.createPrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}),r?.object?await this.createCommit(e,r?.object,{parentCommitHash:r?.parentCommitHash}):await this._getPromptUrl(e)}async clonePublicDataset(e,r={}){let{sourceApiUrl:n=this.apiUrl,datasetName:o}=r,[i,s]=this.parseTokenOrUrl(e,n),a=new t({apiUrl:i,apiKey:"placeholder"}),c=await a.readSharedDataset(s),u=o||c.name;try{if(await this.hasDataset({datasetId:u})){console.log(`Dataset ${u} already exists in your tenant. Skipping.`);return}}catch{}let l=await a.listSharedExamples(s),d=await this.createDataset(u,{description:c.description,dataType:c.data_type||"kv",inputsSchema:c.inputs_schema_definition??void 0,outputsSchema:c.outputs_schema_definition??void 0});try{await this.createExamples({inputs:l.map(f=>f.inputs),outputs:l.flatMap(f=>f.outputs?[f.outputs]:[]),datasetId:d.id})}catch(f){throw console.error(`An error occurred while creating dataset ${u}. You should delete it manually.`),f}}parseTokenOrUrl(e,r,n=2,o="dataset"){try{return $e(e),[r,e]}catch{}try{let s=new URL(e).pathname.split("/").filter(a=>a!=="");if(s.length>=n){let a=s[s.length-n];return[r,a]}else throw new Error(`Invalid public ${o} URL: ${e}`)}catch{throw new Error(`Invalid public ${o} URL or token: ${e}`)}}async awaitPendingTraceBatches(){if(this.manualFlushMode)return console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve();await Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()]),this.langSmithToOTELTranslator!==void 0&&await iP()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}};function pR(t){return"dataset_id"in t||"dataset_name"in t}var mR=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>At(r)==="true");var mo=Symbol.for("lc:context_variables"),Zh=Symbol.for("langsmith:replica_trace_roots");function t0(t,e){if(mo in t)return t[mo][e]}function hR(t,e,r){let n=mo in t?t[mo]:{};n[e]=r,t[mo]=n}var Fd=36,Bd="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function gR(t){let r=Object.keys(t).sort().map(n=>`${n}:${t[n]??""}`).join("|");return ua(r,Bd)}function Mq(t){return t.replace(/[-:.]/g,"")}function yR(t,e=1){let r=e.toFixed(0).slice(0,3).padStart(3,"0");return`${new Date(t).toISOString().slice(0,-1)}${r}Z`}function r0(t,e,r=1){let n=yR(t,r);return{dottedOrder:Mq(n)+e,microsecondPrecisionDatestring:n}}var qh=class t{constructor(e,r,n,o){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n,this.replicas=o}static fromHeader(e){let r=e.split(","),n={},o=[],i,s;for(let a of r){let[c,u]=a.split("="),l=decodeURIComponent(u);c==="langsmith-metadata"?n=JSON.parse(l):c==="langsmith-tags"?o=l.split(","):c==="langsmith-project"?i=l:c==="langsmith-replicas"&&(s=JSON.parse(l))}return new t(n,o,i,s)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}},Ln=class t{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"distributedParentId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),vR(e)){Object.assign(this,{...e});return}let r=t.getDefaultConfig(),{metadata:n,...o}=e,i=o.client??t.getSharedClient(),s={...n,...o?.extra?.metadata};if(o.extra={...o.extra,metadata:s},"id"in o&&o.id==null&&delete o.id,Object.assign(this,{...r,...o,client:i}),this.execution_order??=1,this.child_execution_order??=1,this.dotted_order||(this._serialized_start_time=yR(this.start_time,this.execution_order)),this.id||(this.id=mh(this._serialized_start_time??this.start_time)),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.replicas=Uq(this.replicas),!this.dotted_order){let{dottedOrder:a}=r0(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+a:this.dotted_order=a}}set metadata(e){this.extra={...this.extra,metadata:{...this.extra?.metadata,...e}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){let e=Date.now();return{run_type:"chain",project_name:Pd(),child_runs:[],api_url:Qr("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Qr("LANGCHAIN_API_KEY"),caller_options:{},start_time:e,serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new da),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=this.replicas?.map(l=>{let{reroot:d,...f}=l;return f}),o=e.replicas??n,i=new t({...e,parent_run:this,project_name:this.project_name,replicas:o,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});mo in this&&(i[mo]=this[mo]);let s=Symbol.for("lc:child_config"),a=e.extra?.[s]??this.extra[s];if(Dq(a)){let l={...a},d=jq(l.callbacks)?l.callbacks.copy?.():void 0;d&&(Object.assign(d,{_parentRunId:i.id}),d.handlers?.find(bR)?.updateFromRunTree?.(i),l.callbacks=d),i.extra[s]=l}let c=new Set,u=this;for(;u!=null&&!c.has(u.id);)c.add(u.id),u.child_execution_order=Math.max(u.child_execution_order,r),u=u.parent_run;return this.child_runs.push(i),i}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o?.runtime?.library===void 0&&(o.runtime||(o.runtime={}),r))for(let[a,c]of Object.entries(r))o.runtime[a]||(o.runtime[a]=c);let i,s;return n?(s=e.parent_run?.id??e.parent_run_id,i=[]):(i=e.child_runs.map(a=>this._convertToCreate(a,r,n)),s=void 0),{id:e.id,name:e.name,start_time:e._serialized_start_time??e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:o,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:i,parent_run_id:s,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments,events:e.events}}_sliceParentId(e,r){if(r.dotted_order){let n=r.dotted_order.split("."),o=null;for(let i=0;i0?r.trace_id=i[0].slice(-Fd):r.trace_id=r.id}}r.parent_run_id===e&&(r.parent_run_id=void 0)}_setReplicaTraceRoot(e,r){let n=t0(this,Zh)??{};n[e]=r,hR(this,Zh,n);for(let o of this.child_runs)o._setReplicaTraceRoot(e,r)}_remapForProject(e){let{projectName:r,runtimeEnv:n,excludeChildRuns:o=!0,reroot:i=!1,distributedParentId:s,apiUrl:a,apiKey:c,workspaceId:u}=e,l=this._convertToCreate(this,n,o);if(r===this.project_name)return{...l,session_name:r};if(i){if(s)this._sliceParentId(s,l);else if(l.parent_run_id=void 0,l.dotted_order){let b=l.dotted_order.split(".");b.length>0&&(l.dotted_order=b[b.length-1],l.trace_id=l.id)}let v=gR({projectName:r,apiUrl:a,apiKey:c,workspaceId:u});this._setReplicaTraceRoot(v,l.id)}let d;if(!i){let v=t0(this,Zh)??{},b=gR({projectName:r,apiUrl:a,apiKey:c,workspaceId:u});if(d=v[b],d&&(l.trace_id=d,l.dotted_order)){let x=l.dotted_order.split("."),k=null;for(let T=0;T{let k=x.slice(-Fd),T=ua(`${k}:${r}`,Bd);return x.slice(0,-Fd)+T}).join(".")),{...l,id:p,trace_id:m,parent_run_id:h,dotted_order:_,session_name:r}}async postRun(e=!0){try{let r=gh();if(this.replicas&&this.replicas.length>0)for(let{projectName:n,apiKey:o,apiUrl:i,workspaceId:s,reroot:a}of this.replicas){let c=this._remapForProject({projectName:n??this.project_name,runtimeEnv:r,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:i,apiKey:o,workspaceId:s});await this.client.createRun(c,{apiKey:o,apiUrl:i,workspaceId:s})}else{let n=this._convertToCreate(this,r,e);await this.client.createRun(n)}if(!e){uu("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let n of this.child_runs)await n.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(e){if(this.replicas&&this.replicas.length>0)for(let{projectName:r,apiKey:n,apiUrl:o,workspaceId:i,updates:s,reroot:a}of this.replicas){let c=this._remapForProject({projectName:r??this.project_name,runtimeEnv:void 0,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:o,apiKey:n,workspaceId:i}),u={id:c.id,name:c.name,run_type:c.run_type,start_time:c.start_time,outputs:c.outputs,error:c.error,parent_run_id:c.parent_run_id,session_name:c.session_name,reference_example_id:c.reference_example_id,end_time:c.end_time,dotted_order:c.dotted_order,trace_id:c.trace_id,events:c.events,tags:c.tags,extra:c.extra,attachments:this.attachments,...s};e?.excludeInputs||(u.inputs=c.inputs),await this.client.updateRun(c.id,u,{apiKey:n,apiUrl:o,workspaceId:i})}else try{let r={name:this.name,run_type:this.run_type,start_time:this._serialized_start_time??this.start_time,end_time:this.end_time,error:this.error,outputs:this.outputs,parent_run_id:this.parent_run?.id??this.parent_run_id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};e?.excludeInputs||(r.inputs=this.inputs),await this.client.updateRun(this.id,r)}catch(r){console.error(`Error in patchRun for run ${this.id}`,r)}}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(e){this.events||(this.events=[]),typeof e=="string"?this.events.push({name:"event",time:new Date().toISOString(),message:e}):this.events.push({...e,time:e.time??new Date().toISOString()})}static fromRunnableConfig(e,r){let n=e?.callbacks,o,i,s,a=mR();if(n){let u=n?.getParentRunId?.()??"",l=n?.handlers?.find(d=>d?.name=="langchain_tracer");o=l?.getRun?.(u),i=l?.projectName,s=l?.client,a=a||!!l}return o?new t({name:o.name,id:o.id,trace_id:o.trace_id,dotted_order:o.dotted_order,client:s,tracingEnabled:a,project_name:i,tags:[...new Set((o?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...o?.extra?.metadata,...e?.metadata}}}).createChild(r):new t({...r,client:s,tracingEnabled:a,project_name:i})}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,r){let n="get"in e&&typeof e.get=="function"?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,o=n["langsmith-trace"];if(!o||typeof o!="string")return;let i=o.trim(),s=i.split(".").map(l=>{let[d,f]=l.split("Z");return{strTime:d,time:Date.parse(d+"Z"),uuid:f}}),a=s[0].uuid,c={...r,name:r?.name??"parent",run_type:r?.run_type??"chain",start_time:r?.start_time??Date.now(),id:s.at(-1)?.uuid,trace_id:a,dotted_order:i};if(n.baggage&&typeof n.baggage=="string"){let l=qh.fromHeader(n.baggage);c.metadata=l.metadata,c.tags=l.tags,c.project_name=l.project_name,c.replicas=l.replicas}let u=new t(c);return u.distributedParentId=u.id,u}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new qh(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(Ln,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null});function vR(t){return t!=null&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function bR(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function _R(t){return Array.isArray(t)&&t.some(e=>bR(e))}function jq(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function Dq(t){return t!=null&&typeof t.callbacks=="object"&&(_R(t.callbacks?.handlers)||_R(t.callbacks))}function Lq(){let t=Qr("LANGSMITH_RUNS_ENDPOINTS");if(!t)return[];try{let e=JSON.parse(t);if(Array.isArray(e)){let r=[];for(let n of e){if(typeof n!="object"||n===null){console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got ${typeof n}`);continue}if(typeof n.api_url!="string"){console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_url}`);continue}if(typeof n.api_key!="string"){console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_key}`);continue}r.push({apiUrl:n.api_url.replace(/\/$/,""),apiKey:n.api_key})}return r}else if(typeof e=="object"&&e!==null){Fq(e);let r=[];for(let[n,o]of Object.entries(e)){let i=n.replace(/\/$/,"");if(typeof o=="string")r.push({apiUrl:i,apiKey:o});else{console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${n}: expected string, got ${typeof o}`);continue}}return r}else return console.warn(`Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey, got ${typeof e}`),[]}catch(e){if(sR(e))throw e;return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey"),[]}}function Uq(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):Lq()}function Fq(t){if(Object.keys(t).length>0&&At("ENDPOINT"))throw new Lh}var Bq={};G(Bq,{BaseTracer:()=>Un,isBaseTracer:()=>fa});var Zq=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};function o0(t,e){if(t)return new Ln({...t,start_time:t._serialized_start_time??t.start_time,parent_run:o0(e),child_runs:t.child_runs.map(r=>o0(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:ex()},tracingEnabled:!1})}function n0(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function fa(t){return typeof t._addRunToRunMap=="function"}var Un=class extends la{runMap=new Map;runTreeMap=new Map;usesRunTreeMap=!1;constructor(t){super(...arguments)}copy(){return this}getRunById(t){if(t!==void 0)return this.usesRunTreeMap?Zq(this.runTreeMap.get(t)):this.runMap.get(t)}stringifyError(t){return t instanceof Error?t.message+(t?.stack?` + +${t.stack}`:""):typeof t=="string"?t:`${t}`}_addChildRun(t,e){t.child_runs.push(e)}_addRunToRunMap(t){let{dottedOrder:e,microsecondPrecisionDatestring:r}=r0(new Date(t.start_time).getTime(),t.id,t.execution_order),n={...t},o=this.getRunById(n.parent_run_id);if(n.parent_run_id!==void 0?o&&(this._addChildRun(o,n),o.child_execution_order=Math.max(o.child_execution_order,n.child_execution_order),n.trace_id=o.trace_id,o.dotted_order!==void 0&&(n.dotted_order=[o.dotted_order,e].join("."),n._serialized_start_time=r)):(n.trace_id=n.id,n.dotted_order=e,n._serialized_start_time=r),this.usesRunTreeMap){let i=o0(n,o);i!==void 0&&this.runTreeMap.set(n.id,i)}else this.runMap.set(n.id,n);return n}async _endTrace(t){let e=t.parent_run_id!==void 0&&this.getRunById(t.parent_run_id);e?e.child_execution_order=Math.max(e.child_execution_order,t.child_execution_order):await this.persistRun(t),await this.onRunUpdate?.(t),this.usesRunTreeMap?this.runTreeMap.delete(t.id):this.runMap.delete(t.id)}_getExecutionOrder(t){let e=t!==void 0&&this.getRunById(t);return e?e.child_execution_order+1:1}_createRunForLLMStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l=s?{...o,metadata:s}:o,d={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{prompts:e},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:l??{},tags:i||[]};return this._addRunToRunMap(d)}async handleLLMStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForLLMStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}_createRunForChatModelStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l=s?{...o,metadata:s}:o,d={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{messages:e},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:l??{},tags:i||[]};return this._addRunToRunMap(d)}async handleChatModelStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForChatModelStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}async handleLLMEnd(t,e,r,n,o){let i=this.getRunById(e);if(!i||i?.run_type!=="llm")throw new Error("No LLM run to end.");return i.end_time=Date.now(),i.outputs=t,i.events.push({name:"end",time:new Date(i.end_time).toISOString()}),i.extra={...i.extra,...o},await this.onLLMEnd?.(i),await this._endTrace(i),i}async handleLLMError(t,e,r,n,o){let i=this.getRunById(e);if(!i||i?.run_type!=="llm")throw new Error("No LLM run to end.");return i.end_time=Date.now(),i.error=this.stringifyError(t),i.events.push({name:"error",time:new Date(i.end_time).toISOString()}),i.extra={...i.extra,...o},await this.onLLMError?.(i),await this._endTrace(i),i}_createRunForChainStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:e,execution_order:c,child_execution_order:c,run_type:s??"chain",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(l)}async handleChainStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForChainStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onChainStart?.(c),c}async handleChainEnd(t,e,r,n,o){let i=this.getRunById(e);if(!i)throw new Error("No chain run to end.");return i.end_time=Date.now(),i.outputs=n0(t,"output"),i.events.push({name:"end",time:new Date(i.end_time).toISOString()}),o?.inputs!==void 0&&(i.inputs=n0(o.inputs,"input")),await this.onChainEnd?.(i),await this._endTrace(i),i}async handleChainError(t,e,r,n,o){let i=this.getRunById(e);if(!i)throw new Error("No chain run to end.");return i.end_time=Date.now(),i.error=this.stringifyError(t),i.events.push({name:"error",time:new Date(i.end_time).toISOString()}),o?.inputs!==void 0&&(i.inputs=n0(o.inputs,"input")),await this.onChainError?.(i),await this._endTrace(i),i}_createRunForToolStart(t,e,r,n,o,i,s){let a=this._getExecutionOrder(n),c=Date.now(),u={id:r,name:s??t.id[t.id.length-1],parent_run_id:n,start_time:c,serialized:t,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{input:e},execution_order:a,child_execution_order:a,run_type:"tool",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(u)}async handleToolStart(t,e,r,n,o,i,s){let a=this.getRunById(r)??this._createRunForToolStart(t,e,r,n,o,i,s);return await this.onRunCreate?.(a),await this.onToolStart?.(a),a}async handleToolEnd(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.outputs={output:t},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onToolEnd?.(r),await this._endTrace(r),r}async handleToolError(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.error=this.stringifyError(t),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onToolError?.(r),await this._endTrace(r),r}async handleAgentAction(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="chain")return;let n=r;n.actions=n.actions||[],n.actions.push(t),n.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentAction?.(r)}async handleAgentEnd(t,e){let r=this.getRunById(e);!r||r?.run_type!=="chain"||(r.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentEnd?.(r))}_createRunForRetrieverStart(t,e,r,n,o,i,s){let a=this._getExecutionOrder(n),c=Date.now(),u={id:r,name:s??t.id[t.id.length-1],parent_run_id:n,start_time:c,serialized:t,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{query:e},execution_order:a,child_execution_order:a,run_type:"retriever",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(u)}async handleRetrieverStart(t,e,r,n,o,i,s){let a=this.getRunById(r)??this._createRunForRetrieverStart(t,e,r,n,o,i,s);return await this.onRunCreate?.(a),await this.onRetrieverStart?.(a),a}async handleRetrieverEnd(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.outputs={documents:t},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onRetrieverEnd?.(r),await this._endTrace(r),r}async handleRetrieverError(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.error=this.stringifyError(t),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onRetrieverError?.(r),await this._endTrace(r),r}async handleText(t,e){let r=this.getRunById(e);!r||r?.run_type!=="chain"||(r.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:t}}),await this.onText?.(r))}async handleLLMNewToken(t,e,r,n,o,i){let s=this.getRunById(r);if(!s||s?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return s.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:t,idx:e,chunk:i?.chunk}}),await this.onLLMNewToken?.(s,t,{chunk:i?.chunk}),s}};var i0=mn(IR(),1),Vq={};G(Vq,{ConsoleCallbackHandler:()=>Vh});function yr(t,e){return`${t.open}${e}${t.close}`}function yn(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function SR(t){return typeof t=="string"?t.trim():t==null?t:yn(t,t.toString())}function Fi(t){if(!t.end_time)return"";let e=t.end_time-t.start_time;return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}var{color:Cr}=i0.default,Vh=class extends Un{name="console_callback_handler";persistRun(t){return Promise.resolve()}getParents(t){let e=[],r=t;for(;r.parent_run_id;){let n=this.runMap.get(r.parent_run_id);if(n)e.push(n),r=n;else break}return e}getBreadcrumbs(t){let r=[...this.getParents(t).reverse(),t].map((n,o,i)=>{let s=`${n.execution_order}:${n.run_type}:${n.name}`;return o===i.length-1?yr(i0.default.bold,s):s}).join(" > ");return yr(Cr.grey,r)}onChainStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[chain/start]")} [${e}] Entering Chain run with input: ${yn(t.inputs,"[inputs]")}`)}onChainEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[chain/end]")} [${e}] [${Fi(t)}] Exiting Chain run with output: ${yn(t.outputs,"[outputs]")}`)}onChainError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[chain/error]")} [${e}] [${Fi(t)}] Chain run errored with error: ${yn(t.error,"[error]")}`)}onLLMStart(t){let e=this.getBreadcrumbs(t),r="prompts"in t.inputs?{prompts:t.inputs.prompts.map(n=>n.trim())}:t.inputs;console.log(`${yr(Cr.green,"[llm/start]")} [${e}] Entering LLM run with input: ${yn(r,"[inputs]")}`)}onLLMEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[llm/end]")} [${e}] [${Fi(t)}] Exiting LLM run with output: ${yn(t.outputs,"[response]")}`)}onLLMError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[llm/error]")} [${e}] [${Fi(t)}] LLM run errored with error: ${yn(t.error,"[error]")}`)}onToolStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[tool/start]")} [${e}] Entering Tool run with input: "${SR(t.inputs.input)}"`)}onToolEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[tool/end]")} [${e}] [${Fi(t)}] Exiting Tool run with output: "${SR(t.outputs?.output)}"`)}onToolError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[tool/error]")} [${e}] [${Fi(t)}] Tool run errored with error: ${yn(t.error,"[error]")}`)}onRetrieverStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[retriever/start]")} [${e}] Entering Retriever run with input: ${yn(t.inputs,"[inputs]")}`)}onRetrieverEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[retriever/end]")} [${e}] [${Fi(t)}] Exiting Retriever run with output: ${yn(t.outputs,"[outputs]")}`)}onRetrieverError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[retriever/error]")} [${e}] [${Fi(t)}] Retriever run errored with error: ${yn(t.error,"[error]")}`)}onAgentAction(t){let e=t,r=this.getBreadcrumbs(t);console.log(`${yr(Cr.blue,"[agent/action]")} [${r}] Agent selected action: ${yn(e.actions[e.actions.length-1],"[action]")}`)}};var s0,Gh=()=>{if(s0===void 0){let t=It("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};s0=new da(t)}return s0};var c0=class{getStore(){}run(e,r){return r()}},a0=Symbol.for("ls:tracing_async_local_storage"),Gq=new c0,u0=class{getInstance(){return globalThis[a0]??Gq}initializeGlobalInstance(e){globalThis[a0]===void 0&&(globalThis[a0]=e)}},Kq=new u0;function kR(t=!1){let e=Kq.getInstance().getStore();if(!t&&e===void 0)throw new Error(`Could not get the current run tree. + +Please make sure you are calling this method within a traceable function and that tracing is enabled.`);return e}var rge=Symbol.for("langsmith:traceable:root");function Kh(t){return typeof t=="function"&&"langsmith:traceable"in t}var Hq={};G(Hq,{LangChainTracer:()=>Zd});var Zd=class TR extends Un{name="langchain_tracer";projectName;exampleId;client;replicas;usesRunTreeMap=!0;constructor(e={}){super(e);let{exampleId:r,projectName:n,client:o,replicas:i}=e;this.projectName=n??Pd(),this.replicas=i,this.exampleId=r,this.client=o??Gh();let s=TR.getTraceableRunTree();s&&this.updateFromRunTree(s)}async persistRun(e){}async onRunCreate(e){await this.getRunTreeWithTracingConfig(e.id)?.postRun()}async onRunUpdate(e){await this.getRunTreeWithTracingConfig(e.id)?.patchRun()}getRun(e){return this.runTreeMap.get(e)}updateFromRunTree(e){this.runTreeMap.set(e.id,e);let r=e,n=new Set;for(;r.parent_run&&!(n.has(r.id)||(n.add(r.id),!r.parent_run));)r=r.parent_run;n.clear();let o=[r];for(;o.length>0;){let i=o.shift();!i||n.has(i.id)||(n.add(i.id),this.runTreeMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.replicas=e.replicas??this.replicas,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}getRunTreeWithTracingConfig(e){let r=this.runTreeMap.get(e);if(r)return new Ln({...r,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return kR(!0)}catch{return}}};var Hh=mn(Sh(),1),ma;function Wq(){let t="default"in Hh.default?Hh.default.default:Hh.default;return new t({autoStart:!0,concurrency:1})}function Jq(){return typeof ma>"u"&&(ma=Wq()),ma}async function gt(t,e){if(e===!0){let r=Li();r!==void 0?await r.run(void 0,async()=>t()):await t()}else ma=Jq(),ma.add(async()=>{let r=Li();r!==void 0?await r.run(void 0,async()=>t()):await t()})}async function ER(){let t=Gh();await Promise.allSettled([typeof ma<"u"?ma.onIdle():Promise.resolve(),t.awaitPendingTraceBatches()])}var Xq={};G(Xq,{awaitAllCallbacks:()=>ER,consumeCallback:()=>gt});var AR=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>It(r)==="true");function l0(t){let e=Li();return e===void 0?void 0:e.getStore()?.[Di]?.[t]}var Yq=Symbol("lc:configure_hooks"),OR=()=>l0(Yq)||[];var Qq={};G(Qq,{BaseCallbackManager:()=>PR,BaseRunManager:()=>Vd,CallbackManager:()=>St,CallbackManagerForChainRun:()=>RR,CallbackManagerForLLMRun:()=>d0,CallbackManagerForRetrieverRun:()=>CR,CallbackManagerForToolRun:()=>NR,ensureHandler:()=>pu,parseCallbackConfigArg:()=>ha});function ha(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}var PR=class{setHandler(t){return this.setHandlers([t])}},Vd=class{constructor(t,e,r,n,o,i,s,a){this.runId=t,this.handlers=e,this.inheritableHandlers=r,this.tags=n,this.inheritableTags=o,this.metadata=i,this.inheritableMetadata=s,this._parentRunId=a}get parentRunId(){return this._parentRunId}async handleText(t){await Promise.all(this.handlers.map(e=>gt(async()=>{try{await e.handleText?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleText: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleCustomEvent(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{try{await i.handleCustomEvent?.(t,e,this.runId,this.tags,this.metadata)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleCustomEvent: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},CR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleRetrieverEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetriever`),e.raiseError)throw r}},e.awaitHandlers)))}async handleRetrieverError(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetrieverError: ${r}`),e.raiseError)throw t}},e.awaitHandlers)))}},d0=class extends Vd{async handleLLMNewToken(t,e,r,n,o,i){await Promise.all(this.handlers.map(s=>gt(async()=>{if(!s.ignoreLLM)try{await s.handleLLMNewToken?.(t,e??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,i)}catch(a){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleLLMNewToken: ${a}`),s.raiseError)throw a}},s.awaitHandlers)))}async handleLLMError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreLLM)try{await i.handleLLMError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleLLMEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreLLM)try{await i.handleLLMEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},RR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleChainError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreChain)try{await i.handleChainError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleChainEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreChain)try{await i.handleChainEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleAgentAction(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleAgentAction?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentAction: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleAgentEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleAgentEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},NR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleToolError(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleToolError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolError: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleToolEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleToolEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},St=class qd extends PR{handlers=[];inheritableHandlers=[];tags=[];inheritableTags=[];metadata={};inheritableMetadata={};name="callback_manager";_parentRunId;constructor(e,r){super(),this.handlers=r?.handlers??this.handlers,this.inheritableHandlers=r?.inheritableHandlers??this.inheritableHandlers,this.tags=r?.tags??this.tags,this.inheritableTags=r?.inheritableTags??this.inheritableTags,this.metadata=r?.metadata??this.metadata,this.inheritableMetadata=r?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=e}getParentRunId(){return this._parentRunId}async handleLLMStart(e,r,n=void 0,o=void 0,i=void 0,s=void 0,a=void 0,c=void 0){return Promise.all(r.map(async(u,l)=>{let d=l===0&&n?n:Et();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return fa(f)&&f._createRunForLLMStart(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c),gt(async()=>{try{await f.handleLLMStart?.(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c)}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new d0(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(e,r,n=void 0,o=void 0,i=void 0,s=void 0,a=void 0,c=void 0){return Promise.all(r.map(async(u,l)=>{let d=l===0&&n?n:Et();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return fa(f)&&f._createRunForChatModelStart(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c),gt(async()=>{try{if(f.handleChatModelStart)await f.handleChatModelStart?.(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c);else if(f.handleLLMStart){let p=au(u);await f.handleLLMStart?.(e,[p],d,this._parentRunId,i,this.tags,this.metadata,c)}}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new d0(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreChain)return fa(c)&&c._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,a),gt(async()=>{try{await c.handleChainStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,o,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleChainStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new RR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreAgent)return fa(c)&&c._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,a),gt(async()=>{try{await c.handleToolStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleToolStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new NR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreRetriever)return fa(c)&&c._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,a),gt(async()=>{try{await c.handleRetrieverStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleRetrieverStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new CR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(e,r,n,o,i){await Promise.all(this.handlers.map(s=>gt(async()=>{if(!s.ignoreCustomEvent)try{await s.handleCustomEvent?.(e,r,n,this.tags,this.metadata)}catch(a){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleCustomEvent: ${a}`),s.raiseError)throw a}},s.awaitHandlers)))}addHandler(e,r=!0){this.handlers.push(e),r&&this.inheritableHandlers.push(e)}removeHandler(e){this.handlers=this.handlers.filter(r=>r!==e),this.inheritableHandlers=this.inheritableHandlers.filter(r=>r!==e)}setHandlers(e,r=!0){this.handlers=[],this.inheritableHandlers=[];for(let n of e)this.addHandler(n,r)}addTags(e,r=!0){this.removeTags(e),this.tags.push(...e),r&&this.inheritableTags.push(...e)}removeTags(e){this.tags=this.tags.filter(r=>!e.includes(r)),this.inheritableTags=this.inheritableTags.filter(r=>!e.includes(r))}addMetadata(e,r=!0){this.metadata={...this.metadata,...e},r&&(this.inheritableMetadata={...this.inheritableMetadata,...e})}removeMetadata(e){for(let r of Object.keys(e))delete this.metadata[r],delete this.inheritableMetadata[r]}copy(e=[],r=!0){let n=new qd(this._parentRunId);for(let o of this.handlers){let i=this.inheritableHandlers.includes(o);n.addHandler(o,i)}for(let o of this.tags){let i=this.inheritableTags.includes(o);n.addTags([o],i)}for(let o of Object.keys(this.metadata)){let i=Object.keys(this.inheritableMetadata).includes(o);n.addMetadata({[o]:this.metadata[o]},i)}for(let o of e)n.handlers.filter(i=>i.name==="console_callback_handler").some(i=>i.name===o.name)||n.addHandler(o,r);return n}static fromHandlers(e){class r extends la{name=Et();constructor(){super(),Object.assign(this,e)}}let n=new this;return n.addHandler(new r),n}static configure(e,r,n,o,i,s,a){return this._configureSync(e,r,n,o,i,s,a)}static _configureSync(e,r,n,o,i,s,a){let c;(e||r)&&(Array.isArray(e)||!e?(c=new qd,c.setHandlers(e?.map(pu)??[],!0)):c=e,c=c.copy(Array.isArray(r)?r.map(pu):r?.handlers,!1));let u=It("LANGCHAIN_VERBOSE")==="true"||a?.verbose,l=Zd.getTraceableRunTree()?.tracingEnabled||AR(),d=l||(It("LANGCHAIN_TRACING")??!1);if(u||d){if(c||(c=new qd),u&&!c.handlers.some(f=>f.name===Vh.prototype.name)){let f=new Vh;c.addHandler(f,!0)}if(d&&!c.handlers.some(f=>f.name==="langchain_tracer")&&l){let f=new Zd;c.addHandler(f,!0)}if(l){let f=Zd.getTraceableRunTree();f&&c._parentRunId===void 0&&(c._parentRunId=f.id,c.handlers.find(m=>m.name==="langchain_tracer")?.updateFromRunTree(f))}}for(let{contextVar:f,inheritable:p=!0,handlerClass:m,envVar:h}of OR()){let _=h&&It(h)==="true"&&m,v,b=f!==void 0?l0(f):void 0;b&&ox(b)?v=b:_&&(v=new m({})),v!==void 0&&(c||(c=new qd),c.handlers.some(x=>x.name===v.name)||c.addHandler(v,p))}return(n||o)&&c&&(c.addTags(n??[]),c.addTags(o??[],!1)),(i||s)&&c&&(c.addMetadata(i??{}),c.addMetadata(s??{},!1)),c}};function pu(t){return"name"in t?t:la.fromMethods(t)}var p0=class{getStore(){}run(t,e){return e()}enterWith(t){}},eV=new p0,zR=Symbol.for("lc:child_config"),tV=class{getInstance(){return Li()??eV}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[zR]}runWithConfig(t,e,r){let n=St._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata),o=this.getInstance(),i=o.getStore(),s=n?.getParentRunId(),a=n?.handlers?.find(u=>u?.name==="langchain_tracer"),c;return a&&s?c=a.getRunTreeWithTracingConfig(s):r||(c=new Ln({name:"",tracingEnabled:!1})),c&&(c.extra={...c.extra,[zR]:t}),i!==void 0&&i[Di]!==void 0&&(c===void 0&&(c={}),c[Di]=i[Di]),o.run(c,e)}initializeGlobalInstance(t){Li()===void 0&&fO(t)}},Lt=new tV;var rV={};G(rV,{AsyncLocalStorageProviderSingleton:()=>Lt,MockAsyncLocalStorage:()=>p0,_CONTEXT_VARIABLES_KEY:()=>Di});var Wh=25;async function or(t){return St._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function ga(...t){let e={};for(let r of t.filter(n=>!!n))for(let n of Object.keys(r))if(n==="metadata")e[n]={...e[n],...r[n]};else if(n==="tags"){let o=e[n]??[];e[n]=[...new Set(o.concat(r[n]??[]))]}else if(n==="configurable")e[n]={...e[n],...r[n]};else if(n==="timeout")e.timeout===void 0?e.timeout=r.timeout:r.timeout!==void 0&&(e.timeout=Math.min(e.timeout,r.timeout));else if(n==="signal")e.signal===void 0?e.signal=r.signal:r.signal!==void 0&&("any"in AbortSignal?e.signal=AbortSignal.any([e.signal,r.signal]):e.signal=r.signal);else if(n==="callbacks"){let o=e.callbacks,i=r.callbacks;if(Array.isArray(i))if(!o)e.callbacks=i;else if(Array.isArray(o))e.callbacks=o.concat(i);else{let s=o.copy();for(let a of i)s.addHandler(pu(a),!0);e.callbacks=s}else if(i)if(!o)e.callbacks=i;else if(Array.isArray(o)){let s=i.copy();for(let a of o)s.addHandler(pu(a),!0);e.callbacks=s}else e.callbacks=new St(i._parentRunId,{handlers:o.handlers.concat(i.handlers),inheritableHandlers:o.inheritableHandlers.concat(i.inheritableHandlers),tags:Array.from(new Set(o.tags.concat(i.tags))),inheritableTags:Array.from(new Set(o.inheritableTags.concat(i.inheritableTags))),metadata:{...o.metadata,...i.metadata}})}else{let o=n;e[o]=r[o]??e[o]}return e}var nV=new Set(["string","number","boolean"]);function Pe(t){let e=Lt.getRunnableConfig(),r={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(e){let{runId:n,runName:o,...i}=e;r=Object.entries(i).reduce((s,[a,c])=>(c!==void 0&&(s[a]=c),s),r)}if(t&&(r=Object.entries(t).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),r)),r?.configurable)for(let n of Object.keys(r.configurable))nV.has(typeof r.configurable[n])&&!r.metadata?.[n]&&(r.metadata||(r.metadata={}),r.metadata[n]=r.configurable[n]);if(r.timeout!==void 0){if(r.timeout<=0)throw new Error("Timeout must be a positive number");let n=AbortSignal.timeout(r.timeout);r.signal!==void 0?"any"in AbortSignal&&(r.signal=AbortSignal.any([r.signal,n])):r.signal=n,delete r.timeout}return r}function Ve(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:s}={}){let a=Pe(t);return e!==void 0&&(delete a.runName,a.callbacks=e),n!==void 0&&(a.recursionLimit=n),r!==void 0&&(a.maxConcurrency=r),o!==void 0&&(a.runName=o),i!==void 0&&(a.configurable={...a.configurable,...i}),s!==void 0&&delete a.runId,a}function vr(t){if(t)return{configurable:t.configurable,recursionLimit:t.recursionLimit,callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,maxConcurrency:t.maxConcurrency,timeout:t.timeout,signal:t.signal,store:t.store}}async function vn(t,e){if(e===void 0)return t;let r;return Promise.race([t.catch(n=>{if(!e?.aborted)throw n}),new Promise((n,o)=>{r=()=>{o(Bi(e))},e.addEventListener("abort",r),e.aborted&&o(Bi(e))})]).finally(()=>e.removeEventListener("abort",r))}function Bi(t){return t?.reason instanceof Error?t.reason:typeof t?.reason=="string"?new Error(t.reason):new Error("Aborted")}var oV={};G(oV,{AsyncGeneratorWithSetup:()=>Zi,IterableReadableStream:()=>br,atee:()=>Jh,concat:()=>en,pipeGeneratorWithSetup:()=>m0});var br=class f0 extends ReadableStream{reader;ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let e=await this.reader.read();return e.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}throw e}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(e){let r=e.getReader();return new f0({start(n){return o();function o(){return r.read().then(({done:i,value:s})=>{if(i){n.close();return}return n.enqueue(s),o()})}},cancel(){r.releaseLock()}})}static fromAsyncGenerator(e){return new f0({async pull(r){let{value:n,done:o}=await e.next();o&&r.close(),r.enqueue(n)},async cancel(r){await e.return(r)}})}};function Jh(t,e=2){let r=Array.from({length:e},()=>[]);return r.map(async function*(o){for(;;)if(o.length===0){let i=await t.next();for(let s of r)s.push(i)}else{if(o[0].done)return;yield o.shift().value}})}function en(t,e){if(Array.isArray(t)&&Array.isArray(e))return t.concat(e);if(typeof t=="string"&&typeof e=="string")return t+e;if(typeof t=="number"&&typeof e=="number")return t+e;if("concat"in t&&typeof t.concat=="function")return t.concat(e);if(typeof t=="object"&&typeof e=="object"){let r={...t};for(let[n,o]of Object.entries(e))n in r&&!Array.isArray(r[n])?r[n]=en(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}var Zi=class{generator;setup;config;signal;firstResult;firstResultUsed=!1;constructor(t){this.generator=t.generator,this.config=t.config,this.signal=t.signal??this.config?.signal,this.setup=new Promise((e,r)=>{Lt.runWithConfig(vr(t.config),async()=>{this.firstResult=t.generator.next(),t.startSetup?this.firstResult.then(t.startSetup).then(e,r):this.firstResult.then(n=>e(void 0),r)},!0)})}async next(...t){return this.signal?.throwIfAborted(),this.firstResultUsed?Lt.runWithConfig(vr(this.config),this.signal?async()=>vn(this.generator.next(...t),this.signal):async()=>this.generator.next(...t),!0):(this.firstResultUsed=!0,this.firstResult)}async return(t){return this.generator.return(t)}async throw(t){return this.generator.throw(t)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}};async function m0(t,e,r,n,...o){let i=new Zi({generator:e,startSetup:r,signal:n}),s=await i.setup;return{output:t(i,s,...o),setup:s}}var iV=Object.prototype.hasOwnProperty;function Yh(t,e){return iV.call(t,e)}function Qh(t){if(Array.isArray(t)){let r=new Array(t.length);for(let n=0;n=48&&n<=57){e++;continue}return!1}return!0}function Jo(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function tg(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function Xh(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r_t,_areEquals:()=>Gd,applyOperation:()=>_a,applyPatch:()=>qi,applyReducer:()=>cV,deepClone:()=>sV,getValueByPointer:()=>ng,validate:()=>jR,validator:()=>og});var _t=rg,sV=wr,fu={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){let n=ng(r,this.path);n&&(n=wr(n));let o=_a(r,{op:"remove",path:this.from}).removed;return _a(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=ng(r,this.from);return _a(r,{op:"add",path:this.path,value:wr(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:Gd(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},aV={add:function(t,e,r){return eg(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:fu.move,copy:fu.copy,test:fu.test,_get:fu._get};function ng(t,e){if(e=="")return t;var r={op:"_get",path:e};return _a(t,r),r.value}function _a(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):og(e,0)),e.path===""){let s={newDocument:t};if(e.op==="add")return s.newDocument=e.value,s;if(e.op==="replace")return s.newDocument=e.value,s.removed=t,s;if(e.op==="move"||e.op==="copy")return s.newDocument=ng(t,e.from),e.op==="move"&&(s.removed=t),s;if(e.op==="test"){if(s.test=Gd(t,e.value),s.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return s.newDocument=t,s}else{if(e.op==="remove")return s.removed=t,s.newDocument=null,s;if(e.op==="_get")return e.value=t,s;if(r)throw new _t("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return s}}else{n||(t=wr(t));let a=(e.path||"").split("/"),c=t,u=1,l=a.length,d,f,p;for(typeof r=="function"?p=r:p=og;;){if(f=a[u],f&&f.indexOf("~")!=-1&&(f=tg(f)),o&&(f=="__proto__"||f=="prototype"&&u>0&&a[u-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&d===void 0&&(c[f]===void 0?d=a.slice(0,u).join("/"):u==l-1&&(d=e.path),d!==void 0&&p(e,0,t,d)),u++,Array.isArray(c)){if(f==="-")f=c.length;else{if(r&&!eg(f))throw new _t("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,e,t);eg(f)&&(f=~~f)}if(u>=l){if(r&&e.op==="add"&&f>c.length)throw new _t("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let m=aV[e.op].call(e,c,f,t);if(m.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(u>=l){let m=fu[e.op].call(e,c,f,t);if(m.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(c=c[f],r&&u0)throw new _t('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new _t("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new _t("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&Xh(t.value))throw new _t("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var o=t.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new _t("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==n)throw new _t("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var s={op:"_get",path:t.from,value:void 0},a=jR([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new _t("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new _t("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function jR(t,e,r){try{if(!Array.isArray(t))throw new _t("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)qi(wr(e),wr(t),r||!0);else{r=r||og;for(var n=0;n=0;u--){var l=s[u],d=t[l];if(Yh(e,l)&&!(e[l]===void 0&&d!==void 0&&Array.isArray(e)===!1)){var f=e[l];typeof d=="object"&&d!=null&&typeof f=="object"&&f!=null&&Array.isArray(d)===Array.isArray(f)?DR(d,f,r,n+"/"+Jo(l),o):d!==f&&(a=!0,o&&r.push({op:"test",path:n+"/"+Jo(l),value:wr(d)}),r.push({op:"replace",path:n+"/"+Jo(l),value:wr(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+Jo(l),value:wr(d)}),r.push({op:"remove",path:n+"/"+Jo(l)}),c=!0):(o&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),a=!0)}if(!(!c&&i.length==s.length))for(var u=0;usg,RunLog:()=>ig,RunLogPatch:()=>ho,isLogStreamHandler:()=>_0});var ho=class{ops;constructor(t){this.ops=t.ops??[]}concat(t){let e=this.ops.concat(t.ops),r=qi({},e);return new ig({ops:e,state:r[r.length-1].newDocument})}},ig=class g0 extends ho{state;constructor(e){super(e),this.state=e.state}concat(e){let r=this.ops.concat(e.ops),n=qi(this.state,e.ops);return new g0({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=qi({},e.ops);return new g0({ops:e.ops,state:r[r.length-1].newDocument})}},_0=t=>t.name==="log_stream_tracer";async function LR(t,e){if(e==="original")throw new Error("Do not assign inputs with original schema drop the key for now. When inputs are added to streamLog they should be added with standardized schema for streaming events.");let{inputs:r}=t;if(["retriever","llm","prompt"].includes(t.run_type))return r;if(!(Object.keys(r).length===1&&r?.input===""))return r.input}async function UR(t,e){let{outputs:r}=t;return e==="original"||["retriever","llm","prompt"].includes(t.run_type)?r:r!==void 0&&Object.keys(r).length===1&&r?.output!==void 0?r.output:r}function lV(t){return t!==void 0&&t.message!==void 0}var sg=class extends Un{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;_schemaFormat="original";rootId;keyMapByRunId={};counterMapByRunName={};transformStream;writer;receiveStream;name="log_stream_tracer";lc_prefer_streaming=!0;constructor(t){super({_awaitHandler:!0,...t}),this.autoClose=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this._schemaFormat=t?._schemaFormat??this._schemaFormat,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=br.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){if(t.id===this.rootId)return!1;let e=t.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(t.run_type)),this.includeTags!==void 0&&(r=r||e.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(t.run_type)),this.excludeTags!==void 0&&(r=r&&e.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(t,e){for await(let r of e){if(t!==this.rootId){let n=this.keyMapByRunId[t];n&&await this.writer.write(new ho({ops:[{op:"add",path:`/logs/${n}/streamed_output/-`,value:r}]}))}yield r}}async onRunCreate(t){if(this.rootId===void 0&&(this.rootId=t.id,await this.writer.write(new ho({ops:[{op:"replace",path:"",value:{id:t.id,name:t.name,type:t.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(t))return;this.counterMapByRunName[t.name]===void 0&&(this.counterMapByRunName[t.name]=0),this.counterMapByRunName[t.name]+=1;let e=this.counterMapByRunName[t.name];this.keyMapByRunId[t.id]=e===1?t.name:`${t.name}:${e}`;let r={id:t.id,name:t.name,type:t.run_type,tags:t.tags??[],metadata:t.extra?.metadata??{},start_time:new Date(t.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};this._schemaFormat==="streaming_events"&&(r.inputs=await LR(t,this._schemaFormat)),await this.writer.write(new ho({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[t.id]}`,value:r}]}))}async onRunUpdate(t){try{let e=this.keyMapByRunId[t.id];if(e===void 0)return;let r=[];this._schemaFormat==="streaming_events"&&r.push({op:"replace",path:`/logs/${e}/inputs`,value:await LR(t,this._schemaFormat)}),r.push({op:"add",path:`/logs/${e}/final_output`,value:await UR(t,this._schemaFormat)}),t.end_time!==void 0&&r.push({op:"add",path:`/logs/${e}/end_time`,value:new Date(t.end_time).toISOString()});let n=new ho({ops:r});await this.writer.write(n)}finally{if(t.id===this.rootId){let e=new ho({ops:[{op:"replace",path:"/final_output",value:await UR(t,this._schemaFormat)}]});await this.writer.write(e),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(t,e,r){let n=this.keyMapByRunId[t.id];if(n===void 0)return;let o=t.inputs.messages!==void 0,i;o?lV(r?.chunk)?i=r?.chunk:i=new Dt({id:`run-${t.id}`,content:e}):i=e;let s=new ho({ops:[{op:"add",path:`/logs/${n}/streamed_output_str/-`,value:e},{op:"add",path:`/logs/${n}/streamed_output/-`,value:i}]});await this.writer.write(s)}};var dV={};G(dV,{ChatGenerationChunk:()=>Vi,GenerationChunk:()=>go,RUN_KEY:()=>ya});var ya="__run",go=class FR{text;generationInfo;constructor(e){this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new FR({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},Vi=class BR extends go{message;constructor(e){super(e),this.message=e.message}concat(e){return new BR({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo},message:this.message.concat(e.message)})}};function ag({name:t,serialized:e}){return t!==void 0?t:e?.name!==void 0?e.name:e?.id!==void 0&&Array.isArray(e?.id)?e.id[e.id.length-1]:"Unnamed"}var ZR=t=>t.name==="event_stream_tracer",qR=class extends Un{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;runInfoMap=new Map;tappedPromises=new Map;transformStream;writer;receiveStream;name="event_stream_tracer";lc_prefer_streaming=!0;constructor(t){super({_awaitHandler:!0,...t}),this.autoClose=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=br.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){let e=t.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(t.runType)),this.includeTags!==void 0&&(r=r||e.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(t.runType)),this.excludeTags!==void 0&&(r=r&&e.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(t,e){let r=await e.next();if(r.done)return;let n=this.runInfoMap.get(t);if(n===void 0){yield r.value;return}function o(s,a){return s==="llm"&&typeof a=="string"?new go({text:a}):a}let i=this.tappedPromises.get(t);if(i===void 0){let s;i=new Promise(a=>{s=a}),this.tappedPromises.set(t,i);try{let a={event:`on_${n.runType}_stream`,run_id:t,name:n.name,tags:n.tags,metadata:n.metadata,data:{}};await this.send({...a,data:{chunk:o(n.runType,r.value)}},n),yield r.value;for await(let c of e)n.runType!=="tool"&&n.runType!=="retriever"&&await this.send({...a,data:{chunk:o(n.runType,c)}},n),yield c}finally{s?.()}}else{yield r.value;for await(let s of e)yield s}}async send(t,e){this._includeRun(e)&&await this.writer.write(t)}async sendEndEvent(t,e){let r=this.tappedPromises.get(t.run_id);r!==void 0?r.then(()=>{this.send(t,e)}):await this.send(t,e)}async onLLMStart(t){let e=ag(t),r=t.inputs.messages!==void 0?"chat_model":"llm",n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:r,inputs:t.inputs};this.runInfoMap.set(t.id,n);let o=`on_${r}_start`;await this.send({event:o,data:{input:t.inputs},name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onLLMNewToken(t,e,r){let n=this.runInfoMap.get(t.id),o,i;if(n===void 0)throw new Error(`onLLMNewToken: Run ID ${t.id} not found in run map.`);if(this.runInfoMap.size!==1){if(n.runType==="chat_model")i="on_chat_model_stream",r?.chunk===void 0?o=new Dt({content:e,id:`run-${t.id}`}):o=r.chunk.message;else if(n.runType==="llm")i="on_llm_stream",r?.chunk===void 0?o=new go({text:e}):o=r.chunk;else throw new Error(`Unexpected run type ${n.runType}`);await this.send({event:i,data:{chunk:o},run_id:t.id,name:n.name,tags:n.tags,metadata:n.metadata},n)}}async onLLMEnd(t){let e=this.runInfoMap.get(t.id);this.runInfoMap.delete(t.id);let r;if(e===void 0)throw new Error(`onLLMEnd: Run ID ${t.id} not found in run map.`);let n=t.outputs?.generations,o;if(e.runType==="chat_model"){for(let i of n??[]){if(o!==void 0)break;o=i[0]?.message}r="on_chat_model_end"}else if(e.runType==="llm")o={generations:n?.map(i=>i.map(s=>({text:s.text,generationInfo:s.generationInfo}))),llmOutput:t.outputs?.llmOutput??{}},r="on_llm_end";else throw new Error(`onLLMEnd: Unexpected run type: ${e.runType}`);await this.sendEndEvent({event:r,data:{output:o,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async onChainStart(t){let e=ag(t),r=t.run_type??"chain",n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:t.run_type},o={};t.inputs.input===""&&Object.keys(t.inputs).length===1?(o={},n.inputs={}):t.inputs.input!==void 0?(o.input=t.inputs.input,n.inputs=t.inputs.input):(o.input=t.inputs,n.inputs=t.inputs),this.runInfoMap.set(t.id,n),await this.send({event:`on_${r}_start`,data:o,name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onChainEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onChainEnd: Run ID ${t.id} not found in run map.`);let r=`on_${t.run_type}_end`,n=t.inputs??e.inputs??{},i={output:t.outputs?.output??t.outputs,input:n};n.input&&Object.keys(n).length===1&&(i.input=n.input,e.inputs=n.input),await this.sendEndEvent({event:r,data:i,run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata??{}},e)}async onToolStart(t){let e=ag(t),r={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:"tool",inputs:t.inputs??{}};this.runInfoMap.set(t.id,r),await this.send({event:"on_tool_start",data:{input:t.inputs??{}},name:e,run_id:t.id,tags:t.tags??[],metadata:t.extra?.metadata??{}},r)}async onToolEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onToolEnd: Run ID ${t.id} not found in run map.`);if(e.inputs===void 0)throw new Error(`onToolEnd: Run ID ${t.id} is a tool call, and is expected to have traced inputs.`);let r=t.outputs?.output===void 0?t.outputs:t.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:r,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async onRetrieverStart(t){let e=ag(t),n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:"retriever",inputs:{query:t.inputs.query}};this.runInfoMap.set(t.id,n),await this.send({event:"on_retriever_start",data:{input:{query:t.inputs.query}},name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onRetrieverEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onRetrieverEnd: Run ID ${t.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:t.outputs?.documents??t.outputs,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async handleCustomEvent(t,e,r){let n=this.runInfoMap.get(r);if(n===void 0)throw new Error(`handleCustomEvent: Run ID ${r} not found in run map.`);await this.send({event:"on_custom_event",run_id:r,name:t,tags:n.tags,metadata:n.metadata,data:e},n)}async finish(){let t=[...this.tappedPromises.values()];Promise.all(t).finally(()=>{this.writer.close()})}};var pV=Object.prototype.toString,fV=t=>pV.call(t)==="[object Error]",mV=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function VR(t){if(!(t&&fV(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:mV.has(r)}function hV(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function cg(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(_),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},_=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&_.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function Kd(t,e={}){if(e={...e},hV(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,cg("factor",e.factor,{min:0,allowInfinity:!1}),cg("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),cg("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),cg("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await yV({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var ug=mn(Sh(),1),vV={};G(vV,{AsyncCaller:()=>Xo});var bV=[400,401,402,403,404,405,406,407,409],wV=t=>{if(t.message.startsWith("Cancel")||t.message.startsWith("AbortError")||t.name==="AbortError"||t?.code==="ECONNABORTED")throw t;let e=t?.response?.status??t?.status;if(e&&bV.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},Xo=class{maxConcurrency;maxRetries;onFailedAttempt;queue;constructor(t){this.maxConcurrency=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??6,this.onFailedAttempt=t.onFailedAttempt??wV;let e="default"in ug.default?ug.default.default:ug.default;this.queue=new e({concurrency:this.maxConcurrency})}async call(t,...e){return this.queue.add(()=>Kd(()=>t(...e).catch(r=>{throw r instanceof Error?r:new Error(r)}),{onFailedAttempt:({error:r})=>this.onFailedAttempt?.(r),retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(t,e,...r){if(t.signal){let n;return Promise.race([this.call(e,...r),new Promise((o,i)=>{n=()=>{i(Bi(t.signal))},t.signal?.addEventListener("abort",n)})]).finally(()=>{t.signal&&n&&t.signal.removeEventListener("abort",n)})}return this.call(e,...r)}fetch(...t){return this.call(()=>fetch(...t).then(e=>e.ok?e:Promise.reject(e)))}};var y0=class extends Un{name="RootListenersTracer";rootId;config;argOnStart;argOnEnd;argOnError;constructor({config:t,onStart:e,onEnd:r,onError:n}){super({_awaitHandler:!0}),this.config=t,this.argOnStart=e,this.argOnEnd=r,this.argOnError=n}persistRun(t){return Promise.resolve()}async onRunCreate(t){this.rootId||(this.rootId=t.id,this.argOnStart&&await this.argOnStart(t,this.config))}async onRunUpdate(t){t.id===this.rootId&&(t.error?this.argOnError&&await this.argOnError(t,this.config):this.argOnEnd&&await this.argOnEnd(t,this.config))}};function Hd(t){return t?t.lc_runnable:!1}var KR=class{includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;constructor(t){this.includeNames=t.includeNames,this.includeTypes=t.includeTypes,this.includeTags=t.includeTags,this.excludeNames=t.excludeNames,this.excludeTypes=t.excludeTypes,this.excludeTags=t.excludeTags}includeEvent(t,e){let r=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,n=t.tags??[];return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(e)),this.includeTags!==void 0&&(r=r||n.some(o=>this.includeTags?.includes(o))),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(e)),this.excludeTags!==void 0&&(r=r&&n.every(o=>!this.excludeTags?.includes(o))),r}},HR=t=>btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");var nn={};gi(nn,{$ZodAny:()=>a_,$ZodArray:()=>l_,$ZodAsyncError:()=>Fn,$ZodBase64:()=>Xg,$ZodBase64URL:()=>Yg,$ZodBigInt:()=>cp,$ZodBigIntFormat:()=>n_,$ZodBoolean:()=>ku,$ZodCIDRv4:()=>Wg,$ZodCIDRv6:()=>Jg,$ZodCUID:()=>jg,$ZodCUID2:()=>Dg,$ZodCatch:()=>S_,$ZodCheck:()=>Je,$ZodCheckBigIntFormat:()=>s$,$ZodCheckEndsWith:()=>y$,$ZodCheckGreaterThan:()=>Sg,$ZodCheckIncludes:()=>g$,$ZodCheckLengthEquals:()=>p$,$ZodCheckLessThan:()=>Ig,$ZodCheckLowerCase:()=>m$,$ZodCheckMaxLength:()=>l$,$ZodCheckMaxSize:()=>a$,$ZodCheckMimeType:()=>b$,$ZodCheckMinLength:()=>d$,$ZodCheckMinSize:()=>c$,$ZodCheckMultipleOf:()=>o$,$ZodCheckNumberFormat:()=>i$,$ZodCheckOverwrite:()=>w$,$ZodCheckProperty:()=>v$,$ZodCheckRegex:()=>f$,$ZodCheckSizeEquals:()=>u$,$ZodCheckStartsWith:()=>_$,$ZodCheckStringFormat:()=>Su,$ZodCheckUpperCase:()=>h$,$ZodCodec:()=>Au,$ZodCustom:()=>R_,$ZodCustomStringFormat:()=>t_,$ZodDate:()=>u_,$ZodDefault:()=>w_,$ZodDiscriminatedUnion:()=>d_,$ZodE164:()=>Qg,$ZodEmail:()=>Rg,$ZodEmoji:()=>zg,$ZodEncodeError:()=>Gi,$ZodEnum:()=>g_,$ZodError:()=>np,$ZodFile:()=>y_,$ZodFunction:()=>O_,$ZodGUID:()=>Pg,$ZodIPv4:()=>Gg,$ZodIPv6:()=>Kg,$ZodISODate:()=>Zg,$ZodISODateTime:()=>Bg,$ZodISODuration:()=>Vg,$ZodISOTime:()=>qg,$ZodIntersection:()=>p_,$ZodJWT:()=>e_,$ZodKSUID:()=>Fg,$ZodLazy:()=>C_,$ZodLiteral:()=>__,$ZodMAC:()=>Hg,$ZodMap:()=>m_,$ZodNaN:()=>k_,$ZodNanoID:()=>Mg,$ZodNever:()=>Eu,$ZodNonOptional:()=>$_,$ZodNull:()=>s_,$ZodNullable:()=>b_,$ZodNumber:()=>ap,$ZodNumberFormat:()=>r_,$ZodObject:()=>S$,$ZodObjectJIT:()=>k$,$ZodOptional:()=>xa,$ZodPipe:()=>T_,$ZodPrefault:()=>x_,$ZodPromise:()=>P_,$ZodReadonly:()=>E_,$ZodRealError:()=>Rr,$ZodRecord:()=>f_,$ZodRegistry:()=>Pu,$ZodSet:()=>h_,$ZodString:()=>Yi,$ZodStringFormat:()=>He,$ZodSuccess:()=>I_,$ZodSymbol:()=>o_,$ZodTemplateLiteral:()=>A_,$ZodTransform:()=>v_,$ZodTuple:()=>lp,$ZodType:()=>ye,$ZodULID:()=>Lg,$ZodURL:()=>Ng,$ZodUUID:()=>Cg,$ZodUndefined:()=>i_,$ZodUnion:()=>up,$ZodUnknown:()=>Tu,$ZodVoid:()=>c_,$ZodXID:()=>Ug,$brand:()=>Jd,$constructor:()=>$,$input:()=>D_,$output:()=>j_,Doc:()=>sp,JSONSchema:()=>$z,JSONSchemaGenerator:()=>zp,NEVER:()=>lg,TimePrecision:()=>B_,_any:()=>uy,_array:()=>T$,_base64:()=>Op,_base64url:()=>Pp,_bigint:()=>ry,_boolean:()=>ey,_catch:()=>j5,_check:()=>xz,_cidrv4:()=>Ep,_cidrv6:()=>Ap,_coercedBigint:()=>ny,_coercedBoolean:()=>ty,_coercedDate:()=>py,_coercedNumber:()=>H_,_coercedString:()=>U_,_cuid:()=>wp,_cuid2:()=>xp,_custom:()=>by,_date:()=>dy,_decode:()=>gg,_decodeAsync:()=>yg,_default:()=>N5,_discriminatedUnion:()=>x5,_e164:()=>Cp,_email:()=>mp,_emoji:()=>vp,_encode:()=>hg,_encodeAsync:()=>_g,_endsWith:()=>Bu,_enum:()=>E5,_file:()=>vy,_float32:()=>J_,_float64:()=>X_,_gt:()=>yo,_gte:()=>ir,_guid:()=>Cu,_includes:()=>Uu,_int:()=>W_,_int32:()=>Y_,_int64:()=>oy,_intersection:()=>$5,_ipv4:()=>kp,_ipv6:()=>Tp,_isoDate:()=>q_,_isoDateTime:()=>Z_,_isoDuration:()=>G_,_isoTime:()=>V_,_jwt:()=>Rp,_ksuid:()=>Sp,_lazy:()=>F5,_length:()=>Sa,_literal:()=>O5,_lowercase:()=>Du,_lt:()=>_o,_lte:()=>zr,_mac:()=>F_,_map:()=>k5,_max:()=>zr,_maxLength:()=>Ia,_maxSize:()=>$a,_mime:()=>Zu,_min:()=>ir,_minLength:()=>Qo,_minSize:()=>es,_multipleOf:()=>Qi,_nan:()=>fy,_nanoid:()=>bp,_nativeEnum:()=>A5,_negative:()=>hy,_never:()=>zu,_nonnegative:()=>_y,_nonoptional:()=>z5,_nonpositive:()=>gy,_normalize:()=>qu,_null:()=>cy,_nullable:()=>R5,_number:()=>K_,_optional:()=>C5,_overwrite:()=>Zn,_parse:()=>bu,_parseAsync:()=>wu,_pipe:()=>D5,_positive:()=>my,_promise:()=>B5,_property:()=>yy,_readonly:()=>L5,_record:()=>S5,_refine:()=>wy,_regex:()=>ju,_safeDecode:()=>bg,_safeDecodeAsync:()=>xg,_safeEncode:()=>vg,_safeEncodeAsync:()=>wg,_safeParse:()=>xu,_safeParseAsync:()=>$u,_set:()=>T5,_size:()=>Mu,_slugify:()=>Np,_startsWith:()=>Fu,_string:()=>L_,_stringFormat:()=>ka,_stringbool:()=>Sy,_success:()=>M5,_superRefine:()=>xy,_symbol:()=>sy,_templateLiteral:()=>U5,_toLowerCase:()=>Gu,_toUpperCase:()=>Ku,_transform:()=>P5,_trim:()=>Vu,_tuple:()=>I5,_uint32:()=>Q_,_uint64:()=>iy,_ulid:()=>$p,_undefined:()=>ay,_union:()=>w5,_unknown:()=>Nu,_uppercase:()=>Lu,_url:()=>Ru,_uuid:()=>hp,_uuidv4:()=>gp,_uuidv6:()=>_p,_uuidv7:()=>yp,_void:()=>ly,_xid:()=>Ip,clone:()=>Qe,config:()=>yt,decode:()=>tN,decodeAsync:()=>nN,describe:()=>$y,encode:()=>eN,encodeAsync:()=>rN,flattenError:()=>yu,formatError:()=>vu,globalConfig:()=>Wd,globalRegistry:()=>Ge,isValidBase64:()=>I$,isValidBase64URL:()=>IN,isValidJWT:()=>SN,locales:()=>Ou,meta:()=>Iy,parse:()=>Bn,parseAsync:()=>Yo,prettifyError:()=>mg,regexes:()=>Nr,registry:()=>fp,safeDecode:()=>iN,safeDecodeAsync:()=>aN,safeEncode:()=>oN,safeEncodeAsync:()=>sN,safeParse:()=>ba,safeParseAsync:()=>Iu,toDotPath:()=>QR,toJSONSchema:()=>vo,treeifyError:()=>fg,util:()=>M,version:()=>x$});var lg=Object.freeze({status:"aborted"});function $(t,e,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let u=s.prototype,l=Object.keys(u);for(let d=0;dr?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var Jd=Symbol("zod_brand"),Fn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Gi=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Wd={};function yt(t){return t&&Object.assign(Wd,t),Wd}var M={};gi(M,{BIGINT_FORMAT_RANGES:()=>E0,Class:()=>b0,NUMBER_FORMAT_RANGES:()=>T0,aborted:()=>Xi,allowsEval:()=>$0,assert:()=>kV,assertEqual:()=>xV,assertIs:()=>IV,assertNever:()=>SV,assertNotEqual:()=>$V,assignProp:()=>Hi,base64ToUint8Array:()=>JR,base64urlToUint8Array:()=>ZV,cached:()=>gu,captureStackTrace:()=>pg,cleanEnum:()=>BV,cleanRegex:()=>Qd,clone:()=>Qe,cloneDef:()=>EV,createTransparentProxy:()=>NV,defineLazy:()=>Me,esc:()=>dg,escapeRegex:()=>bn,extend:()=>jV,finalizeIssue:()=>rn,floatSafeRemainder:()=>w0,getElementAtPath:()=>AV,getEnumValues:()=>Yd,getLengthableOrigin:()=>rp,getParsedType:()=>RV,getSizableOrigin:()=>tp,hexToUint8Array:()=>VV,isObject:()=>va,isPlainObject:()=>Ji,issue:()=>_u,joinValues:()=>E,jsonStringifyReplacer:()=>hu,merge:()=>LV,mergeDefs:()=>Wi,normalizeParams:()=>D,nullish:()=>Ki,numKeys:()=>CV,objectClone:()=>TV,omit:()=>MV,optionalKeys:()=>k0,partial:()=>UV,pick:()=>zV,prefixIssues:()=>tn,primitiveTypes:()=>S0,promiseAllObject:()=>OV,propertyKeyTypes:()=>ep,randomString:()=>PV,required:()=>FV,safeExtend:()=>DV,shallowClone:()=>I0,slugify:()=>x0,stringifyPrimitive:()=>j,uint8ArrayToBase64:()=>XR,uint8ArrayToBase64url:()=>qV,uint8ArrayToHex:()=>GV,unwrapMessage:()=>Xd});function xV(t){return t}function $V(t){return t}function IV(t){}function SV(t){throw new Error}function kV(t){}function Yd(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function E(t,e="|"){return t.map(r=>j(r)).join(e)}function hu(t,e){return typeof e=="bigint"?e.toString():e}function gu(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ki(t){return t==null}function Qd(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function w0(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,s=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return s%a/10**i}var WR=Symbol("evaluating");function Me(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==WR)return n===void 0&&(n=WR,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function TV(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Hi(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Wi(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function EV(t){return Wi(t._zod.def)}function AV(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function OV(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i{};function va(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var $0=gu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Ji(t){if(va(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(va(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function I0(t){return Ji(t)?{...t}:Array.isArray(t)?[...t]:t}function CV(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var RV=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},ep=new Set(["string","number","symbol"]),S0=new Set(["string","number","bigint","boolean","symbol","undefined"]);function bn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qe(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function D(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function NV(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function j(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function k0(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var T0={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},E0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zV(t,e){let r=t._zod.def,n=Wi(t._zod.def,{get shape(){let o={};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&(o[i]=r.shape[i])}return Hi(this,"shape",o),o},checks:[]});return Qe(t,n)}function MV(t,e){let r=t._zod.def,n=Wi(t._zod.def,{get shape(){let o={...t._zod.def.shape};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&delete o[i]}return Hi(this,"shape",o),o},checks:[]});return Qe(t,n)}function jV(t,e){if(!Ji(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let o=Wi(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return Hi(this,"shape",i),i},checks:[]});return Qe(t,o)}function DV(t,e){if(!Ji(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return Hi(this,"shape",n),n},checks:t._zod.def.checks};return Qe(t,r)}function LV(t,e){let r=Wi(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return Hi(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Qe(t,r)}function UV(t,e,r){let n=Wi(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=t?new t({type:"optional",innerType:o[s]}):o[s])}else for(let s in o)i[s]=t?new t({type:"optional",innerType:o[s]}):o[s];return Hi(this,"shape",i),i},checks:[]});return Qe(e,n)}function FV(t,e,r){let n=Wi(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new t({type:"nonoptional",innerType:o[s]}))}else for(let s in o)i[s]=new t({type:"nonoptional",innerType:o[s]});return Hi(this,"shape",i),i},checks:[]});return Qe(e,n)}function Xi(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Xd(t){return typeof t=="string"?t:t?.message}function rn(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=Xd(t.inst?._zod.def?.error?.(t))??Xd(e?.error?.(t))??Xd(r.customError?.(t))??Xd(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function tp(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function rp(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function _u(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function BV(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function JR(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;ne.toString(16).padStart(2,"0")).join("")}var b0=class{constructor(...e){}};var YR=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,hu,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},np=$("$ZodError",YR),Rr=$("$ZodError",YR,{Parent:Error});function yu(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function vu(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>n({issues:s}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let s=r,a=0;for(;ar.message){let r={errors:[]},n=(o,i=[])=>{var s,a;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>n({issues:u},c.path));else if(c.code==="invalid_key")n({issues:c.issues},c.path);else if(c.code==="invalid_element")n({issues:c.issues},c.path);else{let u=[...i,...c.path];if(u.length===0){r.errors.push(e(c));continue}let l=r,d=0;for(;dtypeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function mg(t){let e=[],r=[...t.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${QR(n.path)}`);return e.join(` +`)}var bu=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Fn;if(s.issues.length){let a=new(o?.Err??t)(s.issues.map(c=>rn(c,i,yt())));throw pg(a,o?.callee),a}return s.value},Bn=bu(Rr),wu=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(o?.Err??t)(s.issues.map(c=>rn(c,i,yt())));throw pg(a,o?.callee),a}return s.value},Yo=wu(Rr),xu=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Fn;return i.issues.length?{success:!1,error:new(t??np)(i.issues.map(s=>rn(s,o,yt())))}:{success:!0,data:i.value}},ba=xu(Rr),$u=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(s=>rn(s,o,yt())))}:{success:!0,data:i.value}},Iu=$u(Rr),hg=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return bu(t)(e,r,o)},eN=hg(Rr),gg=t=>(e,r,n)=>bu(t)(e,r,n),tN=gg(Rr),_g=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wu(t)(e,r,o)},rN=_g(Rr),yg=t=>async(e,r,n)=>wu(t)(e,r,n),nN=yg(Rr),vg=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return xu(t)(e,r,o)},oN=vg(Rr),bg=t=>(e,r,n)=>xu(t)(e,r,n),iN=bg(Rr),wg=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return $u(t)(e,r,o)},sN=wg(Rr),xg=t=>async(e,r,n)=>$u(t)(e,r,n),aN=xg(Rr);var Nr={};gi(Nr,{base64:()=>q0,base64url:()=>$g,bigint:()=>J0,boolean:()=>Q0,browserEmail:()=>t3,cidrv4:()=>B0,cidrv6:()=>Z0,cuid:()=>A0,cuid2:()=>O0,date:()=>G0,datetime:()=>H0,domain:()=>o3,duration:()=>z0,e164:()=>V0,email:()=>j0,emoji:()=>D0,extendedDuration:()=>HV,guid:()=>M0,hex:()=>i3,hostname:()=>n3,html5Email:()=>YV,idnEmail:()=>e3,integer:()=>X0,ipv4:()=>L0,ipv6:()=>U0,ksuid:()=>R0,lowercase:()=>r$,mac:()=>F0,md5_base64:()=>a3,md5_base64url:()=>c3,md5_hex:()=>s3,nanoid:()=>N0,null:()=>e$,number:()=>Y0,rfc5322Email:()=>QV,sha1_base64:()=>l3,sha1_base64url:()=>d3,sha1_hex:()=>u3,sha256_base64:()=>f3,sha256_base64url:()=>m3,sha256_hex:()=>p3,sha384_base64:()=>g3,sha384_base64url:()=>_3,sha384_hex:()=>h3,sha512_base64:()=>v3,sha512_base64url:()=>b3,sha512_hex:()=>y3,string:()=>W0,time:()=>K0,ulid:()=>P0,undefined:()=>t$,unicodeEmail:()=>cN,uppercase:()=>n$,uuid:()=>wa,uuid4:()=>WV,uuid6:()=>JV,uuid7:()=>XV,xid:()=>C0});var A0=/^[cC][^\s-]{8,}$/,O0=/^[0-9a-z]+$/,P0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,C0=/^[0-9a-vA-V]{20}$/,R0=/^[A-Za-z0-9]{27}$/,N0=/^[a-zA-Z0-9_-]{21}$/,z0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,HV=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,M0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,wa=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,WV=wa(4),JV=wa(6),XV=wa(7),j0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,YV=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,QV=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,cN=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,e3=cN,t3=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,r3="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function D0(){return new RegExp(r3,"u")}var L0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,U0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,F0=t=>{let e=bn(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},B0=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Z0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,q0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$g=/^[A-Za-z0-9_-]*$/,n3=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,o3=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,V0=/^\+(?:[0-9]){6,14}[0-9]$/,uN="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",G0=new RegExp(`^${uN}$`);function lN(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function K0(t){return new RegExp(`^${lN(t)}$`)}function H0(t){let e=lN({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${uN}T(?:${n})$`)}var W0=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},J0=/^-?\d+n?$/,X0=/^-?\d+$/,Y0=/^-?\d+(?:\.\d+)?/,Q0=/^(?:true|false)$/i,e$=/^null$/i;var t$=/^undefined$/i;var r$=/^[^A-Z]*$/,n$=/^[^a-z]*$/,i3=/^[0-9a-fA-F]*$/;function op(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function ip(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var s3=/^[0-9a-fA-F]{32}$/,a3=op(22,"=="),c3=ip(22),u3=/^[0-9a-fA-F]{40}$/,l3=op(27,"="),d3=ip(27),p3=/^[0-9a-fA-F]{64}$/,f3=op(43,"="),m3=ip(43),h3=/^[0-9a-fA-F]{96}$/,g3=op(64,""),_3=ip(64),y3=/^[0-9a-fA-F]{128}$/,v3=op(86,"=="),b3=ip(86);var Je=$("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),pN={number:"number",bigint:"bigint",object:"date"},Ig=$("$ZodCheckLessThan",(t,e)=>{Je.init(t,e);let r=pN[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?n.value<=e.value:n.value{Je.init(t,e);let r=pN[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),o$=$("$ZodCheckMultipleOf",(t,e)=>{Je.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):w0(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),i$=$("$ZodCheckNumberFormat",(t,e)=>{Je.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=T0[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=o,a.maximum=i,r&&(a.pattern=X0)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}ai&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:t})}}),s$=$("$ZodCheckBigIntFormat",(t,e)=>{Je.init(t,e);let[r,n]=E0[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;in&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inst:t})}}),a$=$("$ZodCheckMaxSize",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=n.value;o.size<=e.maximum||n.issues.push({origin:tp(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),c$=$("$ZodCheckMinSize",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:tp(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),u$=$("$ZodCheckSizeEquals",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let s=i>e.size;n.issues.push({origin:tp(o),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),l$=$("$ZodCheckMaxLength",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=n.value;if(o.length<=e.maximum)return;let s=rp(o);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),d$=$("$ZodCheckMinLength",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let s=rp(o);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),p$=$("$ZodCheckLengthEquals",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let s=rp(o),a=i>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Su=$("$ZodCheckStringFormat",(t,e)=>{var r,n;Je.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),f$=$("$ZodCheckRegex",(t,e)=>{Su.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),m$=$("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=r$),Su.init(t,e)}),h$=$("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=n$),Su.init(t,e)}),g$=$("$ZodCheckIncludes",(t,e)=>{Je.init(t,e);let r=bn(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),_$=$("$ZodCheckStartsWith",(t,e)=>{Je.init(t,e);let r=new RegExp(`^${bn(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),y$=$("$ZodCheckEndsWith",(t,e)=>{Je.init(t,e);let r=new RegExp(`.*${bn(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function dN(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues))}var v$=$("$ZodCheckProperty",(t,e)=>{Je.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>dN(o,r,e.property));dN(n,r,e.property)}}),b$=$("$ZodCheckMimeType",(t,e)=>{Je.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),w$=$("$ZodCheckOverwrite",(t,e)=>{Je.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var sp=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(` +`).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,o.join(` +`))}};var x$={major:4,minor:1,patch:13};var ye=$("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=x$;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(s,a,c)=>{let u=Xi(s),l;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(u)continue;let f=s.issues.length,p=d._zod.check(s);if(p instanceof Promise&&c?.async===!1)throw new Fn;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,s.issues.length!==f&&(u||(u=Xi(s,f)))});else{if(s.issues.length===f)continue;u||(u=Xi(s,f))}}return l?l.then(()=>s):s},i=(s,a,c)=>{if(Xi(s))return s.aborted=!0,s;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new Fn;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let u=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,s,a)):i(u,s,a)}let c=t._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Fn;return c.then(u=>o(u,n,a))}return o(c,n,a)}}t["~standard"]={validate:o=>{try{let i=ba(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Iu(t,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),Yi=$("$ZodString",(t,e)=>{ye.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??W0(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),He=$("$ZodStringFormat",(t,e)=>{Su.init(t,e),Yi.init(t,e)}),Pg=$("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=M0),He.init(t,e)}),Cg=$("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=wa(n))}else e.pattern??(e.pattern=wa());He.init(t,e)}),Rg=$("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=j0),He.init(t,e)}),Ng=$("$ZodURL",(t,e)=>{He.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),zg=$("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=D0()),He.init(t,e)}),Mg=$("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=N0),He.init(t,e)}),jg=$("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=A0),He.init(t,e)}),Dg=$("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=O0),He.init(t,e)}),Lg=$("$ZodULID",(t,e)=>{e.pattern??(e.pattern=P0),He.init(t,e)}),Ug=$("$ZodXID",(t,e)=>{e.pattern??(e.pattern=C0),He.init(t,e)}),Fg=$("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=R0),He.init(t,e)}),Bg=$("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=H0(e)),He.init(t,e)}),Zg=$("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=G0),He.init(t,e)}),qg=$("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=K0(e)),He.init(t,e)}),Vg=$("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=z0),He.init(t,e)}),Gg=$("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=L0),He.init(t,e),t._zod.bag.format="ipv4"}),Kg=$("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=U0),He.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Hg=$("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=F0(e.delimiter)),He.init(t,e),t._zod.bag.format="mac"}),Wg=$("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=B0),He.init(t,e)}),Jg=$("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Z0),He.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function I$(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Xg=$("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=q0),He.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{I$(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function IN(t){if(!$g.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return I$(r)}var Yg=$("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=$g),He.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{IN(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Qg=$("$ZodE164",(t,e)=>{e.pattern??(e.pattern=V0),He.init(t,e)});function SN(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var e_=$("$ZodJWT",(t,e)=>{He.init(t,e),t._zod.check=r=>{SN(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),t_=$("$ZodCustomStringFormat",(t,e)=>{He.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),ap=$("$ZodNumber",(t,e)=>{ye.init(t,e),t._zod.pattern=t._zod.bag.pattern??Y0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),r_=$("$ZodNumberFormat",(t,e)=>{i$.init(t,e),ap.init(t,e)}),ku=$("$ZodBoolean",(t,e)=>{ye.init(t,e),t._zod.pattern=Q0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),cp=$("$ZodBigInt",(t,e)=>{ye.init(t,e),t._zod.pattern=J0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),n_=$("$ZodBigIntFormat",(t,e)=>{s$.init(t,e),cp.init(t,e)}),o_=$("$ZodSymbol",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),i_=$("$ZodUndefined",(t,e)=>{ye.init(t,e),t._zod.pattern=t$,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),s_=$("$ZodNull",(t,e)=>{ye.init(t,e),t._zod.pattern=e$,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),a_=$("$ZodAny",(t,e)=>{ye.init(t,e),t._zod.parse=r=>r}),Tu=$("$ZodUnknown",(t,e)=>{ye.init(t,e),t._zod.parse=r=>r}),Eu=$("$ZodNever",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),c_=$("$ZodVoid",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),u_=$("$ZodDate",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});function mN(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues)),e.value[r]=t.value}var l_=$("$ZodArray",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let s=0;smN(u,r,s))):mN(c,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function Og(t,e,r,n){t.issues.length&&e.issues.push(...tn(r,t.issues)),t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function kN(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=k0(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function TN(t,e,r,n,o,i){let s=[],a=o.keySet,c=o.catchall._zod,u=c.def.type;for(let l in e){if(a.has(l))continue;if(u==="never"){s.push(l);continue}let d=c.run({value:e[l],issues:[]},n);d instanceof Promise?t.push(d.then(f=>Og(f,r,l,e))):Og(d,r,l,e)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var S$=$("$ZodObject",(t,e)=>{if(ye.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=gu(()=>kN(e));Me(t._zod,"propValues",()=>{let a=e.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=va,i=e.catchall,s;t._zod.parse=(a,c)=>{s??(s=n.value);let u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),a;a.value={};let l=[],d=s.shape;for(let f of s.keys){let m=d[f]._zod.run({value:u[f],issues:[]},c);m instanceof Promise?l.push(m.then(h=>Og(h,a,f,u))):Og(m,a,f,u)}return i?TN(l,u,a,c,n.value,t):l.length?Promise.all(l).then(()=>a):a}}),k$=$("$ZodObjectJIT",(t,e)=>{S$.init(t,e);let r=t._zod.parse,n=gu(()=>kN(e)),o=f=>{let p=new sp(["shape","payload","ctx"]),m=n.value,h=x=>{let k=dg(x);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};p.write("const input = payload.value;");let _=Object.create(null),v=0;for(let x of m.keys)_[x]=`key_${v++}`;p.write("const newResult = {};");for(let x of m.keys){let k=_[x],T=dg(x);p.write(`const ${k} = ${h(x)};`),p.write(` + if (${k}.issues.length) { + payload.issues = payload.issues.concat(${k}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${T}, ...iss.path] : [${T}] + }))); + } + + + if (${k}.value === undefined) { + if (${T} in input) { + newResult[${T}] = undefined; + } + } else { + newResult[${T}] = ${k}.value; + } + + `)}p.write("payload.value = newResult;"),p.write("return payload;");let b=p.compile();return(x,k)=>b(f,x,k)},i,s=va,a=!Wd.jitless,u=a&&$0.value,l=e.catchall,d;t._zod.parse=(f,p)=>{d??(d=n.value);let m=f.value;return s(m)?a&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(e.shape)),f=i(f,p),l?TN([],m,f,p,d,t):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function hN(t,e,r,n){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let o=t.filter(i=>!Xi(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(s=>rn(s,n,yt())))}),e)}var up=$("$ZodUnion",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Me(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Me(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),Me(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Qd(i.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1,a=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}return s?Promise.all(a).then(c=>hN(c,o,t,i)):hN(a,o,t,i)}}),d_=$("$ZodDiscriminatedUnion",(t,e)=>{up.init(t,e);let r=t._zod.parse;Me(t._zod,"propValues",()=>{let o={};for(let i of e.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=gu(()=>{let o=e.options,i=new Map;for(let s of o){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});t._zod.parse=(o,i)=>{let s=o.value;if(!va(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),o;let a=n.value.get(s?.[e.discriminator]);return a?a._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:s,path:[e.discriminator],inst:t}),o)}}),p_=$("$ZodIntersection",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),s=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>gN(r,c,u)):gN(r,i,s)}});function $$(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Ji(t)&&Ji(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let s=$$(t[i],e[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n{ye.init(t,e);let r=e.items;t._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let s=[],a=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=a===-1?0:r.length-a;if(!e.rest){let l=i.length>r.length,d=i.length=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?s.push(d.then(f=>kg(f,n,u))):kg(d,n,u)}if(e.rest){let l=i.slice(r.length);for(let d of l){u++;let f=e.rest._zod.run({value:d,issues:[]},o);f instanceof Promise?s.push(f.then(p=>kg(p,n,u))):kg(f,n,u)}}return s.length?Promise.all(s).then(()=>n):n}});function kg(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues)),e.value[r]=t.value}var f_=$("$ZodRecord",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Ji(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...tn(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...tn(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let c=e.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(l=>rn(l,n,yt())),input:a,path:[a],inst:t}),r.value[c.value]=c.value;continue}let u=e.valueType._zod.run({value:o[a],issues:[]},n);u instanceof Promise?i.push(u.then(l=>{l.issues.length&&r.issues.push(...tn(a,l.issues)),r.value[c.value]=l.value})):(u.issues.length&&r.issues.push(...tn(a,u.issues)),r.value[c.value]=u.value)}}return i.length?Promise.all(i).then(()=>r):r}}),m_=$("$ZodMap",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[s,a]of o){let c=e.keyType._zod.run({value:s,issues:[]},n),u=e.valueType._zod.run({value:a,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{_N(l,d,r,s,o,t,n)})):_N(c,u,r,s,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});function _N(t,e,r,n,o,i,s){t.issues.length&&(ep.has(typeof n)?r.issues.push(...tn(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(a=>rn(a,s,yt()))})),e.issues.length&&(ep.has(typeof n)?r.issues.push(...tn(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(a=>rn(a,s,yt()))})),r.value.set(t.value,e.value)}var h_=$("$ZodSet",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of o){let a=e.valueType._zod.run({value:s,issues:[]},n);a instanceof Promise?i.push(a.then(c=>yN(c,r))):yN(a,r)}return i.length?Promise.all(i).then(()=>r):r}});function yN(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var g_=$("$ZodEnum",(t,e)=>{ye.init(t,e);let r=Yd(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>ep.has(typeof o)).map(o=>typeof o=="string"?bn(o):o.toString()).join("|")})$`),t._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:t}),o}}),__=$("$ZodLiteral",(t,e)=>{if(ye.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?bn(n):n?bn(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),y_=$("$ZodFile",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),v_=$("$ZodTransform",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new Fn;return r.value=o,r}});function vN(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var xa=$("$ZodOptional",(t,e)=>{ye.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Me(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Me(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qd(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>vN(i,r.value)):vN(o,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),b_=$("$ZodNullable",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.innerType._zod.optin),Me(t._zod,"optout",()=>e.innerType._zod.optout),Me(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qd(r.source)}|null)$`):void 0}),Me(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),w_=$("$ZodDefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>bN(i,e)):bN(o,e)}});function bN(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var x_=$("$ZodPrefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),$_=$("$ZodNonOptional",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>wN(i,t)):wN(o,t)}});function wN(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var I_=$("$ZodSuccess",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi("ZodSuccess");let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),S_=$("$ZodCatch",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.innerType._zod.optin),Me(t._zod,"optout",()=>e.innerType._zod.optout),Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(s=>rn(s,n,yt()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>rn(i,n,yt()))},input:r.value}),r.issues=[]),r)}}),k_=$("$ZodNaN",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),T_=$("$ZodPipe",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>e.in._zod.values),Me(t._zod,"optin",()=>e.in._zod.optin),Me(t._zod,"optout",()=>e.out._zod.optout),Me(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Tg(s,e.in,n)):Tg(i,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Tg(i,e.out,n)):Tg(o,e.out,n)}});function Tg(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var Au=$("$ZodCodec",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>e.in._zod.values),Me(t._zod,"optin",()=>e.in._zod.optin),Me(t._zod,"optout",()=>e.out._zod.optout),Me(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(s=>Eg(s,e,n)):Eg(i,e,n)}else{let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Eg(s,e,n)):Eg(i,e,n)}}});function Eg(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(i=>Ag(t,i,e.out,r)):Ag(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(i=>Ag(t,i,e.in,r)):Ag(t,o,e.in,r)}}function Ag(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}var E_=$("$ZodReadonly",(t,e)=>{ye.init(t,e),Me(t._zod,"propValues",()=>e.innerType._zod.propValues),Me(t._zod,"values",()=>e.innerType._zod.values),Me(t._zod,"optin",()=>e.innerType?._zod?.optin),Me(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(xN):xN(o)}});function xN(t){return t.value=Object.freeze(t.value),t}var A_=$("$ZodTemplateLiteral",(t,e)=>{ye.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,s=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,s))}else if(n===null||S0.has(typeof n))r.push(bn(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"template_literal",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),O_=$("$ZodFunction",(t,e)=>(ye.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=t._def.input?Bn(t._def.input,n):n,i=Reflect.apply(r,this,o);return t._def.output?Bn(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=t._def.input?await Yo(t._def.input,n):n,i=await Reflect.apply(r,this,o);return t._def.output?await Yo(t._def.output,i):i}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new lp({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),P_=$("$ZodPromise",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),C_=$("$ZodLazy",(t,e)=>{ye.init(t,e),Me(t._zod,"innerType",()=>e.getter()),Me(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),Me(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),Me(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),Me(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),R_=$("$ZodCustom",(t,e)=>{Je.init(t,e),ye.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>$N(i,r,n,t));$N(o,r,n,t)}});function $N(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(_u(o))}}var Ou={};gi(Ou,{ar:()=>EN,az:()=>AN,be:()=>PN,bg:()=>CN,ca:()=>RN,cs:()=>NN,da:()=>zN,de:()=>MN,en:()=>N_,eo:()=>jN,es:()=>DN,fa:()=>LN,fi:()=>UN,fr:()=>FN,frCA:()=>BN,he:()=>ZN,hu:()=>qN,id:()=>VN,is:()=>GN,it:()=>KN,ja:()=>HN,ka:()=>WN,kh:()=>JN,km:()=>z_,ko:()=>XN,lt:()=>QN,mk:()=>ez,ms:()=>tz,nl:()=>rz,no:()=>nz,ota:()=>oz,pl:()=>sz,ps:()=>iz,pt:()=>az,ru:()=>uz,sl:()=>lz,sv:()=>dz,ta:()=>pz,th:()=>fz,tr:()=>mz,ua:()=>hz,uk:()=>M_,ur:()=>gz,vi:()=>_z,yo:()=>bz,zhCN:()=>yz,zhTW:()=>vz});var x3=()=>{let t={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return o=>{switch(o.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${j(o.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${o.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${n[i.format]??o.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${o.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${o.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${o.keys.length>1?"\u0629":""}: ${E(o.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function EN(){return{localeError:x3()}}var $3=()=>{let t={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o.expected}, daxil olan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${j(o.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${n[i.format]??o.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${o.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${o.keys.length>1?"lar":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${o.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function AN(){return{localeError:$3()}}function ON(t,e,r,n){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?n:i===1?e:i>=2&&i<=4?r:n}var I3=()=>{let t={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0456\u045E";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${j(o.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),c=ON(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${o.maximum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),c=ON(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${o.minimum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${o.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${o.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function PN(){return{localeError:I3()}}var S3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(t))return"\u043C\u0430\u0441\u0438\u0432";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},k3=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function e(n){return t[n]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"};return n=>{switch(n.code){case"invalid_type":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${S3(n.input)}`;case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${j(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.maximum.toString()} ${i.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.minimum.toString()} ${i.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;if(o.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${o.prefix}"`;if(o.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${o.suffix}"`;if(o.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${o.includes}"`;if(o.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${o.pattern}`;let i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return o.format==="emoji"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="datetime"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="date"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),o.format==="time"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="duration"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${i} ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${E(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function CN(){return{localeError:k3()}}var T3=()=>{let t={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${o.expected}, s'ha rebut ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Valor inv\xE0lid: s'esperava ${j(o.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${E(o.values," o ")}`;case"too_big":{let i=o.inclusive?"com a m\xE0xim":"menys de",s=e(o.origin);return s?`Massa gran: s'esperava que ${o.origin??"el valor"} contingu\xE9s ${i} ${o.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${o.origin??"el valor"} fos ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"com a m\xEDnim":"m\xE9s de",s=e(o.origin);return s?`Massa petit: s'esperava que ${o.origin} contingu\xE9s ${i} ${o.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${o.origin} fos ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${n[i.format]??o.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${o.divisor}`;case"unrecognized_keys":return`Clau${o.keys.length>1?"s":""} no reconeguda${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${o.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${o.origin}`;default:return"Entrada inv\xE0lida"}}};function RN(){return{localeError:T3()}}var E3=()=>{let t={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(o))return"pole";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return o=>{switch(o.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o.expected}, obdr\u017Eeno ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${j(o.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${n[i.format]??o.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${o.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${E(o.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${o.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${o.origin}`;default:return"Neplatn\xFD vstup"}}};function NN(){return{localeError:E3()}}var A3=()=>{let t={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},e={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};function r(s){return t[s]??null}function n(s){return e[s]??s}let o=s=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"tal";case"object":return Array.isArray(s)?"liste":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype&&s.constructor?s.constructor.name:"objekt"}return a},i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return s=>{switch(s.code){case"invalid_type":return`Ugyldigt input: forventede ${n(s.expected)}, fik ${n(o(s.input))}`;case"invalid_value":return s.values.length===1?`Ugyldig v\xE6rdi: forventede ${j(s.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${E(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=r(s.origin),u=n(s.origin);return c?`For stor: forventede ${u??"value"} ${c.verb} ${a} ${s.maximum.toString()} ${c.unit??"elementer"}`:`For stor: forventede ${u??"value"} havde ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=r(s.origin),u=n(s.origin);return c?`For lille: forventede ${u} ${c.verb} ${a} ${s.minimum.toString()} ${c.unit}`:`For lille: forventede ${u} havde ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Ugyldig streng: skal starte med "${a.prefix}"`:a.format==="ends_with"?`Ugyldig streng: skal ende med "${a.suffix}"`:a.format==="includes"?`Ugyldig streng: skal indeholde "${a.includes}"`:a.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${a.pattern}`:`Ugyldig ${i[a.format]??s.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${s.divisor}`;case"unrecognized_keys":return`${s.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${E(s.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${s.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${s.origin}`;default:return"Ugyldigt input"}}};function zN(){return{localeError:A3()}}var O3=()=>{let t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"Zahl";case"object":{if(Array.isArray(o))return"Array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return o=>{switch(o.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${o.expected}, erhalten ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ung\xFCltige Eingabe: erwartet ${j(o.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ist`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ist`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${o.divisor} sein`;case"unrecognized_keys":return`${o.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${o.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${o.origin}`;default:return"Ung\xFCltige Eingabe"}}};function MN(){return{localeError:O3()}}var P3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},C3=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${P3(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${j(n.values[0])}`:`Invalid option: expected one of ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function N_(){return{localeError:C3()}}var R3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"nombro";case"object":{if(Array.isArray(t))return"tabelo";if(t===null)return"senvalora";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},N3=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(n){return t[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return n=>{switch(n.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${n.expected}, ricevi\u011Dis ${R3(n.input)}`;case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${j(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()} ${i.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${o}${n.minimum.toString()} ${i.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${r[o.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function jN(){return{localeError:N3()}}var z3=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},e={string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};function r(s){return t[s]??null}function n(s){return e[s]??s}let o=s=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"number";case"object":return Array.isArray(s)?"array":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype?s.constructor.name:"object"}return a},i={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return s=>{switch(s.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${n(s.expected)}, recibido ${n(o(s.input))}`;case"invalid_value":return s.values.length===1?`Entrada inv\xE1lida: se esperaba ${j(s.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${E(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=r(s.origin),u=n(s.origin);return c?`Demasiado grande: se esperaba que ${u??"valor"} tuviera ${a}${s.maximum.toString()} ${c.unit??"elementos"}`:`Demasiado grande: se esperaba que ${u??"valor"} fuera ${a}${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=r(s.origin),u=n(s.origin);return c?`Demasiado peque\xF1o: se esperaba que ${u} tuviera ${a}${s.minimum.toString()} ${c.unit}`:`Demasiado peque\xF1o: se esperaba que ${u} fuera ${a}${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${a.prefix}"`:a.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${a.suffix}"`:a.format==="includes"?`Cadena inv\xE1lida: debe incluir "${a.includes}"`:a.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${a.pattern}`:`Inv\xE1lido ${i[a.format]??s.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${s.divisor}`;case"unrecognized_keys":return`Llave${s.keys.length>1?"s":""} desconocida${s.keys.length>1?"s":""}: ${E(s.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${n(s.origin)}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${n(s.origin)}`;default:return"Entrada inv\xE1lida"}}};function DN(){return{localeError:z3()}}var M3=()=>{let t={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0622\u0631\u0627\u06CC\u0647";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return o=>{switch(o.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${r(o.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":return o.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${j(o.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${E(o.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${n[i.format]??o.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${o.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${o.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${E(o.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${o.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${o.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function LN(){return{localeError:M3()}}var j3=()=>{let t={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return o=>{switch(o.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${o.expected}, oli ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${j(o.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${i}${o.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${i}${o.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${n[i.format]??o.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${o.divisor} monikerta`;case"unrecognized_keys":return`${o.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${E(o.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function UN(){return{localeError:j3()}}var D3=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombre";case"object":{if(Array.isArray(o))return"tableau";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : ${o.expected} attendu, ${r(o.input)} re\xE7u`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : ${j(o.values[0])} attendu`:`Option invalide : une valeur parmi ${E(o.values,"|")} attendue`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Trop grand : ${o.origin??"valeur"} doit ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o.origin??"valeur"} doit \xEAtre ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Trop petit : ${o.origin} doit ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Trop petit : ${o.origin} doit \xEAtre ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${E(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function FN(){return{localeError:D3()}}var L3=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${o.expected}, re\xE7u ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : attendu ${j(o.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u2264":"<",s=e(o.origin);return s?`Trop grand : attendu que ${o.origin??"la valeur"} ait ${i}${o.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${o.origin??"la valeur"} soit ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u2265":">",s=e(o.origin);return s?`Trop petit : attendu que ${o.origin} ait ${i}${o.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${o.origin} soit ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${E(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function BN(){return{localeError:L3()}}var U3=()=>{let t={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},e={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=u=>u?t[u]:void 0,n=u=>{let l=r(u);return l?l.label:u??t.unknown.label},o=u=>`\u05D4${n(u)}`,i=u=>(r(u)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",s=u=>u?e[u]??null:null,a=u=>{let l=typeof u;switch(l){case"number":return Number.isNaN(u)?"NaN":"number";case"object":return Array.isArray(u)?"array":u===null?"null":Object.getPrototypeOf(u)!==Object.prototype&&u.constructor?u.constructor.name:"object";default:return l}},c={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}};return u=>{switch(u.code){case"invalid_type":{let l=u.expected,d=n(l),f=a(u.input),p=t[f]?.label??f;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`}case"invalid_value":{if(u.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${j(u.values[0])}`;let l=u.values.map(p=>j(p));if(u.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l[0]} \u05D0\u05D5 ${l[1]}`;let d=l[l.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let l=s(u.origin),d=o(u.origin??"value");if(u.origin==="string")return`${l?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${u.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=u.inclusive?`${u.maximum} ${l?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${l?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?"<=":"<",p=i(u.origin??"value");return l?.unit?`${l.longLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()} ${l.unit}`:`${l?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()}`}case"too_small":{let l=s(u.origin),d=o(u.origin??"value");if(u.origin==="string")return`${l?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${u.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let _=(u.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${_}`}let h=u.inclusive?`${u.minimum} ${l?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${l?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?">=":">",p=i(u.origin??"value");return l?.unit?`${l.shortLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()} ${l.unit}`:`${l?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()}`}case"invalid_format":{let l=u;if(l.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${l.prefix}"`;if(l.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${l.suffix}"`;if(l.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${l.includes}"`;if(l.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${l.pattern}`;let d=c[l.format],f=d?.label??l.format,m=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${f} \u05DC\u05D0 ${m}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${u.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${u.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${u.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${E(u.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${o(u.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function ZN(){return{localeError:U3()}}var F3=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(o))return"t\xF6mb";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return o=>{switch(o.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o.expected}, a kapott \xE9rt\xE9k ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${j(o.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`T\xFAl nagy: ${o.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${o.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${o.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} m\xE9rete t\xFAl kicsi ${i}${o.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} t\xFAl kicsi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${n[i.format]??o.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${o.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${o.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${o.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function qN(){return{localeError:F3()}}var B3=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak valid: diharapkan ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak valid: diharapkan ${j(o.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: diharapkan ${o.origin??"value"} memiliki ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${o.origin??"value"} menjadi ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: diharapkan ${o.origin} memiliki ${i}${o.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${o.origin} menjadi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${n[i.format]??o.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${o.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${o.origin}`;default:return"Input tidak valid"}}};function VN(){return{localeError:B3()}}var Z3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"n\xFAmer";case"object":{if(Array.isArray(t))return"fylki";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},q3=()=>{let t={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function e(n){return t[n]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"};return n=>{switch(n.code){case"invalid_type":return`Rangt gildi: \xDE\xFA sl\xF3st inn ${Z3(n.input)} \xFEar sem \xE1 a\xF0 vera ${n.expected}`;case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${j(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${o}${n.maximum.toString()} ${i.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${o}${n.minimum.toString()} ${i.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${o.prefix}"`:o.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${o.suffix}"`:o.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${o.includes}"`:o.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${o.pattern}`:`Rangt ${r[o.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${E(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}};function GN(){return{localeError:q3()}}var V3=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numero";case"object":{if(Array.isArray(o))return"vettore";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input non valido: atteso ${o.expected}, ricevuto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input non valido: atteso ${j(o.values[0])}`:`Opzione non valida: atteso uno tra ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Troppo grande: ${o.origin??"valore"} deve avere ${i}${o.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${o.origin??"valore"} deve essere ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Troppo piccolo: ${o.origin} deve avere ${i}${o.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${o.origin} deve essere ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${o.divisor}`;case"unrecognized_keys":return`Chiav${o.keys.length>1?"i":"e"} non riconosciut${o.keys.length>1?"e":"a"}: ${E(o.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${o.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${o.origin}`;default:return"Input non valido"}}};function KN(){return{localeError:V3()}}var G3=()=>{let t={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(o))return"\u914D\u5217";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${o.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${r(o.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":return o.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${j(o.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${E(o.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=o.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=e(o.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${s.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=o.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=e(o.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${s.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${o.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${o.keys.length>1?"\u7FA4":""}: ${E(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function HN(){return{localeError:G3()}}var K3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8";case"object":{if(Array.isArray(t))return"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return{string:"\u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0"}[e]??e},H3=()=>{let t={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function e(n){return t[n]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",json_string:"JSON \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"};return n=>{switch(n.code){case"invalid_type":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${K3(n.input)}`;case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${j(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${E(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${i.verb} ${o}${n.maximum.toString()} ${i.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${i.verb} ${o}${n.minimum.toString()} ${i.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.prefix}"-\u10D8\u10D7`:o.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.suffix}"-\u10D8\u10D7`:o.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${o.includes}"-\u10E1`:o.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${o.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${E(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function WN(){return{localeError:H3()}}var W3=()=>{let t={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(o))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(o===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return o=>{switch(o.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${j(o.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${o.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${E(o.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function z_(){return{localeError:W3()}}function JN(){return z_()}var J3=()=>{let t={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return o=>{switch(o.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${r(o.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":return o.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${j(o.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${E(o.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=o.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),c=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()}${c} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()} ${i}${s}`}case"too_small":{let i=o.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),c=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()}${c} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${n[i.format]??o.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${o.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${E(o.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${o.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${o.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function XN(){return{localeError:J3()}}var X3=t=>pp(typeof t,t),pp=(t,e=void 0)=>{switch(t){case"number":return Number.isNaN(e)?"NaN":"skai\u010Dius";case"bigint":return"sveikasis skai\u010Dius";case"string":return"eilut\u0117";case"boolean":return"login\u0117 reik\u0161m\u0117";case"undefined":case"void":return"neapibr\u0117\u017Eta reik\u0161m\u0117";case"function":return"funkcija";case"symbol":return"simbolis";case"object":return e===void 0?"ne\u017Einomas objektas":e===null?"nulin\u0117 reik\u0161m\u0117":Array.isArray(e)?"masyvas":Object.getPrototypeOf(e)!==Object.prototype&&e.constructor?e.constructor.name:"objektas";case"null":return"nulin\u0117 reik\u0161m\u0117"}return t},dp=t=>t.charAt(0).toUpperCase()+t.slice(1);function YN(t){let e=Math.abs(t),r=e%10,n=e%100;return n>=11&&n<=19||r===0?"many":r===1?"one":"few"}var Y3=()=>{let t={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function e(n,o,i,s){let a=t[n]??null;return a===null?a:{unit:a.unit[o],verb:a.verb[s][i?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"};return n=>{switch(n.code){case"invalid_type":return`Gautas tipas ${X3(n.input)}, o tik\u0117tasi - ${pp(n.expected)}`;case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${j(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${E(n.values,"|")} pasirinkim\u0173`;case"too_big":{let o=pp(n.origin),i=e(n.origin,YN(Number(n.maximum)),n.inclusive??!1,"smaller");if(i?.verb)return`${dp(o??n.origin??"reik\u0161m\u0117")} ${i.verb} ${n.maximum.toString()} ${i.unit??"element\u0173"}`;let s=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${dp(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.maximum.toString()} ${i?.unit}`}case"too_small":{let o=pp(n.origin),i=e(n.origin,YN(Number(n.minimum)),n.inclusive??!1,"bigger");if(i?.verb)return`${dp(o??n.origin??"reik\u0161m\u0117")} ${i.verb} ${n.minimum.toString()} ${i.unit??"element\u0173"}`;let s=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${dp(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.minimum.toString()} ${i?.unit}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${o.prefix}"`:o.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${o.includes}"`:o.format==="regex"?`Eilut\u0117 privalo atitikti ${o.pattern}`:`Neteisingas ${r[o.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${E(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let o=pp(n.origin);return`${dp(o??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function QN(){return{localeError:Y3()}}var Q3=()=>{let t={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(o))return"\u043D\u0438\u0437\u0430";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return o=>{switch(o.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${j(o.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${o.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${o.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function ez(){return{localeError:Q3()}}var e5=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombor";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak sah: dijangka ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak sah: dijangka ${j(o.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: dijangka ${o.origin??"nilai"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${o.origin??"nilai"} adalah ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: dijangka ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${o.origin} adalah ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${n[i.format]??o.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${E(o.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${o.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${o.origin}`;default:return"Input tidak sah"}}};function tz(){return{localeError:e5()}}var t5=()=>{let t={string:{unit:"tekens",verb:"te hebben"},file:{unit:"bytes",verb:"te hebben"},array:{unit:"elementen",verb:"te hebben"},set:{unit:"elementen",verb:"te hebben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"getal";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return o=>{switch(o.code){case"invalid_type":return`Ongeldige invoer: verwacht ${o.expected}, ontving ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ongeldige invoer: verwacht ${j(o.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Te groot: verwacht dat ${o.origin??"waarde"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"elementen"}`:`Te groot: verwacht dat ${o.origin??"waarde"} ${i}${o.maximum.toString()} is`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Te klein: verwacht dat ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Te klein: verwacht dat ${o.origin} ${i}${o.minimum.toString()} is`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${o.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${o.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${o.origin}`;default:return"Ongeldige invoer"}}};function rz(){return{localeError:t5()}}var r5=()=>{let t={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"tall";case"object":{if(Array.isArray(o))return"liste";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Ugyldig input: forventet ${o.expected}, fikk ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ugyldig verdi: forventet ${j(o.values[0])}`:`Ugyldig valg: forventet en av ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${n[i.format]??o.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${o.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${o.origin}`;default:return"Ugyldig input"}}};function nz(){return{localeError:r5()}}var n5=()=>{let t={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numara";case"object":{if(Array.isArray(o))return"saf";if(o===null)return"gayb";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return o=>{switch(o.code){case"invalid_type":return`F\xE2sit giren: umulan ${o.expected}, al\u0131nan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`F\xE2sit giren: umulan ${j(o.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=o;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${n[i.format]??o.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${o.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${o.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function oz(){return{localeError:n5()}}var o5=()=>{let t={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0627\u0631\u06D0";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return o=>{switch(o.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${r(o.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":return o.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${j(o.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${E(o.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0648\u064A`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${n[i.format]??o.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${o.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${o.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${o.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${o.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function iz(){return{localeError:o5()}}var i5=()=>{let t={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"liczba";case"object":{if(Array.isArray(o))return"tablica";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return o=>{switch(o.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o.expected}, otrzymano ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${j(o.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${n[i.format]??o.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${o.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${o.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${o.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function sz(){return{localeError:i5()}}var s5=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(o))return"array";if(o===null)return"nulo";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${o.expected}, recebido ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: esperado ${j(o.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Muito grande: esperado que ${o.origin??"valor"} tivesse ${i}${o.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${o.origin??"valor"} fosse ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Muito pequeno: esperado que ${o.origin} tivesse ${i}${o.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${o.origin} fosse ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`:i.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inv\xE1lido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`:`${n[i.format]??o.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${o.divisor}`;case"unrecognized_keys":return`Chave${o.keys.length>1?"s":""} desconhecida${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${o.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${o.origin}`;default:return"Campo inv\xE1lido"}}};function az(){return{localeError:s5()}}function cz(t,e,r,n){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?n:i===1?e:i>=2&&i<=4?r:n}var a5=()=>{let t={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${j(o.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),c=cz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.maximum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),c=cz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.minimum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${o.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0438":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${o.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function uz(){return{localeError:a5()}}var c5=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(o))return"tabela";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return o=>{switch(o.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${o.expected}, prejeto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${j(o.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} imelo ${i}${o.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${o.origin} imelo ${i}${o.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${n[i.format]??o.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${o.divisor}`;case"unrecognized_keys":return`Neprepoznan${o.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${E(o.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${o.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${o.origin}`;default:return"Neveljaven vnos"}}};function lz(){return{localeError:c5()}}var u5=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"antal";case"object":{if(Array.isArray(o))return"lista";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return o=>{switch(o.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${o.expected}, fick ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${j(o.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${n[i.format]??o.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${o.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${o.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function dz(){return{localeError:u5()}}var l5=()=>{let t={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(o))return"\u0B85\u0BA3\u0BBF";if(o===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${j(o.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${E(o.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${o.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${o.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function pz(){return{localeError:l5()}}var d5=()=>{let t={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(o))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(o===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return o=>{switch(o.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${j(o.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=e(o.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=e(o.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${o.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${E(o.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function fz(){return{localeError:d5()}}var p5=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},f5=()=>{let t={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(n){return t[n]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return n=>{switch(n.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${n.expected}, al\u0131nan ${p5(n.input)}`;case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${j(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()} ${i.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()} ${i.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[o.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function mz(){return{localeError:f5()}}var m5=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${j(o.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} \u0431\u0443\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0456":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${o.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function M_(){return{localeError:m5()}}function hz(){return M_()}var h5=()=>{let t={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(o))return"\u0622\u0631\u06D2";if(o===null)return"\u0646\u0644";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return o=>{switch(o.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${r(o.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":return o.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${j(o.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${E(o.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${o.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u06D2 ${i}${o.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u0627 ${i}${o.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${o.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${o.keys.length>1?"\u0632":""}: ${E(o.keys,"\u060C ")}`;case"invalid_key":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function gz(){return{localeError:h5()}}var g5=()=>{let t={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(o))return"m\u1EA3ng";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return o=>{switch(o.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${j(o.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${n[i.format]??o.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${o.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${E(o.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function _z(){return{localeError:g5()}}var _5=()=>{let t={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(o))return"\u6570\u7EC4";if(o===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${j(o.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${n[i.format]??o.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${o.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${o.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function yz(){return{localeError:_5()}}var y5=()=>{let t={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o.expected}\uFF0C\u4F46\u6536\u5230 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${j(o.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${o.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${o.keys.length>1?"\u5011":""}\uFF1A${E(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function vz(){return{localeError:y5()}}var v5=()=>{let t={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\u1ECD\u0301mb\xE0";case"object":{if(Array.isArray(o))return"akop\u1ECD";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"};return o=>{switch(o.code){case"invalid_type":return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${o.expected}, \xE0m\u1ECD\u0300 a r\xED ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${j(o.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin??"iye"} ${s.verb} ${i}${o.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${o.maximum}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin} ${s.verb} ${i}${o.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${o.minimum}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`:i.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`:i.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`:i.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`:`A\u1E63\xEC\u1E63e: ${n[i.format]??o.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${o.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${E(o.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function bz(){return{localeError:v5()}}var wz,j_=Symbol("ZodOutput"),D_=Symbol("ZodInput"),Pu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function fp(){return new Pu}(wz=globalThis).__zod_globalRegistry??(wz.__zod_globalRegistry=fp());var Ge=globalThis.__zod_globalRegistry;function L_(t,e){return new t({type:"string",...D(e)})}function U_(t,e){return new t({type:"string",coerce:!0,...D(e)})}function mp(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...D(e)})}function Cu(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...D(e)})}function hp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...D(e)})}function gp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(e)})}function _p(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(e)})}function yp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(e)})}function Ru(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...D(e)})}function vp(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...D(e)})}function bp(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(e)})}function wp(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...D(e)})}function xp(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(e)})}function $p(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...D(e)})}function Ip(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...D(e)})}function Sp(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(e)})}function kp(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(e)})}function Tp(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(e)})}function F_(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...D(e)})}function Ep(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(e)})}function Ap(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(e)})}function Op(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...D(e)})}function Pp(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...D(e)})}function Cp(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...D(e)})}function Rp(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...D(e)})}var B_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Z_(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(e)})}function q_(t,e){return new t({type:"string",format:"date",check:"string_format",...D(e)})}function V_(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...D(e)})}function G_(t,e){return new t({type:"string",format:"duration",check:"string_format",...D(e)})}function K_(t,e){return new t({type:"number",checks:[],...D(e)})}function H_(t,e){return new t({type:"number",coerce:!0,checks:[],...D(e)})}function W_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...D(e)})}function J_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...D(e)})}function X_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...D(e)})}function Y_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...D(e)})}function Q_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...D(e)})}function ey(t,e){return new t({type:"boolean",...D(e)})}function ty(t,e){return new t({type:"boolean",coerce:!0,...D(e)})}function ry(t,e){return new t({type:"bigint",...D(e)})}function ny(t,e){return new t({type:"bigint",coerce:!0,...D(e)})}function oy(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...D(e)})}function iy(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...D(e)})}function sy(t,e){return new t({type:"symbol",...D(e)})}function ay(t,e){return new t({type:"undefined",...D(e)})}function cy(t,e){return new t({type:"null",...D(e)})}function uy(t){return new t({type:"any"})}function Nu(t){return new t({type:"unknown"})}function zu(t,e){return new t({type:"never",...D(e)})}function ly(t,e){return new t({type:"void",...D(e)})}function dy(t,e){return new t({type:"date",...D(e)})}function py(t,e){return new t({type:"date",coerce:!0,...D(e)})}function fy(t,e){return new t({type:"nan",...D(e)})}function _o(t,e){return new Ig({check:"less_than",...D(e),value:t,inclusive:!1})}function zr(t,e){return new Ig({check:"less_than",...D(e),value:t,inclusive:!0})}function yo(t,e){return new Sg({check:"greater_than",...D(e),value:t,inclusive:!1})}function ir(t,e){return new Sg({check:"greater_than",...D(e),value:t,inclusive:!0})}function my(t){return yo(0,t)}function hy(t){return _o(0,t)}function gy(t){return zr(0,t)}function _y(t){return ir(0,t)}function Qi(t,e){return new o$({check:"multiple_of",...D(e),value:t})}function $a(t,e){return new a$({check:"max_size",...D(e),maximum:t})}function es(t,e){return new c$({check:"min_size",...D(e),minimum:t})}function Mu(t,e){return new u$({check:"size_equals",...D(e),size:t})}function Ia(t,e){return new l$({check:"max_length",...D(e),maximum:t})}function Qo(t,e){return new d$({check:"min_length",...D(e),minimum:t})}function Sa(t,e){return new p$({check:"length_equals",...D(e),length:t})}function ju(t,e){return new f$({check:"string_format",format:"regex",...D(e),pattern:t})}function Du(t){return new m$({check:"string_format",format:"lowercase",...D(t)})}function Lu(t){return new h$({check:"string_format",format:"uppercase",...D(t)})}function Uu(t,e){return new g$({check:"string_format",format:"includes",...D(e),includes:t})}function Fu(t,e){return new _$({check:"string_format",format:"starts_with",...D(e),prefix:t})}function Bu(t,e){return new y$({check:"string_format",format:"ends_with",...D(e),suffix:t})}function yy(t,e,r){return new v$({check:"property",property:t,schema:e,...D(r)})}function Zu(t,e){return new b$({check:"mime_type",mime:t,...D(e)})}function Zn(t){return new w$({check:"overwrite",tx:t})}function qu(t){return Zn(e=>e.normalize(t))}function Vu(){return Zn(t=>t.trim())}function Gu(){return Zn(t=>t.toLowerCase())}function Ku(){return Zn(t=>t.toUpperCase())}function Np(){return Zn(t=>x0(t))}function T$(t,e,r){return new t({type:"array",element:e,...D(r)})}function w5(t,e,r){return new t({type:"union",options:e,...D(r)})}function x5(t,e,r,n){return new t({type:"union",options:r,discriminator:e,...D(n)})}function $5(t,e,r){return new t({type:"intersection",left:e,right:r})}function I5(t,e,r,n){let o=r instanceof ye,i=o?n:r,s=o?r:null;return new t({type:"tuple",items:e,rest:s,...D(i)})}function S5(t,e,r,n){return new t({type:"record",keyType:e,valueType:r,...D(n)})}function k5(t,e,r,n){return new t({type:"map",keyType:e,valueType:r,...D(n)})}function T5(t,e,r){return new t({type:"set",valueType:e,...D(r)})}function E5(t,e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new t({type:"enum",entries:n,...D(r)})}function A5(t,e,r){return new t({type:"enum",entries:e,...D(r)})}function O5(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...D(r)})}function vy(t,e){return new t({type:"file",...D(e)})}function P5(t,e){return new t({type:"transform",transform:e})}function C5(t,e){return new t({type:"optional",innerType:e})}function R5(t,e){return new t({type:"nullable",innerType:e})}function N5(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():I0(r)}})}function z5(t,e,r){return new t({type:"nonoptional",innerType:e,...D(r)})}function M5(t,e){return new t({type:"success",innerType:e})}function j5(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function D5(t,e,r){return new t({type:"pipe",in:e,out:r})}function L5(t,e){return new t({type:"readonly",innerType:e})}function U5(t,e,r){return new t({type:"template_literal",parts:e,...D(r)})}function F5(t,e){return new t({type:"lazy",getter:e})}function B5(t,e){return new t({type:"promise",innerType:e})}function by(t,e,r){let n=D(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function wy(t,e,r){return new t({type:"custom",check:"custom",fn:e,...D(r)})}function xy(t){let e=xz(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(_u(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(_u(o))}},t(r.value,r)));return e}function xz(t,e){let r=new Je({check:"custom",...D(e)});return r._zod.check=t,r}function $y(t){let e=new Je({check:"describe"});return e._zod.onattach=[r=>{let n=Ge.get(r)??{};Ge.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function Iy(t){let e=new Je({check:"meta"});return e._zod.onattach=[r=>{let n=Ge.get(r)??{};Ge.add(r,{...n,...t})}],e._zod.check=()=>{},e}function Sy(t,e){let r=D(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(n),s=new Set(o),a=t.Codec??Au,c=t.Boolean??ku,u=t.String??Yi,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new a({type:"pipe",in:l,out:d,transform:((p,m)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:s.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((p,m)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return f}function ka(t,e,r,n={}){let o=D(n),i={...D(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:a=>r.test(a),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}var zp=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Ge,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},f=e._zod.parent;if(f)a.ref=f,this.process(f,d),this.seen.get(f).isParent=!0;else{let p=a.schema;switch(o.type){case"string":{let m=p;m.type="string";let{minimum:h,maximum:_,format:v,patterns:b,contentEncoding:x}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof _=="number"&&(m.maxLength=_),v&&(m.format=i[v]??v,m.format===""&&delete m.format),x&&(m.contentEncoding=x),b&&b.size>0){let k=[...b];k.length===1?m.pattern=k[0].source:k.length>1&&(a.schema.allOf=[...k.map(T=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:T.source}))])}break}case"number":{let m=p,{minimum:h,maximum:_,format:v,multipleOf:b,exclusiveMaximum:x,exclusiveMinimum:k}=e._zod.bag;typeof v=="string"&&v.includes("int")?m.type="integer":m.type="number",typeof k=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.minimum=k,m.exclusiveMinimum=!0):m.exclusiveMinimum=k),typeof h=="number"&&(m.minimum=h,typeof k=="number"&&this.target!=="draft-4"&&(k>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof x=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.maximum=x,m.exclusiveMaximum=!0):m.exclusiveMaximum=x),typeof _=="number"&&(m.maximum=_,typeof x=="number"&&this.target!=="draft-4"&&(x<=_?delete m.maximum:delete m.exclusiveMaximum)),typeof b=="number"&&(m.multipleOf=b);break}case"boolean":{let m=p;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{this.target==="openapi-3.0"?(p.type="string",p.nullable=!0,p.enum=[null]):p.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{p.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let m=p,{minimum:h,maximum:_}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof _=="number"&&(m.maxItems=_),m.type="array",m.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let m=p;m.type="object",m.properties={};let h=o.shape;for(let b in h)m.properties[b]=this.process(h[b],{...d,path:[...d.path,"properties",b]});let _=new Set(Object.keys(h)),v=new Set([..._].filter(b=>{let x=o.shape[b]._zod;return this.io==="input"?x.optin===void 0:x.optout===void 0}));v.size>0&&(m.required=Array.from(v)),o.catchall?._zod.def.type==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{let m=p,h=o.discriminator!==void 0,_=o.options.map((v,b)=>this.process(v,{...d,path:[...d.path,h?"oneOf":"anyOf",b]}));h?m.oneOf=_:m.anyOf=_;break}case"intersection":{let m=p,h=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),_=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),v=x=>"allOf"in x&&Object.keys(x).length===1,b=[...v(h)?h.allOf:[h],...v(_)?_.allOf:[_]];m.allOf=b;break}case"tuple":{let m=p;m.type="array";let h=this.target==="draft-2020-12"?"prefixItems":"items",_=this.target==="draft-2020-12"||this.target==="openapi-3.0"?"items":"additionalItems",v=o.items.map((T,F)=>this.process(T,{...d,path:[...d.path,h,F]})),b=o.rest?this.process(o.rest,{...d,path:[...d.path,_,...this.target==="openapi-3.0"?[o.items.length]:[]]}):null;this.target==="draft-2020-12"?(m.prefixItems=v,b&&(m.items=b)):this.target==="openapi-3.0"?(m.items={anyOf:v},b&&m.items.anyOf.push(b),m.minItems=v.length,b||(m.maxItems=v.length)):(m.items=v,b&&(m.additionalItems=b));let{minimum:x,maximum:k}=e._zod.bag;typeof x=="number"&&(m.minItems=x),typeof k=="number"&&(m.maxItems=k);break}case"record":{let m=p;m.type="object",(this.target==="draft-7"||this.target==="draft-2020-12")&&(m.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]})),m.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=p,h=Yd(o.entries);h.every(_=>typeof _=="number")&&(m.type="number"),h.every(_=>typeof _=="string")&&(m.type="string"),m.enum=h;break}case"literal":{let m=p,h=[];for(let _ of o.values)if(_===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof _=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(_))}else h.push(_);if(h.length!==0)if(h.length===1){let _=h[0];m.type=_===null?"null":typeof _,this.target==="draft-4"||this.target==="openapi-3.0"?m.enum=[_]:m.const=_}else h.every(_=>typeof _=="number")&&(m.type="number"),h.every(_=>typeof _=="string")&&(m.type="string"),h.every(_=>typeof _=="boolean")&&(m.type="string"),h.every(_=>_===null)&&(m.type="null"),m.enum=h;break}case"file":{let m=p,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:_,maximum:v,mime:b}=e._zod.bag;_!==void 0&&(h.minLength=_),v!==void 0&&(h.maxLength=v),b?b.length===1?(h.contentMediaType=b[0],Object.assign(m,h)):m.anyOf=b.map(x=>({...h,contentMediaType:x})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,d);this.target==="openapi-3.0"?(a.ref=o.innerType,p.nullable=!0):p.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"success":{let m=p;m.type="boolean";break}case"default":{this.process(o.innerType,d),a.ref=o.innerType,p.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),a.ref=o.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),a.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}p.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=p,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,d),a.ref=m;break}case"readonly":{this.process(o.innerType,d),a.ref=o.innerType,p.readOnly=!0;break}case"promise":{this.process(o.innerType,d),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,d),a.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&xr(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let h=n.external.registry.get(l[0])?.id,_=n.external.uri??(b=>b);if(h)return{ref:_(h)};let v=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=v,{defId:v,ref:`${_("__shared")}#/${d}/${v}`}}if(l[1]===o)return{ref:"#"};let p=`#/${d}/`,m=l[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:p+m}},s=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:f,defId:p}=i(l);d.def={...d.schema},p&&(d.defId=p);let m=d.schema;for(let h in m)delete m[h];m.$ref=f};if(n.cycles==="throw")for(let l of this.seen.entries()){let d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/ + +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(e===l[0]){s(l);continue}if(n.external){let p=n.external.registry.get(l[0])?.id;if(e!==l[0]&&p){s(l);continue}}if(this.metadataRegistry.get(l[0])?.id){s(l);continue}if(d.cycle){s(l);continue}if(d.count>1&&n.reused==="ref"){s(l);continue}}let a=(l,d)=>{let f=this.seen.get(l),p=f.def??f.schema,m={...p};if(f.ref===null)return;let h=f.ref;if(f.ref=null,h){a(h,d);let _=this.seen.get(h).schema;_.$ref&&(d.target==="draft-7"||d.target==="draft-4"||d.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(_)):(Object.assign(p,_),Object.assign(p,m))}f.isParent||this.override({zodSchema:l,jsonSchema:p,path:f.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?c.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,o.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let d=l[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function vo(t,e){if(t instanceof Pu){let n=new zp(e),o={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let i={},s={registry:t,uri:e?.uri,defs:o};for(let a of t._idmap.entries()){let[c,u]=a;i[c]=n.emit(u,{...e,external:s})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}let r=new zp(e);return r.process(t),r.emit(t,e)}function xr(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return xr(n.element,r);if(n.type==="set")return xr(n.valueType,r);if(n.type==="lazy")return xr(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return xr(n.innerType,r);if(n.type==="intersection")return xr(n.left,r)||xr(n.right,r);if(n.type==="record"||n.type==="map")return xr(n.keyType,r)||xr(n.valueType,r);if(n.type==="pipe")return xr(n.in,r)||xr(n.out,r);if(n.type==="object"){for(let o in n.shape)if(xr(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(xr(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(xr(o,r))return!0;return!!(n.rest&&xr(n.rest,r))}return!1}var $z={};function nt(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_zod"in e))return!1;let r=e._zod;return typeof r=="object"&&r!==null&&"def"in r}function vt(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_def"in e)||"_zod"in e)return!1;let r=e._def;return typeof r=="object"&&r!=null&&"typeName"in r}function Iz(t){return nt(t)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),vt(t)}function on(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(nt(t)||vt(t))}function E$(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodLiteral"}function A$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="literal":!1}function Sz(t){return!!(E$(t)||A$(t))}async function Ey(t,e){if(nt(t))try{return{success:!0,data:await Yo(t,e)}}catch(r){return{success:!1,error:r}}if(vt(t))return await t.safeParseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function ts(t,e){if(nt(t))return await Yo(t,e);if(vt(t))return await t.parseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function kz(t,e){if(nt(t))try{return{success:!0,data:Bn(t,e)}}catch(r){return{success:!1,error:r}}if(vt(t))return t.safeParse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Tz(t,e){if(nt(t))return Bn(t,e);if(vt(t))return t.parse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function rs(t){if(nt(t))return Ge.get(t)?.description;if(vt(t)||"description"in t&&typeof t.description=="string")return t.description}function Ez(t){if(!on(t))return!1;if(vt(t)){let e=t._def;if(e.typeName==="ZodObject"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.typeName==="ZodRecord")return!0}if(nt(t)){let e=t._zod.def;if(e.type==="object"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.type==="record")return!0}return typeof t=="object"&&t!==null&&!("shape"in t)}function Wu(t){return on(t)?vt(t)?t._def.typeName==="ZodString":nt(t)?t._zod.def.type==="string":!1:!1}function Ay(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodObject"}function wn(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="object":!1}function Mp(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="array":!1}function O$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="optional":!1}function P$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="nullable":!1}function Az(t){return!!(Ay(t)||wn(t))}function ky(t){if(vt(t))return t.shape;if(nt(t))return t._zod.def.shape;throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Oz(t,e){if(vt(t))return t.extend(e);if(nt(t))return M.extend(t,e);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Pz(t){if(vt(t))return t.partial();if(nt(t))return M.partial(xa,t,void 0);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Hu(t,e=!1){if(vt(t))return t.strict();if(wn(t)){let r=t._zod.def.shape;if(e)for(let[i,s]of Object.entries(t._zod.def.shape)){if(wn(s)){let c=Hu(s,e);r[i]=c}else if(Mp(s)){let c=s._zod.def.element;wn(c)&&(c=Hu(c,e)),r[i]=Qe(s,{...s._zod.def,element:c})}else r[i]=s;let a=Ge.get(s);a&&Ge.add(r[i],a)}let n=Qe(t,{...t._zod.def,shape:r,catchall:zu(Eu)}),o=Ge.get(t);return o&&Ge.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Ty(t,e=!1){if(Ay(t))return t.passthrough();if(wn(t)){let r=t._zod.def.shape;if(e)for(let[i,s]of Object.entries(t._zod.def.shape)){if(wn(s)){let c=Ty(s,e);r[i]=c}else if(Mp(s)){let c=s._zod.def.element;wn(c)&&(c=Ty(c,e)),r[i]=Qe(s,{...s._zod.def,element:c})}else r[i]=s;let a=Ge.get(s);a&&Ge.add(r[i],a)}let n=Qe(t,{...t._zod.def,shape:r,catchall:Nu(Tu)}),o=Ge.get(t);return o&&Ge.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Cz(t){if(vt(t))try{let e=t.parse(void 0);return()=>e}catch{return}if(nt(t))try{let e=Bn(t,void 0);return()=>e}catch{return}}function Z5(t){return vt(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function q5(t){return nt(t)&&t._zod.def.type==="pipe"}function Ta(t,e,r){let n=r.get(t);if(n!==void 0)return n;if(vt(t))return Z5(t)?Ta(t._def.schema,e,r):t;if(nt(t)){let o=t;if(q5(t)&&(o=Ta(t._zod.def.in,e,r)),e){if(wn(o)){let s=o._zod.def.shape;for(let[a,c]of Object.entries(o._zod.def.shape))s[a]=Ta(c,e,r);o=Qe(o,{...o._zod.def,shape:s})}else if(Mp(o)){let s=Ta(o._zod.def.element,e,r);o=Qe(o,{...o._zod.def,element:s})}else if(O$(o)){let s=Ta(o._zod.def.innerType,e,r);o=Qe(o,{...o._zod.def,innerType:s})}else if(P$(o)){let s=Ta(o._zod.def.innerType,e,r);o=Qe(o,{...o._zod.def,innerType:s})}}let i=Ge.get(t);return i&&Ge.add(o,i),r.set(t,o),o}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Oy(t,e=!1){return Ta(t,e,new WeakMap)}function Rz(t,e){if(vt(t)){let r=ky(t),n={};for(let[o,i]of Object.entries(r))e(o,i)?n[o]=i.optional():n[o]=i;return t.extend(n)}if(nt(t)){let r=ky(t),n={...t._zod.def.shape};for(let[s,a]of Object.entries(r))e(s,a)&&(n[s]=new xa({type:"optional",innerType:a}));let o=Qe(t,{...t._zod.def,shape:n}),i=Ge.get(t);return i&&Ge.add(o,i),o}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Py(t){return t instanceof Error&&(t.constructor.name==="ZodError"||t.constructor.name==="$ZodError")}function C$(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}var V5=["*","_","`"];function G5(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n}; +`;return e}function Nz(t,e,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:s=!0,curveStyle:a="linear",wrapLabelNWords:c=9}=r??{},u=s?`%%{init: {'flowchart': {'curve': '${a}'}}}%% +graph TD; +`:`graph TD; +`;if(s){let p="default",m={[p]:"{0}({1})"};n!==void 0&&(m[n]="{0}([{1}]):::first"),o!==void 0&&(m[o]="{0}([{1}]):::last");for(let[h,_]of Object.entries(t)){let v=_.name.split(":").pop()??"",x=V5.some(T=>v.startsWith(T)&&v.endsWith(T))?`

${v}

`:v;Object.keys(_.metadata??{}).length&&(x+=`
${Object.entries(_.metadata??{}).map(([T,F])=>`${T} = ${F}`).join(` +`)}`);let k=(m[h]??m[p]).replace("{0}",C$(h)).replace("{1}",x);u+=` ${k} +`}}let l={};for(let p of e){let m=p.source.split(":"),h=p.target.split(":"),_=m.filter((v,b)=>v===h[b]).join(":");l[_]||(l[_]=[]),l[_].push(p)}let d=new Set;function f(p,m){let h=p.length===1&&p[0].source===p[0].target;if(m&&!h){let _=m.split(":").pop();if(d.has(_))throw new Error(`Found duplicate subgraph '${_}' -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);d.add(_),u+=` subgraph ${_} +`}for(let _ of p){let{source:v,target:b,data:x,conditional:k}=_,T="";if(x!==void 0){let F=x,J=F.split(" ");J.length>c&&(F=Array.from({length:Math.ceil(J.length/c)},(w,Z)=>J.slice(Z*c,(Z+1)*c).join(" ")).join(" 
 ")),T=k?` -.  ${F}  .-> `:` --  ${F}  --> `}else T=k?" -.-> ":" --> ";u+=` ${C$(v)}${T}${C$(b)}; +`}for(let _ in l)_.startsWith(`${m}:`)&&_!==m&&f(l[_],_);m&&!h&&(u+=` end +`)}f(l[""]??[],"");for(let p in l)!p.includes(":")&&p!==""&&f(l[p],p);return s&&(u+=G5(i??{})),u}async function zz(t,e){let r=e?.backgroundColor??"white",n=e?.imageType??"png",o=HR(t);r!==void 0&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(r)||(r=`!${r}`));let i=`https://mermaid.ink/img/${o}?bgColor=${r}&type=${n}`,s=await fetch(i);if(!s.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${s.status}`,`Status text: ${s.statusText}`].join(` +`));return await s.blob()}var jz=Symbol("Let zodToJsonSchema decide on which parser to use"),Mz={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Dz=t=>typeof t=="string"?{...Mz,name:t}:{...Mz,...t};var Lz=t=>{let e=Dz(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};var Cy=(t,e)=>{let r=0;for(;ryG,DIRTY:()=>Ea,EMPTY_PATH:()=>J5,INVALID:()=>pe,NEVER:()=>tK,OK:()=>sr,ParseStatus:()=>Gt,Schema:()=>Ee,ZodAny:()=>is,ZodArray:()=>ni,ZodBigInt:()=>Oa,ZodBoolean:()=>Pa,ZodBranded:()=>Dp,ZodCatch:()=>Ba,ZodDate:()=>Ca,ZodDefault:()=>Fa,ZodDiscriminatedUnion:()=>zy,ZodEffects:()=>In,ZodEnum:()=>La,ZodError:()=>Mr,ZodFirstPartyTypeKind:()=>N,ZodFunction:()=>jy,ZodIntersection:()=>Ma,ZodIssueCode:()=>z,ZodLazy:()=>ja,ZodLiteral:()=>Da,ZodMap:()=>tl,ZodNaN:()=>nl,ZodNativeEnum:()=>Ua,ZodNever:()=>qn,ZodNull:()=>Na,ZodNullable:()=>xo,ZodNumber:()=>Aa,ZodObject:()=>jr,ZodOptional:()=>xn,ZodParsedType:()=>W,ZodPipeline:()=>Lp,ZodPromise:()=>ss,ZodReadonly:()=>Za,ZodRecord:()=>My,ZodSchema:()=>Ee,ZodSet:()=>rl,ZodString:()=>os,ZodSymbol:()=>Qu,ZodTransformer:()=>In,ZodTuple:()=>wo,ZodType:()=>Ee,ZodUndefined:()=>Ra,ZodUnion:()=>za,ZodUnknown:()=>ri,ZodVoid:()=>el,addIssueToContext:()=>B,any:()=>TG,array:()=>PG,bigint:()=>xG,boolean:()=>Jz,coerce:()=>eK,custom:()=>Kz,date:()=>$G,datetimeRegex:()=>Vz,defaultErrorMap:()=>ei,discriminatedUnion:()=>NG,effect:()=>GG,enum:()=>ZG,function:()=>UG,getErrorMap:()=>Ju,getParsedType:()=>bo,instanceof:()=>bG,intersection:()=>zG,isAborted:()=>Ry,isAsync:()=>Xu,isDirty:()=>Ny,isValid:()=>ns,late:()=>vG,lazy:()=>FG,literal:()=>BG,makeIssue:()=>jp,map:()=>DG,nan:()=>wG,nativeEnum:()=>qG,never:()=>AG,null:()=>kG,nullable:()=>HG,number:()=>Wz,object:()=>Xz,objectUtil:()=>N$,oboolean:()=>QG,onumber:()=>YG,optional:()=>KG,ostring:()=>XG,pipeline:()=>JG,preprocess:()=>WG,promise:()=>VG,quotelessJson:()=>K5,record:()=>jG,set:()=>LG,setErrorMap:()=>W5,strictObject:()=>CG,string:()=>Hz,symbol:()=>IG,transformer:()=>GG,tuple:()=>MG,undefined:()=>SG,union:()=>RG,unknown:()=>EG,util:()=>je,void:()=>OG});var je;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(je||(je={}));var N$;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(N$||(N$={}));var W=je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bo=t=>{switch(typeof t){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(t)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(t)?W.array:t===null?W.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?W.promise:typeof Map<"u"&&t instanceof Map?W.map:typeof Set<"u"&&t instanceof Set?W.set:typeof Date<"u"&&t instanceof Date?W.date:W.object;default:return W.unknown}};var z=je.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),K5=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Mr=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;cr.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Mr.create=t=>new Mr(t);var H5=(t,e)=>{let r;switch(t.code){case z.invalid_type:t.received===W.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,je.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${je.joinValues(t.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${je.joinValues(t.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${je.joinValues(t.options)}, received '${t.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:je.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case z.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case z.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=e.defaultError,je.assertNever(t)}return{message:r}},ei=H5;var Uz=ei;function W5(t){Uz=t}function Ju(){return Uz}var jp=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}},J5=[];function B(t,e){let r=Ju(),n=jp({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ei?void 0:ei].filter(o=>!!o)});t.common.issues.push(n)}var Gt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return pe;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return pe;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}},pe=Object.freeze({status:"aborted"}),Ea=t=>({status:"dirty",value:t}),sr=t=>({status:"valid",value:t}),Ry=t=>t.status==="aborted",Ny=t=>t.status==="dirty",ns=t=>t.status==="valid",Xu=t=>typeof Promise<"u"&&t instanceof Promise;var ne;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ne||(ne={}));var $n=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Fz=(t,e)=>{if(ns(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Mr(t.common.issues);return this._error=r,this._error}}};function Se(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var Ee=class{get description(){return this._def.description}_getType(e){return bo(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Gt,ctx:{common:e.parent.common,data:e.data,parsedType:bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Xu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Fz(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return ns(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>ns(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Xu(o)?o:Promise.resolve(o));return Fz(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:z.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new In({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return xn.create(this,this._def)}nullable(){return xo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ni.create(this)}promise(){return ss.create(this,this._def)}or(e){return za.create([this,e],this._def)}and(e){return Ma.create(this,e,this._def)}transform(e){return new In({...Se(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Fa({...Se(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new Dp({typeName:N.ZodBranded,type:this,...Se(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Ba({...Se(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Lp.create(this,e)}readonly(){return Za.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},X5=/^c[^\s-]{8,}$/i,Y5=/^[0-9a-z]+$/,Q5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,eG=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tG=/^[a-z0-9_-]{21}$/i,rG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,nG=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",z$,sG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,aG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,cG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,uG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zz="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",pG=new RegExp(`^${Zz}$`);function qz(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function fG(t){return new RegExp(`^${qz(t)}$`)}function Vz(t){let e=`${Zz}T${qz(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function mG(t,e){return!!((e==="v4"||!e)&&sG.test(t)||(e==="v6"||!e)&&cG.test(t))}function hG(t,e){if(!rG.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function gG(t,e){return!!((e==="v4"||!e)&&aG.test(t)||(e==="v6"||!e)&&uG.test(t))}var os=class t extends Ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.string,received:i.parsedType}),pe}let n=new Gt,o;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(o=this._getOrReturnCtx(e,o),B(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.lengthe.test(o),{validation:r,code:z.invalid_string,...ne.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ne.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ne.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ne.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ne.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ne.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ne.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ne.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ne.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ne.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ne.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ne.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ne.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ne.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ne.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ne.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ne.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ne.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ne.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ne.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ne.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ne.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ne.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ne.errToObj(r)})}nonempty(e){return this.min(1,ne.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew os({checks:[],typeName:N.ZodString,coerce:t?.coerce??!1,...Se(t)});function _G(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var Aa=class t extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==W.number){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.number,received:i.parsedType}),pe}let n,o=new Gt;for(let i of this._def.checks)i.kind==="int"?je.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?_G(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_finite,message:i.message}),o.dirty()):je.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ne.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ne.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ne.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ne.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ne.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ne.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ne.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ne.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ne.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ne.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&je.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew Aa({checks:[],typeName:N.ZodNumber,coerce:t?.coerce||!1,...Se(t)});var Oa=class t extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==W.bigint)return this._getInvalidInput(e);let n,o=new Gt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):je.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return B(r,{code:z.invalid_type,expected:W.bigint,received:r.parsedType}),pe}gte(e,r){return this.setLimit("min",e,!0,ne.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ne.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ne.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ne.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ne.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ne.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Oa({checks:[],typeName:N.ZodBigInt,coerce:t?.coerce??!1,...Se(t)});var Pa=class extends Ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.boolean,received:n.parsedType}),pe}return sr(e.data)}};Pa.create=t=>new Pa({typeName:N.ZodBoolean,coerce:t?.coerce||!1,...Se(t)});var Ca=class t extends Ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.date,received:i.parsedType}),pe}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_date}),pe}let n=new Gt,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(o=this._getOrReturnCtx(e,o),B(o,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):je.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ne.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ne.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ca({checks:[],coerce:t?.coerce||!1,typeName:N.ZodDate,...Se(t)});var Qu=class extends Ee{_parse(e){if(this._getType(e)!==W.symbol){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.symbol,received:n.parsedType}),pe}return sr(e.data)}};Qu.create=t=>new Qu({typeName:N.ZodSymbol,...Se(t)});var Ra=class extends Ee{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.undefined,received:n.parsedType}),pe}return sr(e.data)}};Ra.create=t=>new Ra({typeName:N.ZodUndefined,...Se(t)});var Na=class extends Ee{_parse(e){if(this._getType(e)!==W.null){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.null,received:n.parsedType}),pe}return sr(e.data)}};Na.create=t=>new Na({typeName:N.ZodNull,...Se(t)});var is=class extends Ee{constructor(){super(...arguments),this._any=!0}_parse(e){return sr(e.data)}};is.create=t=>new is({typeName:N.ZodAny,...Se(t)});var ri=class extends Ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return sr(e.data)}};ri.create=t=>new ri({typeName:N.ZodUnknown,...Se(t)});var qn=class extends Ee{_parse(e){let r=this._getOrReturnCtx(e);return B(r,{code:z.invalid_type,expected:W.never,received:r.parsedType}),pe}};qn.create=t=>new qn({typeName:N.ZodNever,...Se(t)});var el=class extends Ee{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.void,received:n.parsedType}),pe}return sr(e.data)}};el.create=t=>new el({typeName:N.ZodVoid,...Se(t)});var ni=class t extends Ee{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==W.array)return B(r,{code:z.invalid_type,expected:W.array,received:r.parsedType}),pe;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.lengtho.maxLength.value&&(B(r,{code:z.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new $n(r,s,r.path,a)))).then(s=>Gt.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new $n(r,s,r.path,a)));return Gt.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:ne.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:ne.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:ne.toString(r)}})}nonempty(e){return this.min(1,e)}};ni.create=(t,e)=>new ni({type:t,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...Se(e)});function Yu(t){if(t instanceof jr){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=xn.create(Yu(n))}return new jr({...t._def,shape:()=>e})}else return t instanceof ni?new ni({...t._def,type:Yu(t.element)}):t instanceof xn?xn.create(Yu(t.unwrap())):t instanceof xo?xo.create(Yu(t.unwrap())):t instanceof wo?wo.create(t.items.map(e=>Yu(e))):t}var jr=class t extends Ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=je.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==W.object){let u=this._getOrReturnCtx(e);return B(u,{code:z.invalid_type,expected:W.object,received:u.parsedType}),pe}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof qn&&this._def.unknownKeys==="strip"))for(let u in o.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new $n(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof qn){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(B(o,{code:z.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new $n(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Gt.mergeObjectSync(n,u)):Gt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return ne.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ne.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of je.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of je.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Yu(this)}partial(e){let r={};for(let n of je.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of je.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof xn;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Gz(je.objectKeys(this.shape))}};jr.create=(t,e)=>new jr({shape:()=>t,unknownKeys:"strip",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});jr.strictCreate=(t,e)=>new jr({shape:()=>t,unknownKeys:"strict",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});jr.lazycreate=(t,e)=>new jr({shape:t,unknownKeys:"strip",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});var za=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new Mr(a.ctx.common.issues));return B(r,{code:z.invalid_union,unionErrors:s}),pe}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new Mr(c));return B(r,{code:z.invalid_union,unionErrors:a}),pe}}get options(){return this._def.options}};za.create=(t,e)=>new za({options:t,typeName:N.ZodUnion,...Se(e)});var ti=t=>t instanceof ja?ti(t.schema):t instanceof In?ti(t.innerType()):t instanceof Da?[t.value]:t instanceof La?t.options:t instanceof Ua?je.objectValues(t.enum):t instanceof Fa?ti(t._def.innerType):t instanceof Ra?[void 0]:t instanceof Na?[null]:t instanceof xn?[void 0,...ti(t.unwrap())]:t instanceof xo?[null,...ti(t.unwrap())]:t instanceof Dp||t instanceof Za?ti(t.unwrap()):t instanceof Ba?ti(t._def.innerType):[],zy=class t extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.object)return B(r,{code:z.invalid_type,expected:W.object,received:r.parsedType}),pe;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(B(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=ti(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Se(n)})}};function M$(t,e){let r=bo(t),n=bo(e);if(t===e)return{valid:!0,data:t};if(r===W.object&&n===W.object){let o=je.objectKeys(e),i=je.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let c=M$(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===W.array&&n===W.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i{if(Ry(i)||Ry(s))return pe;let a=M$(i.value,s.value);return a.valid?((Ny(i)||Ny(s))&&r.dirty(),{status:r.value,value:a.data}):(B(n,{code:z.invalid_intersection_types}),pe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ma.create=(t,e,r)=>new Ma({left:t,right:e,typeName:N.ZodIntersection,...Se(r)});var wo=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.array)return B(n,{code:z.invalid_type,expected:W.array,received:n.parsedType}),pe;if(n.data.lengththis._def.items.length&&(B(n,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new $n(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>Gt.mergeArray(r,s)):Gt.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};wo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wo({items:t,typeName:N.ZodTuple,rest:null,...Se(e)})};var My=class t extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.object)return B(n,{code:z.invalid_type,expected:W.object,received:n.parsedType}),pe;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new $n(n,a,n.path,a)),value:s._parse(new $n(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Gt.mergeObjectAsync(r,o):Gt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ee?new t({keyType:e,valueType:r,typeName:N.ZodRecord,...Se(n)}):new t({keyType:os.create(),valueType:e,typeName:N.ZodRecord,...Se(r)})}},tl=class extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.map)return B(n,{code:z.invalid_type,expected:W.map,received:n.parsedType}),pe;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new $n(n,a,n.path,[u,"key"])),value:i._parse(new $n(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return pe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return pe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};tl.create=(t,e,r)=>new tl({valueType:e,keyType:t,typeName:N.ZodMap,...Se(r)});var rl=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.set)return B(n,{code:z.invalid_type,expected:W.set,received:n.parsedType}),pe;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&(B(n,{code:z.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return pe;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>i._parse(new $n(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:ne.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:ne.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};rl.create=(t,e)=>new rl({valueType:t,minSize:null,maxSize:null,typeName:N.ZodSet,...Se(e)});var jy=class t extends Ee{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.function)return B(r,{code:z.invalid_type,expected:W.function,received:r.parsedType}),pe;function n(a,c){return jp({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ju(),ei].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function o(a,c){return jp({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ju(),ei].filter(u=>!!u),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof ss){let a=this;return sr(async function(...c){let u=new Mr([]),l=await a._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(o(d,p)),u})})}else{let a=this;return sr(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new Mr([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new Mr([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:wo.create(e).rest(ri.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||wo.create([]).rest(ri.create()),returns:r||ri.create(),typeName:N.ZodFunction,...Se(n)})}},ja=class extends Ee{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ja.create=(t,e)=>new ja({getter:t,typeName:N.ZodLazy,...Se(e)});var Da=class extends Ee{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return B(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}};Da.create=(t,e)=>new Da({value:t,typeName:N.ZodLiteral,...Se(e)});function Gz(t,e){return new La({values:t,typeName:N.ZodEnum,...Se(e)})}var La=class t extends Ee{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{expected:je.joinValues(n),received:r.parsedType,code:z.invalid_type}),pe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{received:r.data,code:z.invalid_enum_value,options:n}),pe}return sr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};La.create=Gz;var Ua=class extends Ee{_parse(e){let r=je.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==W.string&&n.parsedType!==W.number){let o=je.objectValues(r);return B(n,{expected:je.joinValues(o),received:n.parsedType,code:z.invalid_type}),pe}if(this._cache||(this._cache=new Set(je.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=je.objectValues(r);return B(n,{received:n.data,code:z.invalid_enum_value,options:o}),pe}return sr(e.data)}get enum(){return this._def.values}};Ua.create=(t,e)=>new Ua({values:t,typeName:N.ZodNativeEnum,...Se(e)});var ss=class extends Ee{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.promise&&r.common.async===!1)return B(r,{code:z.invalid_type,expected:W.promise,received:r.parsedType}),pe;let n=r.parsedType===W.promise?r.data:Promise.resolve(r.data);return sr(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ss.create=(t,e)=>new ss({type:t,typeName:N.ZodPromise,...Se(e)});var In=class extends Ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{B(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return pe;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?pe:c.status==="dirty"?Ea(c.value):r.value==="dirty"?Ea(c.value):c});{if(r.value==="aborted")return pe;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?pe:a.status==="dirty"?Ea(a.value):r.value==="dirty"?Ea(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?pe:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?pe:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ns(s))return pe;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>ns(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):pe);je.assertNever(o)}};In.create=(t,e,r)=>new In({schema:t,typeName:N.ZodEffects,effect:e,...Se(r)});In.createWithPreprocess=(t,e,r)=>new In({schema:e,effect:{type:"preprocess",transform:t},typeName:N.ZodEffects,...Se(r)});var xn=class extends Ee{_parse(e){return this._getType(e)===W.undefined?sr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xn.create=(t,e)=>new xn({innerType:t,typeName:N.ZodOptional,...Se(e)});var xo=class extends Ee{_parse(e){return this._getType(e)===W.null?sr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xo.create=(t,e)=>new xo({innerType:t,typeName:N.ZodNullable,...Se(e)});var Fa=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===W.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Fa.create=(t,e)=>new Fa({innerType:t,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Se(e)});var Ba=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Xu(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Se(e)});var nl=class extends Ee{_parse(e){if(this._getType(e)!==W.nan){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.nan,received:n.parsedType}),pe}return{status:"valid",value:e.data}}};nl.create=t=>new nl({typeName:N.ZodNaN,...Se(t)});var yG=Symbol("zod_brand"),Dp=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Lp=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?pe:i.status==="dirty"?(r.dirty(),Ea(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?pe:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:N.ZodPipeline})}},Za=class extends Ee{_parse(e){let r=this._def.innerType._parse(e),n=o=>(ns(o)&&(o.value=Object.freeze(o.value)),o);return Xu(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Za.create=(t,e)=>new Za({innerType:t,typeName:N.ZodReadonly,...Se(e)});function Bz(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Kz(t,e={},r){return t?is.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=Bz(e,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!i){let s=Bz(e,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):is.create()}var vG={object:jr.lazycreate},N;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(N||(N={}));var bG=(t,e={message:`Input not instance of ${t.name}`})=>Kz(r=>r instanceof t,e),Hz=os.create,Wz=Aa.create,wG=nl.create,xG=Oa.create,Jz=Pa.create,$G=Ca.create,IG=Qu.create,SG=Ra.create,kG=Na.create,TG=is.create,EG=ri.create,AG=qn.create,OG=el.create,PG=ni.create,Xz=jr.create,CG=jr.strictCreate,RG=za.create,NG=zy.create,zG=Ma.create,MG=wo.create,jG=My.create,DG=tl.create,LG=rl.create,UG=jy.create,FG=ja.create,BG=Da.create,ZG=La.create,qG=Ua.create,VG=ss.create,GG=In.create,KG=xn.create,HG=xo.create,WG=In.createWithPreprocess,JG=Lp.create,XG=()=>Hz().optional(),YG=()=>Wz().optional(),QG=()=>Jz().optional(),eK={string:(t=>os.create({...t,coerce:!0})),number:(t=>Aa.create({...t,coerce:!0})),boolean:(t=>Pa.create({...t,coerce:!0})),bigint:(t=>Oa.create({...t,coerce:!0})),date:(t=>Ca.create({...t,coerce:!0}))};var tK=pe;function Yz(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==N.ZodAny&&(r.items=he(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&De(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&De(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(De(r,"minItems",t.exactLength.value,t.exactLength.message,e),De(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Qz(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?De(r,"minimum",n.value,n.message,e):De(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),De(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?De(r,"maximum",n.value,n.message,e):De(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),De(r,"maximum",n.value,n.message,e));break;case"multipleOf":De(r,"multipleOf",n.value,n.message,e);break}return r}function e1(){return{type:"boolean"}}function Dy(t,e){return he(t.type._def,e)}var t1=(t,e)=>he(t.innerType._def,e);function j$(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map(o=>j$(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return nK(t,e)}}var nK=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":De(r,"minimum",n.value,n.message,e);break;case"max":De(r,"maximum",n.value,n.message,e);break}return r};function r1(t,e){return{...he(t.innerType._def,e),default:t.defaultValue()}}function n1(t,e){return e.effectStrategy==="input"?he(t.schema._def,e):pt(e)}function o1(t){return{type:"string",enum:Array.from(t.values)}}var oK=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function i1(t,e){let r=[he(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),he(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(oK(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...c}=i;s=c}else n=void 0;o.push(s)}}),o.length?{allOf:o,...n}:void 0}function s1(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var D$,Vn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(D$===void 0&&(D$=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),D$),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Ly(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":De(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":De(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Gn(r,"email",n.message,e);break;case"format:idn-email":Gn(r,"idn-email",n.message,e);break;case"pattern:zod":Ir(r,Vn.email,n.message,e);break}break;case"url":Gn(r,"uri",n.message,e);break;case"uuid":Gn(r,"uuid",n.message,e);break;case"regex":Ir(r,n.regex,n.message,e);break;case"cuid":Ir(r,Vn.cuid,n.message,e);break;case"cuid2":Ir(r,Vn.cuid2,n.message,e);break;case"startsWith":Ir(r,RegExp(`^${L$(n.value,e)}`),n.message,e);break;case"endsWith":Ir(r,RegExp(`${L$(n.value,e)}$`),n.message,e);break;case"datetime":Gn(r,"date-time",n.message,e);break;case"date":Gn(r,"date",n.message,e);break;case"time":Gn(r,"time",n.message,e);break;case"duration":Gn(r,"duration",n.message,e);break;case"length":De(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),De(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":Ir(r,RegExp(L$(n.value,e)),n.message,e);break;case"ip":n.version!=="v6"&&Gn(r,"ipv4",n.message,e),n.version!=="v4"&&Gn(r,"ipv6",n.message,e);break;case"base64url":Ir(r,Vn.base64url,n.message,e);break;case"jwt":Ir(r,Vn.jwt,n.message,e);break;case"cidr":n.version!=="v6"&&Ir(r,Vn.ipv4Cidr,n.message,e),n.version!=="v4"&&Ir(r,Vn.ipv6Cidr,n.message,e);break;case"emoji":Ir(r,Vn.emoji(),n.message,e);break;case"ulid":Ir(r,Vn.ulid,n.message,e);break;case"base64":switch(e.base64Strategy){case"format:binary":Gn(r,"binary",n.message,e);break;case"contentEncoding:base64":De(r,"contentEncoding","base64",n.message,e);break;case"pattern:zod":Ir(r,Vn.base64,n.message,e);break}break;case"nanoid":Ir(r,Vn.nanoid,n.message,e);break;case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function L$(t,e){return e.patternStrategy==="escape"?sK(t):t}var iK=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function sK(t){let e="";for(let r=0;ro.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):De(t,"format",e,r,n)}function Ir(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:a1(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):De(t,"pattern",a1(e,n),r,n)}function a1(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",i=!1,s=!1,a=!1;for(let c=0;c({...n,[o]:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??pt(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===N.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=Ly(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===N.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===N.ZodBranded&&t.keyType._def.type._def.typeName===N.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=Dy(t.keyType._def,e);return{...r,propertyNames:o}}}return r}function c1(t,e){if(e.mapStrategy==="record")return Uy(t,e);let r=he(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||pt(e),n=he(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||pt(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function u1(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function l1(t){return t.target==="openAi"?void 0:{not:pt({...t,currentPath:[...t.currentPath,"not"]})}}function d1(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Up={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function f1(t,e){if(e.target==="openApi3")return p1(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Up&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let s=Up[i._def.typeName];return s&&!o.includes(s)?[...o,s]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,i)=>{let s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];case"bigint":return[...o,"integer"];case"object":return i._def.value===null?[...o,"null"]:o;case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((i,s,a)=>a.indexOf(i)===s);return{type:o.length>1?o:o[0],enum:r.reduce((i,s)=>i.includes(s._def.value)?i:[...i,s._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return p1(t,e)}var p1=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>he(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function m1(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Up[t.innerType._def.typeName],nullable:!0}:{type:[Up[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=he(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function h1(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",R$(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?De(r,"minimum",n.value,n.message,e):De(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),De(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?De(r,"maximum",n.value,n.message,e):De(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),De(r,"maximum",n.value,n.message,e));break;case"multipleOf":De(r,"multipleOf",n.value,n.message,e);break}return r}function g1(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},o=[],i=t.shape();for(let a in i){let c=i[a];if(c===void 0||c._def===void 0)continue;let u=cK(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=he(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||o.push(a))}o.length&&(n.required=o);let s=aK(t,e);return s!==void 0&&(n.additionalProperties=s),n}function aK(t,e){if(t.catchall._def.typeName!=="ZodNever")return he(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function cK(t){try{return t.isOptional()}catch{return!0}}var _1=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return he(t.innerType._def,e);let r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:pt(e)},r]}:pt(e)};var y1=(t,e)=>{if(e.pipeStrategy==="input")return he(t.in._def,e);if(e.pipeStrategy==="output")return he(t.out._def,e);let r=he(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=he(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function v1(t,e){return he(t.type._def,e)}function b1(t,e){let n={type:"array",uniqueItems:!0,items:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&De(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&De(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function w1(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>he(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:he(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>he(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function x1(t){return{not:pt(t)}}function $1(t){return pt(t)}var I1=(t,e)=>he(t.innerType._def,e);var S1=(t,e,r)=>{switch(e){case N.ZodString:return Ly(t,r);case N.ZodNumber:return h1(t,r);case N.ZodObject:return g1(t,r);case N.ZodBigInt:return Qz(t,r);case N.ZodBoolean:return e1();case N.ZodDate:return j$(t,r);case N.ZodUndefined:return x1(r);case N.ZodNull:return d1(r);case N.ZodArray:return Yz(t,r);case N.ZodUnion:case N.ZodDiscriminatedUnion:return f1(t,r);case N.ZodIntersection:return i1(t,r);case N.ZodTuple:return w1(t,r);case N.ZodRecord:return Uy(t,r);case N.ZodLiteral:return s1(t,r);case N.ZodEnum:return o1(t);case N.ZodNativeEnum:return u1(t);case N.ZodNullable:return m1(t,r);case N.ZodOptional:return _1(t,r);case N.ZodMap:return c1(t,r);case N.ZodSet:return b1(t,r);case N.ZodLazy:return()=>t.getter()._def;case N.ZodPromise:return v1(t,r);case N.ZodNaN:case N.ZodNever:return l1(r);case N.ZodEffects:return n1(t,r);case N.ZodAny:return pt(r);case N.ZodUnknown:return $1(r);case N.ZodDefault:return r1(t,r);case N.ZodBranded:return Dy(t,r);case N.ZodReadonly:return I1(t,r);case N.ZodCatch:return t1(t,r);case N.ZodPipeline:return y1(t,r);case N.ZodFunction:case N.ZodVoid:case N.ZodSymbol:return;default:return(n=>{})(e)}};function he(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==jz)return a}if(n&&!r){let a=uK(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=S1(t,t.typeName,e),s=typeof i=="function"?he(i(),e):i;if(s&&lK(t,e,s),e.postProcess){let a=e.postProcess(s,t,e);return o.jsonSchema=s,a}return o.jsonSchema=s,s}var uK=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Cy(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),pt(e)):e.$refStrategy==="seen"?pt(e):void 0}},lK=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var k1=(t,e)=>{let r=Lz(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:he(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??pt(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=he(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??pt(r),s=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;s!==void 0&&(i.title=s),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=o===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function $o(t,e){let r=typeof t;if(r!==typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let n=t.length;if(n!==e.length)return!1;for(let o=0;o1?e[s.href]=t:(s.hash="",n===""?r=s:Kn(t,e,r))}}else if(t!==!0&&t!==!1)return e;let o=r.href+(n?"#"+n:"");if(e[o]!==void 0)throw new Error(`Duplicate schema URI "${o}".`);if(e[o]=t,t===!0||t===!1)return e;if(t.__absolute_uri__===void 0&&Object.defineProperty(t,"__absolute_uri__",{enumerable:!1,value:o}),t.$ref&&t.__absolute_ref__===void 0){let i=new URL(t.$ref,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_ref__",{enumerable:!1,value:i.href})}if(t.$recursiveRef&&t.__absolute_recursive_ref__===void 0){let i=new URL(t.$recursiveRef,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(t.$anchor){let i=new URL("#"+t.$anchor,r.href);e[i.href]=t}for(let i in t){if(mK[i])continue;let s=`${n}/${sn(i)}`,a=t[i];if(Array.isArray(a)){if(pK[i]){let c=a.length;for(let u=0;u%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,xK=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,$K=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,IK=/^(?:\/(?:[^~/]|~0|~1)*)*$/,SK=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,kK=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,TK=t=>{if(t[0]==='"')return!1;let[e,r,...n]=t.split("@");return!e||!r||n.length!==0||e.length>64||r.length>253||e[0]==="."||e.endsWith(".")||e.includes("..")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(e)?!1:r.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},EK=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,AK=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,OK=t=>t.length>1&&t.length<80&&(/^P\d+([.,]\d+)?W$/.test(t)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(t)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(t));function Io(t){return t.test.bind(t)}var U$={date:T1,time:E1.bind(void 0,!1),"date-time":RK,duration:OK,uri:MK,"uri-reference":Io(bK),"uri-template":Io(wK),url:Io(xK),email:TK,hostname:Io(vK),ipv4:Io(EK),ipv6:Io(AK),regex:DK,uuid:Io($K),"json-pointer":Io(IK),"json-pointer-uri-fragment":Io(SK),"relative-json-pointer":Io(kK)};function PK(t){return t%4===0&&(t%100!==0||t%400===0)}function T1(t){let e=t.match(gK);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&PK(r)?29:_K[n])}function E1(t,e){let r=e.match(yK);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3],s=!!r[5];return(n<=23&&o<=59&&i<=59||n==23&&o==59&&i==60)&&(!t||s)}var CK=/t|\s/i;function RK(t){let e=t.split(CK);return e.length==2&&T1(e[0])&&E1(!0,e[1])}var NK=/\/|:/,zK=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function MK(t){return NK.test(t)&&zK.test(t)}var jK=/[^\\]\\Z/;function DK(t){if(jK.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var A1;(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(A1||(A1={}));function O1(t){let e=0,r=t.length,n=0,o;for(;n=55296&&o<=56319&&n$o(t,ge))||H.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`}):_.some(ge=>t===ge)||H.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`})),b!==void 0){let ge=`${a}/not`;ot(t,b,r,n,o,i,s,ge).valid&&H.push({instanceLocation:s,keyword:"not",keywordLocation:ge,error:'Instance matched "not" schema.'})}let Ts=[];if(x!==void 0){let ge=`${a}/anyOf`,le=H.length,xe=!1;for(let ee=0;ee{let ve=Object.create(c),_e=ot(t,ee,r,n,o,p===!0?i:null,s,`${ge}/${q}`,ve);return H.push(..._e.errors),_e.valid&&Ts.push(ve),_e.valid}).length;xe===1?H.length=le:H.splice(le,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:ge,error:`Instance does not match exactly one subschema (${xe} matches).`})}if((l==="object"||l==="array")&&Object.assign(c,...Ts),F!==void 0){let ge=`${a}/if`;if(ot(t,F,r,n,o,i,s,ge,c).valid){if(J!==void 0){let xe=ot(t,J,r,n,o,i,s,`${a}/then`,c);xe.valid||H.push({instanceLocation:s,keyword:"if",keywordLocation:ge,error:'Instance does not match "then" schema.'},...xe.errors)}}else if(w!==void 0){let xe=ot(t,w,r,n,o,i,s,`${a}/else`,c);xe.valid||H.push({instanceLocation:s,keyword:"if",keywordLocation:ge,error:'Instance does not match "else" schema.'},...xe.errors)}}if(l==="object"){if(v!==void 0)for(let ee of v)ee in t||H.push({instanceLocation:s,keyword:"required",keywordLocation:`${a}/required`,error:`Instance does not have required property "${ee}".`});let ge=Object.keys(t);if(pn!==void 0&&ge.lengthNo&&H.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${No} properties.`}),qe!==void 0){let ee=`${a}/propertyNames`;for(let q in t){let ve=`${s}/${sn(q)}`,_e=ot(q,qe,r,n,o,i,ve,ee);_e.valid||H.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:ee,error:`Property name "${q}" does not match schema.`},..._e.errors)}}if(Ul!==void 0){let ee=`${a}/dependantRequired`;for(let q in Ul)if(q in t){let ve=Ul[q];for(let _e of ve)_e in t||H.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:ee,error:`Instance has "${q}" but does not have "${_e}".`})}}if(Ss!==void 0)for(let ee in Ss){let q=`${a}/dependentSchemas`;if(ee in t){let ve=ot(t,Ss[ee],r,n,o,i,s,`${q}/${sn(ee)}`,c);ve.valid||H.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:q,error:`Instance has "${ee}" but does not match dependant schema.`},...ve.errors)}}if(ks!==void 0){let ee=`${a}/dependencies`;for(let q in ks)if(q in t){let ve=ks[q];if(Array.isArray(ve))for(let _e of ve)_e in t||H.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ee,error:`Instance has "${q}" but does not have "${_e}".`});else{let _e=ot(t,ve,r,n,o,i,s,`${ee}/${sn(q)}`);_e.valid||H.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ee,error:`Instance has "${q}" but does not match dependant schema.`},..._e.errors)}}}let le=Object.create(null),xe=!1;if(oe!==void 0){let ee=`${a}/properties`;for(let q in oe){if(!(q in t))continue;let ve=`${s}/${sn(q)}`,_e=ot(t[q],oe[q],r,n,o,i,ve,`${ee}/${sn(q)}`);if(_e.valid)c[q]=le[q]=!0;else if(xe=o,H.push({instanceLocation:s,keyword:"properties",keywordLocation:ee,error:`Property "${q}" does not match schema.`},..._e.errors),xe)break}}if(!xe&&Q!==void 0){let ee=`${a}/patternProperties`;for(let q in Q){let ve=new RegExp(q,"u"),_e=Q[q];for(let Er in t){if(!ve.test(Er))continue;let ET=`${s}/${sn(Er)}`,AT=ot(t[Er],_e,r,n,o,i,ET,`${ee}/${sn(q)}`);AT.valid?c[Er]=le[Er]=!0:(xe=o,H.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:ee,error:`Property "${Er}" matches pattern "${q}" but does not match associated schema.`},...AT.errors))}}}if(!xe&&wt!==void 0){let ee=`${a}/additionalProperties`;for(let q in t){if(le[q])continue;let ve=`${s}/${sn(q)}`,_e=ot(t[q],wt,r,n,o,i,ve,ee);_e.valid?c[q]=!0:(xe=o,H.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:ee,error:`Property "${q}" does not match additional properties schema.`},..._e.errors))}}else if(!xe&&dn!==void 0){let ee=`${a}/unevaluatedProperties`;for(let q in t)if(!c[q]){let ve=`${s}/${sn(q)}`,_e=ot(t[q],dn,r,n,o,i,ve,ee);_e.valid?c[q]=!0:H.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:ee,error:`Property "${q}" does not match unevaluated properties schema.`},..._e.errors)}}}else if(l==="array"){R!==void 0&&t.length>R&&H.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${t.length} > ${R}).`}),g!==void 0&&t.length=(Cn||0)&&(H.length=q),Cn===void 0&&y===void 0&&ve===0?H.splice(q,0,{instanceLocation:s,keyword:"contains",keywordLocation:ee,error:"Array does not contain item matching schema."}):Cn!==void 0&&vey&&H.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${y} items matching schema. ${ve} items were found.`})}if(!xe&&Bl!==void 0){let ee=`${a}/unevaluatedItems`;for(le;le=Ye||t>Ye)&&H.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${Tt?"or equal to ":""} ${Ye}.`})):(ze!==void 0&&tYe&&H.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${Ye}.`}),it!==void 0&&t<=it&&H.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${a}/exclusiveMinimum`,error:`${t} is less than ${it}.`}),Tt!==void 0&&t>=Tt&&H.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${a}/exclusiveMaximum`,error:`${t} is greater than or equal to ${Tt}.`})),Bt!==void 0){let ge=t%Bt;Math.abs(0-ge)>=11920929e-14&&Math.abs(Bt-ge)>=11920929e-14&&H.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${a}/multipleOf`,error:`${t} is not a multiple of ${Bt}.`})}}else if(l==="string"){let ge=Rn===void 0&&ht===void 0?0:O1(t);Rn!==void 0&&geht&&H.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${a}/maxLength`,error:`String is too long (${ge} > ${ht}).`}),fn!==void 0&&!new RegExp(fn,"u").test(t)&&H.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${a}/pattern`,error:"String does not match pattern."}),Z!==void 0&&U$[Z]&&!U$[Z](t)&&H.push({instanceLocation:s,keyword:"format",keywordLocation:`${a}/format`,error:`String does not match format "${Z}".`})}return{valid:H.length===0,errors:H}}var Fy=class{schema;draft;shortCircuit;lookup;constructor(e,r="2019-09",n=!0){this.schema=e,this.draft=r,this.shortCircuit=n,this.lookup=Kn(e)}validate(e){return ot(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,r){r&&(e={...e,$id:r}),Kn(e,this.lookup)}};var LK={};G(LK,{Validator:()=>Fy,deepCompareStrict:()=>$o,toJsonSchema:()=>an,validatesOnlyStrings:()=>ol});function an(t){if(nt(t)){let e=Oy(t,!0);if(wn(e)){let r=Hu(e,!0);return vo(r)}else return vo(t)}return vt(t)?k1(t):t}function ol(t){if(!t||typeof t!="object"||Object.keys(t).length===0||Array.isArray(t))return!1;if("type"in t)return typeof t.type=="string"?t.type==="string":Array.isArray(t.type)?t.type.every(e=>e==="string"):!1;if("enum"in t)return Array.isArray(t.enum)&&t.enum.length>0&&t.enum.every(e=>typeof e=="string");if("const"in t)return typeof t.const=="string";if("allOf"in t&&Array.isArray(t.allOf))return t.allOf.some(e=>ol(e));if("anyOf"in t&&Array.isArray(t.anyOf)||"oneOf"in t&&Array.isArray(t.oneOf)){let e="anyOf"in t?t.anyOf:t.oneOf;return e.length>0&&e.every(r=>ol(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=Kn(t);return r[e]?ol(r[e]):!1}return!1}var UK={};G(UK,{Graph:()=>By});function FK(t,e){if(t!==void 0&&!Ui(t))return t;if(Hd(e))try{let r=e.getName();return r=r.startsWith("Runnable")?r.slice(8):r,r}catch{return e.getName()}else return e.name??"UnknownSchema"}function BK(t){return Hd(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...an(t.data.schema),title:t.data.name}}}var By=class R1{nodes={};edges=[];constructor(e){this.nodes=e?.nodes??this.nodes,this.edges=e?.edges??this.edges}toJSON(){let e={};return Object.values(this.nodes).forEach((r,n)=>{e[r.id]=Ui(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...BK(r)})),edges:this.edges.map(r=>{let n={source:e[r.source],target:e[r.target]};return typeof r.data<"u"&&(n.data=r.data),typeof r.conditional<"u"&&(n.conditional=r.conditional),n})}}addNode(e,r,n){if(r!==void 0&&this.nodes[r]!==void 0)throw new Error(`Node with id ${r} already exists`);let o=r??Et(),i={id:o,data:e,name:FK(r,e),metadata:n};return this.nodes[o]=i,i}removeNode(e){delete this.nodes[e.id],this.edges=this.edges.filter(r=>r.source!==e.id&&r.target!==e.id)}addEdge(e,r,n,o){if(this.nodes[e.id]===void 0)throw new Error(`Source node ${e.id} not in graph`);if(this.nodes[r.id]===void 0)throw new Error(`Target node ${r.id} not in graph`);let i={source:e.id,target:r.id,data:n,conditional:o};return this.edges.push(i),i}firstNode(){return P1(this)}lastNode(){return C1(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(u=>u.id).every(Ui)&&(n="");let i=u=>n?`${n}:${u}`:u;Object.entries(e.nodes).forEach(([u,l])=>{this.nodes[i(u)]={...l,id:i(u)}});let s=e.edges.map(u=>({...u,source:i(u.source),target:i(u.target)}));this.edges=[...this.edges,...s];let a=e.firstNode(),c=e.lastNode();return[a?{id:i(a.id),data:a.data}:void 0,c?{id:i(c.id),data:c.data}:void 0]}trimFirstNode(){let e=this.firstNode();e&&P1(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&C1(this,[e.id])&&this.removeNode(e)}reid(){let e=Object.fromEntries(Object.values(this.nodes).map(o=>[o.id,o.name])),r=new Map;Object.values(e).forEach(o=>{r.set(o,(r.get(o)||0)+1)});let n=o=>{let i=e[o];return Ui(o)&&r.get(i)===1?i:o};return new R1({nodes:Object.fromEntries(Object.entries(this.nodes).map(([o,i])=>[n(o),{...i,id:n(o)}])),edges:this.edges.map(o=>({...o,source:n(o.source),target:n(o.target)}))})}drawMermaid(e){let{withStyles:r,curveStyle:n,nodeColors:o={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=e??{},s=this.reid(),a=s.firstNode(),c=s.lastNode();return Nz(s.nodes,s.edges,{firstNode:a?.id,lastNode:c?.id,withStyles:r,curveStyle:n,nodeColors:o,wrapLabelNWords:i})}async drawMermaidPng(e){let r=this.drawMermaid(e);return zz(r,{backgroundColor:e?.backgroundColor})}};function P1(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.source)).map(o=>o.target)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function C1(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.target)).map(o=>o.source)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function N1(t){let e=new TextEncoder,r=new ReadableStream({async start(n){for await(let o of t)n.enqueue(e.encode(`event: data +data: ${JSON.stringify(o)} + +`));n.enqueue(e.encode(`event: end + +`)),n.close()}});return br.fromReadableStream(r)}function F$(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}var z1=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function";function Zy(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*B$(t,e){for(;;){let{value:r,done:n}=Lt.runWithConfig(vr(t),e.next.bind(e),!0);if(n)break;yield r}}async function*qy(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Lt.runWithConfig(vr(t),r.next.bind(e),!0);if(o)break;yield n}}function Ot(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}var Ze=class extends uo{lc_runnable=!0;name;getName(t){let e=this.name??this.constructor.lc_name()??this.constructor.name;return t?`${e}${t}`:e}withRetry(t){return new Gy({bound:this,kwargs:{},config:{},maxAttemptNumber:t?.stopAfterAttempt,...t})}withConfig(t){return new as({bound:this,config:t,kwargs:{}})}withFallbacks(t){let e=Array.isArray(t)?t:t.fallbacks;return new Z$({runnable:this,fallbacks:e})}_getOptionsList(t,e=0){if(Array.isArray(t)&&t.length!==e)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${t.length} options for ${e} inputs`);if(Array.isArray(t))return t.map(Pe);if(e>1&&!Array.isArray(t)&&t.runId){console.warn("Provided runId will be used only for the first element of the batch.");let r=Object.fromEntries(Object.entries(t).filter(([n])=>n!=="runId"));return Array.from({length:e},(n,o)=>Pe(o===0?t:r))}return Array.from({length:e},()=>Pe(t))}async batch(t,e,r){let n=this._getOptionsList(e??{},t.length),o=n[0]?.maxConcurrency??r?.maxConcurrency,i=new Xo({maxConcurrency:o,onFailedAttempt:a=>{throw a}}),s=t.map((a,c)=>i.call(async()=>{try{return await this.invoke(a,n[c])}catch(u){if(r?.returnExceptions)return u;throw u}}));return Promise.all(s)}async*_streamIterator(t,e){yield this.invoke(t,e)}async stream(t,e){let r=Pe(e),n=new Zi({generator:this._streamIterator(t,r),config:r});return await n.setup,br.fromAsyncGenerator(n)}_separateRunnableConfigFromCallOptions(t){let e;t===void 0?e=Pe(t):e=Pe({callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,runName:t.runName,configurable:t.configurable,recursionLimit:t.recursionLimit,maxConcurrency:t.maxConcurrency,runId:t.runId,timeout:t.timeout,signal:t.signal});let r={...t};return delete r.callbacks,delete r.tags,delete r.metadata,delete r.runName,delete r.configurable,delete r.recursionLimit,delete r.maxConcurrency,delete r.runId,delete r.timeout,delete r.signal,[e,r]}async _callWithConfig(t,e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),Ot(e,"input"),n.runId,n?.runType,void 0,void 0,n?.runName??this.getName());delete n.runId;let s;try{let a=t.call(this,e,n,i);s=await vn(a,r?.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(Ot(s,"output")),s}async _batchWithConfig(t,e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(or)),s=await Promise.all(i.map(async(c,u)=>{let l=await c?.handleChainStart(this.toJSON(),Ot(e[u],"input"),o[u].runId,o[u].runType,void 0,void 0,o[u].runName??this.getName());return delete o[u].runId,l})),a;try{let c=t.call(this,e,o,s,n);a=await vn(c,o?.[0]?.signal)}catch(c){throw await Promise.all(s.map(u=>u?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(Ot(a,"output")))),a}_concatOutputChunks(t,e){return en(t,e)}async*_transformStreamWithConfig(t,e,r){let n,o=!0,i,s=!0,a=Pe(r),c=await or(a),u=this;async function*l(){for await(let f of t){if(o)if(n===void 0)n=f;else try{n=u._concatOutputChunks(n,f)}catch{n=void 0,o=!1}yield f}}let d;try{let f=await m0(e.bind(this),l(),async()=>c?.handleChainStart(this.toJSON(),{input:""},a.runId,a.runType,void 0,void 0,a.runName??this.getName()),r?.signal,a);delete a.runId,d=f.setup;let p=d?.handlers.find(ZR),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(_0);h!==void 0&&d!==void 0&&(m=h.tapOutputIterable(d.runId,m));for await(let _ of m)if(yield _,s)if(i===void 0)i=_;else try{i=this._concatOutputChunks(i,_)}catch{i=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:Ot(n,"input")}),f}await d?.handleChainEnd(i??{},void 0,void 0,void 0,{inputs:Ot(n,"input")})}getGraph(t){let e=new By,r=e.addNode({name:`${this.getName()}Input`,schema:$r.any()}),n=e.addNode(this),o=e.addNode({name:`${this.getName()}Output`,schema:$r.any()});return e.addEdge(r,n),e.addEdge(n,o),e}pipe(t){return new cs({first:this,last:cn(t)})}pick(t){return this.pipe(new q$(t))}assign(t){return this.pipe(new Bp(new us({steps:t})))}async*transform(t,e){let r;for await(let n of t)r===void 0?r=n:r=this._concatOutputChunks(r,n);yield*this._streamIterator(r,Pe(e))}async*streamLog(t,e,r){let n=new sg({...r,autoClose:!1,_schemaFormat:"original"}),o=Pe(e);yield*this._streamLog(t,n,o)}async*_streamLog(t,e,r){let{callbacks:n}=r;if(n===void 0)r.callbacks=[e];else if(Array.isArray(n))r.callbacks=n.concat([e]);else{let a=n.copy();a.addHandler(e,!0),r.callbacks=a}let o=this.stream(t,r);async function i(){try{let a=await o;for await(let c of a){let u=new ho({ops:[{op:"add",path:"/streamed_output/-",value:c}]});await e.writer.write(u)}}finally{await e.writer.close()}}let s=i();try{for await(let a of e)yield a}finally{await s}}streamEvents(t,e,r){let n;if(e.version==="v1")n=this._streamEventsV1(t,e,r);else if(e.version==="v2")n=this._streamEventsV2(t,e,r);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return e.encoding==="text/event-stream"?N1(n):br.fromAsyncGenerator(n)}async*_streamEventsV2(t,e,r){let n=new qR({...r,autoClose:!1}),o=Pe(e),i=o.runId??Et();o.runId=i;let s=o.callbacks;if(s===void 0)o.callbacks=[n];else if(Array.isArray(s))o.callbacks=s.concat(n);else{let p=s.copy();p.addHandler(n,!0),o.callbacks=p}let a=new AbortController,c=this;async function u(){let p,m=null;try{e?.signal?"any"in AbortSignal?p=AbortSignal.any([a.signal,e.signal]):(p=e.signal,m=()=>{a.abort()},e.signal.addEventListener("abort",m,{once:!0})):p=a.signal;let h=await c.stream(t,{...o,signal:p}),_=n.tapOutputIterable(i,h);for await(let v of _)if(a.signal.aborted)break}finally{await n.finish(),p&&m&&p.removeEventListener("abort",m)}}let l=u(),d=!1,f;try{for await(let p of n){if(!d){p.data.input=t,d=!0,f=p.run_id,yield p;continue}p.run_id===f&&p.event.endsWith("_end")&&p.data?.input&&delete p.data.input,yield p}}finally{a.abort(),await l}}async*_streamEventsV1(t,e,r){let n,o=!1,i=Pe(e),s=i.tags??[],a=i.metadata??{},c=i.runName??this.getName(),u=new sg({...r,autoClose:!1,_schemaFormat:"streaming_events"}),l=new KR({...r}),d=this._streamLog(t,u,i);for await(let p of d){if(n?n=n.concat(p):n=ig.fromRunLogPatch(p),n.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!o){o=!0;let v={...n.state},b={run_id:v.id,event:`on_${v.type}_start`,name:c,tags:s,metadata:a,data:{input:t}};l.includeEvent(b,v.type)&&(yield b)}let m=p.ops.filter(v=>v.path.startsWith("/logs/")).map(v=>v.path.split("/")[2]),h=[...new Set(m)];for(let v of h){let b,x={},k=n.state.logs[v];if(k.end_time===void 0?k.streamed_output.length>0?b="stream":b="start":b="end",b==="start")k.inputs!==void 0&&(x.input=k.inputs);else if(b==="end")k.inputs!==void 0&&(x.input=k.inputs),x.output=k.final_output;else if(b==="stream"){let T=k.streamed_output.length;if(T!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${T} instead. Encountered in: "${k.name}"`);x={chunk:k.streamed_output[0]},k.streamed_output=[]}yield{event:`on_${k.type}_${b}`,name:k.name,run_id:k.id,tags:k.tags,metadata:k.metadata,data:x}}let{state:_}=n;if(_.streamed_output.length>0){let v=_.streamed_output.length;if(v!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${v} instead. Encountered in: "${_.name}"`);let b={chunk:_.streamed_output[0]};_.streamed_output=[];let x={event:`on_${_.type}_stream`,run_id:_.id,tags:s,metadata:a,name:c,data:b};l.includeEvent(x,_.type)&&(yield x)}}let f=n?.state;if(f!==void 0){let p={event:`on_${f.type}_end`,name:c,run_id:f.id,tags:s,metadata:a,data:{output:f.final_output}};l.includeEvent(p,f.type)&&(yield p)}}static isRunnable(t){return Hd(t)}withListeners({onStart:t,onEnd:e,onError:r}){return new as({bound:this,config:{},configFactories:[n=>({callbacks:[new y0({config:n,onStart:t,onEnd:e,onError:r})]})]})}asTool(t){return VK(this,t)}},as=class M1 extends Ze{static lc_name(){return"RunnableBinding"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;bound;config;kwargs;configFactories;constructor(e){super(e),this.bound=e.bound,this.kwargs=e.kwargs,this.config=e.config,this.configFactories=e.configFactories}getName(e){return this.bound.getName(e)}async _mergeConfig(...e){let r=ga(this.config,...e);return ga(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new Gy({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:e?.stopAfterAttempt,...e})}async invoke(e,r){return this.bound.invoke(e,await this._mergeConfig(r,this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(Pe(i),this.kwargs))):await this._mergeConfig(Pe(r),this.kwargs);return this.bound.batch(e,o,n)}_concatOutputChunks(e,r){return this.bound._concatOutputChunks(e,r)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(Pe(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(Pe(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(Pe(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(Pe(r),o.kwargs),version:r.version},n)};return br.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&Ze.isRunnable(e.bound)}withListeners({onStart:e,onEnd:r,onError:n}){return new M1({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[o=>({callbacks:[new y0({config:o,onStart:e,onEnd:r,onError:n})]})]})}},j1=class D1 extends Ze{static lc_name(){return"RunnableEach"}lc_serializable=!0;lc_namespace=["langchain_core","runnables"];bound;constructor(e){super(e),this.bound=e.bound}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _invoke(e,r,n){return this.bound.batch(e,Ve(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new D1({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},Gy=class extends as{static lc_name(){return"RunnableRetry"}lc_namespace=["langchain_core","runnables"];maxAttemptNumber=3;onFailedAttempt=()=>{};constructor(t){super(t),this.maxAttemptNumber=t.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=t.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(t,e,r){let n=t>1?`retry:attempt:${t}`:void 0;return Ve(e,{callbacks:r?.getChild(n)})}async _invoke(t,e,r){return Kd(n=>super.invoke(t,this._patchConfigForRetry(n,e,r)),{onFailedAttempt:({error:n})=>this.onFailedAttempt(n,t),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(t,e){return this._callWithConfig(this._invoke.bind(this),t,e)}async _batch(t,e,r,n){let o={};try{await Kd(async i=>{let s=t.map((d,f)=>f).filter(d=>o[d.toString()]===void 0||o[d.toString()]instanceof Error),a=s.map(d=>t[d]),c=s.map(d=>this._patchConfigForRetry(i,e?.[d],r?.[d])),u=await super.batch(a,c,{...n,returnExceptions:!0}),l;for(let d=0;dthis.onFailedAttempt(i,i.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(i){if(n?.returnExceptions!==!0)throw i}return Object.keys(o).sort((i,s)=>parseInt(i,10)-parseInt(s,10)).map(i=>o[parseInt(i,10)])}async batch(t,e,r){return this._batchWithConfig(this._batch.bind(this),t,e,r)}},cs=class Fp extends Ze{static lc_name(){return"RunnableSequence"}first;middle=[];last;omitSequenceTags=!1;lc_serializable=!0;lc_namespace=["langchain_core","runnables"];constructor(e){super(e),this.first=e.first,this.middle=e.middle??this.middle,this.last=e.last,this.name=e.name,this.omitSequenceTags=e.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),Ot(e,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let s=e,a;try{let c=[this.first,...this.middle];for(let u=0;u{let l=await c?.handleChainStart(this.toJSON(),Ot(e[u],"input"),o[u].runId,void 0,void 0,void 0,o[u].runName);return delete o[u].runId,l})),a=e;try{for(let c=0;c{let p=d?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`);return Ve(o[f],{callbacks:p})}),n);a=await vn(l,o[0]?.signal)}}catch(c){throw await Promise.all(s.map(u=>u?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(Ot(a,"output")))),a}_concatOutputChunks(e,r){return this.last._concatOutputChunks(e,r)}async*_streamIterator(e,r){let n=await or(r),{runId:o,...i}=r??{},s=await n?.handleChainStart(this.toJSON(),Ot(e,"input"),o,void 0,void 0,void 0,i?.runName),a=[this.first,...this.middle,this.last],c=!0,u;async function*l(){yield e}try{let d=a[0].transform(l(),Ve(i,{callbacks:s?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let f=1;f{let s=o.getGraph(e);i!==0&&s.trimFirstNode(),i!==this.steps.length-1&&s.trimLastNode(),r.extend(s);let a=s.firstNode();if(!a)throw new Error(`Runnable ${o} has no first node`);n&&r.addEdge(n,a),n=s.lastNode()}),r}pipe(e){return Fp.isRunnableSequence(e)?new Fp({first:this.first,middle:this.middle.concat([this.last,e.first,...e.middle]),last:e.last,name:this.name??e.name}):new Fp({first:this.first,middle:[...this.middle,this.last],last:cn(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&Ze.isRunnable(e)}static from([e,...r],n){let o={};return typeof n=="string"?o.name=n:n!==void 0&&(o=n),new Fp({...o,first:cn(e),middle:r.slice(0,-1).map(cn),last:cn(r[r.length-1])})}},us=class L1 extends Ze{static lc_name(){return"RunnableMap"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;steps;getStepsKeys(){return Object.keys(this.steps)}constructor(e){super(e),this.steps={};for(let[r,n]of Object.entries(e.steps))this.steps[r]=cn(n)}static from(e){return new L1({steps:e})}async invoke(e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),{input:e},n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let s={};try{let a=Object.entries(this.steps).map(async([c,u])=>{s[c]=await u.invoke(e,Ve(n,{callbacks:i?.getChild(`map:key:${c}`)}))});await vn(Promise.all(a),r?.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(s),s}async*_transform(e,r,n){let o={...this.steps},i=Jh(e,Object.keys(o).length),s=new Map(Object.entries(o).map(([a,c],u)=>{let l=c.transform(i[u],Ve(n,{callbacks:r?.getChild(`map:key:${a}`)}));return[a,l.next().then(d=>({key:a,gen:l,result:d}))]}));for(;s.size;){let a=Promise.race(s.values()),{key:c,result:u,gen:l}=await vn(a,n?.signal);s.delete(c),u.done||(yield{[c]:u.value},s.set(c,l.next().then(d=>({key:c,gen:l,result:d}))))}}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Pe(r),i=new Zi({generator:this.transform(n(),o),config:o});return await i.setup,br.fromAsyncGenerator(i)}},ZK=class U1 extends Ze{lc_serializable=!1;lc_namespace=["langchain_core","runnables"];func;constructor(e){if(super(e),!Kh(e.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=e.func}async invoke(e,r){let[n]=this._getOptionsList(r??{},1),o=await or(n),i=this.func(Ve(n,{callbacks:o}),e);return vn(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(Zy(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(z1(o)){for(;;){n?.signal?.throwIfAborted();let i=o.next();if(i.done)break;yield i.value}return}yield o}static from(e){return new U1({func:e})}};function qK(t){if(Kh(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}var Dr=class F1 extends Ze{static lc_name(){return"RunnableLambda"}lc_namespace=["langchain_core","runnables"];func;constructor(e){if(Kh(e.func))return ZK.from(e.func);super(e),qK(e.func),this.func=e.func}static from(e){return new F1({func:e})}async _invoke(e,r,n){return new Promise((o,i)=>{let s=Ve(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??Wh)-1});Lt.runWithConfig(vr(s),async()=>{try{let a=await this.func(e,{...s});if(a&&Ze.isRunnable(a)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");a=await a.invoke(e,{...s,recursionLimit:(s.recursionLimit??Wh)-1})}else if(Zy(a)){let c;for await(let u of qy(s,a))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}a=c}else if(F$(a)){let c;for(let u of B$(s,a))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}a=c}o(a)}catch(a){i(a)}})})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async*_transform(e,r,n){let o;for await(let a of e)if(o===void 0)o=a;else try{o=this._concatOutputChunks(o,a)}catch{o=a}let i=Ve(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??Wh)-1}),s=await new Promise((a,c)=>{Lt.runWithConfig(vr(i),async()=>{try{let u=await this.func(o,{...i,config:i});a(u)}catch(u){c(u)}})});if(s&&Ze.isRunnable(s)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");let a=await s.stream(o,i);for await(let c of a)yield c}else if(Zy(s))for await(let a of qy(i,s))n?.signal?.throwIfAborted(),yield a;else if(F$(s))for(let a of B$(i,s))n?.signal?.throwIfAborted(),yield a;else yield s}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Pe(r),i=new Zi({generator:this.transform(n(),o),config:o});return await i.setup,br.fromAsyncGenerator(i)}},B1=class extends us{},Z$=class extends Ze{static lc_name(){return"RunnableWithFallbacks"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnable;fallbacks;constructor(t){super(t),this.runnable=t.runnable,this.fallbacks=t.fallbacks}*runnables(){yield this.runnable;for(let t of this.fallbacks)yield t}async invoke(t,e){let r=Pe(e),n=await or(r),{runId:o,...i}=r,s=await n?.handleChainStart(this.toJSON(),Ot(t,"input"),o,void 0,void 0,void 0,i?.runName),a=Ve(i,{callbacks:s?.getChild()});return await Lt.runWithConfig(a,async()=>{let u;for(let l of this.runnables()){r?.signal?.throwIfAborted();try{let d=await l.invoke(t,a);return await s?.handleChainEnd(Ot(d,"output")),d}catch(d){u===void 0&&(u=d)}}throw u===void 0?new Error("No error stored at end of fallback."):(await s?.handleChainError(u),u)})}async*_streamIterator(t,e){let r=Pe(e),n=await or(r),{runId:o,...i}=r,s=await n?.handleChainStart(this.toJSON(),Ot(t,"input"),o,void 0,void 0,void 0,i?.runName),a,c;for(let l of this.runnables()){r?.signal?.throwIfAborted();let d=Ve(i,{callbacks:s?.getChild()});try{let f=await l.stream(t,d);c=qy(d,f);break}catch(f){a===void 0&&(a=f)}}if(c===void 0){let l=a??new Error("No error stored at end of fallback.");throw await s?.handleChainError(l),l}let u;try{for await(let l of c){yield l;try{u=u===void 0?u:this._concatOutputChunks(u,l)}catch{u=void 0}}}catch(l){throw await s?.handleChainError(l),l}await s?.handleChainEnd(Ot(u,"output"))}async batch(t,e,r){if(r?.returnExceptions)throw new Error("Not implemented.");let n=this._getOptionsList(e??{},t.length),o=await Promise.all(n.map(a=>or(a))),i=await Promise.all(o.map(async(a,c)=>{let u=await a?.handleChainStart(this.toJSON(),Ot(t[c],"input"),n[c].runId,void 0,void 0,void 0,n[c].runName);return delete n[c].runId,u})),s;for(let a of this.runnables()){n[0].signal?.throwIfAborted();try{let c=await a.batch(t,i.map((u,l)=>Ve(n[l],{callbacks:u?.getChild()})),r);return await Promise.all(i.map((u,l)=>u?.handleChainEnd(Ot(c[l],"output")))),c}catch(c){s===void 0&&(s=c)}}throw s?(await Promise.all(i.map(a=>a?.handleChainError(s))),s):new Error("No error stored at end of fallbacks.")}};function cn(t){if(typeof t=="function")return new Dr({func:t});if(Ze.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=cn(n);return new us({steps:e})}else throw new Error(`Expected a Runnable, function or object. +Instead got an unsupported type.`)}var Bp=class extends Ze{static lc_name(){return"RunnableAssign"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;mapper;constructor(t){t instanceof us&&(t={mapper:t}),super(t),this.mapper=t.mapper}async invoke(t,e){let r=await this.mapper.invoke(t,e);return{...t,...r}}async*_transform(t,e,r){let n=this.mapper.getStepsKeys(),[o,i]=Jh(t),s=this.mapper.transform(i,Ve(r,{callbacks:e?.getChild()})),a=s.next();for await(let c of o){if(typeof c!="object"||Array.isArray(c))throw new Error(`RunnableAssign can only be used with objects as input, got ${typeof c}`);let u=Object.fromEntries(Object.entries(c).filter(([l])=>!n.includes(l)));Object.keys(u).length>0&&(yield u)}yield(await a).value;for await(let c of s)yield c}transform(t,e){return this._transformStreamWithConfig(t,this._transform.bind(this),e)}async stream(t,e){async function*r(){yield t}let n=Pe(e),o=new Zi({generator:this.transform(r(),n),config:n});return await o.setup,br.fromAsyncGenerator(o)}},q$=class extends Ze{static lc_name(){return"RunnablePick"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;keys;constructor(t){(typeof t=="string"||Array.isArray(t))&&(t={keys:t}),super(t),this.keys=t.keys}async _pick(t){if(typeof this.keys=="string")return t[this.keys];{let e=this.keys.map(r=>[r,t[r]]).filter(r=>r[1]!==void 0);return e.length===0?void 0:Object.fromEntries(e)}}async invoke(t,e){return this._callWithConfig(this._pick.bind(this),t,e)}async*_transform(t){for await(let e of t){let r=await this._pick(e);r!==void 0&&(yield r)}}transform(t,e){return this._transformStreamWithConfig(t,this._transform.bind(this),e)}async stream(t,e){async function*r(){yield t}let n=Pe(e),o=new Zi({generator:this.transform(r(),n),config:n});return await o.setup,br.fromAsyncGenerator(o)}},Vy=class extends as{name;description;schema;constructor(t){let e=cs.from([Dr.from(async r=>{let n;if(Mi(r))try{n=await ts(this.schema,r.args)}catch{throw new su("Received tool input did not match expected schema",JSON.stringify(r.args))}else n=r;return n}).withConfig({runName:`${t.name}:parse_input`}),t.bound]).withConfig({runName:t.name});super({bound:e,config:t.config??{}}),this.name=t.name,this.description=t.description,this.schema=t.schema}static lc_name(){return"RunnableToolLike"}};function VK(t,e){let r=e.name??t.getName(),n=e.description??rs(e.schema);return Wu(e.schema)?new Vy({name:r,description:n,schema:$r.object({input:$r.string()}).transform(o=>o.input),bound:t}):new Vy({name:r,description:n,schema:e.schema,bound:t})}var Ky=(t,e)=>{let r=[...new Set(e?.map(o=>{if(typeof o=="string")return o;let i=new o({});if(!("getType"in i)||typeof i.getType!="function")throw new Error("Invalid type provided.");return i.getType()}))],n=t.getType();return r.some(o=>o===n)};function K1(t,e){return Array.isArray(t)?Z1(t,e):Dr.from(r=>Z1(r,t))}function Z1(t,e={}){let{includeNames:r,excludeNames:n,includeTypes:o,excludeTypes:i,includeIds:s,excludeIds:a}=e,c=[];for(let u of t)if(!(n&&u.name&&n.includes(u.name))){{if(i&&Ky(u,i))continue;if(a&&u.id&&a.includes(u.id))continue}o||s||r?(r&&u.name&&r.some(l=>l===u.name)||o&&Ky(u,o)||s&&u.id&&s.some(l=>l===u.id))&&c.push(u):c.push(u)}return c}function H1(t){return Array.isArray(t)?q1(t):Dr.from(q1)}function q1(t){if(!t.length)return[];let e=[];for(let r of t){let n=r,o=e.pop();if(!o)e.push(n);else if(n.getType()==="tool"||n.getType()!==o.getType())e.push(o,n);else{let i=ca(o),s=ca(n),a=i.concat(s);typeof i.content=="string"&&typeof s.content=="string"&&(a.content=`${i.content} +${s.content}`),e.push(KK(a))}}return e}function W1(t,e){if(Array.isArray(t)){let r=t;if(!e)throw new Error("Options parameter is required when providing messages.");return V1(r,e)}else{let r=t;return Dr.from(n=>V1(n,r)).withConfig({runName:"trim_messages"})}}async function V1(t,e){let{maxTokens:r,tokenCounter:n,strategy:o="last",allowPartial:i=!1,endOn:s,startOn:a,includeSystem:c=!1,textSplitter:u}=e;if(a&&o==="first")throw new Error("`startOn` should only be specified if `strategy` is 'last'.");if(c&&o==="first")throw new Error("`includeSystem` should only be specified if `strategy` is 'last'.");let l;"getNumTokens"in n?l=async f=>(await Promise.all(f.map(m=>n.getNumTokens(m.content)))).reduce((m,h)=>m+h,0):l=async f=>n(f);let d=G$;if(u&&("splitText"in u?d=u.splitText:d=async f=>u(f)),o==="first")return J1(t,{maxTokens:r,tokenCounter:l,textSplitter:d,partialStrategy:i?"first":void 0,endOn:s});if(o==="last")return GK(t,{maxTokens:r,tokenCounter:l,textSplitter:d,allowPartial:i,includeSystem:c,startOn:a,endOn:s});throw new Error(`Unrecognized strategy: '${o}'. Must be one of 'first' or 'last'.`)}async function J1(t,e){let{maxTokens:r,tokenCounter:n,textSplitter:o,partialStrategy:i,endOn:s}=e,a=[...t],c=0;for(let u=0;u0?a.slice(0,-u):a;if(await n(l)<=r){c=a.length-u;break}}if(cb!=="type"&&!b.startsWith("lc_"))),_=V$(l.getType(),{...h,content:m}),v=[...a.slice(0,c),_];if(await n(v)<=r)a=v,c+=1,u=!0;else break}u&&i==="last"&&(l.content=[...f].reverse())}if(!u){let l=a[c],d;if(Array.isArray(l.content)&&l.content.some(f=>typeof f=="string"||f.type==="text")?d=l.content.find(p=>p.type==="text"&&p.text)?.text:typeof l.content=="string"&&(d=l.content),d){let f=await o(d),p=f.length;i==="last"&&f.reverse();for(let m=0;m0&&!Ky(a[c-1],u);)c-=1}return a.slice(0,c)}async function GK(t,e){let{allowPartial:r=!1,includeSystem:n=!1,endOn:o,startOn:i,...s}=e,a=t.map(l=>{let d=Object.fromEntries(Object.entries(l).filter(([f])=>f!=="type"&&!f.startsWith("lc_")));return V$(l.getType(),d,iu(l))});if(o){let l=Array.isArray(o)?o:[o];for(;a.length>0&&!Ky(a[a.length-1],l);)a=a.slice(0,-1)}let c=n&&a[0]?.getType()==="system",u=c?a.slice(0,1).concat(a.slice(1).reverse()):a.reverse();return u=await J1(u,{...s,partialStrategy:r?"last":void 0,endOn:i}),c?[u[0],...u.slice(1).reverse()]:u.reverse()}var G1={human:{message:mr,messageChunk:zi},ai:{message:jt,messageChunk:Dt},system:{message:hn,messageChunk:lo},developer:{message:hn,messageChunk:lo},tool:{message:Or,messageChunk:na},function:{message:oa,messageChunk:Ni},generic:{message:jn,messageChunk:Ri},remove:{message:ia,messageChunk:ia}};function V$(t,e,r){let n,o;switch(t){case"human":r?n=new zi(e):o=new mr(e);break;case"ai":if(r){let i={...e};"tool_calls"in i&&(i={...i,tool_call_chunks:i.tool_calls?.map(s=>({...s,type:"tool_call_chunk",index:void 0,args:JSON.stringify(s.args)}))}),n=new Dt(i)}else o=new jt(e);break;case"system":r?n=new lo(e):o=new hn(e);break;case"developer":r?n=new lo({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}}):o=new hn({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in e)r?n=new na(e):o=new Or(e);else throw new Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(r)n=new Ni(e);else{if(!e.name)throw new Error("FunctionMessage must have a 'name' field");o=new oa(e)}break;case"generic":if("role"in e)r?n=new Ri(e):o=new jn(e);else throw new Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw new Error(`Unrecognized message type ${t}`)}if(r&&n)return n;if(o)return o;throw new Error(`Unrecognized message type ${t}`)}function KK(t){let e=t.getType(),r,n=Object.fromEntries(Object.entries(t).filter(([o])=>!["type","tool_call_chunks"].includes(o)&&!o.startsWith("lc_")));if(e in G1&&(r=V$(e,n)),!r)throw new Error(`Unrecognized message chunk class ${e}. Supported classes are ${Object.keys(G1)}`);return r}function G$(t){let e=t.split(` +`);return Promise.resolve([...e.slice(0,-1).map(r=>`${r} +`),e[e.length-1]])}var X1=["tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result"];var Y1=["image","video","audio","text-plain","file"];var Q1=["text","reasoning",...X1,...Y1];var HK={};G(HK,{AIMessage:()=>jt,AIMessageChunk:()=>Dt,BaseMessage:()=>qt,BaseMessageChunk:()=>fr,ChatMessage:()=>jn,ChatMessageChunk:()=>Ri,FunctionMessage:()=>oa,FunctionMessageChunk:()=>Ni,HumanMessage:()=>mr,HumanMessageChunk:()=>zi,KNOWN_BLOCK_TYPES:()=>Q1,RemoveMessage:()=>ia,SystemMessage:()=>hn,SystemMessageChunk:()=>lo,ToolMessage:()=>Or,ToolMessageChunk:()=>na,_isMessageFieldWithRole:()=>ih,_mergeDicts:()=>dt,_mergeLists:()=>ra,_mergeObj:()=>oh,_mergeStatus:()=>nh,coerceMessageLikeToMessage:()=>ji,collapseToolCallChunks:()=>lh,convertToChunk:()=>ca,convertToOpenAIImageBlock:()=>Xm,convertToProviderContentBlock:()=>$d,defaultTextSplitter:()=>G$,defaultToolCallParser:()=>Sd,filterMessages:()=>K1,getBufferString:()=>au,iife:()=>Xw,isAIMessage:()=>aa,isAIMessageChunk:()=>Td,isBase64ContentBlock:()=>ou,isBaseMessage:()=>Yr,isBaseMessageChunk:()=>iu,isChatMessage:()=>WA,isChatMessageChunk:()=>JA,isDataContentBlock:()=>Jr,isDirectToolOutput:()=>Id,isFunctionMessage:()=>XA,isFunctionMessageChunk:()=>YA,isHumanMessage:()=>QA,isHumanMessageChunk:()=>eO,isIDContentBlock:()=>Jm,isMessage:()=>Qm,isOpenAIToolCallArray:()=>VA,isPlainTextContentBlock:()=>bA,isSystemMessage:()=>tO,isSystemMessageChunk:()=>rO,isToolMessage:()=>Gw,isToolMessageChunk:()=>Kw,isURLContentBlock:()=>nu,mapChatMessagesToStoredMessages:()=>dO,mapStoredMessageToChatMessage:()=>Ed,mapStoredMessagesToChatMessages:()=>lO,mergeContent:()=>er,mergeMessageRuns:()=>H1,mergeResponseMetadata:()=>sh,mergeUsageMetadata:()=>ah,parseBase64DataUrl:()=>ta,parseMimeType:()=>Ym,trimMessages:()=>W1});function Zp(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function qp(t){return t!==void 0&&Ze.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function Vp(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(on(t.schema)||t.schema!=null&&typeof t.schema=="object"&&"type"in t.schema&&typeof t.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(t.schema.type))}function qa(t){return Vp(t)||qp(t)||Zp(t)}var JK={};G(JK,{convertToOpenAIFunction:()=>eM,convertToOpenAITool:()=>tM,isLangChainTool:()=>qa,isRunnableToolLike:()=>qp,isStructuredTool:()=>Zp,isStructuredToolParams:()=>Vp});function eM(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:an(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function tM(t,e){let r=typeof e=="number"?void 0:e,n;return qa(t)?n={type:"function",function:eM(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var XK={};G(XK,{extendInteropZodObject:()=>Oz,getInteropZodDefaultGetter:()=>Cz,getInteropZodObjectShape:()=>ky,getSchemaDescription:()=>rs,interopParse:()=>Tz,interopParseAsync:()=>ts,interopSafeParse:()=>kz,interopSafeParseAsync:()=>Ey,interopZodObjectMakeFieldsOptional:()=>Rz,interopZodObjectPartial:()=>Pz,interopZodObjectPassthrough:()=>Ty,interopZodObjectStrict:()=>Hu,interopZodTransformInputSchema:()=>Oy,isInteropZodError:()=>Py,isInteropZodLiteral:()=>Sz,isInteropZodObject:()=>Az,isInteropZodSchema:()=>on,isShapelessZodSchema:()=>Ez,isSimpleStringZodSchema:()=>Wu,isZodArrayV4:()=>Mp,isZodLiteralV3:()=>E$,isZodLiteralV4:()=>A$,isZodNullableV4:()=>P$,isZodObjectV3:()=>Ay,isZodObjectV4:()=>wn,isZodOptionalV4:()=>O$,isZodSchema:()=>Iz,isZodSchemaV3:()=>vt,isZodSchemaV4:()=>nt});var av={};gi(av,{$brand:()=>Jd,$input:()=>D_,$output:()=>j_,NEVER:()=>lg,TimePrecision:()=>B_,ZodAny:()=>cM,ZodArray:()=>pM,ZodBase64:()=>$I,ZodBase64URL:()=>II,ZodBigInt:()=>Xp,ZodBigIntFormat:()=>TI,ZodBoolean:()=>Jp,ZodCIDRv4:()=>wI,ZodCIDRv6:()=>xI,ZodCUID:()=>mI,ZodCUID2:()=>hI,ZodCatch:()=>AM,ZodCodec:()=>zI,ZodCustom:()=>iv,ZodCustomStringFormat:()=>Hp,ZodDate:()=>rv,ZodDefault:()=>$M,ZodDiscriminatedUnion:()=>fM,ZodE164:()=>SI,ZodEmail:()=>dI,ZodEmoji:()=>pI,ZodEnum:()=>Gp,ZodError:()=>QK,ZodFile:()=>bM,ZodFirstPartyTypeKind:()=>jI,ZodFunction:()=>DM,ZodGUID:()=>Yy,ZodIPv4:()=>vI,ZodIPv6:()=>bI,ZodISODate:()=>Wy,ZodISODateTime:()=>Hy,ZodISODuration:()=>Xy,ZodISOTime:()=>Jy,ZodIntersection:()=>mM,ZodIssueCode:()=>aW,ZodJWT:()=>kI,ZodKSUID:()=>yI,ZodLazy:()=>zM,ZodLiteral:()=>vM,ZodMAC:()=>oM,ZodMap:()=>_M,ZodNaN:()=>PM,ZodNanoID:()=>fI,ZodNever:()=>lM,ZodNonOptional:()=>RI,ZodNull:()=>aM,ZodNullable:()=>xM,ZodNumber:()=>Wp,ZodNumberFormat:()=>sl,ZodObject:()=>nv,ZodOptional:()=>CI,ZodPipe:()=>NI,ZodPrefault:()=>SM,ZodPromise:()=>jM,ZodReadonly:()=>CM,ZodRealError:()=>Lr,ZodRecord:()=>OI,ZodSet:()=>yM,ZodString:()=>Kp,ZodStringFormat:()=>et,ZodSuccess:()=>EM,ZodSymbol:()=>iM,ZodTemplateLiteral:()=>NM,ZodTransform:()=>wM,ZodTuple:()=>hM,ZodType:()=>Ae,ZodULID:()=>gI,ZodURL:()=>tv,ZodUUID:()=>oi,ZodUndefined:()=>sM,ZodUnion:()=>AI,ZodUnknown:()=>uM,ZodVoid:()=>dM,ZodXID:()=>_I,_ZodString:()=>lI,_default:()=>IM,_function:()=>eW,any:()=>DH,array:()=>Re,base64:()=>wH,base64url:()=>xH,bigint:()=>RH,boolean:()=>Nt,catch:()=>OM,check:()=>tW,cidrv4:()=>vH,cidrv6:()=>bH,clone:()=>Qe,codec:()=>XH,coerce:()=>DI,config:()=>yt,core:()=>nn,cuid:()=>dH,cuid2:()=>pH,custom:()=>MI,date:()=>UH,decode:()=>rI,decodeAsync:()=>oI,describe:()=>rW,discriminatedUnion:()=>ov,e164:()=>$H,email:()=>tH,emoji:()=>uH,encode:()=>tI,encodeAsync:()=>nI,endsWith:()=>Bu,enum:()=>zt,file:()=>KH,flattenError:()=>yu,float32:()=>AH,float64:()=>OH,formatError:()=>vu,function:()=>eW,getErrorMap:()=>uW,globalRegistry:()=>Ge,gt:()=>yo,gte:()=>ir,guid:()=>rH,hash:()=>EH,hex:()=>TH,hostname:()=>kH,httpUrl:()=>cH,includes:()=>Uu,instanceof:()=>oW,int:()=>uI,int32:()=>PH,int64:()=>NH,intersection:()=>Qp,ipv4:()=>gH,ipv6:()=>yH,iso:()=>il,json:()=>sW,jwt:()=>IH,keyof:()=>FH,ksuid:()=>hH,lazy:()=>MM,length:()=>Sa,literal:()=>se,locales:()=>Ou,looseObject:()=>un,lowercase:()=>Du,lt:()=>_o,lte:()=>zr,mac:()=>_H,map:()=>qH,maxLength:()=>Ia,maxSize:()=>$a,meta:()=>nW,mime:()=>Zu,minLength:()=>Qo,minSize:()=>es,multipleOf:()=>Qi,nan:()=>JH,nanoid:()=>lH,nativeEnum:()=>GH,negative:()=>hy,never:()=>EI,nonnegative:()=>_y,nonoptional:()=>TM,nonpositive:()=>gy,normalize:()=>qu,null:()=>Yp,nullable:()=>Qy,nullish:()=>HH,number:()=>We,object:()=>U,optional:()=>ie,overwrite:()=>Zn,parse:()=>X$,parseAsync:()=>Y$,partialRecord:()=>ZH,pipe:()=>ev,positive:()=>my,prefault:()=>kM,preprocess:()=>sv,prettifyError:()=>mg,promise:()=>QH,property:()=>yy,readonly:()=>RM,record:()=>bt,refine:()=>LM,regex:()=>ju,regexes:()=>Nr,registry:()=>fp,safeDecode:()=>sI,safeDecodeAsync:()=>cI,safeEncode:()=>iI,safeEncodeAsync:()=>aI,safeParse:()=>Q$,safeParseAsync:()=>eI,set:()=>VH,setErrorMap:()=>cW,size:()=>Mu,slugify:()=>Np,startsWith:()=>Fu,strictObject:()=>BH,string:()=>A,stringFormat:()=>SH,stringbool:()=>iW,success:()=>WH,superRefine:()=>UM,symbol:()=>MH,templateLiteral:()=>YH,toJSONSchema:()=>vo,toLowerCase:()=>Gu,toUpperCase:()=>Ku,transform:()=>PI,treeifyError:()=>fg,trim:()=>Vu,tuple:()=>gM,uint32:()=>CH,uint64:()=>zH,ulid:()=>fH,undefined:()=>jH,union:()=>tt,unknown:()=>ft,uppercase:()=>Lu,url:()=>aH,util:()=>M,uuid:()=>nH,uuidv4:()=>oH,uuidv6:()=>iH,uuidv7:()=>sH,void:()=>LH,xid:()=>mH});var il={};gi(il,{ZodISODate:()=>Wy,ZodISODateTime:()=>Hy,ZodISODuration:()=>Xy,ZodISOTime:()=>Jy,date:()=>H$,datetime:()=>K$,duration:()=>J$,time:()=>W$});var Hy=$("ZodISODateTime",(t,e)=>{Bg.init(t,e),et.init(t,e)});function K$(t){return Z_(Hy,t)}var Wy=$("ZodISODate",(t,e)=>{Zg.init(t,e),et.init(t,e)});function H$(t){return q_(Wy,t)}var Jy=$("ZodISOTime",(t,e)=>{qg.init(t,e),et.init(t,e)});function W$(t){return V_(Jy,t)}var Xy=$("ZodISODuration",(t,e)=>{Vg.init(t,e),et.init(t,e)});function J$(t){return G_(Xy,t)}var nM=(t,e)=>{np.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>vu(t,r)},flatten:{value:r=>yu(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,hu,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,hu,2)}},isEmpty:{get(){return t.issues.length===0}}})},QK=$("ZodError",nM),Lr=$("ZodError",nM,{Parent:Error});var X$=bu(Lr),Y$=wu(Lr),Q$=xu(Lr),eI=$u(Lr),tI=hg(Lr),rI=gg(Lr),nI=_g(Lr),oI=yg(Lr),iI=vg(Lr),sI=bg(Lr),aI=wg(Lr),cI=xg(Lr);var Ae=$("ZodType",(t,e)=>(ye.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(M.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>Qe(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>X$(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Q$(t,r,n),t.parseAsync=async(r,n)=>Y$(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>eI(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>tI(t,r,n),t.decode=(r,n)=>rI(t,r,n),t.encodeAsync=async(r,n)=>nI(t,r,n),t.decodeAsync=async(r,n)=>oI(t,r,n),t.safeEncode=(r,n)=>iI(t,r,n),t.safeDecode=(r,n)=>sI(t,r,n),t.safeEncodeAsync=async(r,n)=>aI(t,r,n),t.safeDecodeAsync=async(r,n)=>cI(t,r,n),t.refine=(r,n)=>t.check(LM(r,n)),t.superRefine=r=>t.check(UM(r)),t.overwrite=r=>t.check(Zn(r)),t.optional=()=>ie(t),t.nullable=()=>Qy(t),t.nullish=()=>ie(Qy(t)),t.nonoptional=r=>TM(t,r),t.array=()=>Re(t),t.or=r=>tt([t,r]),t.and=r=>Qp(t,r),t.transform=r=>ev(t,PI(r)),t.default=r=>IM(t,r),t.prefault=r=>kM(t,r),t.catch=r=>OM(t,r),t.pipe=r=>ev(t,r),t.readonly=()=>RM(t),t.describe=r=>{let n=t.clone();return Ge.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ge.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ge.get(t);let n=t.clone();return Ge.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),lI=$("_ZodString",(t,e)=>{Yi.init(t,e),Ae.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(ju(...n)),t.includes=(...n)=>t.check(Uu(...n)),t.startsWith=(...n)=>t.check(Fu(...n)),t.endsWith=(...n)=>t.check(Bu(...n)),t.min=(...n)=>t.check(Qo(...n)),t.max=(...n)=>t.check(Ia(...n)),t.length=(...n)=>t.check(Sa(...n)),t.nonempty=(...n)=>t.check(Qo(1,...n)),t.lowercase=n=>t.check(Du(n)),t.uppercase=n=>t.check(Lu(n)),t.trim=()=>t.check(Vu()),t.normalize=(...n)=>t.check(qu(...n)),t.toLowerCase=()=>t.check(Gu()),t.toUpperCase=()=>t.check(Ku()),t.slugify=()=>t.check(Np())}),Kp=$("ZodString",(t,e)=>{Yi.init(t,e),lI.init(t,e),t.email=r=>t.check(mp(dI,r)),t.url=r=>t.check(Ru(tv,r)),t.jwt=r=>t.check(Rp(kI,r)),t.emoji=r=>t.check(vp(pI,r)),t.guid=r=>t.check(Cu(Yy,r)),t.uuid=r=>t.check(hp(oi,r)),t.uuidv4=r=>t.check(gp(oi,r)),t.uuidv6=r=>t.check(_p(oi,r)),t.uuidv7=r=>t.check(yp(oi,r)),t.nanoid=r=>t.check(bp(fI,r)),t.guid=r=>t.check(Cu(Yy,r)),t.cuid=r=>t.check(wp(mI,r)),t.cuid2=r=>t.check(xp(hI,r)),t.ulid=r=>t.check($p(gI,r)),t.base64=r=>t.check(Op($I,r)),t.base64url=r=>t.check(Pp(II,r)),t.xid=r=>t.check(Ip(_I,r)),t.ksuid=r=>t.check(Sp(yI,r)),t.ipv4=r=>t.check(kp(vI,r)),t.ipv6=r=>t.check(Tp(bI,r)),t.cidrv4=r=>t.check(Ep(wI,r)),t.cidrv6=r=>t.check(Ap(xI,r)),t.e164=r=>t.check(Cp(SI,r)),t.datetime=r=>t.check(K$(r)),t.date=r=>t.check(H$(r)),t.time=r=>t.check(W$(r)),t.duration=r=>t.check(J$(r))});function A(t){return L_(Kp,t)}var et=$("ZodStringFormat",(t,e)=>{He.init(t,e),lI.init(t,e)}),dI=$("ZodEmail",(t,e)=>{Rg.init(t,e),et.init(t,e)});function tH(t){return mp(dI,t)}var Yy=$("ZodGUID",(t,e)=>{Pg.init(t,e),et.init(t,e)});function rH(t){return Cu(Yy,t)}var oi=$("ZodUUID",(t,e)=>{Cg.init(t,e),et.init(t,e)});function nH(t){return hp(oi,t)}function oH(t){return gp(oi,t)}function iH(t){return _p(oi,t)}function sH(t){return yp(oi,t)}var tv=$("ZodURL",(t,e)=>{Ng.init(t,e),et.init(t,e)});function aH(t){return Ru(tv,t)}function cH(t){return Ru(tv,{protocol:/^https?$/,hostname:Nr.domain,...M.normalizeParams(t)})}var pI=$("ZodEmoji",(t,e)=>{zg.init(t,e),et.init(t,e)});function uH(t){return vp(pI,t)}var fI=$("ZodNanoID",(t,e)=>{Mg.init(t,e),et.init(t,e)});function lH(t){return bp(fI,t)}var mI=$("ZodCUID",(t,e)=>{jg.init(t,e),et.init(t,e)});function dH(t){return wp(mI,t)}var hI=$("ZodCUID2",(t,e)=>{Dg.init(t,e),et.init(t,e)});function pH(t){return xp(hI,t)}var gI=$("ZodULID",(t,e)=>{Lg.init(t,e),et.init(t,e)});function fH(t){return $p(gI,t)}var _I=$("ZodXID",(t,e)=>{Ug.init(t,e),et.init(t,e)});function mH(t){return Ip(_I,t)}var yI=$("ZodKSUID",(t,e)=>{Fg.init(t,e),et.init(t,e)});function hH(t){return Sp(yI,t)}var vI=$("ZodIPv4",(t,e)=>{Gg.init(t,e),et.init(t,e)});function gH(t){return kp(vI,t)}var oM=$("ZodMAC",(t,e)=>{Hg.init(t,e),et.init(t,e)});function _H(t){return F_(oM,t)}var bI=$("ZodIPv6",(t,e)=>{Kg.init(t,e),et.init(t,e)});function yH(t){return Tp(bI,t)}var wI=$("ZodCIDRv4",(t,e)=>{Wg.init(t,e),et.init(t,e)});function vH(t){return Ep(wI,t)}var xI=$("ZodCIDRv6",(t,e)=>{Jg.init(t,e),et.init(t,e)});function bH(t){return Ap(xI,t)}var $I=$("ZodBase64",(t,e)=>{Xg.init(t,e),et.init(t,e)});function wH(t){return Op($I,t)}var II=$("ZodBase64URL",(t,e)=>{Yg.init(t,e),et.init(t,e)});function xH(t){return Pp(II,t)}var SI=$("ZodE164",(t,e)=>{Qg.init(t,e),et.init(t,e)});function $H(t){return Cp(SI,t)}var kI=$("ZodJWT",(t,e)=>{e_.init(t,e),et.init(t,e)});function IH(t){return Rp(kI,t)}var Hp=$("ZodCustomStringFormat",(t,e)=>{t_.init(t,e),et.init(t,e)});function SH(t,e,r={}){return ka(Hp,t,e,r)}function kH(t){return ka(Hp,"hostname",Nr.hostname,t)}function TH(t){return ka(Hp,"hex",Nr.hex,t)}function EH(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=Nr[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return ka(Hp,n,o,e)}var Wp=$("ZodNumber",(t,e)=>{ap.init(t,e),Ae.init(t,e),t.gt=(n,o)=>t.check(yo(n,o)),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.lt=(n,o)=>t.check(_o(n,o)),t.lte=(n,o)=>t.check(zr(n,o)),t.max=(n,o)=>t.check(zr(n,o)),t.int=n=>t.check(uI(n)),t.safe=n=>t.check(uI(n)),t.positive=n=>t.check(yo(0,n)),t.nonnegative=n=>t.check(ir(0,n)),t.negative=n=>t.check(_o(0,n)),t.nonpositive=n=>t.check(zr(0,n)),t.multipleOf=(n,o)=>t.check(Qi(n,o)),t.step=(n,o)=>t.check(Qi(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function We(t){return K_(Wp,t)}var sl=$("ZodNumberFormat",(t,e)=>{r_.init(t,e),Wp.init(t,e)});function uI(t){return W_(sl,t)}function AH(t){return J_(sl,t)}function OH(t){return X_(sl,t)}function PH(t){return Y_(sl,t)}function CH(t){return Q_(sl,t)}var Jp=$("ZodBoolean",(t,e)=>{ku.init(t,e),Ae.init(t,e)});function Nt(t){return ey(Jp,t)}var Xp=$("ZodBigInt",(t,e)=>{cp.init(t,e),Ae.init(t,e),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.gt=(n,o)=>t.check(yo(n,o)),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.lt=(n,o)=>t.check(_o(n,o)),t.lte=(n,o)=>t.check(zr(n,o)),t.max=(n,o)=>t.check(zr(n,o)),t.positive=n=>t.check(yo(BigInt(0),n)),t.negative=n=>t.check(_o(BigInt(0),n)),t.nonpositive=n=>t.check(zr(BigInt(0),n)),t.nonnegative=n=>t.check(ir(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(Qi(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function RH(t){return ry(Xp,t)}var TI=$("ZodBigIntFormat",(t,e)=>{n_.init(t,e),Xp.init(t,e)});function NH(t){return oy(TI,t)}function zH(t){return iy(TI,t)}var iM=$("ZodSymbol",(t,e)=>{o_.init(t,e),Ae.init(t,e)});function MH(t){return sy(iM,t)}var sM=$("ZodUndefined",(t,e)=>{i_.init(t,e),Ae.init(t,e)});function jH(t){return ay(sM,t)}var aM=$("ZodNull",(t,e)=>{s_.init(t,e),Ae.init(t,e)});function Yp(t){return cy(aM,t)}var cM=$("ZodAny",(t,e)=>{a_.init(t,e),Ae.init(t,e)});function DH(){return uy(cM)}var uM=$("ZodUnknown",(t,e)=>{Tu.init(t,e),Ae.init(t,e)});function ft(){return Nu(uM)}var lM=$("ZodNever",(t,e)=>{Eu.init(t,e),Ae.init(t,e)});function EI(t){return zu(lM,t)}var dM=$("ZodVoid",(t,e)=>{c_.init(t,e),Ae.init(t,e)});function LH(t){return ly(dM,t)}var rv=$("ZodDate",(t,e)=>{u_.init(t,e),Ae.init(t,e),t.min=(n,o)=>t.check(ir(n,o)),t.max=(n,o)=>t.check(zr(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function UH(t){return dy(rv,t)}var pM=$("ZodArray",(t,e)=>{l_.init(t,e),Ae.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Qo(r,n)),t.nonempty=r=>t.check(Qo(1,r)),t.max=(r,n)=>t.check(Ia(r,n)),t.length=(r,n)=>t.check(Sa(r,n)),t.unwrap=()=>t.element});function Re(t,e){return T$(pM,t,e)}function FH(t){let e=t._zod.def.shape;return zt(Object.keys(e))}var nv=$("ZodObject",(t,e)=>{k$.init(t,e),Ae.init(t,e),M.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>zt(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ft()}),t.loose=()=>t.clone({...t._zod.def,catchall:ft()}),t.strict=()=>t.clone({...t._zod.def,catchall:EI()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>M.extend(t,r),t.safeExtend=r=>M.safeExtend(t,r),t.merge=r=>M.merge(t,r),t.pick=r=>M.pick(t,r),t.omit=r=>M.omit(t,r),t.partial=(...r)=>M.partial(CI,t,r[0]),t.required=(...r)=>M.required(RI,t,r[0])});function U(t,e){let r={type:"object",shape:t??{},...M.normalizeParams(e)};return new nv(r)}function BH(t,e){return new nv({type:"object",shape:t,catchall:EI(),...M.normalizeParams(e)})}function un(t,e){return new nv({type:"object",shape:t,catchall:ft(),...M.normalizeParams(e)})}var AI=$("ZodUnion",(t,e)=>{up.init(t,e),Ae.init(t,e),t.options=e.options});function tt(t,e){return new AI({type:"union",options:t,...M.normalizeParams(e)})}var fM=$("ZodDiscriminatedUnion",(t,e)=>{AI.init(t,e),d_.init(t,e)});function ov(t,e,r){return new fM({type:"union",options:e,discriminator:t,...M.normalizeParams(r)})}var mM=$("ZodIntersection",(t,e)=>{p_.init(t,e),Ae.init(t,e)});function Qp(t,e){return new mM({type:"intersection",left:t,right:e})}var hM=$("ZodTuple",(t,e)=>{lp.init(t,e),Ae.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});function gM(t,e,r){let n=e instanceof ye,o=n?r:e,i=n?e:null;return new hM({type:"tuple",items:t,rest:i,...M.normalizeParams(o)})}var OI=$("ZodRecord",(t,e)=>{f_.init(t,e),Ae.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function bt(t,e,r){return new OI({type:"record",keyType:t,valueType:e,...M.normalizeParams(r)})}function ZH(t,e,r){let n=Qe(t);return n._zod.values=void 0,new OI({type:"record",keyType:n,valueType:e,...M.normalizeParams(r)})}var _M=$("ZodMap",(t,e)=>{m_.init(t,e),Ae.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function qH(t,e,r){return new _M({type:"map",keyType:t,valueType:e,...M.normalizeParams(r)})}var yM=$("ZodSet",(t,e)=>{h_.init(t,e),Ae.init(t,e),t.min=(...r)=>t.check(es(...r)),t.nonempty=r=>t.check(es(1,r)),t.max=(...r)=>t.check($a(...r)),t.size=(...r)=>t.check(Mu(...r))});function VH(t,e){return new yM({type:"set",valueType:t,...M.normalizeParams(e)})}var Gp=$("ZodEnum",(t,e)=>{g_.init(t,e),Ae.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Gp({...e,checks:[],...M.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Gp({...e,checks:[],...M.normalizeParams(o),entries:i})}});function zt(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Gp({type:"enum",entries:r,...M.normalizeParams(e)})}function GH(t,e){return new Gp({type:"enum",entries:t,...M.normalizeParams(e)})}var vM=$("ZodLiteral",(t,e)=>{__.init(t,e),Ae.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function se(t,e){return new vM({type:"literal",values:Array.isArray(t)?t:[t],...M.normalizeParams(e)})}var bM=$("ZodFile",(t,e)=>{y_.init(t,e),Ae.init(t,e),t.min=(r,n)=>t.check(es(r,n)),t.max=(r,n)=>t.check($a(r,n)),t.mime=(r,n)=>t.check(Zu(Array.isArray(r)?r:[r],n))});function KH(t){return vy(bM,t)}var wM=$("ZodTransform",(t,e)=>{v_.init(t,e),Ae.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(M.issue(i,r.value,e));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(M.issue(s))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function PI(t){return new wM({type:"transform",transform:t})}var CI=$("ZodOptional",(t,e)=>{xa.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function ie(t){return new CI({type:"optional",innerType:t})}var xM=$("ZodNullable",(t,e)=>{b_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Qy(t){return new xM({type:"nullable",innerType:t})}function HH(t){return ie(Qy(t))}var $M=$("ZodDefault",(t,e)=>{w_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function IM(t,e){return new $M({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var SM=$("ZodPrefault",(t,e)=>{x_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function kM(t,e){return new SM({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var RI=$("ZodNonOptional",(t,e)=>{$_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function TM(t,e){return new RI({type:"nonoptional",innerType:t,...M.normalizeParams(e)})}var EM=$("ZodSuccess",(t,e)=>{I_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function WH(t){return new EM({type:"success",innerType:t})}var AM=$("ZodCatch",(t,e)=>{S_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function OM(t,e){return new AM({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var PM=$("ZodNaN",(t,e)=>{k_.init(t,e),Ae.init(t,e)});function JH(t){return fy(PM,t)}var NI=$("ZodPipe",(t,e)=>{T_.init(t,e),Ae.init(t,e),t.in=e.in,t.out=e.out});function ev(t,e){return new NI({type:"pipe",in:t,out:e})}var zI=$("ZodCodec",(t,e)=>{NI.init(t,e),Au.init(t,e)});function XH(t,e,r){return new zI({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var CM=$("ZodReadonly",(t,e)=>{E_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function RM(t){return new CM({type:"readonly",innerType:t})}var NM=$("ZodTemplateLiteral",(t,e)=>{A_.init(t,e),Ae.init(t,e)});function YH(t,e){return new NM({type:"template_literal",parts:t,...M.normalizeParams(e)})}var zM=$("ZodLazy",(t,e)=>{C_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.getter()});function MM(t){return new zM({type:"lazy",getter:t})}var jM=$("ZodPromise",(t,e)=>{P_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function QH(t){return new jM({type:"promise",innerType:t})}var DM=$("ZodFunction",(t,e)=>{O_.init(t,e),Ae.init(t,e)});function eW(t){return new DM({type:"function",input:Array.isArray(t?.input)?gM(t?.input):t?.input??Re(ft()),output:t?.output??ft()})}var iv=$("ZodCustom",(t,e)=>{R_.init(t,e),Ae.init(t,e)});function tW(t){let e=new Je({check:"custom"});return e._zod.check=t,e}function MI(t,e){return by(iv,t??(()=>!0),e)}function LM(t,e={}){return wy(iv,t,e)}function UM(t){return xy(t)}var rW=$y,nW=Iy;function oW(t,e={error:`Input not instance of ${t.name}`}){let r=new iv({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...M.normalizeParams(e)});return r._zod.bag.Class=t,r}var iW=(...t)=>Sy({Codec:zI,Boolean:Jp,String:Kp},...t);function sW(t){let e=MM(()=>tt([A(t),We(),Nt(),Yp(),Re(e),bt(A(),e)]));return e}function sv(t,e){return ev(PI(t),e)}var aW={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function cW(t){yt({customError:t})}function uW(){return yt().customError}var jI;jI||(jI={});var DI={};gi(DI,{bigint:()=>fW,boolean:()=>pW,date:()=>mW,number:()=>dW,string:()=>lW});function lW(t){return U_(Kp,t)}function dW(t){return H_(Wp,t)}function pW(t){return ty(Jp,t)}function fW(t){return ny(Xp,t)}function mW(t){return py(rv,t)}yt(N_());var hW=Symbol("Let zodToJsonSchema decide on which parser to use");var bW={};G(bW,{BasePromptValue:()=>cv,ChatPromptValue:()=>UI,ImagePromptValue:()=>wW,StringPromptValue:()=>LI});var cv=class extends uo{},LI=class extends cv{static lc_name(){return"StringPromptValue"}lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;value;constructor(t){super({value:t}),this.value=t}toString(){return this.value}toChatMessages(){return[new mr(this.value)]}},UI=class extends cv{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ChatPromptValue"}messages;constructor(t){Array.isArray(t)&&(t={messages:t}),super(t),this.messages=t.messages}toString(){return au(this.messages)}toChatMessages(){return this.messages}},wW=class extends cv{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ImagePromptValue"}imageUrl;value;constructor(t){"imageUrl"in t||(t={imageUrl:t}),super(t),this.imageUrl=t.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new mr({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}};var te="0123456789abcdef".split(""),xW=[-2147483648,8388608,32768,128],Hn=[24,16,8,0],uv=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Ut=[];function Wn(t,e){e?(Ut[0]=Ut[16]=Ut[1]=Ut[2]=Ut[3]=Ut[4]=Ut[5]=Ut[6]=Ut[7]=Ut[8]=Ut[9]=Ut[10]=Ut[11]=Ut[12]=Ut[13]=Ut[14]=Ut[15]=0,this.blocks=Ut):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}Wn.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if(r!=="string"){if(r==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);e=!0}for(var n,o=0,i,s=t.length,a=this.blocks;o>>2]|=t[o]<>>2]|=n<>>2]|=(192|n>>>6)<>>2]|=(128|n&63)<=57344?(a[i>>>2]|=(224|n>>>12)<>>2]|=(128|n>>>6&63)<>>2]|=(128|n&63)<>>2]|=(240|n>>>18)<>>2]|=(128|n>>>12&63)<>>2]|=(128|n>>>6&63)<>>2]|=(128|n&63)<=64?(this.block=a[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};Wn.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=xW[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}};Wn.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=this.blocks,u,l,d,f,p,m,h,_,v,b,x;for(u=16;u<64;++u)p=c[u-15],l=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=c[u-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,c[u]=c[u-16]+l+c[u-7]+d<<0;for(x=e&r,u=0;u<64;u+=4)this.first?(this.is224?(_=300032,p=c[0]-1413257819,a=p-150054599<<0,n=p+24177077<<0):(_=704751109,p=c[0]-210244248,a=p-1521486534<<0,n=p+143694565<<0),this.first=!1):(l=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),_=t&e,f=_^t&r^x,h=o&i^~o&s,p=a+d+h+uv[u]+c[u],m=l+f,a=n+p<<0,n=p+m<<0),l=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),v=n&t,f=v^n&e^_,h=s&a^~s&o,p=i+d+h+uv[u+1]+c[u+1],m=l+f,s=r+p<<0,r=p+m<<0,l=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=r&n,f=b^r&t^v,h=i&s^~i&a,p=o+d+h+uv[u+2]+c[u+2],m=l+f,i=e+p<<0,e=p+m<<0,l=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),x=e&r,f=x^e&n^b,h=i&s^~i&a,p=o+d+h+uv[u+3]+c[u+3],m=l+f,o=t+p<<0,t=p+m<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0,this.h5=this.h5+i<<0,this.h6=this.h6+s<<0,this.h7=this.h7+a<<0};Wn.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=te[t>>>28&15]+te[t>>>24&15]+te[t>>>20&15]+te[t>>>16&15]+te[t>>>12&15]+te[t>>>8&15]+te[t>>>4&15]+te[t&15]+te[e>>>28&15]+te[e>>>24&15]+te[e>>>20&15]+te[e>>>16&15]+te[e>>>12&15]+te[e>>>8&15]+te[e>>>4&15]+te[e&15]+te[r>>>28&15]+te[r>>>24&15]+te[r>>>20&15]+te[r>>>16&15]+te[r>>>12&15]+te[r>>>8&15]+te[r>>>4&15]+te[r&15]+te[n>>>28&15]+te[n>>>24&15]+te[n>>>20&15]+te[n>>>16&15]+te[n>>>12&15]+te[n>>>8&15]+te[n>>>4&15]+te[n&15]+te[o>>>28&15]+te[o>>>24&15]+te[o>>>20&15]+te[o>>>16&15]+te[o>>>12&15]+te[o>>>8&15]+te[o>>>4&15]+te[o&15]+te[i>>>28&15]+te[i>>>24&15]+te[i>>>20&15]+te[i>>>16&15]+te[i>>>12&15]+te[i>>>8&15]+te[i>>>4&15]+te[i&15]+te[s>>>28&15]+te[s>>>24&15]+te[s>>>20&15]+te[s>>>16&15]+te[s>>>12&15]+te[s>>>8&15]+te[s>>>4&15]+te[s&15];return this.is224||(c+=te[a>>>28&15]+te[a>>>24&15]+te[a>>>20&15]+te[a>>>16&15]+te[a>>>12&15]+te[a>>>8&15]+te[a>>>4&15]+te[a&15]),c};Wn.prototype.toString=Wn.prototype.hex;Wn.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=[t>>>24&255,t>>>16&255,t>>>8&255,t&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255];return this.is224||c.push(a>>>24&255,a>>>16&255,a>>>8&255,a&255),c};Wn.prototype.array=Wn.prototype.digest;Wn.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};var lv=(...t)=>new Wn(!1,!0).update(t.join("")).hex();var $W={};G($W,{sha256:()=>lv});var IW={};G(IW,{BaseCache:()=>ZM,InMemoryCache:()=>FI,defaultHashKeyEncoder:()=>BM,deserializeStoredGeneration:()=>SW,serializeGeneration:()=>kW});var BM=(...t)=>lv(t.join("_"));function SW(t){return t.message!==void 0?{text:t.text,message:Ed(t.message)}:{text:t.text}}function kW(t){let e={text:t.text};return t.message!==void 0&&(e.message=t.message.toDict()),e}var ZM=class{keyEncoder=BM;makeDefaultKeyEncoder(t){this.keyEncoder=t}},TW=new Map,FI=class qM extends ZM{cache;constructor(e){super(),this.cache=e??new Map}lookup(e,r){return Promise.resolve(this.cache.get(this.keyEncoder(e,r))??null)}async update(e,r,n){this.cache.set(this.keyEncoder(e,r),n)}static global(){return new qM(TW)}};var HM=mn(KM(),1),zW=Object.defineProperty,MW=(t,e,r)=>e in t?zW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jW=(t,e,r)=>(MW(t,typeof e!="symbol"?e+"":e,r),r);function DW(t,e){let r=Array.from({length:t.length},(n,o)=>({start:o,end:o+1}));for(;r.length>1;){let n=null;for(let o=0;oe.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function UW(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}var ZI=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(t,e){this.patStr=t.pat_str;let r=t.bpe_ranks.split(` +`).filter(Boolean).reduce((n,o)=>{let[i,s,...a]=o.split(" "),c=Number.parseInt(s,10);return a.forEach((u,l)=>n[u]=c+l),n},{});for(let[n,o]of Object.entries(r)){let i=HM.default.toByteArray(n);this.rankMap.set(i.join(","),o),this.textMap.set(o,i)}this.specialTokens={...t.special_tokens,...e},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((n,[o,i])=>(n[i]=this.textEncoder.encode(o),n),{})}encode(t,e=[],r="all"){let n=new RegExp(this.patStr,"ug"),o=ZI.specialTokenRegex(Object.keys(this.specialTokens)),i=[],s=new Set(e==="all"?Object.keys(this.specialTokens):e),a=new Set(r==="all"?Object.keys(this.specialTokens).filter(u=>!s.has(u)):r);if(a.size>0){let u=ZI.specialTokenRegex([...a]),l=t.match(u);if(l!=null)throw new Error(`The text contains a special token that is not allowed: ${l[0]}`)}let c=0;for(;;){let u=null,l=c;for(;o.lastIndex=l,u=o.exec(t),!(u==null||s.has(u[0]));)l=u.index+1;let d=u?.index??t.length;for(let p of t.substring(c,d).matchAll(n)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){i.push(h);continue}i.push(...LW(m,this.rankMap))}if(u==null)break;let f=this.specialTokens[u[0]];i.push(f),c=u.index+u[0].length}return i}decode(t){let e=[],r=0;for(let i=0;inew RegExp(t.map(e=>UW(e)).join("|"),"g"));function qI(t){switch(t){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw new Error("Unknown model")}}var FW={};G(FW,{encodingForModel:()=>mv,getEncoding:()=>WM});var fv={},BW=new Xo({});async function WM(t){return t in fv||(fv[t]=BW.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new pv(e)).catch(e=>{throw delete fv[t],e})),await fv[t]}async function mv(t){return WM(qI(t))}var ZW={};G(ZW,{BaseLangChain:()=>_v,BaseLanguageModel:()=>tf,calculateMaxTokens:()=>XM,getEmbeddingContextSize:()=>qW,getModelContextSize:()=>JM,getModelNameForTiktoken:()=>hv,isOpenAITool:()=>gv});var hv=t=>t.startsWith("gpt-5")?"gpt-5":t.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":t.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":t.startsWith("gpt-4-32k")?"gpt-4-32k":t.startsWith("gpt-4-")?"gpt-4":t.startsWith("gpt-4o")?"gpt-4o":t,qW=t=>{switch(t){case"text-embedding-ada-002":return 8191;default:return 2046}},JM=t=>{switch(hv(t)){case"gpt-5":case"gpt-5-turbo":case"gpt-5-turbo-preview":return 4e5;case"gpt-4o":case"gpt-4o-mini":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":return 128e3;case"gpt-4-turbo":case"gpt-4-turbo-preview":case"gpt-4-turbo-2024-04-09":case"gpt-4-0125-preview":case"gpt-4-1106-preview":return 128e3;case"gpt-4-32k":case"gpt-4-32k-0314":case"gpt-4-32k-0613":return 32768;case"gpt-4":case"gpt-4-0314":case"gpt-4-0613":return 8192;case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-16k-0613":return 16384;case"gpt-3.5-turbo":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-1106":case"gpt-3.5-turbo-0125":return 4096;case"text-davinci-003":case"text-davinci-002":return 4097;case"text-davinci-001":return 2049;case"text-curie-001":case"text-babbage-001":case"text-ada-001":return 2048;case"code-davinci-002":case"code-davinci-001":return 8e3;case"code-cushman-001":return 2048;case"claude-3-5-sonnet-20241022":case"claude-3-5-sonnet-20240620":case"claude-3-opus-20240229":case"claude-3-sonnet-20240229":case"claude-3-haiku-20240307":case"claude-2.1":return 2e5;case"claude-2.0":case"claude-instant-1.2":return 1e5;case"gemini-1.5-pro":case"gemini-1.5-pro-latest":case"gemini-1.5-flash":case"gemini-1.5-flash-latest":return 1e6;case"gemini-pro":case"gemini-pro-vision":return 32768;default:return 4097}};function gv(t){return typeof t!="object"||!t?!1:!!("type"in t&&t.type==="function"&&"function"in t&&typeof t.function=="object"&&t.function&&"name"in t.function&&"parameters"in t.function)}var XM=async({prompt:t,modelName:e})=>{let r;try{r=(await mv(hv(e))).encode(t).length}catch{console.warn("Failed to calculate number of tokens, falling back to approximate count"),r=Math.ceil(t.length/4)}return JM(e)-r},VW=()=>!1,_v=class extends Ze{verbose;callbacks;tags;metadata;get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(t){super(t),this.verbose=t.verbose??VW(),this.callbacks=t.callbacks,this.tags=t.tags??[],this.metadata=t.metadata??{}}},tf=class extends _v{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}caller;cache;constructor({callbacks:t,callbackManager:e,...r}){let{cache:n,...o}=r;super({callbacks:t??e,...o}),typeof n=="object"?this.cache=n:n?this.cache=FI.global():this.cache=void 0,this.caller=new Xo(r??{})}_encoding;async getNumTokens(t){let e;typeof t=="string"?e=t:e=t.map(n=>typeof n=="string"?n:n.type==="text"&&"text"in n?n.text:"").join("");let r=Math.ceil(e.length/4);if(!this._encoding)try{this._encoding=await mv("modelName"in this?hv(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(e).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(t){return typeof t=="string"?new LI(t):Array.isArray(t)?new UI(t.map(ji)):t}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:t,...e}){let r={...this._identifyingParams(),...e,_type:this._llmType(),_model:this._modelType()};return Object.entries(r).filter(([i,s])=>s!==void 0).map(([i,s])=>`${i}:${JSON.stringify(s)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(t){throw new Error("Use .toJSON() instead")}get profile(){return{}}};var ii=class extends Ze{static lc_name(){return"RunnablePassthrough"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;func;constructor(t){super(t),t&&(this.func=t.func)}async invoke(t,e){let r=Pe(e);return this.func&&await this.func(t,r),this._callWithConfig(n=>Promise.resolve(n),t,r)}async*transform(t,e){let r=Pe(e),n,o=!0;for await(let i of this._transformStreamWithConfig(t,s=>s,r))if(yield i,o)if(n===void 0)n=i;else try{n=en(n,i)}catch{n=void 0,o=!1}this.func&&n!==void 0&&await this.func(n,r)}static assign(t){return new Bp(new us({steps:t}))}};var YM=t=>t();function yv(t){let e=t.constructor;return new e({...t,content:t.contentBlocks,response_metadata:{...t.response_metadata,output_version:"v1"}})}var GW={};G(GW,{BaseChatModel:()=>vv,SimpleChatModel:()=>KW});function VI(t){let e=[];for(let r of t){let n=r;if(Array.isArray(r.content))for(let o=0;o{let r=e.outputVersion??It("LC_OUTPUT_VERSION");return r&&["v0","v1"].includes(r)?r:"v0"})}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async invoke(e,r){let n=Ga._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].message}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}async*_streamIterator(e,r){if(this._streamResponseChunks===Ga.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(e,r);else{let o=Ga._convertInputToPromptValue(e).toChatMessages(),[i,s]=this._separateRunnableConfigFromCallOptionsCompat(r),a={...i.metadata,...this.getLsParams(s)},c=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,a,this.metadata,{verbose:this.verbose}),u={options:s,invocation_params:this?.invocationParams(s),batch_size:1},l=s.outputVersion??this.outputVersion,d=await c?.handleChatModelStart(this.toJSON(),[VI(o)],i.runId,void 0,u,void 0,void 0,i.runName),f,p;try{for await(let m of this._streamResponseChunks(o,s,d?.[0])){if(m.message.id==null){let h=d?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}m.message.response_metadata={...m.generationInfo,...m.message.response_metadata},l==="v1"?yield yv(m.message):yield m.message,f?f=f.concat(m):f=m,Td(m.message)&&m.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:m.message.usage_metadata.input_tokens,completionTokens:m.message.usage_metadata.output_tokens,totalTokens:m.message.usage_metadata.total_tokens}})}}catch(m){throw await Promise.all((d??[]).map(h=>h?.handleLLMError(m))),m}await Promise.all((d??[]).map(m=>m?.handleLLMEnd({generations:[[f]],llmOutput:p})))}}getLsParams(e){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:r}}async _generateUncached(e,r,n,o){let i=e.map(f=>f.map(ji)),s;if(o!==void 0&&o.length===i.length)s=o;else{let f={...n.metadata,...this.getLsParams(r)},p=await St.configure(n.callbacks,this.callbacks,n.tags,this.tags,f,this.metadata,{verbose:this.verbose}),m={options:r,invocation_params:this?.invocationParams(r),batch_size:1};s=await p?.handleChatModelStart(this.toJSON(),i.map(VI),n.runId,void 0,m,void 0,void 0,n.runName)}let a=r.outputVersion??this.outputVersion,c=[],u=[];if(!!s?.[0].handlers.find(Od)&&!this.disableStreaming&&i.length===1&&this._streamResponseChunks!==Ga.prototype._streamResponseChunks)try{let f=await this._streamResponseChunks(i[0],r,s?.[0]),p,m;for await(let h of f){if(h.message.id==null){let _=s?.at(0)?.runId;_!=null&&h.message._updateId(`run-${_}`)}p===void 0?p=h:p=en(p,h),Td(h.message)&&h.message.usage_metadata!==void 0&&(m={tokenUsage:{promptTokens:h.message.usage_metadata.input_tokens,completionTokens:h.message.usage_metadata.output_tokens,totalTokens:h.message.usage_metadata.total_tokens}})}if(p===void 0)throw new Error("Received empty response from chat model call.");c.push([p]),await s?.[0].handleLLMEnd({generations:c,llmOutput:m})}catch(f){throw await s?.[0].handleLLMError(f),f}else{let f=await Promise.allSettled(i.map(async(p,m)=>{let h=await this._generate(p,{...r,promptIndex:m},s?.[m]);if(a==="v1")for(let _ of h.generations)_.message=yv(_.message);return h}));await Promise.all(f.map(async(p,m)=>{if(p.status==="fulfilled"){let h=p.value;for(let _ of h.generations){if(_.message.id==null){let v=s?.at(0)?.runId;v!=null&&_.message._updateId(`run-${v}`)}_.message.response_metadata={..._.generationInfo,..._.message.response_metadata}}return h.generations.length===1&&(h.generations[0].message.response_metadata={...h.llmOutput,...h.generations[0].message.response_metadata}),c[m]=h.generations,u[m]=h.llmOutput,s?.[m]?.handleLLMEnd({generations:[h.generations],llmOutput:h.llmOutput})}else return await s?.[m]?.handleLLMError(p.reason),Promise.reject(p.reason)}))}let d={generations:c,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(d,ya,{value:s?{runIds:s?.map(f=>f.runId)}:void 0,configurable:!0}),d}async _generateCached({messages:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i}){let s=e.map(v=>v.map(ji)),a={...i.metadata,...this.getLsParams(o)},c=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,a,this.metadata,{verbose:this.verbose}),u={options:o,invocation_params:this?.invocationParams(o),batch_size:1},l=await c?.handleChatModelStart(this.toJSON(),s.map(VI),i.runId,void 0,u,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(s.map(async(v,b)=>{let x=Ga._convertInputToPromptValue(v).toString(),k=await r.lookup(x,n);return k==null&&d.push(b),k}))).map((v,b)=>({result:v,runManager:l?.[b]})).filter(({result:v})=>v.status==="fulfilled"&&v.value!=null||v.status==="rejected"),m=o.outputVersion??this.outputVersion,h=[];await Promise.all(p.map(async({result:v,runManager:b},x)=>{if(v.status==="fulfilled"){let k=v.value;return h[x]=k.map(T=>("message"in T&&Yr(T.message)&&aa(T.message)&&(T.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},m==="v1"&&(T.message=yv(T.message))),T.generationInfo={...T.generationInfo,tokenUsage:{}},T)),k.length&&await b?.handleLLMNewToken(k[0].text),b?.handleLLMEnd({generations:[k]},void 0,void 0,void 0,{cached:!0})}else return await b?.handleLLMError(v.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(v.reason)}));let _={generations:h,missingPromptIndices:d,startedRunManagers:l};return Object.defineProperty(_,ya,{value:l?{runIds:l?.map(v=>v.runId)}:void 0,configurable:!0}),_}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(m=>m.map(ji)),[s,a]=this._separateRunnableConfigFromCallOptionsCompat(o);if(s.callbacks=s.callbacks??n,!this.cache)return this._generateUncached(i,a,s);let{cache:c}=this,u=this._getSerializedCacheKeyParametersForCall(a),{generations:l,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:i,cache:c,llmStringKey:u,parsedOptions:a,handledOptions:s}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>i[h]),a,s,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,_)=>{let v=d[_];l[v]=h;let b=Ga._convertInputToPromptValue(i[v]).toString();return c.update(b,u,h)})),p=m.llmOutput??{}}return{generations:l,llmOutput:p}}invocationParams(e){return{}}_modelType(){return"base_chat_model"}async generatePrompt(e,r,n){let o=e.map(i=>i.toChatMessages());return this.generate(o,r,n)}withStructuredOutput(e,r){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(r?.strict)throw new Error('"strict" mode is not supported for this model by default.');let n=e,o=r?.name,i=rs(n)??"A function available to call.",s=r?.method,a=r?.includeRaw;if(s==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let c=o??"extract",u;on(n)?u=[{type:"function",function:{name:c,description:i,parameters:an(n)}}]:("name"in n&&(c=n.name),u=[{type:"function",function:{name:c,description:i,parameters:n}}]);let l=this.bindTools(u),d=Dr.from(h=>{if(!Dt.isInstance(h))throw new Error("Input is not an AIMessageChunk.");if(!h.tool_calls||h.tool_calls.length===0)throw new Error("No tool calls found in the response.");let _=h.tool_calls.find(v=>v.name===c);if(!_)throw new Error(`No tool call found with name ${c}.`);return _.args});if(!a)return l.pipe(d).withConfig({runName:"StructuredOutput"});let f=ii.assign({parsed:(h,_)=>d.invoke(h.raw,_)}),p=ii.assign({parsed:()=>null}),m=f.withFallbacks({fallbacks:[p]});return cs.from([{raw:l},m]).withConfig({runName:"StructuredOutputRunnable"})}},KW=class extends vv{async _generate(t,e,r){let n=await this._call(t,e,r),o=new jt(n);if(typeof o.content!="string")throw new Error("Cannot generate with a simple chat model when output is not a string.");return{generations:[{text:o.content,message:o}]}}};var QM=class extends Ze{static lc_name(){return"RouterRunnable"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnables;constructor(t){super(t),this.runnables=t.runnables}async invoke(t,e){let{key:r,input:n}=t,o=this.runnables[r];if(o===void 0)throw new Error(`No runnable associated with key "${r}".`);return o.invoke(n,Pe(e))}async batch(t,e,r){let n=t.map(d=>d.key),o=t.map(d=>d.input);if(n.find(d=>this.runnables[d]===void 0)!==void 0)throw new Error("One or more keys do not have a corresponding runnable.");let s=n.map(d=>this.runnables[d]),a=this._getOptionsList(e??{},t.length),c=a[0]?.maxConcurrency??r?.maxConcurrency,u=c&&c>0?c:t.length,l=[];for(let d=0;ds[h].invoke(m,a[h])),p=await Promise.all(f);l.push(p)}return l.flat()}async stream(t,e){let{key:r,input:n}=t,o=this.runnables[r];if(o===void 0)throw new Error(`No runnable associated with key "${r}".`);return o.stream(n,e)}};var ej=class extends Ze{static lc_name(){return"RunnableBranch"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;default;branches;constructor(t){super(t),this.branches=t.branches,this.default=t.default}static from(t){if(t.length<1)throw new Error("RunnableBranch requires at least one branch");let r=t.slice(0,-1).map(([o,i])=>[cn(o),cn(i)]),n=cn(t[t.length-1]);return new this({branches:r,default:n})}async _invoke(t,e,r){let n;for(let o=0;othis._enterHistory(i,s??{})).withConfig({runName:"loadHistory"}),r=t.historyMessagesKey??t.inputMessagesKey;r&&(e=ii.assign({[r]:e}).withConfig({runName:"insertHistory"}));let n=e.pipe(t.runnable.withListeners({onEnd:(i,s)=>this._exitHistory(i,s??{})})).withConfig({runName:"RunnableWithMessageHistory"}),o=t.config??{};super({...t,config:o,bound:n}),this.runnable=t.runnable,this.getMessageHistory=t.getMessageHistory,this.inputMessagesKey=t.inputMessagesKey,this.outputMessagesKey=t.outputMessagesKey,this.historyMessagesKey=t.historyMessagesKey}_getInputMessages(t){let e;if(typeof t=="object"&&!Array.isArray(t)&&!Yr(t)){let r;this.inputMessagesKey?r=this.inputMessagesKey:Object.keys(t).length===1?r=Object.keys(t)[0]:r="input",Array.isArray(t[r])&&Array.isArray(t[r][0])?e=t[r][0]:e=t[r]}else e=t;if(typeof e=="string")return[new mr(e)];if(Array.isArray(e))return e;if(Yr(e))return[e];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. +Got ${JSON.stringify(e,null,2)}`)}_getOutputMessages(t){let e;if(!Array.isArray(t)&&!Yr(t)&&typeof t!="string"){let r;this.outputMessagesKey!==void 0?r=this.outputMessagesKey:Object.keys(t).length===1?r=Object.keys(t)[0]:r="output",t.generations!==void 0?e=t.generations[0][0].message:e=t[r]}else e=t;if(typeof e=="string")return[new jt(e)];if(Array.isArray(e))return e;if(Yr(e))return[e];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. Received: ${JSON.stringify(e,null,2)}`)}async _enterHistory(t,e){let n=await(e?.configurable?.messageHistory).getMessages();return this.historyMessagesKey===void 0?n.concat(this._getInputMessages(t)):n}async _exitHistory(t,e){let r=e.configurable?.messageHistory,n;Array.isArray(t.inputs)&&Array.isArray(t.inputs[0])?n=t.inputs[0]:n=t.inputs;let o=this._getInputMessages(n);if(this.historyMessagesKey===void 0){let a=await r.getMessages();o=o.slice(a.length)}let i=t.outputs;if(!i)throw new Error(`Output values from 'Run' undefined. Run: ${JSON.stringify(t,null,2)}`);let s=this._getOutputMessages(i);await r.addMessages([...o,...s])}async _mergeConfig(...t){let e=await super._mergeConfig(...t);if(!e.configurable||!e.configurable.sessionId){let n={[this.inputMessagesKey??"input"]:"foo"},o={configurable:{sessionId:"123"}};throw new Error(`sessionId is required. Pass it in as part of the config argument to .invoke() or .stream() +eg. chain.invoke(${JSON.stringify(n)}, ${JSON.stringify(o)})`)}let{sessionId:r}=e.configurable;return e.configurable.messageHistory=await this.getMessageHistory(r),e}};var HW={};G(HW,{RouterRunnable:()=>QM,Runnable:()=>Ze,RunnableAssign:()=>Bp,RunnableBinding:()=>as,RunnableBranch:()=>ej,RunnableEach:()=>j1,RunnableLambda:()=>Dr,RunnableMap:()=>us,RunnableParallel:()=>B1,RunnablePassthrough:()=>ii,RunnablePick:()=>q$,RunnableRetry:()=>Gy,RunnableSequence:()=>cs,RunnableToolLike:()=>Vy,RunnableWithFallbacks:()=>Z$,RunnableWithMessageHistory:()=>tj,_coerceToRunnable:()=>cn,ensureConfig:()=>Pe,getCallbackManagerForConfig:()=>or,mergeConfigs:()=>ga,patchConfig:()=>Ve,pickRunnableConfigKeys:()=>vr,raceWithSignal:()=>vn});var GI=class extends Ze{parseResultWithPrompt(t,e,r){return this.parseResult(t,r)}_baseMessageToString(t){return typeof t.content=="string"?t.content:this._baseMessageContentToString(t.content)}_baseMessageContentToString(t){return JSON.stringify(t)}async invoke(t,e){return typeof t=="string"?this._callWithConfig(async(r,n)=>this.parseResult([{text:r}],n?.callbacks),t,{...e,runType:"parser"}):this._callWithConfig(async(r,n)=>this.parseResult([{message:r,text:this._baseMessageToString(r)}],n?.callbacks),t,{...e,runType:"parser"})}},Ka=class extends GI{parseResult(t,e){return this.parse(t[0].text,e)}async parseWithPrompt(t,e,r){return this.parse(t,r)}_type(){throw new Error("_type not implemented")}},ln=class extends Error{llmOutput;observation;sendToLLM;constructor(t,e,r,n=!1){if(super(t),this.llmOutput=e,this.observation=r,this.sendToLLM=n,n&&(r===void 0||e===void 0))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");uh(this,"OUTPUT_PARSING_FAILURE")}};var si=class extends Ka{async*_transform(t){for await(let e of t)typeof e=="string"?yield this.parseResult([{text:e}]):yield this.parseResult([{message:e,text:this._baseMessageToString(e)}])}async*transform(t,e){yield*this._transformStreamWithConfig(t,this._transform.bind(this),{...e,runType:"parser"})}},ls=class extends si{diff=!1;constructor(t){super(t),this.diff=t?.diff??this.diff}async*_transform(t){let e,r;for await(let n of t){if(typeof n!="string"&&typeof n.content!="string")throw new Error("Cannot handle non-string output.");let o;if(iu(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");o=new Vi({message:n,text:n.content})}else if(Yr(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");o=new Vi({message:ca(n),text:n.content})}else o=new go({text:n});r===void 0?r=o:r=r.concat(o);let i=await this.parsePartialResult([r]);i!=null&&!$o(i,e)&&(this.diff?yield this._diff(e,i):yield i,e=i)}}getFormatInstructions(){return""}};var WW={};G(WW,{applyPatch:()=>qi,compare:()=>mu});var KI=class extends ls{static lc_name(){return"JsonOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_concatOutputChunks(t,e){return this.diff?super._concatOutputChunks(t,e):e}_diff(t,e){if(e)return t?mu(t,e):[{op:"replace",path:"",value:e}]}async parsePartialResult(t){return kd(t[0].text)}async parse(t){return kd(t,JSON.parse)}getFormatInstructions(){return""}};var rj=class extends si{static lc_name(){return"BytesOutputParser"}lc_namespace=["langchain_core","output_parsers","bytes"];lc_serializable=!0;textEncoder=new TextEncoder;parse(t){return Promise.resolve(this.textEncoder.encode(t))}getFormatInstructions(){return""}};var al=class extends si{re;async*_transform(t){let e="";for await(let r of t)if(typeof r=="string"?e+=r:e+=r.content,this.re){let n=[...e.matchAll(this.re)];if(n.length>1){let o=0;for(let i of n.slice(0,-1))yield[i[1]],o+=(i.index??0)+i[0].length;e=e.slice(o)}}else{let n=await this.parse(e);if(n.length>1){for(let o of n.slice(0,-1))yield[o];e=n[n.length-1]}}for(let r of await this.parse(e))yield[r]}},nj=class extends al{static lc_name(){return"CommaSeparatedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;async parse(t){try{return t.trim().split(",").map(e=>e.trim())}catch{throw new ln(`Could not parse output: ${t}`,t)}}getFormatInstructions(){return"Your response should be a list of comma separated values, eg: `foo, bar, baz`"}},oj=class extends al{lc_namespace=["langchain_core","output_parsers","list"];length;separator;constructor({length:t,separator:e}){super(...arguments),this.length=t,this.separator=e||","}async parse(t){try{let e=t.trim().split(this.separator).map(r=>r.trim());if(this.length!==void 0&&e.length!==this.length)throw new ln(`Incorrect number of items. Expected ${this.length}, got ${e.length}.`);return e}catch(e){throw Object.getPrototypeOf(e)===ln.prototype?e:new ln(`Could not parse output: ${t}`)}}getFormatInstructions(){return`Your response should be a list of ${this.length===void 0?"":`${this.length} `}items separated by "${this.separator}" (eg: \`foo${this.separator} bar${this.separator} baz\`)`}},ij=class extends al{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example: + +1. foo + +2. bar + +3. baz`}re=/\d+\.\s([^\n]+)/g;async parse(t){return[...t.matchAll(this.re)??[]].map(e=>e[1])}},sj=class extends al{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example: + +1. foo + +2. bar + +3. baz`}re=/^\s*[-*]\s([^\n]+)$/gm;async parse(t){return[...t.matchAll(this.re)??[]].map(e=>e[1])}};var aj=class extends si{static lc_name(){return"StrOutputParser"}lc_namespace=["langchain_core","output_parsers","string"];lc_serializable=!0;parse(t){return Promise.resolve(t)}getFormatInstructions(){return""}_textContentToString(t){return t.text}_imageUrlContentToString(t){throw new Error('Cannot coerce a multimodal "image_url" message part into a string.')}_messageContentToString(t){switch(t.type){case"text":case"text_delta":if("text"in t)return this._textContentToString(t);break;case"image_url":if("image_url"in t)return this._imageUrlContentToString(t);break;default:throw new Error(`Cannot coerce "${t.type}" message part into a string.`)}throw new Error(`Invalid content type: ${t.type}`)}_baseMessageContentToString(t){return t.reduce((e,r)=>e+this._messageContentToString(r),"")}};var bv=class extends Ka{static lc_name(){return"StructuredOutputParser"}lc_namespace=["langchain","output_parsers","structured"];toJSON(){return this.toJSONNotImplemented()}constructor(t){super(t),this.schema=t}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=$r.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,$r.string().describe(n)])));return new this(e)}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance. + +"JSON Schema" is a declarative language that allows you to annotate and validate JSON documents. + +For example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}} +would match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings. +Thus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted. + +Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas! + +Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock: +\`\`\`json +${JSON.stringify(an(this.schema))} +\`\`\` +`}async parse(t){try{let e=t.trim(),n=(e.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||e.match(/```json\s*([\s\S]*?)```/)?.[1]||e).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(o,i)=>`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await ts(this.schema,JSON.parse(n))}catch(e){throw new ln(`Failed to parse. Text: "${t}". Error: ${e}`,t)}}},HI=class extends bv{static lc_name(){return"JsonMarkdownStructuredOutputParser"}getFormatInstructions(t){let e=t?.interpolationDepth??1;if(e<1)throw new Error("f string interpolation depth must be at least 1");return`Return a markdown code snippet with a JSON object formatted to look like: +\`\`\`json +${this._schemaToInstruction(an(this.schema)).replaceAll("{","{".repeat(e)).replaceAll("}","}".repeat(e))} +\`\`\``}_schemaToInstruction(t,e=2){let r=t;if("type"in r){let n=!1,o;if(Array.isArray(r.type)){let a=r.type.findIndex(c=>c==="null");a!==-1&&(n=!0,r.type.splice(a,1)),o=r.type.join(" | ")}else o=r.type;if(r.type==="object"&&r.properties){let a=r.description?` // ${r.description}`:"";return`{ +${Object.entries(r.properties).map(([u,l])=>{let d=r.required?.includes(u)?"":" (optional)";return`${" ".repeat(e)}"${u}": ${this._schemaToInstruction(l,e+2)}${d}`}).join(` +`)} +${" ".repeat(e-2)}}${a}`}if(r.type==="array"&&r.items){let a=r.description?` // ${r.description}`:"";return`array[ +${" ".repeat(e)}${this._schemaToInstruction(r.items,e+2)} +${" ".repeat(e-2)}] ${a}`}let i=n?" (nullable)":"",s=r.description?` // ${r.description}`:"";return`${o}${s}${i}`}if("anyOf"in r)return r.anyOf.map(n=>this._schemaToInstruction(n,e)).join(` +${" ".repeat(e-2)}`);throw new Error("unsupported schema type")}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=$r.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,$r.string().describe(n)])));return new this(e)}},cj=class extends Ka{structuredInputParser;constructor({inputSchema:t}){super(...arguments),this.structuredInputParser=new HI(t)}async parse(t){let e;try{e=await this.structuredInputParser.parse(t)}catch(r){throw new ln(`Failed to parse. Text: "${t}". Error: ${r}`,t)}return this.outputProcessor(e)}getFormatInstructions(){return this.structuredInputParser.getFormatInstructions()}};var JW=function(){let t={};t.parser=function(y,g){return new r(y,g)},t.SAXParser=r,t.SAXStream=u,t.createStream=c,t.MAX_BUFFER_LENGTH=65536;let e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(y,g){if(!(this instanceof r))return new r(y,g);var R=this;o(R),R.q=R.c="",R.bufferCheckPosition=t.MAX_BUFFER_LENGTH,R.opt=g||{},R.opt.lowercase=R.opt.lowercase||R.opt.lowercasetags,R.looseCase=R.opt.lowercase?"toLowerCase":"toUpperCase",R.tags=[],R.closed=R.closedRoot=R.sawRoot=!1,R.tag=R.error=null,R.strict=!!y,R.noscript=!!(y||R.opt.noscript),R.state=w.BEGIN,R.strictEntities=R.opt.strictEntities,R.ENTITIES=R.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),R.attribList=[],R.opt.xmlns&&(R.ns=Object.create(m)),R.trackPosition=R.opt.position!==!1,R.trackPosition&&(R.position=R.line=R.column=0),oe(R,"onready")}Object.create||(Object.create=function(y){function g(){}g.prototype=y;var R=new g;return R}),Object.keys||(Object.keys=function(y){var g=[];for(var R in y)y.hasOwnProperty(R)&&g.push(R);return g});function n(y){for(var g=Math.max(t.MAX_BUFFER_LENGTH,10),R=0,I=0,ze=e.length;Ig)switch(e[I]){case"textNode":wt(y);break;case"cdata":Q(y,"oncdata",y.cdata),y.cdata="";break;case"script":Q(y,"onscript",y.script),y.script="";break;default:pn(y,"Max buffer length exceeded: "+e[I])}R=Math.max(R,Ye)}var it=t.MAX_BUFFER_LENGTH-R;y.bufferCheckPosition=it+y.position}function o(y){for(var g=0,R=e.length;g"||x(y)}function F(y,g){return y.test(g)}function J(y,g){return!F(y,g)}var w=0;t.STATE={BEGIN:w++,BEGIN_WHITESPACE:w++,TEXT:w++,TEXT_ENTITY:w++,OPEN_WAKA:w++,SGML_DECL:w++,SGML_DECL_QUOTED:w++,DOCTYPE:w++,DOCTYPE_QUOTED:w++,DOCTYPE_DTD:w++,DOCTYPE_DTD_QUOTED:w++,COMMENT_STARTING:w++,COMMENT:w++,COMMENT_ENDING:w++,COMMENT_ENDED:w++,CDATA:w++,CDATA_ENDING:w++,CDATA_ENDING_2:w++,PROC_INST:w++,PROC_INST_BODY:w++,PROC_INST_ENDING:w++,OPEN_TAG:w++,OPEN_TAG_SLASH:w++,ATTRIB:w++,ATTRIB_NAME:w++,ATTRIB_NAME_SAW_WHITE:w++,ATTRIB_VALUE:w++,ATTRIB_VALUE_QUOTED:w++,ATTRIB_VALUE_CLOSED:w++,ATTRIB_VALUE_UNQUOTED:w++,ATTRIB_VALUE_ENTITY_Q:w++,ATTRIB_VALUE_ENTITY_U:w++,CLOSE_TAG:w++,CLOSE_TAG_SAW_WHITE:w++,SCRIPT:w++,SCRIPT_ENDING:w++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(y){var g=t.ENTITIES[y],R=typeof g=="number"?String.fromCharCode(g):g;t.ENTITIES[y]=R});for(var Z in t.STATE)t.STATE[t.STATE[Z]]=Z;w=t.STATE;function oe(y,g,R){y[g]&&y[g](R)}function Q(y,g,R){y.textNode&&wt(y),oe(y,g,R)}function wt(y){y.textNode=dn(y.opt,y.textNode),y.textNode&&oe(y,"ontext",y.textNode),y.textNode=""}function dn(y,g){return y.trim&&(g=g.trim()),y.normalize&&(g=g.replace(/\s+/g," ")),g}function pn(y,g){return wt(y),y.trackPosition&&(g+=` +Line: `+y.line+` +Column: `+y.column+` +Char: `+y.c),g=new Error(g),y.error=g,oe(y,"onerror",g),y}function No(y){return y.sawRoot&&!y.closedRoot&&qe(y,"Unclosed root tag"),y.state!==w.BEGIN&&y.state!==w.BEGIN_WHITESPACE&&y.state!==w.TEXT&&pn(y,"Unexpected end"),wt(y),y.c="",y.closed=!0,oe(y,"onend"),r.call(y,y.strict,y.opt),y}function qe(y,g){if(typeof y!="object"||!(y instanceof r))throw new Error("bad call to strictFail");y.strict&&pn(y,g)}function Ul(y){y.strict||(y.tagName=y.tagName[y.looseCase]());var g=y.tags[y.tags.length-1]||y,R=y.tag={name:y.tagName,attributes:{}};y.opt.xmlns&&(R.ns=g.ns),y.attribList.length=0,Q(y,"onopentagstart",R)}function Ss(y,g){var R=y.indexOf(":"),I=R<0?["",y]:y.split(":"),ze=I[0],Ye=I[1];return g&&y==="xmlns"&&(ze="xmlns",Ye=""),{prefix:ze,local:Ye}}function ks(y){if(y.strict||(y.attribName=y.attribName[y.looseCase]()),y.attribList.indexOf(y.attribName)!==-1||y.tag.attributes.hasOwnProperty(y.attribName)){y.attribName=y.attribValue="";return}if(y.opt.xmlns){var g=Ss(y.attribName,!0),R=g.prefix,I=g.local;if(R==="xmlns")if(I==="xml"&&y.attribValue!==f)qe(y,"xml: prefix must be bound to "+f+` +Actual: `+y.attribValue);else if(I==="xmlns"&&y.attribValue!==p)qe(y,"xmlns: prefix must be bound to "+p+` +Actual: `+y.attribValue);else{var ze=y.tag,Ye=y.tags[y.tags.length-1]||y;ze.ns===Ye.ns&&(ze.ns=Object.create(Ye.ns)),ze.ns[I]=y.attribValue}y.attribList.push([y.attribName,y.attribValue])}else y.tag.attributes[y.attribName]=y.attribValue,Q(y,"onattribute",{name:y.attribName,value:y.attribValue});y.attribName=y.attribValue=""}function Pn(y,g){if(y.opt.xmlns){var R=y.tag,I=Ss(y.tagName);R.prefix=I.prefix,R.local=I.local,R.uri=R.ns[I.prefix]||"",R.prefix&&!R.uri&&(qe(y,"Unbound namespace prefix: "+JSON.stringify(y.tagName)),R.uri=I.prefix);var ze=y.tags[y.tags.length-1]||y;R.ns&&ze.ns!==R.ns&&Object.keys(R.ns).forEach(function(Ts){Q(y,"onopennamespace",{prefix:Ts,uri:R.ns[Ts]})});for(var Ye=0,it=y.attribList.length;Ye",y.tagName="",y.state=w.SCRIPT;return}Q(y,"onscript",y.script),y.script=""}var g=y.tags.length,R=y.tagName;y.strict||(R=R[y.looseCase]());for(var I=R;g--;){var ze=y.tags[g];if(ze.name!==I)qe(y,"Unexpected close tag");else break}if(g<0){qe(y,"Unmatched closing tag: "+y.tagName),y.textNode+="",y.state=w.TEXT;return}y.tagName=R;for(var Ye=y.tags.length;Ye-- >g;){var it=y.tag=y.tags.pop();y.tagName=y.tag.name,Q(y,"onclosetag",y.tagName);var Tt={};for(var Bt in it.ns)Tt[Bt]=it.ns[Bt];var Rn=y.tags[y.tags.length-1]||y;y.opt.xmlns&&it.ns!==Rn.ns&&Object.keys(it.ns).forEach(function(ht){var fn=it.ns[ht];Q(y,"onclosenamespace",{prefix:ht,uri:fn})})}g===0&&(y.closedRoot=!0),y.tagName=y.attribValue=y.attribName="",y.attribList.length=0,y.state=w.TEXT}function Fl(y){var g=y.entity,R=g.toLowerCase(),I,ze="";return y.ENTITIES[g]?y.ENTITIES[g]:y.ENTITIES[R]?y.ENTITIES[R]:(g=R,g.charAt(0)==="#"&&(g.charAt(1)==="x"?(g=g.slice(2),I=parseInt(g,16),ze=I.toString(16)):(g=g.slice(1),I=parseInt(g,10),ze=I.toString(10))),g=g.replace(/^0+/,""),isNaN(I)||ze.toLowerCase()!==g?(qe(y,"Invalid character entity"),"&"+y.entity+";"):String.fromCodePoint(I))}function Bl(y,g){g==="<"?(y.state=w.OPEN_WAKA,y.startTagPosition=y.position):x(g)||(qe(y,"Non-whitespace before first tag."),y.textNode=g,y.state=w.TEXT)}function Zl(y,g){var R="";return g"?(Q(g,"onsgmldeclaration",g.sgmlDecl),g.sgmlDecl="",g.state=w.TEXT):(k(I)&&(g.state=w.SGML_DECL_QUOTED),g.sgmlDecl+=I);continue;case w.SGML_DECL_QUOTED:I===g.q&&(g.state=w.SGML_DECL,g.q=""),g.sgmlDecl+=I;continue;case w.DOCTYPE:I===">"?(g.state=w.TEXT,Q(g,"ondoctype",g.doctype),g.doctype=!0):(g.doctype+=I,I==="["?g.state=w.DOCTYPE_DTD:k(I)&&(g.state=w.DOCTYPE_QUOTED,g.q=I));continue;case w.DOCTYPE_QUOTED:g.doctype+=I,I===g.q&&(g.q="",g.state=w.DOCTYPE);continue;case w.DOCTYPE_DTD:g.doctype+=I,I==="]"?g.state=w.DOCTYPE:k(I)&&(g.state=w.DOCTYPE_DTD_QUOTED,g.q=I);continue;case w.DOCTYPE_DTD_QUOTED:g.doctype+=I,I===g.q&&(g.state=w.DOCTYPE_DTD,g.q="");continue;case w.COMMENT:I==="-"?g.state=w.COMMENT_ENDING:g.comment+=I;continue;case w.COMMENT_ENDING:I==="-"?(g.state=w.COMMENT_ENDED,g.comment=dn(g.opt,g.comment),g.comment&&Q(g,"oncomment",g.comment),g.comment=""):(g.comment+="-"+I,g.state=w.COMMENT);continue;case w.COMMENT_ENDED:I!==">"?(qe(g,"Malformed comment"),g.comment+="--"+I,g.state=w.COMMENT):g.state=w.TEXT;continue;case w.CDATA:I==="]"?g.state=w.CDATA_ENDING:g.cdata+=I;continue;case w.CDATA_ENDING:I==="]"?g.state=w.CDATA_ENDING_2:(g.cdata+="]"+I,g.state=w.CDATA);continue;case w.CDATA_ENDING_2:I===">"?(g.cdata&&Q(g,"oncdata",g.cdata),Q(g,"onclosecdata"),g.cdata="",g.state=w.TEXT):I==="]"?g.cdata+="]":(g.cdata+="]]"+I,g.state=w.CDATA);continue;case w.PROC_INST:I==="?"?g.state=w.PROC_INST_ENDING:x(I)?g.state=w.PROC_INST_BODY:g.procInstName+=I;continue;case w.PROC_INST_BODY:if(!g.procInstBody&&x(I))continue;I==="?"?g.state=w.PROC_INST_ENDING:g.procInstBody+=I;continue;case w.PROC_INST_ENDING:I===">"?(Q(g,"onprocessinginstruction",{name:g.procInstName,body:g.procInstBody}),g.procInstName=g.procInstBody="",g.state=w.TEXT):(g.procInstBody+="?"+I,g.state=w.PROC_INST_BODY);continue;case w.OPEN_TAG:F(_,I)?g.tagName+=I:(Ul(g),I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:(x(I)||qe(g,"Invalid character in tag name"),g.state=w.ATTRIB));continue;case w.OPEN_TAG_SLASH:I===">"?(Pn(g,!0),zo(g)):(qe(g,"Forward-slash in opening tag not followed by >"),g.state=w.ATTRIB);continue;case w.ATTRIB:if(x(I))continue;I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:F(h,I)?(g.attribName=I,g.attribValue="",g.state=w.ATTRIB_NAME):qe(g,"Invalid attribute name");continue;case w.ATTRIB_NAME:I==="="?g.state=w.ATTRIB_VALUE:I===">"?(qe(g,"Attribute without value"),g.attribValue=g.attribName,ks(g),Pn(g)):x(I)?g.state=w.ATTRIB_NAME_SAW_WHITE:F(_,I)?g.attribName+=I:qe(g,"Invalid attribute name");continue;case w.ATTRIB_NAME_SAW_WHITE:if(I==="=")g.state=w.ATTRIB_VALUE;else{if(x(I))continue;qe(g,"Attribute without value"),g.tag.attributes[g.attribName]="",g.attribValue="",Q(g,"onattribute",{name:g.attribName,value:""}),g.attribName="",I===">"?Pn(g):F(h,I)?(g.attribName=I,g.state=w.ATTRIB_NAME):(qe(g,"Invalid attribute name"),g.state=w.ATTRIB)}continue;case w.ATTRIB_VALUE:if(x(I))continue;k(I)?(g.q=I,g.state=w.ATTRIB_VALUE_QUOTED):(qe(g,"Unquoted attribute value"),g.state=w.ATTRIB_VALUE_UNQUOTED,g.attribValue=I);continue;case w.ATTRIB_VALUE_QUOTED:if(I!==g.q){I==="&"?g.state=w.ATTRIB_VALUE_ENTITY_Q:g.attribValue+=I;continue}ks(g),g.q="",g.state=w.ATTRIB_VALUE_CLOSED;continue;case w.ATTRIB_VALUE_CLOSED:x(I)?g.state=w.ATTRIB:I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:F(h,I)?(qe(g,"No whitespace between attributes"),g.attribName=I,g.attribValue="",g.state=w.ATTRIB_NAME):qe(g,"Invalid attribute name");continue;case w.ATTRIB_VALUE_UNQUOTED:if(!T(I)){I==="&"?g.state=w.ATTRIB_VALUE_ENTITY_U:g.attribValue+=I;continue}ks(g),I===">"?Pn(g):g.state=w.ATTRIB;continue;case w.CLOSE_TAG:if(g.tagName)I===">"?zo(g):F(_,I)?g.tagName+=I:g.script?(g.script+=""?zo(g):qe(g,"Invalid characters in closing tag");continue;case w.TEXT_ENTITY:case w.ATTRIB_VALUE_ENTITY_Q:case w.ATTRIB_VALUE_ENTITY_U:var it,Tt;switch(g.state){case w.TEXT_ENTITY:it=w.TEXT,Tt="textNode";break;case w.ATTRIB_VALUE_ENTITY_Q:it=w.ATTRIB_VALUE_QUOTED,Tt="attribValue";break;case w.ATTRIB_VALUE_ENTITY_U:it=w.ATTRIB_VALUE_UNQUOTED,Tt="attribValue";break}if(I===";")if(g.opt.unparsedEntities){var Bt=Fl(g);g.entity="",g.state=it,g.write(Bt)}else g[Tt]+=Fl(g),g.entity="",g.state=it;else F(g.entity.length?b:v,I)?g.entity+=I:(qe(g,"Invalid character in entity name"),g[Tt]+="&"+g.entity+I,g.entity="",g.state=it);continue;default:throw new Error(g,"Unknown state: "+g.state)}return g.position>=g.bufferCheckPosition&&n(g),g}return String.fromCodePoint||(function(){var y=String.fromCharCode,g=Math.floor,R=function(){var I=16384,ze=[],Ye,it,Tt=-1,Bt=arguments.length;if(!Bt)return"";for(var Rn="";++Tt1114111||g(ht)!==ht)throw RangeError("Invalid code point: "+ht);ht<=65535?ze.push(ht):(ht-=65536,Ye=(ht>>10)+55296,it=ht%1024+56320,ze.push(Ye,it)),(Tt+1===Bt||ze.length>I)&&(Rn+=y.apply(null,ze),ze.length=0)}return Rn};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:R,configurable:!0,writable:!0}):String.fromCodePoint=R})(),t},uj=JW();var wv=`The output should be formatted as a XML file. +1. Output should conform to the tags below. +2. If tags are not given, make them on your own. +3. Remember to always open and close all the tags. + +As an example, for the tags ["foo", "bar", "baz"]: +1. String " + + + +" is a well-formatted instance of the schema. +2. String " + + " is a badly-formatted instance. +3. String " + + +" is a badly-formatted instance. + +Here are the output tags: +\`\`\` +{tags} +\`\`\``,lj=class extends ls{tags;constructor(t){super(t),this.tags=t?.tags}static lc_name(){return"XMLOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_diff(t,e){if(e)return t?mu(t,e):[{op:"replace",path:"",value:e}]}async parsePartialResult(t){return xv(t[0].text)}async parse(t){return xv(t)}getFormatInstructions(){return!!(this.tags&&this.tags.length>0)?wv.replace("{tags}",this.tags?.join(", ")??""):wv}},XW=t=>t.split(` +`).map(e=>e.replace(/^\s+/,"")).join(` +`).trim(),dj=t=>{if(Object.keys(t).length===0)return{};let e={};return t.children.length>0?(e[t.name]=t.children.map(dj),e):(e[t.name]=t.text??void 0,e)};function xv(t){let e=XW(t),r=uj.parser(!0),n={},o=[];r.onopentag=a=>{let c={name:a.name,attributes:a.attributes,children:[],text:"",isSelfClosing:a.isSelfClosing};o.length>0?o[o.length-1].children.push(c):n=c,a.isSelfClosing||o.push(c)},r.onclosetag=()=>{if(o.length>0){let a=o.pop();o.length===0&&a&&(n=a)}},r.ontext=a=>{if(o.length>0){let c=o[o.length-1];c.text+=a}},r.onattribute=a=>{if(o.length>0){let c=o[o.length-1];c.attributes[a.name]=a.value}};let i=/```(xml)?(.*)```/s.exec(e),s=i?i[2]:e;return r.write(s).close(),n&&n.name==="?xml"&&(n=n.children[0]),dj(n)}var YW={};G(YW,{AsymmetricStructuredOutputParser:()=>cj,BaseCumulativeTransformOutputParser:()=>ls,BaseLLMOutputParser:()=>GI,BaseOutputParser:()=>Ka,BaseTransformOutputParser:()=>si,BytesOutputParser:()=>rj,CommaSeparatedListOutputParser:()=>nj,CustomListOutputParser:()=>oj,JsonMarkdownStructuredOutputParser:()=>HI,JsonOutputParser:()=>KI,ListOutputParser:()=>al,MarkdownListOutputParser:()=>sj,NumberedListOutputParser:()=>ij,OutputParserException:()=>ln,StringOutputParser:()=>aj,StructuredOutputParser:()=>bv,XMLOutputParser:()=>lj,XML_FORMAT_INSTRUCTIONS:()=>wv,parseJsonMarkdown:()=>kd,parsePartialJson:()=>sa,parseXMLMarkdown:()=>xv});function rf(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=sa(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new ln([`Function "${t.function.name}" arguments:`,"",t.function.arguments,"","are not valid JSON.",`Error: ${o.message}`].join(` +`))}let n={name:t.function.name,args:r,type:"tool_call"};return e?.returnId&&(n.id=t.id),n}function WI(t){if(t.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:t.id,type:"function",function:{name:t.name,arguments:JSON.stringify(t.args)}}}function $v(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var JI=class extends ls{static lc_name(){return"JsonOutputToolsParser"}returnId=!1;lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;constructor(t){super(t),this.returnId=t?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(t){return await this.parsePartialResult(t,!1)}async parsePartialResult(t,e=!0){let r=t[0].message,n;if(aa(r)&&r.tool_calls?.length?n=r.tool_calls.map(i=>{let{id:s,...a}=i;return this.returnId?{id:s,...a}:a}):r.additional_kwargs.tool_calls!==void 0&&(n=JSON.parse(JSON.stringify(r.additional_kwargs.tool_calls)).map(s=>rf(s,{returnId:this.returnId,partial:e}))),!n)return[];let o=[];for(let i of n)if(i!==void 0){let s={type:i.name,args:i.args,id:i.id};o.push(s)}return o}},XI=class extends JI{static lc_name(){return"JsonOutputKeyToolsParser"}lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(t){super(t),this.keyName=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){if(this.zodSchema===void 0)return t;let e=await Ey(this.zodSchema,t);if(e.success)return e.data;throw new ln(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(e.error?.issues)}`,JSON.stringify(t,null,2))}async parsePartialResult(t){let r=(await super.parsePartialResult(t)).filter(o=>o.type===this.keyName),n=r;if(r.length)return this.returnId||(n=r.map(o=>o.args)),this.returnSingle?n[0]:n}async parseResult(t){let r=(await super.parsePartialResult(t,!1)).filter(i=>i.type===this.keyName),n=r;return r.length?(this.returnId||(n=r.map(i=>i.args)),this.returnSingle?this._validateResult(n[0]):await Promise.all(n.map(i=>this._validateResult(i)))):void 0}};var QW={};G(QW,{JsonOutputKeyToolsParser:()=>XI,JsonOutputToolsParser:()=>JI,convertLangChainToolCallToOpenAI:()=>WI,makeInvalidToolCall:()=>$v,parseToolCall:()=>rf});var p8={};G(p8,{BaseLLM:()=>tS,LLM:()=>f8});var tS=class of extends tf{lc_namespace=["langchain","llms",this._llmType()];async invoke(e,r){let n=of._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].text}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async*_streamIterator(e,r){if(this._streamResponseChunks===of.prototype._streamResponseChunks)yield this.invoke(e,r);else{let n=of._convertInputToPromptValue(e),[o,i]=this._separateRunnableConfigFromCallOptionsCompat(r),s=await St.configure(o.callbacks,this.callbacks,o.tags,this.tags,o.metadata,this.metadata,{verbose:this.verbose}),a={options:i,invocation_params:this?.invocationParams(i),batch_size:1},c=await s?.handleLLMStart(this.toJSON(),[n.toString()],o.runId,void 0,a,void 0,void 0,o.runName),u=new go({text:""});try{for await(let l of this._streamResponseChunks(n.toString(),i,c?.[0]))u?u=u.concat(l):u=l,typeof l.text=="string"&&(yield l.text)}catch(l){throw await Promise.all((c??[]).map(d=>d?.handleLLMError(l))),l}await Promise.all((c??[]).map(l=>l?.handleLLMEnd({generations:[[u]]})))}}async generatePrompt(e,r,n){let o=e.map(i=>i.toString());return this.generate(o,r,n)}invocationParams(e){return{}}_flattenLLMResult(e){let r=[];for(let n=0;nd?.handleLLMError(l))),l}let u=this._flattenLLMResult(a);await Promise.all((i??[]).map((l,d)=>l?.handleLLMEnd(u[d])))}let c=i?.map(u=>u.runId)||void 0;return Object.defineProperty(a,ya,{value:c?{runIds:c}:void 0,configurable:!0}),a}async _generateCached({prompts:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i,runId:s}){let a=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,i.metadata,this.metadata,{verbose:this.verbose}),c={options:o,invocation_params:this?.invocationParams(o),batch_size:e.length},u=await a?.handleLLMStart(this.toJSON(),e,s,void 0,c,void 0,void 0,i?.runName),l=[],f=(await Promise.allSettled(e.map(async(h,_)=>{let v=await r.lookup(h,n);return v==null&&l.push(_),v}))).map((h,_)=>({result:h,runManager:u?.[_]})).filter(({result:h})=>h.status==="fulfilled"&&h.value!=null||h.status==="rejected"),p=[];await Promise.all(f.map(async({result:h,runManager:_},v)=>{if(h.status==="fulfilled"){let b=h.value;return p[v]=b.map(x=>(x.generationInfo={...x.generationInfo,tokenUsage:{}},x)),b.length&&await _?.handleLLMNewToken(b[0].text),_?.handleLLMEnd({generations:[b]},void 0,void 0,void 0,{cached:!0})}else return await _?.handleLLMError(h.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(h.reason)}));let m={generations:p,missingPromptIndices:l,startedRunManagers:u};return Object.defineProperty(m,ya,{value:u?{runIds:u?.map(h=>h.runId)}:void 0,configurable:!0}),m}async generate(e,r,n){if(!Array.isArray(e))throw new Error("Argument 'prompts' is expected to be a string[]");let o;Array.isArray(r)?o={stop:r}:o=r;let[i,s]=this._separateRunnableConfigFromCallOptionsCompat(o);if(i.callbacks=i.callbacks??n,!this.cache)return this._generateUncached(e,s,i);let{cache:a}=this,c=this._getSerializedCacheKeyParametersForCall(s),{generations:u,missingPromptIndices:l,startedRunManagers:d}=await this._generateCached({prompts:e,cache:a,llmStringKey:c,parsedOptions:s,handledOptions:i,runId:i.runId}),f={};if(l.length>0){let p=await this._generateUncached(l.map(m=>e[m]),s,i,d!==void 0?l.map(m=>d?.[m]):void 0);await Promise.all(p.generations.map(async(m,h)=>{let _=l[h];return u[_]=m,a.update(e[_],c,m)})),f=p.llmOutput??{}}return{generations:u,llmOutput:f}}_identifyingParams(){return{}}_modelType(){return"base_llm"}},f8=class extends tS{async _generate(t,e,r){return{generations:await Promise.all(t.map((o,i)=>this._call(o,{...e,promptIndex:i},r).then(s=>[{text:s}])))}}};var m8={};G(m8,{chunkArray:()=>rS});var rS=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),s=r[i]||[];return r[i]=s.concat([n]),r},[]);var g8={};G(g8,{Embeddings:()=>nS});var nS=class{caller;constructor(t){this.caller=new Xo(t??{})}};var y8={};G(y8,{BaseToolkit:()=>v8,DynamicStructuredTool:()=>xj,DynamicTool:()=>sS,StructuredTool:()=>oS,Tool:()=>iS,ToolInputParsingException:()=>su,isLangChainTool:()=>qa,isRunnableToolLike:()=>qp,isStructuredTool:()=>Zp,isStructuredToolParams:()=>Vp,tool:()=>b8});var oS=class extends _v{extras;returnDirect=!1;verboseParsingErrors=!1;get lc_namespace(){return["langchain","tools"]}responseFormat="content";defaultConfig;constructor(t){super(t??{}),this.verboseParsingErrors=t?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=t?.responseFormat??this.responseFormat,this.defaultConfig=t?.defaultConfig??this.defaultConfig,this.metadata=t?.metadata??this.metadata,this.extras=t?.extras??this.extras}async invoke(t,e){let r,n=Pe(ga(this.defaultConfig,e));return Mi(t)?(r=t.args,n={...n,toolCall:t}):r=t,this.call(r,n)}async call(t,e,r){let n=Mi(t)?t.args:t,o;if(on(this.schema))try{o=await ts(this.schema,n)}catch(p){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m} +Details: ${p.message}`),Py(p)&&(m=`${m} + +${av.prettifyError(p)}`),new su(m,JSON.stringify(t))}else{let p=ot(n,this.schema);if(!p.valid){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m} +Details: ${p.errors.map(h=>`${h.keywordLocation}: ${h.error}`).join(` +`)}`),new su(m,JSON.stringify(t))}o=n}let i=ha(e),a=await St.configure(i.callbacks,this.callbacks,i.tags||r,this.tags,i.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof t=="string"?t:JSON.stringify(t),i.runId,void 0,void 0,void 0,i.runName);delete i.runId;let c;try{c=await this._call(o,a,i)}catch(p){throw await a?.handleToolError(p),p}let u,l;if(this.responseFormat==="content_and_artifact")if(Array.isArray(c)&&c.length===2)[u,l]=c;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple. +Result: ${JSON.stringify(c)}`);else u=c;let d;Mi(t)&&(d=t.id),!d&&nO(i)&&(d=i.toolCall.id);let f=w8({content:u,artifact:l,toolCallId:d,name:this.name,metadata:this.metadata});return await a?.handleToolEnd(f),f}},iS=class extends oS{schema=$r.object({input:$r.string().optional()}).transform(t=>t.input);constructor(t){super(t)}call(t,e){let r=typeof t=="string"||t==null?{input:t}:t;return super.call(r,e)}},sS=class extends iS{static lc_name(){return"DynamicTool"}name;description;func;constructor(t){super(t),this.name=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect}async call(t,e){let r=ha(e);return r.runName===void 0&&(r.runName=this.name),super.call(t,r)}async _call(t,e,r){return this.func(t,e,r)}},xj=class extends oS{static lc_name(){return"DynamicStructuredTool"}name;description;func;schema;constructor(t){super(t),this.name=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect,this.schema=t.schema}async call(t,e,r){let n=ha(e);return n.runName===void 0&&(n.runName=this.name),super.call(t,n,r)}_call(t,e,r){return this.func(t,e,r)}},v8=class{getTools(){return this.tools}};function b8(t,e){let r=Wu(e.schema),n=ol(e.schema);if(!e.schema||r||n)return new sS({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(s,a,c)=>new Promise((u,l)=>{let d=Ve(c,{callbacks:a?.getChild()});Lt.runWithConfig(vr(d),async()=>{try{u(t(s,d))}catch(f){l(f)}})})});let o=e.schema,i=e.description??e.schema.description??`${e.name} tool`;return new xj({...e,description:i,schema:o,func:async(s,a,c)=>new Promise((u,l)=>{let d,f=()=>{c?.signal&&d&&c.signal.removeEventListener("abort",d)};c?.signal&&(d=()=>{f(),l(Bi(c.signal))},c.signal.addEventListener("abort",d));let p=Ve(c,{callbacks:a?.getChild()});Lt.runWithConfig(vr(p),async()=>{try{let m=await t(s,p);if(c?.signal?.aborted){f();return}f(),u(m)}catch(m){f(),l(m)}})})})}function w8(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!Id(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new Or({status:"success",content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new Or({status:"success",content:x8(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function x8(t){try{return JSON.stringify(t,null,2)??""}catch{return`${t}`}}import{BedrockRuntimeClient as G1e,ConverseCommand as K1e,ConverseStreamCommand as H1e}from"@aws-sdk/client-bedrock-runtime";import{defaultProvider as Y1e}from"@aws-sdk/credential-provider-node";import{BedrockAgentRuntimeClient as lMe,RetrieveCommand as dMe}from"@aws-sdk/client-bedrock-agent-runtime";var I8={};G(I8,{BaseRetriever:()=>aS});var aS=class extends Ze{callbacks;tags;metadata;verbose;constructor(t){super(t),this.callbacks=t?.callbacks,this.tags=t?.tags??[],this.metadata=t?.metadata??{},this.verbose=t?.verbose??!1}_getRelevantDocuments(t,e){throw new Error("Not implemented!")}async invoke(t,e){let r=Pe(ha(e)),o=await(await St.configure(r.callbacks,this.callbacks,r.tags,this.tags,r.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),t,r.runId,void 0,void 0,void 0,r.runName);try{let i=await this._getRelevantDocuments(t,o);return await o?.handleRetrieverEnd(i),i}catch(i){throw await o?.handleRetrieverError(i),i}}};import{KendraClient as kMe,QueryCommand as TMe,RetrieveCommand as EMe}from"@aws-sdk/client-kendra";var cS=class{pageContent;metadata;id;constructor(t){this.pageContent=t.pageContent!==void 0?t.pageContent.toString():"",this.metadata=t.metadata??{},this.id=t.id}};var uS=class extends Ze{lc_namespace=["langchain_core","documents","transformers"];invoke(t,e){return this.transformDocuments(t)}},$j=class extends uS{async transformDocuments(t){let e=[];for(let r of t){let n=await this._transformDocument(r);e.push(n)}return e}};var S8={};G(S8,{BaseDocumentTransformer:()=>uS,Document:()=>cS,MappingDocumentTransformer:()=>$j});import{BedrockRuntimeClient as MMe,InvokeModelCommand as jMe}from"@aws-sdk/client-bedrock-runtime";var ll=class{uri;bucketOwner;constructor(e){this.uri=e.uri,e.bucketOwner!==void 0&&(this.bucketOwner=e.bucketOwner)}},sf=class{type="imageBlock";format;source;constructor(e){this.format=e.format,this.source=this._convertSource(e.source)}_convertSource(e){if("bytes"in e)return{type:"imageSourceBytes",bytes:e.bytes};if("url"in e)return{type:"imageSourceUrl",url:e.url};if("s3Location"in e)return{type:"imageSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid image source")}},af=class{type="videoBlock";format;source;constructor(e){this.format=e.format,this.source=this._convertSource(e.source)}_convertSource(e){if("bytes"in e)return{type:"videoSourceBytes",bytes:e.bytes};if("s3Location"in e)return{type:"videoSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid video source")}},cf=class{type="documentBlock";name;format;source;citations;context;constructor(e){this.name=e.name,this.format=e.format,this.source=this._convertSource(e.source),e.citations!==void 0&&(this.citations=e.citations),e.context!==void 0&&(this.context=e.context)}_convertSource(e){if("bytes"in e)return{type:"documentSourceBytes",bytes:e.bytes};if("text"in e)return{type:"documentSourceText",text:e.text};if("content"in e)return{type:"documentSourceContentBlock",content:e.content.map(r=>new mt(r.text))};if("s3Location"in e)return{type:"documentSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid document source")}};var Sr=class t{type="message";role;content;constructor(e){this.role=e.role,this.content=e.content}static fromMessageData(e){let r=e.content.map(Iv);return new t({role:e.role,content:r})}},mt=class{type="textBlock";text;constructor(e){this.text=e}},dl=class{type="toolUseBlock";name;toolUseId;input;constructor(e){this.name=e.name,this.toolUseId=e.toolUseId,this.input=e.input}},Ht=class{type="toolResultBlock";toolUseId;status;content;error;constructor(e){this.toolUseId=e.toolUseId,this.status=e.status,this.content=e.content,e.error!==void 0&&(this.error=e.error)}},pl=class{type="reasoningBlock";text;signature;redactedContent;constructor(e){e.text!==void 0&&(this.text=e.text),e.signature!==void 0&&(this.signature=e.signature),e.redactedContent!==void 0&&(this.redactedContent=e.redactedContent)}},uf=class{type="cachePointBlock";cacheType;constructor(e){this.cacheType=e.cacheType}},Ha=class{type="jsonBlock";json;constructor(e){this.json=e.json}};function Ij(t){return typeof t=="string"?t:t.map(e=>{if("type"in e)return e;if("cachePoint"in e)return new uf(e.cachePoint);if("guardContent"in e)return new lf(e.guardContent);if("text"in e)return new mt(e.text);throw new Error("Unknown SystemContentBlockData type")})}var lf=class{type="guardContentBlock";text;image;constructor(e){if(!e.text&&!e.image)throw new Error("GuardContentBlock must have either text or image content");if(e.text&&e.image)throw new Error("GuardContentBlock cannot have both text and image content");e.text&&(this.text=e.text),e.image&&(this.image=e.image)}};function Iv(t){if("text"in t)return new mt(t.text);if("toolUse"in t)return new dl(t.toolUse);if("toolResult"in t)return new Ht({toolUseId:t.toolResult.toolUseId,status:t.toolResult.status,content:t.toolResult.content.map(e=>{if("text"in e)return new mt(e.text);if("json"in e)return new Ha(e);throw new Error("Unknown ToolResultContentData type")})});if("reasoning"in t)return new pl(t.reasoning);if("cachePoint"in t)return new uf(t.cachePoint);if("guardContent"in t)return new lf(t.guardContent);if("image"in t)return new sf(t.image);if("video"in t)return new af(t.video);if("document"in t)return new cf(t.document);throw new Error("Unknown ContentBlockData type")}var ds=class extends Error{constructor(e){super(e),this.name="ContextWindowOverflowError"}},df=class extends Error{partialMessage;constructor(e,r){super(e),this.name="MaxTokensError",this.partialMessage=r}},ps=class extends Error{constructor(e){super(e),this.name="JsonValidationError"}},pf=class extends Error{constructor(e){super(e),this.name="ConcurrentInvocationError"}};function ai(t){return t instanceof Error?t:new Error(String(t))}var ff=class extends Error{constructor(e){super(`Item with id '${e}' not found`),this.name="ItemNotFoundError"}},mf=class extends Error{constructor(e){super(`An item with the ID '${e}' already exists.`),this.name="DuplicateItemError"}},Ft=class extends Error{constructor(e){super(e),this.name="ValidationError"}},hf=class{_items;constructor(e){this._items=new Map,e&&this.addAll(e)}get(e){return this._items.get(e)}find(e){for(let r of this._items.values())if(e(r))return r}keys(){return Array.from(this._items.keys())}values(){return Array.from(this._items.values())}pairs(){return Array.from(this._items.entries())}clear(){this._items.clear()}add(e){this.validate(e);let r=this.generateId(e);if(this._items.has(r))throw new mf(r);return this._items.set(r,e),r}addAll(e){return e.map(r=>this.add(r))}remove(e){let r=this._items.get(e);if(r===void 0)throw new ff(e);return this._items.delete(e),r}removeAll(e){return e.map(r=>this.remove(r))}findRemove(e){for(let[r,n]of this._items.entries())if(e(n))return this._items.delete(r),n}};if(import.meta.vitest){let{describe:t,it:e,expect:r,beforeEach:n,vi:o}=import.meta.vitest;class i extends hf{nextId=1;generateId(){return this.nextId++}validate(a){if(a.length===0)throw new Ft("Item cannot be an empty string.")}}t("Error Classes",()=>{e("ItemNotFoundError should have the correct name and message",()=>{let s=new ff(123);r(s.name).toBe("ItemNotFoundError"),r(s.message).toBe("Item with id '123' not found")}),e("DuplicateItemError should have the correct name and message",()=>{let s=new mf("abc");r(s.name).toBe("DuplicateItemError"),r(s.message).toBe("An item with the ID 'abc' already exists.")}),e("ValidationError should have the correct name and message",()=>{let s=new Ft("Invalid item");r(s.name).toBe("ValidationError"),r(s.message).toBe("Invalid item")})}),t("Registry",()=>{let s;n(()=>{s=new i}),e("should register an item and return a new ID",()=>{let a=s.add("test-item");r(a).toBe(1),r(s.get(1)).toBe("test-item")}),e("should throw DuplicateItemError when registering with an existing ID",()=>{let a=o.spyOn(s,"generateId").mockReturnValue(1);s.add("test-item"),r(()=>s.add("another-item")).toThrow(mf),a.mockRestore()}),e("should deregister an item and return it",()=>{let a=s.add("test-item"),c=s.remove(a);r(c).toBe("test-item"),r(s.get(a)).toBeUndefined()}),e("should throw ItemNotFoundError when deregistering a non-existent item",()=>{r(()=>s.remove(999)).toThrow(ff)}),e("should get an item by its ID",()=>{let a=s.add("test-item"),c=s.get(a);r(c).toBe("test-item")}),e("should return undefined when getting a non-existent item",()=>{let a=s.get(999);r(a).toBeUndefined()}),e("should find an item using a predicate",()=>{s.add("item-a"),s.add("item-b");let a=s.find(c=>c.includes("b"));r(a).toBe("item-b")}),e("should return undefined when no item matches the predicate",()=>{s.add("item-a");let a=s.find(c=>c.includes("c"));r(a).toBeUndefined()}),e("should return all keys",()=>{s.add("item-1"),s.add("item-2"),r(s.keys()).toEqual([1,2])}),e("should return all values",()=>{s.add("item-1"),s.add("item-2"),r(s.values()).toEqual(["item-1","item-2"])}),e("should return all key-value pairs",()=>{s.add("item-1"),s.add("item-2"),r(s.pairs()).toEqual([[1,"item-1"],[2,"item-2"]])}),e("should clear all items from the registry",()=>{s.add("item-1"),s.clear(),r(s.keys()).toEqual([]),r(s.values()).toEqual([])}),e("should register multiple items",()=>{let a=s.addAll(["item-a","item-b"]);r(a).toEqual([1,2]),r(s.values()).toEqual(["item-a","item-b"])}),e("should deregister multiple items",()=>{let a=s.addAll(["item-a","item-b","item-c"]),c=s.removeAll([a[0],a[2]]);r(c).toEqual(["item-a","item-c"]),r(s.values()).toEqual(["item-b"])}),e("should find and deregister an item",()=>{s.add("item-a"),s.add("item-b");let a=s.findRemove(c=>c.includes("a"));r(a).toBe("item-a"),r(s.values()).toEqual(["item-b"])}),e("should return undefined from findRemove if no item matches",()=>{let a=s.findRemove(c=>c.includes("c"));r(a).toBeUndefined()}),e("should call the validate method on register",()=>{let a=o.spyOn(s,"validate");s.add("a-valid-item"),r(a).toHaveBeenCalledWith("a-valid-item"),a.mockRestore()}),e("should throw a validation error for an invalid item",()=>{r(()=>s.add("")).toThrow(Ft)})})}var gf=class{type="toolStreamEvent";data;constructor(e){e.data!==void 0&&(this.data=e.data)}},fl=class{};function lS(t,e){let r=ai(t);return new Ht({toolUseId:e,status:"error",content:[new mt(`Error: ${r.message}`)],error:r})}var _f=class extends hf{generateId(e){return e}validate(e){if(typeof e.name!="string")throw new Ft("Tool name must be a string");if(e.name.length<1||e.name.length>64)throw new Ft("Tool name must be between 1 and 64 characters");if(!/^[a-zA-Z0-9_-]+$/.test(e.name))throw new Ft("Tool name must contain only alphanumeric characters, hyphens, and underscores");if(e.description!==void 0&&e.description!==null&&(typeof e.description!="string"||e.description.length<1))throw new Ft("Tool description must be a non-empty string");if(this.values().some(n=>n.name===e.name))throw new Ft(`Tool with name '${e.name}' already registered`)}getByName(e){return this.values().find(r=>r.name===e)}removeByName(e){this.findRemove(r=>r.name===e)}};if(import.meta.vitest){let{describe:t,it:e,expect:r,beforeEach:n}=import.meta.vitest,o=(i={})=>({name:"valid-tool",description:"A valid tool description.",toolSpec:{name:"valid-tool",description:"A valid tool description.",inputSchema:{type:"object",properties:{}}},stream:async function*(){return yield new gf({data:"mock data"}),new Ht({toolUseId:"",status:"success",content:[]})},...i});t("ToolRegistry",()=>{let i;n(()=>{i=new _f}),e("should register a valid tool successfully",()=>{let s=o();r(()=>i.add(s)).not.toThrow(),r(i.values()).toHaveLength(1),r(i.values()[0]?.name).toBe("valid-tool")}),e("should throw ValidationError for a duplicate tool name",()=>{let s=o({name:"duplicate-name"}),a=o({name:"duplicate-name"});i.add(s),r(()=>i.add(a)).toThrow(Ft),r(()=>i.add(a)).toThrow("Tool with name 'duplicate-name' already registered")}),e("should throw ValidationError for an invalid tool name pattern",()=>{let s=o({name:"invalid name!"});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must contain only alphanumeric characters, hyphens, and underscores")}),e("should throw ValidationError for a tool name that is too long",()=>{let s="a".repeat(65),a=o({name:s});r(()=>i.add(a)).toThrow(Ft),r(()=>i.add(a)).toThrow("Tool name must be between 1 and 64 characters")}),e("should throw ValidationError for a tool name that is too short",()=>{let s=o({name:""});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must be between 1 and 64 characters")}),e("should throw ValidationError for an invalid description",()=>{let s=o({description:123});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool description must be a non-empty string")}),e("should throw ValidationError for an empty string description",()=>{let s=o({description:""});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool description must be a non-empty string")}),e("should allow a tool with a null or undefined description",()=>{let s=o();s.description=void 0;let a=o();a.name="another-valid-tool",a.description=null,r(()=>i.add(s)).not.toThrow(),r(()=>i.add(a)).not.toThrow()}),e("should retrieve a tool by its name",()=>{let s=o({name:"find-me"});i.add(s);let a=i.getByName("find-me");r(a).toBe(s)}),e("should return undefined when getting a tool by a name that does not exist",()=>{let s=i.getByName("non-existent");r(s).toBeUndefined()}),e("should remove a tool by its name",()=>{let s=o({name:"remove-me"});i.add(s),r(i.getByName("remove-me")).toBeDefined(),i.removeByName("remove-me"),r(i.getByName("remove-me")).toBeUndefined()}),e("should not throw when removing a tool by a name that does not exist",()=>{r(()=>i.removeByName("non-existent")).not.toThrow()}),e("should generate a valid ToolIdentifier",()=>{let s=o(),a=i.generateId(s);r(a).toBe(s)}),e("should register a tool with a name at the maximum length",()=>{let s="a".repeat(64),a=o({name:s});r(()=>i.add(a)).not.toThrow()}),e("should throw ValidationError for a non-string tool name",()=>{let s=o({name:123});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must be a string")})})}function Sv(t){try{return JSON.parse(JSON.stringify(t))}catch(e){let r=e instanceof Error?e.message:String(e);throw new Error(`Unable to serialize tool result: ${r}`)}}function dS(t,e="value"){let r=[],n=(o,i)=>{let s=e;if(o!==""&&(/^\d+$/.test(o)?s=r.length>0?`${r[r.length-1]}[${o}]`:`${e}[${o}]`:s=r.length>0?`${r[r.length-1]}.${o}`:`${e}.${o}`),typeof i=="function")throw new ps(`${s} contains a function which cannot be serialized`);if(typeof i=="symbol")throw new ps(`${s} contains a symbol which cannot be serialized`);if(i===void 0)throw new ps(`${s} is undefined which cannot be serialized`);return i!==null&&typeof i=="object"&&r.push(s),i};try{let o=JSON.stringify(t,n);return JSON.parse(o)}catch(o){if(o instanceof ps)throw o;let i=o instanceof Error?o.message:String(o);throw new Error(`Unable to serialize value: ${i}`)}}var kv=class{_state;constructor(e){e!==void 0?this._state=dS(e,"initialState"):this._state={}}get(e){if(e==null)throw new Error("key is required");let r=this._state[e];if(r!==void 0)return Sv(r)}set(e,r){this._state[e]=dS(r,`value for key "${e}"`)}delete(e){delete this._state[e]}clear(){this._state={}}getAll(){return Sv(this._state)}keys(){return Object.keys(this._state)}};function Sj(){return typeof process<"u"&&process.stdout?.write?t=>process.stdout.write(t):t=>console.log(t)}var Tv=class{_appender;_inReasoningBlock=!1;_toolCount=0;_needReasoningIndent=!1;constructor(e){this._appender=e}write(e){this._appender(e)}processEvent(e){switch(e.type){case"modelContentBlockDeltaEvent":this.handleContentBlockDelta(e);break;case"modelContentBlockStartEvent":this.handleContentBlockStart(e);break;case"modelContentBlockStopEvent":this.handleContentBlockStop();break;case"toolResultBlock":this.handleToolResult(e);break;default:break}}handleContentBlockDelta(e){let{delta:r}=e;r.type==="textDelta"?r.text&&r.text.length>0&&this.write(r.text):r.type==="reasoningContentDelta"&&(this._inReasoningBlock||(this._inReasoningBlock=!0,this._needReasoningIndent=!0,this.write(` +\u{1F4AD} Reasoning: +`)),r.text&&r.text.length>0&&this.writeReasoningText(r.text))}writeReasoningText(e){let r="";for(let n=0;n{this.applyManagement(r.agent.messages)}),e.addCallback(ui,r=>{r.error instanceof ds&&(this.reduceContext(r.agent.messages,r.error),r.retryModelCall=!0)})}applyManagement(e){e.length<=this._windowSize||this.reduceContext(e)}reduceContext(e,r){let n=this.findLastMessageWithToolResults(e);if(r&&n!==void 0&&this._shouldTruncateResults&&this.truncateToolResults(e,n))return;let o=e.length<=this._windowSize?2:e.length-this._windowSize;for(;oc.type==="toolResultBlock")){o++;continue}if(i.content.some(c=>c.type==="toolUseBlock")){let c=e[o+1];if(!(c&&c.content.some(l=>l.type==="toolResultBlock"))){o++;continue}}break}if(o>=e.length)throw new ds("Unable to trim conversation context!");e.splice(0,o)}truncateToolResults(e,r){if(r>=e.length||r<0)return!1;let n=e[r];if(!n)return!1;let o="The tool result was too large!",i=!1;for(let a of n.content)if(a.type==="toolResultBlock"){let c=a,u=c.content[0],l=u&&u.type==="textBlock"?u.text:"";if(c.status==="error"&&l===o)return!1;i=!0;break}if(!i)return!1;let s=n.content.map(a=>{if(a.type==="toolResultBlock"){let c=a;return new Ht({toolUseId:c.toolUseId,status:"error",content:[new mt(o)]})}return a});return e[r]=new Sr({role:n.role,content:s}),!0}findLastMessageWithToolResults(e){for(let r=e.length-1;r>=0;r--)if(e[r].content.some(i=>i.type==="toolResultBlock"))return r}};var vl=class{_callbacks;_currentProvider;constructor(){this._callbacks=new Map,this._currentProvider=void 0}addCallback(e,r){let n={callback:r,source:this._currentProvider},o=this._callbacks.get(e)??[];return o.push(n),this._callbacks.set(e,o),()=>{let i=this._callbacks.get(e);if(!i)return;let s=i.indexOf(n);s!==-1&&i.splice(s,1)}}addHook(e){this._currentProvider=e;try{e.registerCallbacks(this)}finally{this._currentProvider=void 0}}addAllHooks(e){for(let r of e)this.addHook(r)}removeHook(e){for(let[r,n]of this._callbacks.entries()){let o=n.filter(i=>i.source!==e);o.length===0?this._callbacks.delete(r):o.length!==n.length&&this._callbacks.set(r,o)}}async invokeCallbacks(e){let r=this.getCallbacksFor(e);for(let n of r)await n(e);return e}getCallbacksFor(e){let n=(this._callbacks.get(e.constructor)??[]).map(o=>o.callback);return e._shouldReverseCallbacks()?[...n].reverse():n}};var E8=function(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e},A8=(function(t){return function(e){function r(s){e.error=e.hasError?new t(s,e.error,"An error was suppressed during disposal."):s,e.hasError=!0}var n,o=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&o===1)return o=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return o|=2,Promise.resolve(s).then(i,function(a){return r(a),i()})}else o|=1}catch(a){r(a)}if(o===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}})(typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n}),bf=class{messages;state;conversationManager;hooks;model;systemPrompt;_toolRegistry;_mcpClients;_initialized;_isInvoking=!1;_printer;constructor(e){this.messages=(e?.messages??[]).map(i=>i instanceof Sr?i:Sr.fromMessageData(i)),this.state=new kv(e?.state),this.conversationManager=e?.conversationManager??new vf({windowSize:40}),this.hooks=new vl,this.hooks.addHook(this.conversationManager),this.hooks.addAllHooks(e?.hooks??[]),typeof e?.model=="string"?this.model=new ms({modelId:e.model}):this.model=e?.model??new ms;let{tools:r,mcpClients:n}=kj(e?.tools??[]);this._toolRegistry=new _f(r),this._mcpClients=n,e?.systemPrompt!==void 0&&(this.systemPrompt=Ij(e.systemPrompt)),(e?.printer??!0)&&(this._printer=new Tv(Sj())),this._initialized=!1}async initialize(){this._initialized||(await Promise.all(this._mcpClients.map(async e=>{let r=await e.listTools();this._toolRegistry.addAll(r)})),this._initialized=!0)}acquireLock(){if(this._isInvoking)throw new pf("Agent is already processing an invocation. Wait for the current invoke() or stream() call to complete before invoking again.");return this._isInvoking=!0,{[Symbol.dispose]:()=>{this._isInvoking=!1}}}get tools(){return this._toolRegistry.values()}get toolRegistry(){return this._toolRegistry}async invoke(e){let r=this.stream(e),n=await r.next();for(;!n.done;)n=await r.next();return n.value}async*stream(e){let r={stack:[],error:void 0,hasError:!1};try{let n=E8(r,this.acquireLock(),!1);await this.initialize();let o=this._stream(e),i=await o.next();for(;!i.done;){let s=i.value;s instanceof ar&&!(s instanceof Wa)&&await this.hooks.invokeCallbacks(s),this._printer?.processEvent(s),yield s,i=await o.next()}return yield i.value,i.value}catch(n){r.error=n,r.hasError=!0}finally{A8(r)}}async*_stream(e){let r=e;yield new ml({agent:this});try{for(;;){let n=yield*this.invokeModel(r);if(r=void 0,n.stopReason!=="toolUse")return yield await this._appendMessage(n.message),new wf({stopReason:n.stopReason,lastMessage:n.message});let o=yield*this.executeTools(n.message,this._toolRegistry);yield await this._appendMessage(n.message),yield await this._appendMessage(o)}}finally{yield new fs({agent:this})}}_normalizeInput(e){if(e!==void 0){if(typeof e=="string")return[new Sr({role:"user",content:[new mt(e)]})];if(Array.isArray(e)&&e.length>0){let r=e[0];if("role"in r&&typeof r.role=="string")return r instanceof Sr?e:e.map(n=>Sr.fromMessageData(n));{let n;return"type"in r&&typeof r.type=="string"?n=e:n=e.map(Iv),[new Sr({role:"user",content:n})]}}}return[]}async*invokeModel(e){let r=this._normalizeInput(e);for(let i of r)yield await this._appendMessage(i);let o={toolSpecs:this._toolRegistry.values().map(i=>i.toolSpec)};this.systemPrompt!==void 0&&(o.systemPrompt=this.systemPrompt),yield new gl({agent:this});try{let{message:i,stopReason:s}=yield*this._streamFromModel(this.messages,o);return yield new ui({agent:this,stopData:{message:i,stopReason:s}}),{message:i,stopReason:s}}catch(i){let s=ai(i),a=new ui({agent:this,error:s});if(yield a,a.retryModelCall)return yield*this.invokeModel(e);throw i}}async*_streamFromModel(e,r){let n=this.model.streamAggregated(e,r),o=await n.next();for(;!o.done;){let i=o.value;yield new yf({agent:this,event:i}),yield i,o=await n.next()}return o.value}async*executeTools(e,r){yield new _l({agent:this,message:e});let n=e.content.filter(s=>s.type==="toolUseBlock");if(n.length===0)throw new Error("Model indicated toolUse but no tool use blocks found in message");let o=[];for(let s of n){let a=yield*this.executeTool(s,r);o.push(a),yield a}let i=new Sr({role:"user",content:o});return yield new yl({agent:this,message:i}),i}async*executeTool(e,r){let n=r.find(s=>s.name===e.name),o={name:e.name,toolUseId:e.toolUseId,input:e.input};if(yield new hl({agent:this,toolUse:o,tool:n}),!n){let s=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(`Tool '${e.name}' not found in registry`)]});return yield new ci({agent:this,toolUse:o,tool:n,result:s}),s}let i={toolUse:{name:e.name,toolUseId:e.toolUseId,input:e.input},agent:this};try{let a=yield*n.stream(i);if(!a){let c=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(`Tool '${e.name}' did not return a result`)]});return yield new ci({agent:this,toolUse:o,tool:n,result:c}),c}return yield new ci({agent:this,toolUse:o,tool:n,result:a}),a}catch(s){let a=ai(s),c=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(a.message)],error:a});return yield new ci({agent:this,toolUse:o,tool:n,result:c,error:a}),c}}async _appendMessage(e){this.messages.push(e);let r=new Wa({agent:this,message:e});return await this.hooks.invokeCallbacks(r),r}};function kj(t){let e=[],r=[];for(let n of t)if(Array.isArray(n)){let{tools:o,mcpClients:i}=kj(n);e.push(...o),r.push(...i)}else n instanceof xf?r.push(n):e.push(n);return{tools:e,mcpClients:r}}var wf=class{type="agentResult";stopReason;lastMessage;constructor(e){this.stopReason=e.stopReason,this.lastMessage=e.lastMessage}toString(){let e=[];for(let r of this.lastMessage.content)switch(r.type){case"textBlock":e.push(r.text);break;case"reasoningBlock":if(r.text){let n=r.text.replace(/\n/g,` + `);e.push(`\u{1F4AD} Reasoning: + ${n}`)}break;default:console.debug(`Skipping content block type: ${r.type}`);break}return e.join(` +`)}};import{BedrockRuntimeClient as C8,ConverseCommand as R8,ConverseStreamCommand as N8}from"@aws-sdk/client-bedrock-runtime";var Ev=class{type="modelMessageStartEvent";role;constructor(e){this.role=e.role}},Av=class{type="modelContentBlockStartEvent";start;constructor(e){e.start!==void 0&&(this.start=e.start)}},Ov=class{type="modelContentBlockDeltaEvent";contentBlockIndex;delta;constructor(e){this.delta=e.delta}},Pv=class{type="modelContentBlockStopEvent";constructor(e){}},Cv=class{type="modelMessageStopEvent";stopReason;additionalModelResponseFields;constructor(e){this.stopReason=e.stopReason,e.additionalModelResponseFields!==void 0&&(this.additionalModelResponseFields=e.additionalModelResponseFields)}},Rv=class{type="modelMetadataEvent";usage;metrics;trace;constructor(e){e.usage!==void 0&&(this.usage=e.usage),e.metrics!==void 0&&(this.metrics=e.metrics),e.trace!==void 0&&(this.trace=e.trace)}};var Nv=class{_convert_to_class_event(e){switch(e.type){case"modelMessageStartEvent":return new Ev(e);case"modelContentBlockStartEvent":return new Av(e);case"modelContentBlockDeltaEvent":return new Ov(e);case"modelContentBlockStopEvent":return new Pv(e);case"modelMessageStopEvent":return new Cv(e);case"modelMetadataEvent":return new Rv(e);default:throw new Error(`Unsupported event type: ${e}`)}}async*streamAggregated(e,r){let n=null,o=[],i="",s="",a="",c="",u={},l,d=null,f=null,p;for await(let h of this.stream(e,r)){let _=this._convert_to_class_event(h);switch(yield _,_.type){case"modelMessageStartEvent":n=_.role,o.length=0;break;case"modelContentBlockStartEvent":_.start?.type==="toolUseStart"&&(a=_.start.name,c=_.start.toolUseId),s="",i="",u={};break;case"modelContentBlockDeltaEvent":switch(_.delta.type){case"textDelta":i+=_.delta.text;break;case"toolUseInputDelta":s+=_.delta.input;break;case"reasoningContentDelta":_.delta.text&&(u.text=(u.text??"")+_.delta.text),_.delta.signature&&(u.signature=_.delta.signature),_.delta.redactedContent&&(u.redactedContent=_.delta.redactedContent);break}break;case"modelContentBlockStopEvent":{let v;try{c?(v=new dl({name:a,toolUseId:c,input:s?JSON.parse(s):{}}),c="",a=""):Object.keys(u).length>0?v=new pl({...u}):v=new mt(i),o.push(v),yield v}catch(b){b instanceof SyntaxError&&(console.error("Unable to parse JSON string."),l=b)}break}case"modelMessageStopEvent":n&&(d=new Sr({role:n,content:[...o]}),f=_.stopReason);break;case"modelMetadataEvent":p=_;break;default:break}}if(!d||!f)throw new Error("Stream ended without completing a message",{cause:l});if(f==="maxTokens"){let h=new df("Model reached maximum token limit. This is an unrecoverable state that requires intervention.",d);l!==void 0?l.cause=h:l=h}if(l!==void 0)throw l;let m={message:d,stopReason:f};return p!==void 0&&(m.metadata=p),m}};function ct(t,e){if(t==null)throw new Error(`Expected ${e} to be defined, but got ${t}`);return t}var P8={debug:()=>{},info:()=>{},warn:(...t)=>console.warn(...t),error:(...t)=>console.error(...t)},hs=P8;var z8="global.anthropic.claude-sonnet-4-5-20250929-v1:0",M8="us-west-2",j8=!1,D8=["anthropic.claude"],L8=["Input is too long for requested model","input length and `max_tokens` exceed context limit","too many total text bytes"],Tj={end_turn:"endTurn",tool_use:"toolUse",max_tokens:"maxTokens",stop_sequence:"stopSequence",content_filtered:"contentFiltered",guardrail_intervened:"guardrailIntervened"};function U8(t){return t.replace(/_([a-z])/g,(e,r)=>r.toUpperCase())}var ms=class extends Nv{_config;_client;constructor(e){super();let{region:r,clientConfig:n,...o}=e??{};this._config={modelId:z8,...o};let i=n?.customUserAgent?`${n.customUserAgent} strands-agents-ts-sdk`:"strands-agents-ts-sdk";this._client=new C8({...n??{},...r?{region:r}:{},customUserAgent:i}),F8(this._client.config)}updateConfig(e){this._config={...this._config,...e}}getConfig(){return this._config}async*stream(e,r){try{let n=this._formatRequest(e,r);if(this._config.stream!==!1){let o=new N8(n),i=await this._client.send(o);if(i.stream)for await(let s of i.stream){let a=this._mapStreamedBedrockEventToSDKEvent(s);for(let c of a)yield c}}else{let o=new R8(n),i=await this._client.send(o);for(let s of this._mapBedrockEventToSDKEvent(i))yield s}}catch(n){let o=ai(n);throw L8.some(i=>o.message.includes(i))?new ds(o.message):o}}_formatRequest(e,r){let n={modelId:this._config.modelId,messages:this._formatMessages(e)};if(r?.systemPrompt!==void 0)if(typeof r.systemPrompt=="string"){let i=[{text:r.systemPrompt}];this._config.cachePrompt&&i.push({cachePoint:{type:this._config.cachePrompt}}),n.system=i}else r.systemPrompt.length>0&&(this._config.cachePrompt&&hs.warn("cachePrompt config is ignored when systemPrompt is an array, use explicit cache points instead"),n.system=r.systemPrompt.map(i=>this._formatContentBlock(i)));if(r?.toolSpecs&&r.toolSpecs.length>0){let i=r.toolSpecs.map(a=>({toolSpec:{name:a.name,description:a.description,inputSchema:{json:a.inputSchema}}}));this._config.cacheTools&&i.push({cachePoint:{type:this._config.cacheTools}});let s={tools:i};r.toolChoice&&(s.toolChoice=r.toolChoice),n.toolConfig=s}let o={};return this._config.maxTokens!==void 0&&(o.maxTokens=this._config.maxTokens),this._config.temperature!==void 0&&(o.temperature=this._config.temperature),this._config.topP!==void 0&&(o.topP=this._config.topP),this._config.stopSequences!==void 0&&(o.stopSequences=this._config.stopSequences),Object.keys(o).length>0&&(n.inferenceConfig=o),this._config.additionalRequestFields&&(n.additionalModelRequestFields=this._config.additionalRequestFields),this._config.additionalResponseFieldPaths&&(n.additionalModelResponseFieldPaths=this._config.additionalResponseFieldPaths),this._config.additionalArgs&&Object.assign(n,this._config.additionalArgs),n}_formatMessages(e){return e.reduce((r,n)=>{let o=n.content.map(i=>this._formatContentBlock(i)).filter(i=>i!==void 0);return o.length>0&&r.push({role:n.role,content:o}),r},[])}_shouldIncludeToolResultStatus(){let e=this._config.includeToolResultStatus??"auto";if(e===!0)return!0;if(e===!1)return!1;let r=D8.some(n=>this._config.modelId?.includes(n));return hs.debug(`model_id=<${this._config.modelId}>, include_tool_result_status=<${r}> | auto-detected includeToolResultStatus`),r}_formatContentBlock(e){switch(e.type){case"textBlock":return{text:e.text};case"toolUseBlock":return{toolUse:{toolUseId:e.toolUseId,name:e.name,input:e.input}};case"toolResultBlock":{let r=e.content.map(n=>{switch(n.type){case"textBlock":return{text:n.text};case"jsonBlock":return{json:n.json}}});return{toolResult:{toolUseId:e.toolUseId,content:r,...this._shouldIncludeToolResultStatus()&&{status:e.status}}}}case"reasoningBlock":{if(e.text)return{reasoningContent:{reasoningText:{text:e.text,signature:e.signature}}};if(e.redactedContent)return{reasoningContent:{redactedContent:e.redactedContent}};throw Error("reasoning content format incorrect. Either 'text' or 'redactedContent' must be set.")}case"cachePointBlock":return{cachePoint:{type:e.cacheType}};case"imageBlock":return{image:{format:e.format,source:this._formatMediaSource(e.source)}};case"videoBlock":return{video:{format:e.format==="3gp"?"three_gp":e.format,source:this._formatMediaSource(e.source)}};case"documentBlock":return{document:{name:e.name,format:e.format,source:this._formatDocumentSource(e.source),...e.citations&&{citations:e.citations},...e.context&&{context:e.context}}};case"guardContentBlock":{if(e.text)return{guardContent:{text:{text:e.text.text,qualifiers:e.text.qualifiers}}};if(e.image)return{guardContent:{image:{format:e.image.format,source:{bytes:e.image.source.bytes}}}};throw new Error("guardContent must have either text or image")}}}_formatMediaSource(e){switch(e.type){case"imageSourceBytes":case"videoSourceBytes":return{bytes:e.bytes};case"imageSourceUrl":if(e.url.startsWith("s3://"))return{s3Location:{uri:e.url}};console.warn("Ignoring imageSourceUrl content block as its not supported by bedrock");return;case"imageSourceS3Location":case"videoSourceS3Location":return{s3Location:{uri:e.s3Location.uri,...e.s3Location.bucketOwner&&{bucketOwner:e.s3Location.bucketOwner}}};default:throw new Error("Invalid media source")}}_formatDocumentSource(e){switch(e.type){case"documentSourceBytes":return{bytes:e.bytes};case"documentSourceText":return{bytes:new TextEncoder().encode(e.text)};case"documentSourceContentBlock":return{content:e.content.map(r=>({text:r.text}))};case"documentSourceS3Location":return{s3Location:{uri:e.s3Location.uri,...e.s3Location.bucketOwner&&{bucketOwner:e.s3Location.bucketOwner}}};default:throw new Error("Invalid document source")}}_mapBedrockEventToSDKEvent(e){let r=[],n=ct(e.output,"event.output"),o=ct(n.message,"output.message"),i=ct(o.role,"message.role");r.push({type:"modelMessageStartEvent",role:i});let s={text:d=>{r.push({type:"modelContentBlockStartEvent"}),r.push({type:"modelContentBlockDeltaEvent",delta:{type:"textDelta",text:d}}),r.push({type:"modelContentBlockStopEvent"})},toolUse:d=>{r.push({type:"modelContentBlockStartEvent",start:{type:"toolUseStart",name:ct(d.name,"toolUse.name"),toolUseId:ct(d.toolUseId,"toolUse.toolUseId")}}),r.push({type:"modelContentBlockDeltaEvent",delta:{type:"toolUseInputDelta",input:JSON.stringify(ct(d.input,"toolUse.input"))}}),r.push({type:"modelContentBlockStopEvent"})},reasoningContent:d=>{if(!d)return;r.push({type:"modelContentBlockStartEvent"});let f={type:"reasoningContentDelta"};d.reasoningText?(f.text=ct(d.reasoningText.text,"reasoningText.text"),d.reasoningText.signature&&(f.signature=d.reasoningText.signature)):d.redactedContent&&(f.redactedContent=d.redactedContent),Object.keys(f).length>1&&r.push({type:"modelContentBlockDeltaEvent",delta:f}),r.push({type:"modelContentBlockStopEvent"})}};ct(o.content,"message.content").forEach(d=>{for(let f in d)if(f in s){let p=f;s[p](d[p])}else hs.warn(`block_key=<${f}> | skipping unsupported block key`)});let c=ct(e.stopReason,"event.stopReason");r.push({type:"modelMessageStopEvent",stopReason:this._transformStopReason(c,e)});let u=ct(e.usage,"output.usage"),l={type:"modelMetadataEvent",usage:{inputTokens:ct(u.inputTokens,"usage.inputTokens"),outputTokens:ct(u.outputTokens,"usage.outputTokens"),totalTokens:ct(u.totalTokens,"usage.totalTokens")}};return e.metrics&&(l.metrics={latencyMs:ct(e.metrics.latencyMs,"metrics.latencyMs")}),r.push(l),r}_mapStreamedBedrockEventToSDKEvent(e){let r=[],n=ct(Object.keys(e)[0],"eventType"),o=e[n];switch(n){case"messageStart":{let i=o;r.push({type:"modelMessageStartEvent",role:ct(i.role,"messageStart.role")});break}case"contentBlockStart":{let i=o,s={type:"modelContentBlockStartEvent"};if(i.start?.toolUse){let a=i.start.toolUse;s.start={type:"toolUseStart",name:ct(a.name,"toolUse.name"),toolUseId:ct(a.toolUseId,"toolUse.toolUseId")}}r.push(s);break}case"contentBlockDelta":{let s=ct(o.delta,"contentBlockDelta.delta"),a={text:c=>{r.push({type:"modelContentBlockDeltaEvent",delta:{type:"textDelta",text:c}})},toolUse:c=>{c?.input&&r.push({type:"modelContentBlockDeltaEvent",delta:{type:"toolUseInputDelta",input:c.input}})},reasoningContent:c=>{if(!c)return;let u={type:"reasoningContentDelta"};c.text&&(u.text=c.text),c.signature&&(u.signature=c.signature),c.redactedContent&&(u.redactedContent=c.redactedContent),Object.keys(u).length>1&&r.push({type:"modelContentBlockDeltaEvent",delta:u})}};for(let c in s)if(c in a){let u=c;a[u](s[u])}else hs.warn(`delta_key=<${c}> | skipping unsupported delta key`);break}case"contentBlockStop":{r.push({type:"modelContentBlockStopEvent"});break}case"messageStop":{let i=o,s=ct(i.stopReason,"messageStop.stopReason"),a={type:"modelMessageStopEvent",stopReason:this._transformStopReason(s,i)};i.additionalModelResponseFields&&(a.additionalModelResponseFields=i.additionalModelResponseFields),r.push(a);break}case"metadata":{let i=o,s={type:"modelMetadataEvent"};if(i.usage){let a=i.usage,c={inputTokens:ct(a.inputTokens,"usage.inputTokens"),outputTokens:ct(a.outputTokens,"usage.outputTokens"),totalTokens:ct(a.totalTokens,"usage.totalTokens")};a.cacheReadInputTokens!==void 0&&(c.cacheReadInputTokens=a.cacheReadInputTokens),a.cacheWriteInputTokens!==void 0&&(c.cacheWriteInputTokens=a.cacheWriteInputTokens),s.usage=c}i.metrics&&(s.metrics={latencyMs:ct(i.metrics.latencyMs,"metrics.latencyMs")}),i.trace&&(s.trace=i.trace),r.push(s);break}case"internalServerException":case"modelStreamErrorException":case"serviceUnavailableException":case"validationException":case"throttlingException":throw o;default:hs.warn(`event_type=<${n}> | unsupported bedrock event type`);break}return r}_transformStopReason(e,r){let n;if(e in Tj)n=Tj[e];else{let o=U8(e);hs.warn(`stop_reason=<${e}>, fallback=<${o}> | unknown stop reason, converting to camelCase`),n=o}return n==="endTurn"&&r&&"output"in r&&r.output?.message?.content?.some(o=>"toolUse"in o)&&(n="toolUse",hs.warn("stop_reason= | adjusting to tool_use due to tool use in content blocks")),n}};function F8(t){let e=t.region.bind(t);t.region=async()=>{try{return await e()}catch(n){if(ai(n).message==="Region is missing")return M8;throw n}};let r=t.useFipsEndpoint.bind(t);t.useFipsEndpoint=async()=>{try{return await r()}catch(n){if(ai(n).message==="Region is missing")return j8;throw n}}}function bl(t){return!!t._zod}function Jn(t,e){return bl(t)?ba(t,e):t.safeParse(e)}function zv(t){var e,r;if(!t)return;let n;if(bl(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function Oj(t){var e;if(bl(t)){let s=(e=t._zod)===null||e===void 0?void 0:e.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let o=t.value;if(o!==void 0)return o}var fS="2025-11-25";var Pj=[fS,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],To="io.modelcontextprotocol/related-task",jv="2.0",ko=MI(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Cj=tt([A(),We().int()]),Rj=A(),G8=un({ttl:tt([We(),Yp()]).optional(),pollInterval:We().optional()}),mS=un({taskId:A()}),K8=un({progressToken:Cj.optional(),[To]:mS.optional()}),Ur=un({task:G8.optional(),_meta:K8.optional()}),Wt=U({method:A(),params:Ur.optional()}),Ja=un({_meta:U({[To]:ie(mS)}).passthrough().optional()}),kn=U({method:A(),params:Ja.optional()}),cr=un({_meta:un({[To]:mS.optional()}).optional()}),Dv=tt([A(),We().int()]),Nj=U({jsonrpc:se(jv),id:Dv,...Wt.shape}).strict(),hS=t=>Nj.safeParse(t).success,zj=U({jsonrpc:se(jv),...kn.shape}).strict(),Mj=t=>zj.safeParse(t).success,jj=U({jsonrpc:se(jv),id:Dv,result:cr}).strict(),$f=t=>jj.safeParse(t).success,be;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(be||(be={}));var Dj=U({jsonrpc:se(jv),id:Dv,error:U({code:We().int(),message:A(),data:ie(ft())})}).strict(),Lj=t=>Dj.safeParse(t).success,BDe=tt([Nj,zj,jj,Dj]),Xa=cr.strict(),H8=Ja.extend({requestId:Dv,reason:A().optional()}),Lv=kn.extend({method:se("notifications/cancelled"),params:H8}),W8=U({src:A(),mimeType:A().optional(),sizes:Re(A()).optional()}),If=U({icons:Re(W8).optional()}),wl=U({name:A(),title:A().optional()}),Uj=wl.extend({...wl.shape,...If.shape,version:A(),websiteUrl:A().optional()}),J8=Qp(U({applyDefaults:Nt().optional()}),bt(A(),ft())),X8=sv(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Qp(U({form:J8.optional(),url:ko.optional()}),bt(A(),ft()).optional())),Y8=U({list:ie(U({}).passthrough()),cancel:ie(U({}).passthrough()),requests:ie(U({sampling:ie(U({createMessage:ie(U({}).passthrough())}).passthrough()),elicitation:ie(U({create:ie(U({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),Q8=U({list:ie(U({}).passthrough()),cancel:ie(U({}).passthrough()),requests:ie(U({tools:ie(U({call:ie(U({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),eJ=U({experimental:bt(A(),ko).optional(),sampling:U({context:ko.optional(),tools:ko.optional()}).optional(),elicitation:X8.optional(),roots:U({listChanged:Nt().optional()}).optional(),tasks:ie(Y8)}),tJ=Ur.extend({protocolVersion:A(),capabilities:eJ,clientInfo:Uj}),rJ=Wt.extend({method:se("initialize"),params:tJ});var nJ=U({experimental:bt(A(),ko).optional(),logging:ko.optional(),completions:ko.optional(),prompts:ie(U({listChanged:ie(Nt())})),resources:U({subscribe:Nt().optional(),listChanged:Nt().optional()}).optional(),tools:U({listChanged:Nt().optional()}).optional(),tasks:ie(Q8)}).passthrough(),gS=cr.extend({protocolVersion:A(),capabilities:nJ,serverInfo:Uj,instructions:A().optional()}),oJ=kn.extend({method:se("notifications/initialized")});var Uv=Wt.extend({method:se("ping")}),iJ=U({progress:We(),total:ie(We()),message:ie(A())}),sJ=U({...Ja.shape,...iJ.shape,progressToken:Cj}),Fv=kn.extend({method:se("notifications/progress"),params:sJ}),aJ=Ur.extend({cursor:Rj.optional()}),Sf=Wt.extend({params:aJ.optional()}),kf=cr.extend({nextCursor:ie(Rj)}),Tf=U({taskId:A(),status:zt(["working","input_required","completed","failed","cancelled"]),ttl:tt([We(),Yp()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:ie(We()),statusMessage:ie(A())}),Ya=cr.extend({task:Tf}),cJ=Ja.merge(Tf),Ef=kn.extend({method:se("notifications/tasks/status"),params:cJ}),Bv=Wt.extend({method:se("tasks/get"),params:Ur.extend({taskId:A()})}),Zv=cr.merge(Tf),qv=Wt.extend({method:se("tasks/result"),params:Ur.extend({taskId:A()})}),Vv=Sf.extend({method:se("tasks/list")}),Gv=kf.extend({tasks:Re(Tf)}),Fj=Wt.extend({method:se("tasks/cancel"),params:Ur.extend({taskId:A()})}),Bj=cr.merge(Tf),Zj=U({uri:A(),mimeType:ie(A()),_meta:bt(A(),ft()).optional()}),qj=Zj.extend({text:A()}),_S=A().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Vj=Zj.extend({blob:_S}),xl=U({audience:Re(zt(["user","assistant"])).optional(),priority:We().min(0).max(1).optional(),lastModified:il.datetime({offset:!0}).optional()}),Gj=U({...wl.shape,...If.shape,uri:A(),description:ie(A()),mimeType:ie(A()),annotations:xl.optional(),_meta:ie(un({}))}),uJ=U({...wl.shape,...If.shape,uriTemplate:A(),description:ie(A()),mimeType:ie(A()),annotations:xl.optional(),_meta:ie(un({}))}),lJ=Sf.extend({method:se("resources/list")}),yS=kf.extend({resources:Re(Gj)}),dJ=Sf.extend({method:se("resources/templates/list")}),vS=kf.extend({resourceTemplates:Re(uJ)}),bS=Ur.extend({uri:A()}),pJ=bS,fJ=Wt.extend({method:se("resources/read"),params:pJ}),wS=cr.extend({contents:Re(tt([qj,Vj]))}),mJ=kn.extend({method:se("notifications/resources/list_changed")}),hJ=bS,gJ=Wt.extend({method:se("resources/subscribe"),params:hJ}),_J=bS,yJ=Wt.extend({method:se("resources/unsubscribe"),params:_J}),vJ=Ja.extend({uri:A()}),bJ=kn.extend({method:se("notifications/resources/updated"),params:vJ}),wJ=U({name:A(),description:ie(A()),required:ie(Nt())}),xJ=U({...wl.shape,...If.shape,description:ie(A()),arguments:ie(Re(wJ)),_meta:ie(un({}))}),$J=Sf.extend({method:se("prompts/list")}),xS=kf.extend({prompts:Re(xJ)}),IJ=Ur.extend({name:A(),arguments:bt(A(),A()).optional()}),SJ=Wt.extend({method:se("prompts/get"),params:IJ}),$S=U({type:se("text"),text:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),IS=U({type:se("image"),data:_S,mimeType:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),SS=U({type:se("audio"),data:_S,mimeType:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),kJ=U({type:se("tool_use"),name:A(),id:A(),input:U({}).passthrough(),_meta:ie(U({}).passthrough())}).passthrough(),TJ=U({type:se("resource"),resource:tt([qj,Vj]),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),EJ=Gj.extend({type:se("resource_link")}),kS=tt([$S,IS,SS,EJ,TJ]),AJ=U({role:zt(["user","assistant"]),content:kS}),TS=cr.extend({description:ie(A()),messages:Re(AJ)}),OJ=kn.extend({method:se("notifications/prompts/list_changed")}),PJ=U({title:A().optional(),readOnlyHint:Nt().optional(),destructiveHint:Nt().optional(),idempotentHint:Nt().optional(),openWorldHint:Nt().optional()}),CJ=U({taskSupport:zt(["required","optional","forbidden"]).optional()}),Kj=U({...wl.shape,...If.shape,description:A().optional(),inputSchema:U({type:se("object"),properties:bt(A(),ko).optional(),required:Re(A()).optional()}).catchall(ft()),outputSchema:U({type:se("object"),properties:bt(A(),ko).optional(),required:Re(A()).optional()}).catchall(ft()).optional(),annotations:ie(PJ),execution:ie(CJ),_meta:bt(A(),ft()).optional()}),RJ=Sf.extend({method:se("tools/list")}),ES=kf.extend({tools:Re(Kj)}),$l=cr.extend({content:Re(kS).default([]),structuredContent:bt(A(),ft()).optional(),isError:ie(Nt())}),ZDe=$l.or(cr.extend({toolResult:ft()})),NJ=Ur.extend({name:A(),arguments:ie(bt(A(),ft()))}),zJ=Wt.extend({method:se("tools/call"),params:NJ}),MJ=kn.extend({method:se("notifications/tools/list_changed")}),Hj=zt(["debug","info","notice","warning","error","critical","alert","emergency"]),jJ=Ur.extend({level:Hj}),DJ=Wt.extend({method:se("logging/setLevel"),params:jJ}),LJ=Ja.extend({level:Hj,logger:A().optional(),data:ft()}),UJ=kn.extend({method:se("notifications/message"),params:LJ}),FJ=U({name:A().optional()}),BJ=U({hints:ie(Re(FJ)),costPriority:ie(We().min(0).max(1)),speedPriority:ie(We().min(0).max(1)),intelligencePriority:ie(We().min(0).max(1))}),ZJ=U({mode:ie(zt(["auto","required","none"]))}),qJ=U({type:se("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:Re(kS).default([]),structuredContent:U({}).passthrough().optional(),isError:ie(Nt()),_meta:ie(U({}).passthrough())}).passthrough(),VJ=ov("type",[$S,IS,SS]),Mv=ov("type",[$S,IS,SS,kJ,qJ]),GJ=U({role:zt(["user","assistant"]),content:tt([Mv,Re(Mv)]),_meta:ie(U({}).passthrough())}).passthrough(),KJ=Ur.extend({messages:Re(GJ),modelPreferences:BJ.optional(),systemPrompt:A().optional(),includeContext:zt(["none","thisServer","allServers"]).optional(),temperature:We().optional(),maxTokens:We().int(),stopSequences:Re(A()).optional(),metadata:ko.optional(),tools:ie(Re(Kj)),toolChoice:ie(ZJ)}),AS=Wt.extend({method:se("sampling/createMessage"),params:KJ}),OS=cr.extend({model:A(),stopReason:ie(zt(["endTurn","stopSequence","maxTokens"]).or(A())),role:zt(["user","assistant"]),content:VJ}),HJ=cr.extend({model:A(),stopReason:ie(zt(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:zt(["user","assistant"]),content:tt([Mv,Re(Mv)])}),WJ=U({type:se("boolean"),title:A().optional(),description:A().optional(),default:Nt().optional()}),JJ=U({type:se("string"),title:A().optional(),description:A().optional(),minLength:We().optional(),maxLength:We().optional(),format:zt(["email","uri","date","date-time"]).optional(),default:A().optional()}),XJ=U({type:zt(["number","integer"]),title:A().optional(),description:A().optional(),minimum:We().optional(),maximum:We().optional(),default:We().optional()}),YJ=U({type:se("string"),title:A().optional(),description:A().optional(),enum:Re(A()),default:A().optional()}),QJ=U({type:se("string"),title:A().optional(),description:A().optional(),oneOf:Re(U({const:A(),title:A()})),default:A().optional()}),e7=U({type:se("string"),title:A().optional(),description:A().optional(),enum:Re(A()),enumNames:Re(A()).optional(),default:A().optional()}),t7=tt([YJ,QJ]),r7=U({type:se("array"),title:A().optional(),description:A().optional(),minItems:We().optional(),maxItems:We().optional(),items:U({type:se("string"),enum:Re(A())}),default:Re(A()).optional()}),n7=U({type:se("array"),title:A().optional(),description:A().optional(),minItems:We().optional(),maxItems:We().optional(),items:U({anyOf:Re(U({const:A(),title:A()}))}),default:Re(A()).optional()}),o7=tt([r7,n7]),i7=tt([e7,t7,o7]),s7=tt([i7,WJ,JJ,XJ]),a7=Ur.extend({mode:se("form").optional(),message:A(),requestedSchema:U({type:se("object"),properties:bt(A(),s7),required:Re(A()).optional()})}),c7=Ur.extend({mode:se("url"),message:A(),elicitationId:A(),url:A().url()}),u7=tt([a7,c7]),PS=Wt.extend({method:se("elicitation/create"),params:u7}),l7=Ja.extend({elicitationId:A()}),d7=kn.extend({method:se("notifications/elicitation/complete"),params:l7}),CS=cr.extend({action:zt(["accept","decline","cancel"]),content:sv(t=>t===null?void 0:t,bt(A(),tt([A(),We(),Nt(),Re(A())])).optional())}),p7=U({type:se("ref/resource"),uri:A()});var f7=U({type:se("ref/prompt"),name:A()}),m7=Ur.extend({ref:tt([f7,p7]),argument:U({name:A(),value:A()}),context:U({arguments:bt(A(),A()).optional()}).optional()}),h7=Wt.extend({method:se("completion/complete"),params:m7});var RS=cr.extend({completion:un({values:Re(A()).max(100),total:ie(We().int()),hasMore:ie(Nt())})}),g7=U({uri:A().startsWith("file://"),name:A().optional(),_meta:bt(A(),ft()).optional()}),_7=Wt.extend({method:se("roots/list")}),y7=cr.extend({roots:Re(g7)}),v7=kn.extend({method:se("notifications/roots/list_changed")}),qDe=tt([Uv,rJ,h7,DJ,SJ,$J,lJ,dJ,fJ,gJ,yJ,zJ,RJ,Bv,qv,Vv]),VDe=tt([Lv,Fv,oJ,v7,Ef]),GDe=tt([Xa,OS,HJ,CS,y7,Zv,Gv,Ya]),KDe=tt([Uv,AS,PS,_7,Bv,qv,Vv]),HDe=tt([Lv,Fv,UJ,bJ,mJ,MJ,OJ,Ef,d7]),WDe=tt([Xa,gS,RS,TS,xS,yS,vS,wS,$l,ES,Zv,Gv,Ya]),de=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===be.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new pS(o.elicitations,r)}return new t(e,r,n)}},pS=class extends de{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(be.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}};function gs(t){return t==="completed"||t==="failed"||t==="cancelled"}var b7=Symbol("Let zodToJsonSchema decide on which parser to use");var ALe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function NS(t){let e=zv(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Oj(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function zS(t,e){let r=Jn(t,e);if(!r.success)throw r.error;return r.data}var k7=6e4,Kv=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Lv,r=>{this._oncancel(r)}),this.setNotificationHandler(Fv,r=>{this._onprogress(r)}),this.setRequestHandler(Uv,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Bv,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new de(be.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(qv,async(r,n)=>{let o=async()=>{var i;let s=r.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(c.type==="response"||c.type==="error"){let u=c.message,l=u.id,d=this._requestResolvers.get(l);if(d)if(this._requestResolvers.delete(l),c.type==="response")d(u);else{let f=u,p=new de(f.error.code,f.error.message,f.error.data);d(p)}else{let f=c.type==="response"?"Response":"Error";this._onerror(new Error(`${f} handler missing for request ${l}`))}continue}await((i=this._transport)===null||i===void 0?void 0:i.send(c.message,{relatedRequestId:n.requestId}))}}let a=await this._taskStore.getTask(s,n.sessionId);if(!a)throw new de(be.InvalidParams,`Task not found: ${s}`);if(!gs(a.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(gs(a.status)){let c=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...c,_meta:{...c._meta,[To]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(Vv,async(r,n)=>{var o;try{let{tasks:i,nextCursor:s}=await this._taskStore.listTasks((o=r.params)===null||o===void 0?void 0:o.cursor,n.sessionId);return{tasks:i,nextCursor:s,_meta:{}}}catch(i){throw new de(be.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Fj,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new de(be.InvalidParams,`Task not found: ${r.params.taskId}`);if(gs(o.status))throw new de(be.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new de(be.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof de?o:new de(be.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){let r=this._requestHandlerAbortControllers.get(e.params.requestId);r?.abort(e.params.reason)}_setupTimeout(e,r,n,o,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),de.fromError(be.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,o;this._transport=e;let i=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};let s=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{s?.(c),this._onerror(c)};let a=(o=this._transport)===null||o===void 0?void 0:o.onmessage;this._transport.onmessage=(c,u)=>{a?.(c,u),$f(c)||Lj(c)?this._onresponse(c):hS(c)?this._onrequest(c,u):Mj(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let n=de.fromError(be.ConnectionClosed,"Connection closed");this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);for(let o of r.values())o(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){var n,o,i,s,a,c;let u=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,l=this._transport,d=(s=(i=(o=e.params)===null||o===void 0?void 0:o._meta)===null||i===void 0?void 0:i[To])===null||s===void 0?void 0:s.taskId;if(u===void 0){let _={jsonrpc:"2.0",id:e.id,error:{code:be.MethodNotFound,message:"Method not found"}};d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:_,timestamp:Date.now()},l?.sessionId).catch(v=>this._onerror(new Error(`Failed to enqueue error response: ${v}`))):l?.send(_).catch(v=>this._onerror(new Error(`Failed to send an error response: ${v}`)));return}let f=new AbortController;this._requestHandlerAbortControllers.set(e.id,f);let p=(a=e.params)===null||a===void 0?void 0:a.task,m=this._taskStore?this.requestTaskStore(e,l?.sessionId):void 0,h={signal:f.signal,sessionId:l?.sessionId,_meta:(c=e.params)===null||c===void 0?void 0:c._meta,sendNotification:async _=>{let v={relatedRequestId:e.id};d&&(v.relatedTask={taskId:d}),await this.notification(_,v)},sendRequest:async(_,v,b)=>{var x,k;let T={...b,relatedRequestId:e.id};d&&!T.relatedTask&&(T.relatedTask={taskId:d});let F=(k=(x=T.relatedTask)===null||x===void 0?void 0:x.taskId)!==null&&k!==void 0?k:d;return F&&m&&await m.updateTaskStatus(F,"input_required"),await this.request(_,v,T)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:d,taskStore:m,taskRequestedTtl:p?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{p&&this.assertTaskHandlerCapability(e.method)}).then(()=>u(e,h)).then(async _=>{if(f.signal.aborted)return;let v={result:_,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:v,timestamp:Date.now()},l?.sessionId):await l?.send(v)},async _=>{var v;if(f.signal.aborted)return;let b={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(_.code)?_.code:be.InternalError,message:(v=_.message)!==null&&v!==void 0?v:"Internal error",..._.data!==void 0&&{data:_.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:b,timestamp:Date.now()},l?.sessionId):await l?.send(b)}).catch(_=>this._onerror(new Error(`Failed to send response: ${_}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),$f(e))n(e);else{let s=new de(e.error.code,e.error.message,e.error.data);n(s)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if($f(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(i=!0,this._taskProgressTokens.set(a.taskId,r))}}if(i||this._progressHandlers.delete(r),$f(e))o(e);else{let s=de.fromError(e.error.code,e.error.message,e.error.data);o(s)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}async*requestStream(e,r,n){var o,i,s,a;let{task:c}=n??{};if(!c){try{yield{type:"result",result:await this.request(e,r,n)}}catch(l){yield{type:"error",error:l instanceof de?l:new de(be.InternalError,String(l))}}return}let u;try{let l=await this.request(e,Ya,n);if(l.task)u=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new de(be.InternalError,"Task creation did not return a task");for(;;){let d=await this.getTask({taskId:u},n);if(yield{type:"taskStatus",task:d},gs(d.status)){d.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)}:d.status==="failed"?yield{type:"error",error:new de(be.InternalError,`Task ${u} failed`)}:d.status==="cancelled"&&(yield{type:"error",error:new de(be.InternalError,`Task ${u} was cancelled`)});return}if(d.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)};return}let f=(s=(o=d.pollInterval)!==null&&o!==void 0?o:(i=this._options)===null||i===void 0?void 0:i.defaultTaskPollInterval)!==null&&s!==void 0?s:1e3;await new Promise(p=>setTimeout(p,f)),(a=n?.signal)===null||a===void 0||a.throwIfAborted()}}catch(l){yield{type:"error",error:l instanceof de?l:new de(be.InternalError,String(l))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{var d,f,p,m,h,_,v;let b=Z=>{l(Z)};if(!this._transport){b(new Error("Not connected"));return}if(((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(Z){b(Z);return}(f=n?.signal)===null||f===void 0||f.throwIfAborted();let x=this._requestMessageId++,k={...e,jsonrpc:"2.0",id:x};n?.onprogress&&(this._progressHandlers.set(x,n.onprogress),k.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:x}}),a&&(k.params={...k.params,task:a}),c&&(k.params={...k.params,_meta:{...((m=k.params)===null||m===void 0?void 0:m._meta)||{},[To]:c}});let T=Z=>{var oe;this._responseHandlers.delete(x),this._progressHandlers.delete(x),this._cleanupTimeout(x),(oe=this._transport)===null||oe===void 0||oe.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:x,reason:String(Z)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(wt=>this._onerror(new Error(`Failed to send cancellation: ${wt}`)));let Q=Z instanceof de?Z:new de(be.RequestTimeout,String(Z));l(Q)};this._responseHandlers.set(x,Z=>{var oe;if(!(!((oe=n?.signal)===null||oe===void 0)&&oe.aborted)){if(Z instanceof Error)return l(Z);try{let Q=Jn(r,Z.result);Q.success?u(Q.data):l(Q.error)}catch(Q){l(Q)}}}),(h=n?.signal)===null||h===void 0||h.addEventListener("abort",()=>{var Z;T((Z=n?.signal)===null||Z===void 0?void 0:Z.reason)});let F=(_=n?.timeout)!==null&&_!==void 0?_:k7,J=()=>T(de.fromError(be.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(x,F,n?.maxTotalTimeout,J,(v=n?.resetTimeoutOnProgress)!==null&&v!==void 0?v:!1);let w=c?.taskId;if(w){let Z=oe=>{let Q=this._responseHandlers.get(x);Q?Q(oe):this._onerror(new Error(`Response handler missing for side-channeled request ${x}`))};this._requestResolvers.set(x,Z),this._enqueueTaskMessage(w,{type:"request",message:k,timestamp:Date.now()}).catch(oe=>{this._cleanupTimeout(x),l(oe)})}else this._transport.send(k,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(Z=>{this._cleanupTimeout(x),l(Z)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Zv,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Gv,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Bj,r)}async notification(e,r){var n,o,i,s,a;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let c=(n=r?.relatedTask)===null||n===void 0?void 0:n.taskId;if(c){let f={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...((o=e.params)===null||o===void 0?void 0:o._meta)||{},[To]:r.relatedTask}}};await this._enqueueTaskMessage(c,{type:"notification",message:f,timestamp:Date.now()});return}if(((s=(i=this._options)===null||i===void 0?void 0:i.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var f,p;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let m={...e,jsonrpc:"2.0"};r?.relatedTask&&(m={...m,params:{...m.params,_meta:{...((f=m.params)===null||f===void 0?void 0:f._meta)||{},[To]:r.relatedTask}}}),(p=this._transport)===null||p===void 0||p.send(m,r).catch(h=>this._onerror(h))});return}let d={...e,jsonrpc:"2.0"};r?.relatedTask&&(d={...d,params:{...d.params,_meta:{...((a=d.params)===null||a===void 0?void 0:a._meta)||{},[To]:r.relatedTask}}}),await this._transport.send(d,r)}setRequestHandler(e,r){let n=NS(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let s=zS(e,o);return Promise.resolve(r(s,i))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=NS(e);this._notificationHandlers.set(n,o=>{let i=zS(e,o);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){var o;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=(o=this._options)===null||o===void 0?void 0:o.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,i)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&hS(o.message)){let i=o.message.id,s=this._requestResolvers.get(i);s?(s(new de(be.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){var n,o,i;let s=(o=(n=this._options)===null||n===void 0?void 0:n.defaultTaskPollInterval)!==null&&o!==void 0?o:1e3;try{let a=await((i=this._taskStore)===null||i===void 0?void 0:i.getTask(e));a?.pollInterval&&(s=a.pollInterval)}catch{}return new Promise((a,c)=>{if(r.aborted){c(new de(be.InvalidRequest,"Request cancelled"));return}let u=setTimeout(a,s);r.addEventListener("abort",()=>{clearTimeout(u),c(new de(be.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new de(be.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await n.storeTaskResult(o,i,s,r);let a=await n.getTask(o,r);if(a){let c=Ef.parse({method:"notifications/tasks/status",params:a});await this.notification(c),gs(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,s)=>{let a=await n.getTask(o,r);if(!a)throw new de(be.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(gs(a.status))throw new de(be.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,s,r);let c=await n.getTask(o,r);if(c){let u=Ef.parse({method:"notifications/tasks/status",params:c});await this.notification(u),gs(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Wj(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Jj(t,e){let r={...t};for(let n in e){let o=n,i=e[o];if(i===void 0)continue;let s=r[o];Wj(s)&&Wj(i)?r[o]={...s,...i}:r[o]=i}return r}var MU=mn(bT(),1),jU=mn(zU(),1);function gre(){let t=new MU.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,jU.default)(t),t}var Ob=class{constructor(e){this._ajv=e??gre()}getValidator(e){var r;let n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return o=>n(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Pb=class{constructor(e){this._client=e}async*callToolStream(e,r=$l,n){var o;let i=this._client,s={...n,task:(o=n?.task)!==null&&o!==void 0?o:i.isToolTask(e.name)?{}:void 0},a=i.requestStream({method:"tools/call",params:e},r,s),c=i.getToolOutputValidator(e.name);for await(let u of a){if(u.type==="result"&&c){let l=u.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new de(be.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{let d=c(l.structuredContent);if(!d.valid){yield{type:"error",error:new de(be.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof de){yield{type:"error",error:d};return}yield{type:"error",error:new de(be.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield u}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function DU(t,e,r){var n;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!(!((n=t.tools)===null||n===void 0)&&n.call))throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function LU(t,e,r){var n,o;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!(!((n=t.sampling)===null||n===void 0)&&n.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!(!((o=t.elicitation)===null||o===void 0)&&o.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function Cb(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let o of Object.keys(n)){let i=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[o]=i.default),r[o]!==void 0&&Cb(i,r[o])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)Cb(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)Cb(r,e)}}function _re(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var Rb=class extends Kv{constructor(e,r){var n,o;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._jsonSchemaValidator=(o=r?.jsonSchemaValidator)!==null&&o!==void 0?o:new Ob}get experimental(){return this._experimental||(this._experimental={tasks:new Pb(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Jj(this._capabilities,e)}setRequestHandler(e,r){var n,o,i;let s=zv(e),a=s?.method;if(!a)throw new Error("Schema is missing a method literal");let c;if(bl(a)){let l=a,d=(n=l._zod)===null||n===void 0?void 0:n.def;c=(o=d?.value)!==null&&o!==void 0?o:l.value}else{let l=a,d=l._def;c=(i=d?.value)!==null&&i!==void 0?i:l.value}if(typeof c!="string")throw new Error("Schema method literal must be a string");let u=c;if(u==="elicitation/create"){let l=async(d,f)=>{var p,m,h;let _=Jn(PS,d);if(!_.success){let Z=_.error instanceof Error?_.error.message:String(_.error);throw new de(be.InvalidParams,`Invalid elicitation request: ${Z}`)}let{params:v}=_.data,b=(p=v.mode)!==null&&p!==void 0?p:"form",{supportsFormMode:x,supportsUrlMode:k}=_re(this._capabilities.elicitation);if(b==="form"&&!x)throw new de(be.InvalidParams,"Client does not support form-mode elicitation requests");if(b==="url"&&!k)throw new de(be.InvalidParams,"Client does not support URL-mode elicitation requests");let T=await Promise.resolve(r(d,f));if(v.task){let Z=Jn(Ya,T);if(!Z.success){let oe=Z.error instanceof Error?Z.error.message:String(Z.error);throw new de(be.InvalidParams,`Invalid task creation result: ${oe}`)}return Z.data}let F=Jn(CS,T);if(!F.success){let Z=F.error instanceof Error?F.error.message:String(F.error);throw new de(be.InvalidParams,`Invalid elicitation result: ${Z}`)}let J=F.data,w=b==="form"?v.requestedSchema:void 0;if(b==="form"&&J.action==="accept"&&J.content&&w&&!((h=(m=this._capabilities.elicitation)===null||m===void 0?void 0:m.form)===null||h===void 0)&&h.applyDefaults)try{Cb(w,J.content)}catch{}return J};return super.setRequestHandler(e,l)}if(u==="sampling/createMessage"){let l=async(d,f)=>{let p=Jn(AS,d);if(!p.success){let v=p.error instanceof Error?p.error.message:String(p.error);throw new de(be.InvalidParams,`Invalid sampling request: ${v}`)}let{params:m}=p.data,h=await Promise.resolve(r(d,f));if(m.task){let v=Jn(Ya,h);if(!v.success){let b=v.error instanceof Error?v.error.message:String(v.error);throw new de(be.InvalidParams,`Invalid task creation result: ${b}`)}return v.data}let _=Jn(OS,h);if(!_.success){let v=_.error instanceof Error?_.error.message:String(_.error);throw new de(be.InvalidParams,`Invalid sampling result: ${v}`)}return _.data};return super.setRequestHandler(e,l)}return super.setRequestHandler(e,r)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:fS,capabilities:this._capabilities,clientInfo:this._clientInfo}},gS,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!Pj.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,o,i,s;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){var r,n;DU((n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests,e,"Server")}assertTaskHandlerCapability(e){var r;this._capabilities&&LU((r=this._capabilities.tasks)===null||r===void 0?void 0:r.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Xa,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},RS,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Xa,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},TS,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},xS,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},yS,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},vS,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},wS,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Xa,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Xa,r)}async callTool(e,r=$l,n){if(this.isToolTaskRequired(e.name))throw new de(be.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},r,n),i=this.getToolOutputValidator(e.name);if(i){if(!o.structuredContent&&!o.isError)throw new de(be.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let s=i(o.structuredContent);if(!s.valid)throw new de(be.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof de?s:new de(be.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return o}isToolTask(e){var r,n,o,i;return!((i=(o=(n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests)===null||o===void 0?void 0:o.tools)===null||i===void 0)&&i.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){var r;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let n of e){if(n.outputSchema){let i=this._jsonSchemaValidator.getValidator(n.outputSchema);this._cachedToolOutputValidators.set(n.name,i)}let o=(r=n.execution)===null||r===void 0?void 0:r.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(n.name),o==="required"&&this._cachedRequiredTaskTools.add(n.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},ES,r);return this.cacheToolMetadata(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Nb=class extends fl{name;description;toolSpec;mcpClient;constructor(e){super(),this.name=e.name,this.description=e.description,this.toolSpec={name:e.name,description:e.description,inputSchema:e.inputSchema},this.mcpClient=e.client}async*stream(e){let{toolUseId:r,input:n}=e.toolUse;try{let o=await this.mcpClient.callTool(this,n);if(!this._isMcpToolResult(o))throw new Error("Invalid tool result from MCP Client: missing content array");let i=o.content.map(s=>this._isMcpTextContent(s)?new mt(s.text):new Ha({json:s}));return i.length===0&&i.push(new mt("Tool execution completed successfully with no output.")),new Ht({toolUseId:r,status:o.isError?"error":"success",content:i})}catch(o){return lS(o,r)}}_isMcpToolResult(e){return typeof e!="object"||e===null?!1:Array.isArray(e.content)}_isMcpTextContent(e){if(typeof e!="object"||e===null)return!1;let r=e;return r.type==="text"&&typeof r.text=="string"}};var xf=class{_clientName;_clientVersion;_transport;_connected;_client;constructor(e){this._clientName=e.applicationName||"strands-agents-ts-sdk",this._clientVersion=e.applicationVersion||"0.0.1",this._transport=e.transport,this._connected=!1,this._client=new Rb({name:this._clientName,version:this._clientVersion})}get client(){return this._client}async connect(e=!1){this._connected&&!e||(this._connected&&e&&(await this._client.close(),this._connected=!1),await this._client.connect(this._transport),this._connected=!0)}async disconnect(){await this._client.close(),await this._transport.close(),this._connected=!1}async listTools(){return await this.connect(),(await this._client.listTools()).tools.map(r=>new Nb({name:r.name,description:r.description??"",inputSchema:r.inputSchema,client:this}))}async callTool(e,r){if(await this.connect(),r==null)return await this.callTool(e,{});if(typeof r!="object"||Array.isArray(r))throw new Error(`MCP Protocol Error: Tool arguments must be a JSON Object (named parameters). Received: ${Array.isArray(r)?"Array":typeof r}`);return await this._client.callTool({name:e.name,arguments:r})}};var UU=({model:t})=>{let e=new ms({region:"us-east-1",modelId:t,maxTokens:4096,temperature:.7});return new bf({model:e})};var yre=async({message:t="\u3053\u3093\u306B\u3061\u306F\uFF01",model:e="us.amazon.nova-micro-v1:0"},r)=>{let n=UU({model:e});for await(let o of n.stream(t))o.type==="modelContentBlockDeltaEvent"&&o.delta.type==="textDelta"&&r.write(o.delta.text)},vre=awslambda.streamifyResponse(async(t,e)=>{wm.debug("event",{event:t});let{message:r,model:n}=t.body?JSON.parse(t.body):{};await yre({message:r,model:n},e),e.end()}),EBe=vre;export{EBe as default,yre as handle,vre as handler}; +/*! Bundled license information: + +@aws-lambda-powertools/logger/lib/esm/logBuffer.js: + (* v8 ignore next -- @preserve *) + +@langchain/core/dist/utils/fast-json-patch/src/helpers.js: + (*! + * https://github.com/Starcounter-Jack/JSON-Patch + * (c) 2017-2022 Joachim Wester + * MIT licensed + *) + +@langchain/core/dist/utils/sax-js/sax.js: + (*! http://mths.be/fromcodepoint v0.1.0 by @mathias *) +*/ diff --git a/agents/agent-strands/cdk.out/asset.716071e6193d8d65285fec67182520a245dc4d4cf966b8c5765ff14412b10546/index.mjs b/agents/agent-strands/cdk.out/asset.716071e6193d8d65285fec67182520a245dc4d4cf966b8c5765ff14412b10546/index.mjs new file mode 100644 index 00000000..bad06e4a --- /dev/null +++ b/agents/agent-strands/cdk.out/asset.716071e6193d8d65285fec67182520a245dc4d4cf966b8c5765ff14412b10546/index.mjs @@ -0,0 +1,238 @@ +import { createRequire } from 'module';const require = createRequire(import.meta.url); +var FU=Object.create;var zb=Object.defineProperty;var BU=Object.getOwnPropertyDescriptor;var ZU=Object.getOwnPropertyNames;var qU=Object.getPrototypeOf,VU=Object.prototype.hasOwnProperty;var P=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),gi=(t,e)=>{for(var r in e)zb(t,r,{get:e[r],enumerable:!0})},GU=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ZU(e))!VU.call(t,o)&&o!==r&&zb(t,o,{get:()=>e[o],enumerable:!(n=BU(e,o))||n.enumerable});return t};var mn=(t,e,r)=>(r=t!=null?FU(qU(t)):{},GU(e||!t||!t.__esModule?zb(r,"default",{value:t,enumerable:!0}):r,t));var Xb=P((Kl,lc)=>{var JU=200,GT="__lodash_hash_undefined__",XU=800,YU=16,KT=9007199254740991,HT="[object Arguments]",QU="[object Array]",e4="[object AsyncFunction]",t4="[object Boolean]",r4="[object Date]",n4="[object Error]",WT="[object Function]",o4="[object GeneratorFunction]",i4="[object Map]",s4="[object Number]",a4="[object Null]",JT="[object Object]",c4="[object Proxy]",u4="[object RegExp]",l4="[object Set]",d4="[object String]",p4="[object Undefined]",f4="[object WeakMap]",m4="[object ArrayBuffer]",h4="[object DataView]",g4="[object Float32Array]",_4="[object Float64Array]",y4="[object Int8Array]",v4="[object Int16Array]",b4="[object Int32Array]",w4="[object Uint8Array]",x4="[object Uint8ClampedArray]",$4="[object Uint16Array]",I4="[object Uint32Array]",S4=/[\\^$.*+?()[\]{}|]/g,k4=/^\[object .+?Constructor\]$/,T4=/^(?:0|[1-9]\d*)$/,st={};st[g4]=st[_4]=st[y4]=st[v4]=st[b4]=st[w4]=st[x4]=st[$4]=st[I4]=!0;st[HT]=st[QU]=st[m4]=st[t4]=st[h4]=st[r4]=st[n4]=st[WT]=st[i4]=st[s4]=st[JT]=st[u4]=st[l4]=st[d4]=st[f4]=!1;var XT=typeof global=="object"&&global&&global.Object===Object&&global,E4=typeof self=="object"&&self&&self.Object===Object&&self,Jl=XT||E4||Function("return this")(),YT=typeof Kl=="object"&&Kl&&!Kl.nodeType&&Kl,Hl=YT&&typeof lc=="object"&&lc&&!lc.nodeType&&lc,QT=Hl&&Hl.exports===YT,Fb=QT&&XT.process,jT=(function(){try{var t=Hl&&Hl.require&&Hl.require("util").types;return t||Fb&&Fb.binding&&Fb.binding("util")}catch{}})(),DT=jT&&jT.isTypedArray;function A4(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function O4(t,e){for(var r=-1,n=Array(t);++r-1}function Y4(t,e){var r=this.__data__,n=pm(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}jo.prototype.clear=H4;jo.prototype.delete=W4;jo.prototype.get=J4;jo.prototype.has=X4;jo.prototype.set=Y4;function dc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(i=t.length>3&&typeof i=="function"?(o--,i):void 0,s&&T2(r[0],r[1],s)&&(i=o<3?void 0:i,o=1),e=Object(e);++n-1&&t%1==0&&t0){if(++e>=XU)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function z2(t){if(t!=null){try{return dm.call(t)}catch{}try{return t+""}catch{}}return""}function hm(t,e){return t===e||t!==t&&e!==e}var Vb=VT((function(){return arguments})())?VT:function(t){return Xl(t)&&Mo.call(t,"callee")&&!D4.call(t,"callee")},Gb=Array.isArray;function Wb(t){return t!=null&&aE(t.length)&&!Jb(t)}function M2(t){return Xl(t)&&Wb(t)}var sE=U4||F2;function Jb(t){if(!Ps(t))return!1;var e=fm(t);return e==WT||e==o4||e==e4||e==c4}function aE(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=KT}function Ps(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Xl(t){return t!=null&&typeof t=="object"}function j2(t){if(!Xl(t)||fm(t)!=JT)return!1;var e=tE(t);if(e===null)return!0;var r=Mo.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&dm.call(r)==M4}var cE=DT?P4(DT):f2;function D2(t){return x2(t,uE(t))}function uE(t){return Wb(t)?u2(t,!0):m2(t)}var L2=$2(function(t,e,r){nE(t,e,r)});function U2(t){return function(){return t}}function lE(t){return t}function F2(){return!1}lc.exports=L2});var xA=P((_de,wA)=>{"use strict";wA.exports=function(t,e){if(typeof t!="string")throw new TypeError("Expected a string");return e=typeof e>"u"?"_":e,t.replace(/([a-z\d])([A-Z])/g,"$1"+e+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+e+"$2").toLowerCase()}});var AA=P((yde,Zw)=>{"use strict";var dB=/[\p{Lu}]/u,pB=/[\p{Ll}]/u,$A=/^[\p{Lu}](?![\p{Lu}])/gu,kA=/([\p{Alpha}\p{N}_]|$)/u,TA=/[_.\- ]+/,fB=new RegExp("^"+TA.source),IA=new RegExp(TA.source+kA.source,"gu"),SA=new RegExp("\\d+"+kA.source,"gu"),mB=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let s=0;s($A.lastIndex=0,t.replace($A,r=>e(r))),gB=(t,e)=>(IA.lastIndex=0,SA.lastIndex=0,t.replace(IA,(r,n)=>e(n)).replace(SA,r=>e(r))),EA=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(t)?t=t.map(i=>i.trim()).filter(i=>i.length).join("-"):t=t.trim(),t.length===0)return"";let r=e.locale===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(e.locale),n=e.locale===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(e.locale);return t.length===1?e.pascalCase?n(t):r(t):(t!==r(t)&&(t=mB(t,r,n)),t=t.replace(fB,""),e.preserveConsecutiveUppercase?t=hB(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),gB(t,n))};Zw.exports=EA;Zw.exports.default=EA});var cP=P((ime,Ix)=>{"use strict";var v6=Object.prototype.hasOwnProperty,hr="~";function Cd(){}Object.create&&(Cd.prototype=Object.create(null),new Cd().__proto__||(hr=!1));function b6(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function aP(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new b6(r,n||t,o),s=hr?hr+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],i]:t._events[s].push(i):(t._events[s]=i,t._eventsCount++),t}function wh(t,e){--t._eventsCount===0?t._events=new Cd:delete t._events[e]}function tr(){this._events=new Cd,this._eventsCount=0}tr.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)v6.call(r,n)&&e.push(hr?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};tr.prototype.listeners=function(e){var r=hr?hr+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,s=new Array(i);o{"use strict";uP.exports=(t,e)=>(e=e||(()=>{}),t.then(r=>new Promise(n=>{n(e())}).then(()=>r),r=>new Promise(n=>{n(e())}).then(()=>{throw r})))});var pP=P((ame,$h)=>{"use strict";var w6=lP(),xh=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},dP=(t,e,r)=>new Promise((n,o)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){n(t);return}let i=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(c){o(c)}return}let s=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,a=r instanceof Error?r:new xh(s);typeof t.cancel=="function"&&t.cancel(),o(a)},e);w6(t.then(n,o),()=>{clearTimeout(i)})});$h.exports=dP;$h.exports.default=dP;$h.exports.TimeoutError=xh});var fP=P(Sx=>{"use strict";Object.defineProperty(Sx,"__esModule",{value:!0});function x6(t,e,r){let n=0,o=t.length;for(;o>0;){let i=o/2|0,s=n+i;r(t[s],e)<=0?(n=++s,o-=i+1):o=i}return n}Sx.default=x6});var mP=P(Tx=>{"use strict";Object.defineProperty(Tx,"__esModule",{value:!0});var $6=fP(),kx=class{constructor(){this._queue=[]}enqueue(e,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let o=$6.default(this._queue,n,(i,s)=>s.priority-i.priority);this._queue.splice(o,0,n)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this._queue.length}};Tx.default=kx});var Sh=P(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:!0});var I6=cP(),hP=pP(),S6=mP(),Ih=()=>{},k6=new hP.TimeoutError,Ex=class extends I6{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Ih,this._resolveIdle=Ih,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:S6.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(i=(o=e.interval)===null||o===void 0?void 0:o.toString())!==null&&i!==void 0?i:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||e.interval===0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=e.throwOnTimeout===!0,this._isPaused=e.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),e&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,r={}){return new Promise((n,o)=>{let i=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&r.timeout===void 0?e():hP.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(k6)});n(await s)}catch(s){o(s)}this._next()};this._queue.enqueue(i,r),this._tryToStartAnother(),this.emit("add")})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(e=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}};Ax.default=Ex});var Nd=P((mme,gP)=>{"use strict";var E6="2.0.0",A6=Number.MAX_SAFE_INTEGER||9007199254740991,O6=16,P6=250,C6=["major","premajor","minor","preminor","patch","prepatch","prerelease"];gP.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:O6,MAX_SAFE_BUILD_LENGTH:P6,MAX_SAFE_INTEGER:A6,RELEASE_TYPES:C6,SEMVER_SPEC_VERSION:E6,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var zd=P((hme,_P)=>{"use strict";var R6=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};_P.exports=R6});var lu=P((fo,yP)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Cx,MAX_SAFE_BUILD_LENGTH:N6,MAX_LENGTH:z6}=Nd(),M6=zd();fo=yP.exports={};var j6=fo.re=[],D6=fo.safeRe=[],X=fo.src=[],L6=fo.safeSrc=[],Y=fo.t={},U6=0,Rx="[a-zA-Z0-9-]",F6=[["\\s",1],["\\d",z6],[Rx,N6]],B6=t=>{for(let[e,r]of F6)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Ie=(t,e,r)=>{let n=B6(e),o=U6++;M6(t,o,e),Y[t]=o,X[o]=e,L6[o]=n,j6[o]=new RegExp(e,r?"g":void 0),D6[o]=new RegExp(n,r?"g":void 0)};Ie("NUMERICIDENTIFIER","0|[1-9]\\d*");Ie("NUMERICIDENTIFIERLOOSE","\\d+");Ie("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Rx}*`);Ie("MAINVERSION",`(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})`);Ie("MAINVERSIONLOOSE",`(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})`);Ie("PRERELEASEIDENTIFIER",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIER]})`);Ie("PRERELEASEIDENTIFIERLOOSE",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIERLOOSE]})`);Ie("PRERELEASE",`(?:-(${X[Y.PRERELEASEIDENTIFIER]}(?:\\.${X[Y.PRERELEASEIDENTIFIER]})*))`);Ie("PRERELEASELOOSE",`(?:-?(${X[Y.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${X[Y.PRERELEASEIDENTIFIERLOOSE]})*))`);Ie("BUILDIDENTIFIER",`${Rx}+`);Ie("BUILD",`(?:\\+(${X[Y.BUILDIDENTIFIER]}(?:\\.${X[Y.BUILDIDENTIFIER]})*))`);Ie("FULLPLAIN",`v?${X[Y.MAINVERSION]}${X[Y.PRERELEASE]}?${X[Y.BUILD]}?`);Ie("FULL",`^${X[Y.FULLPLAIN]}$`);Ie("LOOSEPLAIN",`[v=\\s]*${X[Y.MAINVERSIONLOOSE]}${X[Y.PRERELEASELOOSE]}?${X[Y.BUILD]}?`);Ie("LOOSE",`^${X[Y.LOOSEPLAIN]}$`);Ie("GTLT","((?:<|>)?=?)");Ie("XRANGEIDENTIFIERLOOSE",`${X[Y.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Ie("XRANGEIDENTIFIER",`${X[Y.NUMERICIDENTIFIER]}|x|X|\\*`);Ie("XRANGEPLAIN",`[v=\\s]*(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:${X[Y.PRERELEASE]})?${X[Y.BUILD]}?)?)?`);Ie("XRANGEPLAINLOOSE",`[v=\\s]*(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:${X[Y.PRERELEASELOOSE]})?${X[Y.BUILD]}?)?)?`);Ie("XRANGE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAIN]}$`);Ie("XRANGELOOSE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAINLOOSE]}$`);Ie("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Cx}})(?:\\.(\\d{1,${Cx}}))?(?:\\.(\\d{1,${Cx}}))?`);Ie("COERCE",`${X[Y.COERCEPLAIN]}(?:$|[^\\d])`);Ie("COERCEFULL",X[Y.COERCEPLAIN]+`(?:${X[Y.PRERELEASE]})?(?:${X[Y.BUILD]})?(?:$|[^\\d])`);Ie("COERCERTL",X[Y.COERCE],!0);Ie("COERCERTLFULL",X[Y.COERCEFULL],!0);Ie("LONETILDE","(?:~>?)");Ie("TILDETRIM",`(\\s*)${X[Y.LONETILDE]}\\s+`,!0);fo.tildeTrimReplace="$1~";Ie("TILDE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAIN]}$`);Ie("TILDELOOSE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAINLOOSE]}$`);Ie("LONECARET","(?:\\^)");Ie("CARETTRIM",`(\\s*)${X[Y.LONECARET]}\\s+`,!0);fo.caretTrimReplace="$1^";Ie("CARET",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAIN]}$`);Ie("CARETLOOSE",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAINLOOSE]}$`);Ie("COMPARATORLOOSE",`^${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]})$|^$`);Ie("COMPARATOR",`^${X[Y.GTLT]}\\s*(${X[Y.FULLPLAIN]})$|^$`);Ie("COMPARATORTRIM",`(\\s*)${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]}|${X[Y.XRANGEPLAIN]})`,!0);fo.comparatorTrimReplace="$1$2$3";Ie("HYPHENRANGE",`^\\s*(${X[Y.XRANGEPLAIN]})\\s+-\\s+(${X[Y.XRANGEPLAIN]})\\s*$`);Ie("HYPHENRANGELOOSE",`^\\s*(${X[Y.XRANGEPLAINLOOSE]})\\s+-\\s+(${X[Y.XRANGEPLAINLOOSE]})\\s*$`);Ie("STAR","(<|>)?=?\\s*\\*");Ie("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Ie("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Th=P((gme,vP)=>{"use strict";var Z6=Object.freeze({loose:!0}),q6=Object.freeze({}),V6=t=>t?typeof t!="object"?Z6:t:q6;vP.exports=V6});var Nx=P((_me,xP)=>{"use strict";var bP=/^[0-9]+$/,wP=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:twP(e,t);xP.exports={compareIdentifiers:wP,rcompareIdentifiers:G6}});var rr=P((yme,IP)=>{"use strict";var Eh=zd(),{MAX_LENGTH:$P,MAX_SAFE_INTEGER:Ah}=Nd(),{safeRe:Oh,t:Ph}=lu(),K6=Th(),{compareIdentifiers:zx}=Nx(),Mx=class t{constructor(e,r){if(r=K6(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>$P)throw new TypeError(`version is longer than ${$P} characters`);Eh("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Oh[Ph.LOOSE]:Oh[Ph.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Ah||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ah||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ah||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let i=+o;if(i>=0&&ie.major?1:this.minore.minor?1:this.patche.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(Eh("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return zx(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(Eh("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return zx(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?Oh[Ph.PRERELEASELOOSE]:Oh[Ph.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let i=[r,o];n===!1&&(i=[r]),zx(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};IP.exports=Mx});var pa=P((vme,kP)=>{"use strict";var SP=rr(),H6=(t,e,r=!1)=>{if(t instanceof SP)return t;try{return new SP(t,e)}catch(n){if(!r)return null;throw n}};kP.exports=H6});var EP=P((bme,TP)=>{"use strict";var W6=pa(),J6=(t,e)=>{let r=W6(t,e);return r?r.version:null};TP.exports=J6});var OP=P((wme,AP)=>{"use strict";var X6=pa(),Y6=(t,e)=>{let r=X6(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};AP.exports=Y6});var RP=P((xme,CP)=>{"use strict";var PP=rr(),Q6=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new PP(t instanceof PP?t.version:t,r).inc(e,n,o).version}catch{return null}};CP.exports=Q6});var MP=P(($me,zP)=>{"use strict";var NP=pa(),eZ=(t,e)=>{let r=NP(t,null,!0),n=NP(e,null,!0),o=r.compare(n);if(o===0)return null;let i=o>0,s=i?r:n,a=i?n:r,c=!!s.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0)return a.minor&&!a.patch?"minor":"patch"}let l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};zP.exports=eZ});var DP=P((Ime,jP)=>{"use strict";var tZ=rr(),rZ=(t,e)=>new tZ(t,e).major;jP.exports=rZ});var UP=P((Sme,LP)=>{"use strict";var nZ=rr(),oZ=(t,e)=>new nZ(t,e).minor;LP.exports=oZ});var BP=P((kme,FP)=>{"use strict";var iZ=rr(),sZ=(t,e)=>new iZ(t,e).patch;FP.exports=sZ});var qP=P((Tme,ZP)=>{"use strict";var aZ=pa(),cZ=(t,e)=>{let r=aZ(t,e);return r&&r.prerelease.length?r.prerelease:null};ZP.exports=cZ});var gn=P((Eme,GP)=>{"use strict";var VP=rr(),uZ=(t,e,r)=>new VP(t,r).compare(new VP(e,r));GP.exports=uZ});var HP=P((Ame,KP)=>{"use strict";var lZ=gn(),dZ=(t,e,r)=>lZ(e,t,r);KP.exports=dZ});var JP=P((Ome,WP)=>{"use strict";var pZ=gn(),fZ=(t,e)=>pZ(t,e,!0);WP.exports=fZ});var Ch=P((Pme,YP)=>{"use strict";var XP=rr(),mZ=(t,e,r)=>{let n=new XP(t,r),o=new XP(e,r);return n.compare(o)||n.compareBuild(o)};YP.exports=mZ});var eC=P((Cme,QP)=>{"use strict";var hZ=Ch(),gZ=(t,e)=>t.sort((r,n)=>hZ(r,n,e));QP.exports=gZ});var rC=P((Rme,tC)=>{"use strict";var _Z=Ch(),yZ=(t,e)=>t.sort((r,n)=>_Z(n,r,e));tC.exports=yZ});var Md=P((Nme,nC)=>{"use strict";var vZ=gn(),bZ=(t,e,r)=>vZ(t,e,r)>0;nC.exports=bZ});var Rh=P((zme,oC)=>{"use strict";var wZ=gn(),xZ=(t,e,r)=>wZ(t,e,r)<0;oC.exports=xZ});var jx=P((Mme,iC)=>{"use strict";var $Z=gn(),IZ=(t,e,r)=>$Z(t,e,r)===0;iC.exports=IZ});var Dx=P((jme,sC)=>{"use strict";var SZ=gn(),kZ=(t,e,r)=>SZ(t,e,r)!==0;sC.exports=kZ});var Nh=P((Dme,aC)=>{"use strict";var TZ=gn(),EZ=(t,e,r)=>TZ(t,e,r)>=0;aC.exports=EZ});var zh=P((Lme,cC)=>{"use strict";var AZ=gn(),OZ=(t,e,r)=>AZ(t,e,r)<=0;cC.exports=OZ});var Lx=P((Ume,uC)=>{"use strict";var PZ=jx(),CZ=Dx(),RZ=Md(),NZ=Nh(),zZ=Rh(),MZ=zh(),jZ=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return PZ(t,r,n);case"!=":return CZ(t,r,n);case">":return RZ(t,r,n);case">=":return NZ(t,r,n);case"<":return zZ(t,r,n);case"<=":return MZ(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};uC.exports=jZ});var dC=P((Fme,lC)=>{"use strict";var DZ=rr(),LZ=pa(),{safeRe:Mh,t:jh}=lu(),UZ=(t,e)=>{if(t instanceof DZ)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Mh[jh.COERCEFULL]:Mh[jh.COERCE]);else{let c=e.includePrerelease?Mh[jh.COERCERTLFULL]:Mh[jh.COERCERTL],u;for(;(u=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",i=r[4]||"0",s=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return LZ(`${n}.${o}.${i}${s}${a}`,e)};lC.exports=UZ});var fC=P((Bme,pC)=>{"use strict";var Ux=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};pC.exports=Ux});var _n=P((Zme,_C)=>{"use strict";var FZ=/\s+/g,Fx=class t{constructor(e,r){if(r=ZZ(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Bx)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(FZ," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(o=>!hC(o[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&JZ(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&HZ)|(this.options.loose&&WZ))+":"+e,o=mC.get(n);if(o)return o;let i=this.options.loose,s=i?gr[nr.HYPHENRANGELOOSE]:gr[nr.HYPHENRANGE];e=e.replace(s,s9(this.options.includePrerelease)),at("hyphen replace",e),e=e.replace(gr[nr.COMPARATORTRIM],VZ),at("comparator trim",e),e=e.replace(gr[nr.TILDETRIM],GZ),at("tilde trim",e),e=e.replace(gr[nr.CARETTRIM],KZ),at("caret trim",e);let a=e.split(" ").map(d=>XZ(d,this.options)).join(" ").split(/\s+/).map(d=>i9(d,this.options));i&&(a=a.filter(d=>(at("loose invalid filter",d,this.options),!!d.match(gr[nr.COMPARATORLOOSE])))),at("range list",a);let c=new Map,u=a.map(d=>new Bx(d,this.options));for(let d of u){if(hC(d))return[d];c.set(d.value,d)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return mC.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>gC(n,r)&&e.set.some(o=>gC(o,r)&&n.every(i=>o.every(s=>i.intersects(s,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new qZ(e,this.options)}catch{return!1}for(let r=0;rt.value==="<0.0.0-0",JZ=t=>t.value==="",gC=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(i=>o.intersects(i,e)),o=n.pop();return r},XZ=(t,e)=>(t=t.replace(gr[nr.BUILD],""),at("comp",t,e),t=e9(t,e),at("caret",t),t=YZ(t,e),at("tildes",t),t=r9(t,e),at("xrange",t),t=o9(t,e),at("stars",t),t),_r=t=>!t||t.toLowerCase()==="x"||t==="*",YZ=(t,e)=>t.trim().split(/\s+/).map(r=>QZ(r,e)).join(" "),QZ=(t,e)=>{let r=e.loose?gr[nr.TILDELOOSE]:gr[nr.TILDE];return t.replace(r,(n,o,i,s,a)=>{at("tilde",t,n,o,i,s,a);let c;return _r(o)?c="":_r(i)?c=`>=${o}.0.0 <${+o+1}.0.0-0`:_r(s)?c=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:a?(at("replaceTilde pr",a),c=`>=${o}.${i}.${s}-${a} <${o}.${+i+1}.0-0`):c=`>=${o}.${i}.${s} <${o}.${+i+1}.0-0`,at("tilde return",c),c})},e9=(t,e)=>t.trim().split(/\s+/).map(r=>t9(r,e)).join(" "),t9=(t,e)=>{at("caret",t,e);let r=e.loose?gr[nr.CARETLOOSE]:gr[nr.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,s,a,c)=>{at("caret",t,o,i,s,a,c);let u;return _r(i)?u="":_r(s)?u=`>=${i}.0.0${n} <${+i+1}.0.0-0`:_r(a)?i==="0"?u=`>=${i}.${s}.0${n} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.0${n} <${+i+1}.0.0-0`:c?(at("replaceCaret pr",c),i==="0"?s==="0"?u=`>=${i}.${s}.${a}-${c} <${i}.${s}.${+a+1}-0`:u=`>=${i}.${s}.${a}-${c} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.${a}-${c} <${+i+1}.0.0-0`):(at("no pr"),i==="0"?s==="0"?u=`>=${i}.${s}.${a}${n} <${i}.${s}.${+a+1}-0`:u=`>=${i}.${s}.${a}${n} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.${a} <${+i+1}.0.0-0`),at("caret return",u),u})},r9=(t,e)=>(at("replaceXRanges",t,e),t.split(/\s+/).map(r=>n9(r,e)).join(" ")),n9=(t,e)=>{t=t.trim();let r=e.loose?gr[nr.XRANGELOOSE]:gr[nr.XRANGE];return t.replace(r,(n,o,i,s,a,c)=>{at("xRange",t,n,o,i,s,a,c);let u=_r(i),l=u||_r(s),d=l||_r(a),f=d;return o==="="&&f&&(o=""),c=e.includePrerelease?"-0":"",u?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&f?(l&&(s=0),a=0,o===">"?(o=">=",l?(i=+i+1,s=0,a=0):(s=+s+1,a=0)):o==="<="&&(o="<",l?i=+i+1:s=+s+1),o==="<"&&(c="-0"),n=`${o+i}.${s}.${a}${c}`):l?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${s}.0${c} <${i}.${+s+1}.0-0`),at("xRange return",n),n})},o9=(t,e)=>(at("replaceStars",t,e),t.trim().replace(gr[nr.STAR],"")),i9=(t,e)=>(at("replaceGTE0",t,e),t.trim().replace(gr[e.includePrerelease?nr.GTE0PRE:nr.GTE0],"")),s9=t=>(e,r,n,o,i,s,a,c,u,l,d,f)=>(_r(n)?r="":_r(o)?r=`>=${n}.0.0${t?"-0":""}`:_r(i)?r=`>=${n}.${o}.0${t?"-0":""}`:s?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,_r(u)?c="":_r(l)?c=`<${+u+1}.0.0-0`:_r(d)?c=`<${u}.${+l+1}.0-0`:f?c=`<=${u}.${l}.${d}-${f}`:t?c=`<${u}.${l}.${+d+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),a9=(t,e,r)=>{for(let n=0;n0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var jd=P((qme,$C)=>{"use strict";var Dd=Symbol("SemVer ANY"),Vx=class t{static get ANY(){return Dd}constructor(e,r){if(r=yC(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),qx("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Dd?this.value="":this.value=this.operator+this.semver.version,qx("comp",this)}parse(e){let r=this.options.loose?vC[bC.COMPARATORLOOSE]:vC[bC.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new wC(n[2],this.options.loose):this.semver=Dd}toString(){return this.value}test(e){if(qx("Comparator.test",e,this.options.loose),this.semver===Dd||e===Dd)return!0;if(typeof e=="string")try{e=new wC(e,this.options)}catch{return!1}return Zx(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new xC(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new xC(this.value,r).test(e.semver):(r=yC(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Zx(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Zx(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};$C.exports=Vx;var yC=Th(),{safeRe:vC,t:bC}=lu(),Zx=Lx(),qx=zd(),wC=rr(),xC=_n()});var Ld=P((Vme,IC)=>{"use strict";var c9=_n(),u9=(t,e,r)=>{try{e=new c9(e,r)}catch{return!1}return e.test(t)};IC.exports=u9});var kC=P((Gme,SC)=>{"use strict";var l9=_n(),d9=(t,e)=>new l9(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));SC.exports=d9});var EC=P((Kme,TC)=>{"use strict";var p9=rr(),f9=_n(),m9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new f9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===-1)&&(n=s,o=new p9(n,r))}),n};TC.exports=m9});var OC=P((Hme,AC)=>{"use strict";var h9=rr(),g9=_n(),_9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new g9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===1)&&(n=s,o=new h9(n,r))}),n};AC.exports=_9});var RC=P((Wme,CC)=>{"use strict";var Gx=rr(),y9=_n(),PC=Md(),v9=(t,e)=>{t=new y9(t,e);let r=new Gx("0.0.0");if(t.test(r)||(r=new Gx("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n{let a=new Gx(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||PC(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),i&&(!r||PC(r,i))&&(r=i)}return r&&t.test(r)?r:null};CC.exports=v9});var zC=P((Jme,NC)=>{"use strict";var b9=_n(),w9=(t,e)=>{try{return new b9(t,e).range||"*"}catch{return null}};NC.exports=w9});var Dh=P((Xme,LC)=>{"use strict";var x9=rr(),DC=jd(),{ANY:$9}=DC,I9=_n(),S9=Ld(),MC=Md(),jC=Rh(),k9=zh(),T9=Nh(),E9=(t,e,r,n)=>{t=new x9(t,n),e=new I9(e,n);let o,i,s,a,c;switch(r){case">":o=MC,i=k9,s=jC,a=">",c=">=";break;case"<":o=jC,i=T9,s=MC,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(S9(t,e,n))return!1;for(let u=0;u{p.semver===$9&&(p=new DC(">=0.0.0")),d=d||p,f=f||p,o(p.semver,d.semver,n)?d=p:s(p.semver,f.semver,n)&&(f=p)}),d.operator===a||d.operator===c||(!f.operator||f.operator===a)&&i(t,f.semver))return!1;if(f.operator===c&&s(t,f.semver))return!1}return!0};LC.exports=E9});var FC=P((Yme,UC)=>{"use strict";var A9=Dh(),O9=(t,e,r)=>A9(t,e,">",r);UC.exports=O9});var ZC=P((Qme,BC)=>{"use strict";var P9=Dh(),C9=(t,e,r)=>P9(t,e,"<",r);BC.exports=C9});var GC=P((ehe,VC)=>{"use strict";var qC=_n(),R9=(t,e,r)=>(t=new qC(t,r),e=new qC(e,r),t.intersects(e,r));VC.exports=R9});var HC=P((the,KC)=>{"use strict";var N9=Ld(),z9=gn();KC.exports=(t,e,r)=>{let n=[],o=null,i=null,s=t.sort((l,d)=>z9(l,d,r));for(let l of s)N9(l,e,r)?(i=l,o||(o=l)):(i&&n.push([o,i]),i=null,o=null);o&&n.push([o,null]);let a=[];for(let[l,d]of n)l===d?a.push(l):!d&&l===s[0]?a.push("*"):d?l===s[0]?a.push(`<=${d}`):a.push(`${l} - ${d}`):a.push(`>=${l}`);let c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length{"use strict";var WC=_n(),Hx=jd(),{ANY:Kx}=Hx,Ud=Ld(),Wx=gn(),M9=(t,e,r={})=>{if(t===e)return!0;t=new WC(t,r),e=new WC(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let s=D9(o,i,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},j9=[new Hx(">=0.0.0-0")],JC=[new Hx(">=0.0.0")],D9=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Kx){if(e.length===1&&e[0].semver===Kx)return!0;r.includePrerelease?t=j9:t=JC}if(e.length===1&&e[0].semver===Kx){if(r.includePrerelease)return!0;e=JC}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=XC(o,p,r):p.operator==="<"||p.operator==="<="?i=YC(i,p,r):n.add(p.semver);if(n.size>1)return null;let s;if(o&&i){if(s=Wx(o.semver,i.semver,r),s>0)return null;if(s===0&&(o.operator!==">="||i.operator!=="<="))return null}for(let p of n){if(o&&!Ud(p,String(o),r)||i&&!Ud(p,String(i),r))return null;for(let m of e)if(!Ud(p,String(m),r))return!1;return!0}let a,c,u,l,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of e){if(l=l||p.operator===">"||p.operator===">=",u=u||p.operator==="<"||p.operator==="<=",o){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator===">"||p.operator===">="){if(a=XC(o,p,r),a===p&&a!==o)return!1}else if(o.operator===">="&&!Ud(o.semver,String(p),r))return!1}if(i){if(d&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===d.major&&p.semver.minor===d.minor&&p.semver.patch===d.patch&&(d=!1),p.operator==="<"||p.operator==="<="){if(c=YC(i,p,r),c===p&&c!==i)return!1}else if(i.operator==="<="&&!Ud(i.semver,String(p),r))return!1}if(!p.operator&&(i||o)&&s!==0)return!1}return!(o&&u&&!i&&s!==0||i&&l&&!o&&s!==0||f||d)},XC=(t,e,r)=>{if(!t)return e;let n=Wx(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},YC=(t,e,r)=>{if(!t)return e;let n=Wx(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};QC.exports=M9});var oR=P((nhe,nR)=>{"use strict";var Jx=lu(),tR=Nd(),L9=rr(),rR=Nx(),U9=pa(),F9=EP(),B9=OP(),Z9=RP(),q9=MP(),V9=DP(),G9=UP(),K9=BP(),H9=qP(),W9=gn(),J9=HP(),X9=JP(),Y9=Ch(),Q9=eC(),eq=rC(),tq=Md(),rq=Rh(),nq=jx(),oq=Dx(),iq=Nh(),sq=zh(),aq=Lx(),cq=dC(),uq=jd(),lq=_n(),dq=Ld(),pq=kC(),fq=EC(),mq=OC(),hq=RC(),gq=zC(),_q=Dh(),yq=FC(),vq=ZC(),bq=GC(),wq=HC(),xq=eR();nR.exports={parse:U9,valid:F9,clean:B9,inc:Z9,diff:q9,major:V9,minor:G9,patch:K9,prerelease:H9,compare:W9,rcompare:J9,compareLoose:X9,compareBuild:Y9,sort:Q9,rsort:eq,gt:tq,lt:rq,eq:nq,neq:oq,gte:iq,lte:sq,cmp:aq,coerce:cq,Comparator:uq,Range:lq,satisfies:dq,toComparators:pq,maxSatisfying:fq,minSatisfying:mq,minVersion:hq,validRange:gq,outside:_q,gtr:yq,ltr:vq,intersects:bq,simplifyRange:wq,subset:xq,SemVer:L9,re:Jx.re,src:Jx.src,tokens:Jx.t,SEMVER_SPEC_VERSION:tR.SEMVER_SPEC_VERSION,RELEASE_TYPES:tR.RELEASE_TYPES,compareIdentifiers:rR.compareIdentifiers,rcompareIdentifiers:rR.rcompareIdentifiers}});var IR=P((Ghe,$R)=>{"use strict";var wR=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,xR=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function qq(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",e.color.ansi256=wR(),e.color.ansi16m=xR(),e.bgColor.ansi256=wR(10),e.bgColor.ansi16m=xR(10),Object.defineProperties(e,{rgbToAnsi256:{value:(r,n,o)=>r===n&&n===o?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:o}=n.groups;o.length===3&&(o=o.split("").map(s=>s+s).join(""));let i=Number.parseInt(o,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:r=>e.rgbToAnsi256(...e.hexToRgb(r)),enumerable:!1}}),e}Object.defineProperty($R,"exports",{enumerable:!0,get:qq})});var KM=P(dv=>{"use strict";dv.byteLength=AW;dv.toByteArray=PW;dv.fromByteArray=NW;var So=[],Sn=[],EW=typeof Uint8Array<"u"?Uint8Array:Array,BI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Va=0,VM=BI.length;Va0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function AW(t){var e=GM(t),r=e[0],n=e[1];return(r+n)*3/4-n}function OW(t,e,r){return(e+r)*3/4-r}function PW(t){var e,r=GM(t),n=r[0],o=r[1],i=new EW(OW(t,n,o)),s=0,a=o>0?n-4:n,c;for(c=0;c>16&255,i[s++]=e>>8&255,i[s++]=e&255;return o===2&&(e=Sn[t.charCodeAt(c)]<<2|Sn[t.charCodeAt(c+1)]>>4,i[s++]=e&255),o===1&&(e=Sn[t.charCodeAt(c)]<<10|Sn[t.charCodeAt(c+1)]<<4|Sn[t.charCodeAt(c+2)]>>2,i[s++]=e>>8&255,i[s++]=e&255),i}function CW(t){return So[t>>18&63]+So[t>>12&63]+So[t>>6&63]+So[t&63]}function RW(t,e,r){for(var n,o=[],i=e;ia?a:s+i));return n===1?(e=t[r-1],o.push(So[e>>2]+So[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(So[e>>10]+So[e>>4&63]+So[e<<2&63]+"=")),o.join("")}});var Cf=P(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.regexpCode=Fe.getEsmExportName=Fe.getProperty=Fe.safeStringify=Fe.stringify=Fe.strConcat=Fe.addCodeArg=Fe.str=Fe._=Fe.nil=Fe._Code=Fe.Name=Fe.IDENTIFIER=Fe._CodeOrName=void 0;var Of=class{};Fe._CodeOrName=Of;Fe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Qa=class extends Of{constructor(e){if(super(),!Fe.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Fe.Name=Qa;var Tn=class extends Of{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Qa&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Fe._Code=Tn;Fe.nil=new Tn("");function Xj(t,...e){let r=[t[0]],n=0;for(;n{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.ValueScope=Br.ValueScopeName=Br.Scope=Br.varKinds=Br.UsedValueState=void 0;var Fr=Cf(),DS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Hv;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Hv||(Br.UsedValueState=Hv={}));Br.varKinds={const:new Fr.Name("const"),let:new Fr.Name("let"),var:new Fr.Name("var")};var Wv=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Fr.Name?e:this.name(e)}name(e){return new Fr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Br.Scope=Wv;var Jv=class extends Fr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Fr._)`.${new Fr.Name(r)}[${n}]`}};Br.ValueScopeName=Jv;var z7=(0,Fr._)`\n`,LS=class extends Wv{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?z7:Fr.nil}}get(){return this._scope}name(e){return new Jv(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:i}=o,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[i];if(a){let l=a.get(s);if(l)return l}else a=this._values[i]=new Map;a.set(s,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Fr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let i=Fr.nil;for(let s in e){let a=e[s];if(!a)continue;let c=n[s]=n[s]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Hv.Started);let l=r(u);if(l){let d=this.opts.es5?Br.varKinds.var:Br.varKinds.const;i=(0,Fr._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Fr._)`${i}${l}${this.opts._n}`;else throw new DS(u);c.set(u,Hv.Completed)})}return i}};Br.ValueScope=LS});var Oe=P(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.or=Ce.and=Ce.not=Ce.CodeGen=Ce.operators=Ce.varKinds=Ce.ValueScopeName=Ce.ValueScope=Ce.Scope=Ce.Name=Ce.regexpCode=Ce.stringify=Ce.getProperty=Ce.nil=Ce.strConcat=Ce.str=Ce._=void 0;var Le=Cf(),Xn=US(),_s=Cf();Object.defineProperty(Ce,"_",{enumerable:!0,get:function(){return _s._}});Object.defineProperty(Ce,"str",{enumerable:!0,get:function(){return _s.str}});Object.defineProperty(Ce,"strConcat",{enumerable:!0,get:function(){return _s.strConcat}});Object.defineProperty(Ce,"nil",{enumerable:!0,get:function(){return _s.nil}});Object.defineProperty(Ce,"getProperty",{enumerable:!0,get:function(){return _s.getProperty}});Object.defineProperty(Ce,"stringify",{enumerable:!0,get:function(){return _s.stringify}});Object.defineProperty(Ce,"regexpCode",{enumerable:!0,get:function(){return _s.regexpCode}});Object.defineProperty(Ce,"Name",{enumerable:!0,get:function(){return _s.Name}});var eb=US();Object.defineProperty(Ce,"Scope",{enumerable:!0,get:function(){return eb.Scope}});Object.defineProperty(Ce,"ValueScope",{enumerable:!0,get:function(){return eb.ValueScope}});Object.defineProperty(Ce,"ValueScopeName",{enumerable:!0,get:function(){return eb.ValueScopeName}});Object.defineProperty(Ce,"varKinds",{enumerable:!0,get:function(){return eb.varKinds}});Ce.operators={GT:new Le._Code(">"),GTE:new Le._Code(">="),LT:new Le._Code("<"),LTE:new Le._Code("<="),EQ:new Le._Code("==="),NEQ:new Le._Code("!=="),NOT:new Le._Code("!"),OR:new Le._Code("||"),AND:new Le._Code("&&"),ADD:new Le._Code("+")};var di=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},FS=class extends di{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Xn.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Sl(this.rhs,e,r)),this}get names(){return this.rhs instanceof Le._CodeOrName?this.rhs.names:{}}},Xv=class extends di{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Le.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Sl(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Le.Name?{}:{...this.lhs.names};return Qv(e,this.rhs)}},BS=class extends Xv{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},ZS=class extends di{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qS=class extends di{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},VS=class extends di{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},GS=class extends di{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Sl(this.code,e,r),this}get names(){return this.code instanceof Le._CodeOrName?this.code.names:{}}},Rf=class extends di{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(e,r)||(M7(e,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rc(e,r.names),{})}},pi=class extends Rf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},KS=class extends Rf{},Il=class extends pi{};Il.kind="else";var ec=class t extends pi{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Il(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Qj(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Sl(this.condition,e,r),this}get names(){let e=super.names;return Qv(e,this.condition),this.else&&rc(e,this.else.names),e}};ec.kind="if";var tc=class extends pi{};tc.kind="for";var HS=class extends tc{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Sl(this.iteration,e,r),this}get names(){return rc(super.names,this.iteration.names)}},WS=class extends tc{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?Xn.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=Qv(super.names,this.from);return Qv(e,this.to)}},Yv=class extends tc{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Sl(this.iterable,e,r),this}get names(){return rc(super.names,this.iterable.names)}},Nf=class extends pi{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Nf.kind="func";var zf=class extends Rf{render(e){return"return "+super.render(e)}};zf.kind="return";var JS=class extends pi{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rc(e,this.catch.names),this.finally&&rc(e,this.finally.names),e}},Mf=class extends pi{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Mf.kind="catch";var jf=class extends pi{render(e){return"finally"+super.render(e)}};jf.kind="finally";var XS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?` +`:""},this._extScope=e,this._scope=new Xn.Scope({parent:e}),this._nodes=[new KS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new FS(e,i,n)),i}const(e,r,n){return this._def(Xn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Xn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Xn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Xv(e,r,n))}add(e,r){return this._leafNode(new BS(e,Ce.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Le.nil&&this._leafNode(new GS(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Le.addCodeArg)(r,o));return r.push("}"),new Le._Code(r)}if(e,r,n){if(this._blockNode(new ec(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ec(e))}else(){return this._elseNode(new Il)}endIf(){return this._endBlockNode(ec,Il)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new HS(e),r)}forRange(e,r,n,o,i=this.opts.es5?Xn.varKinds.var:Xn.varKinds.let){let s=this._scope.toName(e);return this._for(new WS(i,s,r,n),()=>o(s))}forOf(e,r,n,o=Xn.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let s=r instanceof Le.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Le._)`${s}.length`,a=>{this.var(i,(0,Le._)`${s}[${a}]`),n(i)})}return this._for(new Yv("of",o,i,r),()=>n(i))}forIn(e,r,n,o=this.opts.es5?Xn.varKinds.var:Xn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Le._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new Yv("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(tc)}label(e){return this._leafNode(new ZS(e))}break(e){return this._leafNode(new qS(e))}return(e){let r=new zf;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(zf)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new JS;if(this._blockNode(o),this.code(e),r){let i=this.name("e");this._currNode=o.catch=new Mf(i),r(i)}return n&&(this._currNode=o.finally=new jf,this.code(n)),this._endBlockNode(Mf,jf)}throw(e){return this._leafNode(new VS(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Le.nil,n,o){return this._blockNode(new Nf(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Nf)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof ec))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ce.CodeGen=XS;function rc(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Qv(t,e){return e instanceof Le._CodeOrName?rc(t,e.names):t}function Sl(t,e,r){if(t instanceof Le.Name)return n(t);if(!o(t))return t;return new Le._Code(t._items.reduce((i,s)=>(s instanceof Le.Name&&(s=n(s)),s instanceof Le._Code?i.push(...s._items):i.push(s),i),[]));function n(i){let s=r[i.str];return s===void 0||e[i.str]!==1?i:(delete e[i.str],s)}function o(i){return i instanceof Le._Code&&i._items.some(s=>s instanceof Le.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function M7(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Qj(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Le._)`!${YS(t)}`}Ce.not=Qj;var j7=eD(Ce.operators.AND);function D7(...t){return t.reduce(j7)}Ce.and=D7;var L7=eD(Ce.operators.OR);function U7(...t){return t.reduce(L7)}Ce.or=U7;function eD(t){return(e,r)=>e===Le.nil?r:r===Le.nil?e:(0,Le._)`${YS(e)} ${t} ${YS(r)}`}function YS(t){return t instanceof Le.Name?t:(0,Le._)`(${t})`}});var Be=P(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.checkStrictMode=Ne.getErrorPath=Ne.Type=Ne.useFunc=Ne.setEvaluated=Ne.evaluatedPropsToName=Ne.mergeEvaluated=Ne.eachItem=Ne.unescapeJsonPointer=Ne.escapeJsonPointer=Ne.escapeFragment=Ne.unescapeFragment=Ne.schemaRefOrVal=Ne.schemaHasRulesButRef=Ne.schemaHasRules=Ne.checkUnknownRules=Ne.alwaysValidSchema=Ne.toHash=void 0;var rt=Oe(),F7=Cf();function B7(t){let e={};for(let r of t)e[r]=!0;return e}Ne.toHash=B7;function Z7(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(nD(t,e),!oD(e,t.self.RULES.all))}Ne.alwaysValidSchema=Z7;function nD(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let i in e)o[i]||aD(t,`unknown keyword: "${i}"`)}Ne.checkUnknownRules=nD;function oD(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Ne.schemaHasRules=oD;function q7(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Ne.schemaHasRulesButRef=q7;function V7({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,rt._)`${r}`}return(0,rt._)`${t}${e}${(0,rt.getProperty)(n)}`}Ne.schemaRefOrVal=V7;function G7(t){return iD(decodeURIComponent(t))}Ne.unescapeFragment=G7;function K7(t){return encodeURIComponent(ek(t))}Ne.escapeFragment=K7;function ek(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Ne.escapeJsonPointer=ek;function iD(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Ne.unescapeJsonPointer=iD;function H7(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Ne.eachItem=H7;function tD({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,i,s,a)=>{let c=s===void 0?i:s instanceof rt.Name?(i instanceof rt.Name?t(o,i,s):e(o,i,s),s):i instanceof rt.Name?(e(o,s,i),i):r(i,s);return a===rt.Name&&!(c instanceof rt.Name)?n(o,c):c}}Ne.mergeEvaluated={props:tD({mergeNames:(t,e,r)=>t.if((0,rt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,rt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,rt._)`${r} || {}`).code((0,rt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,rt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,rt._)`${r} || {}`),tk(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:sD}),items:tD({mergeNames:(t,e,r)=>t.if((0,rt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,rt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,rt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,rt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function sD(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,rt._)`{}`);return e!==void 0&&tk(t,r,e),r}Ne.evaluatedPropsToName=sD;function tk(t,e,r){Object.keys(r).forEach(n=>t.assign((0,rt._)`${e}${(0,rt.getProperty)(n)}`,!0))}Ne.setEvaluated=tk;var rD={};function W7(t,e){return t.scopeValue("func",{ref:e,code:rD[e.code]||(rD[e.code]=new F7._Code(e.code))})}Ne.useFunc=W7;var QS;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(QS||(Ne.Type=QS={}));function J7(t,e,r){if(t instanceof rt.Name){let n=e===QS.Num;return r?n?(0,rt._)`"[" + ${t} + "]"`:(0,rt._)`"['" + ${t} + "']"`:n?(0,rt._)`"/" + ${t}`:(0,rt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,rt.getProperty)(t).toString():"/"+ek(t)}Ne.getErrorPath=J7;function aD(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Ne.checkStrictMode=aD});var fi=P(rk=>{"use strict";Object.defineProperty(rk,"__esModule",{value:!0});var ur=Oe(),X7={data:new ur.Name("data"),valCxt:new ur.Name("valCxt"),instancePath:new ur.Name("instancePath"),parentData:new ur.Name("parentData"),parentDataProperty:new ur.Name("parentDataProperty"),rootData:new ur.Name("rootData"),dynamicAnchors:new ur.Name("dynamicAnchors"),vErrors:new ur.Name("vErrors"),errors:new ur.Name("errors"),this:new ur.Name("this"),self:new ur.Name("self"),scope:new ur.Name("scope"),json:new ur.Name("json"),jsonPos:new ur.Name("jsonPos"),jsonLen:new ur.Name("jsonLen"),jsonPart:new ur.Name("jsonPart")};rk.default=X7});var Df=P(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.extendErrors=lr.resetErrorsCount=lr.reportExtraError=lr.reportError=lr.keyword$DataError=lr.keywordError=void 0;var Ue=Oe(),tb=Be(),kr=fi();lr.keywordError={message:({keyword:t})=>(0,Ue.str)`must pass "${t}" keyword validation`};lr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ue.str)`"${t}" keyword must be ${e} ($data)`:(0,Ue.str)`"${t}" keyword is invalid ($data)`};function Y7(t,e=lr.keywordError,r,n){let{it:o}=t,{gen:i,compositeRule:s,allErrors:a}=o,c=lD(t,e,r);n??(s||a)?cD(i,c):uD(o,(0,Ue._)`[${c}]`)}lr.reportError=Y7;function Q7(t,e=lr.keywordError,r){let{it:n}=t,{gen:o,compositeRule:i,allErrors:s}=n,a=lD(t,e,r);cD(o,a),i||s||uD(n,kr.default.vErrors)}lr.reportExtraError=Q7;function eX(t,e){t.assign(kr.default.errors,e),t.if((0,Ue._)`${kr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ue._)`${kr.default.vErrors}.length`,e),()=>t.assign(kr.default.vErrors,null)))}lr.resetErrorsCount=eX;function tX({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",o,kr.default.errors,a=>{t.const(s,(0,Ue._)`${kr.default.vErrors}[${a}]`),t.if((0,Ue._)`${s}.instancePath === undefined`,()=>t.assign((0,Ue._)`${s}.instancePath`,(0,Ue.strConcat)(kr.default.instancePath,i.errorPath))),t.assign((0,Ue._)`${s}.schemaPath`,(0,Ue.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,Ue._)`${s}.schema`,r),t.assign((0,Ue._)`${s}.data`,n))})}lr.extendErrors=tX;function cD(t,e){let r=t.const("err",e);t.if((0,Ue._)`${kr.default.vErrors} === null`,()=>t.assign(kr.default.vErrors,(0,Ue._)`[${r}]`),(0,Ue._)`${kr.default.vErrors}.push(${r})`),t.code((0,Ue._)`${kr.default.errors}++`)}function uD(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,Ue._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ue._)`${n}.errors`,e),r.return(!1))}var nc={keyword:new Ue.Name("keyword"),schemaPath:new Ue.Name("schemaPath"),params:new Ue.Name("params"),propertyName:new Ue.Name("propertyName"),message:new Ue.Name("message"),schema:new Ue.Name("schema"),parentSchema:new Ue.Name("parentSchema")};function lD(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Ue._)`{}`:rX(t,e,r)}function rX(t,e,r={}){let{gen:n,it:o}=t,i=[nX(o,r),oX(t,r)];return iX(t,e,i),n.object(...i)}function nX({errorPath:t},{instancePath:e}){let r=e?(0,Ue.str)`${t}${(0,tb.getErrorPath)(e,tb.Type.Str)}`:t;return[kr.default.instancePath,(0,Ue.strConcat)(kr.default.instancePath,r)]}function oX({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,Ue.str)`${e}/${t}`;return r&&(o=(0,Ue.str)`${o}${(0,tb.getErrorPath)(r,tb.Type.Str)}`),[nc.schemaPath,o]}function iX(t,{params:e,message:r},n){let{keyword:o,data:i,schemaValue:s,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([nc.keyword,o],[nc.params,typeof e=="function"?e(t):e||(0,Ue._)`{}`]),c.messages&&n.push([nc.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([nc.schema,s],[nc.parentSchema,(0,Ue._)`${l}${d}`],[kr.default.data,i]),u&&n.push([nc.propertyName,u])}});var pD=P(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.boolOrEmptySchema=kl.topBoolOrEmptySchema=void 0;var sX=Df(),aX=Oe(),cX=fi(),uX={message:"boolean schema is false"};function lX(t){let{gen:e,schema:r,validateName:n}=t;r===!1?dD(t,!1):typeof r=="object"&&r.$async===!0?e.return(cX.default.data):(e.assign((0,aX._)`${n}.errors`,null),e.return(!0))}kl.topBoolOrEmptySchema=lX;function dX(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),dD(t)):r.var(e,!0)}kl.boolOrEmptySchema=dX;function dD(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,sX.reportError)(o,uX,void 0,e)}});var nk=P(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.getRules=Tl.isJSONType=void 0;var pX=["string","number","integer","boolean","null","object","array"],fX=new Set(pX);function mX(t){return typeof t=="string"&&fX.has(t)}Tl.isJSONType=mX;function hX(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Tl.getRules=hX});var ok=P(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.shouldUseRule=ys.shouldUseGroup=ys.schemaHasRulesForType=void 0;function gX({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&fD(t,n)}ys.schemaHasRulesForType=gX;function fD(t,e){return e.rules.some(r=>mD(t,r))}ys.shouldUseGroup=fD;function mD(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ys.shouldUseRule=mD});var Lf=P(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.reportTypeError=dr.checkDataTypes=dr.checkDataType=dr.coerceAndCheckDataType=dr.getJSONTypes=dr.getSchemaTypes=dr.DataType=void 0;var _X=nk(),yX=ok(),vX=Df(),Te=Oe(),hD=Be(),El;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(El||(dr.DataType=El={}));function bX(t){let e=gD(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}dr.getSchemaTypes=bX;function gD(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(_X.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}dr.getJSONTypes=gD;function wX(t,e){let{gen:r,data:n,opts:o}=t,i=xX(e,o.coerceTypes),s=e.length>0&&!(i.length===0&&e.length===1&&(0,yX.schemaHasRulesForType)(t,e[0]));if(s){let a=sk(e,n,o.strictNumbers,El.Wrong);r.if(a,()=>{i.length?$X(t,e,i):ak(t)})}return s}dr.coerceAndCheckDataType=wX;var _D=new Set(["string","number","integer","boolean","null"]);function xX(t,e){return e?t.filter(r=>_D.has(r)||e==="array"&&r==="array"):[]}function $X(t,e,r){let{gen:n,data:o,opts:i}=t,s=n.let("dataType",(0,Te._)`typeof ${o}`),a=n.let("coerced",(0,Te._)`undefined`);i.coerceTypes==="array"&&n.if((0,Te._)`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,Te._)`${o}[0]`).assign(s,(0,Te._)`typeof ${o}`).if(sk(e,o,i.strictNumbers),()=>n.assign(a,o))),n.if((0,Te._)`${a} !== undefined`);for(let u of r)(_D.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),ak(t),n.endIf(),n.if((0,Te._)`${a} !== undefined`,()=>{n.assign(o,a),IX(t,a)});function c(u){switch(u){case"string":n.elseIf((0,Te._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,Te._)`"" + ${o}`).elseIf((0,Te._)`${o} === null`).assign(a,(0,Te._)`""`);return;case"number":n.elseIf((0,Te._)`${s} == "boolean" || ${o} === null + || (${s} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,Te._)`+${o}`);return;case"integer":n.elseIf((0,Te._)`${s} === "boolean" || ${o} === null + || (${s} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,Te._)`+${o}`);return;case"boolean":n.elseIf((0,Te._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,Te._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,Te._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,Te._)`${s} === "string" || ${s} === "number" + || ${s} === "boolean" || ${o} === null`).assign(a,(0,Te._)`[${o}]`)}}}function IX({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Te._)`${e} !== undefined`,()=>t.assign((0,Te._)`${e}[${r}]`,n))}function ik(t,e,r,n=El.Correct){let o=n===El.Correct?Te.operators.EQ:Te.operators.NEQ,i;switch(t){case"null":return(0,Te._)`${e} ${o} null`;case"array":i=(0,Te._)`Array.isArray(${e})`;break;case"object":i=(0,Te._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=s((0,Te._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=s();break;default:return(0,Te._)`typeof ${e} ${o} ${t}`}return n===El.Correct?i:(0,Te.not)(i);function s(a=Te.nil){return(0,Te.and)((0,Te._)`typeof ${e} == "number"`,a,r?(0,Te._)`isFinite(${e})`:Te.nil)}}dr.checkDataType=ik;function sk(t,e,r,n){if(t.length===1)return ik(t[0],e,r,n);let o,i=(0,hD.toHash)(t);if(i.array&&i.object){let s=(0,Te._)`typeof ${e} != "object"`;o=i.null?s:(0,Te._)`!${e} || ${s}`,delete i.null,delete i.array,delete i.object}else o=Te.nil;i.number&&delete i.integer;for(let s in i)o=(0,Te.and)(o,ik(s,e,r,n));return o}dr.checkDataTypes=sk;var SX={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Te._)`{type: ${t}}`:(0,Te._)`{type: ${e}}`};function ak(t){let e=kX(t);(0,vX.reportError)(e,SX)}dr.reportTypeError=ak;function kX(t){let{gen:e,data:r,schema:n}=t,o=(0,hD.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var vD=P(rb=>{"use strict";Object.defineProperty(rb,"__esModule",{value:!0});rb.assignDefaults=void 0;var Al=Oe(),TX=Be();function EX(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)yD(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,i)=>yD(t,i,o.default))}rb.assignDefaults=EX;function yD(t,e,r){let{gen:n,compositeRule:o,data:i,opts:s}=t;if(r===void 0)return;let a=(0,Al._)`${i}${(0,Al.getProperty)(e)}`;if(o){(0,TX.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Al._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,Al._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Al._)`${a} = ${(0,Al.stringify)(r)}`)}});var En=P(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.validateUnion=Xe.validateArray=Xe.usePattern=Xe.callValidateCode=Xe.schemaProperties=Xe.allSchemaProperties=Xe.noPropertyInData=Xe.propertyInData=Xe.isOwnProperty=Xe.hasPropFunc=Xe.reportMissingProp=Xe.checkMissingProp=Xe.checkReportMissingProp=void 0;var ut=Oe(),ck=Be(),vs=fi(),AX=Be();function OX(t,e){let{gen:r,data:n,it:o}=t;r.if(lk(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,ut._)`${e}`},!0),t.error()})}Xe.checkReportMissingProp=OX;function PX({gen:t,data:e,it:{opts:r}},n,o){return(0,ut.or)(...n.map(i=>(0,ut.and)(lk(t,e,i,r.ownProperties),(0,ut._)`${o} = ${i}`)))}Xe.checkMissingProp=PX;function CX(t,e){t.setParams({missingProperty:e},!0),t.error()}Xe.reportMissingProp=CX;function bD(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ut._)`Object.prototype.hasOwnProperty`})}Xe.hasPropFunc=bD;function uk(t,e,r){return(0,ut._)`${bD(t)}.call(${e}, ${r})`}Xe.isOwnProperty=uk;function RX(t,e,r,n){let o=(0,ut._)`${e}${(0,ut.getProperty)(r)} !== undefined`;return n?(0,ut._)`${o} && ${uk(t,e,r)}`:o}Xe.propertyInData=RX;function lk(t,e,r,n){let o=(0,ut._)`${e}${(0,ut.getProperty)(r)} === undefined`;return n?(0,ut.or)(o,(0,ut.not)(uk(t,e,r))):o}Xe.noPropertyInData=lk;function wD(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Xe.allSchemaProperties=wD;function NX(t,e){return wD(e).filter(r=>!(0,ck.alwaysValidSchema)(t,e[r]))}Xe.schemaProperties=NX;function zX({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:s},a,c,u){let l=u?(0,ut._)`${t}, ${e}, ${n}${o}`:e,d=[[vs.default.instancePath,(0,ut.strConcat)(vs.default.instancePath,i)],[vs.default.parentData,s.parentData],[vs.default.parentDataProperty,s.parentDataProperty],[vs.default.rootData,vs.default.rootData]];s.opts.dynamicRef&&d.push([vs.default.dynamicAnchors,vs.default.dynamicAnchors]);let f=(0,ut._)`${l}, ${r.object(...d)}`;return c!==ut.nil?(0,ut._)`${a}.call(${c}, ${f})`:(0,ut._)`${a}(${f})`}Xe.callValidateCode=zX;var MX=(0,ut._)`new RegExp`;function jX({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,i=o(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ut._)`${o.code==="new RegExp"?MX:(0,AX.useFunc)(t,o)}(${r}, ${n})`})}Xe.usePattern=jX;function DX(t){let{gen:e,data:r,keyword:n,it:o}=t,i=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(i,!0),s(()=>e.break()),i;function s(a){let c=e.const("len",(0,ut._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:ck.Type.Num},i),e.if((0,ut.not)(i),a)})}}Xe.validateArray=DX;function LX(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,ck.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(s,(0,ut._)`${s} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,ut.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}Xe.validateUnion=LX});var ID=P(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.validateKeywordUsage=Eo.validSchemaType=Eo.funcKeywordCode=Eo.macroKeywordCode=void 0;var Tr=Oe(),oc=fi(),UX=En(),FX=Df();function BX(t,e){let{gen:r,keyword:n,schema:o,parentSchema:i,it:s}=t,a=e.macro.call(s.self,o,i,s),c=$D(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:Tr.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Eo.macroKeywordCode=BX;function ZX(t,e){var r;let{gen:n,keyword:o,schema:i,parentSchema:s,$data:a,it:c}=t;VX(c,e);let u=!a&&e.compile?e.compile.call(c.self,i,s,c):e.validate,l=$D(n,o,u),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&xD(t),_(()=>t.error());else{let v=e.async?p():m();e.modifying&&xD(t),_(()=>qX(t,v))}}function p(){let v=n.let("ruleErrs",null);return n.try(()=>h((0,Tr._)`await `),b=>n.assign(d,!1).if((0,Tr._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,Tr._)`${b}.errors`),()=>n.throw(b))),v}function m(){let v=(0,Tr._)`${l}.errors`;return n.assign(v,null),h(Tr.nil),v}function h(v=e.async?(0,Tr._)`await `:Tr.nil){let b=c.opts.passContext?oc.default.this:oc.default.self,x=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Tr._)`${v}${(0,UX.callValidateCode)(t,l,b,x)}`,e.modifying)}function _(v){var b;n.if((0,Tr.not)((b=e.valid)!==null&&b!==void 0?b:d),v)}}Eo.funcKeywordCode=ZX;function xD(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Tr._)`${n.parentData}[${n.parentDataProperty}]`))}function qX(t,e){let{gen:r}=t;r.if((0,Tr._)`Array.isArray(${e})`,()=>{r.assign(oc.default.vErrors,(0,Tr._)`${oc.default.vErrors} === null ? ${e} : ${oc.default.vErrors}.concat(${e})`).assign(oc.default.errors,(0,Tr._)`${oc.default.vErrors}.length`),(0,FX.extendErrors)(t)},()=>t.error())}function VX({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function $D(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Tr.stringify)(r)})}function GX(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Eo.validSchemaType=GX;function KX({schema:t,opts:e,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let s=o.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Eo.validateKeywordUsage=KX});var kD=P(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.extendSubschemaMode=bs.extendSubschemaData=bs.getSubschema=void 0;var Ao=Oe(),SD=Be();function HX(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ao._)`${t.schemaPath}${(0,Ao.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ao._)`${t.schemaPath}${(0,Ao.getProperty)(e)}${(0,Ao.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,SD.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:s,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}bs.getSubschema=HX;function WX(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:s}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,f=a.let("data",(0,Ao._)`${e.data}${(0,Ao.getProperty)(r)}`,!0);c(f),t.errorPath=(0,Ao.str)`${u}${(0,SD.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ao._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Ao.Name?o:a.let("data",o,!0);c(u),s!==void 0&&(t.propertyName=s)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}bs.extendSubschemaData=WX;function JX(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}bs.extendSubschemaMode=JX});var dk=P((Z2e,TD)=>{"use strict";TD.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var s=i[o];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var AD=P((q2e,ED)=>{"use strict";var ws=ED.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};nb(e,n,o,t,"",t)};ws.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ws.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ws.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ws.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function nb(t,e,r,n,o,i,s,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,i,s,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ws.arrayKeywords)for(var f=0;f{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.getSchemaRefs=Zr.resolveUrl=Zr.normalizeId=Zr._getFullPath=Zr.getFullPath=Zr.inlineRef=void 0;var YX=Be(),QX=dk(),eY=AD(),tY=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function rY(t,e=!0){return typeof t=="boolean"?!0:e===!0?!pk(t):e?OD(t)<=e:!1}Zr.inlineRef=rY;var nY=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function pk(t){for(let e in t){if(nY.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(pk)||typeof r=="object"&&pk(r))return!0}return!1}function OD(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!tY.has(r)&&(typeof t[r]=="object"&&(0,YX.eachItem)(t[r],n=>e+=OD(n)),e===1/0))return 1/0}return e}function PD(t,e="",r){r!==!1&&(e=Ol(e));let n=t.parse(e);return CD(t,n)}Zr.getFullPath=PD;function CD(t,e){return t.serialize(e).split("#")[0]+"#"}Zr._getFullPath=CD;var oY=/#\/?$/;function Ol(t){return t?t.replace(oY,""):""}Zr.normalizeId=Ol;function iY(t,e,r){return r=Ol(r),t.resolve(e,r)}Zr.resolveUrl=iY;var sY=/^[a-z_][-a-z0-9._]*$/i;function aY(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Ol(t[r]||e),i={"":o},s=PD(n,o,!1),a={},c=new Set;return eY(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=s+f,_=i[m];typeof d[r]=="string"&&(_=v.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),i[f]=_;function v(x){let k=this.opts.uriResolver.resolve;if(x=Ol(_?k(_,x):x),c.has(x))throw l(x);c.add(x);let T=this.refs[x];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?u(d,T.schema,x):x!==Ol(h)&&(x[0]==="#"?(u(d,a[x],x),a[x]=d):this.refs[x]=h),x}function b(x){if(typeof x=="string"){if(!sY.test(x))throw new Error(`invalid anchor "${x}"`);v.call(this,`#${x}`)}}}),a;function u(d,f,p){if(f!==void 0&&!QX(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Zr.getSchemaRefs=aY});var Zf=P(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.getData=xs.KeywordCxt=xs.validateFunctionCode=void 0;var jD=pD(),RD=Lf(),mk=ok(),ob=Lf(),cY=vD(),Bf=ID(),fk=kD(),ae=Oe(),we=fi(),uY=Uf(),mi=Be(),Ff=Df();function lY(t){if(UD(t)&&(FD(t),LD(t))){fY(t);return}DD(t,()=>(0,jD.topBoolOrEmptySchema)(t))}xs.validateFunctionCode=lY;function DD({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,ae._)`${we.default.data}, ${we.default.valCxt}`,n.$async,()=>{t.code((0,ae._)`"use strict"; ${ND(r,o)}`),pY(t,o),t.code(i)}):t.func(e,(0,ae._)`${we.default.data}, ${dY(o)}`,n.$async,()=>t.code(ND(r,o)).code(i))}function dY(t){return(0,ae._)`{${we.default.instancePath}="", ${we.default.parentData}, ${we.default.parentDataProperty}, ${we.default.rootData}=${we.default.data}${t.dynamicRef?(0,ae._)`, ${we.default.dynamicAnchors}={}`:ae.nil}}={}`}function pY(t,e){t.if(we.default.valCxt,()=>{t.var(we.default.instancePath,(0,ae._)`${we.default.valCxt}.${we.default.instancePath}`),t.var(we.default.parentData,(0,ae._)`${we.default.valCxt}.${we.default.parentData}`),t.var(we.default.parentDataProperty,(0,ae._)`${we.default.valCxt}.${we.default.parentDataProperty}`),t.var(we.default.rootData,(0,ae._)`${we.default.valCxt}.${we.default.rootData}`),e.dynamicRef&&t.var(we.default.dynamicAnchors,(0,ae._)`${we.default.valCxt}.${we.default.dynamicAnchors}`)},()=>{t.var(we.default.instancePath,(0,ae._)`""`),t.var(we.default.parentData,(0,ae._)`undefined`),t.var(we.default.parentDataProperty,(0,ae._)`undefined`),t.var(we.default.rootData,we.default.data),e.dynamicRef&&t.var(we.default.dynamicAnchors,(0,ae._)`{}`)})}function fY(t){let{schema:e,opts:r,gen:n}=t;DD(t,()=>{r.$comment&&e.$comment&&ZD(t),yY(t),n.let(we.default.vErrors,null),n.let(we.default.errors,0),r.unevaluated&&mY(t),BD(t),wY(t)})}function mY(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,ae._)`${r}.evaluated`),e.if((0,ae._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ae._)`${t.evaluated}.props`,(0,ae._)`undefined`)),e.if((0,ae._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ae._)`${t.evaluated}.items`,(0,ae._)`undefined`))}function ND(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,ae._)`/*# sourceURL=${r} */`:ae.nil}function hY(t,e){if(UD(t)&&(FD(t),LD(t))){gY(t,e);return}(0,jD.boolOrEmptySchema)(t,e)}function LD({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function UD(t){return typeof t.schema!="boolean"}function gY(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&ZD(t),vY(t),bY(t);let i=n.const("_errs",we.default.errors);BD(t,i),n.var(e,(0,ae._)`${i} === ${we.default.errors}`)}function FD(t){(0,mi.checkUnknownRules)(t),_Y(t)}function BD(t,e){if(t.opts.jtd)return zD(t,[],!1,e);let r=(0,RD.getSchemaTypes)(t.schema),n=(0,RD.coerceAndCheckDataType)(t,r);zD(t,r,!n,e)}function _Y(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,mi.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function yY(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,mi.checkStrictMode)(t,"default is ignored in the schema root")}function vY(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,uY.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function bY(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function ZD({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,ae._)`${we.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let s=(0,ae.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,ae._)`${we.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function wY(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=t;r.$async?e.if((0,ae._)`${we.default.errors} === 0`,()=>e.return(we.default.data),()=>e.throw((0,ae._)`new ${o}(${we.default.vErrors})`)):(e.assign((0,ae._)`${n}.errors`,we.default.vErrors),i.unevaluated&&xY(t),e.return((0,ae._)`${we.default.errors} === 0`))}function xY({gen:t,evaluated:e,props:r,items:n}){r instanceof ae.Name&&t.assign((0,ae._)`${e}.props`,r),n instanceof ae.Name&&t.assign((0,ae._)`${e}.items`,n)}function zD(t,e,r,n){let{gen:o,schema:i,data:s,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,mi.schemaHasRulesButRef)(i,l))){o.block(()=>VD(t,"$ref",l.all.$ref.definition));return}c.jtd||$Y(t,e),o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,mk.shouldUseGroup)(i,f)&&(f.type?(o.if((0,ob.checkDataType)(f.type,s,c.strictNumbers)),MD(t,f),e.length===1&&e[0]===f.type&&r&&(o.else(),(0,ob.reportTypeError)(t)),o.endIf()):MD(t,f),a||o.if((0,ae._)`${we.default.errors} === ${n||0}`))}}function MD(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,cY.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,mk.shouldUseRule)(n,i)&&VD(t,i.keyword,i.definition,e.type)})}function $Y(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(IY(t,e),t.opts.allowUnionTypes||SY(t,e),kY(t,t.dataTypes))}function IY(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{qD(t.dataTypes,r)||hk(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),EY(t,e)}}function SY(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&hk(t,"use allowUnionTypes to allow union type keyword")}function kY(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,mk.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(s=>TY(e,s))&&hk(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function TY(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function qD(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function EY(t,e){let r=[];for(let n of t.dataTypes)qD(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function hk(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,mi.checkStrictMode)(t,e,t.opts.strictTypes)}var ib=class{constructor(e,r,n){if((0,Bf.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,mi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",GD(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Bf.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",we.default.errors))}result(e,r,n){this.failResult((0,ae.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,ae.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,ae._)`${r} !== undefined && (${(0,ae.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Ff.reportExtraError:Ff.reportError)(this,this.def.error,r)}$dataError(){(0,Ff.reportError)(this,this.def.$dataError||Ff.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ff.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=ae.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=ae.nil,r=ae.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:s}=this;n.if((0,ae.or)((0,ae._)`${o} === undefined`,r)),e!==ae.nil&&n.assign(e,!0),(i.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==ae.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,ae.or)(s(),a());function s(){if(n.length){if(!(r instanceof ae.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,ae._)`${(0,ob.checkDataTypes)(c,r,i.opts.strictNumbers,ob.DataType.Wrong)}`}return ae.nil}function a(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,ae._)`!${c}(${r})`}return ae.nil}}subschema(e,r){let n=(0,fk.getSubschema)(this.it,e);(0,fk.extendSubschemaData)(n,this.it,e),(0,fk.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return hY(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=mi.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=mi.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,ae.Name)),!0}};xs.KeywordCxt=ib;function VD(t,e,r,n){let o=new ib(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Bf.funcKeywordCode)(o,r):"macro"in r?(0,Bf.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Bf.funcKeywordCode)(o,r)}var AY=/^\/(?:[^~]|~0|~1)*$/,OY=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function GD(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return we.default.rootData;if(t[0]==="/"){if(!AY.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=we.default.rootData}else{let u=OY.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!o)return i}let s=i,a=o.split("/");for(let u of a)u&&(i=(0,ae._)`${i}${(0,ae.getProperty)((0,mi.unescapeJsonPointer)(u))}`,s=(0,ae._)`${s} && ${i}`);return s;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}xs.getData=GD});var sb=P(_k=>{"use strict";Object.defineProperty(_k,"__esModule",{value:!0});var gk=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};_k.default=gk});var qf=P(bk=>{"use strict";Object.defineProperty(bk,"__esModule",{value:!0});var yk=Uf(),vk=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,yk.resolveUrl)(e,r,n),this.missingSchema=(0,yk.normalizeId)((0,yk.getFullPath)(e,this.missingRef))}};bk.default=vk});var cb=P(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.resolveSchema=An.getCompilingSchema=An.resolveRef=An.compileSchema=An.SchemaEnv=void 0;var Yn=Oe(),PY=sb(),ic=fi(),Qn=Uf(),KD=Be(),CY=Zf(),Pl=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Qn.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};An.SchemaEnv=Pl;function xk(t){let e=HD.call(this,t);if(e)return e;let r=(0,Qn.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,s=new Yn.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),a;t.$async&&(a=s.scopeValue("Error",{ref:PY.default,code:(0,Yn._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");t.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:ic.default.data,parentData:ic.default.parentData,parentDataProperty:ic.default.parentDataProperty,dataNames:[ic.default.data],dataPathArr:[Yn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Yn.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Yn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Yn._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,CY.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let d=s.toString();l=`${s.scopeRefs(ic.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let p=new Function(`${ic.default.self}`,`${ic.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=u;p.evaluated={props:m instanceof Yn.Name?void 0:m,items:h instanceof Yn.Name?void 0:h,dynamicProps:m instanceof Yn.Name,dynamicItems:h instanceof Yn.Name},p.source&&(p.source.evaluated=(0,Yn.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}An.compileSchema=xk;function RY(t,e,r){var n;r=(0,Qn.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let i=MY.call(this,t,r);if(i===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(i=new Pl({schema:s,schemaId:a,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=NY.call(this,i)}An.resolveRef=RY;function NY(t){return(0,Qn.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:xk.call(this,t)}function HD(t){for(let e of this._compilations)if(zY(e,t))return e}An.getCompilingSchema=HD;function zY(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function MY(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||ab.call(this,t,e)}function ab(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Qn._getFullPath)(this.opts.uriResolver,r),o=(0,Qn.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return wk.call(this,r,t);let i=(0,Qn.normalizeId)(n),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){let a=ab.call(this,t,s);return typeof a?.schema!="object"?void 0:wk.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||xk.call(this,s),i===(0,Qn.normalizeId)(e)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,Qn.resolveUrl)(this.opts.uriResolver,o,u)),new Pl({schema:a,schemaId:c,root:t,baseId:o})}return wk.call(this,r,s)}}An.resolveSchema=ab;var jY=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function wk(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,KD.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!jY.has(a)&&u&&(e=(0,Qn.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,KD.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Qn.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=ab.call(this,n,a)}let{schemaId:s}=this.opts;if(i=i||new Pl({schema:r,schemaId:s,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var WD=P((J2e,DY)=>{DY.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Ik=P((X2e,QD)=>{"use strict";var LY=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),XD=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function $k(t){let e="",r=0,n=0;for(n=0;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var UY=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function JD(t){return t.length=0,!0}function FY(t,e,r){if(t.length){let n=$k(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function BY(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,s=!1,a=FY;for(let c=0;c7){r.error=!0;break}c>0&&t[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=JD}else{o.push(u);continue}}return o.length&&(a===JD?r.zone=o.join(""):s?n.push(o.join("")):n.push($k(o))),r.address=n.join(""),r}function YD(t){if(ZY(t,":")<2)return{host:t,isIPV6:!1};let e=BY(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function ZY(t,e){let r=0;for(let n=0;n{"use strict";var{isUUID:KY}=Ik(),HY=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,WY=["http","https","ws","wss","urn","urn:uuid"];function JY(t){return WY.indexOf(t)!==-1}function Sk(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function eL(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function tL(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function XY(t){return t.secure=Sk(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function YY(t){if((t.port===(Sk(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function QY(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(HY);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,i=kk(o);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function eQ(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,i=kk(o);i&&(t=i.serialize(t,e));let s=t,a=t.nss;return s.path=`${n||e.nid}:${a}`,e.skipEscape=!0,s}function tQ(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!KY(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function rQ(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var rL={scheme:"http",domainHost:!0,parse:eL,serialize:tL},nQ={scheme:"https",domainHost:rL.domainHost,parse:eL,serialize:tL},ub={scheme:"ws",domainHost:!0,parse:XY,serialize:YY},oQ={scheme:"wss",domainHost:ub.domainHost,parse:ub.parse,serialize:ub.serialize},iQ={scheme:"urn",parse:QY,serialize:eQ,skipNormalize:!0},sQ={scheme:"urn:uuid",parse:tQ,serialize:rQ,skipNormalize:!0},lb={http:rL,https:nQ,ws:ub,wss:oQ,urn:iQ,"urn:uuid":sQ};Object.setPrototypeOf(lb,null);function kk(t){return t&&(lb[t]||lb[t.toLowerCase()])||void 0}nL.exports={wsIsSecure:Sk,SCHEMES:lb,isValidSchemeName:JY,getSchemeHandler:kk}});var aL=P((Q2e,pb)=>{"use strict";var{normalizeIPv6:aQ,removeDotSegments:Vf,recomposeAuthority:cQ,normalizeComponentEncoding:db,isIPv4:uQ,nonSimpleDomain:lQ}=Ik(),{SCHEMES:dQ,getSchemeHandler:iL}=oL();function pQ(t,e){return typeof t=="string"?t=Oo(hi(t,e),e):typeof t=="object"&&(t=hi(Oo(t,e),e)),t}function fQ(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=sL(hi(t,n),hi(e,n),n,!0);return n.skipEscape=!0,Oo(o,n)}function sL(t,e,r,n){let o={};return n||(t=hi(Oo(t,r),r),e=hi(Oo(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Vf(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Vf(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=Vf(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=Vf(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function mQ(t,e,r){return typeof t=="string"?(t=unescape(t),t=Oo(db(hi(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Oo(db(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Oo(db(hi(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Oo(db(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Oo(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],i=iL(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let s=cQ(r);if(s!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(s),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(a=Vf(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var hQ=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function hi(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(hQ);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(uQ(n.host)===!1){let c=aQ(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let s=iL(r.scheme||n.scheme);if(!r.unicodeSupport&&(!s||!s.unicodeSupport)&&n.host&&(r.domainHost||s&&s.domainHost)&&o===!1&&lQ(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!s||s&&!s.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),s&&s.parse&&s.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Tk={SCHEMES:dQ,normalize:pQ,resolve:fQ,resolveComponent:sL,equal:mQ,serialize:Oo,parse:hi};pb.exports=Tk;pb.exports.default=Tk;pb.exports.fastUri=Tk});var uL=P(Ek=>{"use strict";Object.defineProperty(Ek,"__esModule",{value:!0});var cL=aL();cL.code='require("ajv/dist/runtime/uri").default';Ek.default=cL});var _L=P(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.CodeGen=Xt.Name=Xt.nil=Xt.stringify=Xt.str=Xt._=Xt.KeywordCxt=void 0;var gQ=Zf();Object.defineProperty(Xt,"KeywordCxt",{enumerable:!0,get:function(){return gQ.KeywordCxt}});var Cl=Oe();Object.defineProperty(Xt,"_",{enumerable:!0,get:function(){return Cl._}});Object.defineProperty(Xt,"str",{enumerable:!0,get:function(){return Cl.str}});Object.defineProperty(Xt,"stringify",{enumerable:!0,get:function(){return Cl.stringify}});Object.defineProperty(Xt,"nil",{enumerable:!0,get:function(){return Cl.nil}});Object.defineProperty(Xt,"Name",{enumerable:!0,get:function(){return Cl.Name}});Object.defineProperty(Xt,"CodeGen",{enumerable:!0,get:function(){return Cl.CodeGen}});var _Q=sb(),mL=qf(),yQ=nk(),Gf=cb(),vQ=Oe(),Kf=Uf(),fb=Lf(),Ok=Be(),lL=WD(),bQ=uL(),hL=(t,e)=>new RegExp(t,e);hL.code="new RegExp";var wQ=["removeAdditional","useDefaults","coerceTypes"],xQ=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),$Q={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},IQ={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},dL=200;function SQ(t){var e,r,n,o,i,s,a,c,u,l,d,f,p,m,h,_,v,b,x,k,T,F,J,w,Z;let oe=t.strict,Q=(e=t.code)===null||e===void 0?void 0:e.optimize,wt=Q===!0||Q===void 0?1:Q||0,dn=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:hL,pn=(o=t.uriResolver)!==null&&o!==void 0?o:bQ.default;return{strictSchema:(s=(i=t.strictSchema)!==null&&i!==void 0?i:oe)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:oe)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:oe)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:oe)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:oe)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:wt,regExp:dn}:{optimize:wt,regExp:dn},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:dL,loopEnum:(_=t.loopEnum)!==null&&_!==void 0?_:dL,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(x=t.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(k=t.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(F=t.validateSchema)!==null&&F!==void 0?F:!0,validateFormats:(J=t.validateFormats)!==null&&J!==void 0?J:!0,unicodeRegExp:(w=t.unicodeRegExp)!==null&&w!==void 0?w:!0,int32range:(Z=t.int32range)!==null&&Z!==void 0?Z:!0,uriResolver:pn}}var Hf=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...SQ(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new vQ.ValueScope({scope:{},prefixes:xQ,es5:r,lines:n}),this.logger=PQ(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,yQ.getRules)(),pL.call(this,$Q,e,"NOT SUPPORTED"),pL.call(this,IQ,e,"DEPRECATED","warn"),this._metaOpts=AQ.call(this),e.formats&&TQ.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&EQ.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),kQ.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=lL;n==="id"&&(o={...lL},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await i.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||s.call(this,f)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof mL.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,o);return this}let i;if(typeof e=="object"){let{schemaId:s}=this.opts;if(i=e[s],i!==void 0&&typeof i!="string")throw new Error(`schema ${s} must be string`)}return r=(0,Kf.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(e){let r;for(;typeof(r=fL.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Gf.SchemaEnv({schema:{},schemaId:n});if(r=Gf.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=fL.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Kf.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(RQ.call(this,n,r),!r)return(0,Ok.eachItem)(n,i=>Ak.call(this,i)),this;zQ.call(this,r);let o={...r,type:(0,fb.getJSONTypes)(r.type),schemaType:(0,fb.getJSONTypes)(r.schemaType)};return(0,Ok.eachItem)(n,o.type.length===0?i=>Ak.call(this,i,o):i=>o.type.forEach(s=>Ak.call(this,i,o,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let i=o.split("/").slice(1),s=e;for(let a of i)s=s[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=s[a];u&&l&&(s[a]=gL(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Kf.normalizeId)(s||n);let u=Kf.getSchemaRefs.call(this,e,n);return c=new Gf.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Gf.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Gf.compileSchema.call(this,e)}finally{this.opts=r}}};Hf.ValidationError=_Q.default;Hf.MissingRefError=mL.default;Xt.default=Hf;function pL(t,e,r,n="error"){for(let o in t){let i=o;i in e&&this.logger[n](`${r}: option ${o}. ${t[i]}`)}}function fL(t){return t=(0,Kf.normalizeId)(t),this.schemas[t]||this.refs[t]}function kQ(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function TQ(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function EQ(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function AQ(){let t={...this.opts};for(let e of wQ)delete t[e];return t}var OQ={log(){},warn(){},error(){}};function PQ(t){if(t===!1)return OQ;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var CQ=/^[a-z_$][a-z0-9_$:-]*$/i;function RQ(t,e){let{RULES:r}=this;if((0,Ok.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!CQ.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Ak(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=o?i.post:i.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,fb.getJSONTypes)(e.type),schemaType:(0,fb.getJSONTypes)(e.schemaType)}};e.before?NQ.call(this,s,a,e.before):s.rules.push(a),i.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function NQ(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function zQ(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=gL(e)),t.validateSchema=this.compile(e,!0))}var MQ={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function gL(t){return{anyOf:[t,MQ]}}});var yL=P(Pk=>{"use strict";Object.defineProperty(Pk,"__esModule",{value:!0});var jQ={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Pk.default=jQ});var xL=P(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.callRef=sc.getValidate=void 0;var DQ=qf(),vL=En(),qr=Oe(),Rl=fi(),bL=cb(),mb=Be(),LQ={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:i,validateName:s,opts:a,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=bL.resolveRef.call(c,u,o,r);if(l===void 0)throw new DQ.default(n.opts.uriResolver,o,r);if(l instanceof bL.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return hb(t,s,i,i.$async);let m=e.scopeValue("root",{ref:u});return hb(t,(0,qr._)`${m}.validate`,u,u.$async)}function f(m){let h=wL(t,m);hb(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,qr.stringify)(m)}:{ref:m}),_=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:qr.nil,topSchemaRef:h,errSchemaPath:r},_);t.mergeEvaluated(v),t.ok(_)}}};function wL(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,qr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}sc.getValidate=wL;function hb(t,e,r,n){let{gen:o,it:i}=t,{allErrors:s,schemaEnv:a,opts:c}=i,u=c.passContext?Rl.default.this:qr.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{o.code((0,qr._)`await ${(0,vL.callValidateCode)(t,e,u)}`),p(e),s||o.assign(m,!0)},h=>{o.if((0,qr._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),f(h),s||o.assign(m,!1)}),t.ok(m)}function d(){t.result((0,vL.callValidateCode)(t,e,u),()=>p(e),()=>f(e))}function f(m){let h=(0,qr._)`${m}.errors`;o.assign(Rl.default.vErrors,(0,qr._)`${Rl.default.vErrors} === null ? ${h} : ${Rl.default.vErrors}.concat(${h})`),o.assign(Rl.default.errors,(0,qr._)`${Rl.default.vErrors}.length`)}function p(m){var h;if(!i.opts.unevaluated)return;let _=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(i.props=mb.mergeEvaluated.props(o,_.props,i.props));else{let v=o.var("props",(0,qr._)`${m}.evaluated.props`);i.props=mb.mergeEvaluated.props(o,v,i.props,qr.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=mb.mergeEvaluated.items(o,_.items,i.items));else{let v=o.var("items",(0,qr._)`${m}.evaluated.items`);i.items=mb.mergeEvaluated.items(o,v,i.items,qr.Name)}}}sc.callRef=hb;sc.default=LQ});var $L=P(Ck=>{"use strict";Object.defineProperty(Ck,"__esModule",{value:!0});var UQ=yL(),FQ=xL(),BQ=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",UQ.default,FQ.default];Ck.default=BQ});var IL=P(Rk=>{"use strict";Object.defineProperty(Rk,"__esModule",{value:!0});var gb=Oe(),$s=gb.operators,_b={maximum:{okStr:"<=",ok:$s.LTE,fail:$s.GT},minimum:{okStr:">=",ok:$s.GTE,fail:$s.LT},exclusiveMaximum:{okStr:"<",ok:$s.LT,fail:$s.GTE},exclusiveMinimum:{okStr:">",ok:$s.GT,fail:$s.LTE}},ZQ={message:({keyword:t,schemaCode:e})=>(0,gb.str)`must be ${_b[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,gb._)`{comparison: ${_b[t].okStr}, limit: ${e}}`},qQ={keyword:Object.keys(_b),type:"number",schemaType:"number",$data:!0,error:ZQ,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,gb._)`${r} ${_b[e].fail} ${n} || isNaN(${r})`)}};Rk.default=qQ});var SL=P(Nk=>{"use strict";Object.defineProperty(Nk,"__esModule",{value:!0});var Wf=Oe(),VQ={message:({schemaCode:t})=>(0,Wf.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Wf._)`{multipleOf: ${t}}`},GQ={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:VQ,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,i=o.opts.multipleOfPrecision,s=e.let("res"),a=i?(0,Wf._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:(0,Wf._)`${s} !== parseInt(${s})`;t.fail$data((0,Wf._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};Nk.default=GQ});var TL=P(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});function kL(t){let e=t.length,r=0,n=0,o;for(;n=55296&&o<=56319&&n{"use strict";Object.defineProperty(Mk,"__esModule",{value:!0});var ac=Oe(),KQ=Be(),HQ=TL(),WQ={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,ac.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,ac._)`{limit: ${t}}`},JQ={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:WQ,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,i=e==="maxLength"?ac.operators.GT:ac.operators.LT,s=o.opts.unicode===!1?(0,ac._)`${r}.length`:(0,ac._)`${(0,KQ.useFunc)(t.gen,HQ.default)}(${r})`;t.fail$data((0,ac._)`${s} ${i} ${n}`)}};Mk.default=JQ});var AL=P(jk=>{"use strict";Object.defineProperty(jk,"__esModule",{value:!0});var XQ=En(),yb=Oe(),YQ={message:({schemaCode:t})=>(0,yb.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,yb._)`{pattern: ${t}}`},QQ={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:YQ,code(t){let{data:e,$data:r,schema:n,schemaCode:o,it:i}=t,s=i.opts.unicodeRegExp?"u":"",a=r?(0,yb._)`(new RegExp(${o}, ${s}))`:(0,XQ.usePattern)(t,n);t.fail$data((0,yb._)`!${a}.test(${e})`)}};jk.default=QQ});var OL=P(Dk=>{"use strict";Object.defineProperty(Dk,"__esModule",{value:!0});var Jf=Oe(),eee={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Jf.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Jf._)`{limit: ${t}}`},tee={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:eee,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Jf.operators.GT:Jf.operators.LT;t.fail$data((0,Jf._)`Object.keys(${r}).length ${o} ${n}`)}};Dk.default=tee});var PL=P(Lk=>{"use strict";Object.defineProperty(Lk,"__esModule",{value:!0});var Xf=En(),Yf=Oe(),ree=Be(),nee={message:({params:{missingProperty:t}})=>(0,Yf.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Yf._)`{missingProperty: ${t}}`},oee={keyword:"required",type:"object",schemaType:"array",$data:!0,error:nee,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:i,it:s}=t,{opts:a}=s;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?u():l(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let _=s.schemaEnv.baseId+s.errSchemaPath,v=`required property "${h}" is not defined at "${_}" (strictRequired)`;(0,ree.checkStrictMode)(s,v,s.opts.strictRequired)}}function u(){if(c||i)t.block$data(Yf.nil,d);else for(let p of r)(0,Xf.checkReportMissingProp)(t,p)}function l(){let p=e.let("missing");if(c||i){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,Xf.checkMissingProp)(t,r,p)),(0,Xf.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Xf.noPropertyInData)(e,o,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,Xf.propertyInData)(e,o,p,a.ownProperties)),e.if((0,Yf.not)(m),()=>{t.error(),e.break()})},Yf.nil)}}};Lk.default=oee});var CL=P(Uk=>{"use strict";Object.defineProperty(Uk,"__esModule",{value:!0});var Qf=Oe(),iee={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Qf.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Qf._)`{limit: ${t}}`},see={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:iee,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Qf.operators.GT:Qf.operators.LT;t.fail$data((0,Qf._)`${r}.length ${o} ${n}`)}};Uk.default=see});var vb=P(Fk=>{"use strict";Object.defineProperty(Fk,"__esModule",{value:!0});var RL=dk();RL.code='require("ajv/dist/runtime/equal").default';Fk.default=RL});var NL=P(Zk=>{"use strict";Object.defineProperty(Zk,"__esModule",{value:!0});var Bk=Lf(),Yt=Oe(),aee=Be(),cee=vb(),uee={message:({params:{i:t,j:e}})=>(0,Yt.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Yt._)`{i: ${t}, j: ${e}}`},lee={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:uee,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:i,schemaCode:s,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=i.items?(0,Bk.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Yt._)`${s} === false`),t.ok(c);function l(){let m=e.let("i",(0,Yt._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,Yt._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,h){let _=e.name("item"),v=(0,Bk.checkDataTypes)(u,_,a.opts.strictNumbers,Bk.DataType.Wrong),b=e.const("indices",(0,Yt._)`{}`);e.for((0,Yt._)`;${m}--;`,()=>{e.let(_,(0,Yt._)`${r}[${m}]`),e.if(v,(0,Yt._)`continue`),u.length>1&&e.if((0,Yt._)`typeof ${_} == "string"`,(0,Yt._)`${_} += "_"`),e.if((0,Yt._)`typeof ${b}[${_}] == "number"`,()=>{e.assign(h,(0,Yt._)`${b}[${_}]`),t.error(),e.assign(c,!1).break()}).code((0,Yt._)`${b}[${_}] = ${m}`)})}function p(m,h){let _=(0,aee.useFunc)(e,cee.default),v=e.name("outer");e.label(v).for((0,Yt._)`;${m}--;`,()=>e.for((0,Yt._)`${h} = ${m}; ${h}--;`,()=>e.if((0,Yt._)`${_}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Zk.default=lee});var zL=P(Vk=>{"use strict";Object.defineProperty(Vk,"__esModule",{value:!0});var qk=Oe(),dee=Be(),pee=vb(),fee={message:"must be equal to constant",params:({schemaCode:t})=>(0,qk._)`{allowedValue: ${t}}`},mee={keyword:"const",$data:!0,error:fee,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,qk._)`!${(0,dee.useFunc)(e,pee.default)}(${r}, ${o})`):t.fail((0,qk._)`${i} !== ${r}`)}};Vk.default=mee});var ML=P(Gk=>{"use strict";Object.defineProperty(Gk,"__esModule",{value:!0});var em=Oe(),hee=Be(),gee=vb(),_ee={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,em._)`{allowedValues: ${t}}`},yee={keyword:"enum",schemaType:"array",$data:!0,error:_ee,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:s}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=s.opts.loopEnum,c,u=()=>c??(c=(0,hee.useFunc)(e,gee.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let p=e.const("vSchema",i);l=(0,em.or)(...o.map((m,h)=>f(p,h)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,p=>e.if((0,em._)`${u()}(${r}, ${p})`,()=>e.assign(l,!0).break()))}function f(p,m){let h=o[m];return typeof h=="object"&&h!==null?(0,em._)`${u()}(${r}, ${p}[${m}])`:(0,em._)`${r} === ${h}`}}};Gk.default=yee});var jL=P(Kk=>{"use strict";Object.defineProperty(Kk,"__esModule",{value:!0});var vee=IL(),bee=SL(),wee=EL(),xee=AL(),$ee=OL(),Iee=PL(),See=CL(),kee=NL(),Tee=zL(),Eee=ML(),Aee=[vee.default,bee.default,wee.default,xee.default,$ee.default,Iee.default,See.default,kee.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Tee.default,Eee.default];Kk.default=Aee});var Wk=P(tm=>{"use strict";Object.defineProperty(tm,"__esModule",{value:!0});tm.validateAdditionalItems=void 0;var cc=Oe(),Hk=Be(),Oee={message:({params:{len:t}})=>(0,cc.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,cc._)`{limit: ${t}}`},Pee={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Oee,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Hk.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}DL(t,n)}};function DL(t,e){let{gen:r,schema:n,data:o,keyword:i,it:s}=t;s.items=!0;let a=r.const("len",(0,cc._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,cc._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Hk.alwaysValidSchema)(s,n)){let u=r.var("valid",(0,cc._)`${a} <= ${e.length}`);r.if((0,cc.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:Hk.Type.Num},u),s.allErrors||r.if((0,cc.not)(u),()=>r.break())})}}tm.validateAdditionalItems=DL;tm.default=Pee});var Jk=P(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});rm.validateTuple=void 0;var LL=Oe(),bb=Be(),Cee=En(),Ree={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return UL(t,"additionalItems",e);r.items=!0,!(0,bb.alwaysValidSchema)(r,e)&&t.ok((0,Cee.validateArray)(t))}};function UL(t,e,r=t.schema){let{gen:n,parentSchema:o,data:i,keyword:s,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=bb.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,LL._)`${i}.length`);r.forEach((d,f)=>{(0,bb.alwaysValidSchema)(a,d)||(n.if((0,LL._)`${u} > ${f}`,()=>t.subschema({keyword:s,schemaProp:f,dataProp:f},c)),t.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let _=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,bb.checkStrictMode)(a,_,f.strictTuples)}}}rm.validateTuple=UL;rm.default=Ree});var FL=P(Xk=>{"use strict";Object.defineProperty(Xk,"__esModule",{value:!0});var Nee=Jk(),zee={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Nee.validateTuple)(t,"items")};Xk.default=zee});var ZL=P(Yk=>{"use strict";Object.defineProperty(Yk,"__esModule",{value:!0});var BL=Oe(),Mee=Be(),jee=En(),Dee=Wk(),Lee={message:({params:{len:t}})=>(0,BL.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,BL._)`{limit: ${t}}`},Uee={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Lee,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,Mee.alwaysValidSchema)(n,e)&&(o?(0,Dee.validateAdditionalItems)(t,o):t.ok((0,jee.validateArray)(t)))}};Yk.default=Uee});var qL=P(Qk=>{"use strict";Object.defineProperty(Qk,"__esModule",{value:!0});var On=Oe(),wb=Be(),Fee={message:({params:{min:t,max:e}})=>e===void 0?(0,On.str)`must contain at least ${t} valid item(s)`:(0,On.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,On._)`{minContains: ${t}}`:(0,On._)`{minContains: ${t}, maxContains: ${e}}`},Bee={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Fee,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t,s,a,{minContains:c,maxContains:u}=n;i.opts.next?(s=c===void 0?1:c,a=u):s=1;let l=e.const("len",(0,On._)`${o}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,wb.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,wb.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,wb.alwaysValidSchema)(i,r)){let h=(0,On._)`${l} >= ${s}`;a!==void 0&&(h=(0,On._)`${h} && ${l} <= ${a}`),t.pass(h);return}i.items=!0;let d=e.name("valid");a===void 0&&s===1?p(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,On._)`${o}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),_=e.let("count",0);p(h,()=>e.if(h,()=>m(_)))}function p(h,_){e.forRange("i",0,l,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:wb.Type.Num,compositeRule:!0},h),_()})}function m(h){e.code((0,On._)`${h}++`),a===void 0?e.if((0,On._)`${h} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,On._)`${h} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,On._)`${h} >= ${s}`,()=>e.assign(d,!0)))}}};Qk.default=Bee});var KL=P(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.validateSchemaDeps=Po.validatePropertyDeps=Po.error=void 0;var eT=Oe(),Zee=Be(),nm=En();Po.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,eT.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,eT._)`{property: ${t}, + missingProperty: ${n}, + depsCount: ${e}, + deps: ${r}}`};var qee={keyword:"dependencies",type:"object",schemaType:"object",error:Po.error,code(t){let[e,r]=Vee(t);VL(t,e),GL(t,r)}};function Vee({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function VL(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let c=(0,nm.propertyInData)(r,n,s,o.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,nm.checkReportMissingProp)(t,u)}):(r.if((0,eT._)`${c} && (${(0,nm.checkMissingProp)(t,a,i)})`),(0,nm.reportMissingProp)(t,i),r.else())}}Po.validatePropertyDeps=VL;function GL(t,e=t.schema){let{gen:r,data:n,keyword:o,it:i}=t,s=r.name("valid");for(let a in e)(0,Zee.alwaysValidSchema)(i,e[a])||(r.if((0,nm.propertyInData)(r,n,a,i.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},s);t.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),t.ok(s))}Po.validateSchemaDeps=GL;Po.default=qee});var WL=P(tT=>{"use strict";Object.defineProperty(tT,"__esModule",{value:!0});var HL=Oe(),Gee=Be(),Kee={message:"property name must be valid",params:({params:t})=>(0,HL._)`{propertyName: ${t.propertyName}}`},Hee={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Kee,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,Gee.alwaysValidSchema)(o,r))return;let i=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),e.if((0,HL.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};tT.default=Hee});var nT=P(rT=>{"use strict";Object.defineProperty(rT,"__esModule",{value:!0});var xb=En(),eo=Oe(),Wee=fi(),$b=Be(),Jee={message:"must NOT have additional properties",params:({params:t})=>(0,eo._)`{additionalProperty: ${t.additionalProperty}}`},Xee={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Jee,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,$b.alwaysValidSchema)(s,r))return;let u=(0,xb.allSchemaProperties)(n.properties),l=(0,xb.allSchemaProperties)(n.patternProperties);d(),t.ok((0,eo._)`${i} === ${Wee.default.errors}`);function d(){e.forIn("key",o,_=>{!u.length&&!l.length?m(_):e.if(f(_),()=>m(_))})}function f(_){let v;if(u.length>8){let b=(0,$b.schemaRefOrVal)(s,n.properties,"properties");v=(0,xb.isOwnProperty)(e,b,_)}else u.length?v=(0,eo.or)(...u.map(b=>(0,eo._)`${_} === ${b}`)):v=eo.nil;return l.length&&(v=(0,eo.or)(v,...l.map(b=>(0,eo._)`${(0,xb.usePattern)(t,b)}.test(${_})`))),(0,eo.not)(v)}function p(_){e.code((0,eo._)`delete ${o}[${_}]`)}function m(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(_);return}if(r===!1){t.setParams({additionalProperty:_}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,$b.alwaysValidSchema)(s,r)){let v=e.name("valid");c.removeAdditional==="failing"?(h(_,v,!1),e.if((0,eo.not)(v),()=>{t.reset(),p(_)})):(h(_,v),a||e.if((0,eo.not)(v),()=>e.break()))}}function h(_,v,b){let x={keyword:"additionalProperties",dataProp:_,dataPropType:$b.Type.Str};b===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,v)}}};rT.default=Xee});var YL=P(iT=>{"use strict";Object.defineProperty(iT,"__esModule",{value:!0});var Yee=Zf(),JL=En(),oT=Be(),XL=nT(),Qee={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&XL.default.code(new Yee.KeywordCxt(i,XL.default,"additionalProperties"));let s=(0,JL.allSchemaProperties)(r);for(let d of s)i.definedProperties.add(d);i.opts.unevaluated&&s.length&&i.props!==!0&&(i.props=oT.mergeEvaluated.props(e,(0,oT.toHash)(s),i.props));let a=s.filter(d=>!(0,oT.alwaysValidSchema)(i,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,JL.propertyInData)(e,o,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};iT.default=Qee});var rU=P(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0});var QL=En(),Ib=Oe(),eU=Be(),tU=Be(),ete={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:i}=t,{opts:s}=i,a=(0,QL.allSchemaProperties)(r),c=a.filter(h=>(0,eU.alwaysValidSchema)(i,r[h]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&o.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof Ib.Name)&&(i.props=(0,tU.evaluatedPropsToName)(e,i.props));let{props:d}=i;f();function f(){for(let h of a)u&&p(h),i.allErrors?m(h):(e.var(l,!0),m(h),e.if(l))}function p(h){for(let _ in u)new RegExp(h).test(_)&&(0,eU.checkStrictMode)(i,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,_=>{e.if((0,Ib._)`${(0,QL.usePattern)(t,h)}.test(${_})`,()=>{let v=c.includes(h);v||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:tU.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,Ib._)`${d}[${_}]`,!0):!v&&!i.allErrors&&e.if((0,Ib.not)(l),()=>e.break())})})}}};sT.default=ete});var nU=P(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});var tte=Be(),rte={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,tte.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};aT.default=rte});var oU=P(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});var nte=En(),ote={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:nte.validateUnion,error:{message:"must match a schema in anyOf"}};cT.default=ote});var iU=P(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});var Sb=Oe(),ite=Be(),ste={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Sb._)`{passingSchemas: ${t.passing}}`},ate={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:ste,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,s=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(s,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let f;(0,ite.alwaysValidSchema)(o,l)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Sb._)`${c} && ${s}`).assign(s,!1).assign(a,(0,Sb._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(s,!0),e.assign(a,d),f&&t.mergeEvaluated(f,Sb.Name)})})}}};uT.default=ate});var sU=P(lT=>{"use strict";Object.defineProperty(lT,"__esModule",{value:!0});var cte=Be(),ute={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((i,s)=>{if((0,cte.alwaysValidSchema)(n,i))return;let a=t.subschema({keyword:"allOf",schemaProp:s},o);t.ok(o),t.mergeEvaluated(a)})}};lT.default=ute});var uU=P(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0});var kb=Oe(),cU=Be(),lte={message:({params:t})=>(0,kb.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,kb._)`{failingKeyword: ${t.ifClause}}`},dte={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:lte,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,cU.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=aU(n,"then"),i=aU(n,"else");if(!o&&!i)return;let s=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else o?e.if(a,u("then")):e.if((0,kb.not)(a),u("else"));t.pass(s,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let f=t.subschema({keyword:l},a);e.assign(s,a),t.mergeValidEvaluated(f,s),d?e.assign(d,(0,kb._)`${l}`):t.setParams({ifClause:l})}}}};function aU(t,e){let r=t.schema[e];return r!==void 0&&!(0,cU.alwaysValidSchema)(t,r)}dT.default=dte});var lU=P(pT=>{"use strict";Object.defineProperty(pT,"__esModule",{value:!0});var pte=Be(),fte={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,pte.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};pT.default=fte});var dU=P(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});var mte=Wk(),hte=FL(),gte=Jk(),_te=ZL(),yte=qL(),vte=KL(),bte=WL(),wte=nT(),xte=YL(),$te=rU(),Ite=nU(),Ste=oU(),kte=iU(),Tte=sU(),Ete=uU(),Ate=lU();function Ote(t=!1){let e=[Ite.default,Ste.default,kte.default,Tte.default,Ete.default,Ate.default,bte.default,wte.default,vte.default,xte.default,$te.default];return t?e.push(hte.default,_te.default):e.push(mte.default,gte.default),e.push(yte.default),e}fT.default=Ote});var pU=P(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});var kt=Oe(),Pte={message:({schemaCode:t})=>(0,kt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,kt._)`{format: ${t}}`},Cte={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Pte,code(t,e){let{gen:r,data:n,$data:o,schema:i,schemaCode:s,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,kt._)`${m}[${s}]`),_=r.let("fType"),v=r.let("format");r.if((0,kt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(_,(0,kt._)`${h}.type || "string"`).assign(v,(0,kt._)`${h}.validate`),()=>r.assign(_,(0,kt._)`"string"`).assign(v,h)),t.fail$data((0,kt.or)(b(),x()));function b(){return c.strictSchema===!1?kt.nil:(0,kt._)`${s} && !${v}`}function x(){let k=l.$async?(0,kt._)`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,kt._)`${v}(${n})`,T=(0,kt._)`(typeof ${v} == "function" ? ${k} : ${v}.test(${n}))`;return(0,kt._)`${v} && ${v} !== true && ${_} === ${e} && !${T}`}}function p(){let m=d.formats[i];if(!m){b();return}if(m===!0)return;let[h,_,v]=x(m);h===e&&t.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function x(T){let F=T instanceof RegExp?(0,kt.regexpCode)(T):c.code.formats?(0,kt._)`${c.code.formats}${(0,kt.getProperty)(i)}`:void 0,J=r.scopeValue("formats",{key:i,ref:T,code:F});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,kt._)`${J}.validate`]:["string",T,J]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,kt._)`await ${v}(${n})`}return typeof _=="function"?(0,kt._)`${v}(${n})`:(0,kt._)`${v}.test(${n})`}}}};mT.default=Cte});var fU=P(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});var Rte=pU(),Nte=[Rte.default];hT.default=Nte});var mU=P(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.contentVocabulary=Nl.metadataVocabulary=void 0;Nl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Nl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var gU=P(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});var zte=$L(),Mte=jL(),jte=dU(),Dte=fU(),hU=mU(),Lte=[zte.default,Mte.default,(0,jte.default)(),Dte.default,hU.metadataVocabulary,hU.contentVocabulary];gT.default=Lte});var yU=P(Tb=>{"use strict";Object.defineProperty(Tb,"__esModule",{value:!0});Tb.DiscrError=void 0;var _U;(function(t){t.Tag="tag",t.Mapping="mapping"})(_U||(Tb.DiscrError=_U={}))});var bU=P(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});var zl=Oe(),_T=yU(),vU=cb(),Ute=qf(),Fte=Be(),Bte={message:({params:{discrError:t,tagName:e}})=>t===_T.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,zl._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},Zte={keyword:"discriminator",type:"object",schemaType:"object",error:Bte,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:i}=t,{oneOf:s}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,zl._)`${r}${(0,zl.getProperty)(a)}`);e.if((0,zl._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:_T.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,zl._)`${u} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:_T.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(h,zl.Name),m}function f(){var p;let m={},h=v(o),_=!0;for(let k=0;k{qte.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var bT=P((lt,vT)=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.MissingRefError=lt.ValidationError=lt.CodeGen=lt.Name=lt.nil=lt.stringify=lt.str=lt._=lt.KeywordCxt=lt.Ajv=void 0;var Vte=_L(),Gte=gU(),Kte=bU(),xU=wU(),Hte=["/properties"],Eb="http://json-schema.org/draft-07/schema",Ml=class extends Vte.default{_addVocabularies(){super._addVocabularies(),Gte.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Kte.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(xU,Hte):xU;this.addMetaSchema(e,Eb,!1),this.refs["http://json-schema.org/schema"]=Eb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Eb)?Eb:void 0)}};lt.Ajv=Ml;vT.exports=lt=Ml;vT.exports.Ajv=Ml;Object.defineProperty(lt,"__esModule",{value:!0});lt.default=Ml;var Wte=Zf();Object.defineProperty(lt,"KeywordCxt",{enumerable:!0,get:function(){return Wte.KeywordCxt}});var jl=Oe();Object.defineProperty(lt,"_",{enumerable:!0,get:function(){return jl._}});Object.defineProperty(lt,"str",{enumerable:!0,get:function(){return jl.str}});Object.defineProperty(lt,"stringify",{enumerable:!0,get:function(){return jl.stringify}});Object.defineProperty(lt,"nil",{enumerable:!0,get:function(){return jl.nil}});Object.defineProperty(lt,"Name",{enumerable:!0,get:function(){return jl.Name}});Object.defineProperty(lt,"CodeGen",{enumerable:!0,get:function(){return jl.CodeGen}});var Jte=sb();Object.defineProperty(lt,"ValidationError",{enumerable:!0,get:function(){return Jte.default}});var Xte=qf();Object.defineProperty(lt,"MissingRefError",{enumerable:!0,get:function(){return Xte.default}})});var OU=P(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.formatNames=Ro.fastFormats=Ro.fullFormats=void 0;function Co(t,e){return{validate:t,compare:e}}Ro.fullFormats={date:Co(kU,IT),time:Co(xT(!0),ST),"date-time":Co($U(!0),EU),"iso-time":Co(xT(),TU),"iso-date-time":Co($U(),AU),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:nre,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:lre,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:ore,int32:{type:"number",validate:are},int64:{type:"number",validate:cre},float:{type:"number",validate:SU},double:{type:"number",validate:SU},password:!0,binary:!0};Ro.fastFormats={...Ro.fullFormats,date:Co(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,IT),time:Co(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ST),"date-time":Co(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,EU),"iso-time":Co(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,TU),"iso-date-time":Co(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,AU),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Ro.formatNames=Object.keys(Ro.fullFormats);function Yte(t){return t%4===0&&(t%100!==0||t%400===0)}var Qte=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,ere=[0,31,28,31,30,31,30,31,31,30,31,30,31];function kU(t){let e=Qte.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&Yte(r)?29:ere[n])}function IT(t,e){if(t&&e)return t>e?1:t23||l>59||t&&!a)return!1;if(o<=23&&i<=59&&s<60)return!0;let d=i-l*c,f=o-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&s<61}}function ST(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function TU(t,e){if(!(t&&e))return;let r=wT.exec(t),n=wT.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t=ire}function cre(t){return Number.isInteger(t)}function SU(){return!0}var ure=/[^\\]\\Z/;function lre(t){if(ure.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var PU=P(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.formatLimitDefinition=void 0;var dre=bT(),to=Oe(),Is=to.operators,Ab={formatMaximum:{okStr:"<=",ok:Is.LTE,fail:Is.GT},formatMinimum:{okStr:">=",ok:Is.GTE,fail:Is.LT},formatExclusiveMaximum:{okStr:"<",ok:Is.LT,fail:Is.GTE},formatExclusiveMinimum:{okStr:">",ok:Is.GT,fail:Is.LTE}},pre={message:({keyword:t,schemaCode:e})=>(0,to.str)`should be ${Ab[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,to._)`{comparison: ${Ab[t].okStr}, limit: ${e}}`};Dl.formatLimitDefinition={keyword:Object.keys(Ab),type:"string",schemaType:"string",$data:!0,error:pre,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:i}=t,{opts:s,self:a}=i;if(!s.validateFormats)return;let c=new dre.KeywordCxt(i,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),p=e.const("fmt",(0,to._)`${f}[${c.schemaCode}]`);t.fail$data((0,to.or)((0,to._)`typeof ${p} != "object"`,(0,to._)`${p} instanceof RegExp`,(0,to._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${f}" does not define "compare" function`);let m=e.scopeValue("formats",{key:f,ref:p,code:s.code.formats?(0,to._)`${s.code.formats}${(0,to.getProperty)(f)}`:void 0});t.fail$data(d(m))}function d(f){return(0,to._)`${f}.compare(${r}, ${n}) ${Ab[o].fail} 0`}},dependencies:["format"]};var fre=t=>(t.addKeyword(Dl.formatLimitDefinition),t);Dl.default=fre});var zU=P((om,NU)=>{"use strict";Object.defineProperty(om,"__esModule",{value:!0});var Ll=OU(),mre=PU(),kT=Oe(),CU=new kT.Name("fullFormats"),hre=new kT.Name("fastFormats"),TT=(t,e={keywords:!0})=>{if(Array.isArray(e))return RU(t,e,Ll.fullFormats,CU),t;let[r,n]=e.mode==="fast"?[Ll.fastFormats,hre]:[Ll.fullFormats,CU],o=e.formats||Ll.formatNames;return RU(t,o,r,n),e.keywords&&(0,mre.default)(t),t};TT.get=(t,e="full")=>{let n=(e==="fast"?Ll.fastFormats:Ll.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function RU(t,e,r,n){var o,i;(o=(i=t.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,kT._)`require("ajv-formats/dist/formats").${n}`);for(let s of e)t.addFormat(s,r[s])}NU.exports=om=TT;Object.defineProperty(om,"__esModule",{value:!0});om.default=TT});var Mb={PRETTY:4,COMPACT:0};var Ke={TRACE:6,DEBUG:8,INFO:12,WARN:16,ERROR:20,CRITICAL:24,SILENT:28},OT=["level","message","sampling_rate","service","timestamp"],PT="Uncaught error detected, flushing log buffer before exit";var ql={REQUEST_ID:Symbol.for("_AWS_LAMBDA_REQUEST_ID"),X_RAY_TRACE_ID:Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),TENANT_ID:Symbol.for("_AWS_LAMBDA_TENANT_ID")},jb=["true","1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??"");jb||(globalThis.awslambda=globalThis.awslambda||{});var sm=class{static PROTECTED_KEYS=ql;isProtectedKey(e){return Object.values(ql).includes(e)}getRequestId(){return this.get(ql.REQUEST_ID)??"-"}getXRayTraceId(){return this.get(ql.X_RAY_TRACE_ID)}getTenantId(){return this.get(ql.TENANT_ID)}},Db=class extends sm{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==void 0}get(e){return this.currentContext?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);this.currentContext=this.currentContext||{},this.currentContext[e]=r}run(e,r){this.currentContext=e;try{return r()}finally{this.currentContext=void 0}}},Lb=class t extends sm{als;static async create(){let e=new t,r=await import("node:async_hooks");return e.als=new r.AsyncLocalStorage,e}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==void 0}get(e){return this.als.getStore()?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);let n=this.als.getStore();if(!n)throw new Error("No context available");n[e]=r}run(e,r){return this.als.run(e,r)}},CT;(function(t){let e=null;async function r(){return e||(e=(async()=>{let o="AWS_LAMBDA_MAX_CONCURRENCY"in process.env?await Lb.create():new Db;return!jb&&globalThis.awslambda?.InvokeStore?globalThis.awslambda.InvokeStore:(!jb&&globalThis.awslambda&&(globalThis.awslambda.InvokeStore=o),o)})()),e}t.getInstanceAsync=r,t._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE==="1"?{reset:()=>{e=null,globalThis.awslambda?.InvokeStore&&delete globalThis.awslambda.InvokeStore,globalThis.awslambda={}}}:void 0})(CT||(CT={}));var RT="AWS_LAMBDA_MAX_CONCURRENCY",NT="POWERTOOLS_DEV";var zT="_X_AMZN_TRACE_ID";var Vr=({key:t,defaultValue:e,errorMessage:r})=>{let n=process.env[t];if(n===void 0){if(e!==void 0)return e;throw r?new Error(r):new Error(`Environment variable ${t} is required`)}return n.trim()},MT=({key:t,defaultValue:e,errorMessage:r})=>{let n=Vr({key:t,defaultValue:String(e),errorMessage:r}),o=Number(n);if(Number.isNaN(o))throw new TypeError(`Environment variable ${t} must be a number`);return o},KU=new Set(["1","y","yes","t","true","on"]),HU=new Set(["0","n","no","f","false","off"]),Ub=({key:t,defaultValue:e,errorMessage:r,extendedParsing:n})=>{let i=Vr({key:t,defaultValue:String(e),errorMessage:r}).toLowerCase();if(n){if(KU.has(i))return!0;if(HU.has(i))return!1}if(i!=="true"&&i!=="false")throw new Error(`Environment variable ${t} must be a boolean`);return i==="true"},Vl=()=>{try{return Ub({key:NT,extendedParsing:!0})}catch{return!1}};var WU=()=>{let t=globalThis.awslambda?.InvokeStore?.getXRayTraceId()??Vr({key:zT,defaultValue:""});if(t==="")return;if(!t.includes("="))return{Root:t};let e={};for(let r of t.split(";")){let[n,o]=r.split("=");e[n]=o}return e};var am=()=>Vr({key:RT,defaultValue:""})!=="",Gl=()=>WU()?.Root;var Es=class{formatError(e){let{name:r,message:n,stack:o,cause:i,...s}=e,a={name:r,location:this.getCodeLocation(e.stack),message:n,stack:Vl()&&typeof o=="string"?o?.split(` +`):o,cause:i instanceof Error?this.formatError(i):i};for(let c in e)typeof c=="string"&&!["name","message","stack","cause"].includes(c)&&(a[c]=s[c]);return a}formatTimestamp(e){let n=Vr({key:"TZ",defaultValue:""});return n&&!n.includes("UTC")?this.#r(e,n):e.toISOString()}getCodeLocation(e){if(!e)return"";let r=e.split(` +`),n=/\(([^()]*?):(\d+?):(\d+?)\)\\?$/;for(let o of r){let i=n.exec(o);if(Array.isArray(i))return`${i[1]}:${Number(i[2])}`}return""}#e=e=>{let r="2-digit",n=Intl.supportedValuesOf("timeZone").includes(e)?e:"UTC";return new Intl.DateTimeFormat("en",{hourCycle:"h23",year:"numeric",month:r,day:r,hour:r,minute:r,second:r,timeZone:n})};#r(e,r){let{year:n,month:o,day:i,hour:s,minute:a,second:c}=this.#e(r).formatToParts(e).reduce((_,v)=>(_[v.type]=v.value,_),{}),u=`${n}-${o}-${i}T${s}:${a}:${c}`,l=-e.getTimezoneOffset(),d=l>=0?"+":"-",f=Math.abs(Math.floor(l/60)).toString().padStart(2,"0"),p=Math.abs(l%60).toString().padStart(2,"0"),m=e.getMilliseconds().toString().padStart(3,"0"),h=`${d}${f}:${p}`;return`${u}.${m}${h}`}};var dE=mn(Xb(),1),_i=class{attributes={};constructor(e){this.setAttributes(e.attributes)}addAttributes(e){return(0,dE.default)(this.attributes,e),this}getAttributes(){return this.attributes}prepareForPrint(){this.attributes=this.removeEmptyKeys(this.getAttributes())}removeEmptyKeys(e){let r={};for(let n in e)e[n]!==void 0&&e[n]!==""&&e[n]!==null&&(r[n]=e[n]);return r}setAttributes(e){this.attributes=e}};import{Console as B2}from"node:console";import{randomInt as Z2}from"node:crypto";var Yl="2.29.0";var Rre=process.env.AWS_EXECUTION_ENV||"NA";var gm="powertools-for-aws",pE=`${gm}.tracer`,fE=`${gm}.metrics`,mE=`${gm}.logger`,hE=`${gm}.idempotency`;var Yb=t=>typeof t=="string";var gE=t=>Object.is(t,null),Qb=t=>gE(t)||Object.is(t,void 0);var Ql=class{#e;coldStart=!0;defaultServiceName="service_undefined";constructor(){this.#e=this.getInitializationType(),this.#e!=="on-demand"&&(this.coldStart=!1)}getInitializationType(){let e=process.env.AWS_LAMBDA_INITIALIZATION_TYPE?.trim();return e==="on-demand"?"on-demand":e==="provisioned-concurrency"?"provisioned-concurrency":"unknown"}getColdStart(){return this.#e!=="on-demand"?!1:this.coldStart?(this.coldStart=!1,!0):!1}isValidServiceName(e){return typeof e=="string"&&e.trim().length>0}};var _E=process.env.AWS_EXECUTION_ENV||"NA";process.env.AWS_SDK_UA_APP_ID?process.env.AWS_SDK_UA_APP_ID=`${process.env.AWS_SDK_UA_APP_ID}/PT/NO-OP/${Yl}/PTEnv/${_E}`:process.env.AWS_SDK_UA_APP_ID=`PT/NO-OP/${Yl}/PTEnv/${_E}`;var bm=mn(Xb(),1);var _m=class extends Es{#e;constructor(e){super(),this.#e=e?.logRecordOrder}formatAttributes(e,r){let n={level:e.logLevel,message:e.message,timestamp:this.formatTimestamp(e.timestamp),service:e.serviceName,cold_start:e.lambdaContext?.coldStart,function_arn:e.lambdaContext?.invokedFunctionArn,function_memory_size:e.lambdaContext?.memoryLimitInMB,function_name:e.lambdaContext?.functionName,function_request_id:e.lambdaContext?.awsRequestId,sampling_rate:e.sampleRateValue,xray_trace_id:e.xRayTraceId};if(this.#e===void 0)return new _i({attributes:n}).addAttributes(r);let o={};for(let s of this.#e)s in n&&!(s in o)?o[s]=n[s]:s in r&&!(s in o)&&(o[s]=r[s]);for(let s in n)s in o||(o[s]=n[s]);for(let s in r)s in o||(o[s]=r[s]);return new _i({attributes:o})}};var ym=class{#e=Symbol("powertools.logger.temporaryAttributes");#r=Symbol("powertools.logger.keys");#i={};#c=new Map;#n={};#o(){if(!am())return this.#i;if(globalThis.awslambda?.InvokeStore===void 0)throw new Error("InvokeStore is not available");let e=globalThis.awslambda.InvokeStore,r=e.get(this.#e);return r==null&&(r={},e.set(this.#e,r)),r}#t(){if(!am())return this.#c;if(globalThis.awslambda?.InvokeStore===void 0)throw new Error("InvokeStore is not available");let e=globalThis.awslambda.InvokeStore,r=e.get(this.#r);return r==null&&(r=new Map,e.set(this.#r,r)),r}appendTemporaryKeys(e){let r=this.#o(),n=this.#t();for(let[o,i]of Object.entries(e))r[o]=i,n.set(o,"temp")}removeTemporaryKeys(e){let r=this.#o(),n=this.#t();for(let o of e)r[o]=void 0,this.#n[o]?n.set(o,"persistent"):n.delete(o)}getTemporaryAttributes(){return{...this.#o()}}clearTemporaryAttributes(){let e=this.#o(),r=this.#t();for(let n of Object.keys(e))this.#n[n]?r.set(n,"persistent"):r.delete(n);if(!am()){this.#i={};return}globalThis.awslambda.InvokeStore?.set(this.#e,{})}setPersistentAttributes(e){let r=this.#t();this.#n={...e};for(let n of Object.keys(e))r.set(n,"persistent")}getPersistentAttributes(){return{...this.#n}}getAllAttributes(){let e={},r=this.#o(),n=this.#t();for(let[o,i]of Object.entries(this.#n))i!==void 0&&(e[o]=i);for(let[o,i]of n.entries())i==="temp"&&r[o]!==void 0&&(e[o]=r[o]);return e}removePersistentKeys(e){let r=this.#t(),n=this.#o();for(let o of e)this.#n[o]=void 0,n[o]?r.set(o,"temp"):r.delete(o)}};var ew=class{value;logLevel;byteSize;constructor(e,r){if(!Yb(e))throw new Error("Value should be a string");this.value=e,this.logLevel=r,this.byteSize=Buffer.byteLength(e)}},tw=class extends Set{currentBytesSize=0;hasEvictedLog=!1;add(e){return this.currentBytesSize+=e.byteSize,super.add(e),this}delete(e){let r=super.delete(e);return r&&(this.currentBytesSize-=e.byteSize),r}clear(){super.clear(),this.currentBytesSize=0}shift(){let e=this.values().next().value;return e&&this.delete(e),e}},vm=class extends Map{#e;#r;constructor({maxBytesSize:e,onBufferOverflow:r}){super(),this.#e=e,this.#r=r}setItem(e,r,n){let o=new ew(r,n);if(o.byteSize>this.#e)throw new Error("Item too big");let i=this.get(e)||new tw;return i.currentBytesSize!==0&&i.currentBytesSize+o.byteSize>=this.#e&&(this.#i(i,o),this.#r&&this.#r()),i.add(o),super.set(e,i),this}#i(e,r){for(;e.size!==0&&e.currentBytesSize+r.byteSize>=this.#e;)e.shift(),e.hasEvictedLog=!0}};var ed=class t extends Ql{console;customConfigService;logEvent=!1;logFormatter;logIndentation=Mb.COMPACT;logLevel=Ke.INFO;#e;powertoolsLogData={sampleRateValue:0};#r=new ym;#i=[];#c=!1;#n=Ke.INFO;#o;#t={enabled:!1,flushOnErrorLog:!0,maxBytes:20480,bufferAtVerbosity:Ke.DEBUG};#s;#u;#a={sampleRateValue:0,refreshedTimes:0};#p=new Map;get level(){return this.logLevel}constructor(e={}){super();let{customConfigService:r,...n}=e;this.customConfigService=r||void 0,this.setOptions(n),this.#c=!0;for(let[o,i]of this.#i)this.printLog(o,this.createAndPopulateLogItem(...i));this.#i=[]}addContext(e){this.addToPowertoolsLogData({lambdaContext:{invokedFunctionArn:e.invokedFunctionArn,coldStart:this.getColdStart(),awsRequestId:e.awsRequestId,memoryLimitInMB:e.memoryLimitInMB,functionName:e.functionName,functionVersion:e.functionVersion}})}addPersistentLogAttributes(e){this.appendPersistentKeys(e)}appendKeys(e){this.#m(e,"temp")}appendPersistentKeys(e){this.#m(e,"persistent")}createChild(e={}){let r="persistentLogAttributes"in e&&!("persistentKeys"in e)?"persistentLogAttributes":"persistentKeys",n=this.createLogger((0,bm.default)({},{logLevel:this.getLevelName(),serviceName:this.powertoolsLogData.serviceName,sampleRateValue:this.#a.sampleRateValue,logFormatter:this.getLogFormatter(),customConfigService:this.getCustomConfigService(),environment:this.powertoolsLogData.environment,[r]:this.#r.getPersistentAttributes(),jsonReplacerFn:this.#o,correlationIdSearchFn:this.#u,...this.#t.enabled&&{logBufferOptions:{maxBytes:this.#t.maxBytes,bufferAtVerbosity:this.getLogLevelNameFromNumber(this.#t.bufferAtVerbosity),flushOnErrorLog:this.#t.flushOnErrorLog}}},e));this.powertoolsLogData.lambdaContext&&n.addContext(this.powertoolsLogData.lambdaContext);let o=this.#r.getTemporaryAttributes();return Object.keys(o).length>0&&n.appendKeys(o),n}critical(e,...r){this.processLogItem(Ke.CRITICAL,e,r)}debug(e,...r){this.processLogItem(Ke.DEBUG,e,r)}error(e,...r){this.#t.enabled&&this.#t.flushOnErrorLog&&this.flushBuffer(),this.processLogItem(Ke.ERROR,e,r)}getLevelName(){return this.getLogLevelNameFromNumber(this.logLevel)}getLogEvent(){return this.logEvent}getPersistentLogAttributes(){return this.#r.getPersistentAttributes()}info(e,...r){this.processLogItem(Ke.INFO,e,r)}injectLambdaContext(e){return(r,n,o)=>{let i=o.value,s=this;o.value=async function(...a){s.refreshSampleRateCalculation(),s.addContext(a[1]),s.logEventIfEnabled(a[0],e?.logEvent),e?.correlationIdPath&&s.setCorrelationId(a[0],e?.correlationIdPath);try{return await i.apply(this,a)}catch(c){throw e?.flushBufferOnUncaughtError&&(s.flushBuffer(),s.error({message:PT,error:c})),c}finally{(e?.clearState||e?.resetKeys)&&s.resetKeys(),s.clearBuffer()}}}}static injectLambdaContextAfterOrOnError(e,r,n){n&&(n.clearState||n?.resetKeys)&&e.resetKeys()}static injectLambdaContextBefore(e,r,n,o){e.addContext(n),e.logEventIfEnabled(r,o?.logEvent)}logEventIfEnabled(e,r){this.shouldLogEvent(r)&&this.info("Lambda invocation event",{event:e})}refreshSampleRateCalculation(){if(this.#a.refreshedTimes===0){this.#a.refreshedTimes++;return}this.#h()&&this.logLevel>Ke.TRACE?(this.setLogLevel("DEBUG"),this.debug("Setting log level to DEBUG due to sampling rate")):this.setLogLevel(this.getLogLevelNameFromNumber(this.#n))}removeKeys(e){this.#r.removeTemporaryKeys(e)}removePersistentKeys(e){this.#r.removePersistentKeys(e)}removePersistentLogAttributes(e){this.removePersistentKeys(e)}resetKeys(){this.#r.clearTemporaryAttributes()}setLogLevel(e){if(!this.awsLogLevelShortCircuit(e))if(this.isValidLogLevel(e))this.logLevel=Ke[e];else throw new Error(`Invalid log level: ${e}`)}setPersistentLogAttributes(e){let r=this.#f(e);this.#r.setPersistentAttributes(r)}get persistentLogAttributes(){return this.#r.getPersistentAttributes()}shouldLogEvent(e){return typeof e=="boolean"?e:this.getLogEvent()}trace(e,...r){this.processLogItem(Ke.TRACE,e,r)}warn(e,...r){this.processLogItem(Ke.WARN,e,r)}#l(e){this.#p.has(e)||(this.#p.set(e,!0),this.warn(e))}createLogger(e){return new t(e)}getJsonReplacer(){let e=new WeakSet;return(r,n)=>{let o=n;if(this.#o&&(o=this.#o?.(r,o)),o instanceof Error&&(o=this.getLogFormatter().formatError(o)),typeof o=="bigint")return o.toString();if(typeof o=="object"&&o!==null){if(e.has(o))return;e.add(o)}return o}}addToPowertoolsLogData(e){(0,bm.default)(this.powertoolsLogData,e)}#f(e){let r={};for(let[n,o]of Object.entries(e))this.#d(n)||(r[n]=o);return r}#m(e,r){let n=this.#f(e);if(r==="temp")this.#r.appendTemporaryKeys(n);else{let o=this.#r.getPersistentAttributes();this.#r.setPersistentAttributes((0,bm.default)(o,n))}}awsLogLevelShortCircuit(e){return this.#e!==void 0?(this.logLevel=Ke[this.#e],this.isValidLogLevel(e)&&this.logLevel>Ke[e]&&this.#l(`Current log level (${e}) does not match AWS Lambda Advanced Logging Controls minimum log level (${this.#e}). This can lead to data loss, consider adjusting them.`),!0):!1}createAndPopulateLogItem(e,r,n){let o={logLevel:this.getLogLevelNameFromNumber(e),timestamp:new Date,xRayTraceId:Gl(),...this.getPowertoolsLogData(),message:""},i=this.#r.getAllAttributes();return this.#g(r,o,i),this.#_(n,i),this.getLogFormatter().formatAttributes(o,i)}#g(e,r,n){if(typeof e=="string"){r.message=e;return}let{message:o,...i}=e;r.message=o;for(let[s,a]of Object.entries(i))this.#d(s)||(n[s]=a)}#_(e,r){for(let n of e)Qb(n)||(n instanceof Error?r.error=n:typeof n=="string"?r.extra=n:this.#y(n,r))}#y(e,r){for(let[n,o]of Object.entries(e))this.#d(n)||(r[n]=o)}#h(){return this.#a.sampleRateValue&&Z2(0,100)/100<=this.#a.sampleRateValue}#d(e){return OT.includes(e)?(this.warn(`The key "${e}" is a reserved key and will be dropped.`),!0):!1}getCustomConfigService(){return this.customConfigService}getLogFormatter(){return this.logFormatter}getLogLevelNameFromNumber(e){let r;for(let[n,o]of Object.entries(Ke))if(o===e){r=n;break}return r}getPowertoolsLogData(){return this.powertoolsLogData}isValidLogLevel(e){return typeof e=="string"&&e in Ke}isValidSampleRate(e){return typeof e=="number"&&0<=e&&e<=1}printLog(e,r){r.prepareForPrint();let n=e===Ke.CRITICAL?"error":this.getLogLevelNameFromNumber(e).toLowerCase();this.console[n](JSON.stringify(r.getAttributes(),this.getJsonReplacer(),this.logIndentation))}processLogItem(e,r,n){let o=Gl();if(o!==void 0&&this.shouldBufferLog(o,e)){try{this.bufferLogItem(o,this.createAndPopulateLogItem(e,r,n),e)}catch(i){this.printLog(Ke.WARN,this.createAndPopulateLogItem(Ke.WARN,`Unable to buffer log: ${i.message}`,[i])),this.printLog(e,this.createAndPopulateLogItem(e,r,n))}return}e>=this.logLevel&&(this.#c?this.printLog(e,this.createAndPopulateLogItem(e,r,n)):this.#i.push([e,[e,r,n]]))}setConsole(){Vl()?this.console=console:this.console=new B2({stdout:process.stdout,stderr:process.stderr}),this.console.trace=(e,...r)=>{this.console.log(e,...r)}}setInitialLogLevel(e){let r=e?.toUpperCase();if(this.awsLogLevelShortCircuit(r)){this.#n=this.logLevel;return}if(this.isValidLogLevel(r)){this.logLevel=Ke[r],this.#n=this.logLevel;return}let n=this.getCustomConfigService()?.getLogLevel()?.toUpperCase();if(this.isValidLogLevel(n)){this.logLevel=Ke[n],this.#n=this.logLevel;return}let o=Vr({key:"POWERTOOLS_LOG_LEVEL",defaultValue:""}),i=Vr({key:"LOG_LEVEL",defaultValue:""}),s=o!==""?o:i;this.isValidLogLevel(s)&&(this.logLevel=Ke[s],this.#n=this.logLevel)}setInitialSampleRate(e){let r=e,n=this.getCustomConfigService()?.getSampleRateValue(),o=MT({key:"POWERTOOLS_LOGGER_SAMPLE_RATE",defaultValue:0});for(let i of[r,n,o])if(this.isValidSampleRate(i)){this.#a.sampleRateValue=i,this.powertoolsLogData.sampleRateValue=i,this.#h()&&this.logLevel>Ke.TRACE&&(this.setLogLevel("DEBUG"),this.debug("Setting log level to DEBUG due to sampling rate"));break}}setLogEvent(){this.logEvent=Ub({key:"POWERTOOLS_LOGGER_LOG_EVENT",defaultValue:!1})}setLogFormatter(e,r){this.logFormatter=e??new _m({logRecordOrder:r})}setLogIndentation(){Vl()&&(this.logIndentation=Mb.PRETTY)}setOptions(e){let{logLevel:r,serviceName:n,sampleRateValue:o,logFormatter:i,persistentKeys:s,persistentLogAttributes:a,environment:c,jsonReplacerFn:u,logRecordOrder:l,logBufferOptions:d,correlationIdSearchFn:f}=e;a&&Object.keys(a).length>0&&s&&Object.keys(s).length>0&&this.warn("Both persistentLogAttributes and persistentKeys options were provided. Using persistentKeys as persistentLogAttributes is deprecated and will be removed in future releases"),this.setPowertoolsLogData(n,c,s||a);let p=Vr({key:"AWS_LAMBDA_LOG_LEVEL",defaultValue:""}),m=p==="FATAL"?"CRITICAL":p;return this.isValidLogLevel(m)&&(this.#e=m),this.setLogEvent(),this.setInitialLogLevel(r),this.setInitialSampleRate(o),this.setLogFormatter(i,l),this.setConsole(),this.setLogIndentation(),this.#o=u,this.#v(d),this.#u=f,this}setPowertoolsLogData(e,r,n){this.addToPowertoolsLogData({awsRegion:Vr({key:"AWS_REGION",defaultValue:""}),environment:r||this.getCustomConfigService()?.getCurrentEnvironment()||Vr({key:"ENVIRONMENT",defaultValue:""}),serviceName:e||this.getCustomConfigService()?.getServiceName()||Vr({key:"POWERTOOLS_SERVICE_NAME",defaultValue:""})||this.defaultServiceName}),n&&this.appendPersistentKeys(n)}#v(e){if(e===void 0||(this.#t.enabled=e?.enabled!==!1,this.#t.enabled===!1))return;e?.maxBytes!==void 0&&(this.#t.maxBytes=e.maxBytes),this.#s=new vm({maxBytesSize:this.#t.maxBytes}),e?.flushOnErrorLog===!1&&(this.#t.flushOnErrorLog=!1);let r=e?.bufferAtVerbosity?.toUpperCase();this.isValidLogLevel(r)&&(this.#t.bufferAtVerbosity=Ke[r]),this.#e!==void 0&&Ke[this.#e]>this.#t.bufferAtVerbosity&&this.#l("Advanced Loggging Controls (ALC) Log Level is less verbose than Log Buffering Log Level. Buffered logs will be filtered by ALC")}bufferLogItem(e,r,n){r.prepareForPrint(),this.#s?.has(e)===!1&&this.#s?.clear(),this.#s?.setItem(e,JSON.stringify(r.getAttributes(),this.getJsonReplacer(),this.logIndentation),n)}flushBuffer(){let e=Gl();if(e===void 0)return;let r=this.#s?.get(e);if(r!==void 0){for(let n of r){let o=this.getLogLevelNameFromNumber(n.logLevel).toLowerCase();this.console[o](n.value)}r.hasEvictedLog&&this.printLog(Ke.WARN,this.createAndPopulateLogItem(Ke.WARN,"Some logs are not displayed because they were evicted from the buffer. Increase buffer size to store more logs in the buffer",[])),this.#e!==void 0&&Ke[this.#e]>this.#t.bufferAtVerbosity&&this.#l("Advanced Loggging Controls (ALC) Log Level is less verbose than Log Buffering Log Level. Some logs might be missing."),this.#s?.delete(e)}}clearBuffer(){let e=Gl();e!==void 0&&this.#s?.delete(e)}shouldBufferLog(e,r){return this.#t.enabled&&e!==void 0&&r<=this.#t.bufferAtVerbosity}setCorrelationId(e,r){if(typeof r=="string"){if(!this.#u){this.#l("correlationIdPath is set but no search function was provided. The correlation ID will not be added to the log attributes.");return}let n=this.#u(r,e);n&&this.appendKeys({correlation_id:n});return}this.appendKeys({correlation_id:e})}getCorrelationId(){return this.#r.getTemporaryAttributes().correlation_id}};var rw=class extends Es{formatAttributes(e,r){let n={logLevel:e.logLevel,timestamp:this.formatTimestamp(e.timestamp),message:e.message},o=new _i({attributes:n});return o.addAttributes(r),o}},wm=new ed({logFormatter:new rw});function ce(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function S(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var nw=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return nw=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function td(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var rd=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var V=class extends Error{},Pt=class t extends V{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("x-request-id"),this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new yi({message:n,cause:rd(r)});let i=r?.error;return e===400?new fc(e,i,n,o):e===401?new mc(e,i,n,o):e===403?new hc(e,i,n,o):e===404?new gc(e,i,n,o):e===409?new _c(e,i,n,o):e===422?new yc(e,i,n,o):e===429?new vc(e,i,n,o):e>=500?new bc(e,i,n,o):new t(e,i,n,o)}},xt=class extends Pt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},yi=class extends Pt{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Do=class extends yi{constructor({message:e}={}){super({message:e??"Request timed out."})}},fc=class extends Pt{},mc=class extends Pt{},hc=class extends Pt{},gc=class extends Pt{},_c=class extends Pt{},yc=class extends Pt{},vc=class extends Pt{},bc=class extends Pt{},wc=class extends V{constructor(){super("Could not parse response content as the length limit was reached")}},xc=class extends V{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},ro=class extends Error{constructor(e){super(e)}};var V2=/^[a-z][a-z0-9+.-]*:/i,yE=t=>V2.test(t),Qt=t=>(Qt=Array.isArray,Qt(t)),ow=Qt;function iw(t){return typeof t!="object"?{}:t??{}}function vE(t){if(!t)return!0;for(let e in t)return!1;return!0}function bE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function nd(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var wE=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new V(`${t} must be an integer`);if(e<0)throw new V(`${t} must be a positive integer`);return e};var xE=t=>{try{return JSON.parse(t)}catch{return}};var no=t=>new Promise(e=>setTimeout(e,t));var vi="6.10.0";var kE=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function G2(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var K2=()=>{let t=G2();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":IE(Deno.build.os),"X-Stainless-Arch":$E(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":IE(globalThis.process.platform??"unknown"),"X-Stainless-Arch":$E(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=H2();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function H2(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,s=n[3]||0;return{browser:e,version:`${o}.${i}.${s}`}}}return null}var $E=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",IE=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),SE,TE=()=>SE??(SE=K2());function EE(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function sw(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function xm(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return sw({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function aw(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function AE(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var OE=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var $m="RFC3986",cw=t=>String(t),Im={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:cw},uw="RFC1738";var Sm=(t,e)=>(Sm=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Sm(t,e)),oo=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var lw=1024,PE=(t,e,r,n,o)=>{if(t.length===0)return t;let i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a=lw?i.slice(a,a+lw):i,u=[];for(let l=0;l=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===uw&&(d===40||d===41)){u[u.length]=c.charAt(l);continue}if(d<128){u[u.length]=oo[d];continue}if(d<2048){u[u.length]=oo[192|d>>6]+oo[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=oo[224|d>>12]+oo[128|d>>6&63]+oo[128|d&63];continue}l+=1,d=65536+((d&1023)<<10|c.charCodeAt(l)&1023),u[u.length]=oo[240|d>>18]+oo[128|d>>12&63]+oo[128|d>>6&63]+oo[128|d&63]}s+=u.join("")}return s};function CE(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function dw(t,e){if(Qt(t)){let r=[];for(let n=0;n"u"&&(k=0)}if(typeof u=="function"?b=u(e,b):b instanceof Date?b=f?.(b):r==="comma"&&Qt(b)&&(b=dw(b,function(oe){return oe instanceof Date?f?.(oe):oe})),b===null){if(i)return c&&!h?c(e,Ct.encoder,_,"key",p):e;b=""}if(X2(b)||CE(b)){if(c){let oe=h?e:c(e,Ct.encoder,_,"key",p);return[m?.(oe)+"="+m?.(c(b,Ct.encoder,_,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let F=[];if(typeof b>"u")return F;let J;if(r==="comma"&&Qt(b))h&&c&&(b=dw(b,c)),J=[{value:b.length>0?b.join(",")||null:void 0}];else if(Qt(u))J=u;else{let oe=Object.keys(b);J=l?oe.sort(l):oe}let w=a?String(e).replace(/\./g,"%2E"):String(e),Z=n&&Qt(b)&&b.length===1?w+"[]":w;if(o&&Qt(b)&&b.length===0)return Z+"[]";for(let oe=0;oe"u"?t.encodeDotInKeys?!0:Ct.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Ct.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Ct.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Ct.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Ct.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Ct.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Ct.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Ct.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Ct.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Ct.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Ct.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Ct.strictNullHandling}}function fw(t,e={}){let r=t,n=Y2(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Qt(n.filter)&&(i=n.filter,o=i);let s=[];if(typeof r!="object"||r===null)return"";let a=NE[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);let u=new WeakMap;for(let f=0;f0?d+l:""}function LE(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}var jE;function $c(t){let e;return(jE??(e=new globalThis.TextEncoder,jE=e.encode.bind(e)))(t)}var DE;function mw(t){let e;return(DE??(e=new globalThis.TextDecoder,DE=e.decode.bind(e)))(t)}var Gr,Kr,Cs=class{constructor(){Gr.set(this,void 0),Kr.set(this,void 0),ce(this,Gr,new Uint8Array,"f"),ce(this,Kr,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?$c(e):e;ce(this,Gr,LE([S(this,Gr,"f"),r]),"f");let n=[],o;for(;(o=eF(S(this,Gr,"f"),S(this,Kr,"f")))!=null;){if(o.carriage&&S(this,Kr,"f")==null){ce(this,Kr,o.index,"f");continue}if(S(this,Kr,"f")!=null&&(o.index!==S(this,Kr,"f")+1||o.carriage)){n.push(mw(S(this,Gr,"f").subarray(0,S(this,Kr,"f")-1))),ce(this,Gr,S(this,Gr,"f").subarray(S(this,Kr,"f")),"f"),ce(this,Kr,null,"f");continue}let i=S(this,Kr,"f")!==null?o.preceding-1:o.preceding,s=mw(S(this,Gr,"f").subarray(0,i));n.push(s),ce(this,Gr,S(this,Gr,"f").subarray(o.index),"f"),ce(this,Kr,null,"f")}return n}flush(){return S(this,Gr,"f").length?this.decode(` +`):[]}};Gr=new WeakMap,Kr=new WeakMap;Cs.NEWLINE_CHARS=new Set([` +`,"\r"]);Cs.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function eF(t,e){for(let o=e??0;o{if(t){if(bE(Tm,t))return t;$t(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Tm))}`)}};function od(){}function km(t,e,r){return!e||Tm[t]>Tm[r]?od:e[t].bind(e)}var tF={error:od,warn:od,info:od,debug:od},FE=new WeakMap;function $t(t){let e=t.logger,r=t.logLevel??"off";if(!e)return tF;let n=FE.get(e);if(n&&n[0]===r)return n[1];let o={error:km("error",e,r),warn:km("warn",e,r),info:km("info",e,r),debug:km("debug",e,r)};return FE.set(e,[r,o]),o}var Lo=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var id,io=class t{constructor(e,r,n){this.iterator=e,id.set(this,void 0),this.controller=r,ce(this,id,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?$t(n):console;async function*s(){if(o)throw new V("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let c of rF(e,r))if(!a){if(c.data.startsWith("[DONE]")){a=!0;continue}if(c.event===null||!c.event.startsWith("thread.")){let u;try{u=JSON.parse(c.data)}catch(l){throw i.error("Could not parse message into JSON:",c.data),i.error("From chunk:",c.raw),l}if(u&&u.error)throw new Pt(void 0,u.error,void 0,e.headers);yield u}else{let u;try{u=JSON.parse(c.data)}catch(l){throw console.error("Could not parse message into JSON:",c.data),console.error("From chunk:",c.raw),l}if(c.event=="error")throw new Pt(void 0,u.error,u.message,void 0);yield{event:c.event,data:u}}}a=!0}catch(c){if(td(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*i(){let a=new Cs,c=aw(e);for await(let u of c)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*s(){if(o)throw new V("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let c of i())a||c&&(yield JSON.parse(c));a=!0}catch(c){if(td(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}[(id=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let s=n.next();e.push(s),r.push(s)}return i.shift()}});return[new t(()=>o(e),this.controller,S(this,id,"f")),new t(()=>o(r),this.controller,S(this,id,"f"))]}toReadableStream(){let e=this,r;return sw({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:i}=await r.next();if(i)return n.close();let s=$c(JSON.stringify(o)+` +`);n.enqueue(s)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};async function*rF(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new V("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new V("Attempted to iterate over a response with no body");let r=new gw,n=new Cs,o=aw(t.body);for await(let i of nF(o))for(let s of n.decode(i)){let a=r.decode(s);a&&(yield a)}for(let i of n.flush()){let s=r.decode(i);s&&(yield s)}}async function*nF(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?$c(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=UE(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var gw=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(` +`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=oF(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function oF(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function Em(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,s=await(async()=>{if(e.options.stream)return $t(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):io.fromSSEResponse(r,e.controller,t);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let c=r.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){let d=await r.json();return _w(d,r)}return await r.text()})();return $t(t).debug(`[${n}] response parsed`,Lo({retryOfRequestLogID:o,url:r.url,status:r.status,body:s,durationMs:Date.now()-i})),s}function _w(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var sd,Rs=class t extends Promise{constructor(e,r,n=Em){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,sd.set(this,void 0),ce(this,sd,e,"f")}_thenUnwrap(e){return new t(S(this,sd,"f"),this.responsePromise,async(r,n)=>_w(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(S(this,sd,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};sd=new WeakMap;var Am,ad=class{constructor(e,r,n,o){Am.set(this,void 0),ce(this,Am,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new V("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await S(this,Am,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Am=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},cd=class extends Rs{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await Em(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},so=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},ke=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),r=e[e.length-1]?.id;return r?{...this.options,query:{...iw(this.options.query),after:r}}:null}},Uo=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1,this.last_id=n.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.last_id;return e?{...this.options,query:{...iw(this.options.query),after:e}}:null}};var bw=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Ic(t,e,r){return bw(),new File(t,e??"unknown_file",r)}function ud(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}var Om=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",ww=async(t,e)=>yw(t.body)?{...t,body:await ZE(t.body,e)}:t,Hr=async(t,e)=>({...t,body:await ZE(t.body,e)}),BE=new WeakMap;function sF(t){let e=typeof t=="function"?t:t.fetch,r=BE.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new o(i).text()}catch{return!0}})();return BE.set(e,n),n}var ZE=async(t,e)=>{if(!await sF(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>vw(r,n,o))),r},qE=t=>t instanceof Blob&&"name"in t,aF=t=>typeof t=="object"&&t!==null&&(t instanceof Response||Om(t)||qE(t)),yw=t=>{if(aF(t))return!0;if(Array.isArray(t))return t.some(yw);if(t&&typeof t=="object"){for(let e in t)if(yw(t[e]))return!0}return!1},vw=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response)t.append(e,Ic([await r.blob()],ud(r)));else if(Om(r))t.append(e,Ic([await new Response(xm(r)).blob()],ud(r)));else if(qE(r))t.append(e,r,ud(r));else if(Array.isArray(r))await Promise.all(r.map(n=>vw(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>vw(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var VE=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",cF=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&VE(t),uF=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";async function ld(t,e,r){if(bw(),t=await t,cF(t))return t instanceof File?t:Ic([await t.arrayBuffer()],t.name);if(uF(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),Ic(await xw(o),e,r)}let n=await xw(t);if(e||(e=ud(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return Ic(n,e,r)}async function xw(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(VE(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(Om(t))for await(let r of t)e.push(...await xw(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${lF(t)}`)}return e}function lF(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var C=class{constructor(e){this._client=e}};function KE(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var GE=Object.freeze(Object.create(null)),pF=(t=KE)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],s=r.reduce((l,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=n[f],m=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??GE)??GE)?.toString)&&(m=p+"",i.push({start:l.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),l+d+(f===n.length?"":m)},""),a=s.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,u;for(;(u=c.exec(a))!==null;)i.push({start:u.index,length:u[0].length,error:`Value "${u[0]}" can't be safely passed as a path parameter`});if(i.sort((l,d)=>l.start-d.start),i.length>0){let l=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-l),h="^".repeat(p.length);return l=p.start+p.length,f+m+h},"");throw new V(`Path parameters result in path with invalid segments: +${i.map(f=>f.error).join(` +`)} +${s} +${d}`)}return s},O=pF(KE);var Ns=class extends C{list(e,r={},n){return this._client.getAPIList(O`/chat/completions/${e}/messages`,ke,{query:r,...n})}};function dd(t){return t!==void 0&&"function"in t&&t.function!==void 0}function pd(t){return t?.$brand==="auto-parseable-response-format"}function zs(t){return t?.$brand==="auto-parseable-tool"}function HE(t,e){return!e||!$w(e)?{...t,choices:t.choices.map(r=>(JE(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:fd(t,e)}function fd(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new wc;if(n.finish_reason==="content_filter")throw new xc;return JE(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>gF(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?hF(e,n.message.content):null}}});return{...t,choices:r}}function hF(t,e){return t.response_format?.type!=="json_schema"?null:t.response_format?.type==="json_schema"?"$parseRaw"in t.response_format?t.response_format.$parseRaw(e):JSON.parse(e):null}function gF(t,e){let r=t.tools?.find(n=>dd(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:zs(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function WE(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>dd(n)&&n.function?.name===e.function.name);return dd(r)&&(zs(r)||r?.function.strict||!1)}function $w(t){return pd(t.response_format)?!0:t.tools?.some(e=>zs(e)||e.type==="function"&&e.function.strict===!0)??!1}function JE(t){for(let e of t||[])if(e.type!=="function")throw new V(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function XE(t){for(let e of t??[]){if(e.type!=="function")throw new V(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new V(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Sc=t=>t?.role==="assistant",Iw=t=>t?.role==="tool";var Sw,Pm,Cm,md,hd,Rm,gd,Fo,_d,Nm,zm,kc,YE,bi=class{constructor(){Sw.add(this),this.controller=new AbortController,Pm.set(this,void 0),Cm.set(this,()=>{}),md.set(this,()=>{}),hd.set(this,void 0),Rm.set(this,()=>{}),gd.set(this,()=>{}),Fo.set(this,{}),_d.set(this,!1),Nm.set(this,!1),zm.set(this,!1),kc.set(this,!1),ce(this,Pm,new Promise((e,r)=>{ce(this,Cm,e,"f"),ce(this,md,r,"f")}),"f"),ce(this,hd,new Promise((e,r)=>{ce(this,Rm,e,"f"),ce(this,gd,r,"f")}),"f"),S(this,Pm,"f").catch(()=>{}),S(this,hd,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},S(this,Sw,"m",YE).bind(this))},0)}_connected(){this.ended||(S(this,Cm,"f").call(this),this._emit("connect"))}get ended(){return S(this,_d,"f")}get errored(){return S(this,Nm,"f")}get aborted(){return S(this,zm,"f")}abort(){this.controller.abort()}on(e,r){return(S(this,Fo,"f")[e]||(S(this,Fo,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=S(this,Fo,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(S(this,Fo,"f")[e]||(S(this,Fo,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ce(this,kc,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ce(this,kc,!0,"f"),await S(this,hd,"f")}_emit(e,...r){if(S(this,_d,"f"))return;e==="end"&&(ce(this,_d,!0,"f"),S(this,Rm,"f").call(this));let n=S(this,Fo,"f")[e];if(n&&(S(this,Fo,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!S(this,kc,"f")&&!n?.length&&Promise.reject(o),S(this,md,"f").call(this,o),S(this,gd,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!S(this,kc,"f")&&!n?.length&&Promise.reject(o),S(this,md,"f").call(this,o),S(this,gd,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Pm=new WeakMap,Cm=new WeakMap,md=new WeakMap,hd=new WeakMap,Rm=new WeakMap,gd=new WeakMap,Fo=new WeakMap,_d=new WeakMap,Nm=new WeakMap,zm=new WeakMap,kc=new WeakMap,Sw=new WeakSet,YE=function(e){if(ce(this,Nm,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new xt),e instanceof xt)return ce(this,zm,!0,"f"),this._emit("abort",e);if(e instanceof V)return this._emit("error",e);if(e instanceof Error){let r=new V(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new V(String(e)))};function QE(t){return typeof t.parse=="function"}var pr,kw,Mm,Tw,Ew,Aw,eA,tA,_F=10,Tc=class extends bi{constructor(){super(...arguments),pr.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let r=e.choices[0]?.message;return r&&this._addMessage(r),e}_addMessage(e,r=!0){if("content"in e||(e.content=null),this.messages.push(e),r){if(this._emit("message",e),Iw(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(Sc(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionToolCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new V("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),S(this,pr,"m",kw).call(this)}async finalMessage(){return await this.done(),S(this,pr,"m",Mm).call(this)}async finalFunctionToolCall(){return await this.done(),S(this,pr,"m",Tw).call(this)}async finalFunctionToolCallResult(){return await this.done(),S(this,pr,"m",Ew).call(this)}async totalUsage(){return await this.done(),S(this,pr,"m",Aw).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=S(this,pr,"m",Mm).call(this);r&&this._emit("finalMessage",r);let n=S(this,pr,"m",kw).call(this);n&&this._emit("finalContent",n);let o=S(this,pr,"m",Tw).call(this);o&&this._emit("finalFunctionToolCall",o);let i=S(this,pr,"m",Ew).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(s=>s.usage)&&this._emit("totalUsage",S(this,pr,"m",Aw).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,pr,"m",eA).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(fd(i,r))}async _runChatCompletion(e,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,r,n)}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:s,...a}=r,c=typeof i!="string"&&i.type==="function"&&i?.function?.name,{maxChatCompletions:u=_F}=n||{},l=r.tools.map(p=>{if(zs(p)){if(!p.$callback)throw new V("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of l)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?l.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;pJSON.stringify(Z)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:v,content:w});continue}let T;try{T=QE(k)?await k.parse(x):x}catch(w){let Z=w instanceof Error?w.message:String(w);this._addMessage({role:o,tool_call_id:v,content:Z});continue}let F=await k.function(T,this),J=S(this,pr,"m",tA).call(this,F);if(this._addMessage({role:o,tool_call_id:v,content:J}),c)return}}}};pr=new WeakSet,kw=function(){return S(this,pr,"m",Mm).call(this).content??null},Mm=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(Sc(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new V("stream ended without producing a ChatCompletionMessage with role=assistant")},Tw=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Sc(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},Ew=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Iw(r)&&r.content!=null&&typeof r.content=="string"&&this.messages.some(n=>n.role==="assistant"&&n.tool_calls?.some(o=>o.type==="function"&&o.id===r.tool_call_id)))return r.content}},Aw=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:r}of this._chatCompletions)r&&(e.completion_tokens+=r.completion_tokens,e.prompt_tokens+=r.prompt_tokens,e.total_tokens+=r.total_tokens);return e},eA=function(e){if(e.n!=null&&e.n>1)throw new V("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},tA=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};var yd=class t extends Tc{static runTools(e,r,n){let o=new t,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}_addMessage(e,r=!0){super._addMessage(e,r),Sc(e)&&e.content&&this._emit("content",e.content)}};var Mt={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511},Ow=class extends Error{},Pw=class extends Error{};function yF(t,e=Mt.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return vF(t.trim(),e)}var vF=(t,e)=>{let r=t.length,n=0,o=f=>{throw new Ow(`${f} at position ${n}`)},i=f=>{throw new Pw(`${f} at position ${n}`)},s=()=>(d(),n>=r&&o("Unexpected end of input"),t[n]==='"'?a():t[n]==="{"?c():t[n]==="["?u():t.substring(n,n+4)==="null"||Mt.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Mt.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Mt.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Mt.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Mt.MINUS_INFINITY&e&&1{let f=n,p=!1;for(n++;n{n++,d();let f={};try{for(;t[n]!=="}";){if(d(),n>=r&&Mt.OBJ&e)return f;let p=a();d(),n++;try{let m=s();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(Mt.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Mt.OBJ&e)return f;o("Expected '}' at end of object")}return n++,f},u=()=>{n++;let f=[];try{for(;t[n]!=="]";)f.push(s()),d(),t[n]===","&&n++}catch{if(Mt.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},l=()=>{if(n===0){t==="-"&&Mt.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Mt.NUM&e)try{return t[t.length-1]==="."?JSON.parse(t.substring(0,t.lastIndexOf("."))):JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch{}i(String(p))}}let f=n;for(t[n]==="-"&&n++;t[n]&&!",]}".includes(t[n]);)n++;n==r&&!(Mt.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Mt.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;nyF(t,Mt.ALL^Mt.NUM);var Rt,Bo,Ec,wi,Rw,jm,Nw,zw,Mw,Dm,jw,rA,Ms=class t extends Tc{constructor(e){super(),Rt.add(this),Bo.set(this,void 0),Ec.set(this,void 0),wi.set(this,void 0),ce(this,Bo,e,"f"),ce(this,Ec,[],"f")}get currentChatCompletionSnapshot(){return S(this,wi,"f")}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createChatCompletion(e,r,n){let o=new t(r);return o._run(()=>o._runChatCompletion(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(e,r,n){super._createChatCompletion;let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,Rt,"m",Rw).call(this);let i=await e.chat.completions.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let s of i)S(this,Rt,"m",Nw).call(this,s);if(i.controller.signal?.aborted)throw new xt;return this._addChatCompletion(S(this,Rt,"m",Dm).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),S(this,Rt,"m",Rw).call(this),this._connected();let o=io.fromReadableStream(e,this.controller),i;for await(let s of o)i&&i!==s.id&&this._addChatCompletion(S(this,Rt,"m",Dm).call(this)),S(this,Rt,"m",Nw).call(this,s),i=s.id;if(o.controller.signal?.aborted)throw new xt;return this._addChatCompletion(S(this,Rt,"m",Dm).call(this))}[(Bo=new WeakMap,Ec=new WeakMap,wi=new WeakMap,Rt=new WeakSet,Rw=function(){this.ended||ce(this,wi,void 0,"f")},jm=function(r){let n=S(this,Ec,"f")[r.index];return n||(n={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},S(this,Ec,"f")[r.index]=n,n)},Nw=function(r){if(this.ended)return;let n=S(this,Rt,"m",rA).call(this,r);this._emit("chunk",r,n);for(let o of r.choices){let i=n.choices[o.index];o.delta.content!=null&&i.message?.role==="assistant"&&i.message?.content&&(this._emit("content",o.delta.content,i.message.content),this._emit("content.delta",{delta:o.delta.content,snapshot:i.message.content,parsed:i.message.parsed})),o.delta.refusal!=null&&i.message?.role==="assistant"&&i.message?.refusal&&this._emit("refusal.delta",{delta:o.delta.refusal,snapshot:i.message.refusal}),o.logprobs?.content!=null&&i.message?.role==="assistant"&&this._emit("logprobs.content.delta",{content:o.logprobs?.content,snapshot:i.logprobs?.content??[]}),o.logprobs?.refusal!=null&&i.message?.role==="assistant"&&this._emit("logprobs.refusal.delta",{refusal:o.logprobs?.refusal,snapshot:i.logprobs?.refusal??[]});let s=S(this,Rt,"m",jm).call(this,i);i.finish_reason&&(S(this,Rt,"m",Mw).call(this,i),s.current_tool_call_index!=null&&S(this,Rt,"m",zw).call(this,i,s.current_tool_call_index));for(let a of o.delta.tool_calls??[])s.current_tool_call_index!==a.index&&(S(this,Rt,"m",Mw).call(this,i),s.current_tool_call_index!=null&&S(this,Rt,"m",zw).call(this,i,s.current_tool_call_index)),s.current_tool_call_index=a.index;for(let a of o.delta.tool_calls??[]){let c=i.message.tool_calls?.[a.index];c?.type&&(c?.type==="function"?this._emit("tool_calls.function.arguments.delta",{name:c.function?.name,index:a.index,arguments:c.function.arguments,parsed_arguments:c.function.parsed_arguments,arguments_delta:a.function?.arguments??""}):(c?.type,void 0))}}},zw=function(r,n){if(S(this,Rt,"m",jm).call(this,r).done_tool_calls.has(n))return;let i=r.message.tool_calls?.[n];if(!i)throw new Error("no tool call snapshot");if(!i.type)throw new Error("tool call snapshot missing `type`");if(i.type==="function"){let s=S(this,Bo,"f")?.tools?.find(a=>dd(a)&&a.function.name===i.function.name);this._emit("tool_calls.function.arguments.done",{name:i.function.name,index:n,arguments:i.function.arguments,parsed_arguments:zs(s)?s.$parseRaw(i.function.arguments):s?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Mw=function(r){let n=S(this,Rt,"m",jm).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=S(this,Rt,"m",jw).call(this);this._emit("content.done",{content:r.message.content,parsed:o?o.$parseRaw(r.message.content):null})}r.message.refusal&&!n.refusal_done&&(n.refusal_done=!0,this._emit("refusal.done",{refusal:r.message.refusal})),r.logprobs?.content&&!n.logprobs_content_done&&(n.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:r.logprobs.content})),r.logprobs?.refusal&&!n.logprobs_refusal_done&&(n.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:r.logprobs.refusal}))},Dm=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");let r=S(this,wi,"f");if(!r)throw new V("request ended without sending any chunks");return ce(this,wi,void 0,"f"),ce(this,Ec,[],"f"),bF(r,S(this,Bo,"f"))},jw=function(){let r=S(this,Bo,"f")?.response_format;return pd(r)?r:null},rA=function(r){var n,o,i,s;let a=S(this,wi,"f"),{choices:c,...u}=r;a?Object.assign(a,u):a=ce(this,wi,{...u,choices:[]},"f");for(let{delta:l,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=a.choices[f];if(h||(h=a.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:F,refusal:J,...w}=p;Object.assign(h.logprobs,w),F&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...F)),J&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...J))}if(d&&(h.finish_reason=d,S(this,Bo,"f")&&$w(S(this,Bo,"f")))){if(d==="length")throw new wc;if(d==="content_filter")throw new xc}if(Object.assign(h,m),!l)continue;let{content:_,refusal:v,function_call:b,role:x,tool_calls:k,...T}=l;if(Object.assign(h.message,T),v&&(h.message.refusal=(h.message.refusal||"")+v),x&&(h.message.role=x),b&&(h.message.function_call?(b.name&&(h.message.function_call.name=b.name),b.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=b.arguments)):h.message.function_call=b),_&&(h.message.content=(h.message.content||"")+_,!h.message.refusal&&S(this,Rt,"m",jw).call(this)&&(h.message.parsed=Cw(h.message.content))),k){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:F,id:J,type:w,function:Z,...oe}of k){let Q=(s=h.message.tool_calls)[F]??(s[F]={});Object.assign(Q,oe),J&&(Q.id=J),w&&(Q.type=w),Z&&(Q.function??(Q.function={name:Z.name??"",arguments:""})),Z?.name&&(Q.function.name=Z.name),Z?.arguments&&(Q.function.arguments+=Z.arguments,WE(S(this,Bo,"f"),Q)&&(Q.function.parsed_arguments=Cw(Q.function.arguments)))}}}return a},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("chunk",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new io(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function bF(t,e){let{id:r,choices:n,created:o,model:i,system_fingerprint:s,...a}=t,c={...a,id:r,choices:n.map(({message:u,finish_reason:l,index:d,logprobs:f,...p})=>{if(!l)throw new V(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:_,...v}=u,b=u.role;if(!b)throw new V(`missing role for choice ${d}`);if(h){let{arguments:x,name:k}=h;if(x==null)throw new V(`missing function_call.arguments for choice ${d}`);if(!k)throw new V(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:x,name:k},role:b,refusal:u.refusal??null},finish_reason:l,index:d,logprobs:f}}return _?{...p,index:d,finish_reason:l,logprobs:f,message:{...v,role:b,content:m,refusal:u.refusal??null,tool_calls:_.map((x,k)=>{let{function:T,type:F,id:J,...w}=x,{arguments:Z,name:oe,...Q}=T||{};if(J==null)throw new V(`missing choices[${d}].tool_calls[${k}].id +${Lm(t)}`);if(F==null)throw new V(`missing choices[${d}].tool_calls[${k}].type +${Lm(t)}`);if(oe==null)throw new V(`missing choices[${d}].tool_calls[${k}].function.name +${Lm(t)}`);if(Z==null)throw new V(`missing choices[${d}].tool_calls[${k}].function.arguments +${Lm(t)}`);return{...w,id:J,type:F,function:{...Q,name:oe,arguments:Z}}})}}:{...p,message:{...v,content:m,role:b,refusal:u.refusal??null},finish_reason:l,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...s?{system_fingerprint:s}:{}};return HE(c,e)}function Lm(t){return JSON.stringify(t)}var vd=class t extends Ms{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runTools(e,r,n){let o=new t(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}};var Zo=class extends C{constructor(){super(...arguments),this.messages=new Ns(this._client)}create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1})}retrieve(e,r){return this._client.get(O`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(O`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/chat/completions/${e}`,r)}parse(e,r){return XE(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>fd(n,e))}runTools(e,r){return e.stream?vd.runTools(this._client,e,r):yd.runTools(this._client,e,r)}stream(e,r){return Ms.createChatCompletion(this._client,e,r)}};Zo.Messages=Ns;var xi=class extends C{constructor(){super(...arguments),this.completions=new Zo(this._client)}};xi.Completions=Zo;var nA=Symbol("brand.privateNullableHeaders");function*xF(t){if(!t)return;if(nA in t){let{values:n,nulls:o}=t;yield*n.entries();for(let i of o)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():ow(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=ow(n[1])?n[1]:[n[1]],s=!1;for(let a of i)a!==void 0&&(e&&!s&&(s=!0,yield[o,null]),yield[o,a])}}var L=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,s]of xF(n)){let a=i.toLowerCase();o.has(a)||(e.delete(i),o.add(a)),s===null?(e.delete(i),r.add(a)):(e.append(i,s),r.delete(a))}}return{[nA]:!0,values:e,nulls:r}};var Ac=class extends C{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:L([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}};var Oc=class extends C{create(e,r){return this._client.post("/audio/transcriptions",Hr({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}};var Pc=class extends C{create(e,r){return this._client.post("/audio/translations",Hr({body:e,...r,__metadata:{model:e.model}},this._client))}};var ao=class extends C{constructor(){super(...arguments),this.transcriptions=new Oc(this._client),this.translations=new Pc(this._client),this.speech=new Ac(this._client)}};ao.Transcriptions=Oc;ao.Translations=Pc;ao.Speech=Ac;var js=class extends C{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(O`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",ke,{query:e,...r})}cancel(e,r){return this._client.post(O`/batches/${e}/cancel`,r)}};var Cc=class extends C{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/assistants/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/assistants/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",ke,{query:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(O`/assistants/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var Rc=class extends C{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var Nc=class extends C{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var $i=class extends C{constructor(){super(...arguments),this.sessions=new Rc(this._client),this.transcriptionSessions=new Nc(this._client)}};$i.Sessions=Rc;$i.TranscriptionSessions=Nc;var zc=class extends C{create(e,r){return this._client.post("/chatkit/sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}cancel(e,r){return this._client.post(O`/chatkit/sessions/${e}/cancel`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}};var Mc=class extends C{retrieve(e,r){return this._client.get(O`/chatkit/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}list(e={},r){return this._client.getAPIList("/chatkit/threads",Uo,{query:e,...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}delete(e,r){return this._client.delete(O`/chatkit/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}listItems(e,r={},n){return this._client.getAPIList(O`/chatkit/threads/${e}/items`,Uo,{query:r,...n,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers])})}};var Ii=class extends C{constructor(){super(...arguments),this.sessions=new zc(this._client),this.threads=new Mc(this._client)}};Ii.Sessions=zc;Ii.Threads=Mc;var jc=class extends C{create(e,r,n){return this._client.post(O`/threads/${e}/messages`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(O`/threads/${o}/messages/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/messages/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/threads/${e}/messages`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(O`/threads/${o}/messages/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var Dc=class extends C{retrieve(e,r,n){let{thread_id:o,run_id:i,...s}=r;return this._client.get(O`/threads/${o}/runs/${i}/steps/${e}`,{query:s,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r,n){let{thread_id:o,...i}=r;return this._client.getAPIList(O`/threads/${o}/runs/${e}/steps`,ke,{query:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var oA=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()};var Zt,Ls,Dw,co,Um,Nn,Us,Lc,Ds,Zm,Wr,Fm,Bm,xd,bd,wd,iA,sA,aA,cA,uA,lA,dA,qo=class extends bi{constructor(){super(...arguments),Zt.add(this),Dw.set(this,[]),co.set(this,{}),Um.set(this,{}),Nn.set(this,void 0),Us.set(this,void 0),Lc.set(this,void 0),Ds.set(this,void 0),Zm.set(this,void 0),Wr.set(this,void 0),Fm.set(this,void 0),Bm.set(this,void 0),xd.set(this,void 0)}[(Dw=new WeakMap,co=new WeakMap,Um=new WeakMap,Nn=new WeakMap,Us=new WeakMap,Lc=new WeakMap,Ds=new WeakMap,Zm=new WeakMap,Wr=new WeakMap,Fm=new WeakMap,Bm=new WeakMap,xd=new WeakMap,Zt=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new Ls;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=io.fromReadableStream(e,this.controller);for await(let i of o)S(this,Zt,"m",bd).call(this,i);if(o.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}toReadableStream(){return new io(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new Ls;return i._run(()=>i._runToolAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...n,stream:!0},a=await e.submitToolOutputs(r,s,{...o,signal:this.controller.signal});this._connected();for await(let c of a)S(this,Zt,"m",bd).call(this,c);if(a.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}static createThreadAssistantStream(e,r,n){let o=new Ls;return o._run(()=>o._threadAssistantStream(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,r,n,o){let i=new Ls;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return S(this,Fm,"f")}currentRun(){return S(this,Bm,"f")}currentMessageSnapshot(){return S(this,Nn,"f")}currentRunStepSnapshot(){return S(this,xd,"f")}async finalRunSteps(){return await this.done(),Object.values(S(this,co,"f"))}async finalMessages(){return await this.done(),Object.values(S(this,Um,"f"))}async finalRun(){if(await this.done(),!S(this,Us,"f"))throw Error("Final run was not received.");return S(this,Us,"f")}async _createThreadAssistantStream(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));let i={...r,stream:!0},s=await e.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let a of s)S(this,Zt,"m",bd).call(this,a);if(s.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}async _createAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...n,stream:!0},a=await e.create(r,s,{...o,signal:this.controller.signal});this._connected();for await(let c of a)S(this,Zt,"m",bd).call(this,c);if(a.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}static accumulateDelta(e,r){for(let[n,o]of Object.entries(r)){if(!e.hasOwnProperty(n)){e[n]=o;continue}let i=e[n];if(i==null){e[n]=o;continue}if(n==="index"||n==="type"){e[n]=o;continue}if(typeof i=="string"&&typeof o=="string")i+=o;else if(typeof i=="number"&&typeof o=="number")i+=o;else if(nd(i)&&nd(o))i=this.accumulateDelta(i,o);else if(Array.isArray(i)&&Array.isArray(o)){if(i.every(s=>typeof s=="string"||typeof s=="number")){i.push(...o);continue}for(let s of o){if(!nd(s))throw new Error(`Expected array delta entry to be an object but got: ${s}`);let a=s.index;if(a==null)throw console.error(s),new Error("Expected array delta entry to have an `index` property");if(typeof a!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${a}`);let c=i[a];c==null?i.push(s):i[a]=this.accumulateDelta(c,s)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${o}, accValue: ${i}`);e[n]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,r,n){return await this._createThreadAssistantStream(r,e,n)}async _runAssistantStream(e,r,n,o){return await this._createAssistantStream(r,e,n,o)}async _runToolAssistantStream(e,r,n,o){return await this._createToolAssistantStream(r,e,n,o)}};Ls=qo,bd=function(e){if(!this.ended)switch(ce(this,Fm,e,"f"),S(this,Zt,"m",aA).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":S(this,Zt,"m",dA).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":S(this,Zt,"m",sA).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":S(this,Zt,"m",iA).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},wd=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");if(!S(this,Us,"f"))throw Error("Final run has not been received");return S(this,Us,"f")},iA=function(e){let[r,n]=S(this,Zt,"m",uA).call(this,e,S(this,Nn,"f"));ce(this,Nn,r,"f"),S(this,Um,"f")[r.id]=r;for(let o of n){let i=r.content[o.index];i?.type=="text"&&this._emit("textCreated",i.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,r),e.data.delta.content)for(let o of e.data.delta.content){if(o.type=="text"&&o.text){let i=o.text,s=r.content[o.index];if(s&&s.type=="text")this._emit("textDelta",i,s.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(o.index!=S(this,Lc,"f")){if(S(this,Ds,"f"))switch(S(this,Ds,"f").type){case"text":this._emit("textDone",S(this,Ds,"f").text,S(this,Nn,"f"));break;case"image_file":this._emit("imageFileDone",S(this,Ds,"f").image_file,S(this,Nn,"f"));break}ce(this,Lc,o.index,"f")}ce(this,Ds,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(S(this,Lc,"f")!==void 0){let o=e.data.content[S(this,Lc,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,S(this,Nn,"f"));break;case"text":this._emit("textDone",o.text,S(this,Nn,"f"));break}}S(this,Nn,"f")&&this._emit("messageDone",e.data),ce(this,Nn,void 0,"f")}},sA=function(e){let r=S(this,Zt,"m",cA).call(this,e);switch(ce(this,xd,r,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let n=e.data.delta;if(n.step_details&&n.step_details.type=="tool_calls"&&n.step_details.tool_calls&&r.step_details.type=="tool_calls")for(let i of n.step_details.tool_calls)i.index==S(this,Zm,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(S(this,Wr,"f")&&this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Zm,i.index,"f"),ce(this,Wr,r.step_details.tool_calls[i.index],"f"),S(this,Wr,"f")&&this._emit("toolCallCreated",S(this,Wr,"f")));this._emit("runStepDelta",e.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":ce(this,xd,void 0,"f"),e.data.step_details.type=="tool_calls"&&S(this,Wr,"f")&&(this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Wr,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},aA=function(e){S(this,Dw,"f").push(e),this._emit("event",e)},cA=function(e){switch(e.event){case"thread.run.step.created":return S(this,co,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=S(this,co,"f")[e.data.id];if(!r)throw Error("Received a RunStepDelta before creation of a snapshot");let n=e.data;if(n.delta){let o=Ls.accumulateDelta(r,n.delta);S(this,co,"f")[e.data.id]=o}return S(this,co,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":S(this,co,"f")[e.data.id]=e.data;break}if(S(this,co,"f")[e.data.id])return S(this,co,"f")[e.data.id];throw new Error("No snapshot available")},uA=function(e,r){let n=[];switch(e.event){case"thread.message.created":return[e.data,n];case"thread.message.delta":if(!r)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let o=e.data;if(o.delta.content)for(let i of o.delta.content)if(i.index in r.content){let s=r.content[i.index];r.content[i.index]=S(this,Zt,"m",lA).call(this,i,s)}else r.content[i.index]=i,n.push(i);return[r,n];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(r)return[r,n];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},lA=function(e,r){return Ls.accumulateDelta(r,e)},dA=function(e){switch(ce(this,Bm,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":ce(this,Us,e.data,"f"),S(this,Wr,"f")&&(this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Wr,void 0,"f"));break;case"thread.run.cancelling":break}};var Fs=class extends C{constructor(){super(...arguments),this.steps=new Dc(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(O`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(O`/threads/${o}/runs/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/runs/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/threads/${e}/runs`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(O`/threads/${o}/runs/${e}/cancel`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(o.id,{thread_id:e},n)}createAndStream(e,r,n){return qo.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(e,r,{...n,headers:{...n?.headers,...o}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return qo.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}async submitToolOutputsAndPoll(e,r,n){let o=await this.submitToolOutputs(e,r,n);return await this.poll(o.id,r,n)}submitToolOutputsStream(e,r,n){return qo.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};Fs.Steps=Dc;var ki=class extends C{constructor(){super(...arguments),this.runs=new Fs(this._client),this.messages=new jc(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/threads/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete(O`/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:e.stream??!1})}async createAndRunPoll(e,r){let n=await this.createAndRun(e,r);return await this.runs.poll(n.id,{thread_id:n.thread_id},r)}createAndRunStream(e,r){return qo.createThreadAssistantStream(e,this._client.beta.threads,r)}};ki.Runs=Fs;ki.Messages=jc;var zn=class extends C{constructor(){super(...arguments),this.realtime=new $i(this._client),this.chatkit=new Ii(this._client),this.assistants=new Cc(this._client),this.threads=new ki(this._client)}};zn.Realtime=$i;zn.ChatKit=Ii;zn.Assistants=Cc;zn.Threads=ki;var Bs=class extends C{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}};var Uc=class extends C{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(O`/containers/${o}/files/${e}/content`,{...n,headers:L([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}};var Zs=class extends C{constructor(){super(...arguments),this.content=new Uc(this._client)}create(e,r,n){return this._client.post(O`/containers/${e}/files`,Hr({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(O`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList(O`/containers/${e}/files`,ke,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(O`/containers/${o}/files/${e}`,{...n,headers:L([{Accept:"*/*"},n?.headers])})}};Zs.Content=Uc;var Ti=class extends C{constructor(){super(...arguments),this.files=new Zs(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get(O`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/containers/${e}`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}};Ti.Files=Zs;var Fc=class extends C{create(e,r,n){let{include:o,...i}=r;return this._client.post(O`/conversations/${e}/items`,{query:{include:o},body:i,...n})}retrieve(e,r,n){let{conversation_id:o,...i}=r;return this._client.get(O`/conversations/${o}/items/${e}`,{query:i,...n})}list(e,r={},n){return this._client.getAPIList(O`/conversations/${e}/items`,Uo,{query:r,...n})}delete(e,r,n){let{conversation_id:o}=r;return this._client.delete(O`/conversations/${o}/items/${e}`,n)}};var Ei=class extends C{constructor(){super(...arguments),this.items=new Fc(this._client)}create(e={},r){return this._client.post("/conversations",{body:e,...r})}retrieve(e,r){return this._client.get(O`/conversations/${e}`,r)}update(e,r,n){return this._client.post(O`/conversations/${e}`,{body:r,...n})}delete(e,r){return this._client.delete(O`/conversations/${e}`,r)}};Ei.Items=Fc;var qs=class extends C{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&$t(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:($t(this._client).debug("embeddings/decoding base64 embeddings from base64"),i._thenUnwrap(s=>(s&&s.data&&s.data.forEach(a=>{let c=a.embedding;a.embedding=oA(c)}),s)))}};var Bc=class extends C{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get(O`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList(O`/evals/${o}/runs/${e}/output_items`,ke,{query:i,...n})}};var Vs=class extends C{constructor(){super(...arguments),this.outputItems=new Bc(this._client)}create(e,r,n){return this._client.post(O`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(O`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList(O`/evals/${e}/runs`,ke,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(O`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(O`/evals/${o}/runs/${e}`,n)}};Vs.OutputItems=Bc;var Ai=class extends C{constructor(){super(...arguments),this.runs=new Vs(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(O`/evals/${e}`,r)}update(e,r,n){return this._client.post(O`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/evals/${e}`,r)}};Ai.Runs=Vs;var Gs=class extends C{create(e,r){return this._client.post("/files",Hr({body:e,...r},this._client))}retrieve(e,r){return this._client.get(O`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/files/${e}`,r)}content(e,r){return this._client.get(O`/files/${e}/content`,{...r,headers:L([{Accept:"application/binary"},r?.headers]),__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:n=1800*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),s=await this.retrieve(e);for(;!s.status||!o.has(s.status);)if(await no(r),s=await this.retrieve(e),Date.now()-i>n)throw new Do({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return s}};var Zc=class extends C{};var qc=class extends C{run(e,r){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...r})}validate(e,r){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...r})}};var Ks=class extends C{constructor(){super(...arguments),this.graders=new qc(this._client)}};Ks.Graders=qc;var Vc=class extends C{create(e,r,n){return this._client.getAPIList(O`/fine_tuning/checkpoints/${e}/permissions`,so,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get(O`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(O`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}};var Hs=class extends C{constructor(){super(...arguments),this.permissions=new Vc(this._client)}};Hs.Permissions=Vc;var Gc=class extends C{list(e,r={},n){return this._client.getAPIList(O`/fine_tuning/jobs/${e}/checkpoints`,ke,{query:r,...n})}};var Ws=class extends C{constructor(){super(...arguments),this.checkpoints=new Gc(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(O`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",ke,{query:e,...r})}cancel(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList(O`/fine_tuning/jobs/${e}/events`,ke,{query:r,...n})}pause(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/resume`,r)}};Ws.Checkpoints=Gc;var Mn=class extends C{constructor(){super(...arguments),this.methods=new Zc(this._client),this.jobs=new Ws(this._client),this.checkpoints=new Hs(this._client),this.alpha=new Ks(this._client)}};Mn.Methods=Zc;Mn.Jobs=Ws;Mn.Checkpoints=Hs;Mn.Alpha=Ks;var Kc=class extends C{};var Oi=class extends C{constructor(){super(...arguments),this.graderModels=new Kc(this._client)}};Oi.GraderModels=Kc;var Js=class extends C{createVariation(e,r){return this._client.post("/images/variations",Hr({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",Hr({body:e,...r,stream:e.stream??!1},this._client))}generate(e,r){return this._client.post("/images/generations",{body:e,...r,stream:e.stream??!1})}};var Xs=class extends C{retrieve(e,r){return this._client.get(O`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",so,e)}delete(e,r){return this._client.delete(O`/models/${e}`,r)}};var Ys=class extends C{create(e,r){return this._client.post("/moderations",{body:e,...r})}};var Hc=class extends C{accept(e,r,n){return this._client.post(O`/realtime/calls/${e}/accept`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}hangup(e,r){return this._client.post(O`/realtime/calls/${e}/hangup`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}refer(e,r,n){return this._client.post(O`/realtime/calls/${e}/refer`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}reject(e,r={},n){return this._client.post(O`/realtime/calls/${e}/reject`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}};var Wc=class extends C{create(e,r){return this._client.post("/realtime/client_secrets",{body:e,...r})}};var Vo=class extends C{constructor(){super(...arguments),this.clientSecrets=new Wc(this._client),this.calls=new Hc(this._client)}};Vo.ClientSecrets=Wc;Vo.Calls=Hc;function pA(t,e){return!e||!QF(e)?{...t,output_parsed:null,output:t.output.map(r=>r.type==="function_call"?{...r,parsed_arguments:null}:r.type==="message"?{...r,content:r.content.map(n=>({...n,parsed:null}))}:r)}:Lw(t,e)}function Lw(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:rB(e,o)};if(o.type==="message"){let i=o.content.map(s=>s.type==="output_text"?{...s,parsed:YF(e,s.text)}:s);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||qm(n),Object.defineProperty(n,"output_parsed",{enumerable:!0,get(){for(let o of n.output)if(o.type==="message"){for(let i of o.content)if(i.type==="output_text"&&i.parsed!==null)return i.parsed}return null}}),n}function YF(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function QF(t){return!!pd(t.text?.format)}function eB(t){return t?.$brand==="auto-parseable-tool"}function tB(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function rB(t,e){let r=tB(t.tools??[],e.name);return{...e,...e,parsed_arguments:eB(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function qm(t){let e=[];for(let r of t.output)if(r.type==="message")for(let n of r.content)n.type==="output_text"&&e.push(n.text);t.output_text=e.join("")}var Jc,Vm,Pi,Gm,fA,mA,hA,gA,Km=class t extends bi{constructor(e){super(),Jc.add(this),Vm.set(this,void 0),Pi.set(this,void 0),Gm.set(this,void 0),ce(this,Vm,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createOrRetrieveResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createOrRetrieveResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,Jc,"m",fA).call(this);let i,s=null;"response_id"in r?(i=await e.responses.retrieve(r.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),s=r.starting_after??null):i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(let a of i)S(this,Jc,"m",mA).call(this,a,s);if(i.controller.signal?.aborted)throw new xt;return S(this,Jc,"m",hA).call(this)}[(Vm=new WeakMap,Pi=new WeakMap,Gm=new WeakMap,Jc=new WeakSet,fA=function(){this.ended||ce(this,Pi,void 0,"f")},mA=function(r,n){if(this.ended)return;let o=(s,a)=>{(n==null||a.sequence_number>n)&&this._emit(s,a)},i=S(this,Jc,"m",gA).call(this,r);switch(o("event",r),r.type){case"response.output_text.delta":{let s=i.output[r.output_index];if(!s)throw new V(`missing output at index ${r.output_index}`);if(s.type==="message"){let a=s.content[r.content_index];if(!a)throw new V(`missing content at index ${r.content_index}`);if(a.type!=="output_text")throw new V(`expected content to be 'output_text', got ${a.type}`);o("response.output_text.delta",{...r,snapshot:a.text})}break}case"response.function_call_arguments.delta":{let s=i.output[r.output_index];if(!s)throw new V(`missing output at index ${r.output_index}`);s.type==="function_call"&&o("response.function_call_arguments.delta",{...r,snapshot:s.arguments});break}default:o(r.type,r);break}},hA=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");let r=S(this,Pi,"f");if(!r)throw new V("request ended without sending any events");ce(this,Pi,void 0,"f");let n=nB(r,S(this,Vm,"f"));return ce(this,Gm,n,"f"),n},gA=function(r){let n=S(this,Pi,"f");if(!n){if(r.type!=="response.created")throw new V(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=ce(this,Pi,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);let i=o.type,s=r.part;i==="message"&&s.type!=="reasoning_text"?o.content.push(s):i==="reasoning"&&s.type==="reasoning_text"&&(o.content||(o.content=[]),o.content.push(s));break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new V(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new V(`expected content to be 'output_text', got ${i.type}`);i.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.reasoning_text.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);if(o.type==="reasoning"){let i=o.content?.[r.content_index];if(!i)throw new V(`missing content at index ${r.content_index}`);if(i.type!=="reasoning_text")throw new V(`expected content to be 'reasoning_text', got ${i.type}`);i.text+=r.delta}break}case"response.completed":{ce(this,Pi,r.response,"f");break}}return n},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=S(this,Gm,"f");if(!e)throw new V("stream ended without producing a ChatCompletion");return e}};function nB(t,e){return pA(t,e)}var Xc=class extends C{list(e,r={},n){return this._client.getAPIList(O`/responses/${e}/input_items`,ke,{query:r,...n})}};var Yc=class extends C{count(e={},r){return this._client.post("/responses/input_tokens",{body:e,...r})}};var Go=class extends C{constructor(){super(...arguments),this.inputItems=new Xc(this._client),this.inputTokens=new Yc(this._client)}create(e,r){return this._client.post("/responses",{body:e,...r,stream:e.stream??!1})._thenUnwrap(n=>("object"in n&&n.object==="response"&&qm(n),n))}retrieve(e,r={},n){return this._client.get(O`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&qm(o),o))}delete(e,r){return this._client.delete(O`/responses/${e}`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>Lw(n,e))}stream(e,r){return Km.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(O`/responses/${e}/cancel`,r)}compact(e={},r){return this._client.post("/responses/compact",{body:e,...r})}};Go.InputItems=Xc;Go.InputTokens=Yc;var Qc=class extends C{create(e,r,n){return this._client.post(O`/uploads/${e}/parts`,Hr({body:r,...n},this._client))}};var Ci=class extends C{constructor(){super(...arguments),this.parts=new Qc(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(O`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(O`/uploads/${e}/complete`,{body:r,...n})}};Ci.Parts=Qc;var _A=async t=>{let e=await Promise.allSettled(t),r=e.filter(o=>o.status==="rejected");if(r.length){for(let o of r)console.error(o.reason);throw new Error(`${r.length} promise(s) failed - see the above errors`)}let n=[];for(let o of e)o.status==="fulfilled"&&n.push(o.value);return n};var eu=class extends C{create(e,r,n){return this._client.post(O`/vector_stores/${e}/file_batches`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(O`/vector_stores/${o}/file_batches/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{vector_store_id:o}=r;return this._client.post(O`/vector_stores/${o}/file_batches/${e}/cancel`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r);return await this.poll(e,o.id,n)}listFiles(e,r,n){let{vector_store_id:o,...i}=r;return this._client.getAPIList(O`/vector_stores/${o}/file_batches/${e}/files`,ke,{query:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse();switch(i.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,s=Math.min(i,r.length),a=this._client,c=r.values(),u=[...n];async function l(f){for(let p of f){let m=await a.files.create({file:p,purpose:"assistants"},o);u.push(m.id)}}let d=Array(s).fill(c).map(l);return await _A(d),await this.createAndPoll(e,{file_ids:u})}};var tu=class extends C{create(e,r,n){return this._client.post(O`/vector_stores/${e}/files`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(O`/vector_stores/${o}/files/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{vector_store_id:o,...i}=r;return this._client.post(O`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/vector_stores/${e}/files`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{vector_store_id:o}=r;return this._client.delete(O`/vector_stores/${o}/files/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse(),s=i.data;switch(s.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=i.response.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"failed":case"completed":return s}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}content(e,r,n){let{vector_store_id:o}=r;return this._client.getAPIList(O`/vector_stores/${o}/files/${e}/content`,so,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var Ko=class extends C{constructor(){super(...arguments),this.files=new tu(this._client),this.fileBatches=new eu(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/vector_stores/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/vector_stores/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",ke,{query:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(O`/vector_stores/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList(O`/vector_stores/${e}/search`,so,{body:r,method:"post",...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};Ko.Files=tu;Ko.FileBatches=eu;var Qs=class extends C{create(e,r){return this._client.post("/videos",ww({body:e,...r},this._client))}retrieve(e,r){return this._client.get(O`/videos/${e}`,r)}list(e={},r){return this._client.getAPIList("/videos",Uo,{query:e,...r})}delete(e,r){return this._client.delete(O`/videos/${e}`,r)}downloadContent(e,r={},n){return this._client.get(O`/videos/${e}/content`,{query:r,...n,headers:L([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}remix(e,r,n){return this._client.post(O`/videos/${e}/remix`,ww({body:r,...n},this._client))}};var ru,yA,Hm,ea=class extends C{constructor(){super(...arguments),ru.add(this)}async unwrap(e,r,n=this._client.webhookSecret,o=300){return await this.verifySignature(e,r,n,o),JSON.parse(e)}async verifySignature(e,r,n=this._client.webhookSecret,o=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");S(this,ru,"m",yA).call(this,n);let i=L([r]).values,s=S(this,ru,"m",Hm).call(this,i,"webhook-signature"),a=S(this,ru,"m",Hm).call(this,i,"webhook-timestamp"),c=S(this,ru,"m",Hm).call(this,i,"webhook-id"),u=parseInt(a,10);if(isNaN(u))throw new ro("Invalid webhook timestamp format");let l=Math.floor(Date.now()/1e3);if(l-u>o)throw new ro("Webhook timestamp is too old");if(u>l+o)throw new ro("Webhook timestamp is too new");let d=s.split(" ").map(h=>h.startsWith("v1,")?h.substring(3):h),f=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),p=c?`${c}.${a}.${e}`:`${a}.${e}`,m=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let h of d)try{let _=Buffer.from(h,"base64");if(await crypto.subtle.verify("HMAC",m,_,new TextEncoder().encode(p)))return}catch{continue}throw new ro("The given webhook signature does not match the expected signature")}};ru=new WeakSet,yA=function(e){if(typeof e!="string"||e.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},Hm=function(e,r){if(!e)throw new Error("Headers are required");let n=e.get(r);if(n==null)throw new Error(`Missing required header: ${r}`);return n};var Uw,Fw,Wm,vA,fe=class{constructor({baseURL:e=Si("OPENAI_BASE_URL"),apiKey:r=Si("OPENAI_API_KEY"),organization:n=Si("OPENAI_ORG_ID")??null,project:o=Si("OPENAI_PROJECT_ID")??null,webhookSecret:i=Si("OPENAI_WEBHOOK_SECRET")??null,...s}={}){if(Uw.add(this),Wm.set(this,void 0),this.completions=new Bs(this),this.chat=new xi(this),this.embeddings=new qs(this),this.files=new Gs(this),this.images=new Js(this),this.audio=new ao(this),this.moderations=new Ys(this),this.models=new Xs(this),this.fineTuning=new Mn(this),this.graders=new Oi(this),this.vectorStores=new Ko(this),this.webhooks=new ea(this),this.beta=new zn(this),this.batches=new js(this),this.uploads=new Ci(this),this.responses=new Go(this),this.realtime=new Vo(this),this.conversations=new Ei(this),this.evals=new Ai(this),this.containers=new Ti(this),this.videos=new Qs(this),r===void 0)throw new V("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");let a={apiKey:r,organization:n,project:o,webhookSecret:i,...s,baseURL:e||"https://api.openai.com/v1"};if(!a.dangerouslyAllowBrowser&&kE())throw new V(`It looks like you're running in a browser-like environment. + +This is disabled by default, as it risks exposing your secret API credentials to attackers. +If you understand the risks and have appropriate mitigations in place, +you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g., + +new OpenAI({ apiKey, dangerouslyAllowBrowser: true }); + +https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety +`);this.baseURL=a.baseURL,this.timeout=a.timeout??Fw.DEFAULT_TIMEOUT,this.logger=a.logger??console;let c="warn";this.logLevel=c,this.logLevel=hw(a.logLevel,"ClientOptions.logLevel",this)??hw(Si("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??c,this.fetchOptions=a.fetchOptions,this.maxRetries=a.maxRetries??2,this.fetch=a.fetch??EE(),ce(this,Wm,OE,"f"),this._options=a,this.apiKey=typeof r=="string"?r:"Missing Key",this.organization=n,this.project=o,this.webhookSecret=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return L([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return fw(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${vi}`}defaultIdempotencyKey(){return`stainless-node-retry-${nw()}`}makeStatusError(e,r,n,o){return Pt.generate(e,r,n,o)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(n){throw n instanceof V?n:new V(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new V(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let o=!S(this,Uw,"m",vA).call(this)&&n||this.baseURL,i=yE(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery();return vE(s)||(r={...s,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}async prepareOptions(e){await this._callApiKey()}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(o=>({method:e,path:r,...o})))}request(e,r=null){return new Rs(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,i=o.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(o);let{req:s,url:a,timeout:c}=await this.buildRequest(o,{retryCount:i-r});await this.prepareRequest(s,{url:a,options:o});let u="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),l=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if($t(this).debug(`[${u}] sending request`,Lo({retryOfRequestLogID:n,method:o.method,url:a,options:o,headers:s.headers})),o.signal?.aborted)throw new xt;let f=new AbortController,p=await this.fetchWithTimeout(a,s,c,f).catch(rd),m=Date.now();if(p instanceof globalThis.Error){let v=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new xt;let b=td(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return $t(this).info(`[${u}] connection ${b?"timed out":"failed"} - ${v}`),$t(this).debug(`[${u}] connection ${b?"timed out":"failed"} (${v})`,Lo({retryOfRequestLogID:n,url:a,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??u);throw $t(this).info(`[${u}] connection ${b?"timed out":"failed"} - error; no more retries left`),$t(this).debug(`[${u}] connection ${b?"timed out":"failed"} (error; no more retries left)`,Lo({retryOfRequestLogID:n,url:a,durationMs:m-d,message:p.message})),b?new Do:new yi({cause:p})}let h=[...p.headers.entries()].filter(([v])=>v==="x-request-id").map(([v,b])=>", "+v+": "+JSON.stringify(b)).join(""),_=`[${u}${l}${h}] ${s.method} ${a} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let v=await this.shouldRetry(p);if(r&&v){let J=`retrying, ${r} attempts remaining`;return await AE(p.body),$t(this).info(`${_} - ${J}`),$t(this).debug(`[${u}] response error (${J})`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??u,p.headers)}let b=v?"error; no more retries left":"error; not retryable";$t(this).info(`${_} - ${b}`);let x=await p.text().catch(J=>rd(J).message),k=xE(x),T=k?void 0:x;throw $t(this).debug(`[${u}] response error (${b})`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:T,durationMs:Date.now()-d})),this.makeStatusError(p.status,k,T,p.headers)}return $t(this).info(_),$t(this).debug(`[${u}] response start`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),{response:p,options:o,controller:f,requestLogID:u,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new cd(this,n,e)}async fetchWithTimeout(e,r,n,o){let{signal:i,method:s,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let c=setTimeout(()=>o.abort(),n),u=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,l={signal:o.signal,...u?{duplex:"half"}:{},method:"GET",...a};s&&(l.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,l)}finally{clearTimeout(c)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,o){let i,s=o?.get("retry-after-ms");if(s){let c=parseFloat(s);Number.isNaN(c)||(i=c)}let a=o?.get("retry-after");if(a&&!i){let c=parseFloat(a);Number.isNaN(c)?i=Date.parse(a)-Date.now():i=c*1e3}if(!(i&&0<=i&&i<60*1e3)){let c=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,c)}return await no(i),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,s=Math.min(.5*Math.pow(2,i),8),a=1-Math.random()*.25;return s*a*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:s,defaultBaseURL:a}=n,c=this.buildURL(i,s,a);"timeout"in n&&wE("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:u,body:l}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:u,retryCount:r});return{req:{method:o,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:c,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let s=L([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...TE(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=L([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:xm(e)}:S(this,Wm,"f").call(this,{body:e,headers:n})}};Fw=fe,Wm=new WeakMap,Uw=new WeakSet,vA=function(){return this.baseURL!=="https://api.openai.com/v1"};fe.OpenAI=Fw;fe.DEFAULT_TIMEOUT=6e5;fe.OpenAIError=V;fe.APIError=Pt;fe.APIConnectionError=yi;fe.APIConnectionTimeoutError=Do;fe.APIUserAbortError=xt;fe.NotFoundError=gc;fe.ConflictError=_c;fe.RateLimitError=vc;fe.BadRequestError=fc;fe.AuthenticationError=mc;fe.InternalServerError=bc;fe.PermissionDeniedError=hc;fe.UnprocessableEntityError=yc;fe.InvalidWebhookSignatureError=ro;fe.toFile=ld;fe.Completions=Bs;fe.Chat=xi;fe.Embeddings=qs;fe.Files=Gs;fe.Images=Js;fe.Audio=ao;fe.Moderations=Ys;fe.Models=Xs;fe.FineTuning=Mn;fe.Graders=Oi;fe.VectorStores=Ko;fe.Webhooks=ea;fe.Beta=zn;fe.Batches=js;fe.Uploads=Ci;fe.Responses=Go;fe.Realtime=Vo;fe.Conversations=Ei;fe.Evals=Ai;fe.Containers=Ti;fe.Videos=Qs;var lB=Object.defineProperty,G=(t,e)=>{for(var r in e)lB(t,r,{get:e[r],enumerable:!0})};function Jr(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function nu(t){return Jr(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function ou(t){return Jr(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function bA(t){return Jr(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function Jm(t){return Jr(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function Xm(t){if(Jr(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function Ym(t){let e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);let r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);let o={};for(let i of t.split(";").slice(1)){let s=i.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);let a=s[0].trim(),c=s[1].trim();if(a==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);o[a]=c}return{type:r,subtype:n,parameters:o}}function ta({dataUrl:t,asTypedArray:e=!1}){let r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let o=e?Uint8Array.from(atob(r[2]),i=>i.charCodeAt(0)):r[2];return{mime_type:n,data:o}}}function $d(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}function Qm(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var OA=mn(xA(),1),_B=mn(AA(),1);function PA(t,e){return e?.[t]||(0,OA.default)(t)}function CA(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var yB={};G(yB,{Serializable:()=>uo,get_lc_unique_name:()=>eh});function RA(t){return Array.isArray(t)?[...t]:{...t}}function vB(t,e){let r=RA(t);for(let[n,o]of Object.entries(e)){let[i,...s]=n.split(".").reverse(),a=r;for(let c of s.reverse()){if(a[c]===void 0)break;a[c]=RA(a[c]),a=a[c]}a[i]!==void 0&&(a[i]={lc:1,type:"secret",id:[o]})}return r}function eh(t){let e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var uo=class NA{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eh(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof NA||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((o,i)=>(o[i]=i in this?this[i]:this.lc_kwargs[i],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(e,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));return Object.keys(r).forEach(o=>{let i=this,s=n,[a,...c]=o.split(".").reverse();for(let u of c.reverse()){if(!(u in i)||i[u]===void 0)return;(!(u in s)||s[u]===void 0)&&(typeof i[u]=="object"&&i[u]!=null?s[u]={}:Array.isArray(i[u])&&(s[u]=[])),i=i[u],s=s[u]}a in i&&i[a]!==void 0&&(s[a]=s[a]||i[a])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:CA(Object.keys(r).length?vB(n,r):n,PA,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function re(t,e){return me(t)&&t.type===e}function me(t){return typeof t=="object"&&t!==null}function Ar(t){return Array.isArray(t)}function K(t){return typeof t=="string"}function Xr(t){return typeof t=="number"}function th(t){return t instanceof Uint8Array}function qw(t){try{return JSON.parse(t)}catch{return}}var Ho=t=>t();function bB(t){if(t.type==="char_location"&&K(t.document_title)&&Xr(t.start_char_index)&&Xr(t.end_char_index)&&K(t.cited_text)){let{document_title:e,start_char_index:r,end_char_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"char",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="page_location"&&K(t.document_title)&&Xr(t.start_page_number)&&Xr(t.end_page_number)&&K(t.cited_text)){let{document_title:e,start_page_number:r,end_page_number:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"page",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="content_block_location"&&K(t.document_title)&&Xr(t.start_block_index)&&Xr(t.end_block_index)&&K(t.cited_text)){let{document_title:e,start_block_index:r,end_block_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"block",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="web_search_result_location"&&K(t.url)&&K(t.title)&&K(t.encrypted_index)&&K(t.cited_text)){let{url:e,title:r,encrypted_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"url",url:e,title:r,startIndex:Number(n),endIndex:Number(n),citedText:o}}if(t.type==="search_result_location"&&K(t.source)&&K(t.title)&&Xr(t.start_block_index)&&Xr(t.end_block_index)&&K(t.cited_text)){let{source:e,title:r,start_block_index:n,end_block_index:o,cited_text:i,...s}=t;return{...s,type:"citation",source:"search",url:e,title:r??void 0,startIndex:n,endIndex:o,citedText:i}}}function MA(t){if(re(t,"document")&&me(t.source)&&"type"in t.source){if(t.source.type==="base64"&&K(t.source.media_type)&&K(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&K(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&K(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&K(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(re(t,"image")&&me(t.source)&&"type"in t.source){if(t.source.type==="base64"&&K(t.source.media_type)&&K(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&K(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&K(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function jA(t){function*e(){for(let r of t){let n=MA(r);n?yield n:yield r}}return Array.from(e())}function zA(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"text")&&K(n.text)){let{text:o,citations:i,...s}=n;if(Ar(i)&&i.length){let a=i.reduce((c,u)=>{let l=bB(u);return l?[...c,l]:c},[]);yield{...s,type:"text",text:o,annotations:a};continue}else{yield{...s,type:"text",text:o};continue}}else if(re(n,"thinking")&&K(n.thinking)){let{thinking:o,signature:i,...s}=n;yield{...s,type:"reasoning",reasoning:o,signature:i};continue}else if(re(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(re(n,"tool_use")&&K(n.name)&&K(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(re(n,"input_json_delta")){if(wB(t)&&t.tool_call_chunks?.length){let o=t.tool_call_chunks[0];yield{type:"tool_call_chunk",id:o.id,name:o.name,args:o.args,index:o.index};continue}}else if(re(n,"server_tool_use")&&K(n.name)&&K(n.id)){let{name:o,id:i}=n;if(o==="web_search"){let s=Ho(()=>{if(typeof n.input=="string")return n.input;if(me(n.input)&&K(n.input.query))return n.input.query;if(K(n.partial_json)){let a=qw(n.partial_json);if(a?.query)return a.query}return""});yield{id:i,type:"server_tool_call",name:"web_search",args:{query:s}};continue}else if(n.name==="code_execution"){let s=Ho(()=>{if(typeof n.input=="string")return n.input;if(me(n.input)&&K(n.input.code))return n.input.code;if(K(n.partial_json)){let a=qw(n.partial_json);if(a?.code)return a.code}return""});yield{id:i,type:"server_tool_call",name:"code_execution",args:{code:s}};continue}}else if(re(n,"web_search_tool_result")&&K(n.tool_use_id)&&Ar(n.content)){let{content:o,tool_use_id:i}=n,s=o.reduce((a,c)=>re(c,"web_search_result")?[...a,c.url]:a,[]);yield{type:"server_tool_call_result",name:"web_search",toolCallId:i,status:"success",output:{urls:s}};continue}else if(re(n,"code_execution_tool_result")&&K(n.tool_use_id)&&me(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(re(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(re(n,"mcp_tool_result")&&K(n.tool_use_id)&&me(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(re(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(re(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(re(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let o=MA(n);if(o){yield o;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var DA={translateContent:zA,translateContentChunk:zA};function wB(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}function xB(t){return nu(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:ou(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:Jm(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function LA(t){return t.map(xB)}function UA(t){return!!(re(t,"image_url")&&me(t.image_url)||re(t,"input_audio")&&me(t.input_audio)||re(t,"file")&&me(t.file))}function FA(t){if(re(t,"image_url")&&me(t.image_url)&&K(t.image_url.url)){let e=ta({dataUrl:t.image_url.url});return e?{type:"image",mimeType:e.mime_type,data:e.data}:{type:"image",url:t.image_url.url}}else{if(re(t,"input_audio")&&me(t.input_audio)&&K(t.input_audio.data)&&K(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(re(t,"file")&&me(t.file)&&K(t.file.data)){let e=ta({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(K(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}function $B(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...rh(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function IB(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...rh(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function rh(t){let e=[];for(let r of t)UA(r)?e.push(FA(r)):e.push(r);return e}function SB(t){if(t.type==="url_citation"){let{url:e,title:r,start_index:n,end_index:o}=t;return{type:"citation",url:e,title:r,startIndex:n,endIndex:o}}if(t.type==="file_citation"){let{file_id:e,filename:r,index:n}=t;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:e}}return t}function BA(t){function*e(){me(t.additional_kwargs?.reasoning)&&Ar(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((o,i)=>me(i)&&K(i.text)?`${o}${i.text}`:o,"")});let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r)if(re(n,"text")){let{text:o,annotations:i,...s}=n;Array.isArray(i)?yield{...s,type:"text",text:String(o),annotations:i.map(SB)}:yield{...s,type:"text",text:String(o)}}for(let n of t.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(me(t.additional_kwargs)&&Ar(t.additional_kwargs.tool_outputs))for(let n of t.additional_kwargs.tool_outputs){if(re(n,"web_search_call")){yield{id:n.id,type:"server_tool_call",name:"web_search",args:{query:n.query}};continue}else if(re(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{query:n.query}};continue}else if(re(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(re(n,"code_interpreter_call")){if(K(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),Ar(n.outputs)){let o=Ho(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(let i of n.outputs)if(re(i,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:o??0,stderr:[0,void 0].includes(o)?void 0:String(i.logs),stdout:[0,void 0].includes(o)?String(i.logs):void 0}};continue}}continue}else if(re(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(re(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(re(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(re(n,"image_generation_call")){yield{type:"non_standard",value:n};continue}me(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function kB(t){function*e(){yield*BA(t);for(let r of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(e())}var ZA={translateContent:t=>typeof t.content=="string"?$B(t):BA(t),translateContentChunk:t=>typeof t.content=="string"?IB(t):kB(t)};function qA(t,e="pretty"){return e==="pretty"?TB(t):JSON.stringify(t)}function TB(t){let e=[],r=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),o="=".repeat(n),i=r.length%2===0?o:`${o}=`;if(e.push(`${o}${r}${i}`),t.type==="ai"){let s=t;if(s.tool_calls&&s.tool_calls.length>0){e.push("Tool Calls:");for(let a of s.tool_calls){e.push(` ${a.name} (${a.id})`),e.push(` Call ID: ${a.id}`),e.push(" Args:");for(let[c,u]of Object.entries(a.args))e.push(` ${c}: ${u}`)}}}if(t.type==="tool"){let s=t;s.name&&e.push(`Name: ${s.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(` +`)}var Vw=Symbol.for("langchain.message");function er(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.length===0?t:Array.isArray(e)&&e.some(r=>Jr(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?ra(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>Jr(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function nh(t,e){return t==="error"||e==="error"?"error":"success"}function EB(t,e){function r(n,o){if(typeof n!="object"||n===null||n===void 0)return n;if(o>=e)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(s=>r(s,o+1));let i={};for(let s of Object.keys(n))i[s]=r(n[s],o+1);return i}return JSON.stringify(r(t,0),null,2)}var qt=class extends uo{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[Vw]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(t){let e=typeof t=="string"||Array.isArray(t)?{content:t}:t;e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),this.name=e.name,e.content===void 0&&e.contentBlocks!==void 0?(this.content=e.contentBlocks,this.response_metadata={output_version:"v1",...e.response_metadata}):e.content!==void 0?(this.content=e.content??[],this.response_metadata=e.response_metadata):(this.content=[],this.response_metadata=e.response_metadata),this.additional_kwargs=e.additional_kwargs,this.id=e.id}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(t=>typeof t=="string"?t:t.type==="text"?t.text:"").join(""):""}get contentBlocks(){let t=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[LA,rh,jA].reduce((n,o)=>o(n),t)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(t){return typeof t=="object"&&t!==null&&Vw in t&&t[Vw]===!0&&Qm(t)}_updateId(t){this.id=t,this.lc_kwargs.id=t}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](t){if(t===null)return this;let e=EB(this._printableFields,Math.max(4,t));return`${this.constructor.lc_name()} ${e}`}toFormattedString(t="pretty"){return qA(this,t)}};function VA(t){return Array.isArray(t)&&t.every(e=>typeof e.index=="number")}function dt(t={},e={}){let r={...t};for(let[n,o]of Object.entries(e))if(r[n]==null)r[n]=o;else{if(o==null)continue;if(typeof r[n]!=typeof o||Array.isArray(r[n])!==Array.isArray(o))throw new Error(`field[${n}] already exists in the message chunk, but with a different type.`);if(typeof r[n]=="string"){if(n==="type")continue;["id","name","output_version","model_provider"].includes(n)?o&&(r[n]=o):r[n]+=o}else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=dt(r[n],o);else if(Array.isArray(r[n]))r[n]=ra(r[n],o);else{if(r[n]===o)continue;console.warn(`field[${n}] already exists in this message chunk and value has unsupported type.`)}}return r}function ra(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)return t||e;{let r=[...t];for(let n of e)if(typeof n=="object"&&n!==null&&"index"in n&&typeof n.index=="number"){let o=r.findIndex(i=>{let s=typeof i=="object",a="index"in i&&i.index===n.index,c="id"in i&&"id"in n&&i?.id===n?.id,u=!("id"in i)||!i?.id||!("id"in n)||!n?.id;return s&&a&&(c||u)});o!==-1&&typeof r[o]=="object"&&r[o]!==null?r[o]=dt(r[o],n):r.push(n)}else{if(typeof n=="object"&&n!==null&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function oh(t,e){if(!t&&!e)throw new Error("Cannot merge two undefined objects.");if(!t||!e)return t||e;if(typeof t!=typeof e)throw new Error(`Cannot merge objects of different types. +Left ${typeof t} +Right ${typeof e}`);if(typeof t=="string"&&typeof e=="string")return t+e;if(Array.isArray(t)&&Array.isArray(e))return ra(t,e);if(typeof t=="object"&&typeof e=="object")return dt(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types. +Left ${t} +Right ${e}`)}var fr=class GA extends qt{static isInstance(e){if(!super.isInstance(e))return!1;let r=Object.getPrototypeOf(e);for(;r!==null;){if(r===GA.prototype)return!0;r=Object.getPrototypeOf(r)}return!1}};function ih(t){return typeof t.role=="string"}function Yr(t){return typeof t?._getType=="function"}function iu(t){return fr.isInstance(t)}function sh(t,e){return dt(t??{},e??{})}function KA(t,e){let r={};return(t?.audio!==void 0||e?.audio!==void 0)&&(r.audio=(t?.audio??0)+(e?.audio??0)),(t?.image!==void 0||e?.image!==void 0)&&(r.image=(t?.image??0)+(e?.image??0)),(t?.video!==void 0||e?.video!==void 0)&&(r.video=(t?.video??0)+(e?.video??0)),(t?.document!==void 0||e?.document!==void 0)&&(r.document=(t?.document??0)+(e?.document??0)),(t?.text!==void 0||e?.text!==void 0)&&(r.text=(t?.text??0)+(e?.text??0)),r}function AB(t,e){let r={...KA(t,e)};return(t?.cache_read!==void 0||e?.cache_read!==void 0)&&(r.cache_read=(t?.cache_read??0)+(e?.cache_read??0)),(t?.cache_creation!==void 0||e?.cache_creation!==void 0)&&(r.cache_creation=(t?.cache_creation??0)+(e?.cache_creation??0)),r}function OB(t,e){let r={...KA(t,e)};return(t?.reasoning!==void 0||e?.reasoning!==void 0)&&(r.reasoning=(t?.reasoning??0)+(e?.reasoning??0)),r}function ah(t,e){return{input_tokens:(t?.input_tokens??0)+(e?.input_tokens??0),output_tokens:(t?.output_tokens??0)+(e?.output_tokens??0),total_tokens:(t?.total_tokens??0)+(e?.total_tokens??0),input_token_details:AB(t?.input_token_details,e?.input_token_details),output_token_details:OB(t?.output_token_details,e?.output_token_details)}}var PB={};G(PB,{ToolMessage:()=>Or,ToolMessageChunk:()=>na,defaultToolCallParser:()=>Sd,isDirectToolOutput:()=>Id,isToolMessage:()=>Gw,isToolMessageChunk:()=>Kw});function Id(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}var Or=class extends qt{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}lc_direct_tool_output=!0;type="tool";status;tool_call_id;metadata;artifact;constructor(t,e,r){let n=typeof t=="string"||Array.isArray(t)?{content:t,name:r,tool_call_id:e}:t;super(n),this.tool_call_id=n.tool_call_id,this.artifact=n.artifact,this.status=n.status,this.metadata=n.metadata}static isInstance(t){return super.isInstance(t)&&t.type==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},na=class extends fr{type="tool";tool_call_id;status;artifact;constructor(t){super(t),this.tool_call_id=t.tool_call_id,this.artifact=t.artifact,this.status=t.status}static lc_name(){return"ToolMessageChunk"}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),artifact:oh(this.artifact,t.artifact),tool_call_id:this.tool_call_id,id:this.id??t.id,status:nh(this.status,t.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}};function Sd(t){let e=[],r=[];for(let n of t)if(n.function){let o=n.function.name;try{let i=JSON.parse(n.function.arguments);e.push({name:o||"",args:i||{},id:n.id})}catch{r.push({name:o,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[e,r]}function Gw(t){return typeof t=="object"&&t!==null&&"getType"in t&&typeof t.getType=="function"&&t.getType()==="tool"}function Kw(t){return t._getType()==="tool"}var jn=class HA extends qt{static lc_name(){return"ChatMessage"}type="generic";role;static _chatMessageClass(){return HA}constructor(e,r){(typeof e=="string"||Array.isArray(e))&&(e={content:e,role:r}),super(e),this.role=e.role}static isInstance(e){return super.isInstance(e)&&e.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},Ri=class extends fr{static lc_name(){return"ChatMessageChunk"}type="generic";role;constructor(t,e){(typeof t=="string"||Array.isArray(t))&&(t={content:t,role:e}),super(t),this.role=t.role}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),role:this.role,id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}};function WA(t){return t._getType()==="generic"}function JA(t){return t._getType()==="generic"}var oa=class extends qt{static lc_name(){return"FunctionMessage"}type="function";name;constructor(t){super(t),this.name=t.name}},Ni=class extends fr{static lc_name(){return"FunctionMessageChunk"}type="function";concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),name:this.name??"",id:this.id??t.id})}};function XA(t){return t._getType()==="function"}function YA(t){return t._getType()==="function"}var mr=class extends qt{static lc_name(){return"HumanMessage"}type="human";constructor(t){super(t)}static isInstance(t){return super.isInstance(t)&&t.type==="human"}},zi=class extends fr{static lc_name(){return"HumanMessageChunk"}type="human";constructor(t){super(t)}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="human"}};function QA(t){return t.getType()==="human"}function eO(t){return t.getType()==="human"}var ia=class extends qt{type="remove";id;constructor(t){super({...t,content:[]}),this.id=t.id}get _printableFields(){return{...super._printableFields,id:this.id}}static isInstance(t){return super.isInstance(t)&&t.type==="remove"}};var hn=class ch extends qt{static lc_name(){return"SystemMessage"}type="system";constructor(e){super(e)}concat(e){if(typeof e=="string")return new ch({...this,content:er(this.content,e)});if(ch.isInstance(e))return new ch({...this,additional_kwargs:{...this.additional_kwargs,...e.additional_kwargs},response_metadata:{...this.response_metadata,...e.response_metadata},content:er(this.content,e.content)});throw new Error("Unexpected chunk type for system message")}static isInstance(e){return super.isInstance(e)&&e.type==="system"}},lo=class extends fr{static lc_name(){return"SystemMessageChunk"}type="system";constructor(t){super(t)}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="system"}};function tO(t){return t._getType()==="system"}function rO(t){return t._getType()==="system"}function uh(t,e){return t.lc_error_code=e,t.message=`${t.message} + +Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/ +`,t}function Mi(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function nO(t){return!!(t&&typeof t=="object"&&"toolCall"in t&&t.toolCall!=null&&typeof t.toolCall=="object"&&"id"in t.toolCall&&typeof t.toolCall.id=="string")}var su=class extends Error{output;constructor(t,e){super(t),this.output=e}};function kd(t,e=sa){t=t.trim();let r=t.indexOf("```");if(r===-1)return e(t);let n=t.substring(r+3);n.startsWith(`json +`)?n=n.substring(5):n.startsWith("json")?n=n.substring(4):n.startsWith(` +`)&&(n=n.substring(1));let o=n.indexOf("```"),i=n;return o!==-1&&(i=n.substring(0,o)),e(i.trim())}function CB(t){try{return JSON.parse(t)}catch{}let e=t.trim();if(e.length===0)throw new Error("Unexpected end of JSON input");let r=0;function n(){for(;r="0"&&e[r]<="9"))throw new Error(`Invalid number at position ${l}`);if(r="1"&&e[r]<="9")for(;r="0"&&e[r]<="9";)d+=e[r],r+=1;if(r="0"&&e[r]<="9";)d+=e[r],r+=1;if(r="0"&&e[r]<="9";)d+=e[r],r+=1;if(d==="-")return-0;let f=Number.parseFloat(d);if(Number.isNaN(f))throw r=l,new Error(`Invalid number '${d}' at position ${l}`);return f}function s(){if(n(),r>=e.length)throw new Error(`Unexpected end of input at position ${r}`);let l=e[r];if(l==="{")return c();if(l==="[")return a();if(l==='"')return o();if("null".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),null;if("true".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),!0;if("false".startsWith(e.substring(r,r+5)))return r+=Math.min(5,e.length-r),!1;if(l==="-"||l>="0"&&l<="9")return i();throw new Error(`Unexpected character '${l}' at position ${r}`)}function a(){if(e[r]!=="[")throw new Error(`Expected '[' at position ${r}, got '${e[r]}'`);let l=[];if(r+=1,n(),r>=e.length)return l;if(e[r]==="]")return r+=1,l;for(;r=e.length||(l.push(s()),n(),r>=e.length))return l;if(e[r]==="]")return r+=1,l;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or ']' at position ${r}, got '${e[r]}'`)}return l}function c(){if(e[r]!=="{")throw new Error(`Expected '{' at position ${r}, got '${e[r]}'`);let l={};if(r+=1,n(),r>=e.length)return l;if(e[r]==="}")return r+=1,l;for(;r=e.length)return l;let d=o();if(n(),r>=e.length)return l;if(e[r]!==":")throw new Error(`Expected ':' at position ${r}, got '${e[r]}'`);if(r+=1,n(),r>=e.length||(l[d]=s(),n(),r>=e.length))return l;if(e[r]==="}")return r+=1,l;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or '}' at position ${r}, got '${e[r]}'`)}return l}let u=s();if(n(),r"u"?null:CB(t)}catch{return null}}function Hw(t){switch(t){case"csv":return"text/csv";case"doc":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"html":return"text/html";case"md":return"text/markdown";case"pdf":return"application/pdf";case"txt":return"text/plain";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"gif":return"image/gif";case"jpeg":return"image/jpeg";case"jpg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"flv":return"video/flv";case"mkv":return"video/mkv";case"mov":return"video/mov";case"mp4":return"video/mp4";case"mpeg":return"video/mpeg";case"mpg":return"video/mpg";case"three_gp":return"video/three_gp";case"webm":return"video/webm";case"wmv":return"video/wmv";default:return"application/octet-stream"}}function RB(t){if(me(t.document)&&me(t.document.source)){let e=me(t.document)&&K(t.document.format)?t.document.format:"",r=Hw(e);if(me(t.document.source)){if(me(t.document.source.s3Location)&&K(t.document.source.s3Location.uri))return{type:"file",mimeType:r,fileId:t.document.source.s3Location.uri};if(th(t.document.source.bytes))return{type:"file",mimeType:r,data:t.document.source.bytes};if(K(t.document.source.text))return{type:"file",mimeType:r,data:Buffer.from(t.document.source.text).toString("base64")};if(Ar(t.document.source.content)){let n=t.document.source.content.reduce((o,i)=>me(i)&&K(i.text)?o+i.text:o,"");return{type:"file",mimeType:r,data:n}}}}return{type:"non_standard",value:t}}function NB(t){if(re(t,"image")&&me(t.image)){let e=me(t.image)&&K(t.image.format)?t.image.format:"",r=Hw(e);if(me(t.image.source)){if(me(t.image.source.s3Location)&&K(t.image.source.s3Location.uri))return{type:"image",mimeType:r,fileId:t.image.source.s3Location.uri};if(th(t.image.source.bytes))return{type:"image",mimeType:r,data:t.image.source.bytes}}}return{type:"non_standard",value:t}}function zB(t){if(re(t,"video")&&me(t.video)){let e=me(t.video)&&K(t.video.format)?t.video.format:"",r=Hw(e);if(me(t.video.source)){if(me(t.video.source.s3Location)&&K(t.video.source.s3Location.uri))return{type:"video",mimeType:r,fileId:t.video.source.s3Location.uri};if(th(t.video.source.bytes))return{type:"video",mimeType:r,data:t.video.source.bytes}}}return{type:"non_standard",value:t}}function oO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"cache_point")){yield{type:"non_standard",value:n};continue}else if(re(n,"citations_content")&&me(n.citationsContent)){let o=Ar(n.citationsContent.content)?n.citationsContent.content.reduce((s,a)=>me(a)&&K(a.text)?s+a.text:s,""):"",i=Ar(n.citationsContent.citations)?n.citationsContent.citations.reduce((s,a)=>{if(me(a)){let c=Ar(a.sourceContent)?a.sourceContent.reduce((l,d)=>me(d)&&K(d.text)?l+d.text:l,""):"",u=Ho(()=>{if(me(a.location)){let l=a.location.documentChar||a.location.documentPage||a.location.documentChunk;if(me(l))return{source:Xr(l.documentIndex)?l.documentIndex.toString():void 0,startIndex:Xr(l.start)?l.start:void 0,endIndex:Xr(l.end)?l.end:void 0}}return{}});s.push({type:"citation",citedText:c,...u})}return s},[]):[];yield{type:"text",text:o,annotations:i};continue}else if(re(n,"document")&&me(n.document)){yield RB(n);continue}else if(re(n,"guard_content")){yield{type:"non_standard",value:n};continue}else if(re(n,"image")&&me(n.image)){yield NB(n);continue}else if(re(n,"reasoning_content")&&K(n.reasoningText)){yield{type:"reasoning",reasoning:n.reasoningText};continue}else if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"tool_result")){yield{type:"non_standard",value:n};continue}else{if(re(n,"tool_call"))continue;if(re(n,"video")&&me(n.video)){yield zB(n);continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var iO={translateContent:oO,translateContentChunk:oO};function sO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"inlineData")&&me(n.inlineData)&&K(n.inlineData.mimeType)&&K(n.inlineData.data)){yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data};continue}else if(re(n,"functionCall")&&me(n.functionCall)&&K(n.functionCall.name)&&me(n.functionCall.args)){yield{type:"tool_call",id:t.id,name:n.functionCall.name,args:n.functionCall.args};continue}else if(re(n,"functionResponse")){yield{type:"non_standard",value:n};continue}else if(re(n,"fileData")&&me(n.fileData)&&K(n.fileData.mimeType)&&K(n.fileData.fileUri)){yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri};continue}else if(re(n,"executableCode")){yield{type:"non_standard",value:n};continue}else if(re(n,"codeExecutionResult")){yield{type:"non_standard",value:n};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var aO={translateContent:sO,translateContentChunk:sO};function cO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"reasoning")&&K(n.reasoning)){let o=Ho(()=>{let i=r.indexOf(n);if(Ar(t.additional_kwargs?.signatures)&&i>=0)return t.additional_kwargs.signatures.at(i)});K(o)?yield{type:"reasoning",reasoning:n.reasoning,signature:o}:yield{type:"reasoning",reasoning:n.reasoning};continue}else if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"image_url")){if(K(n.image_url))if(n.image_url.startsWith("data:")){let o=/^data:([^;]+);base64,(.+)$/,i=n.image_url.match(o);i?yield{type:"image",data:i[2],mimeType:i[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url};continue}else if(re(n,"media")&&K(n.mimeType)&&K(n.data)){yield{type:"file",mimeType:n.mimeType,data:n.data};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var uO={translateContent:cO,translateContentChunk:cO};globalThis.lc_block_translators_registry??=new Map([["anthropic",DA],["bedrock-converse",iO],["google-genai",aO],["google-vertexai",uO],["openai",ZA]]);function Ww(t){return globalThis.lc_block_translators_registry.get(t)}var jt=class extends qt{type="ai";tool_calls=[];invalid_tool_calls=[];usage_metadata;get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls"}}constructor(t){let e;if(typeof t=="string"||Array.isArray(t))e={content:t,tool_calls:[],invalid_tool_calls:[],additional_kwargs:{}};else{e=t;let r=e.additional_kwargs?.tool_calls,n=e.tool_calls;r!=null&&r.length>0&&(n===void 0||n.length===0)&&console.warn(["New LangChain packages are available that more efficiently handle",`tool calling. + +Please upgrade your packages to versions that set`,"message tool calls. e.g., `pnpm install @langchain/anthropic`,","pnpm install @langchain/openai`, etc."].join(" "));try{if(r!=null&&n===void 0){let[o,i]=Sd(r);e.tool_calls=o??[],e.invalid_tool_calls=i??[]}else e.tool_calls=e.tool_calls??[],e.invalid_tool_calls=e.invalid_tool_calls??[]}catch{e.tool_calls=[],e.invalid_tool_calls=[]}if(e.response_metadata!==void 0&&"output_version"in e.response_metadata&&e.response_metadata.output_version==="v1"&&(e.contentBlocks=e.content,e.content=void 0),e.contentBlocks!==void 0){e.contentBlocks.push(...e.tool_calls.map(i=>({type:"tool_call",id:i.id,name:i.name,args:i.args})));let o=e.contentBlocks.filter(i=>i.type==="tool_call").filter(i=>!e.tool_calls?.some(s=>s.id===i.id&&s.name===i.name));o.length>0&&(e.tool_calls=o.map(i=>({type:"tool_call",id:i.id,name:i.name,args:i.args})))}}super(e),typeof e!="string"&&(this.tool_calls=e.tool_calls??this.tool_calls,this.invalid_tool_calls=e.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=e.usage_metadata}static lc_name(){return"AIMessage"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let e=Ww(this.response_metadata.model_provider);if(e)return e.translateContent(this)}let t=super.contentBlocks;if(this.tool_calls){let e=this.tool_calls.filter(r=>!t.some(n=>n.id===r.id&&n.name===r.name));t.push(...e.map(r=>({...r,type:"tool_call",id:r.id,name:r.name,args:r.args})))}return t}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}static isInstance(t){return super.isInstance(t)&&t.type==="ai"}};function aa(t){return t._getType()==="ai"}function Td(t){return t._getType()==="ai"}var Dt=class extends fr{type="ai";tool_calls=[];invalid_tool_calls=[];tool_call_chunks=[];usage_metadata;constructor(t){let e;typeof t=="string"||Array.isArray(t)?e={content:t,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]}:t.tool_call_chunks===void 0||t.tool_call_chunks.length===0?e={...t,tool_calls:t.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:t.usage_metadata!==void 0?t.usage_metadata:void 0}:e={...t,...lh(t.tool_call_chunks??[]),usage_metadata:t.usage_metadata!==void 0?t.usage_metadata:void 0},super(e),this.tool_call_chunks=e.tool_call_chunks??this.tool_call_chunks,this.tool_calls=e.tool_calls??this.tool_calls,this.invalid_tool_calls=e.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=e.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks"}}static lc_name(){return"AIMessageChunk"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let e=Ww(this.response_metadata.model_provider);if(e)return e.translateContent(this)}let t=super.contentBlocks;if(this.tool_calls&&typeof this.content!="string"){let e=this.content.filter(r=>r.type==="tool_call").map(r=>r.id);for(let r of this.tool_calls)r.id&&!e.includes(r.id)&&t.push({...r,type:"tool_call",id:r.id,name:r.name,args:r.args})}return t}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(t){let e={content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:sh(this.response_metadata,t.response_metadata),tool_call_chunks:[],id:this.id??t.id};if(this.tool_call_chunks!==void 0||t.tool_call_chunks!==void 0){let n=ra(this.tool_call_chunks,t.tool_call_chunks);n!==void 0&&n.length>0&&(e.tool_call_chunks=n)}(this.usage_metadata!==void 0||t.usage_metadata!==void 0)&&(e.usage_metadata=ah(this.usage_metadata,t.usage_metadata));let r=this.constructor;return new r(e)}static isInstance(t){return super.isInstance(t)&&t.type==="ai"}};var Xw=t=>t();function MB(t){return Mi(t)?t:typeof t.id=="string"&&t.type==="function"&&typeof t.function=="object"&&t.function!==null&&"arguments"in t.function&&typeof t.function.arguments=="string"&&"name"in t.function&&typeof t.function.name=="string"?{id:t.id,args:JSON.parse(t.function.arguments),name:t.function.name,type:"tool_call"}:t}function jB(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function Jw(t){let e,r;if(jB(t)){let n=t.id.at(-1);n==="HumanMessage"||n==="HumanMessageChunk"?e="user":n==="AIMessage"||n==="AIMessageChunk"?e="assistant":n==="SystemMessage"||n==="SystemMessageChunk"?e="system":n==="FunctionMessage"||n==="FunctionMessageChunk"?e="function":n==="ToolMessage"||n==="ToolMessageChunk"?e="tool":e="unknown",r=t.kwargs}else{let{type:n,...o}=t;e=n,r=o}if(e==="human"||e==="user")return new mr(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new jt(r);let i=n.map(MB);return new jt({...o,tool_calls:i})}else{if(e==="system")return new hn(r);if(e==="developer")return new hn({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new Or({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});if(e==="remove"&&"id"in r&&typeof r.id=="string")return new ia({...r,id:r.id});throw uh(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported. + +Received: ${JSON.stringify(t,null,2)}`),"MESSAGE_COERCION_FAILURE")}}function ji(t){if(typeof t=="string")return new mr(t);if(Yr(t))return t;if(Array.isArray(t)){let[e,r]=t;return Jw({type:e,content:r})}else if(ih(t)){let{role:e,...r}=t;return Jw({...r,type:e})}else return Jw(t)}function au(t,e="Human",r="AI"){let n=[];for(let o of t){let i;if(o._getType()==="human")i=e;else if(o._getType()==="ai")i=r;else if(o._getType()==="system")i="System";else if(o._getType()==="tool")i="Tool";else if(o._getType()==="generic")i=o.role;else throw new Error(`Got unsupported message type: ${o._getType()}`);let s=o.name?`${o.name}, `:"",a=typeof o.content=="string"?o.content:JSON.stringify(o.content,null,2);n.push(`${i}: ${s}${a}`)}return n.join(` +`)}function DB(t){if(t.data!==void 0)return t;{let e=t;return{type:e.type,data:{content:e.text,role:e.role,name:void 0,tool_call_id:void 0}}}}function Ed(t){let e=DB(t);switch(e.type){case"human":return new mr(e.data);case"ai":return new jt(e.data);case"system":return new hn(e.data);case"function":if(e.data.name===void 0)throw new Error("Name must be defined for function messages");return new oa(e.data);case"tool":if(e.data.tool_call_id===void 0)throw new Error("Tool call ID must be defined for tool messages");return new Or(e.data);case"generic":if(e.data.role===void 0)throw new Error("Role must be defined for chat messages");return new jn(e.data);default:throw new Error(`Got unexpected type: ${e.type}`)}}function lO(t){return t.map(Ed)}function dO(t){return t.map(e=>e.toDict())}function ca(t){let e=t._getType();if(e==="human")return new zi({...t});if(e==="ai"){let r={...t};return"tool_calls"in r&&(r={...r,tool_call_chunks:r.tool_calls?.map(n=>({...n,type:"tool_call_chunk",index:void 0,args:JSON.stringify(n.args)}))}),new Dt({...r})}else{if(e==="system")return new lo({...t});if(e==="function")return new Ni({...t});if(jn.isInstance(t))return new Ri({...t});throw new Error("Unknown message type.")}}function lh(t){let e=t.reduce((o,i)=>{let s=o.findIndex(([a])=>"id"in i&&i.id&&"index"in i&&i.index!==void 0?i.id===a.id&&i.index===a.index:"id"in i&&i.id?i.id===a.id:"index"in i&&i.index!==void 0?i.index===a.index:!1);return s!==-1?o[s].push(i):o.push([i]),o},[]),r=[],n=[];for(let o of e){let i=null,s=o[0]?.name??"",a=o.map(l=>l.args||"").join("").trim(),c=a.length?a:"{}",u=o[0]?.id;try{if(i=sa(c),!u||i===null||typeof i!="object"||Array.isArray(i))throw new Error("Malformed tool call chunk args.");r.push({name:s,args:i,id:u,type:"tool_call"})}catch{n.push({name:s,args:c,id:u,error:"Malformed args.",type:"invalid_tool_call"})}}return{tool_call_chunks:t,tool_calls:r,invalid_tool_calls:n}}var pO=Symbol.for("ls:tracing_async_local_storage"),Di=Symbol.for("lc:context_variables"),fO=t=>{globalThis[pO]=t},Li=()=>globalThis[pO];var LB={};G(LB,{getEnv:()=>Qw,getEnvironmentVariable:()=>It,getRuntimeEnvironment:()=>ex,isBrowser:()=>mO,isDeno:()=>dh,isJsDom:()=>gO,isNode:()=>_O,isWebWorker:()=>hO});var mO=()=>typeof window<"u"&&typeof window.document<"u",hO=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",gO=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),dh=()=>typeof Deno<"u",_O=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!dh(),Qw=()=>{let t;return mO()?t="browser":_O()?t="node":hO()?t="webworker":gO()?t="jsdom":dh()?t="deno":t="other",t},Yw;function ex(){return Yw===void 0&&(Yw={library:"langchain-js",runtime:Qw()}),Yw}function It(t){try{return typeof process<"u"?process.env?.[t]:dh()?Deno?.env.get(t):void 0}catch{return}}var yO=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function UB(t){return typeof t=="string"&&yO.test(t)}var Ui=UB;function FB(t){if(!Ui(t))throw TypeError("Invalid UUID");let e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var vO=FB;var Vt=[];for(let t=0;t<256;++t)Vt.push((t+256).toString(16).slice(1));function cu(t,e=0){return(Vt[t[e+0]]+Vt[t[e+1]]+Vt[t[e+2]]+Vt[t[e+3]]+"-"+Vt[t[e+4]]+Vt[t[e+5]]+"-"+Vt[t[e+6]]+Vt[t[e+7]]+"-"+Vt[t[e+8]]+Vt[t[e+9]]+"-"+Vt[t[e+10]]+Vt[t[e+11]]+Vt[t[e+12]]+Vt[t[e+13]]+Vt[t[e+14]]+Vt[t[e+15]]).toLowerCase()}import BB from"node:crypto";var fh=new Uint8Array(256),ph=fh.length;function Ad(){return ph>fh.length-16&&(BB.randomFillSync(fh),ph=0),fh.slice(ph,ph+=16)}function ZB(t){t=unescape(encodeURIComponent(t));let e=[];for(let r=0;rDn&&t.msecs===void 0&&(Dn=s,a!==null&&(c=null,u=null)),a!==null&&(a>2147483647&&(a=2147483647),c=a>>>19&4095,u=a&524287),(c===null||u===null)&&(c=i[6]&127,c=c<<8|i[7],u=i[8]&63,u=u<<8|i[9],u=u<<5|i[10]>>>3),s+1e4>Dn&&a===null?++u>524287&&(u=0,++c>4095&&(c=0,Dn++)):Dn=s,xO=c,wO=u,o[n++]=Dn/1099511627776&255,o[n++]=Dn/4294967296&255,o[n++]=Dn/16777216&255,o[n++]=Dn/65536&255,o[n++]=Dn/256&255,o[n++]=Dn&255,o[n++]=c>>>4&15|112,o[n++]=c&255,o[n++]=u>>>13&63|128,o[n++]=u>>>5&255,o[n++]=u<<3&255|i[10]&7,o[n++]=i[11],o[n++]=i[12],o[n++]=i[13],o[n++]=i[14],o[n++]=i[15],e||cu(o)}var nx=XB;var YB={};G(YB,{BaseCallbackHandler:()=>la,callbackHandlerPrefersStreaming:()=>Od,isBaseCallbackHandler:()=>ox});var QB=class{};function Od(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var la=class extends QB{lc_serializable=!1;get lc_namespace(){return["langchain_core","callbacks",this.name]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eh(this.constructor)]}lc_kwargs;ignoreLLM=!1;ignoreChain=!1;ignoreAgent=!1;ignoreRetriever=!1;ignoreCustomEvent=!1;raiseError=!1;awaitHandlers=It("LANGCHAIN_CALLBACKS_BACKGROUND")==="false";constructor(t){super(),this.lc_kwargs=t||{},t&&(this.ignoreLLM=t.ignoreLLM??this.ignoreLLM,this.ignoreChain=t.ignoreChain??this.ignoreChain,this.ignoreAgent=t.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=t.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=t.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=t.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(t._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return uo.prototype.toJSON.call(this)}toJSONNotImplemented(){return uo.prototype.toJSONNotImplemented.call(this)}static fromMethods(t){class e extends la{name=Et();constructor(){super(),Object.assign(this,t)}}return new e}},ox=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"};var IO="gen_ai.operation.name",SO="gen_ai.system",ix="gen_ai.request.model",kO="gen_ai.response.model",sx="gen_ai.usage.input_tokens",ax="gen_ai.usage.output_tokens",cx="gen_ai.usage.total_tokens",TO="gen_ai.request.max_tokens",EO="gen_ai.request.temperature",AO="gen_ai.request.top_p",OO="gen_ai.request.frequency_penalty",PO="gen_ai.request.presence_penalty",CO="gen_ai.response.finish_reasons",RO="gen_ai.prompt",NO="gen_ai.completion",zO="gen_ai.request.extra_query",MO="gen_ai.request.extra_body",jO="gen_ai.serialized.name",DO="gen_ai.serialized.signature",LO="gen_ai.serialized.doc",UO="gen_ai.response.id",FO="gen_ai.response.service_tier",BO="gen_ai.response.system_fingerprint",ZO="gen_ai.usage.input_token_details",qO="gen_ai.usage.output_token_details",VO="langsmith.trace.session_id",GO="langsmith.trace.session_name",KO="langsmith.span.kind",HO="langsmith.trace.name",WO="langsmith.metadata",ux="langsmith.span.tags";var JO="langsmith.request.streaming",XO="langsmith.request.headers";var t6=(...t)=>fetch(...t),YO=Symbol.for("ls:fetch_implementation");var QO=()=>{let t=globalThis[YO];return t?typeof t=="function"&&"Headers"in t&&"Request"in t&&"Response"in t:!1},eP=t=>async(...e)=>{if(t||At("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[YO]??t6)(...e);return(t||At("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r};var Pd=()=>At("PROJECT")??Qr("LANGCHAIN_SESSION")??"default";var tP={};function uu(t){tP[t]||(console.warn(t),tP[t]=!0)}var r6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function $e(t,e){if(!r6.test(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}function mh(t){let e=typeof t=="string"?Date.parse(t):t;return nx({msecs:e,seq:0})}var hh="0.3.82";var po,n6=()=>typeof window<"u"&&typeof window.document<"u",o6=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",i6=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),rP=()=>typeof Deno<"u",s6=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!rP(),px=()=>po||(typeof Bun<"u"?po="bun":n6()?po="browser":s6()?po="node":o6()?po="webworker":i6()?po="jsdom":rP()?po="deno":po="other",po),lx;function gh(){if(lx===void 0){let t=px(),e=c6();lx={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:hh,...e}}return lx}function fx(){let t=a6(),e={},r=["LANGCHAIN_API_KEY","LANGCHAIN_ENDPOINT","LANGCHAIN_TRACING_V2","LANGCHAIN_PROJECT","LANGCHAIN_SESSION","LANGSMITH_API_KEY","LANGSMITH_ENDPOINT","LANGSMITH_TRACING_V2","LANGSMITH_PROJECT","LANGSMITH_SESSION"];for(let[n,o]of Object.entries(t))typeof o=="string"&&!r.includes(n)&&!n.toLowerCase().includes("key")&&!n.toLowerCase().includes("secret")&&!n.toLowerCase().includes("token")&&(n==="LANGCHAIN_REVISION_ID"?e.revision_id=o:e[n]=o);return e}function a6(){let t={};try{if(typeof process<"u"&&process.env)for(let[e,r]of Object.entries(process.env))(e.startsWith("LANGCHAIN_")||e.startsWith("LANGSMITH_"))&&r!=null&&((e.toLowerCase().includes("key")||e.toLowerCase().includes("secret")||e.toLowerCase().includes("token"))&&typeof r=="string"?t[e]=r.slice(0,2)+"*".repeat(r.length-4)+r.slice(-2):t[e]=r)}catch{}return t}function Qr(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function At(t){return Qr(`LANGSMITH_${t}`)||Qr(`LANGCHAIN_${t}`)}var dx;function c6(){if(dx!==void 0)return dx;let t=["VERCEL_GIT_COMMIT_SHA","NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA","COMMIT_REF","RENDER_GIT_COMMIT","CI_COMMIT_SHA","CIRCLE_SHA1","CF_PAGES_COMMIT_SHA","REACT_APP_GIT_SHA","SOURCE_VERSION","GITHUB_SHA","TRAVIS_COMMIT","GIT_COMMIT","BUILD_VCS_NUMBER","bamboo_planRepository_revision","Build.SourceVersion","BITBUCKET_COMMIT","DRONE_COMMIT_SHA","SEMAPHORE_GIT_SHA","BUILDKITE_COMMIT"],e={};for(let r of t){let n=Qr(r);n!==void 0&&(e[r]=n)}return dx=e,e}function _h(){return Qr("OTEL_ENABLED")==="true"||At("OTEL_ENABLED")==="true"}var gx=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&_h()&&(console.warn('You have enabled OTEL export via the `OTEL_ENABLED` or `LANGSMITH_OTEL_ENABLED` environment variable, but have not initialized the required OTEL instances. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0);let n;if(r.length===1&&typeof r[0]=="function"?n=r[0]:r.length===2&&typeof r[1]=="function"?n=r[1]:r.length===3&&typeof r[2]=="function"&&(n=r[2]),typeof n=="function")return n()}},_x=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new gx})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},yx=class{active(){return{}}with(e,r){return r()}},mx=Symbol.for("ls:otel_trace"),hx=Symbol.for("ls:otel_context"),nP=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),u6=new _x,l6=new yx,vx=class{getTraceInstance(){return globalThis[mx]??u6}getContextInstance(){return globalThis[hx]??l6}initializeGlobalInstances(e){globalThis[mx]===void 0&&(globalThis[mx]=e.trace),globalThis[hx]===void 0&&(globalThis[hx]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[nP]=e}getDefaultOTLPTracerComponents(){return globalThis[nP]??void 0}},bx=new vx;function yh(){return bx.getTraceInstance()}function oP(){return bx.getContextInstance()}function iP(){return bx.getDefaultOTLPTracerComponents()}var d6={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};function p6(t){return d6[t]||t}var vh=class{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(e,r){for(let n of e)try{if(!n.run)continue;if(n.operation==="post"){let o=this.createSpanForRun(n,n.run,r.get(n.id));o&&!n.run.end_time&&this.spans.set(n.id,o)}else this.updateSpanForRun(n,n.run)}catch(o){console.error(`Error processing operation ${n.id}:`,o)}}createSpanForRun(e,r,n){let o=n&&yh().getSpan(n);if(o)try{return this.finishSpanSetup(o,r,e)}catch(i){console.error(`Failed to create span for run ${e.id}:`,i);return}}finishSpanSetup(e,r,n){return this.setSpanAttributes(e,r,n),r.error?(e.setStatus({code:2}),e.recordException(new Error(r.error))):e.setStatus({code:1}),r.end_time&&e.end(new Date(r.end_time)),e}updateSpanForRun(e,r){try{let n=this.spans.get(e.id);if(!n){console.debug(`No span found for run ${e.id} during update`);return}this.setSpanAttributes(n,r,e),r.error?(n.setStatus({code:2}),n.recordException(new Error(r.error))):n.setStatus({code:1});let o=r.end_time;o&&(n.end(new Date(o)),this.spans.delete(e.id))}catch(n){console.error(`Failed to update span for run ${e.id}:`,n)}}extractModelName(e){if(e.extra?.metadata){let r=e.extra.metadata;if(r.ls_model_name)return r.ls_model_name;if(r.invocation_params){let n=r.invocation_params;if(n.model)return n.model;if(n.model_name)return n.model_name}}}setSpanAttributes(e,r,n){if("run_type"in r&&r.run_type){e.setAttribute(KO,r.run_type);let a=p6(r.run_type||"chain");e.setAttribute(IO,a)}"name"in r&&r.name&&e.setAttribute(HO,r.name),"session_id"in r&&r.session_id&&e.setAttribute(VO,r.session_id),"session_name"in r&&r.session_name&&e.setAttribute(GO,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute(ix,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute(sx,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(ax,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(cx,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[a,c]of Object.entries(i))c!=null&&e.setAttribute(`${WO}.${a}`,String(c));let s=r.tags;if(s&&Array.isArray(s)?e.setAttribute(ux,s.join(", ")):s&&e.setAttribute(ux,String(s)),"serialized"in r&&typeof r.serialized=="object"){let a=r.serialized;a.name&&e.setAttribute(jO,String(a.name)),a.signature&&e.setAttribute(DO,String(a.signature)),a.doc&&e.setAttribute(LO,String(a.doc))}this.setIOAttributes(e,n)}setGenAiSystem(e,r){let n="langchain",o=this.extractModelName(r);if(o){let i=o.toLowerCase();i.includes("anthropic")||i.startsWith("claude")?n="anthropic":i.includes("bedrock")?n="aws.bedrock":i.includes("azure")&&i.includes("openai")?n="az.ai.openai":i.includes("azure")&&i.includes("inference")?n="az.ai.inference":i.includes("cohere")?n="cohere":i.includes("deepseek")?n="deepseek":i.includes("gemini")?n="gemini":i.includes("groq")?n="groq":i.includes("watson")||i.includes("ibm")?n="ibm.watsonx.ai":i.includes("mistral")?n="mistral_ai":i.includes("gpt")||i.includes("openai")?n="openai":i.includes("perplexity")||i.includes("sonar")?n="perplexity":i.includes("vertex")?n="vertex_ai":(i.includes("xai")||i.includes("grok"))&&(n="xai")}e.setAttribute(SO,n)}setInvocationParameters(e,r){if(!r.extra?.metadata?.invocation_params)return;let n=r.extra.metadata.invocation_params;n.max_tokens!==void 0&&e.setAttribute(TO,n.max_tokens),n.temperature!==void 0&&e.setAttribute(EO,n.temperature),n.top_p!==void 0&&e.setAttribute(AO,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(OO,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute(PO,n.presence_penalty)}setIOAttributes(e,r){if(r.run.inputs)try{let n=r.run.inputs;typeof n=="object"&&n!==null&&(n.model&&Array.isArray(n.messages)&&e.setAttribute(ix,n.model),n.stream!==void 0&&e.setAttribute(JO,n.stream),n.extra_headers&&e.setAttribute(XO,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute(zO,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(MO,JSON.stringify(n.extra_body))),e.setAttribute(RO,JSON.stringify(n))}catch(n){console.debug(`Failed to process inputs for run ${r.id}`,n)}if(r.run.outputs)try{let n=r.run.outputs,o=this.getUnifiedRunTokens(n);if(o&&(e.setAttribute(sx,o[0]),e.setAttribute(ax,o[1]),e.setAttribute(cx,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(kO,String(n.model)),n.id&&e.setAttribute(UO,n.id),n.choices&&Array.isArray(n.choices)){let i=n.choices.map(s=>s.finish_reason).filter(s=>s).map(String);i.length>0&&e.setAttribute(CO,i.join(", "))}if(n.service_tier&&e.setAttribute(FO,n.service_tier),n.system_fingerprint&&e.setAttribute(BO,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let i=n.usage_metadata;i.input_token_details&&e.setAttribute(ZO,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(qO,JSON.stringify(i.output_token_details))}}e.setAttribute(NO,JSON.stringify(n))}catch(n){console.debug(`Failed to process outputs for run ${r.id}`,n)}}getUnifiedRunTokens(e){if(!e)return null;let r=this.extractUnifiedRunTokens(e.usage_metadata);if(r)return r;let n=Object.keys(e);for(let s of n){let a=e[s];if(!(!a||typeof a!="object")&&(r=this.extractUnifiedRunTokens(a.usage_metadata),r||a.lc===1&&a.kwargs&&typeof a.kwargs=="object"&&(r=this.extractUnifiedRunTokens(a.kwargs.usage_metadata),r)))return r}let o=e.generations||[];if(!Array.isArray(o))return null;let i=Array.isArray(o[0])?o.flat():o;for(let s of i)if(typeof s=="object"&&s.message&&typeof s.message=="object"&&s.message.kwargs&&typeof s.message.kwargs=="object"&&(r=this.extractUnifiedRunTokens(s.message.kwargs.usage_metadata),r))return r;return null}extractUnifiedRunTokens(e){return!e||typeof e!="object"||typeof e.input_tokens!="number"||typeof e.output_tokens!="number"?null:[e.input_tokens,e.output_tokens]}};var f6=Object.prototype.toString,m6=t=>f6.call(t)==="[object Error]",h6=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function wx(t){if(!(t&&m6(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:h6.has(r)}function g6(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function bh(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(_),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},_=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&_.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function $x(t,e={}){if(e={...e},g6(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,bh("factor",e.factor,{min:0,allowInfinity:!1}),bh("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),bh("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),bh("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await y6({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var kh=mn(Sh(),1),T6=[408,425,429,500,502,503,504],Rd=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxQueueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.maxQueueSizeBytes=e.maxQueueSizeBytes,"default"in kh.default?this.queue=new kh.default.default({concurrency:this.maxConcurrency}):this.queue=new kh.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){return this.callWithOptions({},e,...r)}callWithOptions(e,r,...n){let o=e.sizeBytes??0;if(this.maxQueueSizeBytes!==void 0&&o>0&&this.queueSizeBytes+o>this.maxQueueSizeBytes)return Promise.reject(new Error(`Queue size limit (${this.maxQueueSizeBytes} bytes) exceeded. Current queue size: ${this.queueSizeBytes} bytes, attempted addition: ${o} bytes.`));o>0&&(this.queueSizeBytes+=o);let i=this.onFailedResponseHook,s=this.queue.add(()=>$x(()=>r(...n).catch(a=>{throw a instanceof Error?a:new Error(a)}),{async onFailedAttempt({error:a}){if(a.message.startsWith("Cancel")||a.message.startsWith("TimeoutError")||a.name==="TimeoutError"||a.message.startsWith("AbortError")||a?.code==="ECONNABORTED")throw a;let c=a?.response;if(i&&await i(c))return;let u=c?.status??a?.status;if(u&&!T6.includes(+u))throw a},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0});return o>0&&(s=s.finally(()=>{this.queueSizeBytes-=o})),e.signal?Promise.race([s,new Promise((a,c)=>{e.signal?.addEventListener("abort",()=>{c(new Error("AbortError"))})})]):s}};function Ox(t){return typeof t?._getType=="function"}function Px(t){let e={type:t._getType(),data:{content:t.content}};return t?.additional_kwargs&&Object.keys(t.additional_kwargs).length>0&&(e.data.additional_kwargs={...t.additional_kwargs}),e}var $q=mn(oR(),1);function Wo(t){if(!t||t.split("/").length>2||t.startsWith("/")||t.endsWith("/")||t.split(":").length>2)throw new Error(`Invalid identifier format: ${t}`);let[e,r]=t.split(":"),n=r||"latest";if(e.includes("/")){let[o,i]=e.split("/",2);if(!o||!i)throw new Error(`Invalid identifier format: ${t}`);return[o,i,n]}else{if(!e)throw new Error(`Invalid identifier format: ${t}`);return["-",e,n]}}var Xx=class extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}};async function ue(t,e,r){let n;if(t.ok){r&&(n=await t.text());return}if(t.status===403)try{(await t.json())?.error==="org_scoped_key_requires_workspace"&&(n="This API key is org-scoped and requires workspace specification. Please provide 'workspaceId' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.")}catch{let a=new Error(`${t.status} ${t.statusText}`);throw a.status=t?.status,a}if(n===void 0)try{n=await t.text()}catch{n=""}let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Message: ${n}`;if(t.status===409)throw new Xx(o);let i=new Error(o);throw i.status=t.status,i}var iR="ERR_CONFLICTING_ENDPOINTS",Lh=class extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:iR}),this.name="ConflictingEndpointsError"}};function sR(t){return typeof t=="object"&&t!==null&&t.code===iR}var aR="[...]",Iq={result:"[Circular]"},Fh=[],du=[],Sq=new TextEncoder;function kq(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Uh(t){return Sq.encode(t)}function cR(t){if(t&&typeof t=="object"&&t!==null){if(t instanceof Map)return Object.fromEntries(t);if(t instanceof Set)return Array.from(t);if(t instanceof Date)return t.toISOString();if(t instanceof RegExp)return t.toString();if(t instanceof Error)return{name:t.name,message:t.message}}else if(typeof t=="bigint")return t.toString();return t}function Tq(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return cR(r)}}function Pr(t,e,r,n,o){try{let i=JSON.stringify(t,Tq(r),n);return Uh(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?` +Context: ${e}`:""}`),Uh("[Unserializable]");At("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?` +Context: ${e}`:""}`),typeof o>"u"&&(o=kq()),Qx(t,"",0,[],void 0,0,o);let s;try{du.length===0?s=JSON.stringify(t,r,n):s=JSON.stringify(t,Eq(r),n)}catch{return Uh("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Fh.length!==0;){let a=Fh.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return Uh(s)}}function Yx(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),Fh.push([n,r,e,o])):du.push([e,r,t]):(n[r]=t,Fh.push([n,r,e]))}function Qx(t,e,r,n,o,i,s){i+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;as.depthLimit){Yx(aR,t,e,o);return}if(typeof s.edgesLimit<"u"&&r+1>s.edgesLimit){Yx(aR,t,e,o);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n{let e=t?.toString()??At("TRACING_SAMPLING_RATE");if(e===void 0)return;let r=parseFloat(e);if(r<0||r>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${r}`);return r},Oq=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};async function Pq(t){let e=[];for await(let r of t)e.push(r);return e}function Bh(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}var Cq=async t=>{if(t?.status===429){let e=parseInt(t.headers.get("retry-after")??"10",10)*1e3;if(e>0)return await new Promise(r=>setTimeout(r,e)),!0}return!1};function lR(t){return typeof t=="number"?Number(t.toFixed(4)):t}var Rq=24*1024*1024,fR=1024*1024*1024,Nq=1e4,zq=100,dR="https://api.smith.langchain.com",e0=class{constructor(e){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSizeBytes=e??fR}peek(){return this.items[0]}push(e){let r,n=new Promise(i=>{r=i}),o=Pr(e.item,`Serializing run with id: ${e.item.id}`).length;return this.sizeBytes+o>this.maxSizeBytes&&this.items.length>0?(console.warn(`AutoBatchQueue size limit (${this.maxSizeBytes} bytes) exceeded. Dropping run with id: ${e.item.id}. Current queue size: ${this.sizeBytes} bytes, attempted addition: ${o} bytes.`),r(),n):(this.items.push({action:e.action,payload:e.item,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n)}pop({upToSizeBytes:e,upToSize:r}){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let n=[],o=0;for(;o+(this.peek()?.size??0)0&&n.length0){let i=this.items.shift();n.push(i),o+=i.size,this.sizeBytes-=i.size}return[n.map(i=>({action:i.action,item:i.payload,otelContext:i.otelContext,apiKey:i.apiKey,apiUrl:i.apiUrl,size:i.size})),()=>n.forEach(i=>i.itemPromiseResolve())]}},da=class t{get _fetch(){return this.fetchImplementation||eP(this.debug)}constructor(e={}){Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"webUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"workspaceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchIngestCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout_ms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tenantId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filteredPostUuids",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchAggregationDelayMs",{enumerable:!0,configurable:!0,writable:!0,value:250}),Object.defineProperty(this,"batchSizeBytesLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSizeLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"blockOnRootRunFinalization",{enumerable:!0,configurable:!0,writable:!0,value:Qr("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"langSmithToOTELTranslator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchImplementation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cachedLSEnvVarsForMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Qr("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=Aq(e.tracingSamplingRate),this.apiUrl=Bh(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=Bh(e.apiKey??r.apiKey),this.webUrl=Bh(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=Bh(e.workspaceId??At("WORKSPACE_ID")),this.timeout_ms=e.timeout_ms??9e4,this.caller=new Rd({...e.callerOptions??{},maxRetries:4,debug:e.debug??this.debug}),this.traceBatchConcurrency=e.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.debug=e.debug??this.debug,this.fetchImplementation=e.fetchImplementation;let n=e.maxIngestMemoryBytes??fR;this.batchIngestCaller=new Rd({maxRetries:4,maxConcurrency:this.traceBatchConcurrency,maxQueueSizeBytes:n,...e.callerOptions??{},onFailedResponseHook:Cq,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.autoBatchQueue=new e0(n),this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.batchSizeLimit=e.batchSizeLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode,_h()&&(this.langSmithToOTELTranslator=new vh),this.cachedLSEnvVarsForMetadata=fx()}static getDefaultClientConfig(){let e=At("API_KEY"),r=At("ENDPOINT")??dR,n=At("HIDE_INPUTS")==="true",o=At("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:Oq(this.apiUrl)?(this.webUrl="http://localhost:3000",this.webUrl):this.apiUrl.endsWith("/api/v1")?(this.webUrl=this.apiUrl.replace("/api/v1",""),this.webUrl):this.apiUrl.includes("/api")&&!this.apiUrl.split(".",1)[0].endsWith("api")?(this.webUrl=this.apiUrl.replace("/api",""),this.webUrl):this.apiUrl.split(".",1)[0].includes("dev")?(this.webUrl="https://dev.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("eu")?(this.webUrl="https://eu.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("beta")?(this.webUrl="https://beta.smith.langchain.com",this.webUrl):(this.webUrl="https://smith.langchain.com",this.webUrl)}get headers(){let e={"User-Agent":`langsmith-js/${hh}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),this.workspaceId&&(e["x-tenant-id"]=this.workspaceId),e}_getPlatformEndpointPath(e){return this.apiUrl.slice(-3)!=="/v1"&&this.apiUrl.slice(-4)!=="/v1/"?`/v1/platform/${e}`:`/platform/${e}`}async processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}async processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}async prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`;return await this.caller.call(async()=>{let s=await this._fetch(o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,`fetch ${e}`),s})}async _get(e,r){return(await this._getResponse(e,r)).json()}async*_getPaginated(e,r=new URLSearchParams,n){let o=Number(r.get("offset"))||0,i=Number(r.get("limit"))||100;for(;;){r.set("offset",String(o)),r.set("limit",String(i));let s=`${this.apiUrl}${e}?${r}`,a=await this.caller.call(async()=>{let u=await this._fetch(s,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(u,`fetch ${e}`),u}),c=n?n(await a.json()):await a.json();if(c.length===0||(yield c,c.length{let l=await this._fetch(`${this.apiUrl}${e}`,{method:n,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(l,`fetch ${e}`),l})).json();if(!c||!c[o])break;yield c[o];let u=c.cursors;if(!u||!u.next)break;i.cursor=u.next}}_shouldSample(){return this.tracingSampleRate===void 0?!0:Math.random()0;){let[o,i]=this.autoBatchQueue.pop({upToSizeBytes:e,upToSize:r});if(!o.length){i();break}let s=o.reduce((u,l)=>{let d=l.apiUrl??this.apiUrl,f=l.apiKey??this.apiKey,m=l.apiKey===this.apiKey&&l.apiUrl===this.apiUrl?"default":`${d}|${f}`;return u[m]||(u[m]=[]),u[m].push(l),u},{}),a=[];for(let[u,l]of Object.entries(s)){let d=this._processBatch(l,{apiUrl:u==="default"?void 0:u.split("|")[0],apiKey:u==="default"?void 0:u.split("|")[1]});a.push(d)}let c=Promise.all(a).finally(i);n.push(c)}return Promise.all(n)}async _processBatch(e,r){if(!e.length)return;let n=e.reduce((o,i)=>o+(i.size??0),0);try{if(this.langSmithToOTELTranslator!==void 0)this._sendBatchToOTELTranslator(e);else{let o={runCreates:e.filter(s=>s.action==="create").map(s=>s.item),runUpdates:e.filter(s=>s.action==="update").map(s=>s.item)},i=await this._ensureServerInfo();if(i?.batch_ingest_config?.use_multipart_endpoint){let s=i?.instance_flags?.gzip_body_enabled;await this.multipartIngestRuns(o,{...r,useGzip:s,sizeBytes:n})}else await this.batchIngestRuns(o,{...r,sizeBytes:n})}}catch(o){console.error("Error exporting batch:",o)}}_sendBatchToOTELTranslator(e){if(this.langSmithToOTELTranslator!==void 0){let r=new Map,n=[];for(let o of e)o.item.id&&o.otelContext&&(r.set(o.item.id,o.otelContext),o.action==="create"?n.push({operation:"post",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}):n.push({operation:"patch",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}));this.langSmithToOTELTranslator.exportBatch(n,r)}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.item=uR(e.item,this.cachedLSEnvVarsForMetadata);let r=this.autoBatchQueue.push(e);if(this.manualFlushMode)return r;let n=await this._getBatchSizeLimitBytes(),o=await this._getBatchSizeLimit();return(this.autoBatchQueue.sizeBytes>n||this.autoBatchQueue.items.length>o)&&this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o}),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o})},this.autoBatchAggregationDelayMs)),r}async _getServerInfo(){let r=await(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(Nq),...this.fetchOptions});return await ue(n,"get server info"),n})).json();return this.debug&&console.log(` +=== LangSmith Server Configuration === +`+JSON.stringify(r,null,2)+` +`),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch(e){console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${e.status??"Unspecified status code"} ${e.message}`)}return this._serverInfo??{}})()),this._getServerInfoPromise.then(e=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),e))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let e=await this._getBatchSizeLimitBytes(),r=await this._getBatchSizeLimit();await this.drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:r})}_cloneCurrentOTELContext(){let e=yh(),r=oP();if(this.langSmithToOTELTranslator!==void 0){let n=e.getActiveSpan();if(n)return e.setSpan(r.active(),n)}}async createRun(e,r){if(!this._filterForSampling([e]).length)return;let n={...this.headers,"Content-Type":"application/json"},o=e.project_name;delete e.project_name;let i=await this.prepareRunCreateOrUpdateInputs({session_name:o,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&i.trace_id!==void 0&&i.dotted_order!==void 0){let c=this._cloneCurrentOTELContext();this.processRunOperation({action:"create",item:i,otelContext:c,apiKey:r?.apiKey,apiUrl:r?.apiUrl}).catch(console.error);return}let s=uR(i,this.cachedLSEnvVarsForMetadata);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),r?.workspaceId!==void 0&&(n["x-tenant-id"]=r.workspaceId);let a=Pr(s,`Creating run with id: ${s.id}`);await this.caller.call(async()=>{let c=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"create run",!0),c})}async batchIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o=await Promise.all(e?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]),i=await Promise.all(r?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]);if(o.length>0&&i.length>0){let c=o.reduce((l,d)=>(d.id&&(l[d.id]=d),l),{}),u=[];for(let l of i)l.id!==void 0&&c[l.id]?c[l.id]={...c[l.id],...l}:u.push(l);o=Object.values(c),i=u}let s={post:o,patch:i};if(!s.post.length&&!s.patch.length)return;let a={post:[],patch:[]};for(let c of["post","patch"]){let u=c,l=s[u].reverse(),d=l.pop();for(;d!==void 0;)a[u].push(d),d=l.pop()}if(a.post.length>0||a.patch.length>0){let c=a.post.map(u=>u.id).concat(a.patch.map(u=>u.id)).join(",");await this._postBatchIngestRuns(Pr(a,`Ingesting runs with ids: ${c}`),n)}}async _postBatchIngestRuns(e,r){let n={...this.headers,"Content-Type":"application/json",Accept:"application/json"};r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),await this.batchIngestCaller.callWithOptions({sizeBytes:r?.sizeBytes},async()=>{let o=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:e});return await ue(o,"batch create run",!0),o})}async multipartIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o={},i=[];for(let d of e??[]){let f=await this.prepareRunCreateOrUpdateInputs(d);f.id!==void 0&&f.attachments!==void 0&&(o[f.id]=f.attachments),delete f.attachments,i.push(f)}let s=[];for(let d of r??[])s.push(await this.prepareRunCreateOrUpdateInputs(d));if(i.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(s.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(i.length>0&&s.length>0){let d=i.reduce((p,m)=>(m.id&&(p[m.id]=m),p),{}),f=[];for(let p of s)p.id!==void 0&&d[p.id]?d[p.id]={...d[p.id],...p}:f.push(p);i=Object.values(d),s=f}if(i.length===0&&s.length===0)return;let u=[],l=[];for(let[d,f]of[["post",i],["patch",s]])for(let p of f){let{inputs:m,outputs:h,events:_,extra:v,error:b,serialized:x,attachments:k,...T}=p,F={inputs:m,outputs:h,events:_,extra:v,error:b,serialized:x},J=Pr(T,`Serializing for multipart ingestion of run with id: ${T.id}`);l.push({name:`${d}.${T.id}`,payload:new Blob([J],{type:`application/json; length=${J.length}`})});for(let[w,Z]of Object.entries(F)){if(Z===void 0)continue;let oe=Pr(Z,`Serializing ${w} for multipart ingestion of run with id: ${T.id}`);l.push({name:`${d}.${T.id}.${w}`,payload:new Blob([oe],{type:`application/json; length=${oe.length}`})})}if(T.id!==void 0){let w=o[T.id];if(w){delete o[T.id];for(let[Z,oe]of Object.entries(w)){let Q,wt;if(Array.isArray(oe)?[Q,wt]=oe:(Q=oe.mimeType,wt=oe.data),Z.includes(".")){console.warn(`Skipping attachment '${Z}' for run ${T.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}l.push({name:`attachment.${T.id}.${Z}`,payload:new Blob([wt],{type:`${Q}; length=${wt.byteLength}`})})}}}u.push(`trace=${T.trace_id},id=${T.id}`)}await this._sendMultipartRequest(l,u.join("; "),n)}async _createNodeFetchBody(e,r){let n=[];for(let s of e)n.push(new Blob([`--${r}\r +`])),n.push(new Blob([`Content-Disposition: form-data; name="${s.name}"\r +`,`Content-Type: ${s.payload.type}\r +\r +`])),n.push(s.payload),n.push(new Blob([`\r +`]));return n.push(new Blob([`--${r}--\r +`])),await new Blob(n).arrayBuffer()}async _createMultipartStream(e,r){let n=new TextEncoder;return new ReadableStream({async start(i){let s=async a=>{typeof a=="string"?i.enqueue(n.encode(a)):i.enqueue(a)};for(let a of e){await s(`--${r}\r +`),await s(`Content-Disposition: form-data; name="${a.name}"\r +`),await s(`Content-Type: ${a.payload.type}\r +\r +`);let u=a.payload.stream().getReader();try{let l;for(;!(l=await u.read()).done;)i.enqueue(l.value)}finally{u.releaseLock()}await s(`\r +`)}await s(`--${r}--\r +`),i.close()}})}async _sendMultipartRequest(e,r,n){let o="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),i=QO(),s=()=>this._createNodeFetchBody(e,o),a=()=>this._createMultipartStream(e,o),c=async u=>this.batchIngestCaller.callWithOptions({sizeBytes:n?.sizeBytes},async()=>{let l=await u(),d={...this.headers,"Content-Type":`multipart/form-data; boundary=${o}`};n?.apiKey!==void 0&&(d["x-api-key"]=n.apiKey);let f=l;n?.useGzip&&typeof l=="object"&&"pipeThrough"in l&&(f=l.pipeThrough(new CompressionStream("gzip")),d["Content-Encoding"]="gzip");let p=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:d,body:f,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(p,"Failed to send multipart request",!0),p});try{let u,l=!1;!i&&!this.multipartStreamingDisabled&&px()!=="bun"?(l=!0,u=await c(a)):u=await c(s),(!this.multipartStreamingDisabled||l)&&u.status===422&&(n?.apiUrl??this.apiUrl)!==dR&&(console.warn(`Streaming multipart upload to ${n?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${r}".`),this.multipartStreamingDisabled=!0,u=await c(s))}catch(u){console.warn(`${u.message.trim()} + +Context: ${r}`)}}async updateRun(e,r,n){$e(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let o={...r,id:e};if(!this._filterForSampling([o],!0).length)return;if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){let a=this._cloneCurrentOTELContext();if(r.end_time!==void 0&&o.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}else this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}let i={...this.headers,"Content-Type":"application/json"};n?.apiKey!==void 0&&(i["x-api-key"]=n.apiKey),n?.workspaceId!==void 0&&(i["x-tenant-id"]=n.workspaceId);let s=Pr(r,`Serializing payload to update run with id: ${e}`);await this.caller.call(async()=>{let a=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(a,"update run",!0),a})}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){$e(e);let n=await this._get(`/runs/${e}`);return r&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:r,projectOpts:n}){if(r!==void 0){let o;r.session_id?o=r.session_id:n?.projectName?o=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?o=n?.projectId:o=(await this.readProject({projectName:At("PROJECT")||"default"})).id;let i=await this._getTenantId();return`${this.getHostUrl()}/o/${i}/projects/p/${o}/r/${r.id}?poll=true`}else if(e!==void 0){let o=await this.readRun(e);if(!o.app_path)throw new Error(`Run ${e} has no app_path`);return`${this.getHostUrl()}${o.app_path}`}else throw new Error("Must provide either runId or run")}async _loadChildRuns(e){let r=await Pq(this.listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),n={},o={};r.sort((i,s)=>(i?.dotted_order??"").localeCompare(s?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.dotted_order?.startsWith(e.dotted_order??"")&&i.id!==e.id&&(i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i)}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:s,startTime:a,executionOrder:c,isRoot:u,runType:l,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:_,limit:v,select:b,order:x}=e,k=[];if(r&&(k=Array.isArray(r)?r:[r]),n){let w=Array.isArray(n)?n:[n],Z=await Promise.all(w.map(oe=>this.readProject({projectName:oe}).then(Q=>Q.id)));k.push(...Z)}let T=["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],F={session:k.length?k:null,run_type:l,reference_example:s,query:p,filter:m,trace_filter:h,tree_filter:_,execution_order:c,parent_run:o,start_time:a?a.toISOString():null,error:d,id:f,limit:v,trace:i,select:b||T,is_root:u,order:x};F.select.includes("child_run_ids")&&uu("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let J=0;for await(let w of this._getCursorPaginatedList("/runs/query",F))if(v){if(J>=v)break;if(w.length+J>v){yield*w.slice(0,v-J);break}J+=w.length,yield*w}else yield*w}async*listGroupRuns(e){let{projectId:r,projectName:n,groupBy:o,filter:i,startTime:s,endTime:a,limit:c,offset:u}=e,d={session_id:r||(await this.readProject({projectName:n})).id,group_by:o,filter:i,start_time:s?s.toISOString():null,end_time:a?a.toISOString():null,limit:Number(c)||100},f=Number(u)||0,p="/runs/group",m=`${this.apiUrl}${p}`;for(;;){let h={...d,offset:f},_=Object.fromEntries(Object.entries(h).filter(([F,J])=>J!==void 0)),v=JSON.stringify(_),x=await(await this.caller.call(async()=>{let F=await this._fetch(m,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:v});return await ue(F,`Failed to fetch ${p}`),F})).json(),{groups:k,total:T}=x;if(k.length===0)break;for(let F of k)yield F;if(f+=k.length,f>=T)break}}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:s,referenceExampleIds:a,startTime:c,endTime:u,error:l,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:_}){let v=s||[];i&&(v=[...s||[],...await Promise.all(i.map(J=>this.readProject({projectName:J}).then(w=>w.id)))]);let x=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:v,reference_example:a,start_time:c,end_time:u,error:l,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:_}).filter(([J,w])=>w!==void 0)),k=JSON.stringify(x);return await(await this.caller.call(async()=>{let J=await this._fetch(`${this.apiUrl}/runs/stats`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:k});return await ue(J,"get run stats"),J})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||Et()};$e(e);let o=JSON.stringify(n),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ue(a,"share run"),a})).json();if(s===null||!("share_token"in s))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${s.share_token}/r`}async unshareRun(e){$e(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"unshare run",!0),r})}async readRunSharedLink(e){$e(e);let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"read run shared link"),o})).json();if(!(n===null||!("share_token"in n)))return`${this.getHostUrl()}/public/${n.share_token}/r`}async listSharedRuns(e,{runIds:r}={}){let n=new URLSearchParams({share_token:e});if(r!==void 0)for(let s of r)n.append("id",s);return $e(e),await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"list shared runs"),s})).json()}async readDatasetSharedSchema(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id),$e(e);let o=await(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,"read dataset shared schema"),i})).json();return o.url=`${this.getHostUrl()}/public/${o.share_token}/d`,o}async shareDataset(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id);let n={dataset_id:e};$e(e);let o=JSON.stringify(n),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ue(a,"share dataset"),a})).json();return s.url=`${this.getHostUrl()}/public/${s.share_token}/d`,s}async unshareDataset(e){$e(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"unshare dataset",!0),r})}async readSharedDataset(e){return $e(e),await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"read shared dataset"),o})).json()}async listSharedExamples(e,r){let n={};r?.exampleIds&&(n.id=r.exampleIds);let o=new URLSearchParams;Object.entries(n).forEach(([a,c])=>{Array.isArray(c)?c.forEach(u=>o.append(a,u)):o.append(a,c)});let i=await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/public/${e}/examples?${o.toString()}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(a,"list shared examples"),a}),s=await i.json();if(!i.ok)throw"detail"in s?new Error(`Failed to list shared examples. +Status: ${i.status} +Message: ${Array.isArray(s.detail)?s.detail.join(` +`):"Unspecified error"}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return s.map(a=>({...a,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:r=null,metadata:n=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:s=null}){let a=o?"?upsert=true":"",c=`${this.apiUrl}/sessions${a}`,u=i||{};n&&(u.metadata=n);let l={name:e,extra:u,description:r};s!==null&&(l.reference_dataset_id=s);let d=JSON.stringify(l);return await(await this.caller.call(async()=>{let m=await this._fetch(c,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:d});return await ue(m,"create project"),m})).json()}async updateProject(e,{name:r=null,description:n=null,metadata:o=null,projectExtra:i=null,endTime:s=null}){let a=`${this.apiUrl}/sessions/${e}`,c=i;o&&(c={...c||{},metadata:o});let u=JSON.stringify({name:r,extra:c,description:n,end_time:s?new Date(s).toISOString():null});return await(await this.caller.call(async()=>{let f=await this._fetch(a,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"update project"),f})).json()}async hasProject({projectId:e,projectName:r}){let n="/sessions",o=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)$e(e),n+=`/${e}`;else if(r!==void 0)o.append("name",r);else throw new Error("Must provide projectName or projectId");let i=await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${n}?${o}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"has project"),s});try{let s=await i.json();return i.ok?Array.isArray(s)?s.length>0:!0:!1}catch{return!1}}async readProject({projectId:e,projectName:r,includeStats:n}){let o="/sessions",i=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)$e(e),o+=`/${e}`;else if(r!==void 0)i.append("name",r);else throw new Error("Must provide projectName or projectId");n!==void 0&&i.append("include_stats",n.toString());let s=await this._get(o,i),a;if(Array.isArray(s)){if(s.length===0)throw new Error(`Project[id=${e}, name=${r}] not found`);a=s[0]}else a=s;return a}async getProjectUrl({projectId:e,projectName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either projectName or projectId");let n=await this.readProject({projectId:e,projectName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/projects/p/${n.id}`}async getDatasetUrl({datasetId:e,datasetName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");let n=await this.readDataset({datasetId:e,datasetName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/datasets/${n.id}`}async _getTenantId(){if(this._tenantId!==null)return this._tenantId;let e=new URLSearchParams({limit:"1"});for await(let r of this._getPaginated("/sessions",e))return this._tenantId=r[0].tenant_id,r[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:e,name:r,nameContains:n,referenceDatasetId:o,referenceDatasetName:i,includeStats:s,datasetVersion:a,referenceFree:c,metadata:u}={}){let l=new URLSearchParams;if(e!==void 0)for(let d of e)l.append("id",d);if(r!==void 0&&l.append("name",r),n!==void 0&&l.append("name_contains",n),o!==void 0)l.append("reference_dataset",o);else if(i!==void 0){let d=await this.readDataset({datasetName:i});l.append("reference_dataset",d.id)}s!==void 0&&l.append("include_stats",s.toString()),a!==void 0&&l.append("dataset_version",a),c!==void 0&&l.append("reference_free",c.toString()),u!==void 0&&l.append("metadata",JSON.stringify(u));for await(let d of this._getPaginated("/sessions",l))yield*d}async deleteProject({projectId:e,projectName:r}){let n;if(e===void 0&&r===void 0)throw new Error("Must provide projectName or projectId");if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");e===void 0?n=(await this.readProject({projectName:r})).id:n=e,$e(n),await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,`delete session ${n} (${r})`,!0),o})}async uploadCsv({csvFile:e,fileName:r,inputKeys:n,outputKeys:o,description:i,dataType:s,name:a}){let c=`${this.apiUrl}/datasets/upload`,u=new FormData;return u.append("file",e,r),n.forEach(f=>{u.append("input_keys",f)}),o.forEach(f=>{u.append("output_keys",f)}),i&&u.append("description",i),s&&u.append("data_type",s),a&&u.append("name",a),await(await this.caller.call(async()=>{let f=await this._fetch(c,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"upload CSV"),f})).json()}async createDataset(e,{description:r,dataType:n,inputsSchema:o,outputsSchema:i,metadata:s}={}){let a={name:e,description:r,extra:s?{metadata:s}:void 0};n&&(a.data_type=n),o&&(a.inputs_schema_definition=o),i&&(a.outputs_schema_definition=i);let c=JSON.stringify(a);return await(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(d,"create dataset"),d})).json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e&&r)throw new Error("Must provide either datasetName or datasetId, not both");if(e)$e(e),n+=`/${e}`;else if(r)o.append("name",r);else throw new Error("Must provide datasetName or datasetId");let i=await this._get(n,o),s;if(Array.isArray(i)){if(i.length===0)throw new Error(`Dataset[id=${e}, name=${r}] not found`);s=i[0]}else s=i;return s}async hasDataset({datasetId:e,datasetName:r}){try{return await this.readDataset({datasetId:e,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:r,fromVersion:n,toVersion:o}){let i=e;if(i===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:r})).id);let s=new URLSearchParams({from_version:typeof n=="string"?n:n.toISOString(),to_version:typeof o=="string"?o:o.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,s)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:r}){let n="/datasets";if(e===void 0)if(r!==void 0)e=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide either datasetName or datasetId");return(await(await this._getResponse(`${n}/${e}/openai_ft`)).text()).trim().split(` +`).map(a=>JSON.parse(a))}async*listDatasets({limit:e=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:s}={}){let a="/datasets",c=new URLSearchParams({limit:e.toString(),offset:r.toString()});if(n!==void 0)for(let u of n)c.append("id",u);o!==void 0&&c.append("name",o),i!==void 0&&c.append("name_contains",i),s!==void 0&&c.append("metadata",JSON.stringify(s));for await(let u of this._getPaginated(a,c))yield*u}async updateDataset(e){let{datasetId:r,datasetName:n,...o}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;$e(i);let s=JSON.stringify(o);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${i}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"update dataset"),c})).json()}async updateDatasetTag(e){let{datasetId:r,datasetName:n,asOf:o,tag:i}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let s=r??(await this.readDataset({datasetName:n})).id;$e(s);let a=JSON.stringify({as_of:typeof o=="string"?o:o.toISOString(),tag:i});await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${s}/tags`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"update dataset tags",!0),c})}async deleteDataset({datasetId:e,datasetName:r}){let n="/datasets",o=e;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(r!==void 0&&(o=(await this.readDataset({datasetName:r})).id),o!==void 0)$e(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");await this.caller.call(async()=>{let i=await this._fetch(this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,`delete ${n}`,!0),i})}async indexDataset({datasetId:e,datasetName:r,tag:n}){let o=e;if(!o&&!r)throw new Error("Must provide either datasetName or datasetId");if(o&&r)throw new Error("Must provide either datasetName or datasetId, not both");o||(o=(await this.readDataset({datasetName:r})).id),$e(o);let s=JSON.stringify({tag:n});await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${o}/index`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"index dataset"),c})).json()}async similarExamples(e,r,n,{filter:o}={}){let i={limit:n,inputs:e};o!==void 0&&(i.filter=o),$e(r);let s=JSON.stringify(i);return(await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${r}/search`,{headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,method:"POST",body:s});return await ue(u,"fetch similar examples"),u})).json()).examples}async createExample(e,r,n){if(pR(e)&&(r!==void 0||n!==void 0))throw new Error("Cannot provide outputs or options when using ExampleCreate object");let o=r?n?.datasetId:e.dataset_id,i=r?n?.datasetName:e.dataset_name;if(o===void 0&&i===void 0)throw new Error("Must provide either datasetName or datasetId");if(o!==void 0&&i!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");o===void 0&&(o=(await this.readDataset({datasetName:i})).id);let s=(r?n?.createdAt:e.created_at)||new Date,a;pR(e)?a=e:a={inputs:e,outputs:r,created_at:s?.toISOString(),id:n?.exampleId,metadata:n?.metadata,split:n?.split,source_run_id:n?.sourceRunId,use_source_run_io:n?.useSourceRunIO,use_source_run_attachments:n?.useSourceRunAttachments,attachments:n?.attachments};let c=await this._uploadExamplesMultipart(o,[a]);return await this.readExample(c.example_ids?.[0]??Et())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let b=e,x=b[0].dataset_id,k=b[0].dataset_name;if(x===void 0&&k===void 0)throw new Error("Must provide either datasetName or datasetId");if(x!==void 0&&k!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");x===void 0&&(x=(await this.readDataset({datasetName:k})).id);let T=await this._uploadExamplesMultipart(x,b);return await Promise.all(T.example_ids.map(J=>this.readExample(J)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:s,useSourceRunIOs:a,useSourceRunAttachments:c,attachments:u,exampleIds:l,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((b,x)=>({dataset_id:p,inputs:b,outputs:n?.[x],metadata:o?.[x],split:i?.[x],id:l?.[x],attachments:u?.[x],source_run_id:s?.[x],use_source_run_io:a?.[x],use_source_run_attachments:c?.[x]})),_=await this._uploadExamplesMultipart(p,h);return await Promise.all(_.example_ids.map(b=>this.readExample(b)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(s=>Ox(s)?Px(s):s),i=Ox(r)?Px(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){$e(e);let r=`/examples/${e}`,n=await this._get(r),{attachment_urls:o,...i}=n,s=i;return o&&(s.attachments=Object.entries(o).reduce((a,[c,u])=>(a[c.slice(11)]={presigned_url:u.presigned_url,mime_type:u.mime_type},a),{})),s}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:s,metadata:a,limit:c,offset:u,filter:l,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=o?typeof o=="string"?o:o?.toISOString():void 0;m&&p.append("as_of",m);let h=s??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let v of n)p.append("id",v);if(i!==void 0)for(let v of i)p.append("splits",v);if(a!==void 0){let v=JSON.stringify(a);p.append("metadata",v)}c!==void 0&&p.append("limit",c.toString()),u!==void 0&&p.append("offset",u.toString()),l!==void 0&&p.append("filter",l),d===!0&&["attachment_urls","outputs","metadata"].forEach(v=>p.append("select",v));let _=0;for await(let v of this._getPaginated("/examples",p)){for(let b of v){let{attachment_urls:x,...k}=b,T=k;x&&(T.attachments=Object.entries(x).reduce((F,[J,w])=>(F[J.slice(11)]={presigned_url:w.presigned_url,mime_type:w.mime_type||void 0},F),{})),yield T,_++}if(c!==void 0&&_>=c)break}}async deleteExample(e){$e(e);let r=`/examples/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,`delete ${r}`,!0),n})}async updateExample(e,r){let n;r?n=e:n=e.id,$e(n);let o;r?o={id:n,...r}:o=e;let i;return o.dataset_id!==void 0?i=o.dataset_id:i=(await this.readExample(n)).dataset_id,this._updateExamplesMultipart(i,[o])}async updateExamples(e){let r;return e[0].dataset_id===void 0?r=(await this.readExample(e[0].id)).dataset_id:r=e[0].dataset_id,this._updateExamplesMultipart(r,e)}async readDatasetVersion({datasetId:e,datasetName:r,asOf:n,tag:o}){let i;if(e?i=e:i=(await this.readDataset({datasetName:r})).id,$e(i),n&&o||!n&&!o)throw new Error("Exactly one of asOf and tag must be specified.");let s=new URLSearchParams;return n!==void 0&&s.append("as_of",typeof n=="string"?n:n.toISOString()),o!==void 0&&s.append("tag",o),await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${i}/version?${s.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(c,"read dataset version"),c})).json()}async listDatasetSplits({datasetId:e,datasetName:r,asOf:n}){let o;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?o=(await this.readDataset({datasetName:r})).id:o=e,$e(o);let i=new URLSearchParams,s=n?typeof n=="string"?n:n?.toISOString():void 0;return s&&i.append("as_of",s),await this._get(`/datasets/${o}/splits`,i)}async updateDatasetSplits({datasetId:e,datasetName:r,splitName:n,exampleIds:o,remove:i=!1}){let s;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?s=(await this.readDataset({datasetName:r})).id:s=e,$e(s);let a={split_name:n,examples:o.map(u=>($e(u),u)),remove:i},c=JSON.stringify(a);await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${s}/splits`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(u,"update dataset splits",!0),u})}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){uu("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let s;if(typeof e=="string")s=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)s=e;else throw new Error(`Invalid run type: ${typeof e}`);s.reference_example_id!==null&&s.reference_example_id!==void 0&&(i=await this.readExample(s.reference_example_id));let a=await r.evaluateRun(s,i),[c,u]=await this._logEvaluationFeedback(a,s,n);return u[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:s,sourceInfo:a,feedbackSourceType:c="api",sourceRunId:u,feedbackId:l,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:c??"api",metadata:a??{}};u!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:u}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&$e(m.metadata.__run.run_id);let h={id:l??Et(),run_id:e,key:r,score:lR(n),value:o,correction:i,comment:s,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},_=JSON.stringify(h),v=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{let b=await this._fetch(v,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:_});return await ue(b,"create feedback",!0),b}),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let s={};r!=null&&(s.score=lR(r)),n!=null&&(s.value=n),o!=null&&(s.correction=o),i!=null&&(s.comment=i),$e(e);let a=JSON.stringify(s);await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"update feedback",!0),c})}async readFeedback(e){$e(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){$e(e);let r=`/feedback/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,`delete ${r}`,!0),n})}async*listFeedback({runIds:e,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(e)for(let i of e)$e(i),o.append("run",i);if(r)for(let i of r)o.append("key",i);if(n)for(let i of n)o.append("source",i);for await(let i of this._getPaginated("/feedback",o))yield*i}async createPresignedFeedbackToken(e,r,{expiration:n,feedbackConfig:o}={}){let i={run_id:e,feedback_key:r,feedback_config:o};n?typeof n=="string"?i.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(i.expires_in=n):i.expires_in={hours:3};let s=JSON.stringify(i);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"create presigned feedback token"),c})).json()}async createComparativeExperiment({name:e,experimentIds:r,referenceDatasetId:n,createdAt:o,description:i,metadata:s,id:a}){if(r.length===0)throw new Error("At least one experiment is required");if(n||(n=(await this.readProject({projectId:r[0]})).reference_dataset_id),!n==null)throw new Error("A reference dataset is required");let c={id:a,name:e,experiment_ids:r,reference_dataset_id:n,description:i,created_at:(o??new Date)?.toISOString(),extra:{}};s&&(c.extra.metadata=s);let u=JSON.stringify(c);return(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(d,"create comparative experiment"),d})).json()}async*listPresignedFeedbackTokens(e){$e(e);let r=new URLSearchParams({run_id:e});for await(let n of this._getPaginated("/feedback/tokens",r))yield*n}_selectEvalResults(e){let r;return"results"in e?r=e.results:Array.isArray(e)?r=e:r=[e],r}async _logEvaluationFeedback(e,r,n){let o=this._selectEvalResults(e),i=[];for(let s of o){let a=n||{};s.evaluatorInfo&&(a={...s.evaluatorInfo,...a});let c=null;s.targetRunId?c=s.targetRunId:r&&(c=r.id),i.push(await this.createFeedback(c,s.key,{score:s.score,value:s.value,comment:s.comment,correction:s.correction,sourceInfo:a,sourceRunId:s.sourceRunId,feedbackConfig:s.feedbackConfig,feedbackSourceType:"model"}))}return[o,i]}async logEvaluationFeedback(e,r,n){let[o]=await this._logEvaluationFeedback(e,r,n);return o}async*listAnnotationQueues(e={}){let{queueIds:r,name:n,nameContains:o,limit:i}=e,s=new URLSearchParams;r&&r.forEach((c,u)=>{$e(c,`queueIds[${u}]`),s.append("ids",c)}),n&&s.append("name",n),o&&s.append("name_contains",o),s.append("limit",(i!==void 0?Math.min(i,100):100).toString());let a=0;for await(let c of this._getPaginated("/annotation-queues",s))if(yield*c,a++,i!==void 0&&a>=i)break}async createAnnotationQueue(e){let{name:r,description:n,queueId:o,rubricInstructions:i}=e,s={name:r,description:n,id:o||Et(),rubric_instructions:i},a=JSON.stringify(Object.fromEntries(Object.entries(s).filter(([u,l])=>l!==void 0)));return(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(u,"create annotation queue"),u})).json()}async readAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"read annotation queue"),n})).json()}async updateAnnotationQueue(e,r){let{name:n,description:o,rubricInstructions:i}=r,s=JSON.stringify({name:n,description:o,rubric_instructions:i});await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(a,"update annotation queue",!0),a})}async deleteAnnotationQueue(e){await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"delete annotation queue",!0),r})}async addRunsToAnnotationQueue(e,r){let n=JSON.stringify(r.map((o,i)=>$e(o,`runIds[${i}]`).toString()));await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(o,"add runs to annotation queue",!0),o})}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${$e(e,"queueId")}/run`;return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,"get run from annotation queue"),i})).json()}async deleteRunFromAnnotationQueue(e,r){await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/runs/${$e(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"delete run from annotation queue",!0),n})}async getSizeFromAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"get size from annotation queue"),n})).json()}async _currentTenantIsOwner(e){let r=await this._getSettings();return e=="-"||r.tenant_handle===e}async _ownerConflictError(e,r){let n=await this._getSettings();return new Error(`Cannot ${e} for another tenant. + + Current tenant: ${n.tenant_handle} + + Requested tenant: ${r}`)}async _getLatestCommitHash(e){let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/commits/${e}/?limit=1&offset=0`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"get latest commit hash"),o})).json();if(n.commits.length!==0)return n.commits[0].commit_hash}async _likeOrUnlikePrompt(e,r){let[n,o,i]=Wo(e),s=JSON.stringify({like:r});return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/likes/${n}/${o}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,`${r?"like":"unlike"} prompt`),c})).json()}async _getPromptUrl(e){let[r,n,o]=Wo(e);if(await this._currentTenantIsOwner(r)){let i=await this._getSettings();return o!=="latest"?`${this.getHostUrl()}/prompts/${n}/${o.substring(0,8)}?organizationId=${i.id}`:`${this.getHostUrl()}/prompts/${n}?organizationId=${i.id}`}else return o!=="latest"?`${this.getHostUrl()}/hub/${r}/${n}/${o.substring(0,8)}`:`${this.getHostUrl()}/hub/${r}/${n}`}async promptExists(e){return!!await this.getPrompt(e)}async likePrompt(e){return this._likeOrUnlikePrompt(e,!0)}async unlikePrompt(e){return this._likeOrUnlikePrompt(e,!1)}async*listCommits(e){for await(let r of this._getPaginated(`/commits/${e}/`,new URLSearchParams,n=>n.commits))yield*r}async*listPrompts(e){let r=new URLSearchParams;r.append("sort_field",e?.sortField??"updated_at"),r.append("sort_direction","desc"),r.append("is_archived",(!!e?.isArchived).toString()),e?.isPublic!==void 0&&r.append("is_public",e.isPublic.toString()),e?.query&&r.append("query",e.query);for await(let n of this._getPaginated("/repos",r,o=>o.repos))yield*n}async getPrompt(e){let[r,n,o]=Wo(e),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return a?.status===404?null:(await ue(a,"get prompt"),a)}))?.json();return s?.repo?s.repo:null}async createPrompt(e,r){let n=await this._getSettings();if(r?.isPublic&&!n.tenant_handle)throw new Error(`Cannot create a public prompt without first + + creating a LangChain Hub handle. + You can add a handle by creating a public prompt at: + + https://smith.langchain.com/prompts`);let[o,i,s]=Wo(e);if(!await this._currentTenantIsOwner(o))throw await this._ownerConflictError("create a prompt",o);let a={repo_handle:i,...r?.description&&{description:r.description},...r?.readme&&{readme:r.readme},...r?.tags&&{tags:r.tags},is_public:!!r?.isPublic},c=JSON.stringify(a),u=await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(d,"create prompt"),d}),{repo:l}=await u.json();return l}async createCommit(e,r,n){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[o,i,s]=Wo(e),a=n?.parentCommitHash==="latest"||!n?.parentCommitHash?await this._getLatestCommitHash(`${o}/${i}`):n?.parentCommitHash,c={manifest:JSON.parse(JSON.stringify(r)),parent_commit:a},u=JSON.stringify(c),d=await(await this.caller.call(async()=>{let f=await this._fetch(`${this.apiUrl}/commits/${o}/${i}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"create commit"),f})).json();return this._getPromptUrl(`${o}/${i}${d.commit_hash?`:${d.commit_hash}`:""}`)}async updateExamplesMultipart(e,r=[]){return this._updateExamplesMultipart(e,r)}async _updateExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let s of r){let a=s.id,c={...s.metadata&&{metadata:s.metadata},...s.split&&{split:s.split}},u=Pr(c,`Serializing body for example with id: ${a}`),l=new Blob([u],{type:"application/json"});if(n.append(a,l),s.inputs){let d=Pr(s.inputs,`Serializing inputs for example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.inputs`,f)}if(s.outputs){let d=Pr(s.outputs,`Serializing outputs whle updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.outputs`,f)}if(s.attachments)for(let[d,f]of Object.entries(s.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${a}.attachment.${d}`,h)}if(s.attachments_operations){let d=Pr(s.attachments_operations,`Serializing attachments while updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.attachments_operations`,f)}}let o=e??r[0]?.dataset_id;return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${o}/examples`)}`,{method:"PATCH",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(s,"update examples"),s})).json()}async uploadExamplesMultipart(e,r=[]){return this._uploadExamplesMultipart(e,r)}async _uploadExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let i of r){let s=(i.id??Et()).toString(),a={created_at:i.created_at,...i.metadata&&{metadata:i.metadata},...i.split&&{split:i.split},...i.source_run_id&&{source_run_id:i.source_run_id},...i.use_source_run_io&&{use_source_run_io:i.use_source_run_io},...i.use_source_run_attachments&&{use_source_run_attachments:i.use_source_run_attachments}},c=Pr(a,`Serializing body for uploaded example with id: ${s}`),u=new Blob([c],{type:"application/json"});if(n.append(s,u),i.inputs){let l=Pr(i.inputs,`Serializing inputs for uploaded example with id: ${s}`),d=new Blob([l],{type:"application/json"});n.append(`${s}.inputs`,d)}if(i.outputs){let l=Pr(i.outputs,`Serializing outputs for uploaded example with id: ${s}`),d=new Blob([l],{type:"application/json"});n.append(`${s}.outputs`,d)}if(i.attachments)for(let[l,d]of Object.entries(i.attachments)){let f,p;Array.isArray(d)?[f,p]=d:(f=d.mimeType,p=d.data);let m=new Blob([p],{type:`${f}; length=${p.byteLength}`});n.append(`${s}.attachment.${l}`,m)}}return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(i,"upload examples"),i})).json()}async updatePrompt(e,r){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[n,o]=Wo(e);if(!await this._currentTenantIsOwner(n))throw await this._ownerConflictError("update a prompt",n);let i={};if(r?.description!==void 0&&(i.description=r.description),r?.readme!==void 0&&(i.readme=r.readme),r?.tags!==void 0&&(i.tags=r.tags),r?.isPublic!==void 0&&(i.is_public=r.isPublic),r?.isArchived!==void 0&&(i.is_archived=r.isArchived),Object.keys(i).length===0)throw new Error("No valid update options provided");let s=JSON.stringify(i);return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/repos/${n}/${o}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"update prompt"),c})).json()}async deletePrompt(e){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[r,n,o]=Wo(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"delete prompt"),s})).json()}async pullPromptCommit(e,r){let[n,o,i]=Wo(e),a=await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/commits/${n}/${o}/${i}${r?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(c,"pull prompt commit"),c})).json();return{owner:n,repo:o,commit_hash:a.commit_hash,manifest:a.manifest,examples:a.examples}}async _pullPrompt(e,r){let n=await this.pullPromptCommit(e,{includeModel:r?.includeModel});return JSON.stringify(n.manifest)}async pushPrompt(e,r){return await this.promptExists(e)?r&&Object.keys(r).some(o=>o!=="object")&&await this.updatePrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}):await this.createPrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}),r?.object?await this.createCommit(e,r?.object,{parentCommitHash:r?.parentCommitHash}):await this._getPromptUrl(e)}async clonePublicDataset(e,r={}){let{sourceApiUrl:n=this.apiUrl,datasetName:o}=r,[i,s]=this.parseTokenOrUrl(e,n),a=new t({apiUrl:i,apiKey:"placeholder"}),c=await a.readSharedDataset(s),u=o||c.name;try{if(await this.hasDataset({datasetId:u})){console.log(`Dataset ${u} already exists in your tenant. Skipping.`);return}}catch{}let l=await a.listSharedExamples(s),d=await this.createDataset(u,{description:c.description,dataType:c.data_type||"kv",inputsSchema:c.inputs_schema_definition??void 0,outputsSchema:c.outputs_schema_definition??void 0});try{await this.createExamples({inputs:l.map(f=>f.inputs),outputs:l.flatMap(f=>f.outputs?[f.outputs]:[]),datasetId:d.id})}catch(f){throw console.error(`An error occurred while creating dataset ${u}. You should delete it manually.`),f}}parseTokenOrUrl(e,r,n=2,o="dataset"){try{return $e(e),[r,e]}catch{}try{let s=new URL(e).pathname.split("/").filter(a=>a!=="");if(s.length>=n){let a=s[s.length-n];return[r,a]}else throw new Error(`Invalid public ${o} URL: ${e}`)}catch{throw new Error(`Invalid public ${o} URL or token: ${e}`)}}async awaitPendingTraceBatches(){if(this.manualFlushMode)return console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve();await Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()]),this.langSmithToOTELTranslator!==void 0&&await iP()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}};function pR(t){return"dataset_id"in t||"dataset_name"in t}var mR=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>At(r)==="true");var mo=Symbol.for("lc:context_variables"),Zh=Symbol.for("langsmith:replica_trace_roots");function t0(t,e){if(mo in t)return t[mo][e]}function hR(t,e,r){let n=mo in t?t[mo]:{};n[e]=r,t[mo]=n}var Fd=36,Bd="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function gR(t){let r=Object.keys(t).sort().map(n=>`${n}:${t[n]??""}`).join("|");return ua(r,Bd)}function Mq(t){return t.replace(/[-:.]/g,"")}function yR(t,e=1){let r=e.toFixed(0).slice(0,3).padStart(3,"0");return`${new Date(t).toISOString().slice(0,-1)}${r}Z`}function r0(t,e,r=1){let n=yR(t,r);return{dottedOrder:Mq(n)+e,microsecondPrecisionDatestring:n}}var qh=class t{constructor(e,r,n,o){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n,this.replicas=o}static fromHeader(e){let r=e.split(","),n={},o=[],i,s;for(let a of r){let[c,u]=a.split("="),l=decodeURIComponent(u);c==="langsmith-metadata"?n=JSON.parse(l):c==="langsmith-tags"?o=l.split(","):c==="langsmith-project"?i=l:c==="langsmith-replicas"&&(s=JSON.parse(l))}return new t(n,o,i,s)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}},Ln=class t{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"distributedParentId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),vR(e)){Object.assign(this,{...e});return}let r=t.getDefaultConfig(),{metadata:n,...o}=e,i=o.client??t.getSharedClient(),s={...n,...o?.extra?.metadata};if(o.extra={...o.extra,metadata:s},"id"in o&&o.id==null&&delete o.id,Object.assign(this,{...r,...o,client:i}),this.execution_order??=1,this.child_execution_order??=1,this.dotted_order||(this._serialized_start_time=yR(this.start_time,this.execution_order)),this.id||(this.id=mh(this._serialized_start_time??this.start_time)),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.replicas=Uq(this.replicas),!this.dotted_order){let{dottedOrder:a}=r0(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+a:this.dotted_order=a}}set metadata(e){this.extra={...this.extra,metadata:{...this.extra?.metadata,...e}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){let e=Date.now();return{run_type:"chain",project_name:Pd(),child_runs:[],api_url:Qr("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Qr("LANGCHAIN_API_KEY"),caller_options:{},start_time:e,serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new da),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=this.replicas?.map(l=>{let{reroot:d,...f}=l;return f}),o=e.replicas??n,i=new t({...e,parent_run:this,project_name:this.project_name,replicas:o,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});mo in this&&(i[mo]=this[mo]);let s=Symbol.for("lc:child_config"),a=e.extra?.[s]??this.extra[s];if(Dq(a)){let l={...a},d=jq(l.callbacks)?l.callbacks.copy?.():void 0;d&&(Object.assign(d,{_parentRunId:i.id}),d.handlers?.find(bR)?.updateFromRunTree?.(i),l.callbacks=d),i.extra[s]=l}let c=new Set,u=this;for(;u!=null&&!c.has(u.id);)c.add(u.id),u.child_execution_order=Math.max(u.child_execution_order,r),u=u.parent_run;return this.child_runs.push(i),i}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o?.runtime?.library===void 0&&(o.runtime||(o.runtime={}),r))for(let[a,c]of Object.entries(r))o.runtime[a]||(o.runtime[a]=c);let i,s;return n?(s=e.parent_run?.id??e.parent_run_id,i=[]):(i=e.child_runs.map(a=>this._convertToCreate(a,r,n)),s=void 0),{id:e.id,name:e.name,start_time:e._serialized_start_time??e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:o,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:i,parent_run_id:s,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments,events:e.events}}_sliceParentId(e,r){if(r.dotted_order){let n=r.dotted_order.split("."),o=null;for(let i=0;i0?r.trace_id=i[0].slice(-Fd):r.trace_id=r.id}}r.parent_run_id===e&&(r.parent_run_id=void 0)}_setReplicaTraceRoot(e,r){let n=t0(this,Zh)??{};n[e]=r,hR(this,Zh,n);for(let o of this.child_runs)o._setReplicaTraceRoot(e,r)}_remapForProject(e){let{projectName:r,runtimeEnv:n,excludeChildRuns:o=!0,reroot:i=!1,distributedParentId:s,apiUrl:a,apiKey:c,workspaceId:u}=e,l=this._convertToCreate(this,n,o);if(r===this.project_name)return{...l,session_name:r};if(i){if(s)this._sliceParentId(s,l);else if(l.parent_run_id=void 0,l.dotted_order){let b=l.dotted_order.split(".");b.length>0&&(l.dotted_order=b[b.length-1],l.trace_id=l.id)}let v=gR({projectName:r,apiUrl:a,apiKey:c,workspaceId:u});this._setReplicaTraceRoot(v,l.id)}let d;if(!i){let v=t0(this,Zh)??{},b=gR({projectName:r,apiUrl:a,apiKey:c,workspaceId:u});if(d=v[b],d&&(l.trace_id=d,l.dotted_order)){let x=l.dotted_order.split("."),k=null;for(let T=0;T{let k=x.slice(-Fd),T=ua(`${k}:${r}`,Bd);return x.slice(0,-Fd)+T}).join(".")),{...l,id:p,trace_id:m,parent_run_id:h,dotted_order:_,session_name:r}}async postRun(e=!0){try{let r=gh();if(this.replicas&&this.replicas.length>0)for(let{projectName:n,apiKey:o,apiUrl:i,workspaceId:s,reroot:a}of this.replicas){let c=this._remapForProject({projectName:n??this.project_name,runtimeEnv:r,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:i,apiKey:o,workspaceId:s});await this.client.createRun(c,{apiKey:o,apiUrl:i,workspaceId:s})}else{let n=this._convertToCreate(this,r,e);await this.client.createRun(n)}if(!e){uu("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let n of this.child_runs)await n.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(e){if(this.replicas&&this.replicas.length>0)for(let{projectName:r,apiKey:n,apiUrl:o,workspaceId:i,updates:s,reroot:a}of this.replicas){let c=this._remapForProject({projectName:r??this.project_name,runtimeEnv:void 0,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:o,apiKey:n,workspaceId:i}),u={id:c.id,name:c.name,run_type:c.run_type,start_time:c.start_time,outputs:c.outputs,error:c.error,parent_run_id:c.parent_run_id,session_name:c.session_name,reference_example_id:c.reference_example_id,end_time:c.end_time,dotted_order:c.dotted_order,trace_id:c.trace_id,events:c.events,tags:c.tags,extra:c.extra,attachments:this.attachments,...s};e?.excludeInputs||(u.inputs=c.inputs),await this.client.updateRun(c.id,u,{apiKey:n,apiUrl:o,workspaceId:i})}else try{let r={name:this.name,run_type:this.run_type,start_time:this._serialized_start_time??this.start_time,end_time:this.end_time,error:this.error,outputs:this.outputs,parent_run_id:this.parent_run?.id??this.parent_run_id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};e?.excludeInputs||(r.inputs=this.inputs),await this.client.updateRun(this.id,r)}catch(r){console.error(`Error in patchRun for run ${this.id}`,r)}}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(e){this.events||(this.events=[]),typeof e=="string"?this.events.push({name:"event",time:new Date().toISOString(),message:e}):this.events.push({...e,time:e.time??new Date().toISOString()})}static fromRunnableConfig(e,r){let n=e?.callbacks,o,i,s,a=mR();if(n){let u=n?.getParentRunId?.()??"",l=n?.handlers?.find(d=>d?.name=="langchain_tracer");o=l?.getRun?.(u),i=l?.projectName,s=l?.client,a=a||!!l}return o?new t({name:o.name,id:o.id,trace_id:o.trace_id,dotted_order:o.dotted_order,client:s,tracingEnabled:a,project_name:i,tags:[...new Set((o?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...o?.extra?.metadata,...e?.metadata}}}).createChild(r):new t({...r,client:s,tracingEnabled:a,project_name:i})}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,r){let n="get"in e&&typeof e.get=="function"?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,o=n["langsmith-trace"];if(!o||typeof o!="string")return;let i=o.trim(),s=i.split(".").map(l=>{let[d,f]=l.split("Z");return{strTime:d,time:Date.parse(d+"Z"),uuid:f}}),a=s[0].uuid,c={...r,name:r?.name??"parent",run_type:r?.run_type??"chain",start_time:r?.start_time??Date.now(),id:s.at(-1)?.uuid,trace_id:a,dotted_order:i};if(n.baggage&&typeof n.baggage=="string"){let l=qh.fromHeader(n.baggage);c.metadata=l.metadata,c.tags=l.tags,c.project_name=l.project_name,c.replicas=l.replicas}let u=new t(c);return u.distributedParentId=u.id,u}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new qh(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(Ln,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null});function vR(t){return t!=null&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function bR(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function _R(t){return Array.isArray(t)&&t.some(e=>bR(e))}function jq(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function Dq(t){return t!=null&&typeof t.callbacks=="object"&&(_R(t.callbacks?.handlers)||_R(t.callbacks))}function Lq(){let t=Qr("LANGSMITH_RUNS_ENDPOINTS");if(!t)return[];try{let e=JSON.parse(t);if(Array.isArray(e)){let r=[];for(let n of e){if(typeof n!="object"||n===null){console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got ${typeof n}`);continue}if(typeof n.api_url!="string"){console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_url}`);continue}if(typeof n.api_key!="string"){console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_key}`);continue}r.push({apiUrl:n.api_url.replace(/\/$/,""),apiKey:n.api_key})}return r}else if(typeof e=="object"&&e!==null){Fq(e);let r=[];for(let[n,o]of Object.entries(e)){let i=n.replace(/\/$/,"");if(typeof o=="string")r.push({apiUrl:i,apiKey:o});else{console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${n}: expected string, got ${typeof o}`);continue}}return r}else return console.warn(`Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey, got ${typeof e}`),[]}catch(e){if(sR(e))throw e;return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey"),[]}}function Uq(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):Lq()}function Fq(t){if(Object.keys(t).length>0&&At("ENDPOINT"))throw new Lh}var Bq={};G(Bq,{BaseTracer:()=>Un,isBaseTracer:()=>fa});var Zq=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};function o0(t,e){if(t)return new Ln({...t,start_time:t._serialized_start_time??t.start_time,parent_run:o0(e),child_runs:t.child_runs.map(r=>o0(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:ex()},tracingEnabled:!1})}function n0(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function fa(t){return typeof t._addRunToRunMap=="function"}var Un=class extends la{runMap=new Map;runTreeMap=new Map;usesRunTreeMap=!1;constructor(t){super(...arguments)}copy(){return this}getRunById(t){if(t!==void 0)return this.usesRunTreeMap?Zq(this.runTreeMap.get(t)):this.runMap.get(t)}stringifyError(t){return t instanceof Error?t.message+(t?.stack?` + +${t.stack}`:""):typeof t=="string"?t:`${t}`}_addChildRun(t,e){t.child_runs.push(e)}_addRunToRunMap(t){let{dottedOrder:e,microsecondPrecisionDatestring:r}=r0(new Date(t.start_time).getTime(),t.id,t.execution_order),n={...t},o=this.getRunById(n.parent_run_id);if(n.parent_run_id!==void 0?o&&(this._addChildRun(o,n),o.child_execution_order=Math.max(o.child_execution_order,n.child_execution_order),n.trace_id=o.trace_id,o.dotted_order!==void 0&&(n.dotted_order=[o.dotted_order,e].join("."),n._serialized_start_time=r)):(n.trace_id=n.id,n.dotted_order=e,n._serialized_start_time=r),this.usesRunTreeMap){let i=o0(n,o);i!==void 0&&this.runTreeMap.set(n.id,i)}else this.runMap.set(n.id,n);return n}async _endTrace(t){let e=t.parent_run_id!==void 0&&this.getRunById(t.parent_run_id);e?e.child_execution_order=Math.max(e.child_execution_order,t.child_execution_order):await this.persistRun(t),await this.onRunUpdate?.(t),this.usesRunTreeMap?this.runTreeMap.delete(t.id):this.runMap.delete(t.id)}_getExecutionOrder(t){let e=t!==void 0&&this.getRunById(t);return e?e.child_execution_order+1:1}_createRunForLLMStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l=s?{...o,metadata:s}:o,d={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{prompts:e},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:l??{},tags:i||[]};return this._addRunToRunMap(d)}async handleLLMStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForLLMStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}_createRunForChatModelStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l=s?{...o,metadata:s}:o,d={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{messages:e},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:l??{},tags:i||[]};return this._addRunToRunMap(d)}async handleChatModelStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForChatModelStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}async handleLLMEnd(t,e,r,n,o){let i=this.getRunById(e);if(!i||i?.run_type!=="llm")throw new Error("No LLM run to end.");return i.end_time=Date.now(),i.outputs=t,i.events.push({name:"end",time:new Date(i.end_time).toISOString()}),i.extra={...i.extra,...o},await this.onLLMEnd?.(i),await this._endTrace(i),i}async handleLLMError(t,e,r,n,o){let i=this.getRunById(e);if(!i||i?.run_type!=="llm")throw new Error("No LLM run to end.");return i.end_time=Date.now(),i.error=this.stringifyError(t),i.events.push({name:"error",time:new Date(i.end_time).toISOString()}),i.extra={...i.extra,...o},await this.onLLMError?.(i),await this._endTrace(i),i}_createRunForChainStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:e,execution_order:c,child_execution_order:c,run_type:s??"chain",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(l)}async handleChainStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForChainStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onChainStart?.(c),c}async handleChainEnd(t,e,r,n,o){let i=this.getRunById(e);if(!i)throw new Error("No chain run to end.");return i.end_time=Date.now(),i.outputs=n0(t,"output"),i.events.push({name:"end",time:new Date(i.end_time).toISOString()}),o?.inputs!==void 0&&(i.inputs=n0(o.inputs,"input")),await this.onChainEnd?.(i),await this._endTrace(i),i}async handleChainError(t,e,r,n,o){let i=this.getRunById(e);if(!i)throw new Error("No chain run to end.");return i.end_time=Date.now(),i.error=this.stringifyError(t),i.events.push({name:"error",time:new Date(i.end_time).toISOString()}),o?.inputs!==void 0&&(i.inputs=n0(o.inputs,"input")),await this.onChainError?.(i),await this._endTrace(i),i}_createRunForToolStart(t,e,r,n,o,i,s){let a=this._getExecutionOrder(n),c=Date.now(),u={id:r,name:s??t.id[t.id.length-1],parent_run_id:n,start_time:c,serialized:t,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{input:e},execution_order:a,child_execution_order:a,run_type:"tool",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(u)}async handleToolStart(t,e,r,n,o,i,s){let a=this.getRunById(r)??this._createRunForToolStart(t,e,r,n,o,i,s);return await this.onRunCreate?.(a),await this.onToolStart?.(a),a}async handleToolEnd(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.outputs={output:t},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onToolEnd?.(r),await this._endTrace(r),r}async handleToolError(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.error=this.stringifyError(t),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onToolError?.(r),await this._endTrace(r),r}async handleAgentAction(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="chain")return;let n=r;n.actions=n.actions||[],n.actions.push(t),n.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentAction?.(r)}async handleAgentEnd(t,e){let r=this.getRunById(e);!r||r?.run_type!=="chain"||(r.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentEnd?.(r))}_createRunForRetrieverStart(t,e,r,n,o,i,s){let a=this._getExecutionOrder(n),c=Date.now(),u={id:r,name:s??t.id[t.id.length-1],parent_run_id:n,start_time:c,serialized:t,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{query:e},execution_order:a,child_execution_order:a,run_type:"retriever",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(u)}async handleRetrieverStart(t,e,r,n,o,i,s){let a=this.getRunById(r)??this._createRunForRetrieverStart(t,e,r,n,o,i,s);return await this.onRunCreate?.(a),await this.onRetrieverStart?.(a),a}async handleRetrieverEnd(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.outputs={documents:t},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onRetrieverEnd?.(r),await this._endTrace(r),r}async handleRetrieverError(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.error=this.stringifyError(t),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onRetrieverError?.(r),await this._endTrace(r),r}async handleText(t,e){let r=this.getRunById(e);!r||r?.run_type!=="chain"||(r.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:t}}),await this.onText?.(r))}async handleLLMNewToken(t,e,r,n,o,i){let s=this.getRunById(r);if(!s||s?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return s.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:t,idx:e,chunk:i?.chunk}}),await this.onLLMNewToken?.(s,t,{chunk:i?.chunk}),s}};var i0=mn(IR(),1),Vq={};G(Vq,{ConsoleCallbackHandler:()=>Vh});function yr(t,e){return`${t.open}${e}${t.close}`}function yn(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function SR(t){return typeof t=="string"?t.trim():t==null?t:yn(t,t.toString())}function Fi(t){if(!t.end_time)return"";let e=t.end_time-t.start_time;return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}var{color:Cr}=i0.default,Vh=class extends Un{name="console_callback_handler";persistRun(t){return Promise.resolve()}getParents(t){let e=[],r=t;for(;r.parent_run_id;){let n=this.runMap.get(r.parent_run_id);if(n)e.push(n),r=n;else break}return e}getBreadcrumbs(t){let r=[...this.getParents(t).reverse(),t].map((n,o,i)=>{let s=`${n.execution_order}:${n.run_type}:${n.name}`;return o===i.length-1?yr(i0.default.bold,s):s}).join(" > ");return yr(Cr.grey,r)}onChainStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[chain/start]")} [${e}] Entering Chain run with input: ${yn(t.inputs,"[inputs]")}`)}onChainEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[chain/end]")} [${e}] [${Fi(t)}] Exiting Chain run with output: ${yn(t.outputs,"[outputs]")}`)}onChainError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[chain/error]")} [${e}] [${Fi(t)}] Chain run errored with error: ${yn(t.error,"[error]")}`)}onLLMStart(t){let e=this.getBreadcrumbs(t),r="prompts"in t.inputs?{prompts:t.inputs.prompts.map(n=>n.trim())}:t.inputs;console.log(`${yr(Cr.green,"[llm/start]")} [${e}] Entering LLM run with input: ${yn(r,"[inputs]")}`)}onLLMEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[llm/end]")} [${e}] [${Fi(t)}] Exiting LLM run with output: ${yn(t.outputs,"[response]")}`)}onLLMError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[llm/error]")} [${e}] [${Fi(t)}] LLM run errored with error: ${yn(t.error,"[error]")}`)}onToolStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[tool/start]")} [${e}] Entering Tool run with input: "${SR(t.inputs.input)}"`)}onToolEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[tool/end]")} [${e}] [${Fi(t)}] Exiting Tool run with output: "${SR(t.outputs?.output)}"`)}onToolError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[tool/error]")} [${e}] [${Fi(t)}] Tool run errored with error: ${yn(t.error,"[error]")}`)}onRetrieverStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[retriever/start]")} [${e}] Entering Retriever run with input: ${yn(t.inputs,"[inputs]")}`)}onRetrieverEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[retriever/end]")} [${e}] [${Fi(t)}] Exiting Retriever run with output: ${yn(t.outputs,"[outputs]")}`)}onRetrieverError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[retriever/error]")} [${e}] [${Fi(t)}] Retriever run errored with error: ${yn(t.error,"[error]")}`)}onAgentAction(t){let e=t,r=this.getBreadcrumbs(t);console.log(`${yr(Cr.blue,"[agent/action]")} [${r}] Agent selected action: ${yn(e.actions[e.actions.length-1],"[action]")}`)}};var s0,Gh=()=>{if(s0===void 0){let t=It("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};s0=new da(t)}return s0};var c0=class{getStore(){}run(e,r){return r()}},a0=Symbol.for("ls:tracing_async_local_storage"),Gq=new c0,u0=class{getInstance(){return globalThis[a0]??Gq}initializeGlobalInstance(e){globalThis[a0]===void 0&&(globalThis[a0]=e)}},Kq=new u0;function kR(t=!1){let e=Kq.getInstance().getStore();if(!t&&e===void 0)throw new Error(`Could not get the current run tree. + +Please make sure you are calling this method within a traceable function and that tracing is enabled.`);return e}var rge=Symbol.for("langsmith:traceable:root");function Kh(t){return typeof t=="function"&&"langsmith:traceable"in t}var Hq={};G(Hq,{LangChainTracer:()=>Zd});var Zd=class TR extends Un{name="langchain_tracer";projectName;exampleId;client;replicas;usesRunTreeMap=!0;constructor(e={}){super(e);let{exampleId:r,projectName:n,client:o,replicas:i}=e;this.projectName=n??Pd(),this.replicas=i,this.exampleId=r,this.client=o??Gh();let s=TR.getTraceableRunTree();s&&this.updateFromRunTree(s)}async persistRun(e){}async onRunCreate(e){await this.getRunTreeWithTracingConfig(e.id)?.postRun()}async onRunUpdate(e){await this.getRunTreeWithTracingConfig(e.id)?.patchRun()}getRun(e){return this.runTreeMap.get(e)}updateFromRunTree(e){this.runTreeMap.set(e.id,e);let r=e,n=new Set;for(;r.parent_run&&!(n.has(r.id)||(n.add(r.id),!r.parent_run));)r=r.parent_run;n.clear();let o=[r];for(;o.length>0;){let i=o.shift();!i||n.has(i.id)||(n.add(i.id),this.runTreeMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.replicas=e.replicas??this.replicas,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}getRunTreeWithTracingConfig(e){let r=this.runTreeMap.get(e);if(r)return new Ln({...r,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return kR(!0)}catch{return}}};var Hh=mn(Sh(),1),ma;function Wq(){let t="default"in Hh.default?Hh.default.default:Hh.default;return new t({autoStart:!0,concurrency:1})}function Jq(){return typeof ma>"u"&&(ma=Wq()),ma}async function gt(t,e){if(e===!0){let r=Li();r!==void 0?await r.run(void 0,async()=>t()):await t()}else ma=Jq(),ma.add(async()=>{let r=Li();r!==void 0?await r.run(void 0,async()=>t()):await t()})}async function ER(){let t=Gh();await Promise.allSettled([typeof ma<"u"?ma.onIdle():Promise.resolve(),t.awaitPendingTraceBatches()])}var Xq={};G(Xq,{awaitAllCallbacks:()=>ER,consumeCallback:()=>gt});var AR=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>It(r)==="true");function l0(t){let e=Li();return e===void 0?void 0:e.getStore()?.[Di]?.[t]}var Yq=Symbol("lc:configure_hooks"),OR=()=>l0(Yq)||[];var Qq={};G(Qq,{BaseCallbackManager:()=>PR,BaseRunManager:()=>Vd,CallbackManager:()=>St,CallbackManagerForChainRun:()=>RR,CallbackManagerForLLMRun:()=>d0,CallbackManagerForRetrieverRun:()=>CR,CallbackManagerForToolRun:()=>NR,ensureHandler:()=>pu,parseCallbackConfigArg:()=>ha});function ha(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}var PR=class{setHandler(t){return this.setHandlers([t])}},Vd=class{constructor(t,e,r,n,o,i,s,a){this.runId=t,this.handlers=e,this.inheritableHandlers=r,this.tags=n,this.inheritableTags=o,this.metadata=i,this.inheritableMetadata=s,this._parentRunId=a}get parentRunId(){return this._parentRunId}async handleText(t){await Promise.all(this.handlers.map(e=>gt(async()=>{try{await e.handleText?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleText: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleCustomEvent(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{try{await i.handleCustomEvent?.(t,e,this.runId,this.tags,this.metadata)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleCustomEvent: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},CR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleRetrieverEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetriever`),e.raiseError)throw r}},e.awaitHandlers)))}async handleRetrieverError(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetrieverError: ${r}`),e.raiseError)throw t}},e.awaitHandlers)))}},d0=class extends Vd{async handleLLMNewToken(t,e,r,n,o,i){await Promise.all(this.handlers.map(s=>gt(async()=>{if(!s.ignoreLLM)try{await s.handleLLMNewToken?.(t,e??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,i)}catch(a){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleLLMNewToken: ${a}`),s.raiseError)throw a}},s.awaitHandlers)))}async handleLLMError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreLLM)try{await i.handleLLMError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleLLMEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreLLM)try{await i.handleLLMEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},RR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleChainError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreChain)try{await i.handleChainError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleChainEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreChain)try{await i.handleChainEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleAgentAction(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleAgentAction?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentAction: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleAgentEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleAgentEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},NR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleToolError(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleToolError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolError: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleToolEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleToolEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},St=class qd extends PR{handlers=[];inheritableHandlers=[];tags=[];inheritableTags=[];metadata={};inheritableMetadata={};name="callback_manager";_parentRunId;constructor(e,r){super(),this.handlers=r?.handlers??this.handlers,this.inheritableHandlers=r?.inheritableHandlers??this.inheritableHandlers,this.tags=r?.tags??this.tags,this.inheritableTags=r?.inheritableTags??this.inheritableTags,this.metadata=r?.metadata??this.metadata,this.inheritableMetadata=r?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=e}getParentRunId(){return this._parentRunId}async handleLLMStart(e,r,n=void 0,o=void 0,i=void 0,s=void 0,a=void 0,c=void 0){return Promise.all(r.map(async(u,l)=>{let d=l===0&&n?n:Et();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return fa(f)&&f._createRunForLLMStart(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c),gt(async()=>{try{await f.handleLLMStart?.(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c)}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new d0(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(e,r,n=void 0,o=void 0,i=void 0,s=void 0,a=void 0,c=void 0){return Promise.all(r.map(async(u,l)=>{let d=l===0&&n?n:Et();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return fa(f)&&f._createRunForChatModelStart(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c),gt(async()=>{try{if(f.handleChatModelStart)await f.handleChatModelStart?.(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c);else if(f.handleLLMStart){let p=au(u);await f.handleLLMStart?.(e,[p],d,this._parentRunId,i,this.tags,this.metadata,c)}}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new d0(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreChain)return fa(c)&&c._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,a),gt(async()=>{try{await c.handleChainStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,o,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleChainStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new RR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreAgent)return fa(c)&&c._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,a),gt(async()=>{try{await c.handleToolStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleToolStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new NR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreRetriever)return fa(c)&&c._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,a),gt(async()=>{try{await c.handleRetrieverStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleRetrieverStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new CR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(e,r,n,o,i){await Promise.all(this.handlers.map(s=>gt(async()=>{if(!s.ignoreCustomEvent)try{await s.handleCustomEvent?.(e,r,n,this.tags,this.metadata)}catch(a){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleCustomEvent: ${a}`),s.raiseError)throw a}},s.awaitHandlers)))}addHandler(e,r=!0){this.handlers.push(e),r&&this.inheritableHandlers.push(e)}removeHandler(e){this.handlers=this.handlers.filter(r=>r!==e),this.inheritableHandlers=this.inheritableHandlers.filter(r=>r!==e)}setHandlers(e,r=!0){this.handlers=[],this.inheritableHandlers=[];for(let n of e)this.addHandler(n,r)}addTags(e,r=!0){this.removeTags(e),this.tags.push(...e),r&&this.inheritableTags.push(...e)}removeTags(e){this.tags=this.tags.filter(r=>!e.includes(r)),this.inheritableTags=this.inheritableTags.filter(r=>!e.includes(r))}addMetadata(e,r=!0){this.metadata={...this.metadata,...e},r&&(this.inheritableMetadata={...this.inheritableMetadata,...e})}removeMetadata(e){for(let r of Object.keys(e))delete this.metadata[r],delete this.inheritableMetadata[r]}copy(e=[],r=!0){let n=new qd(this._parentRunId);for(let o of this.handlers){let i=this.inheritableHandlers.includes(o);n.addHandler(o,i)}for(let o of this.tags){let i=this.inheritableTags.includes(o);n.addTags([o],i)}for(let o of Object.keys(this.metadata)){let i=Object.keys(this.inheritableMetadata).includes(o);n.addMetadata({[o]:this.metadata[o]},i)}for(let o of e)n.handlers.filter(i=>i.name==="console_callback_handler").some(i=>i.name===o.name)||n.addHandler(o,r);return n}static fromHandlers(e){class r extends la{name=Et();constructor(){super(),Object.assign(this,e)}}let n=new this;return n.addHandler(new r),n}static configure(e,r,n,o,i,s,a){return this._configureSync(e,r,n,o,i,s,a)}static _configureSync(e,r,n,o,i,s,a){let c;(e||r)&&(Array.isArray(e)||!e?(c=new qd,c.setHandlers(e?.map(pu)??[],!0)):c=e,c=c.copy(Array.isArray(r)?r.map(pu):r?.handlers,!1));let u=It("LANGCHAIN_VERBOSE")==="true"||a?.verbose,l=Zd.getTraceableRunTree()?.tracingEnabled||AR(),d=l||(It("LANGCHAIN_TRACING")??!1);if(u||d){if(c||(c=new qd),u&&!c.handlers.some(f=>f.name===Vh.prototype.name)){let f=new Vh;c.addHandler(f,!0)}if(d&&!c.handlers.some(f=>f.name==="langchain_tracer")&&l){let f=new Zd;c.addHandler(f,!0)}if(l){let f=Zd.getTraceableRunTree();f&&c._parentRunId===void 0&&(c._parentRunId=f.id,c.handlers.find(m=>m.name==="langchain_tracer")?.updateFromRunTree(f))}}for(let{contextVar:f,inheritable:p=!0,handlerClass:m,envVar:h}of OR()){let _=h&&It(h)==="true"&&m,v,b=f!==void 0?l0(f):void 0;b&&ox(b)?v=b:_&&(v=new m({})),v!==void 0&&(c||(c=new qd),c.handlers.some(x=>x.name===v.name)||c.addHandler(v,p))}return(n||o)&&c&&(c.addTags(n??[]),c.addTags(o??[],!1)),(i||s)&&c&&(c.addMetadata(i??{}),c.addMetadata(s??{},!1)),c}};function pu(t){return"name"in t?t:la.fromMethods(t)}var p0=class{getStore(){}run(t,e){return e()}enterWith(t){}},eV=new p0,zR=Symbol.for("lc:child_config"),tV=class{getInstance(){return Li()??eV}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[zR]}runWithConfig(t,e,r){let n=St._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata),o=this.getInstance(),i=o.getStore(),s=n?.getParentRunId(),a=n?.handlers?.find(u=>u?.name==="langchain_tracer"),c;return a&&s?c=a.getRunTreeWithTracingConfig(s):r||(c=new Ln({name:"",tracingEnabled:!1})),c&&(c.extra={...c.extra,[zR]:t}),i!==void 0&&i[Di]!==void 0&&(c===void 0&&(c={}),c[Di]=i[Di]),o.run(c,e)}initializeGlobalInstance(t){Li()===void 0&&fO(t)}},Lt=new tV;var rV={};G(rV,{AsyncLocalStorageProviderSingleton:()=>Lt,MockAsyncLocalStorage:()=>p0,_CONTEXT_VARIABLES_KEY:()=>Di});var Wh=25;async function or(t){return St._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function ga(...t){let e={};for(let r of t.filter(n=>!!n))for(let n of Object.keys(r))if(n==="metadata")e[n]={...e[n],...r[n]};else if(n==="tags"){let o=e[n]??[];e[n]=[...new Set(o.concat(r[n]??[]))]}else if(n==="configurable")e[n]={...e[n],...r[n]};else if(n==="timeout")e.timeout===void 0?e.timeout=r.timeout:r.timeout!==void 0&&(e.timeout=Math.min(e.timeout,r.timeout));else if(n==="signal")e.signal===void 0?e.signal=r.signal:r.signal!==void 0&&("any"in AbortSignal?e.signal=AbortSignal.any([e.signal,r.signal]):e.signal=r.signal);else if(n==="callbacks"){let o=e.callbacks,i=r.callbacks;if(Array.isArray(i))if(!o)e.callbacks=i;else if(Array.isArray(o))e.callbacks=o.concat(i);else{let s=o.copy();for(let a of i)s.addHandler(pu(a),!0);e.callbacks=s}else if(i)if(!o)e.callbacks=i;else if(Array.isArray(o)){let s=i.copy();for(let a of o)s.addHandler(pu(a),!0);e.callbacks=s}else e.callbacks=new St(i._parentRunId,{handlers:o.handlers.concat(i.handlers),inheritableHandlers:o.inheritableHandlers.concat(i.inheritableHandlers),tags:Array.from(new Set(o.tags.concat(i.tags))),inheritableTags:Array.from(new Set(o.inheritableTags.concat(i.inheritableTags))),metadata:{...o.metadata,...i.metadata}})}else{let o=n;e[o]=r[o]??e[o]}return e}var nV=new Set(["string","number","boolean"]);function Pe(t){let e=Lt.getRunnableConfig(),r={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(e){let{runId:n,runName:o,...i}=e;r=Object.entries(i).reduce((s,[a,c])=>(c!==void 0&&(s[a]=c),s),r)}if(t&&(r=Object.entries(t).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),r)),r?.configurable)for(let n of Object.keys(r.configurable))nV.has(typeof r.configurable[n])&&!r.metadata?.[n]&&(r.metadata||(r.metadata={}),r.metadata[n]=r.configurable[n]);if(r.timeout!==void 0){if(r.timeout<=0)throw new Error("Timeout must be a positive number");let n=AbortSignal.timeout(r.timeout);r.signal!==void 0?"any"in AbortSignal&&(r.signal=AbortSignal.any([r.signal,n])):r.signal=n,delete r.timeout}return r}function Ve(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:s}={}){let a=Pe(t);return e!==void 0&&(delete a.runName,a.callbacks=e),n!==void 0&&(a.recursionLimit=n),r!==void 0&&(a.maxConcurrency=r),o!==void 0&&(a.runName=o),i!==void 0&&(a.configurable={...a.configurable,...i}),s!==void 0&&delete a.runId,a}function vr(t){if(t)return{configurable:t.configurable,recursionLimit:t.recursionLimit,callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,maxConcurrency:t.maxConcurrency,timeout:t.timeout,signal:t.signal,store:t.store}}async function vn(t,e){if(e===void 0)return t;let r;return Promise.race([t.catch(n=>{if(!e?.aborted)throw n}),new Promise((n,o)=>{r=()=>{o(Bi(e))},e.addEventListener("abort",r),e.aborted&&o(Bi(e))})]).finally(()=>e.removeEventListener("abort",r))}function Bi(t){return t?.reason instanceof Error?t.reason:typeof t?.reason=="string"?new Error(t.reason):new Error("Aborted")}var oV={};G(oV,{AsyncGeneratorWithSetup:()=>Zi,IterableReadableStream:()=>br,atee:()=>Jh,concat:()=>en,pipeGeneratorWithSetup:()=>m0});var br=class f0 extends ReadableStream{reader;ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let e=await this.reader.read();return e.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}throw e}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(e){let r=e.getReader();return new f0({start(n){return o();function o(){return r.read().then(({done:i,value:s})=>{if(i){n.close();return}return n.enqueue(s),o()})}},cancel(){r.releaseLock()}})}static fromAsyncGenerator(e){return new f0({async pull(r){let{value:n,done:o}=await e.next();o&&r.close(),r.enqueue(n)},async cancel(r){await e.return(r)}})}};function Jh(t,e=2){let r=Array.from({length:e},()=>[]);return r.map(async function*(o){for(;;)if(o.length===0){let i=await t.next();for(let s of r)s.push(i)}else{if(o[0].done)return;yield o.shift().value}})}function en(t,e){if(Array.isArray(t)&&Array.isArray(e))return t.concat(e);if(typeof t=="string"&&typeof e=="string")return t+e;if(typeof t=="number"&&typeof e=="number")return t+e;if("concat"in t&&typeof t.concat=="function")return t.concat(e);if(typeof t=="object"&&typeof e=="object"){let r={...t};for(let[n,o]of Object.entries(e))n in r&&!Array.isArray(r[n])?r[n]=en(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}var Zi=class{generator;setup;config;signal;firstResult;firstResultUsed=!1;constructor(t){this.generator=t.generator,this.config=t.config,this.signal=t.signal??this.config?.signal,this.setup=new Promise((e,r)=>{Lt.runWithConfig(vr(t.config),async()=>{this.firstResult=t.generator.next(),t.startSetup?this.firstResult.then(t.startSetup).then(e,r):this.firstResult.then(n=>e(void 0),r)},!0)})}async next(...t){return this.signal?.throwIfAborted(),this.firstResultUsed?Lt.runWithConfig(vr(this.config),this.signal?async()=>vn(this.generator.next(...t),this.signal):async()=>this.generator.next(...t),!0):(this.firstResultUsed=!0,this.firstResult)}async return(t){return this.generator.return(t)}async throw(t){return this.generator.throw(t)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}};async function m0(t,e,r,n,...o){let i=new Zi({generator:e,startSetup:r,signal:n}),s=await i.setup;return{output:t(i,s,...o),setup:s}}var iV=Object.prototype.hasOwnProperty;function Yh(t,e){return iV.call(t,e)}function Qh(t){if(Array.isArray(t)){let r=new Array(t.length);for(let n=0;n=48&&n<=57){e++;continue}return!1}return!0}function Jo(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function tg(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function Xh(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r_t,_areEquals:()=>Gd,applyOperation:()=>_a,applyPatch:()=>qi,applyReducer:()=>cV,deepClone:()=>sV,getValueByPointer:()=>ng,validate:()=>jR,validator:()=>og});var _t=rg,sV=wr,fu={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){let n=ng(r,this.path);n&&(n=wr(n));let o=_a(r,{op:"remove",path:this.from}).removed;return _a(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=ng(r,this.from);return _a(r,{op:"add",path:this.path,value:wr(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:Gd(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},aV={add:function(t,e,r){return eg(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:fu.move,copy:fu.copy,test:fu.test,_get:fu._get};function ng(t,e){if(e=="")return t;var r={op:"_get",path:e};return _a(t,r),r.value}function _a(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):og(e,0)),e.path===""){let s={newDocument:t};if(e.op==="add")return s.newDocument=e.value,s;if(e.op==="replace")return s.newDocument=e.value,s.removed=t,s;if(e.op==="move"||e.op==="copy")return s.newDocument=ng(t,e.from),e.op==="move"&&(s.removed=t),s;if(e.op==="test"){if(s.test=Gd(t,e.value),s.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return s.newDocument=t,s}else{if(e.op==="remove")return s.removed=t,s.newDocument=null,s;if(e.op==="_get")return e.value=t,s;if(r)throw new _t("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return s}}else{n||(t=wr(t));let a=(e.path||"").split("/"),c=t,u=1,l=a.length,d,f,p;for(typeof r=="function"?p=r:p=og;;){if(f=a[u],f&&f.indexOf("~")!=-1&&(f=tg(f)),o&&(f=="__proto__"||f=="prototype"&&u>0&&a[u-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&d===void 0&&(c[f]===void 0?d=a.slice(0,u).join("/"):u==l-1&&(d=e.path),d!==void 0&&p(e,0,t,d)),u++,Array.isArray(c)){if(f==="-")f=c.length;else{if(r&&!eg(f))throw new _t("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,e,t);eg(f)&&(f=~~f)}if(u>=l){if(r&&e.op==="add"&&f>c.length)throw new _t("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let m=aV[e.op].call(e,c,f,t);if(m.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(u>=l){let m=fu[e.op].call(e,c,f,t);if(m.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(c=c[f],r&&u0)throw new _t('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new _t("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new _t("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&Xh(t.value))throw new _t("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var o=t.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new _t("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==n)throw new _t("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var s={op:"_get",path:t.from,value:void 0},a=jR([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new _t("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new _t("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function jR(t,e,r){try{if(!Array.isArray(t))throw new _t("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)qi(wr(e),wr(t),r||!0);else{r=r||og;for(var n=0;n=0;u--){var l=s[u],d=t[l];if(Yh(e,l)&&!(e[l]===void 0&&d!==void 0&&Array.isArray(e)===!1)){var f=e[l];typeof d=="object"&&d!=null&&typeof f=="object"&&f!=null&&Array.isArray(d)===Array.isArray(f)?DR(d,f,r,n+"/"+Jo(l),o):d!==f&&(a=!0,o&&r.push({op:"test",path:n+"/"+Jo(l),value:wr(d)}),r.push({op:"replace",path:n+"/"+Jo(l),value:wr(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+Jo(l),value:wr(d)}),r.push({op:"remove",path:n+"/"+Jo(l)}),c=!0):(o&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),a=!0)}if(!(!c&&i.length==s.length))for(var u=0;usg,RunLog:()=>ig,RunLogPatch:()=>ho,isLogStreamHandler:()=>_0});var ho=class{ops;constructor(t){this.ops=t.ops??[]}concat(t){let e=this.ops.concat(t.ops),r=qi({},e);return new ig({ops:e,state:r[r.length-1].newDocument})}},ig=class g0 extends ho{state;constructor(e){super(e),this.state=e.state}concat(e){let r=this.ops.concat(e.ops),n=qi(this.state,e.ops);return new g0({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=qi({},e.ops);return new g0({ops:e.ops,state:r[r.length-1].newDocument})}},_0=t=>t.name==="log_stream_tracer";async function LR(t,e){if(e==="original")throw new Error("Do not assign inputs with original schema drop the key for now. When inputs are added to streamLog they should be added with standardized schema for streaming events.");let{inputs:r}=t;if(["retriever","llm","prompt"].includes(t.run_type))return r;if(!(Object.keys(r).length===1&&r?.input===""))return r.input}async function UR(t,e){let{outputs:r}=t;return e==="original"||["retriever","llm","prompt"].includes(t.run_type)?r:r!==void 0&&Object.keys(r).length===1&&r?.output!==void 0?r.output:r}function lV(t){return t!==void 0&&t.message!==void 0}var sg=class extends Un{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;_schemaFormat="original";rootId;keyMapByRunId={};counterMapByRunName={};transformStream;writer;receiveStream;name="log_stream_tracer";lc_prefer_streaming=!0;constructor(t){super({_awaitHandler:!0,...t}),this.autoClose=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this._schemaFormat=t?._schemaFormat??this._schemaFormat,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=br.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){if(t.id===this.rootId)return!1;let e=t.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(t.run_type)),this.includeTags!==void 0&&(r=r||e.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(t.run_type)),this.excludeTags!==void 0&&(r=r&&e.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(t,e){for await(let r of e){if(t!==this.rootId){let n=this.keyMapByRunId[t];n&&await this.writer.write(new ho({ops:[{op:"add",path:`/logs/${n}/streamed_output/-`,value:r}]}))}yield r}}async onRunCreate(t){if(this.rootId===void 0&&(this.rootId=t.id,await this.writer.write(new ho({ops:[{op:"replace",path:"",value:{id:t.id,name:t.name,type:t.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(t))return;this.counterMapByRunName[t.name]===void 0&&(this.counterMapByRunName[t.name]=0),this.counterMapByRunName[t.name]+=1;let e=this.counterMapByRunName[t.name];this.keyMapByRunId[t.id]=e===1?t.name:`${t.name}:${e}`;let r={id:t.id,name:t.name,type:t.run_type,tags:t.tags??[],metadata:t.extra?.metadata??{},start_time:new Date(t.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};this._schemaFormat==="streaming_events"&&(r.inputs=await LR(t,this._schemaFormat)),await this.writer.write(new ho({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[t.id]}`,value:r}]}))}async onRunUpdate(t){try{let e=this.keyMapByRunId[t.id];if(e===void 0)return;let r=[];this._schemaFormat==="streaming_events"&&r.push({op:"replace",path:`/logs/${e}/inputs`,value:await LR(t,this._schemaFormat)}),r.push({op:"add",path:`/logs/${e}/final_output`,value:await UR(t,this._schemaFormat)}),t.end_time!==void 0&&r.push({op:"add",path:`/logs/${e}/end_time`,value:new Date(t.end_time).toISOString()});let n=new ho({ops:r});await this.writer.write(n)}finally{if(t.id===this.rootId){let e=new ho({ops:[{op:"replace",path:"/final_output",value:await UR(t,this._schemaFormat)}]});await this.writer.write(e),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(t,e,r){let n=this.keyMapByRunId[t.id];if(n===void 0)return;let o=t.inputs.messages!==void 0,i;o?lV(r?.chunk)?i=r?.chunk:i=new Dt({id:`run-${t.id}`,content:e}):i=e;let s=new ho({ops:[{op:"add",path:`/logs/${n}/streamed_output_str/-`,value:e},{op:"add",path:`/logs/${n}/streamed_output/-`,value:i}]});await this.writer.write(s)}};var dV={};G(dV,{ChatGenerationChunk:()=>Vi,GenerationChunk:()=>go,RUN_KEY:()=>ya});var ya="__run",go=class FR{text;generationInfo;constructor(e){this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new FR({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},Vi=class BR extends go{message;constructor(e){super(e),this.message=e.message}concat(e){return new BR({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo},message:this.message.concat(e.message)})}};function ag({name:t,serialized:e}){return t!==void 0?t:e?.name!==void 0?e.name:e?.id!==void 0&&Array.isArray(e?.id)?e.id[e.id.length-1]:"Unnamed"}var ZR=t=>t.name==="event_stream_tracer",qR=class extends Un{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;runInfoMap=new Map;tappedPromises=new Map;transformStream;writer;receiveStream;name="event_stream_tracer";lc_prefer_streaming=!0;constructor(t){super({_awaitHandler:!0,...t}),this.autoClose=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=br.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){let e=t.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(t.runType)),this.includeTags!==void 0&&(r=r||e.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(t.runType)),this.excludeTags!==void 0&&(r=r&&e.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(t,e){let r=await e.next();if(r.done)return;let n=this.runInfoMap.get(t);if(n===void 0){yield r.value;return}function o(s,a){return s==="llm"&&typeof a=="string"?new go({text:a}):a}let i=this.tappedPromises.get(t);if(i===void 0){let s;i=new Promise(a=>{s=a}),this.tappedPromises.set(t,i);try{let a={event:`on_${n.runType}_stream`,run_id:t,name:n.name,tags:n.tags,metadata:n.metadata,data:{}};await this.send({...a,data:{chunk:o(n.runType,r.value)}},n),yield r.value;for await(let c of e)n.runType!=="tool"&&n.runType!=="retriever"&&await this.send({...a,data:{chunk:o(n.runType,c)}},n),yield c}finally{s?.()}}else{yield r.value;for await(let s of e)yield s}}async send(t,e){this._includeRun(e)&&await this.writer.write(t)}async sendEndEvent(t,e){let r=this.tappedPromises.get(t.run_id);r!==void 0?r.then(()=>{this.send(t,e)}):await this.send(t,e)}async onLLMStart(t){let e=ag(t),r=t.inputs.messages!==void 0?"chat_model":"llm",n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:r,inputs:t.inputs};this.runInfoMap.set(t.id,n);let o=`on_${r}_start`;await this.send({event:o,data:{input:t.inputs},name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onLLMNewToken(t,e,r){let n=this.runInfoMap.get(t.id),o,i;if(n===void 0)throw new Error(`onLLMNewToken: Run ID ${t.id} not found in run map.`);if(this.runInfoMap.size!==1){if(n.runType==="chat_model")i="on_chat_model_stream",r?.chunk===void 0?o=new Dt({content:e,id:`run-${t.id}`}):o=r.chunk.message;else if(n.runType==="llm")i="on_llm_stream",r?.chunk===void 0?o=new go({text:e}):o=r.chunk;else throw new Error(`Unexpected run type ${n.runType}`);await this.send({event:i,data:{chunk:o},run_id:t.id,name:n.name,tags:n.tags,metadata:n.metadata},n)}}async onLLMEnd(t){let e=this.runInfoMap.get(t.id);this.runInfoMap.delete(t.id);let r;if(e===void 0)throw new Error(`onLLMEnd: Run ID ${t.id} not found in run map.`);let n=t.outputs?.generations,o;if(e.runType==="chat_model"){for(let i of n??[]){if(o!==void 0)break;o=i[0]?.message}r="on_chat_model_end"}else if(e.runType==="llm")o={generations:n?.map(i=>i.map(s=>({text:s.text,generationInfo:s.generationInfo}))),llmOutput:t.outputs?.llmOutput??{}},r="on_llm_end";else throw new Error(`onLLMEnd: Unexpected run type: ${e.runType}`);await this.sendEndEvent({event:r,data:{output:o,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async onChainStart(t){let e=ag(t),r=t.run_type??"chain",n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:t.run_type},o={};t.inputs.input===""&&Object.keys(t.inputs).length===1?(o={},n.inputs={}):t.inputs.input!==void 0?(o.input=t.inputs.input,n.inputs=t.inputs.input):(o.input=t.inputs,n.inputs=t.inputs),this.runInfoMap.set(t.id,n),await this.send({event:`on_${r}_start`,data:o,name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onChainEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onChainEnd: Run ID ${t.id} not found in run map.`);let r=`on_${t.run_type}_end`,n=t.inputs??e.inputs??{},i={output:t.outputs?.output??t.outputs,input:n};n.input&&Object.keys(n).length===1&&(i.input=n.input,e.inputs=n.input),await this.sendEndEvent({event:r,data:i,run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata??{}},e)}async onToolStart(t){let e=ag(t),r={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:"tool",inputs:t.inputs??{}};this.runInfoMap.set(t.id,r),await this.send({event:"on_tool_start",data:{input:t.inputs??{}},name:e,run_id:t.id,tags:t.tags??[],metadata:t.extra?.metadata??{}},r)}async onToolEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onToolEnd: Run ID ${t.id} not found in run map.`);if(e.inputs===void 0)throw new Error(`onToolEnd: Run ID ${t.id} is a tool call, and is expected to have traced inputs.`);let r=t.outputs?.output===void 0?t.outputs:t.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:r,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async onRetrieverStart(t){let e=ag(t),n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:"retriever",inputs:{query:t.inputs.query}};this.runInfoMap.set(t.id,n),await this.send({event:"on_retriever_start",data:{input:{query:t.inputs.query}},name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onRetrieverEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onRetrieverEnd: Run ID ${t.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:t.outputs?.documents??t.outputs,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async handleCustomEvent(t,e,r){let n=this.runInfoMap.get(r);if(n===void 0)throw new Error(`handleCustomEvent: Run ID ${r} not found in run map.`);await this.send({event:"on_custom_event",run_id:r,name:t,tags:n.tags,metadata:n.metadata,data:e},n)}async finish(){let t=[...this.tappedPromises.values()];Promise.all(t).finally(()=>{this.writer.close()})}};var pV=Object.prototype.toString,fV=t=>pV.call(t)==="[object Error]",mV=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function VR(t){if(!(t&&fV(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:mV.has(r)}function hV(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function cg(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(_),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},_=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&_.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function Kd(t,e={}){if(e={...e},hV(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,cg("factor",e.factor,{min:0,allowInfinity:!1}),cg("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),cg("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),cg("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await yV({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var ug=mn(Sh(),1),vV={};G(vV,{AsyncCaller:()=>Xo});var bV=[400,401,402,403,404,405,406,407,409],wV=t=>{if(t.message.startsWith("Cancel")||t.message.startsWith("AbortError")||t.name==="AbortError"||t?.code==="ECONNABORTED")throw t;let e=t?.response?.status??t?.status;if(e&&bV.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},Xo=class{maxConcurrency;maxRetries;onFailedAttempt;queue;constructor(t){this.maxConcurrency=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??6,this.onFailedAttempt=t.onFailedAttempt??wV;let e="default"in ug.default?ug.default.default:ug.default;this.queue=new e({concurrency:this.maxConcurrency})}async call(t,...e){return this.queue.add(()=>Kd(()=>t(...e).catch(r=>{throw r instanceof Error?r:new Error(r)}),{onFailedAttempt:({error:r})=>this.onFailedAttempt?.(r),retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(t,e,...r){if(t.signal){let n;return Promise.race([this.call(e,...r),new Promise((o,i)=>{n=()=>{i(Bi(t.signal))},t.signal?.addEventListener("abort",n)})]).finally(()=>{t.signal&&n&&t.signal.removeEventListener("abort",n)})}return this.call(e,...r)}fetch(...t){return this.call(()=>fetch(...t).then(e=>e.ok?e:Promise.reject(e)))}};var y0=class extends Un{name="RootListenersTracer";rootId;config;argOnStart;argOnEnd;argOnError;constructor({config:t,onStart:e,onEnd:r,onError:n}){super({_awaitHandler:!0}),this.config=t,this.argOnStart=e,this.argOnEnd=r,this.argOnError=n}persistRun(t){return Promise.resolve()}async onRunCreate(t){this.rootId||(this.rootId=t.id,this.argOnStart&&await this.argOnStart(t,this.config))}async onRunUpdate(t){t.id===this.rootId&&(t.error?this.argOnError&&await this.argOnError(t,this.config):this.argOnEnd&&await this.argOnEnd(t,this.config))}};function Hd(t){return t?t.lc_runnable:!1}var KR=class{includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;constructor(t){this.includeNames=t.includeNames,this.includeTypes=t.includeTypes,this.includeTags=t.includeTags,this.excludeNames=t.excludeNames,this.excludeTypes=t.excludeTypes,this.excludeTags=t.excludeTags}includeEvent(t,e){let r=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,n=t.tags??[];return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(e)),this.includeTags!==void 0&&(r=r||n.some(o=>this.includeTags?.includes(o))),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(e)),this.excludeTags!==void 0&&(r=r&&n.every(o=>!this.excludeTags?.includes(o))),r}},HR=t=>btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");var nn={};gi(nn,{$ZodAny:()=>a_,$ZodArray:()=>l_,$ZodAsyncError:()=>Fn,$ZodBase64:()=>Xg,$ZodBase64URL:()=>Yg,$ZodBigInt:()=>cp,$ZodBigIntFormat:()=>n_,$ZodBoolean:()=>ku,$ZodCIDRv4:()=>Wg,$ZodCIDRv6:()=>Jg,$ZodCUID:()=>jg,$ZodCUID2:()=>Dg,$ZodCatch:()=>S_,$ZodCheck:()=>Je,$ZodCheckBigIntFormat:()=>s$,$ZodCheckEndsWith:()=>y$,$ZodCheckGreaterThan:()=>Sg,$ZodCheckIncludes:()=>g$,$ZodCheckLengthEquals:()=>p$,$ZodCheckLessThan:()=>Ig,$ZodCheckLowerCase:()=>m$,$ZodCheckMaxLength:()=>l$,$ZodCheckMaxSize:()=>a$,$ZodCheckMimeType:()=>b$,$ZodCheckMinLength:()=>d$,$ZodCheckMinSize:()=>c$,$ZodCheckMultipleOf:()=>o$,$ZodCheckNumberFormat:()=>i$,$ZodCheckOverwrite:()=>w$,$ZodCheckProperty:()=>v$,$ZodCheckRegex:()=>f$,$ZodCheckSizeEquals:()=>u$,$ZodCheckStartsWith:()=>_$,$ZodCheckStringFormat:()=>Su,$ZodCheckUpperCase:()=>h$,$ZodCodec:()=>Au,$ZodCustom:()=>R_,$ZodCustomStringFormat:()=>t_,$ZodDate:()=>u_,$ZodDefault:()=>w_,$ZodDiscriminatedUnion:()=>d_,$ZodE164:()=>Qg,$ZodEmail:()=>Rg,$ZodEmoji:()=>zg,$ZodEncodeError:()=>Gi,$ZodEnum:()=>g_,$ZodError:()=>np,$ZodFile:()=>y_,$ZodFunction:()=>O_,$ZodGUID:()=>Pg,$ZodIPv4:()=>Gg,$ZodIPv6:()=>Kg,$ZodISODate:()=>Zg,$ZodISODateTime:()=>Bg,$ZodISODuration:()=>Vg,$ZodISOTime:()=>qg,$ZodIntersection:()=>p_,$ZodJWT:()=>e_,$ZodKSUID:()=>Fg,$ZodLazy:()=>C_,$ZodLiteral:()=>__,$ZodMAC:()=>Hg,$ZodMap:()=>m_,$ZodNaN:()=>k_,$ZodNanoID:()=>Mg,$ZodNever:()=>Eu,$ZodNonOptional:()=>$_,$ZodNull:()=>s_,$ZodNullable:()=>b_,$ZodNumber:()=>ap,$ZodNumberFormat:()=>r_,$ZodObject:()=>S$,$ZodObjectJIT:()=>k$,$ZodOptional:()=>xa,$ZodPipe:()=>T_,$ZodPrefault:()=>x_,$ZodPromise:()=>P_,$ZodReadonly:()=>E_,$ZodRealError:()=>Rr,$ZodRecord:()=>f_,$ZodRegistry:()=>Pu,$ZodSet:()=>h_,$ZodString:()=>Yi,$ZodStringFormat:()=>He,$ZodSuccess:()=>I_,$ZodSymbol:()=>o_,$ZodTemplateLiteral:()=>A_,$ZodTransform:()=>v_,$ZodTuple:()=>lp,$ZodType:()=>ye,$ZodULID:()=>Lg,$ZodURL:()=>Ng,$ZodUUID:()=>Cg,$ZodUndefined:()=>i_,$ZodUnion:()=>up,$ZodUnknown:()=>Tu,$ZodVoid:()=>c_,$ZodXID:()=>Ug,$brand:()=>Jd,$constructor:()=>$,$input:()=>D_,$output:()=>j_,Doc:()=>sp,JSONSchema:()=>$z,JSONSchemaGenerator:()=>zp,NEVER:()=>lg,TimePrecision:()=>B_,_any:()=>uy,_array:()=>T$,_base64:()=>Op,_base64url:()=>Pp,_bigint:()=>ry,_boolean:()=>ey,_catch:()=>j5,_check:()=>xz,_cidrv4:()=>Ep,_cidrv6:()=>Ap,_coercedBigint:()=>ny,_coercedBoolean:()=>ty,_coercedDate:()=>py,_coercedNumber:()=>H_,_coercedString:()=>U_,_cuid:()=>wp,_cuid2:()=>xp,_custom:()=>by,_date:()=>dy,_decode:()=>gg,_decodeAsync:()=>yg,_default:()=>N5,_discriminatedUnion:()=>x5,_e164:()=>Cp,_email:()=>mp,_emoji:()=>vp,_encode:()=>hg,_encodeAsync:()=>_g,_endsWith:()=>Bu,_enum:()=>E5,_file:()=>vy,_float32:()=>J_,_float64:()=>X_,_gt:()=>yo,_gte:()=>ir,_guid:()=>Cu,_includes:()=>Uu,_int:()=>W_,_int32:()=>Y_,_int64:()=>oy,_intersection:()=>$5,_ipv4:()=>kp,_ipv6:()=>Tp,_isoDate:()=>q_,_isoDateTime:()=>Z_,_isoDuration:()=>G_,_isoTime:()=>V_,_jwt:()=>Rp,_ksuid:()=>Sp,_lazy:()=>F5,_length:()=>Sa,_literal:()=>O5,_lowercase:()=>Du,_lt:()=>_o,_lte:()=>zr,_mac:()=>F_,_map:()=>k5,_max:()=>zr,_maxLength:()=>Ia,_maxSize:()=>$a,_mime:()=>Zu,_min:()=>ir,_minLength:()=>Qo,_minSize:()=>es,_multipleOf:()=>Qi,_nan:()=>fy,_nanoid:()=>bp,_nativeEnum:()=>A5,_negative:()=>hy,_never:()=>zu,_nonnegative:()=>_y,_nonoptional:()=>z5,_nonpositive:()=>gy,_normalize:()=>qu,_null:()=>cy,_nullable:()=>R5,_number:()=>K_,_optional:()=>C5,_overwrite:()=>Zn,_parse:()=>bu,_parseAsync:()=>wu,_pipe:()=>D5,_positive:()=>my,_promise:()=>B5,_property:()=>yy,_readonly:()=>L5,_record:()=>S5,_refine:()=>wy,_regex:()=>ju,_safeDecode:()=>bg,_safeDecodeAsync:()=>xg,_safeEncode:()=>vg,_safeEncodeAsync:()=>wg,_safeParse:()=>xu,_safeParseAsync:()=>$u,_set:()=>T5,_size:()=>Mu,_slugify:()=>Np,_startsWith:()=>Fu,_string:()=>L_,_stringFormat:()=>ka,_stringbool:()=>Sy,_success:()=>M5,_superRefine:()=>xy,_symbol:()=>sy,_templateLiteral:()=>U5,_toLowerCase:()=>Gu,_toUpperCase:()=>Ku,_transform:()=>P5,_trim:()=>Vu,_tuple:()=>I5,_uint32:()=>Q_,_uint64:()=>iy,_ulid:()=>$p,_undefined:()=>ay,_union:()=>w5,_unknown:()=>Nu,_uppercase:()=>Lu,_url:()=>Ru,_uuid:()=>hp,_uuidv4:()=>gp,_uuidv6:()=>_p,_uuidv7:()=>yp,_void:()=>ly,_xid:()=>Ip,clone:()=>Qe,config:()=>yt,decode:()=>tN,decodeAsync:()=>nN,describe:()=>$y,encode:()=>eN,encodeAsync:()=>rN,flattenError:()=>yu,formatError:()=>vu,globalConfig:()=>Wd,globalRegistry:()=>Ge,isValidBase64:()=>I$,isValidBase64URL:()=>IN,isValidJWT:()=>SN,locales:()=>Ou,meta:()=>Iy,parse:()=>Bn,parseAsync:()=>Yo,prettifyError:()=>mg,regexes:()=>Nr,registry:()=>fp,safeDecode:()=>iN,safeDecodeAsync:()=>aN,safeEncode:()=>oN,safeEncodeAsync:()=>sN,safeParse:()=>ba,safeParseAsync:()=>Iu,toDotPath:()=>QR,toJSONSchema:()=>vo,treeifyError:()=>fg,util:()=>M,version:()=>x$});var lg=Object.freeze({status:"aborted"});function $(t,e,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let u=s.prototype,l=Object.keys(u);for(let d=0;dr?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var Jd=Symbol("zod_brand"),Fn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Gi=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Wd={};function yt(t){return t&&Object.assign(Wd,t),Wd}var M={};gi(M,{BIGINT_FORMAT_RANGES:()=>E0,Class:()=>b0,NUMBER_FORMAT_RANGES:()=>T0,aborted:()=>Xi,allowsEval:()=>$0,assert:()=>kV,assertEqual:()=>xV,assertIs:()=>IV,assertNever:()=>SV,assertNotEqual:()=>$V,assignProp:()=>Hi,base64ToUint8Array:()=>JR,base64urlToUint8Array:()=>ZV,cached:()=>gu,captureStackTrace:()=>pg,cleanEnum:()=>BV,cleanRegex:()=>Qd,clone:()=>Qe,cloneDef:()=>EV,createTransparentProxy:()=>NV,defineLazy:()=>Me,esc:()=>dg,escapeRegex:()=>bn,extend:()=>jV,finalizeIssue:()=>rn,floatSafeRemainder:()=>w0,getElementAtPath:()=>AV,getEnumValues:()=>Yd,getLengthableOrigin:()=>rp,getParsedType:()=>RV,getSizableOrigin:()=>tp,hexToUint8Array:()=>VV,isObject:()=>va,isPlainObject:()=>Ji,issue:()=>_u,joinValues:()=>E,jsonStringifyReplacer:()=>hu,merge:()=>LV,mergeDefs:()=>Wi,normalizeParams:()=>D,nullish:()=>Ki,numKeys:()=>CV,objectClone:()=>TV,omit:()=>MV,optionalKeys:()=>k0,partial:()=>UV,pick:()=>zV,prefixIssues:()=>tn,primitiveTypes:()=>S0,promiseAllObject:()=>OV,propertyKeyTypes:()=>ep,randomString:()=>PV,required:()=>FV,safeExtend:()=>DV,shallowClone:()=>I0,slugify:()=>x0,stringifyPrimitive:()=>j,uint8ArrayToBase64:()=>XR,uint8ArrayToBase64url:()=>qV,uint8ArrayToHex:()=>GV,unwrapMessage:()=>Xd});function xV(t){return t}function $V(t){return t}function IV(t){}function SV(t){throw new Error}function kV(t){}function Yd(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function E(t,e="|"){return t.map(r=>j(r)).join(e)}function hu(t,e){return typeof e=="bigint"?e.toString():e}function gu(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ki(t){return t==null}function Qd(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function w0(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,s=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return s%a/10**i}var WR=Symbol("evaluating");function Me(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==WR)return n===void 0&&(n=WR,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function TV(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Hi(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Wi(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function EV(t){return Wi(t._zod.def)}function AV(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function OV(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i{};function va(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var $0=gu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Ji(t){if(va(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(va(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function I0(t){return Ji(t)?{...t}:Array.isArray(t)?[...t]:t}function CV(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var RV=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},ep=new Set(["string","number","symbol"]),S0=new Set(["string","number","bigint","boolean","symbol","undefined"]);function bn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qe(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function D(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function NV(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function j(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function k0(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var T0={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},E0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zV(t,e){let r=t._zod.def,n=Wi(t._zod.def,{get shape(){let o={};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&(o[i]=r.shape[i])}return Hi(this,"shape",o),o},checks:[]});return Qe(t,n)}function MV(t,e){let r=t._zod.def,n=Wi(t._zod.def,{get shape(){let o={...t._zod.def.shape};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&delete o[i]}return Hi(this,"shape",o),o},checks:[]});return Qe(t,n)}function jV(t,e){if(!Ji(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let o=Wi(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return Hi(this,"shape",i),i},checks:[]});return Qe(t,o)}function DV(t,e){if(!Ji(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return Hi(this,"shape",n),n},checks:t._zod.def.checks};return Qe(t,r)}function LV(t,e){let r=Wi(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return Hi(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Qe(t,r)}function UV(t,e,r){let n=Wi(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=t?new t({type:"optional",innerType:o[s]}):o[s])}else for(let s in o)i[s]=t?new t({type:"optional",innerType:o[s]}):o[s];return Hi(this,"shape",i),i},checks:[]});return Qe(e,n)}function FV(t,e,r){let n=Wi(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new t({type:"nonoptional",innerType:o[s]}))}else for(let s in o)i[s]=new t({type:"nonoptional",innerType:o[s]});return Hi(this,"shape",i),i},checks:[]});return Qe(e,n)}function Xi(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Xd(t){return typeof t=="string"?t:t?.message}function rn(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=Xd(t.inst?._zod.def?.error?.(t))??Xd(e?.error?.(t))??Xd(r.customError?.(t))??Xd(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function tp(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function rp(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function _u(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function BV(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function JR(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;ne.toString(16).padStart(2,"0")).join("")}var b0=class{constructor(...e){}};var YR=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,hu,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},np=$("$ZodError",YR),Rr=$("$ZodError",YR,{Parent:Error});function yu(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function vu(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>n({issues:s}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let s=r,a=0;for(;ar.message){let r={errors:[]},n=(o,i=[])=>{var s,a;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>n({issues:u},c.path));else if(c.code==="invalid_key")n({issues:c.issues},c.path);else if(c.code==="invalid_element")n({issues:c.issues},c.path);else{let u=[...i,...c.path];if(u.length===0){r.errors.push(e(c));continue}let l=r,d=0;for(;dtypeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function mg(t){let e=[],r=[...t.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${QR(n.path)}`);return e.join(` +`)}var bu=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Fn;if(s.issues.length){let a=new(o?.Err??t)(s.issues.map(c=>rn(c,i,yt())));throw pg(a,o?.callee),a}return s.value},Bn=bu(Rr),wu=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(o?.Err??t)(s.issues.map(c=>rn(c,i,yt())));throw pg(a,o?.callee),a}return s.value},Yo=wu(Rr),xu=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Fn;return i.issues.length?{success:!1,error:new(t??np)(i.issues.map(s=>rn(s,o,yt())))}:{success:!0,data:i.value}},ba=xu(Rr),$u=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(s=>rn(s,o,yt())))}:{success:!0,data:i.value}},Iu=$u(Rr),hg=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return bu(t)(e,r,o)},eN=hg(Rr),gg=t=>(e,r,n)=>bu(t)(e,r,n),tN=gg(Rr),_g=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wu(t)(e,r,o)},rN=_g(Rr),yg=t=>async(e,r,n)=>wu(t)(e,r,n),nN=yg(Rr),vg=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return xu(t)(e,r,o)},oN=vg(Rr),bg=t=>(e,r,n)=>xu(t)(e,r,n),iN=bg(Rr),wg=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return $u(t)(e,r,o)},sN=wg(Rr),xg=t=>async(e,r,n)=>$u(t)(e,r,n),aN=xg(Rr);var Nr={};gi(Nr,{base64:()=>q0,base64url:()=>$g,bigint:()=>J0,boolean:()=>Q0,browserEmail:()=>t3,cidrv4:()=>B0,cidrv6:()=>Z0,cuid:()=>A0,cuid2:()=>O0,date:()=>G0,datetime:()=>H0,domain:()=>o3,duration:()=>z0,e164:()=>V0,email:()=>j0,emoji:()=>D0,extendedDuration:()=>HV,guid:()=>M0,hex:()=>i3,hostname:()=>n3,html5Email:()=>YV,idnEmail:()=>e3,integer:()=>X0,ipv4:()=>L0,ipv6:()=>U0,ksuid:()=>R0,lowercase:()=>r$,mac:()=>F0,md5_base64:()=>a3,md5_base64url:()=>c3,md5_hex:()=>s3,nanoid:()=>N0,null:()=>e$,number:()=>Y0,rfc5322Email:()=>QV,sha1_base64:()=>l3,sha1_base64url:()=>d3,sha1_hex:()=>u3,sha256_base64:()=>f3,sha256_base64url:()=>m3,sha256_hex:()=>p3,sha384_base64:()=>g3,sha384_base64url:()=>_3,sha384_hex:()=>h3,sha512_base64:()=>v3,sha512_base64url:()=>b3,sha512_hex:()=>y3,string:()=>W0,time:()=>K0,ulid:()=>P0,undefined:()=>t$,unicodeEmail:()=>cN,uppercase:()=>n$,uuid:()=>wa,uuid4:()=>WV,uuid6:()=>JV,uuid7:()=>XV,xid:()=>C0});var A0=/^[cC][^\s-]{8,}$/,O0=/^[0-9a-z]+$/,P0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,C0=/^[0-9a-vA-V]{20}$/,R0=/^[A-Za-z0-9]{27}$/,N0=/^[a-zA-Z0-9_-]{21}$/,z0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,HV=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,M0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,wa=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,WV=wa(4),JV=wa(6),XV=wa(7),j0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,YV=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,QV=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,cN=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,e3=cN,t3=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,r3="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function D0(){return new RegExp(r3,"u")}var L0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,U0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,F0=t=>{let e=bn(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},B0=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Z0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,q0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$g=/^[A-Za-z0-9_-]*$/,n3=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,o3=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,V0=/^\+(?:[0-9]){6,14}[0-9]$/,uN="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",G0=new RegExp(`^${uN}$`);function lN(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function K0(t){return new RegExp(`^${lN(t)}$`)}function H0(t){let e=lN({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${uN}T(?:${n})$`)}var W0=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},J0=/^-?\d+n?$/,X0=/^-?\d+$/,Y0=/^-?\d+(?:\.\d+)?/,Q0=/^(?:true|false)$/i,e$=/^null$/i;var t$=/^undefined$/i;var r$=/^[^A-Z]*$/,n$=/^[^a-z]*$/,i3=/^[0-9a-fA-F]*$/;function op(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function ip(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var s3=/^[0-9a-fA-F]{32}$/,a3=op(22,"=="),c3=ip(22),u3=/^[0-9a-fA-F]{40}$/,l3=op(27,"="),d3=ip(27),p3=/^[0-9a-fA-F]{64}$/,f3=op(43,"="),m3=ip(43),h3=/^[0-9a-fA-F]{96}$/,g3=op(64,""),_3=ip(64),y3=/^[0-9a-fA-F]{128}$/,v3=op(86,"=="),b3=ip(86);var Je=$("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),pN={number:"number",bigint:"bigint",object:"date"},Ig=$("$ZodCheckLessThan",(t,e)=>{Je.init(t,e);let r=pN[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?n.value<=e.value:n.value{Je.init(t,e);let r=pN[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),o$=$("$ZodCheckMultipleOf",(t,e)=>{Je.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):w0(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),i$=$("$ZodCheckNumberFormat",(t,e)=>{Je.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=T0[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=o,a.maximum=i,r&&(a.pattern=X0)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}ai&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:t})}}),s$=$("$ZodCheckBigIntFormat",(t,e)=>{Je.init(t,e);let[r,n]=E0[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;in&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inst:t})}}),a$=$("$ZodCheckMaxSize",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=n.value;o.size<=e.maximum||n.issues.push({origin:tp(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),c$=$("$ZodCheckMinSize",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:tp(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),u$=$("$ZodCheckSizeEquals",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let s=i>e.size;n.issues.push({origin:tp(o),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),l$=$("$ZodCheckMaxLength",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=n.value;if(o.length<=e.maximum)return;let s=rp(o);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),d$=$("$ZodCheckMinLength",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let s=rp(o);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),p$=$("$ZodCheckLengthEquals",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let s=rp(o),a=i>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Su=$("$ZodCheckStringFormat",(t,e)=>{var r,n;Je.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),f$=$("$ZodCheckRegex",(t,e)=>{Su.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),m$=$("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=r$),Su.init(t,e)}),h$=$("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=n$),Su.init(t,e)}),g$=$("$ZodCheckIncludes",(t,e)=>{Je.init(t,e);let r=bn(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),_$=$("$ZodCheckStartsWith",(t,e)=>{Je.init(t,e);let r=new RegExp(`^${bn(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),y$=$("$ZodCheckEndsWith",(t,e)=>{Je.init(t,e);let r=new RegExp(`.*${bn(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function dN(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues))}var v$=$("$ZodCheckProperty",(t,e)=>{Je.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>dN(o,r,e.property));dN(n,r,e.property)}}),b$=$("$ZodCheckMimeType",(t,e)=>{Je.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),w$=$("$ZodCheckOverwrite",(t,e)=>{Je.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var sp=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(` +`).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,o.join(` +`))}};var x$={major:4,minor:1,patch:13};var ye=$("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=x$;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(s,a,c)=>{let u=Xi(s),l;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(u)continue;let f=s.issues.length,p=d._zod.check(s);if(p instanceof Promise&&c?.async===!1)throw new Fn;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,s.issues.length!==f&&(u||(u=Xi(s,f)))});else{if(s.issues.length===f)continue;u||(u=Xi(s,f))}}return l?l.then(()=>s):s},i=(s,a,c)=>{if(Xi(s))return s.aborted=!0,s;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new Fn;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let u=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,s,a)):i(u,s,a)}let c=t._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Fn;return c.then(u=>o(u,n,a))}return o(c,n,a)}}t["~standard"]={validate:o=>{try{let i=ba(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Iu(t,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),Yi=$("$ZodString",(t,e)=>{ye.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??W0(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),He=$("$ZodStringFormat",(t,e)=>{Su.init(t,e),Yi.init(t,e)}),Pg=$("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=M0),He.init(t,e)}),Cg=$("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=wa(n))}else e.pattern??(e.pattern=wa());He.init(t,e)}),Rg=$("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=j0),He.init(t,e)}),Ng=$("$ZodURL",(t,e)=>{He.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),zg=$("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=D0()),He.init(t,e)}),Mg=$("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=N0),He.init(t,e)}),jg=$("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=A0),He.init(t,e)}),Dg=$("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=O0),He.init(t,e)}),Lg=$("$ZodULID",(t,e)=>{e.pattern??(e.pattern=P0),He.init(t,e)}),Ug=$("$ZodXID",(t,e)=>{e.pattern??(e.pattern=C0),He.init(t,e)}),Fg=$("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=R0),He.init(t,e)}),Bg=$("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=H0(e)),He.init(t,e)}),Zg=$("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=G0),He.init(t,e)}),qg=$("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=K0(e)),He.init(t,e)}),Vg=$("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=z0),He.init(t,e)}),Gg=$("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=L0),He.init(t,e),t._zod.bag.format="ipv4"}),Kg=$("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=U0),He.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Hg=$("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=F0(e.delimiter)),He.init(t,e),t._zod.bag.format="mac"}),Wg=$("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=B0),He.init(t,e)}),Jg=$("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Z0),He.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function I$(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Xg=$("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=q0),He.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{I$(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function IN(t){if(!$g.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return I$(r)}var Yg=$("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=$g),He.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{IN(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Qg=$("$ZodE164",(t,e)=>{e.pattern??(e.pattern=V0),He.init(t,e)});function SN(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var e_=$("$ZodJWT",(t,e)=>{He.init(t,e),t._zod.check=r=>{SN(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),t_=$("$ZodCustomStringFormat",(t,e)=>{He.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),ap=$("$ZodNumber",(t,e)=>{ye.init(t,e),t._zod.pattern=t._zod.bag.pattern??Y0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),r_=$("$ZodNumberFormat",(t,e)=>{i$.init(t,e),ap.init(t,e)}),ku=$("$ZodBoolean",(t,e)=>{ye.init(t,e),t._zod.pattern=Q0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),cp=$("$ZodBigInt",(t,e)=>{ye.init(t,e),t._zod.pattern=J0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),n_=$("$ZodBigIntFormat",(t,e)=>{s$.init(t,e),cp.init(t,e)}),o_=$("$ZodSymbol",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),i_=$("$ZodUndefined",(t,e)=>{ye.init(t,e),t._zod.pattern=t$,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),s_=$("$ZodNull",(t,e)=>{ye.init(t,e),t._zod.pattern=e$,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),a_=$("$ZodAny",(t,e)=>{ye.init(t,e),t._zod.parse=r=>r}),Tu=$("$ZodUnknown",(t,e)=>{ye.init(t,e),t._zod.parse=r=>r}),Eu=$("$ZodNever",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),c_=$("$ZodVoid",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),u_=$("$ZodDate",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});function mN(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues)),e.value[r]=t.value}var l_=$("$ZodArray",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let s=0;smN(u,r,s))):mN(c,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function Og(t,e,r,n){t.issues.length&&e.issues.push(...tn(r,t.issues)),t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function kN(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=k0(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function TN(t,e,r,n,o,i){let s=[],a=o.keySet,c=o.catchall._zod,u=c.def.type;for(let l in e){if(a.has(l))continue;if(u==="never"){s.push(l);continue}let d=c.run({value:e[l],issues:[]},n);d instanceof Promise?t.push(d.then(f=>Og(f,r,l,e))):Og(d,r,l,e)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var S$=$("$ZodObject",(t,e)=>{if(ye.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=gu(()=>kN(e));Me(t._zod,"propValues",()=>{let a=e.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=va,i=e.catchall,s;t._zod.parse=(a,c)=>{s??(s=n.value);let u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),a;a.value={};let l=[],d=s.shape;for(let f of s.keys){let m=d[f]._zod.run({value:u[f],issues:[]},c);m instanceof Promise?l.push(m.then(h=>Og(h,a,f,u))):Og(m,a,f,u)}return i?TN(l,u,a,c,n.value,t):l.length?Promise.all(l).then(()=>a):a}}),k$=$("$ZodObjectJIT",(t,e)=>{S$.init(t,e);let r=t._zod.parse,n=gu(()=>kN(e)),o=f=>{let p=new sp(["shape","payload","ctx"]),m=n.value,h=x=>{let k=dg(x);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};p.write("const input = payload.value;");let _=Object.create(null),v=0;for(let x of m.keys)_[x]=`key_${v++}`;p.write("const newResult = {};");for(let x of m.keys){let k=_[x],T=dg(x);p.write(`const ${k} = ${h(x)};`),p.write(` + if (${k}.issues.length) { + payload.issues = payload.issues.concat(${k}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${T}, ...iss.path] : [${T}] + }))); + } + + + if (${k}.value === undefined) { + if (${T} in input) { + newResult[${T}] = undefined; + } + } else { + newResult[${T}] = ${k}.value; + } + + `)}p.write("payload.value = newResult;"),p.write("return payload;");let b=p.compile();return(x,k)=>b(f,x,k)},i,s=va,a=!Wd.jitless,u=a&&$0.value,l=e.catchall,d;t._zod.parse=(f,p)=>{d??(d=n.value);let m=f.value;return s(m)?a&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(e.shape)),f=i(f,p),l?TN([],m,f,p,d,t):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function hN(t,e,r,n){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let o=t.filter(i=>!Xi(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(s=>rn(s,n,yt())))}),e)}var up=$("$ZodUnion",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Me(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Me(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),Me(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Qd(i.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1,a=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}return s?Promise.all(a).then(c=>hN(c,o,t,i)):hN(a,o,t,i)}}),d_=$("$ZodDiscriminatedUnion",(t,e)=>{up.init(t,e);let r=t._zod.parse;Me(t._zod,"propValues",()=>{let o={};for(let i of e.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=gu(()=>{let o=e.options,i=new Map;for(let s of o){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});t._zod.parse=(o,i)=>{let s=o.value;if(!va(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),o;let a=n.value.get(s?.[e.discriminator]);return a?a._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:s,path:[e.discriminator],inst:t}),o)}}),p_=$("$ZodIntersection",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),s=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>gN(r,c,u)):gN(r,i,s)}});function $$(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Ji(t)&&Ji(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let s=$$(t[i],e[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n{ye.init(t,e);let r=e.items;t._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let s=[],a=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=a===-1?0:r.length-a;if(!e.rest){let l=i.length>r.length,d=i.length=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?s.push(d.then(f=>kg(f,n,u))):kg(d,n,u)}if(e.rest){let l=i.slice(r.length);for(let d of l){u++;let f=e.rest._zod.run({value:d,issues:[]},o);f instanceof Promise?s.push(f.then(p=>kg(p,n,u))):kg(f,n,u)}}return s.length?Promise.all(s).then(()=>n):n}});function kg(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues)),e.value[r]=t.value}var f_=$("$ZodRecord",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Ji(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...tn(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...tn(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let c=e.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(l=>rn(l,n,yt())),input:a,path:[a],inst:t}),r.value[c.value]=c.value;continue}let u=e.valueType._zod.run({value:o[a],issues:[]},n);u instanceof Promise?i.push(u.then(l=>{l.issues.length&&r.issues.push(...tn(a,l.issues)),r.value[c.value]=l.value})):(u.issues.length&&r.issues.push(...tn(a,u.issues)),r.value[c.value]=u.value)}}return i.length?Promise.all(i).then(()=>r):r}}),m_=$("$ZodMap",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[s,a]of o){let c=e.keyType._zod.run({value:s,issues:[]},n),u=e.valueType._zod.run({value:a,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{_N(l,d,r,s,o,t,n)})):_N(c,u,r,s,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});function _N(t,e,r,n,o,i,s){t.issues.length&&(ep.has(typeof n)?r.issues.push(...tn(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(a=>rn(a,s,yt()))})),e.issues.length&&(ep.has(typeof n)?r.issues.push(...tn(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(a=>rn(a,s,yt()))})),r.value.set(t.value,e.value)}var h_=$("$ZodSet",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of o){let a=e.valueType._zod.run({value:s,issues:[]},n);a instanceof Promise?i.push(a.then(c=>yN(c,r))):yN(a,r)}return i.length?Promise.all(i).then(()=>r):r}});function yN(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var g_=$("$ZodEnum",(t,e)=>{ye.init(t,e);let r=Yd(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>ep.has(typeof o)).map(o=>typeof o=="string"?bn(o):o.toString()).join("|")})$`),t._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:t}),o}}),__=$("$ZodLiteral",(t,e)=>{if(ye.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?bn(n):n?bn(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),y_=$("$ZodFile",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),v_=$("$ZodTransform",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new Fn;return r.value=o,r}});function vN(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var xa=$("$ZodOptional",(t,e)=>{ye.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Me(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Me(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qd(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>vN(i,r.value)):vN(o,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),b_=$("$ZodNullable",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.innerType._zod.optin),Me(t._zod,"optout",()=>e.innerType._zod.optout),Me(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qd(r.source)}|null)$`):void 0}),Me(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),w_=$("$ZodDefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>bN(i,e)):bN(o,e)}});function bN(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var x_=$("$ZodPrefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),$_=$("$ZodNonOptional",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>wN(i,t)):wN(o,t)}});function wN(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var I_=$("$ZodSuccess",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi("ZodSuccess");let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),S_=$("$ZodCatch",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.innerType._zod.optin),Me(t._zod,"optout",()=>e.innerType._zod.optout),Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(s=>rn(s,n,yt()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>rn(i,n,yt()))},input:r.value}),r.issues=[]),r)}}),k_=$("$ZodNaN",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),T_=$("$ZodPipe",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>e.in._zod.values),Me(t._zod,"optin",()=>e.in._zod.optin),Me(t._zod,"optout",()=>e.out._zod.optout),Me(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Tg(s,e.in,n)):Tg(i,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Tg(i,e.out,n)):Tg(o,e.out,n)}});function Tg(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var Au=$("$ZodCodec",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>e.in._zod.values),Me(t._zod,"optin",()=>e.in._zod.optin),Me(t._zod,"optout",()=>e.out._zod.optout),Me(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(s=>Eg(s,e,n)):Eg(i,e,n)}else{let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Eg(s,e,n)):Eg(i,e,n)}}});function Eg(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(i=>Ag(t,i,e.out,r)):Ag(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(i=>Ag(t,i,e.in,r)):Ag(t,o,e.in,r)}}function Ag(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}var E_=$("$ZodReadonly",(t,e)=>{ye.init(t,e),Me(t._zod,"propValues",()=>e.innerType._zod.propValues),Me(t._zod,"values",()=>e.innerType._zod.values),Me(t._zod,"optin",()=>e.innerType?._zod?.optin),Me(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(xN):xN(o)}});function xN(t){return t.value=Object.freeze(t.value),t}var A_=$("$ZodTemplateLiteral",(t,e)=>{ye.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,s=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,s))}else if(n===null||S0.has(typeof n))r.push(bn(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"template_literal",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),O_=$("$ZodFunction",(t,e)=>(ye.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=t._def.input?Bn(t._def.input,n):n,i=Reflect.apply(r,this,o);return t._def.output?Bn(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=t._def.input?await Yo(t._def.input,n):n,i=await Reflect.apply(r,this,o);return t._def.output?await Yo(t._def.output,i):i}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new lp({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),P_=$("$ZodPromise",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),C_=$("$ZodLazy",(t,e)=>{ye.init(t,e),Me(t._zod,"innerType",()=>e.getter()),Me(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),Me(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),Me(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),Me(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),R_=$("$ZodCustom",(t,e)=>{Je.init(t,e),ye.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>$N(i,r,n,t));$N(o,r,n,t)}});function $N(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(_u(o))}}var Ou={};gi(Ou,{ar:()=>EN,az:()=>AN,be:()=>PN,bg:()=>CN,ca:()=>RN,cs:()=>NN,da:()=>zN,de:()=>MN,en:()=>N_,eo:()=>jN,es:()=>DN,fa:()=>LN,fi:()=>UN,fr:()=>FN,frCA:()=>BN,he:()=>ZN,hu:()=>qN,id:()=>VN,is:()=>GN,it:()=>KN,ja:()=>HN,ka:()=>WN,kh:()=>JN,km:()=>z_,ko:()=>XN,lt:()=>QN,mk:()=>ez,ms:()=>tz,nl:()=>rz,no:()=>nz,ota:()=>oz,pl:()=>sz,ps:()=>iz,pt:()=>az,ru:()=>uz,sl:()=>lz,sv:()=>dz,ta:()=>pz,th:()=>fz,tr:()=>mz,ua:()=>hz,uk:()=>M_,ur:()=>gz,vi:()=>_z,yo:()=>bz,zhCN:()=>yz,zhTW:()=>vz});var x3=()=>{let t={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return o=>{switch(o.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${j(o.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${o.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${n[i.format]??o.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${o.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${o.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${o.keys.length>1?"\u0629":""}: ${E(o.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function EN(){return{localeError:x3()}}var $3=()=>{let t={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o.expected}, daxil olan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${j(o.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${n[i.format]??o.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${o.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${o.keys.length>1?"lar":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${o.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function AN(){return{localeError:$3()}}function ON(t,e,r,n){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?n:i===1?e:i>=2&&i<=4?r:n}var I3=()=>{let t={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0456\u045E";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${j(o.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),c=ON(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${o.maximum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),c=ON(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${o.minimum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${o.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${o.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function PN(){return{localeError:I3()}}var S3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(t))return"\u043C\u0430\u0441\u0438\u0432";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},k3=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function e(n){return t[n]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"};return n=>{switch(n.code){case"invalid_type":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${S3(n.input)}`;case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${j(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.maximum.toString()} ${i.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.minimum.toString()} ${i.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;if(o.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${o.prefix}"`;if(o.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${o.suffix}"`;if(o.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${o.includes}"`;if(o.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${o.pattern}`;let i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return o.format==="emoji"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="datetime"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="date"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),o.format==="time"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="duration"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${i} ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${E(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function CN(){return{localeError:k3()}}var T3=()=>{let t={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${o.expected}, s'ha rebut ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Valor inv\xE0lid: s'esperava ${j(o.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${E(o.values," o ")}`;case"too_big":{let i=o.inclusive?"com a m\xE0xim":"menys de",s=e(o.origin);return s?`Massa gran: s'esperava que ${o.origin??"el valor"} contingu\xE9s ${i} ${o.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${o.origin??"el valor"} fos ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"com a m\xEDnim":"m\xE9s de",s=e(o.origin);return s?`Massa petit: s'esperava que ${o.origin} contingu\xE9s ${i} ${o.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${o.origin} fos ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${n[i.format]??o.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${o.divisor}`;case"unrecognized_keys":return`Clau${o.keys.length>1?"s":""} no reconeguda${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${o.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${o.origin}`;default:return"Entrada inv\xE0lida"}}};function RN(){return{localeError:T3()}}var E3=()=>{let t={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(o))return"pole";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return o=>{switch(o.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o.expected}, obdr\u017Eeno ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${j(o.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${n[i.format]??o.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${o.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${E(o.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${o.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${o.origin}`;default:return"Neplatn\xFD vstup"}}};function NN(){return{localeError:E3()}}var A3=()=>{let t={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},e={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};function r(s){return t[s]??null}function n(s){return e[s]??s}let o=s=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"tal";case"object":return Array.isArray(s)?"liste":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype&&s.constructor?s.constructor.name:"objekt"}return a},i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return s=>{switch(s.code){case"invalid_type":return`Ugyldigt input: forventede ${n(s.expected)}, fik ${n(o(s.input))}`;case"invalid_value":return s.values.length===1?`Ugyldig v\xE6rdi: forventede ${j(s.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${E(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=r(s.origin),u=n(s.origin);return c?`For stor: forventede ${u??"value"} ${c.verb} ${a} ${s.maximum.toString()} ${c.unit??"elementer"}`:`For stor: forventede ${u??"value"} havde ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=r(s.origin),u=n(s.origin);return c?`For lille: forventede ${u} ${c.verb} ${a} ${s.minimum.toString()} ${c.unit}`:`For lille: forventede ${u} havde ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Ugyldig streng: skal starte med "${a.prefix}"`:a.format==="ends_with"?`Ugyldig streng: skal ende med "${a.suffix}"`:a.format==="includes"?`Ugyldig streng: skal indeholde "${a.includes}"`:a.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${a.pattern}`:`Ugyldig ${i[a.format]??s.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${s.divisor}`;case"unrecognized_keys":return`${s.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${E(s.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${s.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${s.origin}`;default:return"Ugyldigt input"}}};function zN(){return{localeError:A3()}}var O3=()=>{let t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"Zahl";case"object":{if(Array.isArray(o))return"Array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return o=>{switch(o.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${o.expected}, erhalten ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ung\xFCltige Eingabe: erwartet ${j(o.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ist`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ist`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${o.divisor} sein`;case"unrecognized_keys":return`${o.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${o.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${o.origin}`;default:return"Ung\xFCltige Eingabe"}}};function MN(){return{localeError:O3()}}var P3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},C3=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${P3(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${j(n.values[0])}`:`Invalid option: expected one of ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function N_(){return{localeError:C3()}}var R3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"nombro";case"object":{if(Array.isArray(t))return"tabelo";if(t===null)return"senvalora";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},N3=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(n){return t[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return n=>{switch(n.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${n.expected}, ricevi\u011Dis ${R3(n.input)}`;case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${j(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()} ${i.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${o}${n.minimum.toString()} ${i.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${r[o.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function jN(){return{localeError:N3()}}var z3=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},e={string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};function r(s){return t[s]??null}function n(s){return e[s]??s}let o=s=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"number";case"object":return Array.isArray(s)?"array":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype?s.constructor.name:"object"}return a},i={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return s=>{switch(s.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${n(s.expected)}, recibido ${n(o(s.input))}`;case"invalid_value":return s.values.length===1?`Entrada inv\xE1lida: se esperaba ${j(s.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${E(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=r(s.origin),u=n(s.origin);return c?`Demasiado grande: se esperaba que ${u??"valor"} tuviera ${a}${s.maximum.toString()} ${c.unit??"elementos"}`:`Demasiado grande: se esperaba que ${u??"valor"} fuera ${a}${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=r(s.origin),u=n(s.origin);return c?`Demasiado peque\xF1o: se esperaba que ${u} tuviera ${a}${s.minimum.toString()} ${c.unit}`:`Demasiado peque\xF1o: se esperaba que ${u} fuera ${a}${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${a.prefix}"`:a.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${a.suffix}"`:a.format==="includes"?`Cadena inv\xE1lida: debe incluir "${a.includes}"`:a.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${a.pattern}`:`Inv\xE1lido ${i[a.format]??s.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${s.divisor}`;case"unrecognized_keys":return`Llave${s.keys.length>1?"s":""} desconocida${s.keys.length>1?"s":""}: ${E(s.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${n(s.origin)}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${n(s.origin)}`;default:return"Entrada inv\xE1lida"}}};function DN(){return{localeError:z3()}}var M3=()=>{let t={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0622\u0631\u0627\u06CC\u0647";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return o=>{switch(o.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${r(o.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":return o.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${j(o.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${E(o.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${n[i.format]??o.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${o.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${o.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${E(o.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${o.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${o.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function LN(){return{localeError:M3()}}var j3=()=>{let t={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return o=>{switch(o.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${o.expected}, oli ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${j(o.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${i}${o.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${i}${o.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${n[i.format]??o.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${o.divisor} monikerta`;case"unrecognized_keys":return`${o.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${E(o.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function UN(){return{localeError:j3()}}var D3=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombre";case"object":{if(Array.isArray(o))return"tableau";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : ${o.expected} attendu, ${r(o.input)} re\xE7u`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : ${j(o.values[0])} attendu`:`Option invalide : une valeur parmi ${E(o.values,"|")} attendue`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Trop grand : ${o.origin??"valeur"} doit ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o.origin??"valeur"} doit \xEAtre ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Trop petit : ${o.origin} doit ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Trop petit : ${o.origin} doit \xEAtre ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${E(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function FN(){return{localeError:D3()}}var L3=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${o.expected}, re\xE7u ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : attendu ${j(o.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u2264":"<",s=e(o.origin);return s?`Trop grand : attendu que ${o.origin??"la valeur"} ait ${i}${o.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${o.origin??"la valeur"} soit ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u2265":">",s=e(o.origin);return s?`Trop petit : attendu que ${o.origin} ait ${i}${o.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${o.origin} soit ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${E(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function BN(){return{localeError:L3()}}var U3=()=>{let t={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},e={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=u=>u?t[u]:void 0,n=u=>{let l=r(u);return l?l.label:u??t.unknown.label},o=u=>`\u05D4${n(u)}`,i=u=>(r(u)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",s=u=>u?e[u]??null:null,a=u=>{let l=typeof u;switch(l){case"number":return Number.isNaN(u)?"NaN":"number";case"object":return Array.isArray(u)?"array":u===null?"null":Object.getPrototypeOf(u)!==Object.prototype&&u.constructor?u.constructor.name:"object";default:return l}},c={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}};return u=>{switch(u.code){case"invalid_type":{let l=u.expected,d=n(l),f=a(u.input),p=t[f]?.label??f;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`}case"invalid_value":{if(u.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${j(u.values[0])}`;let l=u.values.map(p=>j(p));if(u.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l[0]} \u05D0\u05D5 ${l[1]}`;let d=l[l.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let l=s(u.origin),d=o(u.origin??"value");if(u.origin==="string")return`${l?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${u.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=u.inclusive?`${u.maximum} ${l?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${l?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?"<=":"<",p=i(u.origin??"value");return l?.unit?`${l.longLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()} ${l.unit}`:`${l?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()}`}case"too_small":{let l=s(u.origin),d=o(u.origin??"value");if(u.origin==="string")return`${l?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${u.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let _=(u.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${_}`}let h=u.inclusive?`${u.minimum} ${l?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${l?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?">=":">",p=i(u.origin??"value");return l?.unit?`${l.shortLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()} ${l.unit}`:`${l?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()}`}case"invalid_format":{let l=u;if(l.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${l.prefix}"`;if(l.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${l.suffix}"`;if(l.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${l.includes}"`;if(l.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${l.pattern}`;let d=c[l.format],f=d?.label??l.format,m=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${f} \u05DC\u05D0 ${m}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${u.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${u.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${u.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${E(u.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${o(u.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function ZN(){return{localeError:U3()}}var F3=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(o))return"t\xF6mb";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return o=>{switch(o.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o.expected}, a kapott \xE9rt\xE9k ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${j(o.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`T\xFAl nagy: ${o.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${o.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${o.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} m\xE9rete t\xFAl kicsi ${i}${o.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} t\xFAl kicsi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${n[i.format]??o.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${o.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${o.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${o.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function qN(){return{localeError:F3()}}var B3=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak valid: diharapkan ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak valid: diharapkan ${j(o.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: diharapkan ${o.origin??"value"} memiliki ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${o.origin??"value"} menjadi ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: diharapkan ${o.origin} memiliki ${i}${o.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${o.origin} menjadi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${n[i.format]??o.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${o.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${o.origin}`;default:return"Input tidak valid"}}};function VN(){return{localeError:B3()}}var Z3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"n\xFAmer";case"object":{if(Array.isArray(t))return"fylki";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},q3=()=>{let t={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function e(n){return t[n]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"};return n=>{switch(n.code){case"invalid_type":return`Rangt gildi: \xDE\xFA sl\xF3st inn ${Z3(n.input)} \xFEar sem \xE1 a\xF0 vera ${n.expected}`;case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${j(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${o}${n.maximum.toString()} ${i.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${o}${n.minimum.toString()} ${i.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${o.prefix}"`:o.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${o.suffix}"`:o.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${o.includes}"`:o.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${o.pattern}`:`Rangt ${r[o.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${E(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}};function GN(){return{localeError:q3()}}var V3=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numero";case"object":{if(Array.isArray(o))return"vettore";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input non valido: atteso ${o.expected}, ricevuto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input non valido: atteso ${j(o.values[0])}`:`Opzione non valida: atteso uno tra ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Troppo grande: ${o.origin??"valore"} deve avere ${i}${o.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${o.origin??"valore"} deve essere ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Troppo piccolo: ${o.origin} deve avere ${i}${o.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${o.origin} deve essere ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${o.divisor}`;case"unrecognized_keys":return`Chiav${o.keys.length>1?"i":"e"} non riconosciut${o.keys.length>1?"e":"a"}: ${E(o.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${o.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${o.origin}`;default:return"Input non valido"}}};function KN(){return{localeError:V3()}}var G3=()=>{let t={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(o))return"\u914D\u5217";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${o.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${r(o.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":return o.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${j(o.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${E(o.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=o.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=e(o.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${s.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=o.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=e(o.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${s.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${o.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${o.keys.length>1?"\u7FA4":""}: ${E(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function HN(){return{localeError:G3()}}var K3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8";case"object":{if(Array.isArray(t))return"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return{string:"\u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0"}[e]??e},H3=()=>{let t={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function e(n){return t[n]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",json_string:"JSON \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"};return n=>{switch(n.code){case"invalid_type":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${K3(n.input)}`;case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${j(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${E(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${i.verb} ${o}${n.maximum.toString()} ${i.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${i.verb} ${o}${n.minimum.toString()} ${i.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.prefix}"-\u10D8\u10D7`:o.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.suffix}"-\u10D8\u10D7`:o.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${o.includes}"-\u10E1`:o.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${o.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${E(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function WN(){return{localeError:H3()}}var W3=()=>{let t={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(o))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(o===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return o=>{switch(o.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${j(o.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${o.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${E(o.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function z_(){return{localeError:W3()}}function JN(){return z_()}var J3=()=>{let t={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return o=>{switch(o.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${r(o.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":return o.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${j(o.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${E(o.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=o.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),c=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()}${c} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()} ${i}${s}`}case"too_small":{let i=o.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),c=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()}${c} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${n[i.format]??o.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${o.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${E(o.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${o.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${o.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function XN(){return{localeError:J3()}}var X3=t=>pp(typeof t,t),pp=(t,e=void 0)=>{switch(t){case"number":return Number.isNaN(e)?"NaN":"skai\u010Dius";case"bigint":return"sveikasis skai\u010Dius";case"string":return"eilut\u0117";case"boolean":return"login\u0117 reik\u0161m\u0117";case"undefined":case"void":return"neapibr\u0117\u017Eta reik\u0161m\u0117";case"function":return"funkcija";case"symbol":return"simbolis";case"object":return e===void 0?"ne\u017Einomas objektas":e===null?"nulin\u0117 reik\u0161m\u0117":Array.isArray(e)?"masyvas":Object.getPrototypeOf(e)!==Object.prototype&&e.constructor?e.constructor.name:"objektas";case"null":return"nulin\u0117 reik\u0161m\u0117"}return t},dp=t=>t.charAt(0).toUpperCase()+t.slice(1);function YN(t){let e=Math.abs(t),r=e%10,n=e%100;return n>=11&&n<=19||r===0?"many":r===1?"one":"few"}var Y3=()=>{let t={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function e(n,o,i,s){let a=t[n]??null;return a===null?a:{unit:a.unit[o],verb:a.verb[s][i?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"};return n=>{switch(n.code){case"invalid_type":return`Gautas tipas ${X3(n.input)}, o tik\u0117tasi - ${pp(n.expected)}`;case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${j(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${E(n.values,"|")} pasirinkim\u0173`;case"too_big":{let o=pp(n.origin),i=e(n.origin,YN(Number(n.maximum)),n.inclusive??!1,"smaller");if(i?.verb)return`${dp(o??n.origin??"reik\u0161m\u0117")} ${i.verb} ${n.maximum.toString()} ${i.unit??"element\u0173"}`;let s=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${dp(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.maximum.toString()} ${i?.unit}`}case"too_small":{let o=pp(n.origin),i=e(n.origin,YN(Number(n.minimum)),n.inclusive??!1,"bigger");if(i?.verb)return`${dp(o??n.origin??"reik\u0161m\u0117")} ${i.verb} ${n.minimum.toString()} ${i.unit??"element\u0173"}`;let s=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${dp(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.minimum.toString()} ${i?.unit}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${o.prefix}"`:o.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${o.includes}"`:o.format==="regex"?`Eilut\u0117 privalo atitikti ${o.pattern}`:`Neteisingas ${r[o.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${E(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let o=pp(n.origin);return`${dp(o??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function QN(){return{localeError:Y3()}}var Q3=()=>{let t={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(o))return"\u043D\u0438\u0437\u0430";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return o=>{switch(o.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${j(o.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${o.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${o.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function ez(){return{localeError:Q3()}}var e5=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombor";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak sah: dijangka ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak sah: dijangka ${j(o.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: dijangka ${o.origin??"nilai"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${o.origin??"nilai"} adalah ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: dijangka ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${o.origin} adalah ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${n[i.format]??o.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${E(o.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${o.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${o.origin}`;default:return"Input tidak sah"}}};function tz(){return{localeError:e5()}}var t5=()=>{let t={string:{unit:"tekens",verb:"te hebben"},file:{unit:"bytes",verb:"te hebben"},array:{unit:"elementen",verb:"te hebben"},set:{unit:"elementen",verb:"te hebben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"getal";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return o=>{switch(o.code){case"invalid_type":return`Ongeldige invoer: verwacht ${o.expected}, ontving ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ongeldige invoer: verwacht ${j(o.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Te groot: verwacht dat ${o.origin??"waarde"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"elementen"}`:`Te groot: verwacht dat ${o.origin??"waarde"} ${i}${o.maximum.toString()} is`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Te klein: verwacht dat ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Te klein: verwacht dat ${o.origin} ${i}${o.minimum.toString()} is`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${o.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${o.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${o.origin}`;default:return"Ongeldige invoer"}}};function rz(){return{localeError:t5()}}var r5=()=>{let t={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"tall";case"object":{if(Array.isArray(o))return"liste";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Ugyldig input: forventet ${o.expected}, fikk ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ugyldig verdi: forventet ${j(o.values[0])}`:`Ugyldig valg: forventet en av ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${n[i.format]??o.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${o.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${o.origin}`;default:return"Ugyldig input"}}};function nz(){return{localeError:r5()}}var n5=()=>{let t={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numara";case"object":{if(Array.isArray(o))return"saf";if(o===null)return"gayb";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return o=>{switch(o.code){case"invalid_type":return`F\xE2sit giren: umulan ${o.expected}, al\u0131nan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`F\xE2sit giren: umulan ${j(o.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=o;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${n[i.format]??o.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${o.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${o.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function oz(){return{localeError:n5()}}var o5=()=>{let t={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0627\u0631\u06D0";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return o=>{switch(o.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${r(o.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":return o.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${j(o.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${E(o.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0648\u064A`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${n[i.format]??o.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${o.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${o.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${o.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${o.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function iz(){return{localeError:o5()}}var i5=()=>{let t={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"liczba";case"object":{if(Array.isArray(o))return"tablica";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return o=>{switch(o.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o.expected}, otrzymano ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${j(o.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${n[i.format]??o.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${o.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${o.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${o.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function sz(){return{localeError:i5()}}var s5=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(o))return"array";if(o===null)return"nulo";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${o.expected}, recebido ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: esperado ${j(o.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Muito grande: esperado que ${o.origin??"valor"} tivesse ${i}${o.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${o.origin??"valor"} fosse ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Muito pequeno: esperado que ${o.origin} tivesse ${i}${o.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${o.origin} fosse ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`:i.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inv\xE1lido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`:`${n[i.format]??o.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${o.divisor}`;case"unrecognized_keys":return`Chave${o.keys.length>1?"s":""} desconhecida${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${o.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${o.origin}`;default:return"Campo inv\xE1lido"}}};function az(){return{localeError:s5()}}function cz(t,e,r,n){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?n:i===1?e:i>=2&&i<=4?r:n}var a5=()=>{let t={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${j(o.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),c=cz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.maximum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),c=cz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.minimum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${o.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0438":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${o.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function uz(){return{localeError:a5()}}var c5=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(o))return"tabela";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return o=>{switch(o.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${o.expected}, prejeto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${j(o.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} imelo ${i}${o.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${o.origin} imelo ${i}${o.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${n[i.format]??o.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${o.divisor}`;case"unrecognized_keys":return`Neprepoznan${o.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${E(o.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${o.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${o.origin}`;default:return"Neveljaven vnos"}}};function lz(){return{localeError:c5()}}var u5=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"antal";case"object":{if(Array.isArray(o))return"lista";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return o=>{switch(o.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${o.expected}, fick ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${j(o.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${n[i.format]??o.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${o.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${o.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function dz(){return{localeError:u5()}}var l5=()=>{let t={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(o))return"\u0B85\u0BA3\u0BBF";if(o===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${j(o.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${E(o.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${o.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${o.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function pz(){return{localeError:l5()}}var d5=()=>{let t={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(o))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(o===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return o=>{switch(o.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${j(o.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=e(o.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=e(o.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${o.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${E(o.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function fz(){return{localeError:d5()}}var p5=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},f5=()=>{let t={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(n){return t[n]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return n=>{switch(n.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${n.expected}, al\u0131nan ${p5(n.input)}`;case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${j(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()} ${i.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()} ${i.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[o.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function mz(){return{localeError:f5()}}var m5=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${j(o.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} \u0431\u0443\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0456":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${o.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function M_(){return{localeError:m5()}}function hz(){return M_()}var h5=()=>{let t={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(o))return"\u0622\u0631\u06D2";if(o===null)return"\u0646\u0644";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return o=>{switch(o.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${r(o.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":return o.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${j(o.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${E(o.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${o.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u06D2 ${i}${o.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u0627 ${i}${o.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${o.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${o.keys.length>1?"\u0632":""}: ${E(o.keys,"\u060C ")}`;case"invalid_key":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function gz(){return{localeError:h5()}}var g5=()=>{let t={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(o))return"m\u1EA3ng";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return o=>{switch(o.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${j(o.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${n[i.format]??o.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${o.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${E(o.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function _z(){return{localeError:g5()}}var _5=()=>{let t={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(o))return"\u6570\u7EC4";if(o===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${j(o.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${n[i.format]??o.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${o.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${o.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function yz(){return{localeError:_5()}}var y5=()=>{let t={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o.expected}\uFF0C\u4F46\u6536\u5230 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${j(o.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${o.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${o.keys.length>1?"\u5011":""}\uFF1A${E(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function vz(){return{localeError:y5()}}var v5=()=>{let t={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\u1ECD\u0301mb\xE0";case"object":{if(Array.isArray(o))return"akop\u1ECD";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"};return o=>{switch(o.code){case"invalid_type":return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${o.expected}, \xE0m\u1ECD\u0300 a r\xED ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${j(o.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin??"iye"} ${s.verb} ${i}${o.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${o.maximum}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin} ${s.verb} ${i}${o.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${o.minimum}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`:i.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`:i.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`:i.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`:`A\u1E63\xEC\u1E63e: ${n[i.format]??o.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${o.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${E(o.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function bz(){return{localeError:v5()}}var wz,j_=Symbol("ZodOutput"),D_=Symbol("ZodInput"),Pu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function fp(){return new Pu}(wz=globalThis).__zod_globalRegistry??(wz.__zod_globalRegistry=fp());var Ge=globalThis.__zod_globalRegistry;function L_(t,e){return new t({type:"string",...D(e)})}function U_(t,e){return new t({type:"string",coerce:!0,...D(e)})}function mp(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...D(e)})}function Cu(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...D(e)})}function hp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...D(e)})}function gp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(e)})}function _p(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(e)})}function yp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(e)})}function Ru(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...D(e)})}function vp(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...D(e)})}function bp(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(e)})}function wp(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...D(e)})}function xp(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(e)})}function $p(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...D(e)})}function Ip(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...D(e)})}function Sp(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(e)})}function kp(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(e)})}function Tp(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(e)})}function F_(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...D(e)})}function Ep(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(e)})}function Ap(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(e)})}function Op(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...D(e)})}function Pp(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...D(e)})}function Cp(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...D(e)})}function Rp(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...D(e)})}var B_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Z_(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(e)})}function q_(t,e){return new t({type:"string",format:"date",check:"string_format",...D(e)})}function V_(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...D(e)})}function G_(t,e){return new t({type:"string",format:"duration",check:"string_format",...D(e)})}function K_(t,e){return new t({type:"number",checks:[],...D(e)})}function H_(t,e){return new t({type:"number",coerce:!0,checks:[],...D(e)})}function W_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...D(e)})}function J_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...D(e)})}function X_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...D(e)})}function Y_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...D(e)})}function Q_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...D(e)})}function ey(t,e){return new t({type:"boolean",...D(e)})}function ty(t,e){return new t({type:"boolean",coerce:!0,...D(e)})}function ry(t,e){return new t({type:"bigint",...D(e)})}function ny(t,e){return new t({type:"bigint",coerce:!0,...D(e)})}function oy(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...D(e)})}function iy(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...D(e)})}function sy(t,e){return new t({type:"symbol",...D(e)})}function ay(t,e){return new t({type:"undefined",...D(e)})}function cy(t,e){return new t({type:"null",...D(e)})}function uy(t){return new t({type:"any"})}function Nu(t){return new t({type:"unknown"})}function zu(t,e){return new t({type:"never",...D(e)})}function ly(t,e){return new t({type:"void",...D(e)})}function dy(t,e){return new t({type:"date",...D(e)})}function py(t,e){return new t({type:"date",coerce:!0,...D(e)})}function fy(t,e){return new t({type:"nan",...D(e)})}function _o(t,e){return new Ig({check:"less_than",...D(e),value:t,inclusive:!1})}function zr(t,e){return new Ig({check:"less_than",...D(e),value:t,inclusive:!0})}function yo(t,e){return new Sg({check:"greater_than",...D(e),value:t,inclusive:!1})}function ir(t,e){return new Sg({check:"greater_than",...D(e),value:t,inclusive:!0})}function my(t){return yo(0,t)}function hy(t){return _o(0,t)}function gy(t){return zr(0,t)}function _y(t){return ir(0,t)}function Qi(t,e){return new o$({check:"multiple_of",...D(e),value:t})}function $a(t,e){return new a$({check:"max_size",...D(e),maximum:t})}function es(t,e){return new c$({check:"min_size",...D(e),minimum:t})}function Mu(t,e){return new u$({check:"size_equals",...D(e),size:t})}function Ia(t,e){return new l$({check:"max_length",...D(e),maximum:t})}function Qo(t,e){return new d$({check:"min_length",...D(e),minimum:t})}function Sa(t,e){return new p$({check:"length_equals",...D(e),length:t})}function ju(t,e){return new f$({check:"string_format",format:"regex",...D(e),pattern:t})}function Du(t){return new m$({check:"string_format",format:"lowercase",...D(t)})}function Lu(t){return new h$({check:"string_format",format:"uppercase",...D(t)})}function Uu(t,e){return new g$({check:"string_format",format:"includes",...D(e),includes:t})}function Fu(t,e){return new _$({check:"string_format",format:"starts_with",...D(e),prefix:t})}function Bu(t,e){return new y$({check:"string_format",format:"ends_with",...D(e),suffix:t})}function yy(t,e,r){return new v$({check:"property",property:t,schema:e,...D(r)})}function Zu(t,e){return new b$({check:"mime_type",mime:t,...D(e)})}function Zn(t){return new w$({check:"overwrite",tx:t})}function qu(t){return Zn(e=>e.normalize(t))}function Vu(){return Zn(t=>t.trim())}function Gu(){return Zn(t=>t.toLowerCase())}function Ku(){return Zn(t=>t.toUpperCase())}function Np(){return Zn(t=>x0(t))}function T$(t,e,r){return new t({type:"array",element:e,...D(r)})}function w5(t,e,r){return new t({type:"union",options:e,...D(r)})}function x5(t,e,r,n){return new t({type:"union",options:r,discriminator:e,...D(n)})}function $5(t,e,r){return new t({type:"intersection",left:e,right:r})}function I5(t,e,r,n){let o=r instanceof ye,i=o?n:r,s=o?r:null;return new t({type:"tuple",items:e,rest:s,...D(i)})}function S5(t,e,r,n){return new t({type:"record",keyType:e,valueType:r,...D(n)})}function k5(t,e,r,n){return new t({type:"map",keyType:e,valueType:r,...D(n)})}function T5(t,e,r){return new t({type:"set",valueType:e,...D(r)})}function E5(t,e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new t({type:"enum",entries:n,...D(r)})}function A5(t,e,r){return new t({type:"enum",entries:e,...D(r)})}function O5(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...D(r)})}function vy(t,e){return new t({type:"file",...D(e)})}function P5(t,e){return new t({type:"transform",transform:e})}function C5(t,e){return new t({type:"optional",innerType:e})}function R5(t,e){return new t({type:"nullable",innerType:e})}function N5(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():I0(r)}})}function z5(t,e,r){return new t({type:"nonoptional",innerType:e,...D(r)})}function M5(t,e){return new t({type:"success",innerType:e})}function j5(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function D5(t,e,r){return new t({type:"pipe",in:e,out:r})}function L5(t,e){return new t({type:"readonly",innerType:e})}function U5(t,e,r){return new t({type:"template_literal",parts:e,...D(r)})}function F5(t,e){return new t({type:"lazy",getter:e})}function B5(t,e){return new t({type:"promise",innerType:e})}function by(t,e,r){let n=D(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function wy(t,e,r){return new t({type:"custom",check:"custom",fn:e,...D(r)})}function xy(t){let e=xz(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(_u(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(_u(o))}},t(r.value,r)));return e}function xz(t,e){let r=new Je({check:"custom",...D(e)});return r._zod.check=t,r}function $y(t){let e=new Je({check:"describe"});return e._zod.onattach=[r=>{let n=Ge.get(r)??{};Ge.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function Iy(t){let e=new Je({check:"meta"});return e._zod.onattach=[r=>{let n=Ge.get(r)??{};Ge.add(r,{...n,...t})}],e._zod.check=()=>{},e}function Sy(t,e){let r=D(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(n),s=new Set(o),a=t.Codec??Au,c=t.Boolean??ku,u=t.String??Yi,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new a({type:"pipe",in:l,out:d,transform:((p,m)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:s.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((p,m)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return f}function ka(t,e,r,n={}){let o=D(n),i={...D(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:a=>r.test(a),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}var zp=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Ge,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},f=e._zod.parent;if(f)a.ref=f,this.process(f,d),this.seen.get(f).isParent=!0;else{let p=a.schema;switch(o.type){case"string":{let m=p;m.type="string";let{minimum:h,maximum:_,format:v,patterns:b,contentEncoding:x}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof _=="number"&&(m.maxLength=_),v&&(m.format=i[v]??v,m.format===""&&delete m.format),x&&(m.contentEncoding=x),b&&b.size>0){let k=[...b];k.length===1?m.pattern=k[0].source:k.length>1&&(a.schema.allOf=[...k.map(T=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:T.source}))])}break}case"number":{let m=p,{minimum:h,maximum:_,format:v,multipleOf:b,exclusiveMaximum:x,exclusiveMinimum:k}=e._zod.bag;typeof v=="string"&&v.includes("int")?m.type="integer":m.type="number",typeof k=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.minimum=k,m.exclusiveMinimum=!0):m.exclusiveMinimum=k),typeof h=="number"&&(m.minimum=h,typeof k=="number"&&this.target!=="draft-4"&&(k>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof x=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.maximum=x,m.exclusiveMaximum=!0):m.exclusiveMaximum=x),typeof _=="number"&&(m.maximum=_,typeof x=="number"&&this.target!=="draft-4"&&(x<=_?delete m.maximum:delete m.exclusiveMaximum)),typeof b=="number"&&(m.multipleOf=b);break}case"boolean":{let m=p;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{this.target==="openapi-3.0"?(p.type="string",p.nullable=!0,p.enum=[null]):p.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{p.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let m=p,{minimum:h,maximum:_}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof _=="number"&&(m.maxItems=_),m.type="array",m.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let m=p;m.type="object",m.properties={};let h=o.shape;for(let b in h)m.properties[b]=this.process(h[b],{...d,path:[...d.path,"properties",b]});let _=new Set(Object.keys(h)),v=new Set([..._].filter(b=>{let x=o.shape[b]._zod;return this.io==="input"?x.optin===void 0:x.optout===void 0}));v.size>0&&(m.required=Array.from(v)),o.catchall?._zod.def.type==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{let m=p,h=o.discriminator!==void 0,_=o.options.map((v,b)=>this.process(v,{...d,path:[...d.path,h?"oneOf":"anyOf",b]}));h?m.oneOf=_:m.anyOf=_;break}case"intersection":{let m=p,h=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),_=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),v=x=>"allOf"in x&&Object.keys(x).length===1,b=[...v(h)?h.allOf:[h],...v(_)?_.allOf:[_]];m.allOf=b;break}case"tuple":{let m=p;m.type="array";let h=this.target==="draft-2020-12"?"prefixItems":"items",_=this.target==="draft-2020-12"||this.target==="openapi-3.0"?"items":"additionalItems",v=o.items.map((T,F)=>this.process(T,{...d,path:[...d.path,h,F]})),b=o.rest?this.process(o.rest,{...d,path:[...d.path,_,...this.target==="openapi-3.0"?[o.items.length]:[]]}):null;this.target==="draft-2020-12"?(m.prefixItems=v,b&&(m.items=b)):this.target==="openapi-3.0"?(m.items={anyOf:v},b&&m.items.anyOf.push(b),m.minItems=v.length,b||(m.maxItems=v.length)):(m.items=v,b&&(m.additionalItems=b));let{minimum:x,maximum:k}=e._zod.bag;typeof x=="number"&&(m.minItems=x),typeof k=="number"&&(m.maxItems=k);break}case"record":{let m=p;m.type="object",(this.target==="draft-7"||this.target==="draft-2020-12")&&(m.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]})),m.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=p,h=Yd(o.entries);h.every(_=>typeof _=="number")&&(m.type="number"),h.every(_=>typeof _=="string")&&(m.type="string"),m.enum=h;break}case"literal":{let m=p,h=[];for(let _ of o.values)if(_===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof _=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(_))}else h.push(_);if(h.length!==0)if(h.length===1){let _=h[0];m.type=_===null?"null":typeof _,this.target==="draft-4"||this.target==="openapi-3.0"?m.enum=[_]:m.const=_}else h.every(_=>typeof _=="number")&&(m.type="number"),h.every(_=>typeof _=="string")&&(m.type="string"),h.every(_=>typeof _=="boolean")&&(m.type="string"),h.every(_=>_===null)&&(m.type="null"),m.enum=h;break}case"file":{let m=p,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:_,maximum:v,mime:b}=e._zod.bag;_!==void 0&&(h.minLength=_),v!==void 0&&(h.maxLength=v),b?b.length===1?(h.contentMediaType=b[0],Object.assign(m,h)):m.anyOf=b.map(x=>({...h,contentMediaType:x})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,d);this.target==="openapi-3.0"?(a.ref=o.innerType,p.nullable=!0):p.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"success":{let m=p;m.type="boolean";break}case"default":{this.process(o.innerType,d),a.ref=o.innerType,p.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),a.ref=o.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),a.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}p.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=p,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,d),a.ref=m;break}case"readonly":{this.process(o.innerType,d),a.ref=o.innerType,p.readOnly=!0;break}case"promise":{this.process(o.innerType,d),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,d),a.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&xr(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let h=n.external.registry.get(l[0])?.id,_=n.external.uri??(b=>b);if(h)return{ref:_(h)};let v=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=v,{defId:v,ref:`${_("__shared")}#/${d}/${v}`}}if(l[1]===o)return{ref:"#"};let p=`#/${d}/`,m=l[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:p+m}},s=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:f,defId:p}=i(l);d.def={...d.schema},p&&(d.defId=p);let m=d.schema;for(let h in m)delete m[h];m.$ref=f};if(n.cycles==="throw")for(let l of this.seen.entries()){let d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/ + +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(e===l[0]){s(l);continue}if(n.external){let p=n.external.registry.get(l[0])?.id;if(e!==l[0]&&p){s(l);continue}}if(this.metadataRegistry.get(l[0])?.id){s(l);continue}if(d.cycle){s(l);continue}if(d.count>1&&n.reused==="ref"){s(l);continue}}let a=(l,d)=>{let f=this.seen.get(l),p=f.def??f.schema,m={...p};if(f.ref===null)return;let h=f.ref;if(f.ref=null,h){a(h,d);let _=this.seen.get(h).schema;_.$ref&&(d.target==="draft-7"||d.target==="draft-4"||d.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(_)):(Object.assign(p,_),Object.assign(p,m))}f.isParent||this.override({zodSchema:l,jsonSchema:p,path:f.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?c.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,o.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let d=l[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function vo(t,e){if(t instanceof Pu){let n=new zp(e),o={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let i={},s={registry:t,uri:e?.uri,defs:o};for(let a of t._idmap.entries()){let[c,u]=a;i[c]=n.emit(u,{...e,external:s})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}let r=new zp(e);return r.process(t),r.emit(t,e)}function xr(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return xr(n.element,r);if(n.type==="set")return xr(n.valueType,r);if(n.type==="lazy")return xr(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return xr(n.innerType,r);if(n.type==="intersection")return xr(n.left,r)||xr(n.right,r);if(n.type==="record"||n.type==="map")return xr(n.keyType,r)||xr(n.valueType,r);if(n.type==="pipe")return xr(n.in,r)||xr(n.out,r);if(n.type==="object"){for(let o in n.shape)if(xr(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(xr(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(xr(o,r))return!0;return!!(n.rest&&xr(n.rest,r))}return!1}var $z={};function nt(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_zod"in e))return!1;let r=e._zod;return typeof r=="object"&&r!==null&&"def"in r}function vt(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_def"in e)||"_zod"in e)return!1;let r=e._def;return typeof r=="object"&&r!=null&&"typeName"in r}function Iz(t){return nt(t)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),vt(t)}function on(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(nt(t)||vt(t))}function E$(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodLiteral"}function A$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="literal":!1}function Sz(t){return!!(E$(t)||A$(t))}async function Ey(t,e){if(nt(t))try{return{success:!0,data:await Yo(t,e)}}catch(r){return{success:!1,error:r}}if(vt(t))return await t.safeParseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function ts(t,e){if(nt(t))return await Yo(t,e);if(vt(t))return await t.parseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function kz(t,e){if(nt(t))try{return{success:!0,data:Bn(t,e)}}catch(r){return{success:!1,error:r}}if(vt(t))return t.safeParse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Tz(t,e){if(nt(t))return Bn(t,e);if(vt(t))return t.parse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function rs(t){if(nt(t))return Ge.get(t)?.description;if(vt(t)||"description"in t&&typeof t.description=="string")return t.description}function Ez(t){if(!on(t))return!1;if(vt(t)){let e=t._def;if(e.typeName==="ZodObject"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.typeName==="ZodRecord")return!0}if(nt(t)){let e=t._zod.def;if(e.type==="object"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.type==="record")return!0}return typeof t=="object"&&t!==null&&!("shape"in t)}function Wu(t){return on(t)?vt(t)?t._def.typeName==="ZodString":nt(t)?t._zod.def.type==="string":!1:!1}function Ay(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodObject"}function wn(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="object":!1}function Mp(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="array":!1}function O$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="optional":!1}function P$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="nullable":!1}function Az(t){return!!(Ay(t)||wn(t))}function ky(t){if(vt(t))return t.shape;if(nt(t))return t._zod.def.shape;throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Oz(t,e){if(vt(t))return t.extend(e);if(nt(t))return M.extend(t,e);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Pz(t){if(vt(t))return t.partial();if(nt(t))return M.partial(xa,t,void 0);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Hu(t,e=!1){if(vt(t))return t.strict();if(wn(t)){let r=t._zod.def.shape;if(e)for(let[i,s]of Object.entries(t._zod.def.shape)){if(wn(s)){let c=Hu(s,e);r[i]=c}else if(Mp(s)){let c=s._zod.def.element;wn(c)&&(c=Hu(c,e)),r[i]=Qe(s,{...s._zod.def,element:c})}else r[i]=s;let a=Ge.get(s);a&&Ge.add(r[i],a)}let n=Qe(t,{...t._zod.def,shape:r,catchall:zu(Eu)}),o=Ge.get(t);return o&&Ge.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Ty(t,e=!1){if(Ay(t))return t.passthrough();if(wn(t)){let r=t._zod.def.shape;if(e)for(let[i,s]of Object.entries(t._zod.def.shape)){if(wn(s)){let c=Ty(s,e);r[i]=c}else if(Mp(s)){let c=s._zod.def.element;wn(c)&&(c=Ty(c,e)),r[i]=Qe(s,{...s._zod.def,element:c})}else r[i]=s;let a=Ge.get(s);a&&Ge.add(r[i],a)}let n=Qe(t,{...t._zod.def,shape:r,catchall:Nu(Tu)}),o=Ge.get(t);return o&&Ge.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Cz(t){if(vt(t))try{let e=t.parse(void 0);return()=>e}catch{return}if(nt(t))try{let e=Bn(t,void 0);return()=>e}catch{return}}function Z5(t){return vt(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function q5(t){return nt(t)&&t._zod.def.type==="pipe"}function Ta(t,e,r){let n=r.get(t);if(n!==void 0)return n;if(vt(t))return Z5(t)?Ta(t._def.schema,e,r):t;if(nt(t)){let o=t;if(q5(t)&&(o=Ta(t._zod.def.in,e,r)),e){if(wn(o)){let s=o._zod.def.shape;for(let[a,c]of Object.entries(o._zod.def.shape))s[a]=Ta(c,e,r);o=Qe(o,{...o._zod.def,shape:s})}else if(Mp(o)){let s=Ta(o._zod.def.element,e,r);o=Qe(o,{...o._zod.def,element:s})}else if(O$(o)){let s=Ta(o._zod.def.innerType,e,r);o=Qe(o,{...o._zod.def,innerType:s})}else if(P$(o)){let s=Ta(o._zod.def.innerType,e,r);o=Qe(o,{...o._zod.def,innerType:s})}}let i=Ge.get(t);return i&&Ge.add(o,i),r.set(t,o),o}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Oy(t,e=!1){return Ta(t,e,new WeakMap)}function Rz(t,e){if(vt(t)){let r=ky(t),n={};for(let[o,i]of Object.entries(r))e(o,i)?n[o]=i.optional():n[o]=i;return t.extend(n)}if(nt(t)){let r=ky(t),n={...t._zod.def.shape};for(let[s,a]of Object.entries(r))e(s,a)&&(n[s]=new xa({type:"optional",innerType:a}));let o=Qe(t,{...t._zod.def,shape:n}),i=Ge.get(t);return i&&Ge.add(o,i),o}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Py(t){return t instanceof Error&&(t.constructor.name==="ZodError"||t.constructor.name==="$ZodError")}function C$(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}var V5=["*","_","`"];function G5(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n}; +`;return e}function Nz(t,e,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:s=!0,curveStyle:a="linear",wrapLabelNWords:c=9}=r??{},u=s?`%%{init: {'flowchart': {'curve': '${a}'}}}%% +graph TD; +`:`graph TD; +`;if(s){let p="default",m={[p]:"{0}({1})"};n!==void 0&&(m[n]="{0}([{1}]):::first"),o!==void 0&&(m[o]="{0}([{1}]):::last");for(let[h,_]of Object.entries(t)){let v=_.name.split(":").pop()??"",x=V5.some(T=>v.startsWith(T)&&v.endsWith(T))?`

${v}

`:v;Object.keys(_.metadata??{}).length&&(x+=`
${Object.entries(_.metadata??{}).map(([T,F])=>`${T} = ${F}`).join(` +`)}`);let k=(m[h]??m[p]).replace("{0}",C$(h)).replace("{1}",x);u+=` ${k} +`}}let l={};for(let p of e){let m=p.source.split(":"),h=p.target.split(":"),_=m.filter((v,b)=>v===h[b]).join(":");l[_]||(l[_]=[]),l[_].push(p)}let d=new Set;function f(p,m){let h=p.length===1&&p[0].source===p[0].target;if(m&&!h){let _=m.split(":").pop();if(d.has(_))throw new Error(`Found duplicate subgraph '${_}' -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);d.add(_),u+=` subgraph ${_} +`}for(let _ of p){let{source:v,target:b,data:x,conditional:k}=_,T="";if(x!==void 0){let F=x,J=F.split(" ");J.length>c&&(F=Array.from({length:Math.ceil(J.length/c)},(w,Z)=>J.slice(Z*c,(Z+1)*c).join(" ")).join(" 
 ")),T=k?` -.  ${F}  .-> `:` --  ${F}  --> `}else T=k?" -.-> ":" --> ";u+=` ${C$(v)}${T}${C$(b)}; +`}for(let _ in l)_.startsWith(`${m}:`)&&_!==m&&f(l[_],_);m&&!h&&(u+=` end +`)}f(l[""]??[],"");for(let p in l)!p.includes(":")&&p!==""&&f(l[p],p);return s&&(u+=G5(i??{})),u}async function zz(t,e){let r=e?.backgroundColor??"white",n=e?.imageType??"png",o=HR(t);r!==void 0&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(r)||(r=`!${r}`));let i=`https://mermaid.ink/img/${o}?bgColor=${r}&type=${n}`,s=await fetch(i);if(!s.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${s.status}`,`Status text: ${s.statusText}`].join(` +`));return await s.blob()}var jz=Symbol("Let zodToJsonSchema decide on which parser to use"),Mz={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Dz=t=>typeof t=="string"?{...Mz,name:t}:{...Mz,...t};var Lz=t=>{let e=Dz(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};var Cy=(t,e)=>{let r=0;for(;ryG,DIRTY:()=>Ea,EMPTY_PATH:()=>J5,INVALID:()=>pe,NEVER:()=>tK,OK:()=>sr,ParseStatus:()=>Gt,Schema:()=>Ee,ZodAny:()=>is,ZodArray:()=>ni,ZodBigInt:()=>Oa,ZodBoolean:()=>Pa,ZodBranded:()=>Dp,ZodCatch:()=>Ba,ZodDate:()=>Ca,ZodDefault:()=>Fa,ZodDiscriminatedUnion:()=>zy,ZodEffects:()=>In,ZodEnum:()=>La,ZodError:()=>Mr,ZodFirstPartyTypeKind:()=>N,ZodFunction:()=>jy,ZodIntersection:()=>Ma,ZodIssueCode:()=>z,ZodLazy:()=>ja,ZodLiteral:()=>Da,ZodMap:()=>tl,ZodNaN:()=>nl,ZodNativeEnum:()=>Ua,ZodNever:()=>qn,ZodNull:()=>Na,ZodNullable:()=>xo,ZodNumber:()=>Aa,ZodObject:()=>jr,ZodOptional:()=>xn,ZodParsedType:()=>W,ZodPipeline:()=>Lp,ZodPromise:()=>ss,ZodReadonly:()=>Za,ZodRecord:()=>My,ZodSchema:()=>Ee,ZodSet:()=>rl,ZodString:()=>os,ZodSymbol:()=>Qu,ZodTransformer:()=>In,ZodTuple:()=>wo,ZodType:()=>Ee,ZodUndefined:()=>Ra,ZodUnion:()=>za,ZodUnknown:()=>ri,ZodVoid:()=>el,addIssueToContext:()=>B,any:()=>TG,array:()=>PG,bigint:()=>xG,boolean:()=>Jz,coerce:()=>eK,custom:()=>Kz,date:()=>$G,datetimeRegex:()=>Vz,defaultErrorMap:()=>ei,discriminatedUnion:()=>NG,effect:()=>GG,enum:()=>ZG,function:()=>UG,getErrorMap:()=>Ju,getParsedType:()=>bo,instanceof:()=>bG,intersection:()=>zG,isAborted:()=>Ry,isAsync:()=>Xu,isDirty:()=>Ny,isValid:()=>ns,late:()=>vG,lazy:()=>FG,literal:()=>BG,makeIssue:()=>jp,map:()=>DG,nan:()=>wG,nativeEnum:()=>qG,never:()=>AG,null:()=>kG,nullable:()=>HG,number:()=>Wz,object:()=>Xz,objectUtil:()=>N$,oboolean:()=>QG,onumber:()=>YG,optional:()=>KG,ostring:()=>XG,pipeline:()=>JG,preprocess:()=>WG,promise:()=>VG,quotelessJson:()=>K5,record:()=>jG,set:()=>LG,setErrorMap:()=>W5,strictObject:()=>CG,string:()=>Hz,symbol:()=>IG,transformer:()=>GG,tuple:()=>MG,undefined:()=>SG,union:()=>RG,unknown:()=>EG,util:()=>je,void:()=>OG});var je;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(je||(je={}));var N$;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(N$||(N$={}));var W=je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bo=t=>{switch(typeof t){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(t)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(t)?W.array:t===null?W.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?W.promise:typeof Map<"u"&&t instanceof Map?W.map:typeof Set<"u"&&t instanceof Set?W.set:typeof Date<"u"&&t instanceof Date?W.date:W.object;default:return W.unknown}};var z=je.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),K5=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Mr=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;cr.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Mr.create=t=>new Mr(t);var H5=(t,e)=>{let r;switch(t.code){case z.invalid_type:t.received===W.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,je.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${je.joinValues(t.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${je.joinValues(t.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${je.joinValues(t.options)}, received '${t.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:je.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case z.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case z.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=e.defaultError,je.assertNever(t)}return{message:r}},ei=H5;var Uz=ei;function W5(t){Uz=t}function Ju(){return Uz}var jp=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}},J5=[];function B(t,e){let r=Ju(),n=jp({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ei?void 0:ei].filter(o=>!!o)});t.common.issues.push(n)}var Gt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return pe;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return pe;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}},pe=Object.freeze({status:"aborted"}),Ea=t=>({status:"dirty",value:t}),sr=t=>({status:"valid",value:t}),Ry=t=>t.status==="aborted",Ny=t=>t.status==="dirty",ns=t=>t.status==="valid",Xu=t=>typeof Promise<"u"&&t instanceof Promise;var ne;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ne||(ne={}));var $n=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Fz=(t,e)=>{if(ns(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Mr(t.common.issues);return this._error=r,this._error}}};function Se(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var Ee=class{get description(){return this._def.description}_getType(e){return bo(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Gt,ctx:{common:e.parent.common,data:e.data,parsedType:bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Xu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Fz(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return ns(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>ns(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Xu(o)?o:Promise.resolve(o));return Fz(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:z.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new In({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return xn.create(this,this._def)}nullable(){return xo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ni.create(this)}promise(){return ss.create(this,this._def)}or(e){return za.create([this,e],this._def)}and(e){return Ma.create(this,e,this._def)}transform(e){return new In({...Se(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Fa({...Se(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new Dp({typeName:N.ZodBranded,type:this,...Se(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Ba({...Se(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Lp.create(this,e)}readonly(){return Za.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},X5=/^c[^\s-]{8,}$/i,Y5=/^[0-9a-z]+$/,Q5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,eG=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tG=/^[a-z0-9_-]{21}$/i,rG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,nG=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",z$,sG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,aG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,cG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,uG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zz="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",pG=new RegExp(`^${Zz}$`);function qz(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function fG(t){return new RegExp(`^${qz(t)}$`)}function Vz(t){let e=`${Zz}T${qz(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function mG(t,e){return!!((e==="v4"||!e)&&sG.test(t)||(e==="v6"||!e)&&cG.test(t))}function hG(t,e){if(!rG.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function gG(t,e){return!!((e==="v4"||!e)&&aG.test(t)||(e==="v6"||!e)&&uG.test(t))}var os=class t extends Ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.string,received:i.parsedType}),pe}let n=new Gt,o;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(o=this._getOrReturnCtx(e,o),B(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.lengthe.test(o),{validation:r,code:z.invalid_string,...ne.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ne.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ne.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ne.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ne.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ne.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ne.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ne.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ne.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ne.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ne.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ne.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ne.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ne.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ne.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ne.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ne.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ne.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ne.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ne.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ne.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ne.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ne.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ne.errToObj(r)})}nonempty(e){return this.min(1,ne.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew os({checks:[],typeName:N.ZodString,coerce:t?.coerce??!1,...Se(t)});function _G(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var Aa=class t extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==W.number){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.number,received:i.parsedType}),pe}let n,o=new Gt;for(let i of this._def.checks)i.kind==="int"?je.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?_G(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_finite,message:i.message}),o.dirty()):je.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ne.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ne.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ne.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ne.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ne.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ne.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ne.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ne.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ne.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ne.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&je.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew Aa({checks:[],typeName:N.ZodNumber,coerce:t?.coerce||!1,...Se(t)});var Oa=class t extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==W.bigint)return this._getInvalidInput(e);let n,o=new Gt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):je.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return B(r,{code:z.invalid_type,expected:W.bigint,received:r.parsedType}),pe}gte(e,r){return this.setLimit("min",e,!0,ne.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ne.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ne.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ne.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ne.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ne.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Oa({checks:[],typeName:N.ZodBigInt,coerce:t?.coerce??!1,...Se(t)});var Pa=class extends Ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.boolean,received:n.parsedType}),pe}return sr(e.data)}};Pa.create=t=>new Pa({typeName:N.ZodBoolean,coerce:t?.coerce||!1,...Se(t)});var Ca=class t extends Ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.date,received:i.parsedType}),pe}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_date}),pe}let n=new Gt,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(o=this._getOrReturnCtx(e,o),B(o,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):je.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ne.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ne.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ca({checks:[],coerce:t?.coerce||!1,typeName:N.ZodDate,...Se(t)});var Qu=class extends Ee{_parse(e){if(this._getType(e)!==W.symbol){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.symbol,received:n.parsedType}),pe}return sr(e.data)}};Qu.create=t=>new Qu({typeName:N.ZodSymbol,...Se(t)});var Ra=class extends Ee{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.undefined,received:n.parsedType}),pe}return sr(e.data)}};Ra.create=t=>new Ra({typeName:N.ZodUndefined,...Se(t)});var Na=class extends Ee{_parse(e){if(this._getType(e)!==W.null){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.null,received:n.parsedType}),pe}return sr(e.data)}};Na.create=t=>new Na({typeName:N.ZodNull,...Se(t)});var is=class extends Ee{constructor(){super(...arguments),this._any=!0}_parse(e){return sr(e.data)}};is.create=t=>new is({typeName:N.ZodAny,...Se(t)});var ri=class extends Ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return sr(e.data)}};ri.create=t=>new ri({typeName:N.ZodUnknown,...Se(t)});var qn=class extends Ee{_parse(e){let r=this._getOrReturnCtx(e);return B(r,{code:z.invalid_type,expected:W.never,received:r.parsedType}),pe}};qn.create=t=>new qn({typeName:N.ZodNever,...Se(t)});var el=class extends Ee{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.void,received:n.parsedType}),pe}return sr(e.data)}};el.create=t=>new el({typeName:N.ZodVoid,...Se(t)});var ni=class t extends Ee{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==W.array)return B(r,{code:z.invalid_type,expected:W.array,received:r.parsedType}),pe;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.lengtho.maxLength.value&&(B(r,{code:z.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new $n(r,s,r.path,a)))).then(s=>Gt.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new $n(r,s,r.path,a)));return Gt.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:ne.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:ne.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:ne.toString(r)}})}nonempty(e){return this.min(1,e)}};ni.create=(t,e)=>new ni({type:t,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...Se(e)});function Yu(t){if(t instanceof jr){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=xn.create(Yu(n))}return new jr({...t._def,shape:()=>e})}else return t instanceof ni?new ni({...t._def,type:Yu(t.element)}):t instanceof xn?xn.create(Yu(t.unwrap())):t instanceof xo?xo.create(Yu(t.unwrap())):t instanceof wo?wo.create(t.items.map(e=>Yu(e))):t}var jr=class t extends Ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=je.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==W.object){let u=this._getOrReturnCtx(e);return B(u,{code:z.invalid_type,expected:W.object,received:u.parsedType}),pe}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof qn&&this._def.unknownKeys==="strip"))for(let u in o.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new $n(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof qn){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(B(o,{code:z.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new $n(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Gt.mergeObjectSync(n,u)):Gt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return ne.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ne.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of je.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of je.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Yu(this)}partial(e){let r={};for(let n of je.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of je.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof xn;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Gz(je.objectKeys(this.shape))}};jr.create=(t,e)=>new jr({shape:()=>t,unknownKeys:"strip",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});jr.strictCreate=(t,e)=>new jr({shape:()=>t,unknownKeys:"strict",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});jr.lazycreate=(t,e)=>new jr({shape:t,unknownKeys:"strip",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});var za=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new Mr(a.ctx.common.issues));return B(r,{code:z.invalid_union,unionErrors:s}),pe}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new Mr(c));return B(r,{code:z.invalid_union,unionErrors:a}),pe}}get options(){return this._def.options}};za.create=(t,e)=>new za({options:t,typeName:N.ZodUnion,...Se(e)});var ti=t=>t instanceof ja?ti(t.schema):t instanceof In?ti(t.innerType()):t instanceof Da?[t.value]:t instanceof La?t.options:t instanceof Ua?je.objectValues(t.enum):t instanceof Fa?ti(t._def.innerType):t instanceof Ra?[void 0]:t instanceof Na?[null]:t instanceof xn?[void 0,...ti(t.unwrap())]:t instanceof xo?[null,...ti(t.unwrap())]:t instanceof Dp||t instanceof Za?ti(t.unwrap()):t instanceof Ba?ti(t._def.innerType):[],zy=class t extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.object)return B(r,{code:z.invalid_type,expected:W.object,received:r.parsedType}),pe;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(B(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=ti(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Se(n)})}};function M$(t,e){let r=bo(t),n=bo(e);if(t===e)return{valid:!0,data:t};if(r===W.object&&n===W.object){let o=je.objectKeys(e),i=je.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let c=M$(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===W.array&&n===W.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i{if(Ry(i)||Ry(s))return pe;let a=M$(i.value,s.value);return a.valid?((Ny(i)||Ny(s))&&r.dirty(),{status:r.value,value:a.data}):(B(n,{code:z.invalid_intersection_types}),pe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ma.create=(t,e,r)=>new Ma({left:t,right:e,typeName:N.ZodIntersection,...Se(r)});var wo=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.array)return B(n,{code:z.invalid_type,expected:W.array,received:n.parsedType}),pe;if(n.data.lengththis._def.items.length&&(B(n,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new $n(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>Gt.mergeArray(r,s)):Gt.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};wo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wo({items:t,typeName:N.ZodTuple,rest:null,...Se(e)})};var My=class t extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.object)return B(n,{code:z.invalid_type,expected:W.object,received:n.parsedType}),pe;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new $n(n,a,n.path,a)),value:s._parse(new $n(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Gt.mergeObjectAsync(r,o):Gt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ee?new t({keyType:e,valueType:r,typeName:N.ZodRecord,...Se(n)}):new t({keyType:os.create(),valueType:e,typeName:N.ZodRecord,...Se(r)})}},tl=class extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.map)return B(n,{code:z.invalid_type,expected:W.map,received:n.parsedType}),pe;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new $n(n,a,n.path,[u,"key"])),value:i._parse(new $n(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return pe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return pe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};tl.create=(t,e,r)=>new tl({valueType:e,keyType:t,typeName:N.ZodMap,...Se(r)});var rl=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.set)return B(n,{code:z.invalid_type,expected:W.set,received:n.parsedType}),pe;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&(B(n,{code:z.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return pe;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>i._parse(new $n(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:ne.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:ne.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};rl.create=(t,e)=>new rl({valueType:t,minSize:null,maxSize:null,typeName:N.ZodSet,...Se(e)});var jy=class t extends Ee{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.function)return B(r,{code:z.invalid_type,expected:W.function,received:r.parsedType}),pe;function n(a,c){return jp({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ju(),ei].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function o(a,c){return jp({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ju(),ei].filter(u=>!!u),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof ss){let a=this;return sr(async function(...c){let u=new Mr([]),l=await a._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(o(d,p)),u})})}else{let a=this;return sr(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new Mr([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new Mr([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:wo.create(e).rest(ri.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||wo.create([]).rest(ri.create()),returns:r||ri.create(),typeName:N.ZodFunction,...Se(n)})}},ja=class extends Ee{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ja.create=(t,e)=>new ja({getter:t,typeName:N.ZodLazy,...Se(e)});var Da=class extends Ee{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return B(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}};Da.create=(t,e)=>new Da({value:t,typeName:N.ZodLiteral,...Se(e)});function Gz(t,e){return new La({values:t,typeName:N.ZodEnum,...Se(e)})}var La=class t extends Ee{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{expected:je.joinValues(n),received:r.parsedType,code:z.invalid_type}),pe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{received:r.data,code:z.invalid_enum_value,options:n}),pe}return sr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};La.create=Gz;var Ua=class extends Ee{_parse(e){let r=je.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==W.string&&n.parsedType!==W.number){let o=je.objectValues(r);return B(n,{expected:je.joinValues(o),received:n.parsedType,code:z.invalid_type}),pe}if(this._cache||(this._cache=new Set(je.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=je.objectValues(r);return B(n,{received:n.data,code:z.invalid_enum_value,options:o}),pe}return sr(e.data)}get enum(){return this._def.values}};Ua.create=(t,e)=>new Ua({values:t,typeName:N.ZodNativeEnum,...Se(e)});var ss=class extends Ee{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.promise&&r.common.async===!1)return B(r,{code:z.invalid_type,expected:W.promise,received:r.parsedType}),pe;let n=r.parsedType===W.promise?r.data:Promise.resolve(r.data);return sr(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ss.create=(t,e)=>new ss({type:t,typeName:N.ZodPromise,...Se(e)});var In=class extends Ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{B(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return pe;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?pe:c.status==="dirty"?Ea(c.value):r.value==="dirty"?Ea(c.value):c});{if(r.value==="aborted")return pe;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?pe:a.status==="dirty"?Ea(a.value):r.value==="dirty"?Ea(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?pe:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?pe:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ns(s))return pe;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>ns(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):pe);je.assertNever(o)}};In.create=(t,e,r)=>new In({schema:t,typeName:N.ZodEffects,effect:e,...Se(r)});In.createWithPreprocess=(t,e,r)=>new In({schema:e,effect:{type:"preprocess",transform:t},typeName:N.ZodEffects,...Se(r)});var xn=class extends Ee{_parse(e){return this._getType(e)===W.undefined?sr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xn.create=(t,e)=>new xn({innerType:t,typeName:N.ZodOptional,...Se(e)});var xo=class extends Ee{_parse(e){return this._getType(e)===W.null?sr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xo.create=(t,e)=>new xo({innerType:t,typeName:N.ZodNullable,...Se(e)});var Fa=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===W.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Fa.create=(t,e)=>new Fa({innerType:t,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Se(e)});var Ba=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Xu(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Se(e)});var nl=class extends Ee{_parse(e){if(this._getType(e)!==W.nan){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.nan,received:n.parsedType}),pe}return{status:"valid",value:e.data}}};nl.create=t=>new nl({typeName:N.ZodNaN,...Se(t)});var yG=Symbol("zod_brand"),Dp=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Lp=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?pe:i.status==="dirty"?(r.dirty(),Ea(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?pe:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:N.ZodPipeline})}},Za=class extends Ee{_parse(e){let r=this._def.innerType._parse(e),n=o=>(ns(o)&&(o.value=Object.freeze(o.value)),o);return Xu(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Za.create=(t,e)=>new Za({innerType:t,typeName:N.ZodReadonly,...Se(e)});function Bz(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Kz(t,e={},r){return t?is.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=Bz(e,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!i){let s=Bz(e,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):is.create()}var vG={object:jr.lazycreate},N;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(N||(N={}));var bG=(t,e={message:`Input not instance of ${t.name}`})=>Kz(r=>r instanceof t,e),Hz=os.create,Wz=Aa.create,wG=nl.create,xG=Oa.create,Jz=Pa.create,$G=Ca.create,IG=Qu.create,SG=Ra.create,kG=Na.create,TG=is.create,EG=ri.create,AG=qn.create,OG=el.create,PG=ni.create,Xz=jr.create,CG=jr.strictCreate,RG=za.create,NG=zy.create,zG=Ma.create,MG=wo.create,jG=My.create,DG=tl.create,LG=rl.create,UG=jy.create,FG=ja.create,BG=Da.create,ZG=La.create,qG=Ua.create,VG=ss.create,GG=In.create,KG=xn.create,HG=xo.create,WG=In.createWithPreprocess,JG=Lp.create,XG=()=>Hz().optional(),YG=()=>Wz().optional(),QG=()=>Jz().optional(),eK={string:(t=>os.create({...t,coerce:!0})),number:(t=>Aa.create({...t,coerce:!0})),boolean:(t=>Pa.create({...t,coerce:!0})),bigint:(t=>Oa.create({...t,coerce:!0})),date:(t=>Ca.create({...t,coerce:!0}))};var tK=pe;function Yz(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==N.ZodAny&&(r.items=he(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&De(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&De(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(De(r,"minItems",t.exactLength.value,t.exactLength.message,e),De(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Qz(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?De(r,"minimum",n.value,n.message,e):De(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),De(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?De(r,"maximum",n.value,n.message,e):De(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),De(r,"maximum",n.value,n.message,e));break;case"multipleOf":De(r,"multipleOf",n.value,n.message,e);break}return r}function e1(){return{type:"boolean"}}function Dy(t,e){return he(t.type._def,e)}var t1=(t,e)=>he(t.innerType._def,e);function j$(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map(o=>j$(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return nK(t,e)}}var nK=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":De(r,"minimum",n.value,n.message,e);break;case"max":De(r,"maximum",n.value,n.message,e);break}return r};function r1(t,e){return{...he(t.innerType._def,e),default:t.defaultValue()}}function n1(t,e){return e.effectStrategy==="input"?he(t.schema._def,e):pt(e)}function o1(t){return{type:"string",enum:Array.from(t.values)}}var oK=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function i1(t,e){let r=[he(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),he(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(oK(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...c}=i;s=c}else n=void 0;o.push(s)}}),o.length?{allOf:o,...n}:void 0}function s1(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var D$,Vn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(D$===void 0&&(D$=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),D$),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Ly(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":De(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":De(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Gn(r,"email",n.message,e);break;case"format:idn-email":Gn(r,"idn-email",n.message,e);break;case"pattern:zod":Ir(r,Vn.email,n.message,e);break}break;case"url":Gn(r,"uri",n.message,e);break;case"uuid":Gn(r,"uuid",n.message,e);break;case"regex":Ir(r,n.regex,n.message,e);break;case"cuid":Ir(r,Vn.cuid,n.message,e);break;case"cuid2":Ir(r,Vn.cuid2,n.message,e);break;case"startsWith":Ir(r,RegExp(`^${L$(n.value,e)}`),n.message,e);break;case"endsWith":Ir(r,RegExp(`${L$(n.value,e)}$`),n.message,e);break;case"datetime":Gn(r,"date-time",n.message,e);break;case"date":Gn(r,"date",n.message,e);break;case"time":Gn(r,"time",n.message,e);break;case"duration":Gn(r,"duration",n.message,e);break;case"length":De(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),De(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":Ir(r,RegExp(L$(n.value,e)),n.message,e);break;case"ip":n.version!=="v6"&&Gn(r,"ipv4",n.message,e),n.version!=="v4"&&Gn(r,"ipv6",n.message,e);break;case"base64url":Ir(r,Vn.base64url,n.message,e);break;case"jwt":Ir(r,Vn.jwt,n.message,e);break;case"cidr":n.version!=="v6"&&Ir(r,Vn.ipv4Cidr,n.message,e),n.version!=="v4"&&Ir(r,Vn.ipv6Cidr,n.message,e);break;case"emoji":Ir(r,Vn.emoji(),n.message,e);break;case"ulid":Ir(r,Vn.ulid,n.message,e);break;case"base64":switch(e.base64Strategy){case"format:binary":Gn(r,"binary",n.message,e);break;case"contentEncoding:base64":De(r,"contentEncoding","base64",n.message,e);break;case"pattern:zod":Ir(r,Vn.base64,n.message,e);break}break;case"nanoid":Ir(r,Vn.nanoid,n.message,e);break;case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function L$(t,e){return e.patternStrategy==="escape"?sK(t):t}var iK=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function sK(t){let e="";for(let r=0;ro.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):De(t,"format",e,r,n)}function Ir(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:a1(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):De(t,"pattern",a1(e,n),r,n)}function a1(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",i=!1,s=!1,a=!1;for(let c=0;c({...n,[o]:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??pt(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===N.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=Ly(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===N.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===N.ZodBranded&&t.keyType._def.type._def.typeName===N.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=Dy(t.keyType._def,e);return{...r,propertyNames:o}}}return r}function c1(t,e){if(e.mapStrategy==="record")return Uy(t,e);let r=he(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||pt(e),n=he(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||pt(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function u1(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function l1(t){return t.target==="openAi"?void 0:{not:pt({...t,currentPath:[...t.currentPath,"not"]})}}function d1(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Up={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function f1(t,e){if(e.target==="openApi3")return p1(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Up&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let s=Up[i._def.typeName];return s&&!o.includes(s)?[...o,s]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,i)=>{let s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];case"bigint":return[...o,"integer"];case"object":return i._def.value===null?[...o,"null"]:o;case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((i,s,a)=>a.indexOf(i)===s);return{type:o.length>1?o:o[0],enum:r.reduce((i,s)=>i.includes(s._def.value)?i:[...i,s._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return p1(t,e)}var p1=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>he(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function m1(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Up[t.innerType._def.typeName],nullable:!0}:{type:[Up[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=he(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function h1(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",R$(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?De(r,"minimum",n.value,n.message,e):De(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),De(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?De(r,"maximum",n.value,n.message,e):De(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),De(r,"maximum",n.value,n.message,e));break;case"multipleOf":De(r,"multipleOf",n.value,n.message,e);break}return r}function g1(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},o=[],i=t.shape();for(let a in i){let c=i[a];if(c===void 0||c._def===void 0)continue;let u=cK(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=he(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||o.push(a))}o.length&&(n.required=o);let s=aK(t,e);return s!==void 0&&(n.additionalProperties=s),n}function aK(t,e){if(t.catchall._def.typeName!=="ZodNever")return he(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function cK(t){try{return t.isOptional()}catch{return!0}}var _1=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return he(t.innerType._def,e);let r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:pt(e)},r]}:pt(e)};var y1=(t,e)=>{if(e.pipeStrategy==="input")return he(t.in._def,e);if(e.pipeStrategy==="output")return he(t.out._def,e);let r=he(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=he(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function v1(t,e){return he(t.type._def,e)}function b1(t,e){let n={type:"array",uniqueItems:!0,items:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&De(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&De(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function w1(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>he(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:he(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>he(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function x1(t){return{not:pt(t)}}function $1(t){return pt(t)}var I1=(t,e)=>he(t.innerType._def,e);var S1=(t,e,r)=>{switch(e){case N.ZodString:return Ly(t,r);case N.ZodNumber:return h1(t,r);case N.ZodObject:return g1(t,r);case N.ZodBigInt:return Qz(t,r);case N.ZodBoolean:return e1();case N.ZodDate:return j$(t,r);case N.ZodUndefined:return x1(r);case N.ZodNull:return d1(r);case N.ZodArray:return Yz(t,r);case N.ZodUnion:case N.ZodDiscriminatedUnion:return f1(t,r);case N.ZodIntersection:return i1(t,r);case N.ZodTuple:return w1(t,r);case N.ZodRecord:return Uy(t,r);case N.ZodLiteral:return s1(t,r);case N.ZodEnum:return o1(t);case N.ZodNativeEnum:return u1(t);case N.ZodNullable:return m1(t,r);case N.ZodOptional:return _1(t,r);case N.ZodMap:return c1(t,r);case N.ZodSet:return b1(t,r);case N.ZodLazy:return()=>t.getter()._def;case N.ZodPromise:return v1(t,r);case N.ZodNaN:case N.ZodNever:return l1(r);case N.ZodEffects:return n1(t,r);case N.ZodAny:return pt(r);case N.ZodUnknown:return $1(r);case N.ZodDefault:return r1(t,r);case N.ZodBranded:return Dy(t,r);case N.ZodReadonly:return I1(t,r);case N.ZodCatch:return t1(t,r);case N.ZodPipeline:return y1(t,r);case N.ZodFunction:case N.ZodVoid:case N.ZodSymbol:return;default:return(n=>{})(e)}};function he(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==jz)return a}if(n&&!r){let a=uK(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=S1(t,t.typeName,e),s=typeof i=="function"?he(i(),e):i;if(s&&lK(t,e,s),e.postProcess){let a=e.postProcess(s,t,e);return o.jsonSchema=s,a}return o.jsonSchema=s,s}var uK=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Cy(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),pt(e)):e.$refStrategy==="seen"?pt(e):void 0}},lK=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var k1=(t,e)=>{let r=Lz(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:he(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??pt(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=he(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??pt(r),s=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;s!==void 0&&(i.title=s),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=o===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function $o(t,e){let r=typeof t;if(r!==typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let n=t.length;if(n!==e.length)return!1;for(let o=0;o1?e[s.href]=t:(s.hash="",n===""?r=s:Kn(t,e,r))}}else if(t!==!0&&t!==!1)return e;let o=r.href+(n?"#"+n:"");if(e[o]!==void 0)throw new Error(`Duplicate schema URI "${o}".`);if(e[o]=t,t===!0||t===!1)return e;if(t.__absolute_uri__===void 0&&Object.defineProperty(t,"__absolute_uri__",{enumerable:!1,value:o}),t.$ref&&t.__absolute_ref__===void 0){let i=new URL(t.$ref,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_ref__",{enumerable:!1,value:i.href})}if(t.$recursiveRef&&t.__absolute_recursive_ref__===void 0){let i=new URL(t.$recursiveRef,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(t.$anchor){let i=new URL("#"+t.$anchor,r.href);e[i.href]=t}for(let i in t){if(mK[i])continue;let s=`${n}/${sn(i)}`,a=t[i];if(Array.isArray(a)){if(pK[i]){let c=a.length;for(let u=0;u%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,xK=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,$K=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,IK=/^(?:\/(?:[^~/]|~0|~1)*)*$/,SK=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,kK=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,TK=t=>{if(t[0]==='"')return!1;let[e,r,...n]=t.split("@");return!e||!r||n.length!==0||e.length>64||r.length>253||e[0]==="."||e.endsWith(".")||e.includes("..")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(e)?!1:r.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},EK=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,AK=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,OK=t=>t.length>1&&t.length<80&&(/^P\d+([.,]\d+)?W$/.test(t)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(t)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(t));function Io(t){return t.test.bind(t)}var U$={date:T1,time:E1.bind(void 0,!1),"date-time":RK,duration:OK,uri:MK,"uri-reference":Io(bK),"uri-template":Io(wK),url:Io(xK),email:TK,hostname:Io(vK),ipv4:Io(EK),ipv6:Io(AK),regex:DK,uuid:Io($K),"json-pointer":Io(IK),"json-pointer-uri-fragment":Io(SK),"relative-json-pointer":Io(kK)};function PK(t){return t%4===0&&(t%100!==0||t%400===0)}function T1(t){let e=t.match(gK);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&PK(r)?29:_K[n])}function E1(t,e){let r=e.match(yK);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3],s=!!r[5];return(n<=23&&o<=59&&i<=59||n==23&&o==59&&i==60)&&(!t||s)}var CK=/t|\s/i;function RK(t){let e=t.split(CK);return e.length==2&&T1(e[0])&&E1(!0,e[1])}var NK=/\/|:/,zK=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function MK(t){return NK.test(t)&&zK.test(t)}var jK=/[^\\]\\Z/;function DK(t){if(jK.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var A1;(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(A1||(A1={}));function O1(t){let e=0,r=t.length,n=0,o;for(;n=55296&&o<=56319&&n$o(t,ge))||H.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`}):_.some(ge=>t===ge)||H.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`})),b!==void 0){let ge=`${a}/not`;ot(t,b,r,n,o,i,s,ge).valid&&H.push({instanceLocation:s,keyword:"not",keywordLocation:ge,error:'Instance matched "not" schema.'})}let Ts=[];if(x!==void 0){let ge=`${a}/anyOf`,le=H.length,xe=!1;for(let ee=0;ee{let ve=Object.create(c),_e=ot(t,ee,r,n,o,p===!0?i:null,s,`${ge}/${q}`,ve);return H.push(..._e.errors),_e.valid&&Ts.push(ve),_e.valid}).length;xe===1?H.length=le:H.splice(le,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:ge,error:`Instance does not match exactly one subschema (${xe} matches).`})}if((l==="object"||l==="array")&&Object.assign(c,...Ts),F!==void 0){let ge=`${a}/if`;if(ot(t,F,r,n,o,i,s,ge,c).valid){if(J!==void 0){let xe=ot(t,J,r,n,o,i,s,`${a}/then`,c);xe.valid||H.push({instanceLocation:s,keyword:"if",keywordLocation:ge,error:'Instance does not match "then" schema.'},...xe.errors)}}else if(w!==void 0){let xe=ot(t,w,r,n,o,i,s,`${a}/else`,c);xe.valid||H.push({instanceLocation:s,keyword:"if",keywordLocation:ge,error:'Instance does not match "else" schema.'},...xe.errors)}}if(l==="object"){if(v!==void 0)for(let ee of v)ee in t||H.push({instanceLocation:s,keyword:"required",keywordLocation:`${a}/required`,error:`Instance does not have required property "${ee}".`});let ge=Object.keys(t);if(pn!==void 0&&ge.lengthNo&&H.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${No} properties.`}),qe!==void 0){let ee=`${a}/propertyNames`;for(let q in t){let ve=`${s}/${sn(q)}`,_e=ot(q,qe,r,n,o,i,ve,ee);_e.valid||H.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:ee,error:`Property name "${q}" does not match schema.`},..._e.errors)}}if(Ul!==void 0){let ee=`${a}/dependantRequired`;for(let q in Ul)if(q in t){let ve=Ul[q];for(let _e of ve)_e in t||H.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:ee,error:`Instance has "${q}" but does not have "${_e}".`})}}if(Ss!==void 0)for(let ee in Ss){let q=`${a}/dependentSchemas`;if(ee in t){let ve=ot(t,Ss[ee],r,n,o,i,s,`${q}/${sn(ee)}`,c);ve.valid||H.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:q,error:`Instance has "${ee}" but does not match dependant schema.`},...ve.errors)}}if(ks!==void 0){let ee=`${a}/dependencies`;for(let q in ks)if(q in t){let ve=ks[q];if(Array.isArray(ve))for(let _e of ve)_e in t||H.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ee,error:`Instance has "${q}" but does not have "${_e}".`});else{let _e=ot(t,ve,r,n,o,i,s,`${ee}/${sn(q)}`);_e.valid||H.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ee,error:`Instance has "${q}" but does not match dependant schema.`},..._e.errors)}}}let le=Object.create(null),xe=!1;if(oe!==void 0){let ee=`${a}/properties`;for(let q in oe){if(!(q in t))continue;let ve=`${s}/${sn(q)}`,_e=ot(t[q],oe[q],r,n,o,i,ve,`${ee}/${sn(q)}`);if(_e.valid)c[q]=le[q]=!0;else if(xe=o,H.push({instanceLocation:s,keyword:"properties",keywordLocation:ee,error:`Property "${q}" does not match schema.`},..._e.errors),xe)break}}if(!xe&&Q!==void 0){let ee=`${a}/patternProperties`;for(let q in Q){let ve=new RegExp(q,"u"),_e=Q[q];for(let Er in t){if(!ve.test(Er))continue;let ET=`${s}/${sn(Er)}`,AT=ot(t[Er],_e,r,n,o,i,ET,`${ee}/${sn(q)}`);AT.valid?c[Er]=le[Er]=!0:(xe=o,H.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:ee,error:`Property "${Er}" matches pattern "${q}" but does not match associated schema.`},...AT.errors))}}}if(!xe&&wt!==void 0){let ee=`${a}/additionalProperties`;for(let q in t){if(le[q])continue;let ve=`${s}/${sn(q)}`,_e=ot(t[q],wt,r,n,o,i,ve,ee);_e.valid?c[q]=!0:(xe=o,H.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:ee,error:`Property "${q}" does not match additional properties schema.`},..._e.errors))}}else if(!xe&&dn!==void 0){let ee=`${a}/unevaluatedProperties`;for(let q in t)if(!c[q]){let ve=`${s}/${sn(q)}`,_e=ot(t[q],dn,r,n,o,i,ve,ee);_e.valid?c[q]=!0:H.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:ee,error:`Property "${q}" does not match unevaluated properties schema.`},..._e.errors)}}}else if(l==="array"){R!==void 0&&t.length>R&&H.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${t.length} > ${R}).`}),g!==void 0&&t.length=(Cn||0)&&(H.length=q),Cn===void 0&&y===void 0&&ve===0?H.splice(q,0,{instanceLocation:s,keyword:"contains",keywordLocation:ee,error:"Array does not contain item matching schema."}):Cn!==void 0&&vey&&H.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${y} items matching schema. ${ve} items were found.`})}if(!xe&&Bl!==void 0){let ee=`${a}/unevaluatedItems`;for(le;le=Ye||t>Ye)&&H.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${Tt?"or equal to ":""} ${Ye}.`})):(ze!==void 0&&tYe&&H.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${Ye}.`}),it!==void 0&&t<=it&&H.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${a}/exclusiveMinimum`,error:`${t} is less than ${it}.`}),Tt!==void 0&&t>=Tt&&H.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${a}/exclusiveMaximum`,error:`${t} is greater than or equal to ${Tt}.`})),Bt!==void 0){let ge=t%Bt;Math.abs(0-ge)>=11920929e-14&&Math.abs(Bt-ge)>=11920929e-14&&H.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${a}/multipleOf`,error:`${t} is not a multiple of ${Bt}.`})}}else if(l==="string"){let ge=Rn===void 0&&ht===void 0?0:O1(t);Rn!==void 0&&geht&&H.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${a}/maxLength`,error:`String is too long (${ge} > ${ht}).`}),fn!==void 0&&!new RegExp(fn,"u").test(t)&&H.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${a}/pattern`,error:"String does not match pattern."}),Z!==void 0&&U$[Z]&&!U$[Z](t)&&H.push({instanceLocation:s,keyword:"format",keywordLocation:`${a}/format`,error:`String does not match format "${Z}".`})}return{valid:H.length===0,errors:H}}var Fy=class{schema;draft;shortCircuit;lookup;constructor(e,r="2019-09",n=!0){this.schema=e,this.draft=r,this.shortCircuit=n,this.lookup=Kn(e)}validate(e){return ot(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,r){r&&(e={...e,$id:r}),Kn(e,this.lookup)}};var LK={};G(LK,{Validator:()=>Fy,deepCompareStrict:()=>$o,toJsonSchema:()=>an,validatesOnlyStrings:()=>ol});function an(t){if(nt(t)){let e=Oy(t,!0);if(wn(e)){let r=Hu(e,!0);return vo(r)}else return vo(t)}return vt(t)?k1(t):t}function ol(t){if(!t||typeof t!="object"||Object.keys(t).length===0||Array.isArray(t))return!1;if("type"in t)return typeof t.type=="string"?t.type==="string":Array.isArray(t.type)?t.type.every(e=>e==="string"):!1;if("enum"in t)return Array.isArray(t.enum)&&t.enum.length>0&&t.enum.every(e=>typeof e=="string");if("const"in t)return typeof t.const=="string";if("allOf"in t&&Array.isArray(t.allOf))return t.allOf.some(e=>ol(e));if("anyOf"in t&&Array.isArray(t.anyOf)||"oneOf"in t&&Array.isArray(t.oneOf)){let e="anyOf"in t?t.anyOf:t.oneOf;return e.length>0&&e.every(r=>ol(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=Kn(t);return r[e]?ol(r[e]):!1}return!1}var UK={};G(UK,{Graph:()=>By});function FK(t,e){if(t!==void 0&&!Ui(t))return t;if(Hd(e))try{let r=e.getName();return r=r.startsWith("Runnable")?r.slice(8):r,r}catch{return e.getName()}else return e.name??"UnknownSchema"}function BK(t){return Hd(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...an(t.data.schema),title:t.data.name}}}var By=class R1{nodes={};edges=[];constructor(e){this.nodes=e?.nodes??this.nodes,this.edges=e?.edges??this.edges}toJSON(){let e={};return Object.values(this.nodes).forEach((r,n)=>{e[r.id]=Ui(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...BK(r)})),edges:this.edges.map(r=>{let n={source:e[r.source],target:e[r.target]};return typeof r.data<"u"&&(n.data=r.data),typeof r.conditional<"u"&&(n.conditional=r.conditional),n})}}addNode(e,r,n){if(r!==void 0&&this.nodes[r]!==void 0)throw new Error(`Node with id ${r} already exists`);let o=r??Et(),i={id:o,data:e,name:FK(r,e),metadata:n};return this.nodes[o]=i,i}removeNode(e){delete this.nodes[e.id],this.edges=this.edges.filter(r=>r.source!==e.id&&r.target!==e.id)}addEdge(e,r,n,o){if(this.nodes[e.id]===void 0)throw new Error(`Source node ${e.id} not in graph`);if(this.nodes[r.id]===void 0)throw new Error(`Target node ${r.id} not in graph`);let i={source:e.id,target:r.id,data:n,conditional:o};return this.edges.push(i),i}firstNode(){return P1(this)}lastNode(){return C1(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(u=>u.id).every(Ui)&&(n="");let i=u=>n?`${n}:${u}`:u;Object.entries(e.nodes).forEach(([u,l])=>{this.nodes[i(u)]={...l,id:i(u)}});let s=e.edges.map(u=>({...u,source:i(u.source),target:i(u.target)}));this.edges=[...this.edges,...s];let a=e.firstNode(),c=e.lastNode();return[a?{id:i(a.id),data:a.data}:void 0,c?{id:i(c.id),data:c.data}:void 0]}trimFirstNode(){let e=this.firstNode();e&&P1(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&C1(this,[e.id])&&this.removeNode(e)}reid(){let e=Object.fromEntries(Object.values(this.nodes).map(o=>[o.id,o.name])),r=new Map;Object.values(e).forEach(o=>{r.set(o,(r.get(o)||0)+1)});let n=o=>{let i=e[o];return Ui(o)&&r.get(i)===1?i:o};return new R1({nodes:Object.fromEntries(Object.entries(this.nodes).map(([o,i])=>[n(o),{...i,id:n(o)}])),edges:this.edges.map(o=>({...o,source:n(o.source),target:n(o.target)}))})}drawMermaid(e){let{withStyles:r,curveStyle:n,nodeColors:o={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=e??{},s=this.reid(),a=s.firstNode(),c=s.lastNode();return Nz(s.nodes,s.edges,{firstNode:a?.id,lastNode:c?.id,withStyles:r,curveStyle:n,nodeColors:o,wrapLabelNWords:i})}async drawMermaidPng(e){let r=this.drawMermaid(e);return zz(r,{backgroundColor:e?.backgroundColor})}};function P1(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.source)).map(o=>o.target)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function C1(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.target)).map(o=>o.source)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function N1(t){let e=new TextEncoder,r=new ReadableStream({async start(n){for await(let o of t)n.enqueue(e.encode(`event: data +data: ${JSON.stringify(o)} + +`));n.enqueue(e.encode(`event: end + +`)),n.close()}});return br.fromReadableStream(r)}function F$(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}var z1=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function";function Zy(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*B$(t,e){for(;;){let{value:r,done:n}=Lt.runWithConfig(vr(t),e.next.bind(e),!0);if(n)break;yield r}}async function*qy(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Lt.runWithConfig(vr(t),r.next.bind(e),!0);if(o)break;yield n}}function Ot(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}var Ze=class extends uo{lc_runnable=!0;name;getName(t){let e=this.name??this.constructor.lc_name()??this.constructor.name;return t?`${e}${t}`:e}withRetry(t){return new Gy({bound:this,kwargs:{},config:{},maxAttemptNumber:t?.stopAfterAttempt,...t})}withConfig(t){return new as({bound:this,config:t,kwargs:{}})}withFallbacks(t){let e=Array.isArray(t)?t:t.fallbacks;return new Z$({runnable:this,fallbacks:e})}_getOptionsList(t,e=0){if(Array.isArray(t)&&t.length!==e)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${t.length} options for ${e} inputs`);if(Array.isArray(t))return t.map(Pe);if(e>1&&!Array.isArray(t)&&t.runId){console.warn("Provided runId will be used only for the first element of the batch.");let r=Object.fromEntries(Object.entries(t).filter(([n])=>n!=="runId"));return Array.from({length:e},(n,o)=>Pe(o===0?t:r))}return Array.from({length:e},()=>Pe(t))}async batch(t,e,r){let n=this._getOptionsList(e??{},t.length),o=n[0]?.maxConcurrency??r?.maxConcurrency,i=new Xo({maxConcurrency:o,onFailedAttempt:a=>{throw a}}),s=t.map((a,c)=>i.call(async()=>{try{return await this.invoke(a,n[c])}catch(u){if(r?.returnExceptions)return u;throw u}}));return Promise.all(s)}async*_streamIterator(t,e){yield this.invoke(t,e)}async stream(t,e){let r=Pe(e),n=new Zi({generator:this._streamIterator(t,r),config:r});return await n.setup,br.fromAsyncGenerator(n)}_separateRunnableConfigFromCallOptions(t){let e;t===void 0?e=Pe(t):e=Pe({callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,runName:t.runName,configurable:t.configurable,recursionLimit:t.recursionLimit,maxConcurrency:t.maxConcurrency,runId:t.runId,timeout:t.timeout,signal:t.signal});let r={...t};return delete r.callbacks,delete r.tags,delete r.metadata,delete r.runName,delete r.configurable,delete r.recursionLimit,delete r.maxConcurrency,delete r.runId,delete r.timeout,delete r.signal,[e,r]}async _callWithConfig(t,e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),Ot(e,"input"),n.runId,n?.runType,void 0,void 0,n?.runName??this.getName());delete n.runId;let s;try{let a=t.call(this,e,n,i);s=await vn(a,r?.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(Ot(s,"output")),s}async _batchWithConfig(t,e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(or)),s=await Promise.all(i.map(async(c,u)=>{let l=await c?.handleChainStart(this.toJSON(),Ot(e[u],"input"),o[u].runId,o[u].runType,void 0,void 0,o[u].runName??this.getName());return delete o[u].runId,l})),a;try{let c=t.call(this,e,o,s,n);a=await vn(c,o?.[0]?.signal)}catch(c){throw await Promise.all(s.map(u=>u?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(Ot(a,"output")))),a}_concatOutputChunks(t,e){return en(t,e)}async*_transformStreamWithConfig(t,e,r){let n,o=!0,i,s=!0,a=Pe(r),c=await or(a),u=this;async function*l(){for await(let f of t){if(o)if(n===void 0)n=f;else try{n=u._concatOutputChunks(n,f)}catch{n=void 0,o=!1}yield f}}let d;try{let f=await m0(e.bind(this),l(),async()=>c?.handleChainStart(this.toJSON(),{input:""},a.runId,a.runType,void 0,void 0,a.runName??this.getName()),r?.signal,a);delete a.runId,d=f.setup;let p=d?.handlers.find(ZR),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(_0);h!==void 0&&d!==void 0&&(m=h.tapOutputIterable(d.runId,m));for await(let _ of m)if(yield _,s)if(i===void 0)i=_;else try{i=this._concatOutputChunks(i,_)}catch{i=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:Ot(n,"input")}),f}await d?.handleChainEnd(i??{},void 0,void 0,void 0,{inputs:Ot(n,"input")})}getGraph(t){let e=new By,r=e.addNode({name:`${this.getName()}Input`,schema:$r.any()}),n=e.addNode(this),o=e.addNode({name:`${this.getName()}Output`,schema:$r.any()});return e.addEdge(r,n),e.addEdge(n,o),e}pipe(t){return new cs({first:this,last:cn(t)})}pick(t){return this.pipe(new q$(t))}assign(t){return this.pipe(new Bp(new us({steps:t})))}async*transform(t,e){let r;for await(let n of t)r===void 0?r=n:r=this._concatOutputChunks(r,n);yield*this._streamIterator(r,Pe(e))}async*streamLog(t,e,r){let n=new sg({...r,autoClose:!1,_schemaFormat:"original"}),o=Pe(e);yield*this._streamLog(t,n,o)}async*_streamLog(t,e,r){let{callbacks:n}=r;if(n===void 0)r.callbacks=[e];else if(Array.isArray(n))r.callbacks=n.concat([e]);else{let a=n.copy();a.addHandler(e,!0),r.callbacks=a}let o=this.stream(t,r);async function i(){try{let a=await o;for await(let c of a){let u=new ho({ops:[{op:"add",path:"/streamed_output/-",value:c}]});await e.writer.write(u)}}finally{await e.writer.close()}}let s=i();try{for await(let a of e)yield a}finally{await s}}streamEvents(t,e,r){let n;if(e.version==="v1")n=this._streamEventsV1(t,e,r);else if(e.version==="v2")n=this._streamEventsV2(t,e,r);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return e.encoding==="text/event-stream"?N1(n):br.fromAsyncGenerator(n)}async*_streamEventsV2(t,e,r){let n=new qR({...r,autoClose:!1}),o=Pe(e),i=o.runId??Et();o.runId=i;let s=o.callbacks;if(s===void 0)o.callbacks=[n];else if(Array.isArray(s))o.callbacks=s.concat(n);else{let p=s.copy();p.addHandler(n,!0),o.callbacks=p}let a=new AbortController,c=this;async function u(){let p,m=null;try{e?.signal?"any"in AbortSignal?p=AbortSignal.any([a.signal,e.signal]):(p=e.signal,m=()=>{a.abort()},e.signal.addEventListener("abort",m,{once:!0})):p=a.signal;let h=await c.stream(t,{...o,signal:p}),_=n.tapOutputIterable(i,h);for await(let v of _)if(a.signal.aborted)break}finally{await n.finish(),p&&m&&p.removeEventListener("abort",m)}}let l=u(),d=!1,f;try{for await(let p of n){if(!d){p.data.input=t,d=!0,f=p.run_id,yield p;continue}p.run_id===f&&p.event.endsWith("_end")&&p.data?.input&&delete p.data.input,yield p}}finally{a.abort(),await l}}async*_streamEventsV1(t,e,r){let n,o=!1,i=Pe(e),s=i.tags??[],a=i.metadata??{},c=i.runName??this.getName(),u=new sg({...r,autoClose:!1,_schemaFormat:"streaming_events"}),l=new KR({...r}),d=this._streamLog(t,u,i);for await(let p of d){if(n?n=n.concat(p):n=ig.fromRunLogPatch(p),n.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!o){o=!0;let v={...n.state},b={run_id:v.id,event:`on_${v.type}_start`,name:c,tags:s,metadata:a,data:{input:t}};l.includeEvent(b,v.type)&&(yield b)}let m=p.ops.filter(v=>v.path.startsWith("/logs/")).map(v=>v.path.split("/")[2]),h=[...new Set(m)];for(let v of h){let b,x={},k=n.state.logs[v];if(k.end_time===void 0?k.streamed_output.length>0?b="stream":b="start":b="end",b==="start")k.inputs!==void 0&&(x.input=k.inputs);else if(b==="end")k.inputs!==void 0&&(x.input=k.inputs),x.output=k.final_output;else if(b==="stream"){let T=k.streamed_output.length;if(T!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${T} instead. Encountered in: "${k.name}"`);x={chunk:k.streamed_output[0]},k.streamed_output=[]}yield{event:`on_${k.type}_${b}`,name:k.name,run_id:k.id,tags:k.tags,metadata:k.metadata,data:x}}let{state:_}=n;if(_.streamed_output.length>0){let v=_.streamed_output.length;if(v!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${v} instead. Encountered in: "${_.name}"`);let b={chunk:_.streamed_output[0]};_.streamed_output=[];let x={event:`on_${_.type}_stream`,run_id:_.id,tags:s,metadata:a,name:c,data:b};l.includeEvent(x,_.type)&&(yield x)}}let f=n?.state;if(f!==void 0){let p={event:`on_${f.type}_end`,name:c,run_id:f.id,tags:s,metadata:a,data:{output:f.final_output}};l.includeEvent(p,f.type)&&(yield p)}}static isRunnable(t){return Hd(t)}withListeners({onStart:t,onEnd:e,onError:r}){return new as({bound:this,config:{},configFactories:[n=>({callbacks:[new y0({config:n,onStart:t,onEnd:e,onError:r})]})]})}asTool(t){return VK(this,t)}},as=class M1 extends Ze{static lc_name(){return"RunnableBinding"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;bound;config;kwargs;configFactories;constructor(e){super(e),this.bound=e.bound,this.kwargs=e.kwargs,this.config=e.config,this.configFactories=e.configFactories}getName(e){return this.bound.getName(e)}async _mergeConfig(...e){let r=ga(this.config,...e);return ga(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new Gy({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:e?.stopAfterAttempt,...e})}async invoke(e,r){return this.bound.invoke(e,await this._mergeConfig(r,this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(Pe(i),this.kwargs))):await this._mergeConfig(Pe(r),this.kwargs);return this.bound.batch(e,o,n)}_concatOutputChunks(e,r){return this.bound._concatOutputChunks(e,r)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(Pe(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(Pe(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(Pe(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(Pe(r),o.kwargs),version:r.version},n)};return br.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&Ze.isRunnable(e.bound)}withListeners({onStart:e,onEnd:r,onError:n}){return new M1({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[o=>({callbacks:[new y0({config:o,onStart:e,onEnd:r,onError:n})]})]})}},j1=class D1 extends Ze{static lc_name(){return"RunnableEach"}lc_serializable=!0;lc_namespace=["langchain_core","runnables"];bound;constructor(e){super(e),this.bound=e.bound}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _invoke(e,r,n){return this.bound.batch(e,Ve(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new D1({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},Gy=class extends as{static lc_name(){return"RunnableRetry"}lc_namespace=["langchain_core","runnables"];maxAttemptNumber=3;onFailedAttempt=()=>{};constructor(t){super(t),this.maxAttemptNumber=t.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=t.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(t,e,r){let n=t>1?`retry:attempt:${t}`:void 0;return Ve(e,{callbacks:r?.getChild(n)})}async _invoke(t,e,r){return Kd(n=>super.invoke(t,this._patchConfigForRetry(n,e,r)),{onFailedAttempt:({error:n})=>this.onFailedAttempt(n,t),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(t,e){return this._callWithConfig(this._invoke.bind(this),t,e)}async _batch(t,e,r,n){let o={};try{await Kd(async i=>{let s=t.map((d,f)=>f).filter(d=>o[d.toString()]===void 0||o[d.toString()]instanceof Error),a=s.map(d=>t[d]),c=s.map(d=>this._patchConfigForRetry(i,e?.[d],r?.[d])),u=await super.batch(a,c,{...n,returnExceptions:!0}),l;for(let d=0;dthis.onFailedAttempt(i,i.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(i){if(n?.returnExceptions!==!0)throw i}return Object.keys(o).sort((i,s)=>parseInt(i,10)-parseInt(s,10)).map(i=>o[parseInt(i,10)])}async batch(t,e,r){return this._batchWithConfig(this._batch.bind(this),t,e,r)}},cs=class Fp extends Ze{static lc_name(){return"RunnableSequence"}first;middle=[];last;omitSequenceTags=!1;lc_serializable=!0;lc_namespace=["langchain_core","runnables"];constructor(e){super(e),this.first=e.first,this.middle=e.middle??this.middle,this.last=e.last,this.name=e.name,this.omitSequenceTags=e.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),Ot(e,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let s=e,a;try{let c=[this.first,...this.middle];for(let u=0;u{let l=await c?.handleChainStart(this.toJSON(),Ot(e[u],"input"),o[u].runId,void 0,void 0,void 0,o[u].runName);return delete o[u].runId,l})),a=e;try{for(let c=0;c{let p=d?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`);return Ve(o[f],{callbacks:p})}),n);a=await vn(l,o[0]?.signal)}}catch(c){throw await Promise.all(s.map(u=>u?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(Ot(a,"output")))),a}_concatOutputChunks(e,r){return this.last._concatOutputChunks(e,r)}async*_streamIterator(e,r){let n=await or(r),{runId:o,...i}=r??{},s=await n?.handleChainStart(this.toJSON(),Ot(e,"input"),o,void 0,void 0,void 0,i?.runName),a=[this.first,...this.middle,this.last],c=!0,u;async function*l(){yield e}try{let d=a[0].transform(l(),Ve(i,{callbacks:s?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let f=1;f{let s=o.getGraph(e);i!==0&&s.trimFirstNode(),i!==this.steps.length-1&&s.trimLastNode(),r.extend(s);let a=s.firstNode();if(!a)throw new Error(`Runnable ${o} has no first node`);n&&r.addEdge(n,a),n=s.lastNode()}),r}pipe(e){return Fp.isRunnableSequence(e)?new Fp({first:this.first,middle:this.middle.concat([this.last,e.first,...e.middle]),last:e.last,name:this.name??e.name}):new Fp({first:this.first,middle:[...this.middle,this.last],last:cn(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&Ze.isRunnable(e)}static from([e,...r],n){let o={};return typeof n=="string"?o.name=n:n!==void 0&&(o=n),new Fp({...o,first:cn(e),middle:r.slice(0,-1).map(cn),last:cn(r[r.length-1])})}},us=class L1 extends Ze{static lc_name(){return"RunnableMap"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;steps;getStepsKeys(){return Object.keys(this.steps)}constructor(e){super(e),this.steps={};for(let[r,n]of Object.entries(e.steps))this.steps[r]=cn(n)}static from(e){return new L1({steps:e})}async invoke(e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),{input:e},n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let s={};try{let a=Object.entries(this.steps).map(async([c,u])=>{s[c]=await u.invoke(e,Ve(n,{callbacks:i?.getChild(`map:key:${c}`)}))});await vn(Promise.all(a),r?.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(s),s}async*_transform(e,r,n){let o={...this.steps},i=Jh(e,Object.keys(o).length),s=new Map(Object.entries(o).map(([a,c],u)=>{let l=c.transform(i[u],Ve(n,{callbacks:r?.getChild(`map:key:${a}`)}));return[a,l.next().then(d=>({key:a,gen:l,result:d}))]}));for(;s.size;){let a=Promise.race(s.values()),{key:c,result:u,gen:l}=await vn(a,n?.signal);s.delete(c),u.done||(yield{[c]:u.value},s.set(c,l.next().then(d=>({key:c,gen:l,result:d}))))}}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Pe(r),i=new Zi({generator:this.transform(n(),o),config:o});return await i.setup,br.fromAsyncGenerator(i)}},ZK=class U1 extends Ze{lc_serializable=!1;lc_namespace=["langchain_core","runnables"];func;constructor(e){if(super(e),!Kh(e.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=e.func}async invoke(e,r){let[n]=this._getOptionsList(r??{},1),o=await or(n),i=this.func(Ve(n,{callbacks:o}),e);return vn(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(Zy(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(z1(o)){for(;;){n?.signal?.throwIfAborted();let i=o.next();if(i.done)break;yield i.value}return}yield o}static from(e){return new U1({func:e})}};function qK(t){if(Kh(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}var Dr=class F1 extends Ze{static lc_name(){return"RunnableLambda"}lc_namespace=["langchain_core","runnables"];func;constructor(e){if(Kh(e.func))return ZK.from(e.func);super(e),qK(e.func),this.func=e.func}static from(e){return new F1({func:e})}async _invoke(e,r,n){return new Promise((o,i)=>{let s=Ve(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??Wh)-1});Lt.runWithConfig(vr(s),async()=>{try{let a=await this.func(e,{...s});if(a&&Ze.isRunnable(a)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");a=await a.invoke(e,{...s,recursionLimit:(s.recursionLimit??Wh)-1})}else if(Zy(a)){let c;for await(let u of qy(s,a))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}a=c}else if(F$(a)){let c;for(let u of B$(s,a))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}a=c}o(a)}catch(a){i(a)}})})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async*_transform(e,r,n){let o;for await(let a of e)if(o===void 0)o=a;else try{o=this._concatOutputChunks(o,a)}catch{o=a}let i=Ve(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??Wh)-1}),s=await new Promise((a,c)=>{Lt.runWithConfig(vr(i),async()=>{try{let u=await this.func(o,{...i,config:i});a(u)}catch(u){c(u)}})});if(s&&Ze.isRunnable(s)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");let a=await s.stream(o,i);for await(let c of a)yield c}else if(Zy(s))for await(let a of qy(i,s))n?.signal?.throwIfAborted(),yield a;else if(F$(s))for(let a of B$(i,s))n?.signal?.throwIfAborted(),yield a;else yield s}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Pe(r),i=new Zi({generator:this.transform(n(),o),config:o});return await i.setup,br.fromAsyncGenerator(i)}},B1=class extends us{},Z$=class extends Ze{static lc_name(){return"RunnableWithFallbacks"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnable;fallbacks;constructor(t){super(t),this.runnable=t.runnable,this.fallbacks=t.fallbacks}*runnables(){yield this.runnable;for(let t of this.fallbacks)yield t}async invoke(t,e){let r=Pe(e),n=await or(r),{runId:o,...i}=r,s=await n?.handleChainStart(this.toJSON(),Ot(t,"input"),o,void 0,void 0,void 0,i?.runName),a=Ve(i,{callbacks:s?.getChild()});return await Lt.runWithConfig(a,async()=>{let u;for(let l of this.runnables()){r?.signal?.throwIfAborted();try{let d=await l.invoke(t,a);return await s?.handleChainEnd(Ot(d,"output")),d}catch(d){u===void 0&&(u=d)}}throw u===void 0?new Error("No error stored at end of fallback."):(await s?.handleChainError(u),u)})}async*_streamIterator(t,e){let r=Pe(e),n=await or(r),{runId:o,...i}=r,s=await n?.handleChainStart(this.toJSON(),Ot(t,"input"),o,void 0,void 0,void 0,i?.runName),a,c;for(let l of this.runnables()){r?.signal?.throwIfAborted();let d=Ve(i,{callbacks:s?.getChild()});try{let f=await l.stream(t,d);c=qy(d,f);break}catch(f){a===void 0&&(a=f)}}if(c===void 0){let l=a??new Error("No error stored at end of fallback.");throw await s?.handleChainError(l),l}let u;try{for await(let l of c){yield l;try{u=u===void 0?u:this._concatOutputChunks(u,l)}catch{u=void 0}}}catch(l){throw await s?.handleChainError(l),l}await s?.handleChainEnd(Ot(u,"output"))}async batch(t,e,r){if(r?.returnExceptions)throw new Error("Not implemented.");let n=this._getOptionsList(e??{},t.length),o=await Promise.all(n.map(a=>or(a))),i=await Promise.all(o.map(async(a,c)=>{let u=await a?.handleChainStart(this.toJSON(),Ot(t[c],"input"),n[c].runId,void 0,void 0,void 0,n[c].runName);return delete n[c].runId,u})),s;for(let a of this.runnables()){n[0].signal?.throwIfAborted();try{let c=await a.batch(t,i.map((u,l)=>Ve(n[l],{callbacks:u?.getChild()})),r);return await Promise.all(i.map((u,l)=>u?.handleChainEnd(Ot(c[l],"output")))),c}catch(c){s===void 0&&(s=c)}}throw s?(await Promise.all(i.map(a=>a?.handleChainError(s))),s):new Error("No error stored at end of fallbacks.")}};function cn(t){if(typeof t=="function")return new Dr({func:t});if(Ze.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=cn(n);return new us({steps:e})}else throw new Error(`Expected a Runnable, function or object. +Instead got an unsupported type.`)}var Bp=class extends Ze{static lc_name(){return"RunnableAssign"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;mapper;constructor(t){t instanceof us&&(t={mapper:t}),super(t),this.mapper=t.mapper}async invoke(t,e){let r=await this.mapper.invoke(t,e);return{...t,...r}}async*_transform(t,e,r){let n=this.mapper.getStepsKeys(),[o,i]=Jh(t),s=this.mapper.transform(i,Ve(r,{callbacks:e?.getChild()})),a=s.next();for await(let c of o){if(typeof c!="object"||Array.isArray(c))throw new Error(`RunnableAssign can only be used with objects as input, got ${typeof c}`);let u=Object.fromEntries(Object.entries(c).filter(([l])=>!n.includes(l)));Object.keys(u).length>0&&(yield u)}yield(await a).value;for await(let c of s)yield c}transform(t,e){return this._transformStreamWithConfig(t,this._transform.bind(this),e)}async stream(t,e){async function*r(){yield t}let n=Pe(e),o=new Zi({generator:this.transform(r(),n),config:n});return await o.setup,br.fromAsyncGenerator(o)}},q$=class extends Ze{static lc_name(){return"RunnablePick"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;keys;constructor(t){(typeof t=="string"||Array.isArray(t))&&(t={keys:t}),super(t),this.keys=t.keys}async _pick(t){if(typeof this.keys=="string")return t[this.keys];{let e=this.keys.map(r=>[r,t[r]]).filter(r=>r[1]!==void 0);return e.length===0?void 0:Object.fromEntries(e)}}async invoke(t,e){return this._callWithConfig(this._pick.bind(this),t,e)}async*_transform(t){for await(let e of t){let r=await this._pick(e);r!==void 0&&(yield r)}}transform(t,e){return this._transformStreamWithConfig(t,this._transform.bind(this),e)}async stream(t,e){async function*r(){yield t}let n=Pe(e),o=new Zi({generator:this.transform(r(),n),config:n});return await o.setup,br.fromAsyncGenerator(o)}},Vy=class extends as{name;description;schema;constructor(t){let e=cs.from([Dr.from(async r=>{let n;if(Mi(r))try{n=await ts(this.schema,r.args)}catch{throw new su("Received tool input did not match expected schema",JSON.stringify(r.args))}else n=r;return n}).withConfig({runName:`${t.name}:parse_input`}),t.bound]).withConfig({runName:t.name});super({bound:e,config:t.config??{}}),this.name=t.name,this.description=t.description,this.schema=t.schema}static lc_name(){return"RunnableToolLike"}};function VK(t,e){let r=e.name??t.getName(),n=e.description??rs(e.schema);return Wu(e.schema)?new Vy({name:r,description:n,schema:$r.object({input:$r.string()}).transform(o=>o.input),bound:t}):new Vy({name:r,description:n,schema:e.schema,bound:t})}var Ky=(t,e)=>{let r=[...new Set(e?.map(o=>{if(typeof o=="string")return o;let i=new o({});if(!("getType"in i)||typeof i.getType!="function")throw new Error("Invalid type provided.");return i.getType()}))],n=t.getType();return r.some(o=>o===n)};function K1(t,e){return Array.isArray(t)?Z1(t,e):Dr.from(r=>Z1(r,t))}function Z1(t,e={}){let{includeNames:r,excludeNames:n,includeTypes:o,excludeTypes:i,includeIds:s,excludeIds:a}=e,c=[];for(let u of t)if(!(n&&u.name&&n.includes(u.name))){{if(i&&Ky(u,i))continue;if(a&&u.id&&a.includes(u.id))continue}o||s||r?(r&&u.name&&r.some(l=>l===u.name)||o&&Ky(u,o)||s&&u.id&&s.some(l=>l===u.id))&&c.push(u):c.push(u)}return c}function H1(t){return Array.isArray(t)?q1(t):Dr.from(q1)}function q1(t){if(!t.length)return[];let e=[];for(let r of t){let n=r,o=e.pop();if(!o)e.push(n);else if(n.getType()==="tool"||n.getType()!==o.getType())e.push(o,n);else{let i=ca(o),s=ca(n),a=i.concat(s);typeof i.content=="string"&&typeof s.content=="string"&&(a.content=`${i.content} +${s.content}`),e.push(KK(a))}}return e}function W1(t,e){if(Array.isArray(t)){let r=t;if(!e)throw new Error("Options parameter is required when providing messages.");return V1(r,e)}else{let r=t;return Dr.from(n=>V1(n,r)).withConfig({runName:"trim_messages"})}}async function V1(t,e){let{maxTokens:r,tokenCounter:n,strategy:o="last",allowPartial:i=!1,endOn:s,startOn:a,includeSystem:c=!1,textSplitter:u}=e;if(a&&o==="first")throw new Error("`startOn` should only be specified if `strategy` is 'last'.");if(c&&o==="first")throw new Error("`includeSystem` should only be specified if `strategy` is 'last'.");let l;"getNumTokens"in n?l=async f=>(await Promise.all(f.map(m=>n.getNumTokens(m.content)))).reduce((m,h)=>m+h,0):l=async f=>n(f);let d=G$;if(u&&("splitText"in u?d=u.splitText:d=async f=>u(f)),o==="first")return J1(t,{maxTokens:r,tokenCounter:l,textSplitter:d,partialStrategy:i?"first":void 0,endOn:s});if(o==="last")return GK(t,{maxTokens:r,tokenCounter:l,textSplitter:d,allowPartial:i,includeSystem:c,startOn:a,endOn:s});throw new Error(`Unrecognized strategy: '${o}'. Must be one of 'first' or 'last'.`)}async function J1(t,e){let{maxTokens:r,tokenCounter:n,textSplitter:o,partialStrategy:i,endOn:s}=e,a=[...t],c=0;for(let u=0;u0?a.slice(0,-u):a;if(await n(l)<=r){c=a.length-u;break}}if(cb!=="type"&&!b.startsWith("lc_"))),_=V$(l.getType(),{...h,content:m}),v=[...a.slice(0,c),_];if(await n(v)<=r)a=v,c+=1,u=!0;else break}u&&i==="last"&&(l.content=[...f].reverse())}if(!u){let l=a[c],d;if(Array.isArray(l.content)&&l.content.some(f=>typeof f=="string"||f.type==="text")?d=l.content.find(p=>p.type==="text"&&p.text)?.text:typeof l.content=="string"&&(d=l.content),d){let f=await o(d),p=f.length;i==="last"&&f.reverse();for(let m=0;m0&&!Ky(a[c-1],u);)c-=1}return a.slice(0,c)}async function GK(t,e){let{allowPartial:r=!1,includeSystem:n=!1,endOn:o,startOn:i,...s}=e,a=t.map(l=>{let d=Object.fromEntries(Object.entries(l).filter(([f])=>f!=="type"&&!f.startsWith("lc_")));return V$(l.getType(),d,iu(l))});if(o){let l=Array.isArray(o)?o:[o];for(;a.length>0&&!Ky(a[a.length-1],l);)a=a.slice(0,-1)}let c=n&&a[0]?.getType()==="system",u=c?a.slice(0,1).concat(a.slice(1).reverse()):a.reverse();return u=await J1(u,{...s,partialStrategy:r?"last":void 0,endOn:i}),c?[u[0],...u.slice(1).reverse()]:u.reverse()}var G1={human:{message:mr,messageChunk:zi},ai:{message:jt,messageChunk:Dt},system:{message:hn,messageChunk:lo},developer:{message:hn,messageChunk:lo},tool:{message:Or,messageChunk:na},function:{message:oa,messageChunk:Ni},generic:{message:jn,messageChunk:Ri},remove:{message:ia,messageChunk:ia}};function V$(t,e,r){let n,o;switch(t){case"human":r?n=new zi(e):o=new mr(e);break;case"ai":if(r){let i={...e};"tool_calls"in i&&(i={...i,tool_call_chunks:i.tool_calls?.map(s=>({...s,type:"tool_call_chunk",index:void 0,args:JSON.stringify(s.args)}))}),n=new Dt(i)}else o=new jt(e);break;case"system":r?n=new lo(e):o=new hn(e);break;case"developer":r?n=new lo({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}}):o=new hn({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in e)r?n=new na(e):o=new Or(e);else throw new Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(r)n=new Ni(e);else{if(!e.name)throw new Error("FunctionMessage must have a 'name' field");o=new oa(e)}break;case"generic":if("role"in e)r?n=new Ri(e):o=new jn(e);else throw new Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw new Error(`Unrecognized message type ${t}`)}if(r&&n)return n;if(o)return o;throw new Error(`Unrecognized message type ${t}`)}function KK(t){let e=t.getType(),r,n=Object.fromEntries(Object.entries(t).filter(([o])=>!["type","tool_call_chunks"].includes(o)&&!o.startsWith("lc_")));if(e in G1&&(r=V$(e,n)),!r)throw new Error(`Unrecognized message chunk class ${e}. Supported classes are ${Object.keys(G1)}`);return r}function G$(t){let e=t.split(` +`);return Promise.resolve([...e.slice(0,-1).map(r=>`${r} +`),e[e.length-1]])}var X1=["tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result"];var Y1=["image","video","audio","text-plain","file"];var Q1=["text","reasoning",...X1,...Y1];var HK={};G(HK,{AIMessage:()=>jt,AIMessageChunk:()=>Dt,BaseMessage:()=>qt,BaseMessageChunk:()=>fr,ChatMessage:()=>jn,ChatMessageChunk:()=>Ri,FunctionMessage:()=>oa,FunctionMessageChunk:()=>Ni,HumanMessage:()=>mr,HumanMessageChunk:()=>zi,KNOWN_BLOCK_TYPES:()=>Q1,RemoveMessage:()=>ia,SystemMessage:()=>hn,SystemMessageChunk:()=>lo,ToolMessage:()=>Or,ToolMessageChunk:()=>na,_isMessageFieldWithRole:()=>ih,_mergeDicts:()=>dt,_mergeLists:()=>ra,_mergeObj:()=>oh,_mergeStatus:()=>nh,coerceMessageLikeToMessage:()=>ji,collapseToolCallChunks:()=>lh,convertToChunk:()=>ca,convertToOpenAIImageBlock:()=>Xm,convertToProviderContentBlock:()=>$d,defaultTextSplitter:()=>G$,defaultToolCallParser:()=>Sd,filterMessages:()=>K1,getBufferString:()=>au,iife:()=>Xw,isAIMessage:()=>aa,isAIMessageChunk:()=>Td,isBase64ContentBlock:()=>ou,isBaseMessage:()=>Yr,isBaseMessageChunk:()=>iu,isChatMessage:()=>WA,isChatMessageChunk:()=>JA,isDataContentBlock:()=>Jr,isDirectToolOutput:()=>Id,isFunctionMessage:()=>XA,isFunctionMessageChunk:()=>YA,isHumanMessage:()=>QA,isHumanMessageChunk:()=>eO,isIDContentBlock:()=>Jm,isMessage:()=>Qm,isOpenAIToolCallArray:()=>VA,isPlainTextContentBlock:()=>bA,isSystemMessage:()=>tO,isSystemMessageChunk:()=>rO,isToolMessage:()=>Gw,isToolMessageChunk:()=>Kw,isURLContentBlock:()=>nu,mapChatMessagesToStoredMessages:()=>dO,mapStoredMessageToChatMessage:()=>Ed,mapStoredMessagesToChatMessages:()=>lO,mergeContent:()=>er,mergeMessageRuns:()=>H1,mergeResponseMetadata:()=>sh,mergeUsageMetadata:()=>ah,parseBase64DataUrl:()=>ta,parseMimeType:()=>Ym,trimMessages:()=>W1});function Zp(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function qp(t){return t!==void 0&&Ze.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function Vp(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(on(t.schema)||t.schema!=null&&typeof t.schema=="object"&&"type"in t.schema&&typeof t.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(t.schema.type))}function qa(t){return Vp(t)||qp(t)||Zp(t)}var JK={};G(JK,{convertToOpenAIFunction:()=>eM,convertToOpenAITool:()=>tM,isLangChainTool:()=>qa,isRunnableToolLike:()=>qp,isStructuredTool:()=>Zp,isStructuredToolParams:()=>Vp});function eM(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:an(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function tM(t,e){let r=typeof e=="number"?void 0:e,n;return qa(t)?n={type:"function",function:eM(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var XK={};G(XK,{extendInteropZodObject:()=>Oz,getInteropZodDefaultGetter:()=>Cz,getInteropZodObjectShape:()=>ky,getSchemaDescription:()=>rs,interopParse:()=>Tz,interopParseAsync:()=>ts,interopSafeParse:()=>kz,interopSafeParseAsync:()=>Ey,interopZodObjectMakeFieldsOptional:()=>Rz,interopZodObjectPartial:()=>Pz,interopZodObjectPassthrough:()=>Ty,interopZodObjectStrict:()=>Hu,interopZodTransformInputSchema:()=>Oy,isInteropZodError:()=>Py,isInteropZodLiteral:()=>Sz,isInteropZodObject:()=>Az,isInteropZodSchema:()=>on,isShapelessZodSchema:()=>Ez,isSimpleStringZodSchema:()=>Wu,isZodArrayV4:()=>Mp,isZodLiteralV3:()=>E$,isZodLiteralV4:()=>A$,isZodNullableV4:()=>P$,isZodObjectV3:()=>Ay,isZodObjectV4:()=>wn,isZodOptionalV4:()=>O$,isZodSchema:()=>Iz,isZodSchemaV3:()=>vt,isZodSchemaV4:()=>nt});var av={};gi(av,{$brand:()=>Jd,$input:()=>D_,$output:()=>j_,NEVER:()=>lg,TimePrecision:()=>B_,ZodAny:()=>cM,ZodArray:()=>pM,ZodBase64:()=>$I,ZodBase64URL:()=>II,ZodBigInt:()=>Xp,ZodBigIntFormat:()=>TI,ZodBoolean:()=>Jp,ZodCIDRv4:()=>wI,ZodCIDRv6:()=>xI,ZodCUID:()=>mI,ZodCUID2:()=>hI,ZodCatch:()=>AM,ZodCodec:()=>zI,ZodCustom:()=>iv,ZodCustomStringFormat:()=>Hp,ZodDate:()=>rv,ZodDefault:()=>$M,ZodDiscriminatedUnion:()=>fM,ZodE164:()=>SI,ZodEmail:()=>dI,ZodEmoji:()=>pI,ZodEnum:()=>Gp,ZodError:()=>QK,ZodFile:()=>bM,ZodFirstPartyTypeKind:()=>jI,ZodFunction:()=>DM,ZodGUID:()=>Yy,ZodIPv4:()=>vI,ZodIPv6:()=>bI,ZodISODate:()=>Wy,ZodISODateTime:()=>Hy,ZodISODuration:()=>Xy,ZodISOTime:()=>Jy,ZodIntersection:()=>mM,ZodIssueCode:()=>aW,ZodJWT:()=>kI,ZodKSUID:()=>yI,ZodLazy:()=>zM,ZodLiteral:()=>vM,ZodMAC:()=>oM,ZodMap:()=>_M,ZodNaN:()=>PM,ZodNanoID:()=>fI,ZodNever:()=>lM,ZodNonOptional:()=>RI,ZodNull:()=>aM,ZodNullable:()=>xM,ZodNumber:()=>Wp,ZodNumberFormat:()=>sl,ZodObject:()=>nv,ZodOptional:()=>CI,ZodPipe:()=>NI,ZodPrefault:()=>SM,ZodPromise:()=>jM,ZodReadonly:()=>CM,ZodRealError:()=>Lr,ZodRecord:()=>OI,ZodSet:()=>yM,ZodString:()=>Kp,ZodStringFormat:()=>et,ZodSuccess:()=>EM,ZodSymbol:()=>iM,ZodTemplateLiteral:()=>NM,ZodTransform:()=>wM,ZodTuple:()=>hM,ZodType:()=>Ae,ZodULID:()=>gI,ZodURL:()=>tv,ZodUUID:()=>oi,ZodUndefined:()=>sM,ZodUnion:()=>AI,ZodUnknown:()=>uM,ZodVoid:()=>dM,ZodXID:()=>_I,_ZodString:()=>lI,_default:()=>IM,_function:()=>eW,any:()=>DH,array:()=>Re,base64:()=>wH,base64url:()=>xH,bigint:()=>RH,boolean:()=>Nt,catch:()=>OM,check:()=>tW,cidrv4:()=>vH,cidrv6:()=>bH,clone:()=>Qe,codec:()=>XH,coerce:()=>DI,config:()=>yt,core:()=>nn,cuid:()=>dH,cuid2:()=>pH,custom:()=>MI,date:()=>UH,decode:()=>rI,decodeAsync:()=>oI,describe:()=>rW,discriminatedUnion:()=>ov,e164:()=>$H,email:()=>tH,emoji:()=>uH,encode:()=>tI,encodeAsync:()=>nI,endsWith:()=>Bu,enum:()=>zt,file:()=>KH,flattenError:()=>yu,float32:()=>AH,float64:()=>OH,formatError:()=>vu,function:()=>eW,getErrorMap:()=>uW,globalRegistry:()=>Ge,gt:()=>yo,gte:()=>ir,guid:()=>rH,hash:()=>EH,hex:()=>TH,hostname:()=>kH,httpUrl:()=>cH,includes:()=>Uu,instanceof:()=>oW,int:()=>uI,int32:()=>PH,int64:()=>NH,intersection:()=>Qp,ipv4:()=>gH,ipv6:()=>yH,iso:()=>il,json:()=>sW,jwt:()=>IH,keyof:()=>FH,ksuid:()=>hH,lazy:()=>MM,length:()=>Sa,literal:()=>se,locales:()=>Ou,looseObject:()=>un,lowercase:()=>Du,lt:()=>_o,lte:()=>zr,mac:()=>_H,map:()=>qH,maxLength:()=>Ia,maxSize:()=>$a,meta:()=>nW,mime:()=>Zu,minLength:()=>Qo,minSize:()=>es,multipleOf:()=>Qi,nan:()=>JH,nanoid:()=>lH,nativeEnum:()=>GH,negative:()=>hy,never:()=>EI,nonnegative:()=>_y,nonoptional:()=>TM,nonpositive:()=>gy,normalize:()=>qu,null:()=>Yp,nullable:()=>Qy,nullish:()=>HH,number:()=>We,object:()=>U,optional:()=>ie,overwrite:()=>Zn,parse:()=>X$,parseAsync:()=>Y$,partialRecord:()=>ZH,pipe:()=>ev,positive:()=>my,prefault:()=>kM,preprocess:()=>sv,prettifyError:()=>mg,promise:()=>QH,property:()=>yy,readonly:()=>RM,record:()=>bt,refine:()=>LM,regex:()=>ju,regexes:()=>Nr,registry:()=>fp,safeDecode:()=>sI,safeDecodeAsync:()=>cI,safeEncode:()=>iI,safeEncodeAsync:()=>aI,safeParse:()=>Q$,safeParseAsync:()=>eI,set:()=>VH,setErrorMap:()=>cW,size:()=>Mu,slugify:()=>Np,startsWith:()=>Fu,strictObject:()=>BH,string:()=>A,stringFormat:()=>SH,stringbool:()=>iW,success:()=>WH,superRefine:()=>UM,symbol:()=>MH,templateLiteral:()=>YH,toJSONSchema:()=>vo,toLowerCase:()=>Gu,toUpperCase:()=>Ku,transform:()=>PI,treeifyError:()=>fg,trim:()=>Vu,tuple:()=>gM,uint32:()=>CH,uint64:()=>zH,ulid:()=>fH,undefined:()=>jH,union:()=>tt,unknown:()=>ft,uppercase:()=>Lu,url:()=>aH,util:()=>M,uuid:()=>nH,uuidv4:()=>oH,uuidv6:()=>iH,uuidv7:()=>sH,void:()=>LH,xid:()=>mH});var il={};gi(il,{ZodISODate:()=>Wy,ZodISODateTime:()=>Hy,ZodISODuration:()=>Xy,ZodISOTime:()=>Jy,date:()=>H$,datetime:()=>K$,duration:()=>J$,time:()=>W$});var Hy=$("ZodISODateTime",(t,e)=>{Bg.init(t,e),et.init(t,e)});function K$(t){return Z_(Hy,t)}var Wy=$("ZodISODate",(t,e)=>{Zg.init(t,e),et.init(t,e)});function H$(t){return q_(Wy,t)}var Jy=$("ZodISOTime",(t,e)=>{qg.init(t,e),et.init(t,e)});function W$(t){return V_(Jy,t)}var Xy=$("ZodISODuration",(t,e)=>{Vg.init(t,e),et.init(t,e)});function J$(t){return G_(Xy,t)}var nM=(t,e)=>{np.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>vu(t,r)},flatten:{value:r=>yu(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,hu,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,hu,2)}},isEmpty:{get(){return t.issues.length===0}}})},QK=$("ZodError",nM),Lr=$("ZodError",nM,{Parent:Error});var X$=bu(Lr),Y$=wu(Lr),Q$=xu(Lr),eI=$u(Lr),tI=hg(Lr),rI=gg(Lr),nI=_g(Lr),oI=yg(Lr),iI=vg(Lr),sI=bg(Lr),aI=wg(Lr),cI=xg(Lr);var Ae=$("ZodType",(t,e)=>(ye.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(M.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>Qe(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>X$(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Q$(t,r,n),t.parseAsync=async(r,n)=>Y$(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>eI(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>tI(t,r,n),t.decode=(r,n)=>rI(t,r,n),t.encodeAsync=async(r,n)=>nI(t,r,n),t.decodeAsync=async(r,n)=>oI(t,r,n),t.safeEncode=(r,n)=>iI(t,r,n),t.safeDecode=(r,n)=>sI(t,r,n),t.safeEncodeAsync=async(r,n)=>aI(t,r,n),t.safeDecodeAsync=async(r,n)=>cI(t,r,n),t.refine=(r,n)=>t.check(LM(r,n)),t.superRefine=r=>t.check(UM(r)),t.overwrite=r=>t.check(Zn(r)),t.optional=()=>ie(t),t.nullable=()=>Qy(t),t.nullish=()=>ie(Qy(t)),t.nonoptional=r=>TM(t,r),t.array=()=>Re(t),t.or=r=>tt([t,r]),t.and=r=>Qp(t,r),t.transform=r=>ev(t,PI(r)),t.default=r=>IM(t,r),t.prefault=r=>kM(t,r),t.catch=r=>OM(t,r),t.pipe=r=>ev(t,r),t.readonly=()=>RM(t),t.describe=r=>{let n=t.clone();return Ge.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ge.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ge.get(t);let n=t.clone();return Ge.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),lI=$("_ZodString",(t,e)=>{Yi.init(t,e),Ae.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(ju(...n)),t.includes=(...n)=>t.check(Uu(...n)),t.startsWith=(...n)=>t.check(Fu(...n)),t.endsWith=(...n)=>t.check(Bu(...n)),t.min=(...n)=>t.check(Qo(...n)),t.max=(...n)=>t.check(Ia(...n)),t.length=(...n)=>t.check(Sa(...n)),t.nonempty=(...n)=>t.check(Qo(1,...n)),t.lowercase=n=>t.check(Du(n)),t.uppercase=n=>t.check(Lu(n)),t.trim=()=>t.check(Vu()),t.normalize=(...n)=>t.check(qu(...n)),t.toLowerCase=()=>t.check(Gu()),t.toUpperCase=()=>t.check(Ku()),t.slugify=()=>t.check(Np())}),Kp=$("ZodString",(t,e)=>{Yi.init(t,e),lI.init(t,e),t.email=r=>t.check(mp(dI,r)),t.url=r=>t.check(Ru(tv,r)),t.jwt=r=>t.check(Rp(kI,r)),t.emoji=r=>t.check(vp(pI,r)),t.guid=r=>t.check(Cu(Yy,r)),t.uuid=r=>t.check(hp(oi,r)),t.uuidv4=r=>t.check(gp(oi,r)),t.uuidv6=r=>t.check(_p(oi,r)),t.uuidv7=r=>t.check(yp(oi,r)),t.nanoid=r=>t.check(bp(fI,r)),t.guid=r=>t.check(Cu(Yy,r)),t.cuid=r=>t.check(wp(mI,r)),t.cuid2=r=>t.check(xp(hI,r)),t.ulid=r=>t.check($p(gI,r)),t.base64=r=>t.check(Op($I,r)),t.base64url=r=>t.check(Pp(II,r)),t.xid=r=>t.check(Ip(_I,r)),t.ksuid=r=>t.check(Sp(yI,r)),t.ipv4=r=>t.check(kp(vI,r)),t.ipv6=r=>t.check(Tp(bI,r)),t.cidrv4=r=>t.check(Ep(wI,r)),t.cidrv6=r=>t.check(Ap(xI,r)),t.e164=r=>t.check(Cp(SI,r)),t.datetime=r=>t.check(K$(r)),t.date=r=>t.check(H$(r)),t.time=r=>t.check(W$(r)),t.duration=r=>t.check(J$(r))});function A(t){return L_(Kp,t)}var et=$("ZodStringFormat",(t,e)=>{He.init(t,e),lI.init(t,e)}),dI=$("ZodEmail",(t,e)=>{Rg.init(t,e),et.init(t,e)});function tH(t){return mp(dI,t)}var Yy=$("ZodGUID",(t,e)=>{Pg.init(t,e),et.init(t,e)});function rH(t){return Cu(Yy,t)}var oi=$("ZodUUID",(t,e)=>{Cg.init(t,e),et.init(t,e)});function nH(t){return hp(oi,t)}function oH(t){return gp(oi,t)}function iH(t){return _p(oi,t)}function sH(t){return yp(oi,t)}var tv=$("ZodURL",(t,e)=>{Ng.init(t,e),et.init(t,e)});function aH(t){return Ru(tv,t)}function cH(t){return Ru(tv,{protocol:/^https?$/,hostname:Nr.domain,...M.normalizeParams(t)})}var pI=$("ZodEmoji",(t,e)=>{zg.init(t,e),et.init(t,e)});function uH(t){return vp(pI,t)}var fI=$("ZodNanoID",(t,e)=>{Mg.init(t,e),et.init(t,e)});function lH(t){return bp(fI,t)}var mI=$("ZodCUID",(t,e)=>{jg.init(t,e),et.init(t,e)});function dH(t){return wp(mI,t)}var hI=$("ZodCUID2",(t,e)=>{Dg.init(t,e),et.init(t,e)});function pH(t){return xp(hI,t)}var gI=$("ZodULID",(t,e)=>{Lg.init(t,e),et.init(t,e)});function fH(t){return $p(gI,t)}var _I=$("ZodXID",(t,e)=>{Ug.init(t,e),et.init(t,e)});function mH(t){return Ip(_I,t)}var yI=$("ZodKSUID",(t,e)=>{Fg.init(t,e),et.init(t,e)});function hH(t){return Sp(yI,t)}var vI=$("ZodIPv4",(t,e)=>{Gg.init(t,e),et.init(t,e)});function gH(t){return kp(vI,t)}var oM=$("ZodMAC",(t,e)=>{Hg.init(t,e),et.init(t,e)});function _H(t){return F_(oM,t)}var bI=$("ZodIPv6",(t,e)=>{Kg.init(t,e),et.init(t,e)});function yH(t){return Tp(bI,t)}var wI=$("ZodCIDRv4",(t,e)=>{Wg.init(t,e),et.init(t,e)});function vH(t){return Ep(wI,t)}var xI=$("ZodCIDRv6",(t,e)=>{Jg.init(t,e),et.init(t,e)});function bH(t){return Ap(xI,t)}var $I=$("ZodBase64",(t,e)=>{Xg.init(t,e),et.init(t,e)});function wH(t){return Op($I,t)}var II=$("ZodBase64URL",(t,e)=>{Yg.init(t,e),et.init(t,e)});function xH(t){return Pp(II,t)}var SI=$("ZodE164",(t,e)=>{Qg.init(t,e),et.init(t,e)});function $H(t){return Cp(SI,t)}var kI=$("ZodJWT",(t,e)=>{e_.init(t,e),et.init(t,e)});function IH(t){return Rp(kI,t)}var Hp=$("ZodCustomStringFormat",(t,e)=>{t_.init(t,e),et.init(t,e)});function SH(t,e,r={}){return ka(Hp,t,e,r)}function kH(t){return ka(Hp,"hostname",Nr.hostname,t)}function TH(t){return ka(Hp,"hex",Nr.hex,t)}function EH(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=Nr[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return ka(Hp,n,o,e)}var Wp=$("ZodNumber",(t,e)=>{ap.init(t,e),Ae.init(t,e),t.gt=(n,o)=>t.check(yo(n,o)),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.lt=(n,o)=>t.check(_o(n,o)),t.lte=(n,o)=>t.check(zr(n,o)),t.max=(n,o)=>t.check(zr(n,o)),t.int=n=>t.check(uI(n)),t.safe=n=>t.check(uI(n)),t.positive=n=>t.check(yo(0,n)),t.nonnegative=n=>t.check(ir(0,n)),t.negative=n=>t.check(_o(0,n)),t.nonpositive=n=>t.check(zr(0,n)),t.multipleOf=(n,o)=>t.check(Qi(n,o)),t.step=(n,o)=>t.check(Qi(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function We(t){return K_(Wp,t)}var sl=$("ZodNumberFormat",(t,e)=>{r_.init(t,e),Wp.init(t,e)});function uI(t){return W_(sl,t)}function AH(t){return J_(sl,t)}function OH(t){return X_(sl,t)}function PH(t){return Y_(sl,t)}function CH(t){return Q_(sl,t)}var Jp=$("ZodBoolean",(t,e)=>{ku.init(t,e),Ae.init(t,e)});function Nt(t){return ey(Jp,t)}var Xp=$("ZodBigInt",(t,e)=>{cp.init(t,e),Ae.init(t,e),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.gt=(n,o)=>t.check(yo(n,o)),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.lt=(n,o)=>t.check(_o(n,o)),t.lte=(n,o)=>t.check(zr(n,o)),t.max=(n,o)=>t.check(zr(n,o)),t.positive=n=>t.check(yo(BigInt(0),n)),t.negative=n=>t.check(_o(BigInt(0),n)),t.nonpositive=n=>t.check(zr(BigInt(0),n)),t.nonnegative=n=>t.check(ir(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(Qi(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function RH(t){return ry(Xp,t)}var TI=$("ZodBigIntFormat",(t,e)=>{n_.init(t,e),Xp.init(t,e)});function NH(t){return oy(TI,t)}function zH(t){return iy(TI,t)}var iM=$("ZodSymbol",(t,e)=>{o_.init(t,e),Ae.init(t,e)});function MH(t){return sy(iM,t)}var sM=$("ZodUndefined",(t,e)=>{i_.init(t,e),Ae.init(t,e)});function jH(t){return ay(sM,t)}var aM=$("ZodNull",(t,e)=>{s_.init(t,e),Ae.init(t,e)});function Yp(t){return cy(aM,t)}var cM=$("ZodAny",(t,e)=>{a_.init(t,e),Ae.init(t,e)});function DH(){return uy(cM)}var uM=$("ZodUnknown",(t,e)=>{Tu.init(t,e),Ae.init(t,e)});function ft(){return Nu(uM)}var lM=$("ZodNever",(t,e)=>{Eu.init(t,e),Ae.init(t,e)});function EI(t){return zu(lM,t)}var dM=$("ZodVoid",(t,e)=>{c_.init(t,e),Ae.init(t,e)});function LH(t){return ly(dM,t)}var rv=$("ZodDate",(t,e)=>{u_.init(t,e),Ae.init(t,e),t.min=(n,o)=>t.check(ir(n,o)),t.max=(n,o)=>t.check(zr(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function UH(t){return dy(rv,t)}var pM=$("ZodArray",(t,e)=>{l_.init(t,e),Ae.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Qo(r,n)),t.nonempty=r=>t.check(Qo(1,r)),t.max=(r,n)=>t.check(Ia(r,n)),t.length=(r,n)=>t.check(Sa(r,n)),t.unwrap=()=>t.element});function Re(t,e){return T$(pM,t,e)}function FH(t){let e=t._zod.def.shape;return zt(Object.keys(e))}var nv=$("ZodObject",(t,e)=>{k$.init(t,e),Ae.init(t,e),M.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>zt(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ft()}),t.loose=()=>t.clone({...t._zod.def,catchall:ft()}),t.strict=()=>t.clone({...t._zod.def,catchall:EI()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>M.extend(t,r),t.safeExtend=r=>M.safeExtend(t,r),t.merge=r=>M.merge(t,r),t.pick=r=>M.pick(t,r),t.omit=r=>M.omit(t,r),t.partial=(...r)=>M.partial(CI,t,r[0]),t.required=(...r)=>M.required(RI,t,r[0])});function U(t,e){let r={type:"object",shape:t??{},...M.normalizeParams(e)};return new nv(r)}function BH(t,e){return new nv({type:"object",shape:t,catchall:EI(),...M.normalizeParams(e)})}function un(t,e){return new nv({type:"object",shape:t,catchall:ft(),...M.normalizeParams(e)})}var AI=$("ZodUnion",(t,e)=>{up.init(t,e),Ae.init(t,e),t.options=e.options});function tt(t,e){return new AI({type:"union",options:t,...M.normalizeParams(e)})}var fM=$("ZodDiscriminatedUnion",(t,e)=>{AI.init(t,e),d_.init(t,e)});function ov(t,e,r){return new fM({type:"union",options:e,discriminator:t,...M.normalizeParams(r)})}var mM=$("ZodIntersection",(t,e)=>{p_.init(t,e),Ae.init(t,e)});function Qp(t,e){return new mM({type:"intersection",left:t,right:e})}var hM=$("ZodTuple",(t,e)=>{lp.init(t,e),Ae.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});function gM(t,e,r){let n=e instanceof ye,o=n?r:e,i=n?e:null;return new hM({type:"tuple",items:t,rest:i,...M.normalizeParams(o)})}var OI=$("ZodRecord",(t,e)=>{f_.init(t,e),Ae.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function bt(t,e,r){return new OI({type:"record",keyType:t,valueType:e,...M.normalizeParams(r)})}function ZH(t,e,r){let n=Qe(t);return n._zod.values=void 0,new OI({type:"record",keyType:n,valueType:e,...M.normalizeParams(r)})}var _M=$("ZodMap",(t,e)=>{m_.init(t,e),Ae.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function qH(t,e,r){return new _M({type:"map",keyType:t,valueType:e,...M.normalizeParams(r)})}var yM=$("ZodSet",(t,e)=>{h_.init(t,e),Ae.init(t,e),t.min=(...r)=>t.check(es(...r)),t.nonempty=r=>t.check(es(1,r)),t.max=(...r)=>t.check($a(...r)),t.size=(...r)=>t.check(Mu(...r))});function VH(t,e){return new yM({type:"set",valueType:t,...M.normalizeParams(e)})}var Gp=$("ZodEnum",(t,e)=>{g_.init(t,e),Ae.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Gp({...e,checks:[],...M.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Gp({...e,checks:[],...M.normalizeParams(o),entries:i})}});function zt(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Gp({type:"enum",entries:r,...M.normalizeParams(e)})}function GH(t,e){return new Gp({type:"enum",entries:t,...M.normalizeParams(e)})}var vM=$("ZodLiteral",(t,e)=>{__.init(t,e),Ae.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function se(t,e){return new vM({type:"literal",values:Array.isArray(t)?t:[t],...M.normalizeParams(e)})}var bM=$("ZodFile",(t,e)=>{y_.init(t,e),Ae.init(t,e),t.min=(r,n)=>t.check(es(r,n)),t.max=(r,n)=>t.check($a(r,n)),t.mime=(r,n)=>t.check(Zu(Array.isArray(r)?r:[r],n))});function KH(t){return vy(bM,t)}var wM=$("ZodTransform",(t,e)=>{v_.init(t,e),Ae.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(M.issue(i,r.value,e));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(M.issue(s))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function PI(t){return new wM({type:"transform",transform:t})}var CI=$("ZodOptional",(t,e)=>{xa.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function ie(t){return new CI({type:"optional",innerType:t})}var xM=$("ZodNullable",(t,e)=>{b_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Qy(t){return new xM({type:"nullable",innerType:t})}function HH(t){return ie(Qy(t))}var $M=$("ZodDefault",(t,e)=>{w_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function IM(t,e){return new $M({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var SM=$("ZodPrefault",(t,e)=>{x_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function kM(t,e){return new SM({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var RI=$("ZodNonOptional",(t,e)=>{$_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function TM(t,e){return new RI({type:"nonoptional",innerType:t,...M.normalizeParams(e)})}var EM=$("ZodSuccess",(t,e)=>{I_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function WH(t){return new EM({type:"success",innerType:t})}var AM=$("ZodCatch",(t,e)=>{S_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function OM(t,e){return new AM({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var PM=$("ZodNaN",(t,e)=>{k_.init(t,e),Ae.init(t,e)});function JH(t){return fy(PM,t)}var NI=$("ZodPipe",(t,e)=>{T_.init(t,e),Ae.init(t,e),t.in=e.in,t.out=e.out});function ev(t,e){return new NI({type:"pipe",in:t,out:e})}var zI=$("ZodCodec",(t,e)=>{NI.init(t,e),Au.init(t,e)});function XH(t,e,r){return new zI({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var CM=$("ZodReadonly",(t,e)=>{E_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function RM(t){return new CM({type:"readonly",innerType:t})}var NM=$("ZodTemplateLiteral",(t,e)=>{A_.init(t,e),Ae.init(t,e)});function YH(t,e){return new NM({type:"template_literal",parts:t,...M.normalizeParams(e)})}var zM=$("ZodLazy",(t,e)=>{C_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.getter()});function MM(t){return new zM({type:"lazy",getter:t})}var jM=$("ZodPromise",(t,e)=>{P_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function QH(t){return new jM({type:"promise",innerType:t})}var DM=$("ZodFunction",(t,e)=>{O_.init(t,e),Ae.init(t,e)});function eW(t){return new DM({type:"function",input:Array.isArray(t?.input)?gM(t?.input):t?.input??Re(ft()),output:t?.output??ft()})}var iv=$("ZodCustom",(t,e)=>{R_.init(t,e),Ae.init(t,e)});function tW(t){let e=new Je({check:"custom"});return e._zod.check=t,e}function MI(t,e){return by(iv,t??(()=>!0),e)}function LM(t,e={}){return wy(iv,t,e)}function UM(t){return xy(t)}var rW=$y,nW=Iy;function oW(t,e={error:`Input not instance of ${t.name}`}){let r=new iv({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...M.normalizeParams(e)});return r._zod.bag.Class=t,r}var iW=(...t)=>Sy({Codec:zI,Boolean:Jp,String:Kp},...t);function sW(t){let e=MM(()=>tt([A(t),We(),Nt(),Yp(),Re(e),bt(A(),e)]));return e}function sv(t,e){return ev(PI(t),e)}var aW={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function cW(t){yt({customError:t})}function uW(){return yt().customError}var jI;jI||(jI={});var DI={};gi(DI,{bigint:()=>fW,boolean:()=>pW,date:()=>mW,number:()=>dW,string:()=>lW});function lW(t){return U_(Kp,t)}function dW(t){return H_(Wp,t)}function pW(t){return ty(Jp,t)}function fW(t){return ny(Xp,t)}function mW(t){return py(rv,t)}yt(N_());var hW=Symbol("Let zodToJsonSchema decide on which parser to use");var bW={};G(bW,{BasePromptValue:()=>cv,ChatPromptValue:()=>UI,ImagePromptValue:()=>wW,StringPromptValue:()=>LI});var cv=class extends uo{},LI=class extends cv{static lc_name(){return"StringPromptValue"}lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;value;constructor(t){super({value:t}),this.value=t}toString(){return this.value}toChatMessages(){return[new mr(this.value)]}},UI=class extends cv{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ChatPromptValue"}messages;constructor(t){Array.isArray(t)&&(t={messages:t}),super(t),this.messages=t.messages}toString(){return au(this.messages)}toChatMessages(){return this.messages}},wW=class extends cv{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ImagePromptValue"}imageUrl;value;constructor(t){"imageUrl"in t||(t={imageUrl:t}),super(t),this.imageUrl=t.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new mr({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}};var te="0123456789abcdef".split(""),xW=[-2147483648,8388608,32768,128],Hn=[24,16,8,0],uv=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Ut=[];function Wn(t,e){e?(Ut[0]=Ut[16]=Ut[1]=Ut[2]=Ut[3]=Ut[4]=Ut[5]=Ut[6]=Ut[7]=Ut[8]=Ut[9]=Ut[10]=Ut[11]=Ut[12]=Ut[13]=Ut[14]=Ut[15]=0,this.blocks=Ut):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}Wn.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if(r!=="string"){if(r==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);e=!0}for(var n,o=0,i,s=t.length,a=this.blocks;o>>2]|=t[o]<>>2]|=n<>>2]|=(192|n>>>6)<>>2]|=(128|n&63)<=57344?(a[i>>>2]|=(224|n>>>12)<>>2]|=(128|n>>>6&63)<>>2]|=(128|n&63)<>>2]|=(240|n>>>18)<>>2]|=(128|n>>>12&63)<>>2]|=(128|n>>>6&63)<>>2]|=(128|n&63)<=64?(this.block=a[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};Wn.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=xW[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}};Wn.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=this.blocks,u,l,d,f,p,m,h,_,v,b,x;for(u=16;u<64;++u)p=c[u-15],l=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=c[u-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,c[u]=c[u-16]+l+c[u-7]+d<<0;for(x=e&r,u=0;u<64;u+=4)this.first?(this.is224?(_=300032,p=c[0]-1413257819,a=p-150054599<<0,n=p+24177077<<0):(_=704751109,p=c[0]-210244248,a=p-1521486534<<0,n=p+143694565<<0),this.first=!1):(l=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),_=t&e,f=_^t&r^x,h=o&i^~o&s,p=a+d+h+uv[u]+c[u],m=l+f,a=n+p<<0,n=p+m<<0),l=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),v=n&t,f=v^n&e^_,h=s&a^~s&o,p=i+d+h+uv[u+1]+c[u+1],m=l+f,s=r+p<<0,r=p+m<<0,l=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=r&n,f=b^r&t^v,h=i&s^~i&a,p=o+d+h+uv[u+2]+c[u+2],m=l+f,i=e+p<<0,e=p+m<<0,l=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),x=e&r,f=x^e&n^b,h=i&s^~i&a,p=o+d+h+uv[u+3]+c[u+3],m=l+f,o=t+p<<0,t=p+m<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0,this.h5=this.h5+i<<0,this.h6=this.h6+s<<0,this.h7=this.h7+a<<0};Wn.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=te[t>>>28&15]+te[t>>>24&15]+te[t>>>20&15]+te[t>>>16&15]+te[t>>>12&15]+te[t>>>8&15]+te[t>>>4&15]+te[t&15]+te[e>>>28&15]+te[e>>>24&15]+te[e>>>20&15]+te[e>>>16&15]+te[e>>>12&15]+te[e>>>8&15]+te[e>>>4&15]+te[e&15]+te[r>>>28&15]+te[r>>>24&15]+te[r>>>20&15]+te[r>>>16&15]+te[r>>>12&15]+te[r>>>8&15]+te[r>>>4&15]+te[r&15]+te[n>>>28&15]+te[n>>>24&15]+te[n>>>20&15]+te[n>>>16&15]+te[n>>>12&15]+te[n>>>8&15]+te[n>>>4&15]+te[n&15]+te[o>>>28&15]+te[o>>>24&15]+te[o>>>20&15]+te[o>>>16&15]+te[o>>>12&15]+te[o>>>8&15]+te[o>>>4&15]+te[o&15]+te[i>>>28&15]+te[i>>>24&15]+te[i>>>20&15]+te[i>>>16&15]+te[i>>>12&15]+te[i>>>8&15]+te[i>>>4&15]+te[i&15]+te[s>>>28&15]+te[s>>>24&15]+te[s>>>20&15]+te[s>>>16&15]+te[s>>>12&15]+te[s>>>8&15]+te[s>>>4&15]+te[s&15];return this.is224||(c+=te[a>>>28&15]+te[a>>>24&15]+te[a>>>20&15]+te[a>>>16&15]+te[a>>>12&15]+te[a>>>8&15]+te[a>>>4&15]+te[a&15]),c};Wn.prototype.toString=Wn.prototype.hex;Wn.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=[t>>>24&255,t>>>16&255,t>>>8&255,t&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255];return this.is224||c.push(a>>>24&255,a>>>16&255,a>>>8&255,a&255),c};Wn.prototype.array=Wn.prototype.digest;Wn.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};var lv=(...t)=>new Wn(!1,!0).update(t.join("")).hex();var $W={};G($W,{sha256:()=>lv});var IW={};G(IW,{BaseCache:()=>ZM,InMemoryCache:()=>FI,defaultHashKeyEncoder:()=>BM,deserializeStoredGeneration:()=>SW,serializeGeneration:()=>kW});var BM=(...t)=>lv(t.join("_"));function SW(t){return t.message!==void 0?{text:t.text,message:Ed(t.message)}:{text:t.text}}function kW(t){let e={text:t.text};return t.message!==void 0&&(e.message=t.message.toDict()),e}var ZM=class{keyEncoder=BM;makeDefaultKeyEncoder(t){this.keyEncoder=t}},TW=new Map,FI=class qM extends ZM{cache;constructor(e){super(),this.cache=e??new Map}lookup(e,r){return Promise.resolve(this.cache.get(this.keyEncoder(e,r))??null)}async update(e,r,n){this.cache.set(this.keyEncoder(e,r),n)}static global(){return new qM(TW)}};var HM=mn(KM(),1),zW=Object.defineProperty,MW=(t,e,r)=>e in t?zW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jW=(t,e,r)=>(MW(t,typeof e!="symbol"?e+"":e,r),r);function DW(t,e){let r=Array.from({length:t.length},(n,o)=>({start:o,end:o+1}));for(;r.length>1;){let n=null;for(let o=0;oe.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function UW(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}var ZI=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(t,e){this.patStr=t.pat_str;let r=t.bpe_ranks.split(` +`).filter(Boolean).reduce((n,o)=>{let[i,s,...a]=o.split(" "),c=Number.parseInt(s,10);return a.forEach((u,l)=>n[u]=c+l),n},{});for(let[n,o]of Object.entries(r)){let i=HM.default.toByteArray(n);this.rankMap.set(i.join(","),o),this.textMap.set(o,i)}this.specialTokens={...t.special_tokens,...e},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((n,[o,i])=>(n[i]=this.textEncoder.encode(o),n),{})}encode(t,e=[],r="all"){let n=new RegExp(this.patStr,"ug"),o=ZI.specialTokenRegex(Object.keys(this.specialTokens)),i=[],s=new Set(e==="all"?Object.keys(this.specialTokens):e),a=new Set(r==="all"?Object.keys(this.specialTokens).filter(u=>!s.has(u)):r);if(a.size>0){let u=ZI.specialTokenRegex([...a]),l=t.match(u);if(l!=null)throw new Error(`The text contains a special token that is not allowed: ${l[0]}`)}let c=0;for(;;){let u=null,l=c;for(;o.lastIndex=l,u=o.exec(t),!(u==null||s.has(u[0]));)l=u.index+1;let d=u?.index??t.length;for(let p of t.substring(c,d).matchAll(n)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){i.push(h);continue}i.push(...LW(m,this.rankMap))}if(u==null)break;let f=this.specialTokens[u[0]];i.push(f),c=u.index+u[0].length}return i}decode(t){let e=[],r=0;for(let i=0;inew RegExp(t.map(e=>UW(e)).join("|"),"g"));function qI(t){switch(t){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw new Error("Unknown model")}}var FW={};G(FW,{encodingForModel:()=>mv,getEncoding:()=>WM});var fv={},BW=new Xo({});async function WM(t){return t in fv||(fv[t]=BW.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new pv(e)).catch(e=>{throw delete fv[t],e})),await fv[t]}async function mv(t){return WM(qI(t))}var ZW={};G(ZW,{BaseLangChain:()=>_v,BaseLanguageModel:()=>tf,calculateMaxTokens:()=>XM,getEmbeddingContextSize:()=>qW,getModelContextSize:()=>JM,getModelNameForTiktoken:()=>hv,isOpenAITool:()=>gv});var hv=t=>t.startsWith("gpt-5")?"gpt-5":t.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":t.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":t.startsWith("gpt-4-32k")?"gpt-4-32k":t.startsWith("gpt-4-")?"gpt-4":t.startsWith("gpt-4o")?"gpt-4o":t,qW=t=>{switch(t){case"text-embedding-ada-002":return 8191;default:return 2046}},JM=t=>{switch(hv(t)){case"gpt-5":case"gpt-5-turbo":case"gpt-5-turbo-preview":return 4e5;case"gpt-4o":case"gpt-4o-mini":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":return 128e3;case"gpt-4-turbo":case"gpt-4-turbo-preview":case"gpt-4-turbo-2024-04-09":case"gpt-4-0125-preview":case"gpt-4-1106-preview":return 128e3;case"gpt-4-32k":case"gpt-4-32k-0314":case"gpt-4-32k-0613":return 32768;case"gpt-4":case"gpt-4-0314":case"gpt-4-0613":return 8192;case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-16k-0613":return 16384;case"gpt-3.5-turbo":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-1106":case"gpt-3.5-turbo-0125":return 4096;case"text-davinci-003":case"text-davinci-002":return 4097;case"text-davinci-001":return 2049;case"text-curie-001":case"text-babbage-001":case"text-ada-001":return 2048;case"code-davinci-002":case"code-davinci-001":return 8e3;case"code-cushman-001":return 2048;case"claude-3-5-sonnet-20241022":case"claude-3-5-sonnet-20240620":case"claude-3-opus-20240229":case"claude-3-sonnet-20240229":case"claude-3-haiku-20240307":case"claude-2.1":return 2e5;case"claude-2.0":case"claude-instant-1.2":return 1e5;case"gemini-1.5-pro":case"gemini-1.5-pro-latest":case"gemini-1.5-flash":case"gemini-1.5-flash-latest":return 1e6;case"gemini-pro":case"gemini-pro-vision":return 32768;default:return 4097}};function gv(t){return typeof t!="object"||!t?!1:!!("type"in t&&t.type==="function"&&"function"in t&&typeof t.function=="object"&&t.function&&"name"in t.function&&"parameters"in t.function)}var XM=async({prompt:t,modelName:e})=>{let r;try{r=(await mv(hv(e))).encode(t).length}catch{console.warn("Failed to calculate number of tokens, falling back to approximate count"),r=Math.ceil(t.length/4)}return JM(e)-r},VW=()=>!1,_v=class extends Ze{verbose;callbacks;tags;metadata;get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(t){super(t),this.verbose=t.verbose??VW(),this.callbacks=t.callbacks,this.tags=t.tags??[],this.metadata=t.metadata??{}}},tf=class extends _v{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}caller;cache;constructor({callbacks:t,callbackManager:e,...r}){let{cache:n,...o}=r;super({callbacks:t??e,...o}),typeof n=="object"?this.cache=n:n?this.cache=FI.global():this.cache=void 0,this.caller=new Xo(r??{})}_encoding;async getNumTokens(t){let e;typeof t=="string"?e=t:e=t.map(n=>typeof n=="string"?n:n.type==="text"&&"text"in n?n.text:"").join("");let r=Math.ceil(e.length/4);if(!this._encoding)try{this._encoding=await mv("modelName"in this?hv(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(e).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(t){return typeof t=="string"?new LI(t):Array.isArray(t)?new UI(t.map(ji)):t}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:t,...e}){let r={...this._identifyingParams(),...e,_type:this._llmType(),_model:this._modelType()};return Object.entries(r).filter(([i,s])=>s!==void 0).map(([i,s])=>`${i}:${JSON.stringify(s)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(t){throw new Error("Use .toJSON() instead")}get profile(){return{}}};var ii=class extends Ze{static lc_name(){return"RunnablePassthrough"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;func;constructor(t){super(t),t&&(this.func=t.func)}async invoke(t,e){let r=Pe(e);return this.func&&await this.func(t,r),this._callWithConfig(n=>Promise.resolve(n),t,r)}async*transform(t,e){let r=Pe(e),n,o=!0;for await(let i of this._transformStreamWithConfig(t,s=>s,r))if(yield i,o)if(n===void 0)n=i;else try{n=en(n,i)}catch{n=void 0,o=!1}this.func&&n!==void 0&&await this.func(n,r)}static assign(t){return new Bp(new us({steps:t}))}};var YM=t=>t();function yv(t){let e=t.constructor;return new e({...t,content:t.contentBlocks,response_metadata:{...t.response_metadata,output_version:"v1"}})}var GW={};G(GW,{BaseChatModel:()=>vv,SimpleChatModel:()=>KW});function VI(t){let e=[];for(let r of t){let n=r;if(Array.isArray(r.content))for(let o=0;o{let r=e.outputVersion??It("LC_OUTPUT_VERSION");return r&&["v0","v1"].includes(r)?r:"v0"})}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async invoke(e,r){let n=Ga._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].message}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}async*_streamIterator(e,r){if(this._streamResponseChunks===Ga.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(e,r);else{let o=Ga._convertInputToPromptValue(e).toChatMessages(),[i,s]=this._separateRunnableConfigFromCallOptionsCompat(r),a={...i.metadata,...this.getLsParams(s)},c=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,a,this.metadata,{verbose:this.verbose}),u={options:s,invocation_params:this?.invocationParams(s),batch_size:1},l=s.outputVersion??this.outputVersion,d=await c?.handleChatModelStart(this.toJSON(),[VI(o)],i.runId,void 0,u,void 0,void 0,i.runName),f,p;try{for await(let m of this._streamResponseChunks(o,s,d?.[0])){if(m.message.id==null){let h=d?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}m.message.response_metadata={...m.generationInfo,...m.message.response_metadata},l==="v1"?yield yv(m.message):yield m.message,f?f=f.concat(m):f=m,Td(m.message)&&m.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:m.message.usage_metadata.input_tokens,completionTokens:m.message.usage_metadata.output_tokens,totalTokens:m.message.usage_metadata.total_tokens}})}}catch(m){throw await Promise.all((d??[]).map(h=>h?.handleLLMError(m))),m}await Promise.all((d??[]).map(m=>m?.handleLLMEnd({generations:[[f]],llmOutput:p})))}}getLsParams(e){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:r}}async _generateUncached(e,r,n,o){let i=e.map(f=>f.map(ji)),s;if(o!==void 0&&o.length===i.length)s=o;else{let f={...n.metadata,...this.getLsParams(r)},p=await St.configure(n.callbacks,this.callbacks,n.tags,this.tags,f,this.metadata,{verbose:this.verbose}),m={options:r,invocation_params:this?.invocationParams(r),batch_size:1};s=await p?.handleChatModelStart(this.toJSON(),i.map(VI),n.runId,void 0,m,void 0,void 0,n.runName)}let a=r.outputVersion??this.outputVersion,c=[],u=[];if(!!s?.[0].handlers.find(Od)&&!this.disableStreaming&&i.length===1&&this._streamResponseChunks!==Ga.prototype._streamResponseChunks)try{let f=await this._streamResponseChunks(i[0],r,s?.[0]),p,m;for await(let h of f){if(h.message.id==null){let _=s?.at(0)?.runId;_!=null&&h.message._updateId(`run-${_}`)}p===void 0?p=h:p=en(p,h),Td(h.message)&&h.message.usage_metadata!==void 0&&(m={tokenUsage:{promptTokens:h.message.usage_metadata.input_tokens,completionTokens:h.message.usage_metadata.output_tokens,totalTokens:h.message.usage_metadata.total_tokens}})}if(p===void 0)throw new Error("Received empty response from chat model call.");c.push([p]),await s?.[0].handleLLMEnd({generations:c,llmOutput:m})}catch(f){throw await s?.[0].handleLLMError(f),f}else{let f=await Promise.allSettled(i.map(async(p,m)=>{let h=await this._generate(p,{...r,promptIndex:m},s?.[m]);if(a==="v1")for(let _ of h.generations)_.message=yv(_.message);return h}));await Promise.all(f.map(async(p,m)=>{if(p.status==="fulfilled"){let h=p.value;for(let _ of h.generations){if(_.message.id==null){let v=s?.at(0)?.runId;v!=null&&_.message._updateId(`run-${v}`)}_.message.response_metadata={..._.generationInfo,..._.message.response_metadata}}return h.generations.length===1&&(h.generations[0].message.response_metadata={...h.llmOutput,...h.generations[0].message.response_metadata}),c[m]=h.generations,u[m]=h.llmOutput,s?.[m]?.handleLLMEnd({generations:[h.generations],llmOutput:h.llmOutput})}else return await s?.[m]?.handleLLMError(p.reason),Promise.reject(p.reason)}))}let d={generations:c,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(d,ya,{value:s?{runIds:s?.map(f=>f.runId)}:void 0,configurable:!0}),d}async _generateCached({messages:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i}){let s=e.map(v=>v.map(ji)),a={...i.metadata,...this.getLsParams(o)},c=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,a,this.metadata,{verbose:this.verbose}),u={options:o,invocation_params:this?.invocationParams(o),batch_size:1},l=await c?.handleChatModelStart(this.toJSON(),s.map(VI),i.runId,void 0,u,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(s.map(async(v,b)=>{let x=Ga._convertInputToPromptValue(v).toString(),k=await r.lookup(x,n);return k==null&&d.push(b),k}))).map((v,b)=>({result:v,runManager:l?.[b]})).filter(({result:v})=>v.status==="fulfilled"&&v.value!=null||v.status==="rejected"),m=o.outputVersion??this.outputVersion,h=[];await Promise.all(p.map(async({result:v,runManager:b},x)=>{if(v.status==="fulfilled"){let k=v.value;return h[x]=k.map(T=>("message"in T&&Yr(T.message)&&aa(T.message)&&(T.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},m==="v1"&&(T.message=yv(T.message))),T.generationInfo={...T.generationInfo,tokenUsage:{}},T)),k.length&&await b?.handleLLMNewToken(k[0].text),b?.handleLLMEnd({generations:[k]},void 0,void 0,void 0,{cached:!0})}else return await b?.handleLLMError(v.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(v.reason)}));let _={generations:h,missingPromptIndices:d,startedRunManagers:l};return Object.defineProperty(_,ya,{value:l?{runIds:l?.map(v=>v.runId)}:void 0,configurable:!0}),_}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(m=>m.map(ji)),[s,a]=this._separateRunnableConfigFromCallOptionsCompat(o);if(s.callbacks=s.callbacks??n,!this.cache)return this._generateUncached(i,a,s);let{cache:c}=this,u=this._getSerializedCacheKeyParametersForCall(a),{generations:l,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:i,cache:c,llmStringKey:u,parsedOptions:a,handledOptions:s}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>i[h]),a,s,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,_)=>{let v=d[_];l[v]=h;let b=Ga._convertInputToPromptValue(i[v]).toString();return c.update(b,u,h)})),p=m.llmOutput??{}}return{generations:l,llmOutput:p}}invocationParams(e){return{}}_modelType(){return"base_chat_model"}async generatePrompt(e,r,n){let o=e.map(i=>i.toChatMessages());return this.generate(o,r,n)}withStructuredOutput(e,r){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(r?.strict)throw new Error('"strict" mode is not supported for this model by default.');let n=e,o=r?.name,i=rs(n)??"A function available to call.",s=r?.method,a=r?.includeRaw;if(s==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let c=o??"extract",u;on(n)?u=[{type:"function",function:{name:c,description:i,parameters:an(n)}}]:("name"in n&&(c=n.name),u=[{type:"function",function:{name:c,description:i,parameters:n}}]);let l=this.bindTools(u),d=Dr.from(h=>{if(!Dt.isInstance(h))throw new Error("Input is not an AIMessageChunk.");if(!h.tool_calls||h.tool_calls.length===0)throw new Error("No tool calls found in the response.");let _=h.tool_calls.find(v=>v.name===c);if(!_)throw new Error(`No tool call found with name ${c}.`);return _.args});if(!a)return l.pipe(d).withConfig({runName:"StructuredOutput"});let f=ii.assign({parsed:(h,_)=>d.invoke(h.raw,_)}),p=ii.assign({parsed:()=>null}),m=f.withFallbacks({fallbacks:[p]});return cs.from([{raw:l},m]).withConfig({runName:"StructuredOutputRunnable"})}},KW=class extends vv{async _generate(t,e,r){let n=await this._call(t,e,r),o=new jt(n);if(typeof o.content!="string")throw new Error("Cannot generate with a simple chat model when output is not a string.");return{generations:[{text:o.content,message:o}]}}};var QM=class extends Ze{static lc_name(){return"RouterRunnable"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnables;constructor(t){super(t),this.runnables=t.runnables}async invoke(t,e){let{key:r,input:n}=t,o=this.runnables[r];if(o===void 0)throw new Error(`No runnable associated with key "${r}".`);return o.invoke(n,Pe(e))}async batch(t,e,r){let n=t.map(d=>d.key),o=t.map(d=>d.input);if(n.find(d=>this.runnables[d]===void 0)!==void 0)throw new Error("One or more keys do not have a corresponding runnable.");let s=n.map(d=>this.runnables[d]),a=this._getOptionsList(e??{},t.length),c=a[0]?.maxConcurrency??r?.maxConcurrency,u=c&&c>0?c:t.length,l=[];for(let d=0;ds[h].invoke(m,a[h])),p=await Promise.all(f);l.push(p)}return l.flat()}async stream(t,e){let{key:r,input:n}=t,o=this.runnables[r];if(o===void 0)throw new Error(`No runnable associated with key "${r}".`);return o.stream(n,e)}};var ej=class extends Ze{static lc_name(){return"RunnableBranch"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;default;branches;constructor(t){super(t),this.branches=t.branches,this.default=t.default}static from(t){if(t.length<1)throw new Error("RunnableBranch requires at least one branch");let r=t.slice(0,-1).map(([o,i])=>[cn(o),cn(i)]),n=cn(t[t.length-1]);return new this({branches:r,default:n})}async _invoke(t,e,r){let n;for(let o=0;othis._enterHistory(i,s??{})).withConfig({runName:"loadHistory"}),r=t.historyMessagesKey??t.inputMessagesKey;r&&(e=ii.assign({[r]:e}).withConfig({runName:"insertHistory"}));let n=e.pipe(t.runnable.withListeners({onEnd:(i,s)=>this._exitHistory(i,s??{})})).withConfig({runName:"RunnableWithMessageHistory"}),o=t.config??{};super({...t,config:o,bound:n}),this.runnable=t.runnable,this.getMessageHistory=t.getMessageHistory,this.inputMessagesKey=t.inputMessagesKey,this.outputMessagesKey=t.outputMessagesKey,this.historyMessagesKey=t.historyMessagesKey}_getInputMessages(t){let e;if(typeof t=="object"&&!Array.isArray(t)&&!Yr(t)){let r;this.inputMessagesKey?r=this.inputMessagesKey:Object.keys(t).length===1?r=Object.keys(t)[0]:r="input",Array.isArray(t[r])&&Array.isArray(t[r][0])?e=t[r][0]:e=t[r]}else e=t;if(typeof e=="string")return[new mr(e)];if(Array.isArray(e))return e;if(Yr(e))return[e];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. +Got ${JSON.stringify(e,null,2)}`)}_getOutputMessages(t){let e;if(!Array.isArray(t)&&!Yr(t)&&typeof t!="string"){let r;this.outputMessagesKey!==void 0?r=this.outputMessagesKey:Object.keys(t).length===1?r=Object.keys(t)[0]:r="output",t.generations!==void 0?e=t.generations[0][0].message:e=t[r]}else e=t;if(typeof e=="string")return[new jt(e)];if(Array.isArray(e))return e;if(Yr(e))return[e];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. Received: ${JSON.stringify(e,null,2)}`)}async _enterHistory(t,e){let n=await(e?.configurable?.messageHistory).getMessages();return this.historyMessagesKey===void 0?n.concat(this._getInputMessages(t)):n}async _exitHistory(t,e){let r=e.configurable?.messageHistory,n;Array.isArray(t.inputs)&&Array.isArray(t.inputs[0])?n=t.inputs[0]:n=t.inputs;let o=this._getInputMessages(n);if(this.historyMessagesKey===void 0){let a=await r.getMessages();o=o.slice(a.length)}let i=t.outputs;if(!i)throw new Error(`Output values from 'Run' undefined. Run: ${JSON.stringify(t,null,2)}`);let s=this._getOutputMessages(i);await r.addMessages([...o,...s])}async _mergeConfig(...t){let e=await super._mergeConfig(...t);if(!e.configurable||!e.configurable.sessionId){let n={[this.inputMessagesKey??"input"]:"foo"},o={configurable:{sessionId:"123"}};throw new Error(`sessionId is required. Pass it in as part of the config argument to .invoke() or .stream() +eg. chain.invoke(${JSON.stringify(n)}, ${JSON.stringify(o)})`)}let{sessionId:r}=e.configurable;return e.configurable.messageHistory=await this.getMessageHistory(r),e}};var HW={};G(HW,{RouterRunnable:()=>QM,Runnable:()=>Ze,RunnableAssign:()=>Bp,RunnableBinding:()=>as,RunnableBranch:()=>ej,RunnableEach:()=>j1,RunnableLambda:()=>Dr,RunnableMap:()=>us,RunnableParallel:()=>B1,RunnablePassthrough:()=>ii,RunnablePick:()=>q$,RunnableRetry:()=>Gy,RunnableSequence:()=>cs,RunnableToolLike:()=>Vy,RunnableWithFallbacks:()=>Z$,RunnableWithMessageHistory:()=>tj,_coerceToRunnable:()=>cn,ensureConfig:()=>Pe,getCallbackManagerForConfig:()=>or,mergeConfigs:()=>ga,patchConfig:()=>Ve,pickRunnableConfigKeys:()=>vr,raceWithSignal:()=>vn});var GI=class extends Ze{parseResultWithPrompt(t,e,r){return this.parseResult(t,r)}_baseMessageToString(t){return typeof t.content=="string"?t.content:this._baseMessageContentToString(t.content)}_baseMessageContentToString(t){return JSON.stringify(t)}async invoke(t,e){return typeof t=="string"?this._callWithConfig(async(r,n)=>this.parseResult([{text:r}],n?.callbacks),t,{...e,runType:"parser"}):this._callWithConfig(async(r,n)=>this.parseResult([{message:r,text:this._baseMessageToString(r)}],n?.callbacks),t,{...e,runType:"parser"})}},Ka=class extends GI{parseResult(t,e){return this.parse(t[0].text,e)}async parseWithPrompt(t,e,r){return this.parse(t,r)}_type(){throw new Error("_type not implemented")}},ln=class extends Error{llmOutput;observation;sendToLLM;constructor(t,e,r,n=!1){if(super(t),this.llmOutput=e,this.observation=r,this.sendToLLM=n,n&&(r===void 0||e===void 0))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");uh(this,"OUTPUT_PARSING_FAILURE")}};var si=class extends Ka{async*_transform(t){for await(let e of t)typeof e=="string"?yield this.parseResult([{text:e}]):yield this.parseResult([{message:e,text:this._baseMessageToString(e)}])}async*transform(t,e){yield*this._transformStreamWithConfig(t,this._transform.bind(this),{...e,runType:"parser"})}},ls=class extends si{diff=!1;constructor(t){super(t),this.diff=t?.diff??this.diff}async*_transform(t){let e,r;for await(let n of t){if(typeof n!="string"&&typeof n.content!="string")throw new Error("Cannot handle non-string output.");let o;if(iu(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");o=new Vi({message:n,text:n.content})}else if(Yr(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");o=new Vi({message:ca(n),text:n.content})}else o=new go({text:n});r===void 0?r=o:r=r.concat(o);let i=await this.parsePartialResult([r]);i!=null&&!$o(i,e)&&(this.diff?yield this._diff(e,i):yield i,e=i)}}getFormatInstructions(){return""}};var WW={};G(WW,{applyPatch:()=>qi,compare:()=>mu});var KI=class extends ls{static lc_name(){return"JsonOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_concatOutputChunks(t,e){return this.diff?super._concatOutputChunks(t,e):e}_diff(t,e){if(e)return t?mu(t,e):[{op:"replace",path:"",value:e}]}async parsePartialResult(t){return kd(t[0].text)}async parse(t){return kd(t,JSON.parse)}getFormatInstructions(){return""}};var rj=class extends si{static lc_name(){return"BytesOutputParser"}lc_namespace=["langchain_core","output_parsers","bytes"];lc_serializable=!0;textEncoder=new TextEncoder;parse(t){return Promise.resolve(this.textEncoder.encode(t))}getFormatInstructions(){return""}};var al=class extends si{re;async*_transform(t){let e="";for await(let r of t)if(typeof r=="string"?e+=r:e+=r.content,this.re){let n=[...e.matchAll(this.re)];if(n.length>1){let o=0;for(let i of n.slice(0,-1))yield[i[1]],o+=(i.index??0)+i[0].length;e=e.slice(o)}}else{let n=await this.parse(e);if(n.length>1){for(let o of n.slice(0,-1))yield[o];e=n[n.length-1]}}for(let r of await this.parse(e))yield[r]}},nj=class extends al{static lc_name(){return"CommaSeparatedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;async parse(t){try{return t.trim().split(",").map(e=>e.trim())}catch{throw new ln(`Could not parse output: ${t}`,t)}}getFormatInstructions(){return"Your response should be a list of comma separated values, eg: `foo, bar, baz`"}},oj=class extends al{lc_namespace=["langchain_core","output_parsers","list"];length;separator;constructor({length:t,separator:e}){super(...arguments),this.length=t,this.separator=e||","}async parse(t){try{let e=t.trim().split(this.separator).map(r=>r.trim());if(this.length!==void 0&&e.length!==this.length)throw new ln(`Incorrect number of items. Expected ${this.length}, got ${e.length}.`);return e}catch(e){throw Object.getPrototypeOf(e)===ln.prototype?e:new ln(`Could not parse output: ${t}`)}}getFormatInstructions(){return`Your response should be a list of ${this.length===void 0?"":`${this.length} `}items separated by "${this.separator}" (eg: \`foo${this.separator} bar${this.separator} baz\`)`}},ij=class extends al{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example: + +1. foo + +2. bar + +3. baz`}re=/\d+\.\s([^\n]+)/g;async parse(t){return[...t.matchAll(this.re)??[]].map(e=>e[1])}},sj=class extends al{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example: + +1. foo + +2. bar + +3. baz`}re=/^\s*[-*]\s([^\n]+)$/gm;async parse(t){return[...t.matchAll(this.re)??[]].map(e=>e[1])}};var aj=class extends si{static lc_name(){return"StrOutputParser"}lc_namespace=["langchain_core","output_parsers","string"];lc_serializable=!0;parse(t){return Promise.resolve(t)}getFormatInstructions(){return""}_textContentToString(t){return t.text}_imageUrlContentToString(t){throw new Error('Cannot coerce a multimodal "image_url" message part into a string.')}_messageContentToString(t){switch(t.type){case"text":case"text_delta":if("text"in t)return this._textContentToString(t);break;case"image_url":if("image_url"in t)return this._imageUrlContentToString(t);break;default:throw new Error(`Cannot coerce "${t.type}" message part into a string.`)}throw new Error(`Invalid content type: ${t.type}`)}_baseMessageContentToString(t){return t.reduce((e,r)=>e+this._messageContentToString(r),"")}};var bv=class extends Ka{static lc_name(){return"StructuredOutputParser"}lc_namespace=["langchain","output_parsers","structured"];toJSON(){return this.toJSONNotImplemented()}constructor(t){super(t),this.schema=t}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=$r.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,$r.string().describe(n)])));return new this(e)}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance. + +"JSON Schema" is a declarative language that allows you to annotate and validate JSON documents. + +For example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}} +would match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings. +Thus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted. + +Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas! + +Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock: +\`\`\`json +${JSON.stringify(an(this.schema))} +\`\`\` +`}async parse(t){try{let e=t.trim(),n=(e.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||e.match(/```json\s*([\s\S]*?)```/)?.[1]||e).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(o,i)=>`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await ts(this.schema,JSON.parse(n))}catch(e){throw new ln(`Failed to parse. Text: "${t}". Error: ${e}`,t)}}},HI=class extends bv{static lc_name(){return"JsonMarkdownStructuredOutputParser"}getFormatInstructions(t){let e=t?.interpolationDepth??1;if(e<1)throw new Error("f string interpolation depth must be at least 1");return`Return a markdown code snippet with a JSON object formatted to look like: +\`\`\`json +${this._schemaToInstruction(an(this.schema)).replaceAll("{","{".repeat(e)).replaceAll("}","}".repeat(e))} +\`\`\``}_schemaToInstruction(t,e=2){let r=t;if("type"in r){let n=!1,o;if(Array.isArray(r.type)){let a=r.type.findIndex(c=>c==="null");a!==-1&&(n=!0,r.type.splice(a,1)),o=r.type.join(" | ")}else o=r.type;if(r.type==="object"&&r.properties){let a=r.description?` // ${r.description}`:"";return`{ +${Object.entries(r.properties).map(([u,l])=>{let d=r.required?.includes(u)?"":" (optional)";return`${" ".repeat(e)}"${u}": ${this._schemaToInstruction(l,e+2)}${d}`}).join(` +`)} +${" ".repeat(e-2)}}${a}`}if(r.type==="array"&&r.items){let a=r.description?` // ${r.description}`:"";return`array[ +${" ".repeat(e)}${this._schemaToInstruction(r.items,e+2)} +${" ".repeat(e-2)}] ${a}`}let i=n?" (nullable)":"",s=r.description?` // ${r.description}`:"";return`${o}${s}${i}`}if("anyOf"in r)return r.anyOf.map(n=>this._schemaToInstruction(n,e)).join(` +${" ".repeat(e-2)}`);throw new Error("unsupported schema type")}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=$r.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,$r.string().describe(n)])));return new this(e)}},cj=class extends Ka{structuredInputParser;constructor({inputSchema:t}){super(...arguments),this.structuredInputParser=new HI(t)}async parse(t){let e;try{e=await this.structuredInputParser.parse(t)}catch(r){throw new ln(`Failed to parse. Text: "${t}". Error: ${r}`,t)}return this.outputProcessor(e)}getFormatInstructions(){return this.structuredInputParser.getFormatInstructions()}};var JW=function(){let t={};t.parser=function(y,g){return new r(y,g)},t.SAXParser=r,t.SAXStream=u,t.createStream=c,t.MAX_BUFFER_LENGTH=65536;let e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(y,g){if(!(this instanceof r))return new r(y,g);var R=this;o(R),R.q=R.c="",R.bufferCheckPosition=t.MAX_BUFFER_LENGTH,R.opt=g||{},R.opt.lowercase=R.opt.lowercase||R.opt.lowercasetags,R.looseCase=R.opt.lowercase?"toLowerCase":"toUpperCase",R.tags=[],R.closed=R.closedRoot=R.sawRoot=!1,R.tag=R.error=null,R.strict=!!y,R.noscript=!!(y||R.opt.noscript),R.state=w.BEGIN,R.strictEntities=R.opt.strictEntities,R.ENTITIES=R.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),R.attribList=[],R.opt.xmlns&&(R.ns=Object.create(m)),R.trackPosition=R.opt.position!==!1,R.trackPosition&&(R.position=R.line=R.column=0),oe(R,"onready")}Object.create||(Object.create=function(y){function g(){}g.prototype=y;var R=new g;return R}),Object.keys||(Object.keys=function(y){var g=[];for(var R in y)y.hasOwnProperty(R)&&g.push(R);return g});function n(y){for(var g=Math.max(t.MAX_BUFFER_LENGTH,10),R=0,I=0,ze=e.length;Ig)switch(e[I]){case"textNode":wt(y);break;case"cdata":Q(y,"oncdata",y.cdata),y.cdata="";break;case"script":Q(y,"onscript",y.script),y.script="";break;default:pn(y,"Max buffer length exceeded: "+e[I])}R=Math.max(R,Ye)}var it=t.MAX_BUFFER_LENGTH-R;y.bufferCheckPosition=it+y.position}function o(y){for(var g=0,R=e.length;g"||x(y)}function F(y,g){return y.test(g)}function J(y,g){return!F(y,g)}var w=0;t.STATE={BEGIN:w++,BEGIN_WHITESPACE:w++,TEXT:w++,TEXT_ENTITY:w++,OPEN_WAKA:w++,SGML_DECL:w++,SGML_DECL_QUOTED:w++,DOCTYPE:w++,DOCTYPE_QUOTED:w++,DOCTYPE_DTD:w++,DOCTYPE_DTD_QUOTED:w++,COMMENT_STARTING:w++,COMMENT:w++,COMMENT_ENDING:w++,COMMENT_ENDED:w++,CDATA:w++,CDATA_ENDING:w++,CDATA_ENDING_2:w++,PROC_INST:w++,PROC_INST_BODY:w++,PROC_INST_ENDING:w++,OPEN_TAG:w++,OPEN_TAG_SLASH:w++,ATTRIB:w++,ATTRIB_NAME:w++,ATTRIB_NAME_SAW_WHITE:w++,ATTRIB_VALUE:w++,ATTRIB_VALUE_QUOTED:w++,ATTRIB_VALUE_CLOSED:w++,ATTRIB_VALUE_UNQUOTED:w++,ATTRIB_VALUE_ENTITY_Q:w++,ATTRIB_VALUE_ENTITY_U:w++,CLOSE_TAG:w++,CLOSE_TAG_SAW_WHITE:w++,SCRIPT:w++,SCRIPT_ENDING:w++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(y){var g=t.ENTITIES[y],R=typeof g=="number"?String.fromCharCode(g):g;t.ENTITIES[y]=R});for(var Z in t.STATE)t.STATE[t.STATE[Z]]=Z;w=t.STATE;function oe(y,g,R){y[g]&&y[g](R)}function Q(y,g,R){y.textNode&&wt(y),oe(y,g,R)}function wt(y){y.textNode=dn(y.opt,y.textNode),y.textNode&&oe(y,"ontext",y.textNode),y.textNode=""}function dn(y,g){return y.trim&&(g=g.trim()),y.normalize&&(g=g.replace(/\s+/g," ")),g}function pn(y,g){return wt(y),y.trackPosition&&(g+=` +Line: `+y.line+` +Column: `+y.column+` +Char: `+y.c),g=new Error(g),y.error=g,oe(y,"onerror",g),y}function No(y){return y.sawRoot&&!y.closedRoot&&qe(y,"Unclosed root tag"),y.state!==w.BEGIN&&y.state!==w.BEGIN_WHITESPACE&&y.state!==w.TEXT&&pn(y,"Unexpected end"),wt(y),y.c="",y.closed=!0,oe(y,"onend"),r.call(y,y.strict,y.opt),y}function qe(y,g){if(typeof y!="object"||!(y instanceof r))throw new Error("bad call to strictFail");y.strict&&pn(y,g)}function Ul(y){y.strict||(y.tagName=y.tagName[y.looseCase]());var g=y.tags[y.tags.length-1]||y,R=y.tag={name:y.tagName,attributes:{}};y.opt.xmlns&&(R.ns=g.ns),y.attribList.length=0,Q(y,"onopentagstart",R)}function Ss(y,g){var R=y.indexOf(":"),I=R<0?["",y]:y.split(":"),ze=I[0],Ye=I[1];return g&&y==="xmlns"&&(ze="xmlns",Ye=""),{prefix:ze,local:Ye}}function ks(y){if(y.strict||(y.attribName=y.attribName[y.looseCase]()),y.attribList.indexOf(y.attribName)!==-1||y.tag.attributes.hasOwnProperty(y.attribName)){y.attribName=y.attribValue="";return}if(y.opt.xmlns){var g=Ss(y.attribName,!0),R=g.prefix,I=g.local;if(R==="xmlns")if(I==="xml"&&y.attribValue!==f)qe(y,"xml: prefix must be bound to "+f+` +Actual: `+y.attribValue);else if(I==="xmlns"&&y.attribValue!==p)qe(y,"xmlns: prefix must be bound to "+p+` +Actual: `+y.attribValue);else{var ze=y.tag,Ye=y.tags[y.tags.length-1]||y;ze.ns===Ye.ns&&(ze.ns=Object.create(Ye.ns)),ze.ns[I]=y.attribValue}y.attribList.push([y.attribName,y.attribValue])}else y.tag.attributes[y.attribName]=y.attribValue,Q(y,"onattribute",{name:y.attribName,value:y.attribValue});y.attribName=y.attribValue=""}function Pn(y,g){if(y.opt.xmlns){var R=y.tag,I=Ss(y.tagName);R.prefix=I.prefix,R.local=I.local,R.uri=R.ns[I.prefix]||"",R.prefix&&!R.uri&&(qe(y,"Unbound namespace prefix: "+JSON.stringify(y.tagName)),R.uri=I.prefix);var ze=y.tags[y.tags.length-1]||y;R.ns&&ze.ns!==R.ns&&Object.keys(R.ns).forEach(function(Ts){Q(y,"onopennamespace",{prefix:Ts,uri:R.ns[Ts]})});for(var Ye=0,it=y.attribList.length;Ye",y.tagName="",y.state=w.SCRIPT;return}Q(y,"onscript",y.script),y.script=""}var g=y.tags.length,R=y.tagName;y.strict||(R=R[y.looseCase]());for(var I=R;g--;){var ze=y.tags[g];if(ze.name!==I)qe(y,"Unexpected close tag");else break}if(g<0){qe(y,"Unmatched closing tag: "+y.tagName),y.textNode+="",y.state=w.TEXT;return}y.tagName=R;for(var Ye=y.tags.length;Ye-- >g;){var it=y.tag=y.tags.pop();y.tagName=y.tag.name,Q(y,"onclosetag",y.tagName);var Tt={};for(var Bt in it.ns)Tt[Bt]=it.ns[Bt];var Rn=y.tags[y.tags.length-1]||y;y.opt.xmlns&&it.ns!==Rn.ns&&Object.keys(it.ns).forEach(function(ht){var fn=it.ns[ht];Q(y,"onclosenamespace",{prefix:ht,uri:fn})})}g===0&&(y.closedRoot=!0),y.tagName=y.attribValue=y.attribName="",y.attribList.length=0,y.state=w.TEXT}function Fl(y){var g=y.entity,R=g.toLowerCase(),I,ze="";return y.ENTITIES[g]?y.ENTITIES[g]:y.ENTITIES[R]?y.ENTITIES[R]:(g=R,g.charAt(0)==="#"&&(g.charAt(1)==="x"?(g=g.slice(2),I=parseInt(g,16),ze=I.toString(16)):(g=g.slice(1),I=parseInt(g,10),ze=I.toString(10))),g=g.replace(/^0+/,""),isNaN(I)||ze.toLowerCase()!==g?(qe(y,"Invalid character entity"),"&"+y.entity+";"):String.fromCodePoint(I))}function Bl(y,g){g==="<"?(y.state=w.OPEN_WAKA,y.startTagPosition=y.position):x(g)||(qe(y,"Non-whitespace before first tag."),y.textNode=g,y.state=w.TEXT)}function Zl(y,g){var R="";return g"?(Q(g,"onsgmldeclaration",g.sgmlDecl),g.sgmlDecl="",g.state=w.TEXT):(k(I)&&(g.state=w.SGML_DECL_QUOTED),g.sgmlDecl+=I);continue;case w.SGML_DECL_QUOTED:I===g.q&&(g.state=w.SGML_DECL,g.q=""),g.sgmlDecl+=I;continue;case w.DOCTYPE:I===">"?(g.state=w.TEXT,Q(g,"ondoctype",g.doctype),g.doctype=!0):(g.doctype+=I,I==="["?g.state=w.DOCTYPE_DTD:k(I)&&(g.state=w.DOCTYPE_QUOTED,g.q=I));continue;case w.DOCTYPE_QUOTED:g.doctype+=I,I===g.q&&(g.q="",g.state=w.DOCTYPE);continue;case w.DOCTYPE_DTD:g.doctype+=I,I==="]"?g.state=w.DOCTYPE:k(I)&&(g.state=w.DOCTYPE_DTD_QUOTED,g.q=I);continue;case w.DOCTYPE_DTD_QUOTED:g.doctype+=I,I===g.q&&(g.state=w.DOCTYPE_DTD,g.q="");continue;case w.COMMENT:I==="-"?g.state=w.COMMENT_ENDING:g.comment+=I;continue;case w.COMMENT_ENDING:I==="-"?(g.state=w.COMMENT_ENDED,g.comment=dn(g.opt,g.comment),g.comment&&Q(g,"oncomment",g.comment),g.comment=""):(g.comment+="-"+I,g.state=w.COMMENT);continue;case w.COMMENT_ENDED:I!==">"?(qe(g,"Malformed comment"),g.comment+="--"+I,g.state=w.COMMENT):g.state=w.TEXT;continue;case w.CDATA:I==="]"?g.state=w.CDATA_ENDING:g.cdata+=I;continue;case w.CDATA_ENDING:I==="]"?g.state=w.CDATA_ENDING_2:(g.cdata+="]"+I,g.state=w.CDATA);continue;case w.CDATA_ENDING_2:I===">"?(g.cdata&&Q(g,"oncdata",g.cdata),Q(g,"onclosecdata"),g.cdata="",g.state=w.TEXT):I==="]"?g.cdata+="]":(g.cdata+="]]"+I,g.state=w.CDATA);continue;case w.PROC_INST:I==="?"?g.state=w.PROC_INST_ENDING:x(I)?g.state=w.PROC_INST_BODY:g.procInstName+=I;continue;case w.PROC_INST_BODY:if(!g.procInstBody&&x(I))continue;I==="?"?g.state=w.PROC_INST_ENDING:g.procInstBody+=I;continue;case w.PROC_INST_ENDING:I===">"?(Q(g,"onprocessinginstruction",{name:g.procInstName,body:g.procInstBody}),g.procInstName=g.procInstBody="",g.state=w.TEXT):(g.procInstBody+="?"+I,g.state=w.PROC_INST_BODY);continue;case w.OPEN_TAG:F(_,I)?g.tagName+=I:(Ul(g),I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:(x(I)||qe(g,"Invalid character in tag name"),g.state=w.ATTRIB));continue;case w.OPEN_TAG_SLASH:I===">"?(Pn(g,!0),zo(g)):(qe(g,"Forward-slash in opening tag not followed by >"),g.state=w.ATTRIB);continue;case w.ATTRIB:if(x(I))continue;I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:F(h,I)?(g.attribName=I,g.attribValue="",g.state=w.ATTRIB_NAME):qe(g,"Invalid attribute name");continue;case w.ATTRIB_NAME:I==="="?g.state=w.ATTRIB_VALUE:I===">"?(qe(g,"Attribute without value"),g.attribValue=g.attribName,ks(g),Pn(g)):x(I)?g.state=w.ATTRIB_NAME_SAW_WHITE:F(_,I)?g.attribName+=I:qe(g,"Invalid attribute name");continue;case w.ATTRIB_NAME_SAW_WHITE:if(I==="=")g.state=w.ATTRIB_VALUE;else{if(x(I))continue;qe(g,"Attribute without value"),g.tag.attributes[g.attribName]="",g.attribValue="",Q(g,"onattribute",{name:g.attribName,value:""}),g.attribName="",I===">"?Pn(g):F(h,I)?(g.attribName=I,g.state=w.ATTRIB_NAME):(qe(g,"Invalid attribute name"),g.state=w.ATTRIB)}continue;case w.ATTRIB_VALUE:if(x(I))continue;k(I)?(g.q=I,g.state=w.ATTRIB_VALUE_QUOTED):(qe(g,"Unquoted attribute value"),g.state=w.ATTRIB_VALUE_UNQUOTED,g.attribValue=I);continue;case w.ATTRIB_VALUE_QUOTED:if(I!==g.q){I==="&"?g.state=w.ATTRIB_VALUE_ENTITY_Q:g.attribValue+=I;continue}ks(g),g.q="",g.state=w.ATTRIB_VALUE_CLOSED;continue;case w.ATTRIB_VALUE_CLOSED:x(I)?g.state=w.ATTRIB:I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:F(h,I)?(qe(g,"No whitespace between attributes"),g.attribName=I,g.attribValue="",g.state=w.ATTRIB_NAME):qe(g,"Invalid attribute name");continue;case w.ATTRIB_VALUE_UNQUOTED:if(!T(I)){I==="&"?g.state=w.ATTRIB_VALUE_ENTITY_U:g.attribValue+=I;continue}ks(g),I===">"?Pn(g):g.state=w.ATTRIB;continue;case w.CLOSE_TAG:if(g.tagName)I===">"?zo(g):F(_,I)?g.tagName+=I:g.script?(g.script+=""?zo(g):qe(g,"Invalid characters in closing tag");continue;case w.TEXT_ENTITY:case w.ATTRIB_VALUE_ENTITY_Q:case w.ATTRIB_VALUE_ENTITY_U:var it,Tt;switch(g.state){case w.TEXT_ENTITY:it=w.TEXT,Tt="textNode";break;case w.ATTRIB_VALUE_ENTITY_Q:it=w.ATTRIB_VALUE_QUOTED,Tt="attribValue";break;case w.ATTRIB_VALUE_ENTITY_U:it=w.ATTRIB_VALUE_UNQUOTED,Tt="attribValue";break}if(I===";")if(g.opt.unparsedEntities){var Bt=Fl(g);g.entity="",g.state=it,g.write(Bt)}else g[Tt]+=Fl(g),g.entity="",g.state=it;else F(g.entity.length?b:v,I)?g.entity+=I:(qe(g,"Invalid character in entity name"),g[Tt]+="&"+g.entity+I,g.entity="",g.state=it);continue;default:throw new Error(g,"Unknown state: "+g.state)}return g.position>=g.bufferCheckPosition&&n(g),g}return String.fromCodePoint||(function(){var y=String.fromCharCode,g=Math.floor,R=function(){var I=16384,ze=[],Ye,it,Tt=-1,Bt=arguments.length;if(!Bt)return"";for(var Rn="";++Tt1114111||g(ht)!==ht)throw RangeError("Invalid code point: "+ht);ht<=65535?ze.push(ht):(ht-=65536,Ye=(ht>>10)+55296,it=ht%1024+56320,ze.push(Ye,it)),(Tt+1===Bt||ze.length>I)&&(Rn+=y.apply(null,ze),ze.length=0)}return Rn};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:R,configurable:!0,writable:!0}):String.fromCodePoint=R})(),t},uj=JW();var wv=`The output should be formatted as a XML file. +1. Output should conform to the tags below. +2. If tags are not given, make them on your own. +3. Remember to always open and close all the tags. + +As an example, for the tags ["foo", "bar", "baz"]: +1. String " + + + +" is a well-formatted instance of the schema. +2. String " + + " is a badly-formatted instance. +3. String " + + +" is a badly-formatted instance. + +Here are the output tags: +\`\`\` +{tags} +\`\`\``,lj=class extends ls{tags;constructor(t){super(t),this.tags=t?.tags}static lc_name(){return"XMLOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_diff(t,e){if(e)return t?mu(t,e):[{op:"replace",path:"",value:e}]}async parsePartialResult(t){return xv(t[0].text)}async parse(t){return xv(t)}getFormatInstructions(){return!!(this.tags&&this.tags.length>0)?wv.replace("{tags}",this.tags?.join(", ")??""):wv}},XW=t=>t.split(` +`).map(e=>e.replace(/^\s+/,"")).join(` +`).trim(),dj=t=>{if(Object.keys(t).length===0)return{};let e={};return t.children.length>0?(e[t.name]=t.children.map(dj),e):(e[t.name]=t.text??void 0,e)};function xv(t){let e=XW(t),r=uj.parser(!0),n={},o=[];r.onopentag=a=>{let c={name:a.name,attributes:a.attributes,children:[],text:"",isSelfClosing:a.isSelfClosing};o.length>0?o[o.length-1].children.push(c):n=c,a.isSelfClosing||o.push(c)},r.onclosetag=()=>{if(o.length>0){let a=o.pop();o.length===0&&a&&(n=a)}},r.ontext=a=>{if(o.length>0){let c=o[o.length-1];c.text+=a}},r.onattribute=a=>{if(o.length>0){let c=o[o.length-1];c.attributes[a.name]=a.value}};let i=/```(xml)?(.*)```/s.exec(e),s=i?i[2]:e;return r.write(s).close(),n&&n.name==="?xml"&&(n=n.children[0]),dj(n)}var YW={};G(YW,{AsymmetricStructuredOutputParser:()=>cj,BaseCumulativeTransformOutputParser:()=>ls,BaseLLMOutputParser:()=>GI,BaseOutputParser:()=>Ka,BaseTransformOutputParser:()=>si,BytesOutputParser:()=>rj,CommaSeparatedListOutputParser:()=>nj,CustomListOutputParser:()=>oj,JsonMarkdownStructuredOutputParser:()=>HI,JsonOutputParser:()=>KI,ListOutputParser:()=>al,MarkdownListOutputParser:()=>sj,NumberedListOutputParser:()=>ij,OutputParserException:()=>ln,StringOutputParser:()=>aj,StructuredOutputParser:()=>bv,XMLOutputParser:()=>lj,XML_FORMAT_INSTRUCTIONS:()=>wv,parseJsonMarkdown:()=>kd,parsePartialJson:()=>sa,parseXMLMarkdown:()=>xv});function rf(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=sa(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new ln([`Function "${t.function.name}" arguments:`,"",t.function.arguments,"","are not valid JSON.",`Error: ${o.message}`].join(` +`))}let n={name:t.function.name,args:r,type:"tool_call"};return e?.returnId&&(n.id=t.id),n}function WI(t){if(t.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:t.id,type:"function",function:{name:t.name,arguments:JSON.stringify(t.args)}}}function $v(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var JI=class extends ls{static lc_name(){return"JsonOutputToolsParser"}returnId=!1;lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;constructor(t){super(t),this.returnId=t?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(t){return await this.parsePartialResult(t,!1)}async parsePartialResult(t,e=!0){let r=t[0].message,n;if(aa(r)&&r.tool_calls?.length?n=r.tool_calls.map(i=>{let{id:s,...a}=i;return this.returnId?{id:s,...a}:a}):r.additional_kwargs.tool_calls!==void 0&&(n=JSON.parse(JSON.stringify(r.additional_kwargs.tool_calls)).map(s=>rf(s,{returnId:this.returnId,partial:e}))),!n)return[];let o=[];for(let i of n)if(i!==void 0){let s={type:i.name,args:i.args,id:i.id};o.push(s)}return o}},XI=class extends JI{static lc_name(){return"JsonOutputKeyToolsParser"}lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(t){super(t),this.keyName=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){if(this.zodSchema===void 0)return t;let e=await Ey(this.zodSchema,t);if(e.success)return e.data;throw new ln(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(e.error?.issues)}`,JSON.stringify(t,null,2))}async parsePartialResult(t){let r=(await super.parsePartialResult(t)).filter(o=>o.type===this.keyName),n=r;if(r.length)return this.returnId||(n=r.map(o=>o.args)),this.returnSingle?n[0]:n}async parseResult(t){let r=(await super.parsePartialResult(t,!1)).filter(i=>i.type===this.keyName),n=r;return r.length?(this.returnId||(n=r.map(i=>i.args)),this.returnSingle?this._validateResult(n[0]):await Promise.all(n.map(i=>this._validateResult(i)))):void 0}};var QW={};G(QW,{JsonOutputKeyToolsParser:()=>XI,JsonOutputToolsParser:()=>JI,convertLangChainToolCallToOpenAI:()=>WI,makeInvalidToolCall:()=>$v,parseToolCall:()=>rf});var p8={};G(p8,{BaseLLM:()=>tS,LLM:()=>f8});var tS=class of extends tf{lc_namespace=["langchain","llms",this._llmType()];async invoke(e,r){let n=of._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].text}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async*_streamIterator(e,r){if(this._streamResponseChunks===of.prototype._streamResponseChunks)yield this.invoke(e,r);else{let n=of._convertInputToPromptValue(e),[o,i]=this._separateRunnableConfigFromCallOptionsCompat(r),s=await St.configure(o.callbacks,this.callbacks,o.tags,this.tags,o.metadata,this.metadata,{verbose:this.verbose}),a={options:i,invocation_params:this?.invocationParams(i),batch_size:1},c=await s?.handleLLMStart(this.toJSON(),[n.toString()],o.runId,void 0,a,void 0,void 0,o.runName),u=new go({text:""});try{for await(let l of this._streamResponseChunks(n.toString(),i,c?.[0]))u?u=u.concat(l):u=l,typeof l.text=="string"&&(yield l.text)}catch(l){throw await Promise.all((c??[]).map(d=>d?.handleLLMError(l))),l}await Promise.all((c??[]).map(l=>l?.handleLLMEnd({generations:[[u]]})))}}async generatePrompt(e,r,n){let o=e.map(i=>i.toString());return this.generate(o,r,n)}invocationParams(e){return{}}_flattenLLMResult(e){let r=[];for(let n=0;nd?.handleLLMError(l))),l}let u=this._flattenLLMResult(a);await Promise.all((i??[]).map((l,d)=>l?.handleLLMEnd(u[d])))}let c=i?.map(u=>u.runId)||void 0;return Object.defineProperty(a,ya,{value:c?{runIds:c}:void 0,configurable:!0}),a}async _generateCached({prompts:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i,runId:s}){let a=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,i.metadata,this.metadata,{verbose:this.verbose}),c={options:o,invocation_params:this?.invocationParams(o),batch_size:e.length},u=await a?.handleLLMStart(this.toJSON(),e,s,void 0,c,void 0,void 0,i?.runName),l=[],f=(await Promise.allSettled(e.map(async(h,_)=>{let v=await r.lookup(h,n);return v==null&&l.push(_),v}))).map((h,_)=>({result:h,runManager:u?.[_]})).filter(({result:h})=>h.status==="fulfilled"&&h.value!=null||h.status==="rejected"),p=[];await Promise.all(f.map(async({result:h,runManager:_},v)=>{if(h.status==="fulfilled"){let b=h.value;return p[v]=b.map(x=>(x.generationInfo={...x.generationInfo,tokenUsage:{}},x)),b.length&&await _?.handleLLMNewToken(b[0].text),_?.handleLLMEnd({generations:[b]},void 0,void 0,void 0,{cached:!0})}else return await _?.handleLLMError(h.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(h.reason)}));let m={generations:p,missingPromptIndices:l,startedRunManagers:u};return Object.defineProperty(m,ya,{value:u?{runIds:u?.map(h=>h.runId)}:void 0,configurable:!0}),m}async generate(e,r,n){if(!Array.isArray(e))throw new Error("Argument 'prompts' is expected to be a string[]");let o;Array.isArray(r)?o={stop:r}:o=r;let[i,s]=this._separateRunnableConfigFromCallOptionsCompat(o);if(i.callbacks=i.callbacks??n,!this.cache)return this._generateUncached(e,s,i);let{cache:a}=this,c=this._getSerializedCacheKeyParametersForCall(s),{generations:u,missingPromptIndices:l,startedRunManagers:d}=await this._generateCached({prompts:e,cache:a,llmStringKey:c,parsedOptions:s,handledOptions:i,runId:i.runId}),f={};if(l.length>0){let p=await this._generateUncached(l.map(m=>e[m]),s,i,d!==void 0?l.map(m=>d?.[m]):void 0);await Promise.all(p.generations.map(async(m,h)=>{let _=l[h];return u[_]=m,a.update(e[_],c,m)})),f=p.llmOutput??{}}return{generations:u,llmOutput:f}}_identifyingParams(){return{}}_modelType(){return"base_llm"}},f8=class extends tS{async _generate(t,e,r){return{generations:await Promise.all(t.map((o,i)=>this._call(o,{...e,promptIndex:i},r).then(s=>[{text:s}])))}}};var m8={};G(m8,{chunkArray:()=>rS});var rS=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),s=r[i]||[];return r[i]=s.concat([n]),r},[]);var g8={};G(g8,{Embeddings:()=>nS});var nS=class{caller;constructor(t){this.caller=new Xo(t??{})}};var y8={};G(y8,{BaseToolkit:()=>v8,DynamicStructuredTool:()=>xj,DynamicTool:()=>sS,StructuredTool:()=>oS,Tool:()=>iS,ToolInputParsingException:()=>su,isLangChainTool:()=>qa,isRunnableToolLike:()=>qp,isStructuredTool:()=>Zp,isStructuredToolParams:()=>Vp,tool:()=>b8});var oS=class extends _v{extras;returnDirect=!1;verboseParsingErrors=!1;get lc_namespace(){return["langchain","tools"]}responseFormat="content";defaultConfig;constructor(t){super(t??{}),this.verboseParsingErrors=t?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=t?.responseFormat??this.responseFormat,this.defaultConfig=t?.defaultConfig??this.defaultConfig,this.metadata=t?.metadata??this.metadata,this.extras=t?.extras??this.extras}async invoke(t,e){let r,n=Pe(ga(this.defaultConfig,e));return Mi(t)?(r=t.args,n={...n,toolCall:t}):r=t,this.call(r,n)}async call(t,e,r){let n=Mi(t)?t.args:t,o;if(on(this.schema))try{o=await ts(this.schema,n)}catch(p){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m} +Details: ${p.message}`),Py(p)&&(m=`${m} + +${av.prettifyError(p)}`),new su(m,JSON.stringify(t))}else{let p=ot(n,this.schema);if(!p.valid){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m} +Details: ${p.errors.map(h=>`${h.keywordLocation}: ${h.error}`).join(` +`)}`),new su(m,JSON.stringify(t))}o=n}let i=ha(e),a=await St.configure(i.callbacks,this.callbacks,i.tags||r,this.tags,i.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof t=="string"?t:JSON.stringify(t),i.runId,void 0,void 0,void 0,i.runName);delete i.runId;let c;try{c=await this._call(o,a,i)}catch(p){throw await a?.handleToolError(p),p}let u,l;if(this.responseFormat==="content_and_artifact")if(Array.isArray(c)&&c.length===2)[u,l]=c;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple. +Result: ${JSON.stringify(c)}`);else u=c;let d;Mi(t)&&(d=t.id),!d&&nO(i)&&(d=i.toolCall.id);let f=w8({content:u,artifact:l,toolCallId:d,name:this.name,metadata:this.metadata});return await a?.handleToolEnd(f),f}},iS=class extends oS{schema=$r.object({input:$r.string().optional()}).transform(t=>t.input);constructor(t){super(t)}call(t,e){let r=typeof t=="string"||t==null?{input:t}:t;return super.call(r,e)}},sS=class extends iS{static lc_name(){return"DynamicTool"}name;description;func;constructor(t){super(t),this.name=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect}async call(t,e){let r=ha(e);return r.runName===void 0&&(r.runName=this.name),super.call(t,r)}async _call(t,e,r){return this.func(t,e,r)}},xj=class extends oS{static lc_name(){return"DynamicStructuredTool"}name;description;func;schema;constructor(t){super(t),this.name=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect,this.schema=t.schema}async call(t,e,r){let n=ha(e);return n.runName===void 0&&(n.runName=this.name),super.call(t,n,r)}_call(t,e,r){return this.func(t,e,r)}},v8=class{getTools(){return this.tools}};function b8(t,e){let r=Wu(e.schema),n=ol(e.schema);if(!e.schema||r||n)return new sS({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(s,a,c)=>new Promise((u,l)=>{let d=Ve(c,{callbacks:a?.getChild()});Lt.runWithConfig(vr(d),async()=>{try{u(t(s,d))}catch(f){l(f)}})})});let o=e.schema,i=e.description??e.schema.description??`${e.name} tool`;return new xj({...e,description:i,schema:o,func:async(s,a,c)=>new Promise((u,l)=>{let d,f=()=>{c?.signal&&d&&c.signal.removeEventListener("abort",d)};c?.signal&&(d=()=>{f(),l(Bi(c.signal))},c.signal.addEventListener("abort",d));let p=Ve(c,{callbacks:a?.getChild()});Lt.runWithConfig(vr(p),async()=>{try{let m=await t(s,p);if(c?.signal?.aborted){f();return}f(),u(m)}catch(m){f(),l(m)}})})})}function w8(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!Id(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new Or({status:"success",content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new Or({status:"success",content:x8(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function x8(t){try{return JSON.stringify(t,null,2)??""}catch{return`${t}`}}import{BedrockRuntimeClient as G1e,ConverseCommand as K1e,ConverseStreamCommand as H1e}from"@aws-sdk/client-bedrock-runtime";import{defaultProvider as Y1e}from"@aws-sdk/credential-provider-node";import{BedrockAgentRuntimeClient as lMe,RetrieveCommand as dMe}from"@aws-sdk/client-bedrock-agent-runtime";var I8={};G(I8,{BaseRetriever:()=>aS});var aS=class extends Ze{callbacks;tags;metadata;verbose;constructor(t){super(t),this.callbacks=t?.callbacks,this.tags=t?.tags??[],this.metadata=t?.metadata??{},this.verbose=t?.verbose??!1}_getRelevantDocuments(t,e){throw new Error("Not implemented!")}async invoke(t,e){let r=Pe(ha(e)),o=await(await St.configure(r.callbacks,this.callbacks,r.tags,this.tags,r.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),t,r.runId,void 0,void 0,void 0,r.runName);try{let i=await this._getRelevantDocuments(t,o);return await o?.handleRetrieverEnd(i),i}catch(i){throw await o?.handleRetrieverError(i),i}}};import{KendraClient as kMe,QueryCommand as TMe,RetrieveCommand as EMe}from"@aws-sdk/client-kendra";var cS=class{pageContent;metadata;id;constructor(t){this.pageContent=t.pageContent!==void 0?t.pageContent.toString():"",this.metadata=t.metadata??{},this.id=t.id}};var uS=class extends Ze{lc_namespace=["langchain_core","documents","transformers"];invoke(t,e){return this.transformDocuments(t)}},$j=class extends uS{async transformDocuments(t){let e=[];for(let r of t){let n=await this._transformDocument(r);e.push(n)}return e}};var S8={};G(S8,{BaseDocumentTransformer:()=>uS,Document:()=>cS,MappingDocumentTransformer:()=>$j});import{BedrockRuntimeClient as MMe,InvokeModelCommand as jMe}from"@aws-sdk/client-bedrock-runtime";var ll=class{uri;bucketOwner;constructor(e){this.uri=e.uri,e.bucketOwner!==void 0&&(this.bucketOwner=e.bucketOwner)}},sf=class{type="imageBlock";format;source;constructor(e){this.format=e.format,this.source=this._convertSource(e.source)}_convertSource(e){if("bytes"in e)return{type:"imageSourceBytes",bytes:e.bytes};if("url"in e)return{type:"imageSourceUrl",url:e.url};if("s3Location"in e)return{type:"imageSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid image source")}},af=class{type="videoBlock";format;source;constructor(e){this.format=e.format,this.source=this._convertSource(e.source)}_convertSource(e){if("bytes"in e)return{type:"videoSourceBytes",bytes:e.bytes};if("s3Location"in e)return{type:"videoSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid video source")}},cf=class{type="documentBlock";name;format;source;citations;context;constructor(e){this.name=e.name,this.format=e.format,this.source=this._convertSource(e.source),e.citations!==void 0&&(this.citations=e.citations),e.context!==void 0&&(this.context=e.context)}_convertSource(e){if("bytes"in e)return{type:"documentSourceBytes",bytes:e.bytes};if("text"in e)return{type:"documentSourceText",text:e.text};if("content"in e)return{type:"documentSourceContentBlock",content:e.content.map(r=>new mt(r.text))};if("s3Location"in e)return{type:"documentSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid document source")}};var Sr=class t{type="message";role;content;constructor(e){this.role=e.role,this.content=e.content}static fromMessageData(e){let r=e.content.map(Iv);return new t({role:e.role,content:r})}},mt=class{type="textBlock";text;constructor(e){this.text=e}},dl=class{type="toolUseBlock";name;toolUseId;input;constructor(e){this.name=e.name,this.toolUseId=e.toolUseId,this.input=e.input}},Ht=class{type="toolResultBlock";toolUseId;status;content;error;constructor(e){this.toolUseId=e.toolUseId,this.status=e.status,this.content=e.content,e.error!==void 0&&(this.error=e.error)}},pl=class{type="reasoningBlock";text;signature;redactedContent;constructor(e){e.text!==void 0&&(this.text=e.text),e.signature!==void 0&&(this.signature=e.signature),e.redactedContent!==void 0&&(this.redactedContent=e.redactedContent)}},uf=class{type="cachePointBlock";cacheType;constructor(e){this.cacheType=e.cacheType}},Ha=class{type="jsonBlock";json;constructor(e){this.json=e.json}};function Ij(t){return typeof t=="string"?t:t.map(e=>{if("type"in e)return e;if("cachePoint"in e)return new uf(e.cachePoint);if("guardContent"in e)return new lf(e.guardContent);if("text"in e)return new mt(e.text);throw new Error("Unknown SystemContentBlockData type")})}var lf=class{type="guardContentBlock";text;image;constructor(e){if(!e.text&&!e.image)throw new Error("GuardContentBlock must have either text or image content");if(e.text&&e.image)throw new Error("GuardContentBlock cannot have both text and image content");e.text&&(this.text=e.text),e.image&&(this.image=e.image)}};function Iv(t){if("text"in t)return new mt(t.text);if("toolUse"in t)return new dl(t.toolUse);if("toolResult"in t)return new Ht({toolUseId:t.toolResult.toolUseId,status:t.toolResult.status,content:t.toolResult.content.map(e=>{if("text"in e)return new mt(e.text);if("json"in e)return new Ha(e);throw new Error("Unknown ToolResultContentData type")})});if("reasoning"in t)return new pl(t.reasoning);if("cachePoint"in t)return new uf(t.cachePoint);if("guardContent"in t)return new lf(t.guardContent);if("image"in t)return new sf(t.image);if("video"in t)return new af(t.video);if("document"in t)return new cf(t.document);throw new Error("Unknown ContentBlockData type")}var ds=class extends Error{constructor(e){super(e),this.name="ContextWindowOverflowError"}},df=class extends Error{partialMessage;constructor(e,r){super(e),this.name="MaxTokensError",this.partialMessage=r}},ps=class extends Error{constructor(e){super(e),this.name="JsonValidationError"}},pf=class extends Error{constructor(e){super(e),this.name="ConcurrentInvocationError"}};function ai(t){return t instanceof Error?t:new Error(String(t))}var ff=class extends Error{constructor(e){super(`Item with id '${e}' not found`),this.name="ItemNotFoundError"}},mf=class extends Error{constructor(e){super(`An item with the ID '${e}' already exists.`),this.name="DuplicateItemError"}},Ft=class extends Error{constructor(e){super(e),this.name="ValidationError"}},hf=class{_items;constructor(e){this._items=new Map,e&&this.addAll(e)}get(e){return this._items.get(e)}find(e){for(let r of this._items.values())if(e(r))return r}keys(){return Array.from(this._items.keys())}values(){return Array.from(this._items.values())}pairs(){return Array.from(this._items.entries())}clear(){this._items.clear()}add(e){this.validate(e);let r=this.generateId(e);if(this._items.has(r))throw new mf(r);return this._items.set(r,e),r}addAll(e){return e.map(r=>this.add(r))}remove(e){let r=this._items.get(e);if(r===void 0)throw new ff(e);return this._items.delete(e),r}removeAll(e){return e.map(r=>this.remove(r))}findRemove(e){for(let[r,n]of this._items.entries())if(e(n))return this._items.delete(r),n}};if(import.meta.vitest){let{describe:t,it:e,expect:r,beforeEach:n,vi:o}=import.meta.vitest;class i extends hf{nextId=1;generateId(){return this.nextId++}validate(a){if(a.length===0)throw new Ft("Item cannot be an empty string.")}}t("Error Classes",()=>{e("ItemNotFoundError should have the correct name and message",()=>{let s=new ff(123);r(s.name).toBe("ItemNotFoundError"),r(s.message).toBe("Item with id '123' not found")}),e("DuplicateItemError should have the correct name and message",()=>{let s=new mf("abc");r(s.name).toBe("DuplicateItemError"),r(s.message).toBe("An item with the ID 'abc' already exists.")}),e("ValidationError should have the correct name and message",()=>{let s=new Ft("Invalid item");r(s.name).toBe("ValidationError"),r(s.message).toBe("Invalid item")})}),t("Registry",()=>{let s;n(()=>{s=new i}),e("should register an item and return a new ID",()=>{let a=s.add("test-item");r(a).toBe(1),r(s.get(1)).toBe("test-item")}),e("should throw DuplicateItemError when registering with an existing ID",()=>{let a=o.spyOn(s,"generateId").mockReturnValue(1);s.add("test-item"),r(()=>s.add("another-item")).toThrow(mf),a.mockRestore()}),e("should deregister an item and return it",()=>{let a=s.add("test-item"),c=s.remove(a);r(c).toBe("test-item"),r(s.get(a)).toBeUndefined()}),e("should throw ItemNotFoundError when deregistering a non-existent item",()=>{r(()=>s.remove(999)).toThrow(ff)}),e("should get an item by its ID",()=>{let a=s.add("test-item"),c=s.get(a);r(c).toBe("test-item")}),e("should return undefined when getting a non-existent item",()=>{let a=s.get(999);r(a).toBeUndefined()}),e("should find an item using a predicate",()=>{s.add("item-a"),s.add("item-b");let a=s.find(c=>c.includes("b"));r(a).toBe("item-b")}),e("should return undefined when no item matches the predicate",()=>{s.add("item-a");let a=s.find(c=>c.includes("c"));r(a).toBeUndefined()}),e("should return all keys",()=>{s.add("item-1"),s.add("item-2"),r(s.keys()).toEqual([1,2])}),e("should return all values",()=>{s.add("item-1"),s.add("item-2"),r(s.values()).toEqual(["item-1","item-2"])}),e("should return all key-value pairs",()=>{s.add("item-1"),s.add("item-2"),r(s.pairs()).toEqual([[1,"item-1"],[2,"item-2"]])}),e("should clear all items from the registry",()=>{s.add("item-1"),s.clear(),r(s.keys()).toEqual([]),r(s.values()).toEqual([])}),e("should register multiple items",()=>{let a=s.addAll(["item-a","item-b"]);r(a).toEqual([1,2]),r(s.values()).toEqual(["item-a","item-b"])}),e("should deregister multiple items",()=>{let a=s.addAll(["item-a","item-b","item-c"]),c=s.removeAll([a[0],a[2]]);r(c).toEqual(["item-a","item-c"]),r(s.values()).toEqual(["item-b"])}),e("should find and deregister an item",()=>{s.add("item-a"),s.add("item-b");let a=s.findRemove(c=>c.includes("a"));r(a).toBe("item-a"),r(s.values()).toEqual(["item-b"])}),e("should return undefined from findRemove if no item matches",()=>{let a=s.findRemove(c=>c.includes("c"));r(a).toBeUndefined()}),e("should call the validate method on register",()=>{let a=o.spyOn(s,"validate");s.add("a-valid-item"),r(a).toHaveBeenCalledWith("a-valid-item"),a.mockRestore()}),e("should throw a validation error for an invalid item",()=>{r(()=>s.add("")).toThrow(Ft)})})}var gf=class{type="toolStreamEvent";data;constructor(e){e.data!==void 0&&(this.data=e.data)}},fl=class{};function lS(t,e){let r=ai(t);return new Ht({toolUseId:e,status:"error",content:[new mt(`Error: ${r.message}`)],error:r})}var _f=class extends hf{generateId(e){return e}validate(e){if(typeof e.name!="string")throw new Ft("Tool name must be a string");if(e.name.length<1||e.name.length>64)throw new Ft("Tool name must be between 1 and 64 characters");if(!/^[a-zA-Z0-9_-]+$/.test(e.name))throw new Ft("Tool name must contain only alphanumeric characters, hyphens, and underscores");if(e.description!==void 0&&e.description!==null&&(typeof e.description!="string"||e.description.length<1))throw new Ft("Tool description must be a non-empty string");if(this.values().some(n=>n.name===e.name))throw new Ft(`Tool with name '${e.name}' already registered`)}getByName(e){return this.values().find(r=>r.name===e)}removeByName(e){this.findRemove(r=>r.name===e)}};if(import.meta.vitest){let{describe:t,it:e,expect:r,beforeEach:n}=import.meta.vitest,o=(i={})=>({name:"valid-tool",description:"A valid tool description.",toolSpec:{name:"valid-tool",description:"A valid tool description.",inputSchema:{type:"object",properties:{}}},stream:async function*(){return yield new gf({data:"mock data"}),new Ht({toolUseId:"",status:"success",content:[]})},...i});t("ToolRegistry",()=>{let i;n(()=>{i=new _f}),e("should register a valid tool successfully",()=>{let s=o();r(()=>i.add(s)).not.toThrow(),r(i.values()).toHaveLength(1),r(i.values()[0]?.name).toBe("valid-tool")}),e("should throw ValidationError for a duplicate tool name",()=>{let s=o({name:"duplicate-name"}),a=o({name:"duplicate-name"});i.add(s),r(()=>i.add(a)).toThrow(Ft),r(()=>i.add(a)).toThrow("Tool with name 'duplicate-name' already registered")}),e("should throw ValidationError for an invalid tool name pattern",()=>{let s=o({name:"invalid name!"});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must contain only alphanumeric characters, hyphens, and underscores")}),e("should throw ValidationError for a tool name that is too long",()=>{let s="a".repeat(65),a=o({name:s});r(()=>i.add(a)).toThrow(Ft),r(()=>i.add(a)).toThrow("Tool name must be between 1 and 64 characters")}),e("should throw ValidationError for a tool name that is too short",()=>{let s=o({name:""});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must be between 1 and 64 characters")}),e("should throw ValidationError for an invalid description",()=>{let s=o({description:123});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool description must be a non-empty string")}),e("should throw ValidationError for an empty string description",()=>{let s=o({description:""});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool description must be a non-empty string")}),e("should allow a tool with a null or undefined description",()=>{let s=o();s.description=void 0;let a=o();a.name="another-valid-tool",a.description=null,r(()=>i.add(s)).not.toThrow(),r(()=>i.add(a)).not.toThrow()}),e("should retrieve a tool by its name",()=>{let s=o({name:"find-me"});i.add(s);let a=i.getByName("find-me");r(a).toBe(s)}),e("should return undefined when getting a tool by a name that does not exist",()=>{let s=i.getByName("non-existent");r(s).toBeUndefined()}),e("should remove a tool by its name",()=>{let s=o({name:"remove-me"});i.add(s),r(i.getByName("remove-me")).toBeDefined(),i.removeByName("remove-me"),r(i.getByName("remove-me")).toBeUndefined()}),e("should not throw when removing a tool by a name that does not exist",()=>{r(()=>i.removeByName("non-existent")).not.toThrow()}),e("should generate a valid ToolIdentifier",()=>{let s=o(),a=i.generateId(s);r(a).toBe(s)}),e("should register a tool with a name at the maximum length",()=>{let s="a".repeat(64),a=o({name:s});r(()=>i.add(a)).not.toThrow()}),e("should throw ValidationError for a non-string tool name",()=>{let s=o({name:123});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must be a string")})})}function Sv(t){try{return JSON.parse(JSON.stringify(t))}catch(e){let r=e instanceof Error?e.message:String(e);throw new Error(`Unable to serialize tool result: ${r}`)}}function dS(t,e="value"){let r=[],n=(o,i)=>{let s=e;if(o!==""&&(/^\d+$/.test(o)?s=r.length>0?`${r[r.length-1]}[${o}]`:`${e}[${o}]`:s=r.length>0?`${r[r.length-1]}.${o}`:`${e}.${o}`),typeof i=="function")throw new ps(`${s} contains a function which cannot be serialized`);if(typeof i=="symbol")throw new ps(`${s} contains a symbol which cannot be serialized`);if(i===void 0)throw new ps(`${s} is undefined which cannot be serialized`);return i!==null&&typeof i=="object"&&r.push(s),i};try{let o=JSON.stringify(t,n);return JSON.parse(o)}catch(o){if(o instanceof ps)throw o;let i=o instanceof Error?o.message:String(o);throw new Error(`Unable to serialize value: ${i}`)}}var kv=class{_state;constructor(e){e!==void 0?this._state=dS(e,"initialState"):this._state={}}get(e){if(e==null)throw new Error("key is required");let r=this._state[e];if(r!==void 0)return Sv(r)}set(e,r){this._state[e]=dS(r,`value for key "${e}"`)}delete(e){delete this._state[e]}clear(){this._state={}}getAll(){return Sv(this._state)}keys(){return Object.keys(this._state)}};function Sj(){return typeof process<"u"&&process.stdout?.write?t=>process.stdout.write(t):t=>console.log(t)}var Tv=class{_appender;_inReasoningBlock=!1;_toolCount=0;_needReasoningIndent=!1;constructor(e){this._appender=e}write(e){this._appender(e)}processEvent(e){switch(e.type){case"modelContentBlockDeltaEvent":this.handleContentBlockDelta(e);break;case"modelContentBlockStartEvent":this.handleContentBlockStart(e);break;case"modelContentBlockStopEvent":this.handleContentBlockStop();break;case"toolResultBlock":this.handleToolResult(e);break;default:break}}handleContentBlockDelta(e){let{delta:r}=e;r.type==="textDelta"?r.text&&r.text.length>0&&this.write(r.text):r.type==="reasoningContentDelta"&&(this._inReasoningBlock||(this._inReasoningBlock=!0,this._needReasoningIndent=!0,this.write(` +\u{1F4AD} Reasoning: +`)),r.text&&r.text.length>0&&this.writeReasoningText(r.text))}writeReasoningText(e){let r="";for(let n=0;n{this.applyManagement(r.agent.messages)}),e.addCallback(ui,r=>{r.error instanceof ds&&(this.reduceContext(r.agent.messages,r.error),r.retryModelCall=!0)})}applyManagement(e){e.length<=this._windowSize||this.reduceContext(e)}reduceContext(e,r){let n=this.findLastMessageWithToolResults(e);if(r&&n!==void 0&&this._shouldTruncateResults&&this.truncateToolResults(e,n))return;let o=e.length<=this._windowSize?2:e.length-this._windowSize;for(;oc.type==="toolResultBlock")){o++;continue}if(i.content.some(c=>c.type==="toolUseBlock")){let c=e[o+1];if(!(c&&c.content.some(l=>l.type==="toolResultBlock"))){o++;continue}}break}if(o>=e.length)throw new ds("Unable to trim conversation context!");e.splice(0,o)}truncateToolResults(e,r){if(r>=e.length||r<0)return!1;let n=e[r];if(!n)return!1;let o="The tool result was too large!",i=!1;for(let a of n.content)if(a.type==="toolResultBlock"){let c=a,u=c.content[0],l=u&&u.type==="textBlock"?u.text:"";if(c.status==="error"&&l===o)return!1;i=!0;break}if(!i)return!1;let s=n.content.map(a=>{if(a.type==="toolResultBlock"){let c=a;return new Ht({toolUseId:c.toolUseId,status:"error",content:[new mt(o)]})}return a});return e[r]=new Sr({role:n.role,content:s}),!0}findLastMessageWithToolResults(e){for(let r=e.length-1;r>=0;r--)if(e[r].content.some(i=>i.type==="toolResultBlock"))return r}};var vl=class{_callbacks;_currentProvider;constructor(){this._callbacks=new Map,this._currentProvider=void 0}addCallback(e,r){let n={callback:r,source:this._currentProvider},o=this._callbacks.get(e)??[];return o.push(n),this._callbacks.set(e,o),()=>{let i=this._callbacks.get(e);if(!i)return;let s=i.indexOf(n);s!==-1&&i.splice(s,1)}}addHook(e){this._currentProvider=e;try{e.registerCallbacks(this)}finally{this._currentProvider=void 0}}addAllHooks(e){for(let r of e)this.addHook(r)}removeHook(e){for(let[r,n]of this._callbacks.entries()){let o=n.filter(i=>i.source!==e);o.length===0?this._callbacks.delete(r):o.length!==n.length&&this._callbacks.set(r,o)}}async invokeCallbacks(e){let r=this.getCallbacksFor(e);for(let n of r)await n(e);return e}getCallbacksFor(e){let n=(this._callbacks.get(e.constructor)??[]).map(o=>o.callback);return e._shouldReverseCallbacks()?[...n].reverse():n}};var E8=function(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e},A8=(function(t){return function(e){function r(s){e.error=e.hasError?new t(s,e.error,"An error was suppressed during disposal."):s,e.hasError=!0}var n,o=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&o===1)return o=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return o|=2,Promise.resolve(s).then(i,function(a){return r(a),i()})}else o|=1}catch(a){r(a)}if(o===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}})(typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n}),bf=class{messages;state;conversationManager;hooks;model;systemPrompt;_toolRegistry;_mcpClients;_initialized;_isInvoking=!1;_printer;constructor(e){this.messages=(e?.messages??[]).map(i=>i instanceof Sr?i:Sr.fromMessageData(i)),this.state=new kv(e?.state),this.conversationManager=e?.conversationManager??new vf({windowSize:40}),this.hooks=new vl,this.hooks.addHook(this.conversationManager),this.hooks.addAllHooks(e?.hooks??[]),typeof e?.model=="string"?this.model=new ms({modelId:e.model}):this.model=e?.model??new ms;let{tools:r,mcpClients:n}=kj(e?.tools??[]);this._toolRegistry=new _f(r),this._mcpClients=n,e?.systemPrompt!==void 0&&(this.systemPrompt=Ij(e.systemPrompt)),(e?.printer??!0)&&(this._printer=new Tv(Sj())),this._initialized=!1}async initialize(){this._initialized||(await Promise.all(this._mcpClients.map(async e=>{let r=await e.listTools();this._toolRegistry.addAll(r)})),this._initialized=!0)}acquireLock(){if(this._isInvoking)throw new pf("Agent is already processing an invocation. Wait for the current invoke() or stream() call to complete before invoking again.");return this._isInvoking=!0,{[Symbol.dispose]:()=>{this._isInvoking=!1}}}get tools(){return this._toolRegistry.values()}get toolRegistry(){return this._toolRegistry}async invoke(e){let r=this.stream(e),n=await r.next();for(;!n.done;)n=await r.next();return n.value}async*stream(e){let r={stack:[],error:void 0,hasError:!1};try{let n=E8(r,this.acquireLock(),!1);await this.initialize();let o=this._stream(e),i=await o.next();for(;!i.done;){let s=i.value;s instanceof ar&&!(s instanceof Wa)&&await this.hooks.invokeCallbacks(s),this._printer?.processEvent(s),yield s,i=await o.next()}return yield i.value,i.value}catch(n){r.error=n,r.hasError=!0}finally{A8(r)}}async*_stream(e){let r=e;yield new ml({agent:this});try{for(;;){let n=yield*this.invokeModel(r);if(r=void 0,n.stopReason!=="toolUse")return yield await this._appendMessage(n.message),new wf({stopReason:n.stopReason,lastMessage:n.message});let o=yield*this.executeTools(n.message,this._toolRegistry);yield await this._appendMessage(n.message),yield await this._appendMessage(o)}}finally{yield new fs({agent:this})}}_normalizeInput(e){if(e!==void 0){if(typeof e=="string")return[new Sr({role:"user",content:[new mt(e)]})];if(Array.isArray(e)&&e.length>0){let r=e[0];if("role"in r&&typeof r.role=="string")return r instanceof Sr?e:e.map(n=>Sr.fromMessageData(n));{let n;return"type"in r&&typeof r.type=="string"?n=e:n=e.map(Iv),[new Sr({role:"user",content:n})]}}}return[]}async*invokeModel(e){let r=this._normalizeInput(e);for(let i of r)yield await this._appendMessage(i);let o={toolSpecs:this._toolRegistry.values().map(i=>i.toolSpec)};this.systemPrompt!==void 0&&(o.systemPrompt=this.systemPrompt),yield new gl({agent:this});try{let{message:i,stopReason:s}=yield*this._streamFromModel(this.messages,o);return yield new ui({agent:this,stopData:{message:i,stopReason:s}}),{message:i,stopReason:s}}catch(i){let s=ai(i),a=new ui({agent:this,error:s});if(yield a,a.retryModelCall)return yield*this.invokeModel(e);throw i}}async*_streamFromModel(e,r){let n=this.model.streamAggregated(e,r),o=await n.next();for(;!o.done;){let i=o.value;yield new yf({agent:this,event:i}),yield i,o=await n.next()}return o.value}async*executeTools(e,r){yield new _l({agent:this,message:e});let n=e.content.filter(s=>s.type==="toolUseBlock");if(n.length===0)throw new Error("Model indicated toolUse but no tool use blocks found in message");let o=[];for(let s of n){let a=yield*this.executeTool(s,r);o.push(a),yield a}let i=new Sr({role:"user",content:o});return yield new yl({agent:this,message:i}),i}async*executeTool(e,r){let n=r.find(s=>s.name===e.name),o={name:e.name,toolUseId:e.toolUseId,input:e.input};if(yield new hl({agent:this,toolUse:o,tool:n}),!n){let s=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(`Tool '${e.name}' not found in registry`)]});return yield new ci({agent:this,toolUse:o,tool:n,result:s}),s}let i={toolUse:{name:e.name,toolUseId:e.toolUseId,input:e.input},agent:this};try{let a=yield*n.stream(i);if(!a){let c=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(`Tool '${e.name}' did not return a result`)]});return yield new ci({agent:this,toolUse:o,tool:n,result:c}),c}return yield new ci({agent:this,toolUse:o,tool:n,result:a}),a}catch(s){let a=ai(s),c=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(a.message)],error:a});return yield new ci({agent:this,toolUse:o,tool:n,result:c,error:a}),c}}async _appendMessage(e){this.messages.push(e);let r=new Wa({agent:this,message:e});return await this.hooks.invokeCallbacks(r),r}};function kj(t){let e=[],r=[];for(let n of t)if(Array.isArray(n)){let{tools:o,mcpClients:i}=kj(n);e.push(...o),r.push(...i)}else n instanceof xf?r.push(n):e.push(n);return{tools:e,mcpClients:r}}var wf=class{type="agentResult";stopReason;lastMessage;constructor(e){this.stopReason=e.stopReason,this.lastMessage=e.lastMessage}toString(){let e=[];for(let r of this.lastMessage.content)switch(r.type){case"textBlock":e.push(r.text);break;case"reasoningBlock":if(r.text){let n=r.text.replace(/\n/g,` + `);e.push(`\u{1F4AD} Reasoning: + ${n}`)}break;default:console.debug(`Skipping content block type: ${r.type}`);break}return e.join(` +`)}};import{BedrockRuntimeClient as C8,ConverseCommand as R8,ConverseStreamCommand as N8}from"@aws-sdk/client-bedrock-runtime";var Ev=class{type="modelMessageStartEvent";role;constructor(e){this.role=e.role}},Av=class{type="modelContentBlockStartEvent";start;constructor(e){e.start!==void 0&&(this.start=e.start)}},Ov=class{type="modelContentBlockDeltaEvent";contentBlockIndex;delta;constructor(e){this.delta=e.delta}},Pv=class{type="modelContentBlockStopEvent";constructor(e){}},Cv=class{type="modelMessageStopEvent";stopReason;additionalModelResponseFields;constructor(e){this.stopReason=e.stopReason,e.additionalModelResponseFields!==void 0&&(this.additionalModelResponseFields=e.additionalModelResponseFields)}},Rv=class{type="modelMetadataEvent";usage;metrics;trace;constructor(e){e.usage!==void 0&&(this.usage=e.usage),e.metrics!==void 0&&(this.metrics=e.metrics),e.trace!==void 0&&(this.trace=e.trace)}};var Nv=class{_convert_to_class_event(e){switch(e.type){case"modelMessageStartEvent":return new Ev(e);case"modelContentBlockStartEvent":return new Av(e);case"modelContentBlockDeltaEvent":return new Ov(e);case"modelContentBlockStopEvent":return new Pv(e);case"modelMessageStopEvent":return new Cv(e);case"modelMetadataEvent":return new Rv(e);default:throw new Error(`Unsupported event type: ${e}`)}}async*streamAggregated(e,r){let n=null,o=[],i="",s="",a="",c="",u={},l,d=null,f=null,p;for await(let h of this.stream(e,r)){let _=this._convert_to_class_event(h);switch(yield _,_.type){case"modelMessageStartEvent":n=_.role,o.length=0;break;case"modelContentBlockStartEvent":_.start?.type==="toolUseStart"&&(a=_.start.name,c=_.start.toolUseId),s="",i="",u={};break;case"modelContentBlockDeltaEvent":switch(_.delta.type){case"textDelta":i+=_.delta.text;break;case"toolUseInputDelta":s+=_.delta.input;break;case"reasoningContentDelta":_.delta.text&&(u.text=(u.text??"")+_.delta.text),_.delta.signature&&(u.signature=_.delta.signature),_.delta.redactedContent&&(u.redactedContent=_.delta.redactedContent);break}break;case"modelContentBlockStopEvent":{let v;try{c?(v=new dl({name:a,toolUseId:c,input:s?JSON.parse(s):{}}),c="",a=""):Object.keys(u).length>0?v=new pl({...u}):v=new mt(i),o.push(v),yield v}catch(b){b instanceof SyntaxError&&(console.error("Unable to parse JSON string."),l=b)}break}case"modelMessageStopEvent":n&&(d=new Sr({role:n,content:[...o]}),f=_.stopReason);break;case"modelMetadataEvent":p=_;break;default:break}}if(!d||!f)throw new Error("Stream ended without completing a message",{cause:l});if(f==="maxTokens"){let h=new df("Model reached maximum token limit. This is an unrecoverable state that requires intervention.",d);l!==void 0?l.cause=h:l=h}if(l!==void 0)throw l;let m={message:d,stopReason:f};return p!==void 0&&(m.metadata=p),m}};function ct(t,e){if(t==null)throw new Error(`Expected ${e} to be defined, but got ${t}`);return t}var P8={debug:()=>{},info:()=>{},warn:(...t)=>console.warn(...t),error:(...t)=>console.error(...t)},hs=P8;var z8="global.anthropic.claude-sonnet-4-5-20250929-v1:0",M8="us-west-2",j8=!1,D8=["anthropic.claude"],L8=["Input is too long for requested model","input length and `max_tokens` exceed context limit","too many total text bytes"],Tj={end_turn:"endTurn",tool_use:"toolUse",max_tokens:"maxTokens",stop_sequence:"stopSequence",content_filtered:"contentFiltered",guardrail_intervened:"guardrailIntervened"};function U8(t){return t.replace(/_([a-z])/g,(e,r)=>r.toUpperCase())}var ms=class extends Nv{_config;_client;constructor(e){super();let{region:r,clientConfig:n,...o}=e??{};this._config={modelId:z8,...o};let i=n?.customUserAgent?`${n.customUserAgent} strands-agents-ts-sdk`:"strands-agents-ts-sdk";this._client=new C8({...n??{},...r?{region:r}:{},customUserAgent:i}),F8(this._client.config)}updateConfig(e){this._config={...this._config,...e}}getConfig(){return this._config}async*stream(e,r){try{let n=this._formatRequest(e,r);if(this._config.stream!==!1){let o=new N8(n),i=await this._client.send(o);if(i.stream)for await(let s of i.stream){let a=this._mapStreamedBedrockEventToSDKEvent(s);for(let c of a)yield c}}else{let o=new R8(n),i=await this._client.send(o);for(let s of this._mapBedrockEventToSDKEvent(i))yield s}}catch(n){let o=ai(n);throw L8.some(i=>o.message.includes(i))?new ds(o.message):o}}_formatRequest(e,r){let n={modelId:this._config.modelId,messages:this._formatMessages(e)};if(r?.systemPrompt!==void 0)if(typeof r.systemPrompt=="string"){let i=[{text:r.systemPrompt}];this._config.cachePrompt&&i.push({cachePoint:{type:this._config.cachePrompt}}),n.system=i}else r.systemPrompt.length>0&&(this._config.cachePrompt&&hs.warn("cachePrompt config is ignored when systemPrompt is an array, use explicit cache points instead"),n.system=r.systemPrompt.map(i=>this._formatContentBlock(i)));if(r?.toolSpecs&&r.toolSpecs.length>0){let i=r.toolSpecs.map(a=>({toolSpec:{name:a.name,description:a.description,inputSchema:{json:a.inputSchema}}}));this._config.cacheTools&&i.push({cachePoint:{type:this._config.cacheTools}});let s={tools:i};r.toolChoice&&(s.toolChoice=r.toolChoice),n.toolConfig=s}let o={};return this._config.maxTokens!==void 0&&(o.maxTokens=this._config.maxTokens),this._config.temperature!==void 0&&(o.temperature=this._config.temperature),this._config.topP!==void 0&&(o.topP=this._config.topP),this._config.stopSequences!==void 0&&(o.stopSequences=this._config.stopSequences),Object.keys(o).length>0&&(n.inferenceConfig=o),this._config.additionalRequestFields&&(n.additionalModelRequestFields=this._config.additionalRequestFields),this._config.additionalResponseFieldPaths&&(n.additionalModelResponseFieldPaths=this._config.additionalResponseFieldPaths),this._config.additionalArgs&&Object.assign(n,this._config.additionalArgs),n}_formatMessages(e){return e.reduce((r,n)=>{let o=n.content.map(i=>this._formatContentBlock(i)).filter(i=>i!==void 0);return o.length>0&&r.push({role:n.role,content:o}),r},[])}_shouldIncludeToolResultStatus(){let e=this._config.includeToolResultStatus??"auto";if(e===!0)return!0;if(e===!1)return!1;let r=D8.some(n=>this._config.modelId?.includes(n));return hs.debug(`model_id=<${this._config.modelId}>, include_tool_result_status=<${r}> | auto-detected includeToolResultStatus`),r}_formatContentBlock(e){switch(e.type){case"textBlock":return{text:e.text};case"toolUseBlock":return{toolUse:{toolUseId:e.toolUseId,name:e.name,input:e.input}};case"toolResultBlock":{let r=e.content.map(n=>{switch(n.type){case"textBlock":return{text:n.text};case"jsonBlock":return{json:n.json}}});return{toolResult:{toolUseId:e.toolUseId,content:r,...this._shouldIncludeToolResultStatus()&&{status:e.status}}}}case"reasoningBlock":{if(e.text)return{reasoningContent:{reasoningText:{text:e.text,signature:e.signature}}};if(e.redactedContent)return{reasoningContent:{redactedContent:e.redactedContent}};throw Error("reasoning content format incorrect. Either 'text' or 'redactedContent' must be set.")}case"cachePointBlock":return{cachePoint:{type:e.cacheType}};case"imageBlock":return{image:{format:e.format,source:this._formatMediaSource(e.source)}};case"videoBlock":return{video:{format:e.format==="3gp"?"three_gp":e.format,source:this._formatMediaSource(e.source)}};case"documentBlock":return{document:{name:e.name,format:e.format,source:this._formatDocumentSource(e.source),...e.citations&&{citations:e.citations},...e.context&&{context:e.context}}};case"guardContentBlock":{if(e.text)return{guardContent:{text:{text:e.text.text,qualifiers:e.text.qualifiers}}};if(e.image)return{guardContent:{image:{format:e.image.format,source:{bytes:e.image.source.bytes}}}};throw new Error("guardContent must have either text or image")}}}_formatMediaSource(e){switch(e.type){case"imageSourceBytes":case"videoSourceBytes":return{bytes:e.bytes};case"imageSourceUrl":if(e.url.startsWith("s3://"))return{s3Location:{uri:e.url}};console.warn("Ignoring imageSourceUrl content block as its not supported by bedrock");return;case"imageSourceS3Location":case"videoSourceS3Location":return{s3Location:{uri:e.s3Location.uri,...e.s3Location.bucketOwner&&{bucketOwner:e.s3Location.bucketOwner}}};default:throw new Error("Invalid media source")}}_formatDocumentSource(e){switch(e.type){case"documentSourceBytes":return{bytes:e.bytes};case"documentSourceText":return{bytes:new TextEncoder().encode(e.text)};case"documentSourceContentBlock":return{content:e.content.map(r=>({text:r.text}))};case"documentSourceS3Location":return{s3Location:{uri:e.s3Location.uri,...e.s3Location.bucketOwner&&{bucketOwner:e.s3Location.bucketOwner}}};default:throw new Error("Invalid document source")}}_mapBedrockEventToSDKEvent(e){let r=[],n=ct(e.output,"event.output"),o=ct(n.message,"output.message"),i=ct(o.role,"message.role");r.push({type:"modelMessageStartEvent",role:i});let s={text:d=>{r.push({type:"modelContentBlockStartEvent"}),r.push({type:"modelContentBlockDeltaEvent",delta:{type:"textDelta",text:d}}),r.push({type:"modelContentBlockStopEvent"})},toolUse:d=>{r.push({type:"modelContentBlockStartEvent",start:{type:"toolUseStart",name:ct(d.name,"toolUse.name"),toolUseId:ct(d.toolUseId,"toolUse.toolUseId")}}),r.push({type:"modelContentBlockDeltaEvent",delta:{type:"toolUseInputDelta",input:JSON.stringify(ct(d.input,"toolUse.input"))}}),r.push({type:"modelContentBlockStopEvent"})},reasoningContent:d=>{if(!d)return;r.push({type:"modelContentBlockStartEvent"});let f={type:"reasoningContentDelta"};d.reasoningText?(f.text=ct(d.reasoningText.text,"reasoningText.text"),d.reasoningText.signature&&(f.signature=d.reasoningText.signature)):d.redactedContent&&(f.redactedContent=d.redactedContent),Object.keys(f).length>1&&r.push({type:"modelContentBlockDeltaEvent",delta:f}),r.push({type:"modelContentBlockStopEvent"})}};ct(o.content,"message.content").forEach(d=>{for(let f in d)if(f in s){let p=f;s[p](d[p])}else hs.warn(`block_key=<${f}> | skipping unsupported block key`)});let c=ct(e.stopReason,"event.stopReason");r.push({type:"modelMessageStopEvent",stopReason:this._transformStopReason(c,e)});let u=ct(e.usage,"output.usage"),l={type:"modelMetadataEvent",usage:{inputTokens:ct(u.inputTokens,"usage.inputTokens"),outputTokens:ct(u.outputTokens,"usage.outputTokens"),totalTokens:ct(u.totalTokens,"usage.totalTokens")}};return e.metrics&&(l.metrics={latencyMs:ct(e.metrics.latencyMs,"metrics.latencyMs")}),r.push(l),r}_mapStreamedBedrockEventToSDKEvent(e){let r=[],n=ct(Object.keys(e)[0],"eventType"),o=e[n];switch(n){case"messageStart":{let i=o;r.push({type:"modelMessageStartEvent",role:ct(i.role,"messageStart.role")});break}case"contentBlockStart":{let i=o,s={type:"modelContentBlockStartEvent"};if(i.start?.toolUse){let a=i.start.toolUse;s.start={type:"toolUseStart",name:ct(a.name,"toolUse.name"),toolUseId:ct(a.toolUseId,"toolUse.toolUseId")}}r.push(s);break}case"contentBlockDelta":{let s=ct(o.delta,"contentBlockDelta.delta"),a={text:c=>{r.push({type:"modelContentBlockDeltaEvent",delta:{type:"textDelta",text:c}})},toolUse:c=>{c?.input&&r.push({type:"modelContentBlockDeltaEvent",delta:{type:"toolUseInputDelta",input:c.input}})},reasoningContent:c=>{if(!c)return;let u={type:"reasoningContentDelta"};c.text&&(u.text=c.text),c.signature&&(u.signature=c.signature),c.redactedContent&&(u.redactedContent=c.redactedContent),Object.keys(u).length>1&&r.push({type:"modelContentBlockDeltaEvent",delta:u})}};for(let c in s)if(c in a){let u=c;a[u](s[u])}else hs.warn(`delta_key=<${c}> | skipping unsupported delta key`);break}case"contentBlockStop":{r.push({type:"modelContentBlockStopEvent"});break}case"messageStop":{let i=o,s=ct(i.stopReason,"messageStop.stopReason"),a={type:"modelMessageStopEvent",stopReason:this._transformStopReason(s,i)};i.additionalModelResponseFields&&(a.additionalModelResponseFields=i.additionalModelResponseFields),r.push(a);break}case"metadata":{let i=o,s={type:"modelMetadataEvent"};if(i.usage){let a=i.usage,c={inputTokens:ct(a.inputTokens,"usage.inputTokens"),outputTokens:ct(a.outputTokens,"usage.outputTokens"),totalTokens:ct(a.totalTokens,"usage.totalTokens")};a.cacheReadInputTokens!==void 0&&(c.cacheReadInputTokens=a.cacheReadInputTokens),a.cacheWriteInputTokens!==void 0&&(c.cacheWriteInputTokens=a.cacheWriteInputTokens),s.usage=c}i.metrics&&(s.metrics={latencyMs:ct(i.metrics.latencyMs,"metrics.latencyMs")}),i.trace&&(s.trace=i.trace),r.push(s);break}case"internalServerException":case"modelStreamErrorException":case"serviceUnavailableException":case"validationException":case"throttlingException":throw o;default:hs.warn(`event_type=<${n}> | unsupported bedrock event type`);break}return r}_transformStopReason(e,r){let n;if(e in Tj)n=Tj[e];else{let o=U8(e);hs.warn(`stop_reason=<${e}>, fallback=<${o}> | unknown stop reason, converting to camelCase`),n=o}return n==="endTurn"&&r&&"output"in r&&r.output?.message?.content?.some(o=>"toolUse"in o)&&(n="toolUse",hs.warn("stop_reason= | adjusting to tool_use due to tool use in content blocks")),n}};function F8(t){let e=t.region.bind(t);t.region=async()=>{try{return await e()}catch(n){if(ai(n).message==="Region is missing")return M8;throw n}};let r=t.useFipsEndpoint.bind(t);t.useFipsEndpoint=async()=>{try{return await r()}catch(n){if(ai(n).message==="Region is missing")return j8;throw n}}}function bl(t){return!!t._zod}function Jn(t,e){return bl(t)?ba(t,e):t.safeParse(e)}function zv(t){var e,r;if(!t)return;let n;if(bl(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function Oj(t){var e;if(bl(t)){let s=(e=t._zod)===null||e===void 0?void 0:e.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let o=t.value;if(o!==void 0)return o}var fS="2025-11-25";var Pj=[fS,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],To="io.modelcontextprotocol/related-task",jv="2.0",ko=MI(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Cj=tt([A(),We().int()]),Rj=A(),G8=un({ttl:tt([We(),Yp()]).optional(),pollInterval:We().optional()}),mS=un({taskId:A()}),K8=un({progressToken:Cj.optional(),[To]:mS.optional()}),Ur=un({task:G8.optional(),_meta:K8.optional()}),Wt=U({method:A(),params:Ur.optional()}),Ja=un({_meta:U({[To]:ie(mS)}).passthrough().optional()}),kn=U({method:A(),params:Ja.optional()}),cr=un({_meta:un({[To]:mS.optional()}).optional()}),Dv=tt([A(),We().int()]),Nj=U({jsonrpc:se(jv),id:Dv,...Wt.shape}).strict(),hS=t=>Nj.safeParse(t).success,zj=U({jsonrpc:se(jv),...kn.shape}).strict(),Mj=t=>zj.safeParse(t).success,jj=U({jsonrpc:se(jv),id:Dv,result:cr}).strict(),$f=t=>jj.safeParse(t).success,be;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(be||(be={}));var Dj=U({jsonrpc:se(jv),id:Dv,error:U({code:We().int(),message:A(),data:ie(ft())})}).strict(),Lj=t=>Dj.safeParse(t).success,BDe=tt([Nj,zj,jj,Dj]),Xa=cr.strict(),H8=Ja.extend({requestId:Dv,reason:A().optional()}),Lv=kn.extend({method:se("notifications/cancelled"),params:H8}),W8=U({src:A(),mimeType:A().optional(),sizes:Re(A()).optional()}),If=U({icons:Re(W8).optional()}),wl=U({name:A(),title:A().optional()}),Uj=wl.extend({...wl.shape,...If.shape,version:A(),websiteUrl:A().optional()}),J8=Qp(U({applyDefaults:Nt().optional()}),bt(A(),ft())),X8=sv(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Qp(U({form:J8.optional(),url:ko.optional()}),bt(A(),ft()).optional())),Y8=U({list:ie(U({}).passthrough()),cancel:ie(U({}).passthrough()),requests:ie(U({sampling:ie(U({createMessage:ie(U({}).passthrough())}).passthrough()),elicitation:ie(U({create:ie(U({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),Q8=U({list:ie(U({}).passthrough()),cancel:ie(U({}).passthrough()),requests:ie(U({tools:ie(U({call:ie(U({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),eJ=U({experimental:bt(A(),ko).optional(),sampling:U({context:ko.optional(),tools:ko.optional()}).optional(),elicitation:X8.optional(),roots:U({listChanged:Nt().optional()}).optional(),tasks:ie(Y8)}),tJ=Ur.extend({protocolVersion:A(),capabilities:eJ,clientInfo:Uj}),rJ=Wt.extend({method:se("initialize"),params:tJ});var nJ=U({experimental:bt(A(),ko).optional(),logging:ko.optional(),completions:ko.optional(),prompts:ie(U({listChanged:ie(Nt())})),resources:U({subscribe:Nt().optional(),listChanged:Nt().optional()}).optional(),tools:U({listChanged:Nt().optional()}).optional(),tasks:ie(Q8)}).passthrough(),gS=cr.extend({protocolVersion:A(),capabilities:nJ,serverInfo:Uj,instructions:A().optional()}),oJ=kn.extend({method:se("notifications/initialized")});var Uv=Wt.extend({method:se("ping")}),iJ=U({progress:We(),total:ie(We()),message:ie(A())}),sJ=U({...Ja.shape,...iJ.shape,progressToken:Cj}),Fv=kn.extend({method:se("notifications/progress"),params:sJ}),aJ=Ur.extend({cursor:Rj.optional()}),Sf=Wt.extend({params:aJ.optional()}),kf=cr.extend({nextCursor:ie(Rj)}),Tf=U({taskId:A(),status:zt(["working","input_required","completed","failed","cancelled"]),ttl:tt([We(),Yp()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:ie(We()),statusMessage:ie(A())}),Ya=cr.extend({task:Tf}),cJ=Ja.merge(Tf),Ef=kn.extend({method:se("notifications/tasks/status"),params:cJ}),Bv=Wt.extend({method:se("tasks/get"),params:Ur.extend({taskId:A()})}),Zv=cr.merge(Tf),qv=Wt.extend({method:se("tasks/result"),params:Ur.extend({taskId:A()})}),Vv=Sf.extend({method:se("tasks/list")}),Gv=kf.extend({tasks:Re(Tf)}),Fj=Wt.extend({method:se("tasks/cancel"),params:Ur.extend({taskId:A()})}),Bj=cr.merge(Tf),Zj=U({uri:A(),mimeType:ie(A()),_meta:bt(A(),ft()).optional()}),qj=Zj.extend({text:A()}),_S=A().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Vj=Zj.extend({blob:_S}),xl=U({audience:Re(zt(["user","assistant"])).optional(),priority:We().min(0).max(1).optional(),lastModified:il.datetime({offset:!0}).optional()}),Gj=U({...wl.shape,...If.shape,uri:A(),description:ie(A()),mimeType:ie(A()),annotations:xl.optional(),_meta:ie(un({}))}),uJ=U({...wl.shape,...If.shape,uriTemplate:A(),description:ie(A()),mimeType:ie(A()),annotations:xl.optional(),_meta:ie(un({}))}),lJ=Sf.extend({method:se("resources/list")}),yS=kf.extend({resources:Re(Gj)}),dJ=Sf.extend({method:se("resources/templates/list")}),vS=kf.extend({resourceTemplates:Re(uJ)}),bS=Ur.extend({uri:A()}),pJ=bS,fJ=Wt.extend({method:se("resources/read"),params:pJ}),wS=cr.extend({contents:Re(tt([qj,Vj]))}),mJ=kn.extend({method:se("notifications/resources/list_changed")}),hJ=bS,gJ=Wt.extend({method:se("resources/subscribe"),params:hJ}),_J=bS,yJ=Wt.extend({method:se("resources/unsubscribe"),params:_J}),vJ=Ja.extend({uri:A()}),bJ=kn.extend({method:se("notifications/resources/updated"),params:vJ}),wJ=U({name:A(),description:ie(A()),required:ie(Nt())}),xJ=U({...wl.shape,...If.shape,description:ie(A()),arguments:ie(Re(wJ)),_meta:ie(un({}))}),$J=Sf.extend({method:se("prompts/list")}),xS=kf.extend({prompts:Re(xJ)}),IJ=Ur.extend({name:A(),arguments:bt(A(),A()).optional()}),SJ=Wt.extend({method:se("prompts/get"),params:IJ}),$S=U({type:se("text"),text:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),IS=U({type:se("image"),data:_S,mimeType:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),SS=U({type:se("audio"),data:_S,mimeType:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),kJ=U({type:se("tool_use"),name:A(),id:A(),input:U({}).passthrough(),_meta:ie(U({}).passthrough())}).passthrough(),TJ=U({type:se("resource"),resource:tt([qj,Vj]),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),EJ=Gj.extend({type:se("resource_link")}),kS=tt([$S,IS,SS,EJ,TJ]),AJ=U({role:zt(["user","assistant"]),content:kS}),TS=cr.extend({description:ie(A()),messages:Re(AJ)}),OJ=kn.extend({method:se("notifications/prompts/list_changed")}),PJ=U({title:A().optional(),readOnlyHint:Nt().optional(),destructiveHint:Nt().optional(),idempotentHint:Nt().optional(),openWorldHint:Nt().optional()}),CJ=U({taskSupport:zt(["required","optional","forbidden"]).optional()}),Kj=U({...wl.shape,...If.shape,description:A().optional(),inputSchema:U({type:se("object"),properties:bt(A(),ko).optional(),required:Re(A()).optional()}).catchall(ft()),outputSchema:U({type:se("object"),properties:bt(A(),ko).optional(),required:Re(A()).optional()}).catchall(ft()).optional(),annotations:ie(PJ),execution:ie(CJ),_meta:bt(A(),ft()).optional()}),RJ=Sf.extend({method:se("tools/list")}),ES=kf.extend({tools:Re(Kj)}),$l=cr.extend({content:Re(kS).default([]),structuredContent:bt(A(),ft()).optional(),isError:ie(Nt())}),ZDe=$l.or(cr.extend({toolResult:ft()})),NJ=Ur.extend({name:A(),arguments:ie(bt(A(),ft()))}),zJ=Wt.extend({method:se("tools/call"),params:NJ}),MJ=kn.extend({method:se("notifications/tools/list_changed")}),Hj=zt(["debug","info","notice","warning","error","critical","alert","emergency"]),jJ=Ur.extend({level:Hj}),DJ=Wt.extend({method:se("logging/setLevel"),params:jJ}),LJ=Ja.extend({level:Hj,logger:A().optional(),data:ft()}),UJ=kn.extend({method:se("notifications/message"),params:LJ}),FJ=U({name:A().optional()}),BJ=U({hints:ie(Re(FJ)),costPriority:ie(We().min(0).max(1)),speedPriority:ie(We().min(0).max(1)),intelligencePriority:ie(We().min(0).max(1))}),ZJ=U({mode:ie(zt(["auto","required","none"]))}),qJ=U({type:se("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:Re(kS).default([]),structuredContent:U({}).passthrough().optional(),isError:ie(Nt()),_meta:ie(U({}).passthrough())}).passthrough(),VJ=ov("type",[$S,IS,SS]),Mv=ov("type",[$S,IS,SS,kJ,qJ]),GJ=U({role:zt(["user","assistant"]),content:tt([Mv,Re(Mv)]),_meta:ie(U({}).passthrough())}).passthrough(),KJ=Ur.extend({messages:Re(GJ),modelPreferences:BJ.optional(),systemPrompt:A().optional(),includeContext:zt(["none","thisServer","allServers"]).optional(),temperature:We().optional(),maxTokens:We().int(),stopSequences:Re(A()).optional(),metadata:ko.optional(),tools:ie(Re(Kj)),toolChoice:ie(ZJ)}),AS=Wt.extend({method:se("sampling/createMessage"),params:KJ}),OS=cr.extend({model:A(),stopReason:ie(zt(["endTurn","stopSequence","maxTokens"]).or(A())),role:zt(["user","assistant"]),content:VJ}),HJ=cr.extend({model:A(),stopReason:ie(zt(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:zt(["user","assistant"]),content:tt([Mv,Re(Mv)])}),WJ=U({type:se("boolean"),title:A().optional(),description:A().optional(),default:Nt().optional()}),JJ=U({type:se("string"),title:A().optional(),description:A().optional(),minLength:We().optional(),maxLength:We().optional(),format:zt(["email","uri","date","date-time"]).optional(),default:A().optional()}),XJ=U({type:zt(["number","integer"]),title:A().optional(),description:A().optional(),minimum:We().optional(),maximum:We().optional(),default:We().optional()}),YJ=U({type:se("string"),title:A().optional(),description:A().optional(),enum:Re(A()),default:A().optional()}),QJ=U({type:se("string"),title:A().optional(),description:A().optional(),oneOf:Re(U({const:A(),title:A()})),default:A().optional()}),e7=U({type:se("string"),title:A().optional(),description:A().optional(),enum:Re(A()),enumNames:Re(A()).optional(),default:A().optional()}),t7=tt([YJ,QJ]),r7=U({type:se("array"),title:A().optional(),description:A().optional(),minItems:We().optional(),maxItems:We().optional(),items:U({type:se("string"),enum:Re(A())}),default:Re(A()).optional()}),n7=U({type:se("array"),title:A().optional(),description:A().optional(),minItems:We().optional(),maxItems:We().optional(),items:U({anyOf:Re(U({const:A(),title:A()}))}),default:Re(A()).optional()}),o7=tt([r7,n7]),i7=tt([e7,t7,o7]),s7=tt([i7,WJ,JJ,XJ]),a7=Ur.extend({mode:se("form").optional(),message:A(),requestedSchema:U({type:se("object"),properties:bt(A(),s7),required:Re(A()).optional()})}),c7=Ur.extend({mode:se("url"),message:A(),elicitationId:A(),url:A().url()}),u7=tt([a7,c7]),PS=Wt.extend({method:se("elicitation/create"),params:u7}),l7=Ja.extend({elicitationId:A()}),d7=kn.extend({method:se("notifications/elicitation/complete"),params:l7}),CS=cr.extend({action:zt(["accept","decline","cancel"]),content:sv(t=>t===null?void 0:t,bt(A(),tt([A(),We(),Nt(),Re(A())])).optional())}),p7=U({type:se("ref/resource"),uri:A()});var f7=U({type:se("ref/prompt"),name:A()}),m7=Ur.extend({ref:tt([f7,p7]),argument:U({name:A(),value:A()}),context:U({arguments:bt(A(),A()).optional()}).optional()}),h7=Wt.extend({method:se("completion/complete"),params:m7});var RS=cr.extend({completion:un({values:Re(A()).max(100),total:ie(We().int()),hasMore:ie(Nt())})}),g7=U({uri:A().startsWith("file://"),name:A().optional(),_meta:bt(A(),ft()).optional()}),_7=Wt.extend({method:se("roots/list")}),y7=cr.extend({roots:Re(g7)}),v7=kn.extend({method:se("notifications/roots/list_changed")}),qDe=tt([Uv,rJ,h7,DJ,SJ,$J,lJ,dJ,fJ,gJ,yJ,zJ,RJ,Bv,qv,Vv]),VDe=tt([Lv,Fv,oJ,v7,Ef]),GDe=tt([Xa,OS,HJ,CS,y7,Zv,Gv,Ya]),KDe=tt([Uv,AS,PS,_7,Bv,qv,Vv]),HDe=tt([Lv,Fv,UJ,bJ,mJ,MJ,OJ,Ef,d7]),WDe=tt([Xa,gS,RS,TS,xS,yS,vS,wS,$l,ES,Zv,Gv,Ya]),de=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===be.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new pS(o.elicitations,r)}return new t(e,r,n)}},pS=class extends de{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(be.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}};function gs(t){return t==="completed"||t==="failed"||t==="cancelled"}var b7=Symbol("Let zodToJsonSchema decide on which parser to use");var ALe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function NS(t){let e=zv(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Oj(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function zS(t,e){let r=Jn(t,e);if(!r.success)throw r.error;return r.data}var k7=6e4,Kv=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Lv,r=>{this._oncancel(r)}),this.setNotificationHandler(Fv,r=>{this._onprogress(r)}),this.setRequestHandler(Uv,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Bv,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new de(be.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(qv,async(r,n)=>{let o=async()=>{var i;let s=r.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(c.type==="response"||c.type==="error"){let u=c.message,l=u.id,d=this._requestResolvers.get(l);if(d)if(this._requestResolvers.delete(l),c.type==="response")d(u);else{let f=u,p=new de(f.error.code,f.error.message,f.error.data);d(p)}else{let f=c.type==="response"?"Response":"Error";this._onerror(new Error(`${f} handler missing for request ${l}`))}continue}await((i=this._transport)===null||i===void 0?void 0:i.send(c.message,{relatedRequestId:n.requestId}))}}let a=await this._taskStore.getTask(s,n.sessionId);if(!a)throw new de(be.InvalidParams,`Task not found: ${s}`);if(!gs(a.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(gs(a.status)){let c=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...c,_meta:{...c._meta,[To]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(Vv,async(r,n)=>{var o;try{let{tasks:i,nextCursor:s}=await this._taskStore.listTasks((o=r.params)===null||o===void 0?void 0:o.cursor,n.sessionId);return{tasks:i,nextCursor:s,_meta:{}}}catch(i){throw new de(be.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Fj,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new de(be.InvalidParams,`Task not found: ${r.params.taskId}`);if(gs(o.status))throw new de(be.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new de(be.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof de?o:new de(be.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){let r=this._requestHandlerAbortControllers.get(e.params.requestId);r?.abort(e.params.reason)}_setupTimeout(e,r,n,o,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),de.fromError(be.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,o;this._transport=e;let i=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};let s=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{s?.(c),this._onerror(c)};let a=(o=this._transport)===null||o===void 0?void 0:o.onmessage;this._transport.onmessage=(c,u)=>{a?.(c,u),$f(c)||Lj(c)?this._onresponse(c):hS(c)?this._onrequest(c,u):Mj(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let n=de.fromError(be.ConnectionClosed,"Connection closed");this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);for(let o of r.values())o(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){var n,o,i,s,a,c;let u=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,l=this._transport,d=(s=(i=(o=e.params)===null||o===void 0?void 0:o._meta)===null||i===void 0?void 0:i[To])===null||s===void 0?void 0:s.taskId;if(u===void 0){let _={jsonrpc:"2.0",id:e.id,error:{code:be.MethodNotFound,message:"Method not found"}};d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:_,timestamp:Date.now()},l?.sessionId).catch(v=>this._onerror(new Error(`Failed to enqueue error response: ${v}`))):l?.send(_).catch(v=>this._onerror(new Error(`Failed to send an error response: ${v}`)));return}let f=new AbortController;this._requestHandlerAbortControllers.set(e.id,f);let p=(a=e.params)===null||a===void 0?void 0:a.task,m=this._taskStore?this.requestTaskStore(e,l?.sessionId):void 0,h={signal:f.signal,sessionId:l?.sessionId,_meta:(c=e.params)===null||c===void 0?void 0:c._meta,sendNotification:async _=>{let v={relatedRequestId:e.id};d&&(v.relatedTask={taskId:d}),await this.notification(_,v)},sendRequest:async(_,v,b)=>{var x,k;let T={...b,relatedRequestId:e.id};d&&!T.relatedTask&&(T.relatedTask={taskId:d});let F=(k=(x=T.relatedTask)===null||x===void 0?void 0:x.taskId)!==null&&k!==void 0?k:d;return F&&m&&await m.updateTaskStatus(F,"input_required"),await this.request(_,v,T)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:d,taskStore:m,taskRequestedTtl:p?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{p&&this.assertTaskHandlerCapability(e.method)}).then(()=>u(e,h)).then(async _=>{if(f.signal.aborted)return;let v={result:_,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:v,timestamp:Date.now()},l?.sessionId):await l?.send(v)},async _=>{var v;if(f.signal.aborted)return;let b={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(_.code)?_.code:be.InternalError,message:(v=_.message)!==null&&v!==void 0?v:"Internal error",..._.data!==void 0&&{data:_.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:b,timestamp:Date.now()},l?.sessionId):await l?.send(b)}).catch(_=>this._onerror(new Error(`Failed to send response: ${_}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),$f(e))n(e);else{let s=new de(e.error.code,e.error.message,e.error.data);n(s)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if($f(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(i=!0,this._taskProgressTokens.set(a.taskId,r))}}if(i||this._progressHandlers.delete(r),$f(e))o(e);else{let s=de.fromError(e.error.code,e.error.message,e.error.data);o(s)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}async*requestStream(e,r,n){var o,i,s,a;let{task:c}=n??{};if(!c){try{yield{type:"result",result:await this.request(e,r,n)}}catch(l){yield{type:"error",error:l instanceof de?l:new de(be.InternalError,String(l))}}return}let u;try{let l=await this.request(e,Ya,n);if(l.task)u=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new de(be.InternalError,"Task creation did not return a task");for(;;){let d=await this.getTask({taskId:u},n);if(yield{type:"taskStatus",task:d},gs(d.status)){d.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)}:d.status==="failed"?yield{type:"error",error:new de(be.InternalError,`Task ${u} failed`)}:d.status==="cancelled"&&(yield{type:"error",error:new de(be.InternalError,`Task ${u} was cancelled`)});return}if(d.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)};return}let f=(s=(o=d.pollInterval)!==null&&o!==void 0?o:(i=this._options)===null||i===void 0?void 0:i.defaultTaskPollInterval)!==null&&s!==void 0?s:1e3;await new Promise(p=>setTimeout(p,f)),(a=n?.signal)===null||a===void 0||a.throwIfAborted()}}catch(l){yield{type:"error",error:l instanceof de?l:new de(be.InternalError,String(l))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{var d,f,p,m,h,_,v;let b=Z=>{l(Z)};if(!this._transport){b(new Error("Not connected"));return}if(((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(Z){b(Z);return}(f=n?.signal)===null||f===void 0||f.throwIfAborted();let x=this._requestMessageId++,k={...e,jsonrpc:"2.0",id:x};n?.onprogress&&(this._progressHandlers.set(x,n.onprogress),k.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:x}}),a&&(k.params={...k.params,task:a}),c&&(k.params={...k.params,_meta:{...((m=k.params)===null||m===void 0?void 0:m._meta)||{},[To]:c}});let T=Z=>{var oe;this._responseHandlers.delete(x),this._progressHandlers.delete(x),this._cleanupTimeout(x),(oe=this._transport)===null||oe===void 0||oe.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:x,reason:String(Z)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(wt=>this._onerror(new Error(`Failed to send cancellation: ${wt}`)));let Q=Z instanceof de?Z:new de(be.RequestTimeout,String(Z));l(Q)};this._responseHandlers.set(x,Z=>{var oe;if(!(!((oe=n?.signal)===null||oe===void 0)&&oe.aborted)){if(Z instanceof Error)return l(Z);try{let Q=Jn(r,Z.result);Q.success?u(Q.data):l(Q.error)}catch(Q){l(Q)}}}),(h=n?.signal)===null||h===void 0||h.addEventListener("abort",()=>{var Z;T((Z=n?.signal)===null||Z===void 0?void 0:Z.reason)});let F=(_=n?.timeout)!==null&&_!==void 0?_:k7,J=()=>T(de.fromError(be.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(x,F,n?.maxTotalTimeout,J,(v=n?.resetTimeoutOnProgress)!==null&&v!==void 0?v:!1);let w=c?.taskId;if(w){let Z=oe=>{let Q=this._responseHandlers.get(x);Q?Q(oe):this._onerror(new Error(`Response handler missing for side-channeled request ${x}`))};this._requestResolvers.set(x,Z),this._enqueueTaskMessage(w,{type:"request",message:k,timestamp:Date.now()}).catch(oe=>{this._cleanupTimeout(x),l(oe)})}else this._transport.send(k,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(Z=>{this._cleanupTimeout(x),l(Z)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Zv,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Gv,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Bj,r)}async notification(e,r){var n,o,i,s,a;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let c=(n=r?.relatedTask)===null||n===void 0?void 0:n.taskId;if(c){let f={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...((o=e.params)===null||o===void 0?void 0:o._meta)||{},[To]:r.relatedTask}}};await this._enqueueTaskMessage(c,{type:"notification",message:f,timestamp:Date.now()});return}if(((s=(i=this._options)===null||i===void 0?void 0:i.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var f,p;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let m={...e,jsonrpc:"2.0"};r?.relatedTask&&(m={...m,params:{...m.params,_meta:{...((f=m.params)===null||f===void 0?void 0:f._meta)||{},[To]:r.relatedTask}}}),(p=this._transport)===null||p===void 0||p.send(m,r).catch(h=>this._onerror(h))});return}let d={...e,jsonrpc:"2.0"};r?.relatedTask&&(d={...d,params:{...d.params,_meta:{...((a=d.params)===null||a===void 0?void 0:a._meta)||{},[To]:r.relatedTask}}}),await this._transport.send(d,r)}setRequestHandler(e,r){let n=NS(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let s=zS(e,o);return Promise.resolve(r(s,i))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=NS(e);this._notificationHandlers.set(n,o=>{let i=zS(e,o);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){var o;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=(o=this._options)===null||o===void 0?void 0:o.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,i)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&hS(o.message)){let i=o.message.id,s=this._requestResolvers.get(i);s?(s(new de(be.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){var n,o,i;let s=(o=(n=this._options)===null||n===void 0?void 0:n.defaultTaskPollInterval)!==null&&o!==void 0?o:1e3;try{let a=await((i=this._taskStore)===null||i===void 0?void 0:i.getTask(e));a?.pollInterval&&(s=a.pollInterval)}catch{}return new Promise((a,c)=>{if(r.aborted){c(new de(be.InvalidRequest,"Request cancelled"));return}let u=setTimeout(a,s);r.addEventListener("abort",()=>{clearTimeout(u),c(new de(be.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new de(be.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await n.storeTaskResult(o,i,s,r);let a=await n.getTask(o,r);if(a){let c=Ef.parse({method:"notifications/tasks/status",params:a});await this.notification(c),gs(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,s)=>{let a=await n.getTask(o,r);if(!a)throw new de(be.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(gs(a.status))throw new de(be.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,s,r);let c=await n.getTask(o,r);if(c){let u=Ef.parse({method:"notifications/tasks/status",params:c});await this.notification(u),gs(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Wj(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Jj(t,e){let r={...t};for(let n in e){let o=n,i=e[o];if(i===void 0)continue;let s=r[o];Wj(s)&&Wj(i)?r[o]={...s,...i}:r[o]=i}return r}var MU=mn(bT(),1),jU=mn(zU(),1);function gre(){let t=new MU.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,jU.default)(t),t}var Ob=class{constructor(e){this._ajv=e??gre()}getValidator(e){var r;let n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return o=>n(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Pb=class{constructor(e){this._client=e}async*callToolStream(e,r=$l,n){var o;let i=this._client,s={...n,task:(o=n?.task)!==null&&o!==void 0?o:i.isToolTask(e.name)?{}:void 0},a=i.requestStream({method:"tools/call",params:e},r,s),c=i.getToolOutputValidator(e.name);for await(let u of a){if(u.type==="result"&&c){let l=u.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new de(be.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{let d=c(l.structuredContent);if(!d.valid){yield{type:"error",error:new de(be.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof de){yield{type:"error",error:d};return}yield{type:"error",error:new de(be.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield u}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function DU(t,e,r){var n;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!(!((n=t.tools)===null||n===void 0)&&n.call))throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function LU(t,e,r){var n,o;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!(!((n=t.sampling)===null||n===void 0)&&n.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!(!((o=t.elicitation)===null||o===void 0)&&o.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function Cb(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let o of Object.keys(n)){let i=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[o]=i.default),r[o]!==void 0&&Cb(i,r[o])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)Cb(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)Cb(r,e)}}function _re(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var Rb=class extends Kv{constructor(e,r){var n,o;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._jsonSchemaValidator=(o=r?.jsonSchemaValidator)!==null&&o!==void 0?o:new Ob}get experimental(){return this._experimental||(this._experimental={tasks:new Pb(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Jj(this._capabilities,e)}setRequestHandler(e,r){var n,o,i;let s=zv(e),a=s?.method;if(!a)throw new Error("Schema is missing a method literal");let c;if(bl(a)){let l=a,d=(n=l._zod)===null||n===void 0?void 0:n.def;c=(o=d?.value)!==null&&o!==void 0?o:l.value}else{let l=a,d=l._def;c=(i=d?.value)!==null&&i!==void 0?i:l.value}if(typeof c!="string")throw new Error("Schema method literal must be a string");let u=c;if(u==="elicitation/create"){let l=async(d,f)=>{var p,m,h;let _=Jn(PS,d);if(!_.success){let Z=_.error instanceof Error?_.error.message:String(_.error);throw new de(be.InvalidParams,`Invalid elicitation request: ${Z}`)}let{params:v}=_.data,b=(p=v.mode)!==null&&p!==void 0?p:"form",{supportsFormMode:x,supportsUrlMode:k}=_re(this._capabilities.elicitation);if(b==="form"&&!x)throw new de(be.InvalidParams,"Client does not support form-mode elicitation requests");if(b==="url"&&!k)throw new de(be.InvalidParams,"Client does not support URL-mode elicitation requests");let T=await Promise.resolve(r(d,f));if(v.task){let Z=Jn(Ya,T);if(!Z.success){let oe=Z.error instanceof Error?Z.error.message:String(Z.error);throw new de(be.InvalidParams,`Invalid task creation result: ${oe}`)}return Z.data}let F=Jn(CS,T);if(!F.success){let Z=F.error instanceof Error?F.error.message:String(F.error);throw new de(be.InvalidParams,`Invalid elicitation result: ${Z}`)}let J=F.data,w=b==="form"?v.requestedSchema:void 0;if(b==="form"&&J.action==="accept"&&J.content&&w&&!((h=(m=this._capabilities.elicitation)===null||m===void 0?void 0:m.form)===null||h===void 0)&&h.applyDefaults)try{Cb(w,J.content)}catch{}return J};return super.setRequestHandler(e,l)}if(u==="sampling/createMessage"){let l=async(d,f)=>{let p=Jn(AS,d);if(!p.success){let v=p.error instanceof Error?p.error.message:String(p.error);throw new de(be.InvalidParams,`Invalid sampling request: ${v}`)}let{params:m}=p.data,h=await Promise.resolve(r(d,f));if(m.task){let v=Jn(Ya,h);if(!v.success){let b=v.error instanceof Error?v.error.message:String(v.error);throw new de(be.InvalidParams,`Invalid task creation result: ${b}`)}return v.data}let _=Jn(OS,h);if(!_.success){let v=_.error instanceof Error?_.error.message:String(_.error);throw new de(be.InvalidParams,`Invalid sampling result: ${v}`)}return _.data};return super.setRequestHandler(e,l)}return super.setRequestHandler(e,r)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:fS,capabilities:this._capabilities,clientInfo:this._clientInfo}},gS,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!Pj.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,o,i,s;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){var r,n;DU((n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests,e,"Server")}assertTaskHandlerCapability(e){var r;this._capabilities&&LU((r=this._capabilities.tasks)===null||r===void 0?void 0:r.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Xa,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},RS,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Xa,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},TS,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},xS,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},yS,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},vS,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},wS,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Xa,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Xa,r)}async callTool(e,r=$l,n){if(this.isToolTaskRequired(e.name))throw new de(be.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},r,n),i=this.getToolOutputValidator(e.name);if(i){if(!o.structuredContent&&!o.isError)throw new de(be.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let s=i(o.structuredContent);if(!s.valid)throw new de(be.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof de?s:new de(be.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return o}isToolTask(e){var r,n,o,i;return!((i=(o=(n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests)===null||o===void 0?void 0:o.tools)===null||i===void 0)&&i.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){var r;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let n of e){if(n.outputSchema){let i=this._jsonSchemaValidator.getValidator(n.outputSchema);this._cachedToolOutputValidators.set(n.name,i)}let o=(r=n.execution)===null||r===void 0?void 0:r.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(n.name),o==="required"&&this._cachedRequiredTaskTools.add(n.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},ES,r);return this.cacheToolMetadata(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Nb=class extends fl{name;description;toolSpec;mcpClient;constructor(e){super(),this.name=e.name,this.description=e.description,this.toolSpec={name:e.name,description:e.description,inputSchema:e.inputSchema},this.mcpClient=e.client}async*stream(e){let{toolUseId:r,input:n}=e.toolUse;try{let o=await this.mcpClient.callTool(this,n);if(!this._isMcpToolResult(o))throw new Error("Invalid tool result from MCP Client: missing content array");let i=o.content.map(s=>this._isMcpTextContent(s)?new mt(s.text):new Ha({json:s}));return i.length===0&&i.push(new mt("Tool execution completed successfully with no output.")),new Ht({toolUseId:r,status:o.isError?"error":"success",content:i})}catch(o){return lS(o,r)}}_isMcpToolResult(e){return typeof e!="object"||e===null?!1:Array.isArray(e.content)}_isMcpTextContent(e){if(typeof e!="object"||e===null)return!1;let r=e;return r.type==="text"&&typeof r.text=="string"}};var xf=class{_clientName;_clientVersion;_transport;_connected;_client;constructor(e){this._clientName=e.applicationName||"strands-agents-ts-sdk",this._clientVersion=e.applicationVersion||"0.0.1",this._transport=e.transport,this._connected=!1,this._client=new Rb({name:this._clientName,version:this._clientVersion})}get client(){return this._client}async connect(e=!1){this._connected&&!e||(this._connected&&e&&(await this._client.close(),this._connected=!1),await this._client.connect(this._transport),this._connected=!0)}async disconnect(){await this._client.close(),await this._transport.close(),this._connected=!1}async listTools(){return await this.connect(),(await this._client.listTools()).tools.map(r=>new Nb({name:r.name,description:r.description??"",inputSchema:r.inputSchema,client:this}))}async callTool(e,r){if(await this.connect(),r==null)return await this.callTool(e,{});if(typeof r!="object"||Array.isArray(r))throw new Error(`MCP Protocol Error: Tool arguments must be a JSON Object (named parameters). Received: ${Array.isArray(r)?"Array":typeof r}`);return await this._client.callTool({name:e.name,arguments:r})}};var UU=({model:t})=>{let e=new ms({region:"us-east-1",modelId:t,maxTokens:4096,temperature:.7});return new bf({model:e})};var yre=async({question:t="\u3053\u3093\u306B\u3061\u306F\uFF01",model:e="us.amazon.nova-micro-v1:0"},r)=>{let n=UU({model:e});for await(let o of n.stream(t))o.type==="modelContentBlockDeltaEvent"&&o.delta.type==="textDelta"&&r.write(o.delta.text)},vre=awslambda.streamifyResponse(async(t,e)=>{wm.debug("event",{event:t});let{question:r,model:n}=t.body?JSON.parse(t.body):{question:"\u3042\u306A\u305F\u306F\u8AB0\uFF1F",model:"gpt"};await yre({question:r,model:n},e),e.end()}),EBe=vre;export{EBe as default,yre as handle,vre as handler}; +/*! Bundled license information: + +@aws-lambda-powertools/logger/lib/esm/logBuffer.js: + (* v8 ignore next -- @preserve *) + +@langchain/core/dist/utils/fast-json-patch/src/helpers.js: + (*! + * https://github.com/Starcounter-Jack/JSON-Patch + * (c) 2017-2022 Joachim Wester + * MIT licensed + *) + +@langchain/core/dist/utils/sax-js/sax.js: + (*! http://mths.be/fromcodepoint v0.1.0 by @mathias *) +*/ diff --git a/agents/agent-strands/cdk.out/cdk.out b/agents/agent-strands/cdk.out/cdk.out new file mode 100644 index 00000000..523a9aac --- /dev/null +++ b/agents/agent-strands/cdk.out/cdk.out @@ -0,0 +1 @@ +{"version":"48.0.0"} \ No newline at end of file diff --git a/agents/agent-strands/cdk.out/manifest.json b/agents/agent-strands/cdk.out/manifest.json new file mode 100644 index 00000000..dcc463af --- /dev/null +++ b/agents/agent-strands/cdk.out/manifest.json @@ -0,0 +1,521 @@ +{ + "version": "48.0.0", + "artifacts": { + "agent-strands-lambda-example.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "agent-strands-lambda-example.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "agent-strands-lambda-example": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "agent-strands-lambda-example.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/3f8dbdc3ac62bea8df0a326a27741714ed2c72c72c4f444c3c879792383f5078.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "agent-strands-lambda-example.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "agent-strands-lambda-example.assets" + ], + "metadata": { + "/agent-strands-lambda-example/ApolloLambdaFunctionLogGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApolloLambdaFunctionLogGroup34540FC6" + } + ], + "/agent-strands-lambda-example/ApolloLambdaFunctionExecutionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApolloLambdaFunctionExecutionRole85D9D1FB" + } + ], + "/agent-strands-lambda-example/Lambda/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaD247545B" + } + ], + "/agent-strands-lambda-example/Lambda/EventInvokeConfig/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaEventInvokeConfig9A47C8EE" + } + ], + "/agent-strands-lambda-example/Lambda/invoke-function-url": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdainvokefunctionurlECBD6AC0" + } + ], + "/agent-strands-lambda-example/Lambda/invoke-function": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdainvokefunctionCF40E9E5" + } + ], + "/agent-strands-lambda-example/LambdaFunctionUrl/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaFunctionUrl62966E86" + } + ], + "/agent-strands-lambda-example/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/agent-strands-lambda-example/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "agent-strands-lambda-example" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "aws-cdk-lib/feature-flag-report": { + "type": "cdk:feature-flag-report", + "properties": { + "module": "aws-cdk-lib", + "flags": { + "@aws-cdk/aws-signer:signingProfileNamePassedToCfn": { + "recommendedValue": true, + "explanation": "Pass signingProfileName to CfnSigningProfile" + }, + "@aws-cdk/core:newStyleStackSynthesis": { + "recommendedValue": true, + "explanation": "Switch to new stack synthesis method which enables CI/CD", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/core:stackRelativeExports": { + "recommendedValue": true, + "explanation": "Name exports based on the construct paths relative to the stack, rather than the global construct path", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-ecs-patterns:secGroupsDisablesImplicitOpenListener": { + "recommendedValue": true, + "explanation": "Disable implicit openListener when custom security groups are provided" + }, + "@aws-cdk/aws-rds:lowercaseDbIdentifier": { + "recommendedValue": true, + "explanation": "Force lowercasing of RDS Cluster names in CDK", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": { + "recommendedValue": true, + "explanation": "Allow adding/removing multiple UsagePlanKeys independently", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-lambda:recognizeVersionProps": { + "recommendedValue": true, + "explanation": "Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-lambda:recognizeLayerVersion": { + "recommendedValue": true, + "explanation": "Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`." + }, + "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": { + "recommendedValue": true, + "explanation": "Enable this feature flag to have cloudfront distributions use the security policy TLSv1.2_2021 by default.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/core:checkSecretUsage": { + "recommendedValue": true, + "explanation": "Enable this flag to make it impossible to accidentally use SecretValues in unsafe locations" + }, + "@aws-cdk/core:target-partitions": { + "recommendedValue": [ + "aws", + "aws-cn" + ], + "explanation": "What regions to include in lookup tables of environment agnostic stacks" + }, + "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": { + "recommendedValue": true, + "explanation": "ECS extensions will automatically add an `awslogs` driver if no logging is specified" + }, + "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": { + "recommendedValue": true, + "explanation": "Enable this feature flag to have Launch Templates generated by the `InstanceRequireImdsv2Aspect` use unique names." + }, + "@aws-cdk/aws-ecs:arnFormatIncludesClusterName": { + "recommendedValue": true, + "explanation": "ARN format used by ECS. In the new ARN format, the cluster name is part of the resource ID." + }, + "@aws-cdk/aws-iam:minimizePolicies": { + "recommendedValue": true, + "explanation": "Minimize IAM policies by combining Statements" + }, + "@aws-cdk/core:validateSnapshotRemovalPolicy": { + "recommendedValue": true, + "explanation": "Error on snapshot removal policies on resources that do not support it." + }, + "@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": { + "recommendedValue": true, + "explanation": "Generate key aliases that include the stack name" + }, + "@aws-cdk/aws-s3:createDefaultLoggingPolicy": { + "recommendedValue": true, + "explanation": "Enable this feature flag to create an S3 bucket policy by default in cases where an AWS service would automatically create the Policy if one does not exist." + }, + "@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": { + "recommendedValue": true, + "explanation": "Restrict KMS key policy for encrypted Queues a bit more" + }, + "@aws-cdk/aws-apigateway:disableCloudWatchRole": { + "recommendedValue": true, + "explanation": "Make default CloudWatch Role behavior safe for multiple API Gateways in one environment" + }, + "@aws-cdk/core:enablePartitionLiterals": { + "recommendedValue": true, + "explanation": "Make ARNs concrete if AWS partition is known" + }, + "@aws-cdk/aws-events:eventsTargetQueueSameAccount": { + "recommendedValue": true, + "explanation": "Event Rules may only push to encrypted SQS queues in the same account" + }, + "@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": { + "recommendedValue": true, + "explanation": "Avoid setting the \"ECS\" deployment controller when adding a circuit breaker" + }, + "@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": { + "recommendedValue": true, + "explanation": "Enable this feature to create default policy names for imported roles that depend on the stack the role is in." + }, + "@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": { + "recommendedValue": true, + "explanation": "Use S3 Bucket Policy instead of ACLs for Server Access Logging" + }, + "@aws-cdk/aws-route53-patters:useCertificate": { + "recommendedValue": true, + "explanation": "Use the official `Certificate` resource instead of `DnsValidatedCertificate`" + }, + "@aws-cdk/customresources:installLatestAwsSdkDefault": { + "recommendedValue": false, + "explanation": "Whether to install the latest SDK by default in AwsCustomResource" + }, + "@aws-cdk/aws-rds:databaseProxyUniqueResourceName": { + "recommendedValue": true, + "explanation": "Use unique resource name for Database Proxy" + }, + "@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": { + "recommendedValue": true, + "explanation": "Remove CloudWatch alarms from deployment group" + }, + "@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": { + "recommendedValue": true, + "explanation": "Include authorizer configuration in the calculation of the API deployment logical ID." + }, + "@aws-cdk/aws-ec2:launchTemplateDefaultUserData": { + "recommendedValue": true, + "explanation": "Define user data for a launch template by default when a machine image is provided." + }, + "@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": { + "recommendedValue": true, + "explanation": "SecretTargetAttachments uses the ResourcePolicy of the attached Secret." + }, + "@aws-cdk/aws-redshift:columnId": { + "recommendedValue": true, + "explanation": "Whether to use an ID to track Redshift column changes" + }, + "@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": { + "recommendedValue": true, + "explanation": "Enable AmazonEMRServicePolicy_v2 managed policies" + }, + "@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": { + "recommendedValue": true, + "explanation": "Restrict access to the VPC default security group" + }, + "@aws-cdk/aws-apigateway:requestValidatorUniqueId": { + "recommendedValue": true, + "explanation": "Generate a unique id for each RequestValidator added to a method" + }, + "@aws-cdk/aws-kms:aliasNameRef": { + "recommendedValue": true, + "explanation": "KMS Alias name and keyArn will have implicit reference to KMS Key" + }, + "@aws-cdk/aws-kms:applyImportedAliasPermissionsToPrincipal": { + "recommendedValue": true, + "explanation": "Enable grant methods on Aliases imported by name to use kms:ResourceAliases condition" + }, + "@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": { + "recommendedValue": true, + "explanation": "Generate a launch template when creating an AutoScalingGroup" + }, + "@aws-cdk/core:includePrefixInUniqueNameGeneration": { + "recommendedValue": true, + "explanation": "Include the stack prefix in the stack name generation process" + }, + "@aws-cdk/aws-efs:denyAnonymousAccess": { + "recommendedValue": true, + "explanation": "EFS denies anonymous clients accesses" + }, + "@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": { + "recommendedValue": true, + "explanation": "Enables support for Multi-AZ with Standby deployment for opensearch domains" + }, + "@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": { + "recommendedValue": true, + "explanation": "Enables aws-lambda-nodejs.Function to use the latest available NodeJs runtime as the default" + }, + "@aws-cdk/aws-efs:mountTargetOrderInsensitiveLogicalId": { + "recommendedValue": true, + "explanation": "When enabled, mount targets will have a stable logicalId that is linked to the associated subnet." + }, + "@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": { + "recommendedValue": true, + "explanation": "When enabled, a scope of InstanceParameterGroup for AuroraClusterInstance with each parameters will change." + }, + "@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": { + "recommendedValue": true, + "explanation": "When enabled, will always use the arn for identifiers for CfnSourceApiAssociation in the GraphqlApi construct rather than id." + }, + "@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": { + "recommendedValue": true, + "explanation": "When enabled, creating an RDS database cluster from a snapshot will only render credentials for snapshot credentials." + }, + "@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": { + "recommendedValue": true, + "explanation": "When enabled, the CodeCommit source action is using the default branch name 'main'." + }, + "@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction": { + "recommendedValue": true, + "explanation": "When enabled, the logical ID of a Lambda permission for a Lambda action includes an alarm ID." + }, + "@aws-cdk/aws-codepipeline:crossAccountKeysDefaultValueToFalse": { + "recommendedValue": true, + "explanation": "Enables Pipeline to set the default value for crossAccountKeys to false." + }, + "@aws-cdk/aws-codepipeline:defaultPipelineTypeToV2": { + "recommendedValue": true, + "explanation": "Enables Pipeline to set the default pipeline type to V2." + }, + "@aws-cdk/aws-kms:reduceCrossAccountRegionPolicyScope": { + "recommendedValue": true, + "explanation": "When enabled, IAM Policy created from KMS key grant will reduce the resource scope to this key only." + }, + "@aws-cdk/pipelines:reduceAssetRoleTrustScope": { + "recommendedValue": true, + "explanation": "Remove the root account principal from PipelineAssetsFileRole trust policy", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-eks:nodegroupNameAttribute": { + "recommendedValue": true, + "explanation": "When enabled, nodegroupName attribute of the provisioned EKS NodeGroup will not have the cluster name prefix." + }, + "@aws-cdk/aws-ec2:ebsDefaultGp3Volume": { + "recommendedValue": true, + "explanation": "When enabled, the default volume type of the EBS volume will be GP3" + }, + "@aws-cdk/aws-ecs:removeDefaultDeploymentAlarm": { + "recommendedValue": true, + "explanation": "When enabled, remove default deployment alarm settings" + }, + "@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault": { + "recommendedValue": false, + "explanation": "When enabled, the custom resource used for `AwsCustomResource` will configure the `logApiResponseData` property as true by default" + }, + "@aws-cdk/aws-s3:keepNotificationInImportedBucket": { + "recommendedValue": false, + "explanation": "When enabled, Adding notifications to a bucket in the current stack will not remove notification from imported stack." + }, + "@aws-cdk/aws-stepfunctions-tasks:useNewS3UriParametersForBedrockInvokeModelTask": { + "recommendedValue": true, + "explanation": "When enabled, use new props for S3 URI field in task definition of state machine for bedrock invoke model.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/core:explicitStackTags": { + "recommendedValue": true, + "explanation": "When enabled, stack tags need to be assigned explicitly on a Stack." + }, + "@aws-cdk/aws-ecs:enableImdsBlockingDeprecatedFeature": { + "recommendedValue": false, + "explanation": "When set to true along with canContainersAccessInstanceRole=false in ECS cluster, new updated commands will be added to UserData to block container accessing IMDS. **Applicable to Linux only. IMPORTANT: See [details.](#aws-cdkaws-ecsenableImdsBlockingDeprecatedFeature)**" + }, + "@aws-cdk/aws-ecs:disableEcsImdsBlocking": { + "recommendedValue": true, + "explanation": "When set to true, CDK synth will throw exception if canContainersAccessInstanceRole is false. **IMPORTANT: See [details.](#aws-cdkaws-ecsdisableEcsImdsBlocking)**" + }, + "@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions": { + "recommendedValue": true, + "explanation": "When enabled, we will only grant the necessary permissions when users specify cloudwatch log group through logConfiguration" + }, + "@aws-cdk/aws-dynamodb:resourcePolicyPerReplica": { + "recommendedValue": true, + "explanation": "When enabled will allow you to specify a resource policy per replica, and not copy the source table policy to all replicas" + }, + "@aws-cdk/aws-ec2:ec2SumTImeoutEnabled": { + "recommendedValue": true, + "explanation": "When enabled, initOptions.timeout and resourceSignalTimeout values will be summed together." + }, + "@aws-cdk/aws-appsync:appSyncGraphQLAPIScopeLambdaPermission": { + "recommendedValue": true, + "explanation": "When enabled, a Lambda authorizer Permission created when using GraphqlApi will be properly scoped with a SourceArn." + }, + "@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId": { + "recommendedValue": true, + "explanation": "When enabled, the value of property `instanceResourceId` in construct `DatabaseInstanceReadReplica` will be set to the correct value which is `DbiResourceId` instead of currently `DbInstanceArn`" + }, + "@aws-cdk/core:cfnIncludeRejectComplexResourceUpdateCreatePolicyIntrinsics": { + "recommendedValue": true, + "explanation": "When enabled, CFN templates added with `cfn-include` will error if the template contains Resource Update or Create policies with CFN Intrinsics that include non-primitive values." + }, + "@aws-cdk/aws-lambda-nodejs:sdkV3ExcludeSmithyPackages": { + "recommendedValue": true, + "explanation": "When enabled, both `@aws-sdk` and `@smithy` packages will be excluded from the Lambda Node.js 18.x runtime to prevent version mismatches in bundled applications." + }, + "@aws-cdk/aws-stepfunctions-tasks:fixRunEcsTaskPolicy": { + "recommendedValue": true, + "explanation": "When enabled, the resource of IAM Run Ecs policy generated by SFN EcsRunTask will reference the definition, instead of constructing ARN." + }, + "@aws-cdk/aws-ec2:bastionHostUseAmazonLinux2023ByDefault": { + "recommendedValue": true, + "explanation": "When enabled, the BastionHost construct will use the latest Amazon Linux 2023 AMI, instead of Amazon Linux 2." + }, + "@aws-cdk/core:aspectStabilization": { + "recommendedValue": true, + "explanation": "When enabled, a stabilization loop will be run when invoking Aspects during synthesis.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-route53-targets:userPoolDomainNameMethodWithoutCustomResource": { + "recommendedValue": true, + "explanation": "When enabled, use a new method for DNS Name of user pool domain target without creating a custom resource." + }, + "@aws-cdk/aws-elasticloadbalancingV2:albDualstackWithoutPublicIpv4SecurityGroupRulesDefault": { + "recommendedValue": true, + "explanation": "When enabled, the default security group ingress rules will allow IPv6 ingress from anywhere" + }, + "@aws-cdk/aws-iam:oidcRejectUnauthorizedConnections": { + "recommendedValue": true, + "explanation": "When enabled, the default behaviour of OIDC provider will reject unauthorized connections" + }, + "@aws-cdk/core:enableAdditionalMetadataCollection": { + "recommendedValue": true, + "explanation": "When enabled, CDK will expand the scope of usage data collected to better inform CDK development and improve communication for security concerns and emerging issues." + }, + "@aws-cdk/aws-lambda:createNewPoliciesWithAddToRolePolicy": { + "recommendedValue": false, + "explanation": "[Deprecated] When enabled, Lambda will create new inline policies with AddToRolePolicy instead of adding to the Default Policy Statement" + }, + "@aws-cdk/aws-s3:setUniqueReplicationRoleName": { + "recommendedValue": true, + "explanation": "When enabled, CDK will automatically generate a unique role name that is used for s3 object replication." + }, + "@aws-cdk/pipelines:reduceStageRoleTrustScope": { + "recommendedValue": true, + "explanation": "Remove the root account principal from Stage addActions trust policy", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-events:requireEventBusPolicySid": { + "recommendedValue": true, + "explanation": "When enabled, grantPutEventsTo() will use resource policies with Statement IDs for service principals." + }, + "@aws-cdk/core:aspectPrioritiesMutating": { + "recommendedValue": true, + "explanation": "When set to true, Aspects added by the construct library on your behalf will be given a priority of MUTATING." + }, + "@aws-cdk/aws-dynamodb:retainTableReplica": { + "recommendedValue": true, + "explanation": "When enabled, table replica will be default to the removal policy of source table unless specified otherwise." + }, + "@aws-cdk/cognito:logUserPoolClientSecretValue": { + "recommendedValue": false, + "explanation": "When disabled, the value of the user pool client secret will not be logged in the custom resource lambda function logs." + }, + "@aws-cdk/pipelines:reduceCrossAccountActionRoleTrustScope": { + "recommendedValue": true, + "explanation": "When enabled, scopes down the trust policy for the cross-account action role", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-stepfunctions:useDistributedMapResultWriterV2": { + "recommendedValue": true, + "explanation": "When enabled, the resultWriterV2 property of DistributedMap will be used insted of resultWriter" + }, + "@aws-cdk/s3-notifications:addS3TrustKeyPolicyForSnsSubscriptions": { + "recommendedValue": true, + "explanation": "Add an S3 trust policy to a KMS key resource policy for SNS subscriptions." + }, + "@aws-cdk/aws-ec2:requirePrivateSubnetsForEgressOnlyInternetGateway": { + "recommendedValue": true, + "explanation": "When enabled, the EgressOnlyGateway resource is only created if private subnets are defined in the dual-stack VPC." + }, + "@aws-cdk/aws-ec2-alpha:useResourceIdForVpcV2Migration": { + "recommendedValue": false, + "explanation": "When enabled, use resource IDs for VPC V2 migration" + }, + "@aws-cdk/aws-s3:publicAccessBlockedByDefault": { + "recommendedValue": true, + "explanation": "When enabled, setting any combination of options for BlockPublicAccess will automatically set true for any options not defined." + }, + "@aws-cdk/aws-lambda:useCdkManagedLogGroup": { + "recommendedValue": true, + "explanation": "When enabled, CDK creates and manages loggroup for the lambda function" + }, + "@aws-cdk/aws-elasticloadbalancingv2:networkLoadBalancerWithSecurityGroupByDefault": { + "recommendedValue": true, + "explanation": "When enabled, Network Load Balancer will be created with a security group by default." + }, + "@aws-cdk/aws-stepfunctions-tasks:httpInvokeDynamicJsonPathEndpoint": { + "recommendedValue": true, + "explanation": "When enabled, allows using a dynamic apiEndpoint with JSONPath format in HttpInvoke tasks.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-ecs-patterns:uniqueTargetGroupId": { + "recommendedValue": true, + "explanation": "When enabled, ECS patterns will generate unique target group IDs to prevent conflicts during load balancer replacement" + } + } + } + } + }, + "minimumCliVersion": "2.1033.0" +} \ No newline at end of file diff --git a/agents/agent-strands/cdk.out/tree.json b/agents/agent-strands/cdk.out/tree.json new file mode 100644 index 00000000..d985640c --- /dev/null +++ b/agents/agent-strands/cdk.out/tree.json @@ -0,0 +1 @@ +{"version":"tree-0.1","tree":{"id":"App","path":"","constructInfo":{"fqn":"aws-cdk-lib.App","version":"2.232.1"},"children":{"agent-strands-lambda-example":{"id":"agent-strands-lambda-example","path":"agent-strands-lambda-example","constructInfo":{"fqn":"aws-cdk-lib.Stack","version":"2.232.1"},"children":{"ApolloLambdaFunctionLogGroup":{"id":"ApolloLambdaFunctionLogGroup","path":"agent-strands-lambda-example/ApolloLambdaFunctionLogGroup","constructInfo":{"fqn":"aws-cdk-lib.aws_logs.LogGroup","version":"2.232.1","metadata":[]},"children":{"Resource":{"id":"Resource","path":"agent-strands-lambda-example/ApolloLambdaFunctionLogGroup/Resource","constructInfo":{"fqn":"aws-cdk-lib.aws_logs.CfnLogGroup","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::Logs::LogGroup","aws:cdk:cloudformation:props":{"logGroupName":"/aws/lambda/agent-strands-lambda-example","retentionInDays":1}}}}},"ApolloLambdaFunctionExecutionRole":{"id":"ApolloLambdaFunctionExecutionRole","path":"agent-strands-lambda-example/ApolloLambdaFunctionExecutionRole","constructInfo":{"fqn":"aws-cdk-lib.aws_iam.Role","version":"2.232.1","metadata":[]},"children":{"ImportApolloLambdaFunctionExecutionRole":{"id":"ImportApolloLambdaFunctionExecutionRole","path":"agent-strands-lambda-example/ApolloLambdaFunctionExecutionRole/ImportApolloLambdaFunctionExecutionRole","constructInfo":{"fqn":"aws-cdk-lib.Resource","version":"2.232.1","metadata":[]}},"Resource":{"id":"Resource","path":"agent-strands-lambda-example/ApolloLambdaFunctionExecutionRole/Resource","constructInfo":{"fqn":"aws-cdk-lib.aws_iam.CfnRole","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::IAM::Role","aws:cdk:cloudformation:props":{"assumeRolePolicyDocument":{"Statement":[{"Action":"sts:AssumeRole","Effect":"Allow","Principal":{"Service":"lambda.amazonaws.com"}}],"Version":"2012-10-17"},"managedPolicyArns":[{"Fn::Join":["",["arn:",{"Ref":"AWS::Partition"},":iam::aws:policy/AWSLambdaExecute"]]},{"Fn::Join":["",["arn:",{"Ref":"AWS::Partition"},":iam::aws:policy/CloudFrontReadOnlyAccess"]]}],"policies":[{"policyName":"bedrock-policy","policyDocument":{"Statement":[{"Action":["bedrock:InvokeModel*","logs:PutLogEvents"],"Effect":"Allow","Resource":"*"}],"Version":"2012-10-17"}}]}}}}},"Lambda":{"id":"Lambda","path":"agent-strands-lambda-example/Lambda","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda_nodejs.NodejsFunction","version":"2.232.1","metadata":[]},"children":{"Code":{"id":"Code","path":"agent-strands-lambda-example/Lambda/Code","constructInfo":{"fqn":"aws-cdk-lib.aws_s3_assets.Asset","version":"2.232.1"},"children":{"Stage":{"id":"Stage","path":"agent-strands-lambda-example/Lambda/Code/Stage","constructInfo":{"fqn":"aws-cdk-lib.AssetStaging","version":"2.232.1"}},"AssetBucket":{"id":"AssetBucket","path":"agent-strands-lambda-example/Lambda/Code/AssetBucket","constructInfo":{"fqn":"aws-cdk-lib.aws_s3.BucketBase","version":"2.232.1","metadata":[]}}}},"Resource":{"id":"Resource","path":"agent-strands-lambda-example/Lambda/Resource","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.CfnFunction","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::Lambda::Function","aws:cdk:cloudformation:props":{"architectures":["arm64"],"code":{"s3Bucket":{"Fn::Sub":"cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"},"s3Key":"60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321.zip"},"functionName":"agent-strands-lambda-example","handler":"index.handler","loggingConfig":{"logFormat":"JSON","applicationLogLevel":"TRACE"},"memorySize":256,"role":{"Fn::GetAtt":["ApolloLambdaFunctionExecutionRole85D9D1FB","Arn"]},"runtime":"nodejs24.x","timeout":60}}},"EventInvokeConfig":{"id":"EventInvokeConfig","path":"agent-strands-lambda-example/Lambda/EventInvokeConfig","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.EventInvokeConfig","version":"2.232.1","metadata":[]},"children":{"Resource":{"id":"Resource","path":"agent-strands-lambda-example/Lambda/EventInvokeConfig/Resource","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.CfnEventInvokeConfig","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::Lambda::EventInvokeConfig","aws:cdk:cloudformation:props":{"functionName":{"Ref":"LambdaD247545B"},"maximumRetryAttempts":0,"qualifier":"$LATEST"}}}}},"invoke-function-url":{"id":"invoke-function-url","path":"agent-strands-lambda-example/Lambda/invoke-function-url","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.CfnPermission","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::Lambda::Permission","aws:cdk:cloudformation:props":{"action":"lambda:InvokeFunctionUrl","functionName":{"Fn::GetAtt":["LambdaD247545B","Arn"]},"functionUrlAuthType":"NONE","principal":"*"}}},"invoke-function":{"id":"invoke-function","path":"agent-strands-lambda-example/Lambda/invoke-function","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.CfnPermission","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::Lambda::Permission","aws:cdk:cloudformation:props":{"action":"lambda:InvokeFunction","functionName":{"Fn::GetAtt":["LambdaD247545B","Arn"]},"invokedViaFunctionUrl":true,"principal":"*"}}}}},"LambdaFunctionUrl":{"id":"LambdaFunctionUrl","path":"agent-strands-lambda-example/LambdaFunctionUrl","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.FunctionUrl","version":"2.232.1","metadata":[]},"children":{"Resource":{"id":"Resource","path":"agent-strands-lambda-example/LambdaFunctionUrl/Resource","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.CfnUrl","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::Lambda::Url","aws:cdk:cloudformation:props":{"authType":"NONE","invokeMode":"RESPONSE_STREAM","targetFunctionArn":{"Fn::GetAtt":["LambdaD247545B","Arn"]}}}}}},"BootstrapVersion":{"id":"BootstrapVersion","path":"agent-strands-lambda-example/BootstrapVersion","constructInfo":{"fqn":"aws-cdk-lib.CfnParameter","version":"2.232.1"}},"CheckBootstrapVersion":{"id":"CheckBootstrapVersion","path":"agent-strands-lambda-example/CheckBootstrapVersion","constructInfo":{"fqn":"aws-cdk-lib.CfnRule","version":"2.232.1"}}}},"Tree":{"id":"Tree","path":"Tree","constructInfo":{"fqn":"constructs.Construct","version":"10.4.3"}}}}} \ No newline at end of file diff --git a/agents/agent-strands/eslint.config.d.ts b/agents/agent-strands/eslint.config.d.ts new file mode 100644 index 00000000..cc2be66e --- /dev/null +++ b/agents/agent-strands/eslint.config.d.ts @@ -0,0 +1,3 @@ +import { Config } from 'eslint/config'; +declare const eslintConfig: Config[]; +export default eslintConfig; diff --git a/agents/agent-strands/eslint.config.js b/agents/agent-strands/eslint.config.js new file mode 100644 index 00000000..fd39c5f7 --- /dev/null +++ b/agents/agent-strands/eslint.config.js @@ -0,0 +1,63 @@ +import { defineConfig } from 'eslint/config'; +import eslint from '@eslint/js'; +import { configs, parser } from 'typescript-eslint'; +import stylistic from '@stylistic/eslint-plugin'; +import importPlugin from 'eslint-plugin-import'; +// @ts-expect-error ignore type errors +import pluginPromise from 'eslint-plugin-promise'; +import { includeIgnoreFile } from '@eslint/compat'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const gitignorePath = path.resolve(__dirname, '.gitignore'); +const eslintConfig = defineConfig({ + ignores: [ + ...(includeIgnoreFile(gitignorePath).ignores || []), + '**/*.d.ts', + 'src/tsconfig.json', + 'src/stories', + '**/*.css', + 'node_modules/**/*', + 'out', + 'cdk.out', + 'dist', + 'app', + ], +}, eslint.configs.recommended, configs.strict, configs.stylistic, pluginPromise.configs['flat/recommended'], { + files: ['**/*.ts', '*.js'], + plugins: { + '@stylistic': stylistic, + }, + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + parser, + parserOptions: { + projectService: true, + tsconfigRootDir: __dirname, + allowDefaultProject: ['eslint.config.ts'], + }, + }, + extends: [ + importPlugin.flatConfigs.recommended, + importPlugin.flatConfigs.typescript, + ], + settings: { + 'import/resolver': { + // You will also need to install and configure the TypeScript resolver + // See also https://github.com/import-js/eslint-import-resolver-typescript#configuration + 'typescript': true, + 'node': true, + }, + }, + rules: { + '@stylistic/semi': ['error', 'always'], + '@stylistic/indent': ['error', 2], + '@stylistic/comma-dangle': ['error', 'always-multiline'], + '@stylistic/arrow-parens': ['error', 'always'], + '@stylistic/quotes': ['error', 'single'], + }, +}); +export default eslintConfig; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNsaW50LmNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImVzbGludC5jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFVLFlBQVksRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUNyRCxPQUFPLE1BQU0sTUFBTSxZQUFZLENBQUM7QUFDaEMsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUNwRCxPQUFPLFNBQVMsTUFBTSwwQkFBMEIsQ0FBQztBQUNqRCxPQUFPLFlBQVksTUFBTSxzQkFBc0IsQ0FBQztBQUNoRCxzQ0FBc0M7QUFDdEMsT0FBTyxhQUFhLE1BQU0sdUJBQXVCLENBQUM7QUFFbEQsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDbkQsT0FBTyxJQUFJLE1BQU0sV0FBVyxDQUFDO0FBQzdCLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSxVQUFVLENBQUM7QUFFekMsTUFBTSxVQUFVLEdBQUcsYUFBYSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUM7QUFDbEQsTUFBTSxTQUFTLEdBQUcsSUFBSSxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQztBQUMzQyxNQUFNLGFBQWEsR0FBRyxJQUFJLENBQUMsT0FBTyxDQUFDLFNBQVMsRUFBRSxZQUFZLENBQUMsQ0FBQztBQUU1RCxNQUFNLFlBQVksR0FBYSxZQUFZLENBQ3pDO0lBQ0UsT0FBTyxFQUFFO1FBQ1AsR0FBRyxDQUFDLGlCQUFpQixDQUFDLGFBQWEsQ0FBQyxDQUFDLE9BQU8sSUFBSSxFQUFFLENBQUM7UUFDbkQsV0FBVztRQUNYLG1CQUFtQjtRQUNuQixhQUFhO1FBQ2IsVUFBVTtRQUNWLG1CQUFtQjtRQUNuQixLQUFLO1FBQ0wsU0FBUztRQUNULE1BQU07UUFDTixLQUFLO0tBQ047Q0FDRixFQUNELE1BQU0sQ0FBQyxPQUFPLENBQUMsV0FBVyxFQUMxQixPQUFPLENBQUMsTUFBTSxFQUNkLE9BQU8sQ0FBQyxTQUFTLEVBQ2pCLGFBQWEsQ0FBQyxPQUFPLENBQUMsa0JBQWtCLENBQUMsRUFDekM7SUFDRSxLQUFLLEVBQUUsQ0FBQyxTQUFTLEVBQUUsTUFBTSxDQUFDO0lBQzFCLE9BQU8sRUFBRTtRQUNQLFlBQVksRUFBRSxTQUFTO0tBQ3hCO0lBQ0QsZUFBZSxFQUFFO1FBQ2YsV0FBVyxFQUFFLFFBQVE7UUFDckIsVUFBVSxFQUFFLFFBQVE7UUFDcEIsTUFBTTtRQUNOLGFBQWEsRUFBRTtZQUNiLGNBQWMsRUFBRSxJQUFJO1lBQ3BCLGVBQWUsRUFBRSxTQUFTO1lBQzFCLG1CQUFtQixFQUFFLENBQUMsa0JBQWtCLENBQUM7U0FDMUM7S0FDRjtJQUNELE9BQU8sRUFBRTtRQUNQLFlBQVksQ0FBQyxXQUFXLENBQUMsV0FBVztRQUNwQyxZQUFZLENBQUMsV0FBVyxDQUFDLFVBQVU7S0FDcEM7SUFDRCxRQUFRLEVBQUU7UUFDUixpQkFBaUIsRUFBRTtZQUNqQixzRUFBc0U7WUFDdEUsd0ZBQXdGO1lBQ3hGLFlBQVksRUFBRSxJQUFJO1lBQ2xCLE1BQU0sRUFBRSxJQUFJO1NBQ2I7S0FDRjtJQUNELEtBQUssRUFBRTtRQUNMLGlCQUFpQixFQUFFLENBQUMsT0FBTyxFQUFFLFFBQVEsQ0FBQztRQUN0QyxtQkFBbUIsRUFBRSxDQUFDLE9BQU8sRUFBRSxDQUFDLENBQUM7UUFDakMseUJBQXlCLEVBQUUsQ0FBQyxPQUFPLEVBQUUsa0JBQWtCLENBQUM7UUFDeEQseUJBQXlCLEVBQUUsQ0FBQyxPQUFPLEVBQUUsUUFBUSxDQUFDO1FBQzlDLG1CQUFtQixFQUFFLENBQUMsT0FBTyxFQUFFLFFBQVEsQ0FBQztLQUN6QztDQUNGLENBQ0YsQ0FBQztBQUVGLGVBQWUsWUFBWSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQ29uZmlnLCBkZWZpbmVDb25maWcgfSBmcm9tICdlc2xpbnQvY29uZmlnJztcbmltcG9ydCBlc2xpbnQgZnJvbSAnQGVzbGludC9qcyc7XG5pbXBvcnQgeyBjb25maWdzLCBwYXJzZXIgfSBmcm9tICd0eXBlc2NyaXB0LWVzbGludCc7XG5pbXBvcnQgc3R5bGlzdGljIGZyb20gJ0BzdHlsaXN0aWMvZXNsaW50LXBsdWdpbic7XG5pbXBvcnQgaW1wb3J0UGx1Z2luIGZyb20gJ2VzbGludC1wbHVnaW4taW1wb3J0Jztcbi8vIEB0cy1leHBlY3QtZXJyb3IgaWdub3JlIHR5cGUgZXJyb3JzXG5pbXBvcnQgcGx1Z2luUHJvbWlzZSBmcm9tICdlc2xpbnQtcGx1Z2luLXByb21pc2UnO1xuXG5pbXBvcnQgeyBpbmNsdWRlSWdub3JlRmlsZSB9IGZyb20gJ0Blc2xpbnQvY29tcGF0JztcbmltcG9ydCBwYXRoIGZyb20gJ25vZGU6cGF0aCc7XG5pbXBvcnQgeyBmaWxlVVJMVG9QYXRoIH0gZnJvbSAnbm9kZTp1cmwnO1xuXG5jb25zdCBfX2ZpbGVuYW1lID0gZmlsZVVSTFRvUGF0aChpbXBvcnQubWV0YS51cmwpO1xuY29uc3QgX19kaXJuYW1lID0gcGF0aC5kaXJuYW1lKF9fZmlsZW5hbWUpO1xuY29uc3QgZ2l0aWdub3JlUGF0aCA9IHBhdGgucmVzb2x2ZShfX2Rpcm5hbWUsICcuZ2l0aWdub3JlJyk7XG5cbmNvbnN0IGVzbGludENvbmZpZzogQ29uZmlnW10gPSBkZWZpbmVDb25maWcoXG4gIHtcbiAgICBpZ25vcmVzOiBbXG4gICAgICAuLi4oaW5jbHVkZUlnbm9yZUZpbGUoZ2l0aWdub3JlUGF0aCkuaWdub3JlcyB8fCBbXSksXG4gICAgICAnKiovKi5kLnRzJyxcbiAgICAgICdzcmMvdHNjb25maWcuanNvbicsXG4gICAgICAnc3JjL3N0b3JpZXMnLFxuICAgICAgJyoqLyouY3NzJyxcbiAgICAgICdub2RlX21vZHVsZXMvKiovKicsXG4gICAgICAnb3V0JyxcbiAgICAgICdjZGsub3V0JyxcbiAgICAgICdkaXN0JyxcbiAgICAgICdhcHAnLFxuICAgIF0sXG4gIH0sXG4gIGVzbGludC5jb25maWdzLnJlY29tbWVuZGVkLFxuICBjb25maWdzLnN0cmljdCxcbiAgY29uZmlncy5zdHlsaXN0aWMsXG4gIHBsdWdpblByb21pc2UuY29uZmlnc1snZmxhdC9yZWNvbW1lbmRlZCddLFxuICB7XG4gICAgZmlsZXM6IFsnKiovKi50cycsICcqLmpzJ10sXG4gICAgcGx1Z2luczoge1xuICAgICAgJ0BzdHlsaXN0aWMnOiBzdHlsaXN0aWMsXG4gICAgfSxcbiAgICBsYW5ndWFnZU9wdGlvbnM6IHtcbiAgICAgIGVjbWFWZXJzaW9uOiAnbGF0ZXN0JyxcbiAgICAgIHNvdXJjZVR5cGU6ICdtb2R1bGUnLFxuICAgICAgcGFyc2VyLFxuICAgICAgcGFyc2VyT3B0aW9uczoge1xuICAgICAgICBwcm9qZWN0U2VydmljZTogdHJ1ZSxcbiAgICAgICAgdHNjb25maWdSb290RGlyOiBfX2Rpcm5hbWUsXG4gICAgICAgIGFsbG93RGVmYXVsdFByb2plY3Q6IFsnZXNsaW50LmNvbmZpZy50cyddLFxuICAgICAgfSxcbiAgICB9LFxuICAgIGV4dGVuZHM6IFtcbiAgICAgIGltcG9ydFBsdWdpbi5mbGF0Q29uZmlncy5yZWNvbW1lbmRlZCxcbiAgICAgIGltcG9ydFBsdWdpbi5mbGF0Q29uZmlncy50eXBlc2NyaXB0LFxuICAgIF0sXG4gICAgc2V0dGluZ3M6IHtcbiAgICAgICdpbXBvcnQvcmVzb2x2ZXInOiB7XG4gICAgICAgIC8vIFlvdSB3aWxsIGFsc28gbmVlZCB0byBpbnN0YWxsIGFuZCBjb25maWd1cmUgdGhlIFR5cGVTY3JpcHQgcmVzb2x2ZXJcbiAgICAgICAgLy8gU2VlIGFsc28gaHR0cHM6Ly9naXRodWIuY29tL2ltcG9ydC1qcy9lc2xpbnQtaW1wb3J0LXJlc29sdmVyLXR5cGVzY3JpcHQjY29uZmlndXJhdGlvblxuICAgICAgICAndHlwZXNjcmlwdCc6IHRydWUsXG4gICAgICAgICdub2RlJzogdHJ1ZSxcbiAgICAgIH0sXG4gICAgfSxcbiAgICBydWxlczoge1xuICAgICAgJ0BzdHlsaXN0aWMvc2VtaSc6IFsnZXJyb3InLCAnYWx3YXlzJ10sXG4gICAgICAnQHN0eWxpc3RpYy9pbmRlbnQnOiBbJ2Vycm9yJywgMl0sXG4gICAgICAnQHN0eWxpc3RpYy9jb21tYS1kYW5nbGUnOiBbJ2Vycm9yJywgJ2Fsd2F5cy1tdWx0aWxpbmUnXSxcbiAgICAgICdAc3R5bGlzdGljL2Fycm93LXBhcmVucyc6IFsnZXJyb3InLCAnYWx3YXlzJ10sXG4gICAgICAnQHN0eWxpc3RpYy9xdW90ZXMnOiBbJ2Vycm9yJywgJ3NpbmdsZSddLFxuICAgIH0sXG4gIH0sXG4pO1xuXG5leHBvcnQgZGVmYXVsdCBlc2xpbnRDb25maWc7XG4iXX0= \ No newline at end of file diff --git a/agents/agent-strands/eslint.config.ts b/agents/agent-strands/eslint.config.ts new file mode 100644 index 00000000..dea76a81 --- /dev/null +++ b/agents/agent-strands/eslint.config.ts @@ -0,0 +1,73 @@ +import { Config, defineConfig } from 'eslint/config'; +import eslint from '@eslint/js'; +import { configs, parser } from 'typescript-eslint'; +import stylistic from '@stylistic/eslint-plugin'; +import importPlugin from 'eslint-plugin-import'; +// @ts-expect-error ignore type errors +import pluginPromise from 'eslint-plugin-promise'; + +import { includeIgnoreFile } from '@eslint/compat'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const gitignorePath = path.resolve(__dirname, '.gitignore'); + +const eslintConfig: Config[] = defineConfig( + { + ignores: [ + ...(includeIgnoreFile(gitignorePath).ignores || []), + '**/*.d.ts', + 'src/tsconfig.json', + 'src/stories', + '**/*.css', + 'node_modules/**/*', + 'out', + 'cdk.out', + 'dist', + 'app', + ], + }, + eslint.configs.recommended, + configs.strict, + configs.stylistic, + pluginPromise.configs['flat/recommended'], + { + files: ['**/*.ts', '*.js'], + plugins: { + '@stylistic': stylistic, + }, + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + parser, + parserOptions: { + projectService: true, + tsconfigRootDir: __dirname, + allowDefaultProject: ['eslint.config.ts'], + }, + }, + extends: [ + importPlugin.flatConfigs.recommended, + importPlugin.flatConfigs.typescript, + ], + settings: { + 'import/resolver': { + // You will also need to install and configure the TypeScript resolver + // See also https://github.com/import-js/eslint-import-resolver-typescript#configuration + 'typescript': true, + 'node': true, + }, + }, + rules: { + '@stylistic/semi': ['error', 'always'], + '@stylistic/indent': ['error', 2], + '@stylistic/comma-dangle': ['error', 'always-multiline'], + '@stylistic/arrow-parens': ['error', 'always'], + '@stylistic/quotes': ['error', 'single'], + }, + }, +); + +export default eslintConfig; diff --git a/agents/agent-strands/lambda/agent.d.ts b/agents/agent-strands/lambda/agent.d.ts new file mode 100644 index 00000000..ec2fd7ea --- /dev/null +++ b/agents/agent-strands/lambda/agent.d.ts @@ -0,0 +1,5 @@ +import { Agent } from '@strands-agents/sdk'; +declare const createAgent: ({ model: modelId }: { + model: string; +}) => Agent; +export { createAgent }; diff --git a/agents/agent-strands/lambda/agent.js b/agents/agent-strands/lambda/agent.js new file mode 100644 index 00000000..60abed8b --- /dev/null +++ b/agents/agent-strands/lambda/agent.js @@ -0,0 +1,12 @@ +import { Agent, BedrockModel } from '@strands-agents/sdk'; +const createAgent = ({ model: modelId }) => { + const model = new BedrockModel({ + region: 'us-east-1', + modelId: modelId, + maxTokens: 4096, + temperature: 0.7, + }); + return new Agent({ model }); +}; +export { createAgent }; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWdlbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhZ2VudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRTFELE1BQU0sV0FBVyxHQUFHLENBQUMsRUFBRSxLQUFLLEVBQUUsT0FBTyxFQUFxQixFQUFFLEVBQUU7SUFDNUQsTUFBTSxLQUFLLEdBQUcsSUFBSSxZQUFZLENBQUM7UUFDN0IsTUFBTSxFQUFFLFdBQVc7UUFDbkIsT0FBTyxFQUFFLE9BQU87UUFDaEIsU0FBUyxFQUFFLElBQUk7UUFDZixXQUFXLEVBQUUsR0FBRztLQUNqQixDQUFDLENBQUM7SUFFSCxPQUFPLElBQUksS0FBSyxDQUFDLEVBQUUsS0FBSyxFQUFFLENBQUMsQ0FBQztBQUM5QixDQUFDLENBQUM7QUFFRixPQUFPLEVBQUUsV0FBVyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBZ2VudCwgQmVkcm9ja01vZGVsIH0gZnJvbSAnQHN0cmFuZHMtYWdlbnRzL3Nkayc7XG5cbmNvbnN0IGNyZWF0ZUFnZW50ID0gKHsgbW9kZWw6IG1vZGVsSWQgfTogeyBtb2RlbDogc3RyaW5nIH0pID0+IHtcbiAgY29uc3QgbW9kZWwgPSBuZXcgQmVkcm9ja01vZGVsKHtcbiAgICByZWdpb246ICd1cy1lYXN0LTEnLFxuICAgIG1vZGVsSWQ6IG1vZGVsSWQsXG4gICAgbWF4VG9rZW5zOiA0MDk2LFxuICAgIHRlbXBlcmF0dXJlOiAwLjcsXG4gIH0pO1xuXG4gIHJldHVybiBuZXcgQWdlbnQoeyBtb2RlbCB9KTtcbn07XG5cbmV4cG9ydCB7IGNyZWF0ZUFnZW50IH07XG4iXX0= \ No newline at end of file diff --git a/agents/agent-strands/lambda/agent.ts b/agents/agent-strands/lambda/agent.ts new file mode 100644 index 00000000..67e2c5ea --- /dev/null +++ b/agents/agent-strands/lambda/agent.ts @@ -0,0 +1,14 @@ +import { Agent, BedrockModel } from '@strands-agents/sdk'; + +const createAgent = ({ model: modelId }: { model: string }) => { + const model = new BedrockModel({ + region: 'us-east-1', + modelId: modelId, + maxTokens: 4096, + temperature: 0.7, + }); + + return new Agent({ model }); +}; + +export { createAgent }; diff --git a/agents/agent-strands/lambda/awslambda.d.ts b/agents/agent-strands/lambda/awslambda.d.ts new file mode 100644 index 00000000..8fa8cc6d --- /dev/null +++ b/agents/agent-strands/lambda/awslambda.d.ts @@ -0,0 +1,24 @@ +'use strict'; + +import { APIGatewayProxyEvent, APIGatewayProxyEvent, Context, Callback } from 'aws-lambda'; +import { Stream } from 'stream' + +export type Event = APIGatewayProxyEvent | APIGatewayProxyEventV2; + +export class HttpResponseStream { + static from(underlyingStream: any, prelude: any): any; +} + +export type RequestHandler = ( + event: Event, + streamResponse: Stream.WritableStream, + ctx?: Context, + callback?: Callback, +) => any | Promise; + +declare global { + namespace awslambda { + function streamifyResponse(handler: RequestHandler, option?: any): RequestHandler; + let HttpResponseStream: HttpResponseStream; + } +} diff --git a/agents/agent-strands/lambda/index.d.ts b/agents/agent-strands/lambda/index.d.ts new file mode 100644 index 00000000..b1bc7c1a --- /dev/null +++ b/agents/agent-strands/lambda/index.d.ts @@ -0,0 +1,7 @@ +import { APIGatewayProxyEvent } from 'aws-lambda'; +export declare const handle: ({ question: message, model: model }: { + question: string; + model: string; +}, output: NodeJS.WritableStream) => Promise; +export declare const handler: import("aws-lambda").StreamifyHandler; +export default handler; diff --git a/agents/agent-strands/lambda/index.js b/agents/agent-strands/lambda/index.js new file mode 100644 index 00000000..f9013c83 --- /dev/null +++ b/agents/agent-strands/lambda/index.js @@ -0,0 +1,21 @@ +import { logger } from '@llm-ts-example/common-backend'; +import { createAgent } from './agent.js'; +export const handle = async ({ question: message = 'こんにちは!', model: model = 'us.amazon.nova-micro-v1:0' }, output) => { + const agent = createAgent({ model }); + for await (const event of agent.stream(message)) { + // console.log('[Event]', event.type); + if (event.type === 'modelContentBlockDeltaEvent') { + if (event.delta.type === 'textDelta') { + output.write(event.delta.text); + } + } + } +}; +export const handler = awslambda.streamifyResponse(async (event, responseStream) => { + logger.debug('event', { event }); + const { question, model } = event.body ? JSON.parse(event.body) : { question: 'あなたは誰?', model: 'gpt' }; + await handle({ question, model }, responseStream); + responseStream.end(); +}); +export default handler; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFFeEQsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUV6QyxNQUFNLENBQUMsTUFBTSxNQUFNLEdBQUcsS0FBSyxFQUFFLEVBQUUsUUFBUSxFQUFFLE9BQU8sR0FBRyxRQUFRLEVBQUUsS0FBSyxFQUFFLEtBQUssR0FBRywyQkFBMkIsRUFBdUMsRUFBRSxNQUE2QixFQUFFLEVBQUU7SUFDL0ssTUFBTSxLQUFLLEdBQUcsV0FBVyxDQUFDLEVBQUUsS0FBSyxFQUFFLENBQUMsQ0FBQztJQUNyQyxJQUFJLEtBQUssRUFBRSxNQUFNLEtBQUssSUFBSSxLQUFLLENBQUMsTUFBTSxDQUFDLE9BQU8sQ0FBQyxFQUFFLENBQUM7UUFDaEQsc0NBQXNDO1FBQ3RDLElBQUksS0FBSyxDQUFDLElBQUksS0FBSyw2QkFBNkIsRUFBRSxDQUFDO1lBQ2pELElBQUksS0FBSyxDQUFDLEtBQUssQ0FBQyxJQUFJLEtBQUssV0FBVyxFQUFFLENBQUM7Z0JBQ3JDLE1BQU0sQ0FBQyxLQUFLLENBQUMsS0FBSyxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsQ0FBQztZQUNqQyxDQUFDO1FBQ0gsQ0FBQztJQUNILENBQUM7QUFDSCxDQUFDLENBQUM7QUFFRixNQUFNLENBQUMsTUFBTSxPQUFPLEdBQUcsU0FBUyxDQUFDLGlCQUFpQixDQUNoRCxLQUFLLEVBQ0gsS0FBMkIsRUFBRSxjQUFxQyxFQUNsRSxFQUFFO0lBQ0YsTUFBTSxDQUFDLEtBQUssQ0FBQyxPQUFPLEVBQUUsRUFBRSxLQUFLLEVBQUUsQ0FBQyxDQUFDO0lBQ2pDLE1BQU0sRUFBRSxRQUFRLEVBQUUsS0FBSyxFQUFFLEdBQUcsS0FBSyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDLEVBQUUsUUFBUSxFQUFFLFFBQVEsRUFBRSxLQUFLLEVBQUUsS0FBSyxFQUFFLENBQUM7SUFDdkcsTUFBTSxNQUFNLENBQUMsRUFBRSxRQUFRLEVBQUUsS0FBSyxFQUFFLEVBQUUsY0FBYyxDQUFDLENBQUM7SUFDbEQsY0FBYyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQ3ZCLENBQUMsQ0FBQyxDQUFDO0FBRUwsZUFBZSxPQUFPLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBsb2dnZXIgfSBmcm9tICdAbGxtLXRzLWV4YW1wbGUvY29tbW9uLWJhY2tlbmQnO1xuaW1wb3J0IHsgQVBJR2F0ZXdheVByb3h5RXZlbnQgfSBmcm9tICdhd3MtbGFtYmRhJztcbmltcG9ydCB7IGNyZWF0ZUFnZW50IH0gZnJvbSAnLi9hZ2VudC5qcyc7XG5cbmV4cG9ydCBjb25zdCBoYW5kbGUgPSBhc3luYyAoeyBxdWVzdGlvbjogbWVzc2FnZSA9ICfjgZPjgpPjgavjgaHjga/vvIEnLCBtb2RlbDogbW9kZWwgPSAndXMuYW1hem9uLm5vdmEtbWljcm8tdjE6MCcgfTogeyBxdWVzdGlvbjogc3RyaW5nLCBtb2RlbDogc3RyaW5nIH0sIG91dHB1dDogTm9kZUpTLldyaXRhYmxlU3RyZWFtKSA9PiB7XG4gIGNvbnN0IGFnZW50ID0gY3JlYXRlQWdlbnQoeyBtb2RlbCB9KTtcbiAgZm9yIGF3YWl0IChjb25zdCBldmVudCBvZiBhZ2VudC5zdHJlYW0obWVzc2FnZSkpIHtcbiAgICAvLyBjb25zb2xlLmxvZygnW0V2ZW50XScsIGV2ZW50LnR5cGUpO1xuICAgIGlmIChldmVudC50eXBlID09PSAnbW9kZWxDb250ZW50QmxvY2tEZWx0YUV2ZW50Jykge1xuICAgICAgaWYgKGV2ZW50LmRlbHRhLnR5cGUgPT09ICd0ZXh0RGVsdGEnKSB7XG4gICAgICAgIG91dHB1dC53cml0ZShldmVudC5kZWx0YS50ZXh0KTtcbiAgICAgIH1cbiAgICB9XG4gIH1cbn07XG5cbmV4cG9ydCBjb25zdCBoYW5kbGVyID0gYXdzbGFtYmRhLnN0cmVhbWlmeVJlc3BvbnNlKFxuICBhc3luYyAoXG4gICAgZXZlbnQ6IEFQSUdhdGV3YXlQcm94eUV2ZW50LCByZXNwb25zZVN0cmVhbTogTm9kZUpTLldyaXRhYmxlU3RyZWFtLFxuICApID0+IHtcbiAgICBsb2dnZXIuZGVidWcoJ2V2ZW50JywgeyBldmVudCB9KTtcbiAgICBjb25zdCB7IHF1ZXN0aW9uLCBtb2RlbCB9ID0gZXZlbnQuYm9keSA/IEpTT04ucGFyc2UoZXZlbnQuYm9keSkgOiB7IHF1ZXN0aW9uOiAn44GC44Gq44Gf44Gv6Kqw77yfJywgbW9kZWw6ICdncHQnIH07XG4gICAgYXdhaXQgaGFuZGxlKHsgcXVlc3Rpb24sIG1vZGVsIH0sIHJlc3BvbnNlU3RyZWFtKTtcbiAgICByZXNwb25zZVN0cmVhbS5lbmQoKTtcbiAgfSk7XG5cbmV4cG9ydCBkZWZhdWx0IGhhbmRsZXI7XG4iXX0= \ No newline at end of file diff --git a/agents/agent-strands/lambda/index.ts b/agents/agent-strands/lambda/index.ts new file mode 100644 index 00000000..ec583ba2 --- /dev/null +++ b/agents/agent-strands/lambda/index.ts @@ -0,0 +1,27 @@ +import { logger } from '@llm-ts-example/common-backend'; +import { APIGatewayProxyEvent } from 'aws-lambda'; +import { createAgent } from './agent.js'; + +export const handle = async ({ message: message = 'こんにちは!', model: model = 'us.amazon.nova-micro-v1:0' }: { message: string, model: string }, output: NodeJS.WritableStream) => { + const agent = createAgent({ model }); + for await (const event of agent.stream(message)) { + // console.log('[Event]', event.type); + if (event.type === 'modelContentBlockDeltaEvent') { + if (event.delta.type === 'textDelta') { + output.write(event.delta.text); + } + } + } +}; + +export const handler = awslambda.streamifyResponse( + async ( + event: APIGatewayProxyEvent, responseStream: NodeJS.WritableStream, + ) => { + logger.debug('event', { event }); + const { message, model } = event.body ? JSON.parse(event.body) : {}; + await handle({ message, model }, responseStream); + responseStream.end(); + }); + +export default handler; diff --git a/agents/agent-strands/lib/cdk-stack.d.ts b/agents/agent-strands/lib/cdk-stack.d.ts new file mode 100644 index 00000000..bae723f3 --- /dev/null +++ b/agents/agent-strands/lib/cdk-stack.d.ts @@ -0,0 +1,9 @@ +import * as cdk from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +interface CloudfrontCdnTemplateStackProps extends cdk.StackProps { + appName: string; +} +export declare class CloudfrontCdnTemplateStack extends cdk.Stack { + constructor(scope: Construct, id: string, props: CloudfrontCdnTemplateStackProps); +} +export {}; diff --git a/agents/agent-strands/lib/cdk-stack.js b/agents/agent-strands/lib/cdk-stack.js new file mode 100644 index 00000000..b5d7eeba --- /dev/null +++ b/agents/agent-strands/lib/cdk-stack.js @@ -0,0 +1,64 @@ +import * as cdk from 'aws-cdk-lib'; +import { buildCommon, buildFrontend } from './process/setup.js'; +export class CloudfrontCdnTemplateStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const { appName, } = props; + buildCommon(); + buildFrontend(); + const functionName = appName; + new cdk.aws_logs.LogGroup(this, 'ApolloLambdaFunctionLogGroup', { + logGroupName: `/aws/lambda/${functionName}`, + removalPolicy: cdk.RemovalPolicy.DESTROY, + retention: cdk.aws_logs.RetentionDays.ONE_DAY, + }); + const devOptions = { + applicationLogLevelV2: cdk.aws_lambda.ApplicationLogLevel.TRACE, + }; + const fn = new cdk.aws_lambda_nodejs.NodejsFunction(this, 'Lambda', { + runtime: cdk.aws_lambda.Runtime.NODEJS_24_X, + architecture: cdk.aws_lambda.Architecture.ARM_64, + entry: './lambda/index.ts', + functionName, + retryAttempts: 0, + bundling: { + target: 'node24', + minify: true, + format: cdk.aws_lambda_nodejs.OutputFormat.ESM, + banner: 'import { createRequire } from \'module\';const require = createRequire(import.meta.url);', + // ...devOptions.bundling, + }, + memorySize: 256, + timeout: cdk.Duration.minutes(1), + role: new cdk.aws_iam.Role(this, 'ApolloLambdaFunctionExecutionRole', { + assumedBy: new cdk.aws_iam.ServicePrincipal('cdk.aws_lambda.amazonaws.com'), + managedPolicies: [ + cdk.aws_iam.ManagedPolicy.fromAwsManagedPolicyName('AWSLambdaExecute'), + cdk.aws_iam.ManagedPolicy.fromAwsManagedPolicyName('CloudFrontReadOnlyAccess'), + ], + inlinePolicies: { + 'bedrock-policy': new cdk.aws_iam.PolicyDocument({ + statements: [ + new cdk.aws_iam.PolicyStatement({ + effect: cdk.aws_iam.Effect.ALLOW, + actions: [ + 'bedrock:InvokeModel*', + 'logs:PutLogEvents', + ], + resources: ['*'], + }), + ], + }), + }, + }), + loggingFormat: cdk.aws_lambda.LoggingFormat.JSON, + applicationLogLevelV2: devOptions.applicationLogLevelV2, + }); + new cdk.aws_lambda.FunctionUrl(this, 'LambdaFunctionUrl', { + function: fn, + authType: cdk.aws_lambda.FunctionUrlAuthType.NONE, + invokeMode: cdk.aws_lambda.InvokeMode.RESPONSE_STREAM, + }); + } +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2RrLXN0YWNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY2RrLXN0YWNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxHQUFHLE1BQU0sYUFBYSxDQUFDO0FBRW5DLE9BQU8sRUFBRSxXQUFXLEVBQUUsYUFBYSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFNaEUsTUFBTSxPQUFPLDBCQUEyQixTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQ3ZELFlBQ0UsS0FBZ0IsRUFDaEIsRUFBVSxFQUNWLEtBQXNDO1FBRXRDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0sRUFDSixPQUFPLEdBQ1IsR0FBRyxLQUFLLENBQUM7UUFFVixXQUFXLEVBQUUsQ0FBQztRQUNkLGFBQWEsRUFBRSxDQUFDO1FBRWhCLE1BQU0sWUFBWSxHQUFHLE9BQU8sQ0FBQztRQUM3QixJQUFJLEdBQUcsQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLElBQUksRUFBRSw4QkFBOEIsRUFBRTtZQUM5RCxZQUFZLEVBQUUsZUFBZSxZQUFZLEVBQUU7WUFDM0MsYUFBYSxFQUFFLEdBQUcsQ0FBQyxhQUFhLENBQUMsT0FBTztZQUN4QyxTQUFTLEVBQUUsR0FBRyxDQUFDLFFBQVEsQ0FBQyxhQUFhLENBQUMsT0FBTztTQUM5QyxDQUFDLENBQUM7UUFFSCxNQUFNLFVBQVUsR0FBRztZQUNqQixxQkFBcUIsRUFBRSxHQUFHLENBQUMsVUFBVSxDQUFDLG1CQUFtQixDQUFDLEtBQUs7U0FDaEUsQ0FBQztRQUVGLE1BQU0sRUFBRSxHQUFHLElBQUksR0FBRyxDQUFDLGlCQUFpQixDQUFDLGNBQWMsQ0FBQyxJQUFJLEVBQUUsUUFBUSxFQUFFO1lBQ2xFLE9BQU8sRUFBRSxHQUFHLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQyxXQUFXO1lBQzNDLFlBQVksRUFBRSxHQUFHLENBQUMsVUFBVSxDQUFDLFlBQVksQ0FBQyxNQUFNO1lBQ2hELEtBQUssRUFBRSxtQkFBbUI7WUFDMUIsWUFBWTtZQUNaLGFBQWEsRUFBRSxDQUFDO1lBQ2hCLFFBQVEsRUFBRTtnQkFDUixNQUFNLEVBQUUsUUFBUTtnQkFDaEIsTUFBTSxFQUFFLElBQUk7Z0JBQ1osTUFBTSxFQUFFLEdBQUcsQ0FBQyxpQkFBaUIsQ0FBQyxZQUFZLENBQUMsR0FBRztnQkFDOUMsTUFBTSxFQUFFLDBGQUEwRjtnQkFDbEcsMEJBQTBCO2FBQzNCO1lBQ0QsVUFBVSxFQUFFLEdBQUc7WUFDZixPQUFPLEVBQUUsR0FBRyxDQUFDLFFBQVEsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDO1lBQ2hDLElBQUksRUFBRSxJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksRUFBRSxtQ0FBbUMsRUFBRTtnQkFDcEUsU0FBUyxFQUFFLElBQUksR0FBRyxDQUFDLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyw4QkFBOEIsQ0FBQztnQkFDM0UsZUFBZSxFQUFFO29CQUNmLEdBQUcsQ0FBQyxPQUFPLENBQUMsYUFBYSxDQUFDLHdCQUF3QixDQUFDLGtCQUFrQixDQUFDO29CQUN0RSxHQUFHLENBQUMsT0FBTyxDQUFDLGFBQWEsQ0FBQyx3QkFBd0IsQ0FBQywwQkFBMEIsQ0FBQztpQkFDL0U7Z0JBQ0QsY0FBYyxFQUFFO29CQUNkLGdCQUFnQixFQUFFLElBQUksR0FBRyxDQUFDLE9BQU8sQ0FBQyxjQUFjLENBQUM7d0JBQy9DLFVBQVUsRUFBRTs0QkFDVixJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQUMsZUFBZSxDQUFDO2dDQUM5QixNQUFNLEVBQUUsR0FBRyxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsS0FBSztnQ0FDaEMsT0FBTyxFQUFFO29DQUNQLHNCQUFzQjtvQ0FDdEIsbUJBQW1CO2lDQUNwQjtnQ0FDRCxTQUFTLEVBQUUsQ0FBQyxHQUFHLENBQUM7NkJBQ2pCLENBQUM7eUJBQ0g7cUJBQ0YsQ0FBQztpQkFDSDthQUNGLENBQUM7WUFDRixhQUFhLEVBQUUsR0FBRyxDQUFDLFVBQVUsQ0FBQyxhQUFhLENBQUMsSUFBSTtZQUNoRCxxQkFBcUIsRUFBRSxVQUFVLENBQUMscUJBQXFCO1NBQ3hELENBQUMsQ0FBQztRQUVILElBQUksR0FBRyxDQUFDLFVBQVUsQ0FBQyxXQUFXLENBQUMsSUFBSSxFQUFFLG1CQUFtQixFQUFFO1lBQ3hELFFBQVEsRUFBRSxFQUFFO1lBQ1osUUFBUSxFQUFFLEdBQUcsQ0FBQyxVQUFVLENBQUMsbUJBQW1CLENBQUMsSUFBSTtZQUNqRCxVQUFVLEVBQUUsR0FBRyxDQUFDLFVBQVUsQ0FBQyxVQUFVLENBQUMsZUFBZTtTQUN0RCxDQUFDLENBQUM7SUFDTCxDQUFDO0NBQ0YiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBjZGsgZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0IHsgQ29uc3RydWN0IH0gZnJvbSAnY29uc3RydWN0cyc7XG5pbXBvcnQgeyBidWlsZENvbW1vbiwgYnVpbGRGcm9udGVuZCB9IGZyb20gJy4vcHJvY2Vzcy9zZXR1cC5qcyc7XG5cbmludGVyZmFjZSBDbG91ZGZyb250Q2RuVGVtcGxhdGVTdGFja1Byb3BzIGV4dGVuZHMgY2RrLlN0YWNrUHJvcHMge1xuICBhcHBOYW1lOiBzdHJpbmdcbn1cblxuZXhwb3J0IGNsYXNzIENsb3VkZnJvbnRDZG5UZW1wbGF0ZVN0YWNrIGV4dGVuZHMgY2RrLlN0YWNrIHtcbiAgY29uc3RydWN0b3IoXG4gICAgc2NvcGU6IENvbnN0cnVjdCxcbiAgICBpZDogc3RyaW5nLFxuICAgIHByb3BzOiBDbG91ZGZyb250Q2RuVGVtcGxhdGVTdGFja1Byb3BzLFxuICApIHtcbiAgICBzdXBlcihzY29wZSwgaWQsIHByb3BzKTtcblxuICAgIGNvbnN0IHtcbiAgICAgIGFwcE5hbWUsXG4gICAgfSA9IHByb3BzO1xuXG4gICAgYnVpbGRDb21tb24oKTtcbiAgICBidWlsZEZyb250ZW5kKCk7XG5cbiAgICBjb25zdCBmdW5jdGlvbk5hbWUgPSBhcHBOYW1lO1xuICAgIG5ldyBjZGsuYXdzX2xvZ3MuTG9nR3JvdXAodGhpcywgJ0Fwb2xsb0xhbWJkYUZ1bmN0aW9uTG9nR3JvdXAnLCB7XG4gICAgICBsb2dHcm91cE5hbWU6IGAvYXdzL2xhbWJkYS8ke2Z1bmN0aW9uTmFtZX1gLFxuICAgICAgcmVtb3ZhbFBvbGljeTogY2RrLlJlbW92YWxQb2xpY3kuREVTVFJPWSxcbiAgICAgIHJldGVudGlvbjogY2RrLmF3c19sb2dzLlJldGVudGlvbkRheXMuT05FX0RBWSxcbiAgICB9KTtcblxuICAgIGNvbnN0IGRldk9wdGlvbnMgPSB7XG4gICAgICBhcHBsaWNhdGlvbkxvZ0xldmVsVjI6IGNkay5hd3NfbGFtYmRhLkFwcGxpY2F0aW9uTG9nTGV2ZWwuVFJBQ0UsXG4gICAgfTtcblxuICAgIGNvbnN0IGZuID0gbmV3IGNkay5hd3NfbGFtYmRhX25vZGVqcy5Ob2RlanNGdW5jdGlvbih0aGlzLCAnTGFtYmRhJywge1xuICAgICAgcnVudGltZTogY2RrLmF3c19sYW1iZGEuUnVudGltZS5OT0RFSlNfMjRfWCxcbiAgICAgIGFyY2hpdGVjdHVyZTogY2RrLmF3c19sYW1iZGEuQXJjaGl0ZWN0dXJlLkFSTV82NCxcbiAgICAgIGVudHJ5OiAnLi9sYW1iZGEvaW5kZXgudHMnLFxuICAgICAgZnVuY3Rpb25OYW1lLFxuICAgICAgcmV0cnlBdHRlbXB0czogMCxcbiAgICAgIGJ1bmRsaW5nOiB7XG4gICAgICAgIHRhcmdldDogJ25vZGUyNCcsXG4gICAgICAgIG1pbmlmeTogdHJ1ZSxcbiAgICAgICAgZm9ybWF0OiBjZGsuYXdzX2xhbWJkYV9ub2RlanMuT3V0cHV0Rm9ybWF0LkVTTSxcbiAgICAgICAgYmFubmVyOiAnaW1wb3J0IHsgY3JlYXRlUmVxdWlyZSB9IGZyb20gXFwnbW9kdWxlXFwnO2NvbnN0IHJlcXVpcmUgPSBjcmVhdGVSZXF1aXJlKGltcG9ydC5tZXRhLnVybCk7JyxcbiAgICAgICAgLy8gLi4uZGV2T3B0aW9ucy5idW5kbGluZyxcbiAgICAgIH0sXG4gICAgICBtZW1vcnlTaXplOiAyNTYsXG4gICAgICB0aW1lb3V0OiBjZGsuRHVyYXRpb24ubWludXRlcygxKSxcbiAgICAgIHJvbGU6IG5ldyBjZGsuYXdzX2lhbS5Sb2xlKHRoaXMsICdBcG9sbG9MYW1iZGFGdW5jdGlvbkV4ZWN1dGlvblJvbGUnLCB7XG4gICAgICAgIGFzc3VtZWRCeTogbmV3IGNkay5hd3NfaWFtLlNlcnZpY2VQcmluY2lwYWwoJ2Nkay5hd3NfbGFtYmRhLmFtYXpvbmF3cy5jb20nKSxcbiAgICAgICAgbWFuYWdlZFBvbGljaWVzOiBbXG4gICAgICAgICAgY2RrLmF3c19pYW0uTWFuYWdlZFBvbGljeS5mcm9tQXdzTWFuYWdlZFBvbGljeU5hbWUoJ0FXU0xhbWJkYUV4ZWN1dGUnKSxcbiAgICAgICAgICBjZGsuYXdzX2lhbS5NYW5hZ2VkUG9saWN5LmZyb21Bd3NNYW5hZ2VkUG9saWN5TmFtZSgnQ2xvdWRGcm9udFJlYWRPbmx5QWNjZXNzJyksXG4gICAgICAgIF0sXG4gICAgICAgIGlubGluZVBvbGljaWVzOiB7XG4gICAgICAgICAgJ2JlZHJvY2stcG9saWN5JzogbmV3IGNkay5hd3NfaWFtLlBvbGljeURvY3VtZW50KHtcbiAgICAgICAgICAgIHN0YXRlbWVudHM6IFtcbiAgICAgICAgICAgICAgbmV3IGNkay5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCh7XG4gICAgICAgICAgICAgICAgZWZmZWN0OiBjZGsuYXdzX2lhbS5FZmZlY3QuQUxMT1csXG4gICAgICAgICAgICAgICAgYWN0aW9uczogW1xuICAgICAgICAgICAgICAgICAgJ2JlZHJvY2s6SW52b2tlTW9kZWwqJyxcbiAgICAgICAgICAgICAgICAgICdsb2dzOlB1dExvZ0V2ZW50cycsXG4gICAgICAgICAgICAgICAgXSxcbiAgICAgICAgICAgICAgICByZXNvdXJjZXM6IFsnKiddLFxuICAgICAgICAgICAgICB9KSxcbiAgICAgICAgICAgIF0sXG4gICAgICAgICAgfSksXG4gICAgICAgIH0sXG4gICAgICB9KSxcbiAgICAgIGxvZ2dpbmdGb3JtYXQ6IGNkay5hd3NfbGFtYmRhLkxvZ2dpbmdGb3JtYXQuSlNPTixcbiAgICAgIGFwcGxpY2F0aW9uTG9nTGV2ZWxWMjogZGV2T3B0aW9ucy5hcHBsaWNhdGlvbkxvZ0xldmVsVjIsXG4gICAgfSk7XG5cbiAgICBuZXcgY2RrLmF3c19sYW1iZGEuRnVuY3Rpb25VcmwodGhpcywgJ0xhbWJkYUZ1bmN0aW9uVXJsJywge1xuICAgICAgZnVuY3Rpb246IGZuLFxuICAgICAgYXV0aFR5cGU6IGNkay5hd3NfbGFtYmRhLkZ1bmN0aW9uVXJsQXV0aFR5cGUuTk9ORSxcbiAgICAgIGludm9rZU1vZGU6IGNkay5hd3NfbGFtYmRhLkludm9rZU1vZGUuUkVTUE9OU0VfU1RSRUFNLFxuICAgIH0pO1xuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/agents/agent-strands/lib/cdk-stack.ts b/agents/agent-strands/lib/cdk-stack.ts new file mode 100644 index 00000000..ae8632b8 --- /dev/null +++ b/agents/agent-strands/lib/cdk-stack.ts @@ -0,0 +1,77 @@ +import * as cdk from 'aws-cdk-lib'; +import { Construct } from 'constructs'; + +interface CloudfrontCdnTemplateStackProps extends cdk.StackProps { + appName: string +} + +export class CloudfrontCdnTemplateStack extends cdk.Stack { + constructor( + scope: Construct, + id: string, + props: CloudfrontCdnTemplateStackProps, + ) { + super(scope, id, props); + + const { + appName, + } = props; + + const functionName = appName; + new cdk.aws_logs.LogGroup(this, 'ApolloLambdaFunctionLogGroup', { + logGroupName: `/aws/lambda/${functionName}`, + removalPolicy: cdk.RemovalPolicy.DESTROY, + retention: cdk.aws_logs.RetentionDays.ONE_DAY, + }); + + const devOptions = { + applicationLogLevelV2: cdk.aws_lambda.ApplicationLogLevel.TRACE, + }; + + const fn = new cdk.aws_lambda_nodejs.NodejsFunction(this, 'Lambda', { + runtime: cdk.aws_lambda.Runtime.NODEJS_24_X, + architecture: cdk.aws_lambda.Architecture.ARM_64, + entry: './lambda/index.ts', + functionName, + retryAttempts: 0, + bundling: { + target: 'node24', + minify: true, + format: cdk.aws_lambda_nodejs.OutputFormat.ESM, + banner: 'import { createRequire } from \'module\';const require = createRequire(import.meta.url);', + // ...devOptions.bundling, + }, + memorySize: 256, + timeout: cdk.Duration.minutes(1), + role: new cdk.aws_iam.Role(this, 'ApolloLambdaFunctionExecutionRole', { + assumedBy: new cdk.aws_iam.ServicePrincipal('lambda.amazonaws.com'), + managedPolicies: [ + cdk.aws_iam.ManagedPolicy.fromAwsManagedPolicyName('AWSLambdaExecute'), + cdk.aws_iam.ManagedPolicy.fromAwsManagedPolicyName('CloudFrontReadOnlyAccess'), + ], + inlinePolicies: { + 'bedrock-policy': new cdk.aws_iam.PolicyDocument({ + statements: [ + new cdk.aws_iam.PolicyStatement({ + effect: cdk.aws_iam.Effect.ALLOW, + actions: [ + 'bedrock:InvokeModel*', + 'logs:PutLogEvents', + ], + resources: ['*'], + }), + ], + }), + }, + }), + loggingFormat: cdk.aws_lambda.LoggingFormat.JSON, + applicationLogLevelV2: devOptions.applicationLogLevelV2, + }); + + new cdk.aws_lambda.FunctionUrl(this, 'LambdaFunctionUrl', { + function: fn, + authType: cdk.aws_lambda.FunctionUrlAuthType.NONE, + invokeMode: cdk.aws_lambda.InvokeMode.RESPONSE_STREAM, + }); + } +} diff --git a/agents/agent-strands/package.json b/agents/agent-strands/package.json new file mode 100644 index 00000000..40b7fcc9 --- /dev/null +++ b/agents/agent-strands/package.json @@ -0,0 +1,43 @@ +{ + "name": "agent-strands", + "version": "0.1.0", + "type": "module", + "scripts": { + "build": "tsc", + "watch": "tsc -w", + "test": "vitest run --passWithNoTests", + "lint": "eslint .", + "lint-fix": "eslint . --fix" + }, + "devDependencies": { + "@eslint/compat": "^2.0.0", + "@eslint/js": "^9.39.1", + "@stylistic/eslint-plugin": "^5.6.1", + "@types/aws-lambda": "^8.10.159", + "@types/node": "24.10.1", + "@vitest/eslint-plugin": "^1.5.1", + "aws-cdk": "^2.1033.0", + "dotenv": "^17.2.3", + "esbuild": "^0.25.12", + "eslint": "^9.39.1", + "eslint-import-resolver-typescript": "^4.4.4", + "eslint-plugin-import": "^2.32.0", + "eslint-plugin-promise": "^7.2.1", + "jiti": "^2.6.1", + "tsx": "^4.21.0", + "typescript": "^5.9.3", + "typescript-eslint": "^8.48.1", + "vite": "^7.2.6", + "vite-tsconfig-paths": "^5.1.4", + "vitest": "^4.0.15" + }, + "dependencies": { + "@aws-lambda-powertools/logger": "^2.29.0", + "@aws-sdk/credential-provider-node": "^3.946.0", + "@llm-ts-example/common-backend": "workspace:*", + "@strands-agents/sdk": "^0.1.2", + "aws-cdk-lib": "^2.232.1", + "constructs": "^10.4.3", + "uuid": "^13.0.0" + } +} diff --git a/agents/agent-strands/test/index.test.d.ts b/agents/agent-strands/test/index.test.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/agents/agent-strands/test/index.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/agents/agent-strands/test/index.test.js b/agents/agent-strands/test/index.test.js new file mode 100644 index 00000000..b29c9d26 --- /dev/null +++ b/agents/agent-strands/test/index.test.js @@ -0,0 +1,20 @@ +import { test } from 'vitest'; +import { stdout } from 'node:process'; +import { PassThrough } from 'node:stream'; +import { handle } from '../lambda/index.js'; +function sleep(time) { + return new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, time); + }); +} +const model = process.env.USE_MODEL ?? ''; +const isDefinedModel = model.length > 0; +test.runIf(isDefinedModel)('test', { retry: 0 }, async () => { + const output = process.env.DISABLE_STDOUT === 'true' ? new PassThrough() : stdout; + const question = process.env.QUESTION && process.env.QUESTION.length > 0 ? process.env.QUESTION : 'あなたは誰?質問と同じ言語で答えてください。'; + await handle({ question, model }, output); + await sleep(2000); +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgudGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImluZGV4LnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLElBQUksRUFBRSxNQUFNLFFBQVEsQ0FBQztBQUM5QixPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sY0FBYyxDQUFDO0FBQ3RDLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDMUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRTVDLFNBQVMsS0FBSyxDQUFDLElBQVk7SUFDekIsT0FBTyxJQUFJLE9BQU8sQ0FBTyxDQUFDLE9BQU8sRUFBRSxFQUFFO1FBQ25DLFVBQVUsQ0FBQyxHQUFHLEVBQUU7WUFDZCxPQUFPLEVBQUUsQ0FBQztRQUNaLENBQUMsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUNYLENBQUMsQ0FBQyxDQUFDO0FBQ0wsQ0FBQztBQUVELE1BQU0sS0FBSyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsU0FBUyxJQUFJLEVBQUUsQ0FBQztBQUMxQyxNQUFNLGNBQWMsR0FBRyxLQUFLLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQztBQUN4QyxJQUFJLENBQUMsS0FBSyxDQUFDLGNBQWMsQ0FBQyxDQUFDLE1BQU0sRUFBRSxFQUFFLEtBQUssRUFBRSxDQUFDLEVBQUUsRUFBRSxLQUFLLElBQUksRUFBRTtJQUUxRCxNQUFNLE1BQU0sR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLGNBQWMsS0FBSyxNQUFNLENBQUMsQ0FBQyxDQUFDLElBQUksV0FBVyxFQUFFLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQztJQUNsRixNQUFNLFFBQVEsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLFFBQVEsSUFBSSxPQUFPLENBQUMsR0FBRyxDQUFDLFFBQVEsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsd0JBQXdCLENBQUM7SUFFM0gsTUFBTSxNQUFNLENBQUMsRUFBQyxRQUFRLEVBQUUsS0FBSyxFQUFDLEVBQUUsTUFBTSxDQUFDLENBQUM7SUFDeEMsTUFBTSxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUM7QUFDcEIsQ0FBQyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyB0ZXN0IH0gZnJvbSAndml0ZXN0JztcbmltcG9ydCB7IHN0ZG91dCB9IGZyb20gJ25vZGU6cHJvY2Vzcyc7XG5pbXBvcnQgeyBQYXNzVGhyb3VnaCB9IGZyb20gJ25vZGU6c3RyZWFtJztcbmltcG9ydCB7IGhhbmRsZSB9IGZyb20gJy4uL2xhbWJkYS9pbmRleC5qcyc7XG5cbmZ1bmN0aW9uIHNsZWVwKHRpbWU6IG51bWJlcikge1xuICByZXR1cm4gbmV3IFByb21pc2U8dm9pZD4oKHJlc29sdmUpID0+IHtcbiAgICBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgIHJlc29sdmUoKTtcbiAgICB9LCB0aW1lKTtcbiAgfSk7XG59XG5cbmNvbnN0IG1vZGVsID0gcHJvY2Vzcy5lbnYuVVNFX01PREVMID8/ICcnO1xuY29uc3QgaXNEZWZpbmVkTW9kZWwgPSBtb2RlbC5sZW5ndGggPiAwO1xudGVzdC5ydW5JZihpc0RlZmluZWRNb2RlbCkoJ3Rlc3QnLCB7IHJldHJ5OiAwIH0sIGFzeW5jICgpID0+IHtcblxuICBjb25zdCBvdXRwdXQgPSBwcm9jZXNzLmVudi5ESVNBQkxFX1NURE9VVCA9PT0gJ3RydWUnID8gbmV3IFBhc3NUaHJvdWdoKCkgOiBzdGRvdXQ7XG4gIGNvbnN0IHF1ZXN0aW9uID0gcHJvY2Vzcy5lbnYuUVVFU1RJT04gJiYgcHJvY2Vzcy5lbnYuUVVFU1RJT04ubGVuZ3RoID4gMCA/IHByb2Nlc3MuZW52LlFVRVNUSU9OIDogJ+OBguOBquOBn+OBr+iqsO+8n+izquWVj+OBqOWQjOOBmOiogOiqnuOBp+etlOOBiOOBpuOBj+OBoOOBleOBhOOAgic7XG5cbiAgYXdhaXQgaGFuZGxlKHtxdWVzdGlvbiwgbW9kZWx9LCBvdXRwdXQpO1xuICBhd2FpdCBzbGVlcCgyMDAwKTtcbn0pO1xuIl19 \ No newline at end of file diff --git a/agents/agent-strands/test/index.test.ts b/agents/agent-strands/test/index.test.ts new file mode 100644 index 00000000..34150c94 --- /dev/null +++ b/agents/agent-strands/test/index.test.ts @@ -0,0 +1,23 @@ +import { test } from 'vitest'; +import { stdout } from 'node:process'; +import { PassThrough } from 'node:stream'; +import { handle } from '../lambda/index.js'; + +function sleep(time: number) { + return new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, time); + }); +} + +const model = process.env.USE_MODEL ?? ''; +const isDefinedModel = model.length > 0; +test.runIf(isDefinedModel)('test', { retry: 0 }, async () => { + + const output = process.env.DISABLE_STDOUT === 'true' ? new PassThrough() : stdout; + const message = process.env.QUESTION && process.env.QUESTION.length > 0 ? process.env.QUESTION : 'あなたは誰?質問と同じ言語で答えてください。'; + + await handle({message, model}, output); + await sleep(2000); +}); diff --git a/agents/agent-strands/tsconfig.json b/agents/agent-strands/tsconfig.json new file mode 100644 index 00000000..6d3c7d41 --- /dev/null +++ b/agents/agent-strands/tsconfig.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "lib": [ + "es2022" + ], + "declaration": true, + "strict": true, + "noImplicitAny": true, + "strictNullChecks": true, + "noImplicitThis": true, + "alwaysStrict": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": false, + "inlineSourceMap": true, + "inlineSources": true, + "experimentalDecorators": true, + "strictPropertyInitialization": false, + "skipLibCheck": true, + "typeRoots": [ + "./node_modules/@types" + ] + }, + "exclude": [ + "node_modules" + ] +} diff --git a/agents/agent-voltagent/package.json b/agents/agent-voltagent/package.json index 83137483..55e83142 100644 --- a/agents/agent-voltagent/package.json +++ b/agents/agent-voltagent/package.json @@ -22,7 +22,7 @@ "@voltagent/libsql": "^1.0.13", "@voltagent/logger": "^1.0.4", "@voltagent/server-hono": "^1.2.5", - "ai": "^5.0.106", + "ai": "^5.0.107", "dotenv": "^16.6.1", "hono": "^4.10.7", "zod": "^4.1.13" diff --git a/basic/cdk/package.json b/basic/cdk/package.json index 8e940343..e00fac11 100644 --- a/basic/cdk/package.json +++ b/basic/cdk/package.json @@ -38,10 +38,10 @@ "@arizeai/openinference-instrumentation-bedrock": "^0.4.3", "@arizeai/openinference-instrumentation-langchain": "^3.4.6", "@aws-lambda-powertools/logger": "^2.29.0", - "@aws-sdk/credential-provider-node": "^3.943.0", + "@aws-sdk/credential-provider-node": "^3.946.0", "@langchain/aws": "^1.1.0", "@langchain/classic": "^1.0.5", - "@langchain/core": "^1.1.3", + "@langchain/core": "^1.1.4", "@langchain/langgraph": "^1.0.4", "@langchain/openai": "^1.1.3", "@llm-ts-example/common-backend": "workspace:*", @@ -55,7 +55,7 @@ "@opentelemetry/sdk-trace-node": "^2.2.0", "@opentelemetry/semantic-conventions": "^1.38.0", "@smithy/eventstream-codec": "^4.2.5", - "aws-cdk-lib": "^2.231.0", + "aws-cdk-lib": "^2.232.1", "constructs": "^10.4.3", "langfuse": "^3.38.6", "langfuse-langchain": "^3.38.6", diff --git a/common/backend/package.json b/common/backend/package.json index f3ac402e..bcc5fef1 100644 --- a/common/backend/package.json +++ b/common/backend/package.json @@ -26,7 +26,7 @@ "dependencies": { "@aws-lambda-powertools/logger": "^2.29.0", "@langchain/aws": "^1.1.0", - "@langchain/core": "^1.1.3", + "@langchain/core": "^1.1.4", "@langchain/openai": "^1.1.3", "@llm-ts-example/common-core": "workspace:*" }, diff --git a/mcp/clients/langgraph-mcp-client/package.json b/mcp/clients/langgraph-mcp-client/package.json index 2d5414b3..5e0b25e7 100644 --- a/mcp/clients/langgraph-mcp-client/package.json +++ b/mcp/clients/langgraph-mcp-client/package.json @@ -34,17 +34,17 @@ "vitest": "^4.0.15" }, "dependencies": { - "@aws-sdk/client-bedrock-runtime": "^3.943.0", + "@aws-sdk/client-bedrock-runtime": "^3.946.0", "@inquirer/prompts": "^7.10.1", "@langchain/aws": "^1.1.0", - "@langchain/core": "^1.1.3", + "@langchain/core": "^1.1.4", "@langchain/langgraph": "^1.0.4", "@langchain/mcp-adapters": "^1.0.3", "@langchain/openai": "^1.1.3", "@modelcontextprotocol/sdk": "^1.24.3", "@smithy/eventstream-codec": "^4.2.5", "dotenv": "^16.6.1", - "langchain": "^1.1.4", + "langchain": "^1.1.5", "langfuse": "^3.38.6", "langfuse-langchain": "^3.38.6", "uuid": "^13.0.0" diff --git a/mcp/clients/mastra-mcp-client/tsconfig.json b/mcp/clients/mastra-mcp-client/tsconfig.json index b4f461ee..e1014a14 100644 --- a/mcp/clients/mastra-mcp-client/tsconfig.json +++ b/mcp/clients/mastra-mcp-client/tsconfig.json @@ -8,7 +8,8 @@ "strict": true, "skipLibCheck": true, "noEmit": true, - "outDir": "dist" + "outDir": "dist", + "rootDir": "./src/mastra" }, "include": [ "src/**/*" diff --git a/mcp/clients/mcp-client-http/package.json b/mcp/clients/mcp-client-http/package.json index 33138f0c..a3b91b59 100644 --- a/mcp/clients/mcp-client-http/package.json +++ b/mcp/clients/mcp-client-http/package.json @@ -18,7 +18,7 @@ "license": "ISC", "dependencies": { "@anthropic-ai/sdk": "^0.69.0", - "@aws-sdk/client-bedrock-runtime": "^3.943.0", + "@aws-sdk/client-bedrock-runtime": "^3.946.0", "@inquirer/prompts": "^8.0.2", "@modelcontextprotocol/sdk": "^1.24.3", "dotenv": "^17.2.3" diff --git a/mcp/clients/mcp-client-typescript/package.json b/mcp/clients/mcp-client-typescript/package.json index cb95a3d6..2d534cb0 100644 --- a/mcp/clients/mcp-client-typescript/package.json +++ b/mcp/clients/mcp-client-typescript/package.json @@ -14,7 +14,7 @@ "license": "ISC", "dependencies": { "@anthropic-ai/sdk": "^0.69.0", - "@aws-sdk/client-bedrock-runtime": "^3.943.0", + "@aws-sdk/client-bedrock-runtime": "^3.946.0", "@inquirer/prompts": "^8.0.2", "@modelcontextprotocol/sdk": "^1.24.3", "dotenv": "^17.2.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 205388e0..d3c5e4f6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -61,7 +61,7 @@ importers: version: 0.15.12(@mastra/core@0.24.6(openapi-types@12.1.3)(zod@4.1.13))(zod@4.1.13) langfuse-vercel: specifier: ^3.38.6 - version: 3.38.6(ai@5.0.106(zod@4.1.13)) + version: 3.38.6(ai@5.0.107(zod@4.1.13)) zod: specifier: ^4.1.13 version: 4.1.13 @@ -103,8 +103,8 @@ importers: agents/agent-sdk: dependencies: '@anthropic-ai/claude-agent-sdk': - specifier: ^0.1.59 - version: 0.1.59(zod@4.1.13) + specifier: ^0.1.60 + version: 0.1.60(zod@4.1.13) source-map-support: specifier: ^0.5.21 version: 0.5.21 @@ -170,6 +170,91 @@ importers: specifier: ^4.0.15 version: 4.0.15(@opentelemetry/api@1.9.0)(@types/node@24.10.1)(jiti@2.6.1)(jsdom@27.2.0)(lightningcss@1.30.1)(tsx@4.21.0)(yaml@2.8.2) + agents/agent-strands: + dependencies: + '@aws-lambda-powertools/logger': + specifier: ^2.29.0 + version: 2.29.0 + '@aws-sdk/credential-provider-node': + specifier: ^3.946.0 + version: 3.946.0 + '@llm-ts-example/common-backend': + specifier: workspace:* + version: link:../../common/backend + '@strands-agents/sdk': + specifier: ^0.1.2 + version: 0.1.2(@cfworker/json-schema@4.1.1)(ws@8.18.3) + aws-cdk-lib: + specifier: ^2.232.1 + version: 2.232.1(constructs@10.4.3) + constructs: + specifier: ^10.4.3 + version: 10.4.3 + uuid: + specifier: ^13.0.0 + version: 13.0.0 + devDependencies: + '@eslint/compat': + specifier: ^2.0.0 + version: 2.0.0(eslint@9.39.1(jiti@2.6.1)) + '@eslint/js': + specifier: ^9.39.1 + version: 9.39.1 + '@stylistic/eslint-plugin': + specifier: ^5.6.1 + version: 5.6.1(eslint@9.39.1(jiti@2.6.1)) + '@types/aws-lambda': + specifier: ^8.10.159 + version: 8.10.159 + '@types/node': + specifier: 24.10.1 + version: 24.10.1 + '@vitest/eslint-plugin': + specifier: ^1.5.1 + version: 1.5.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3)(vitest@4.0.15(@opentelemetry/api@1.9.0)(@types/node@24.10.1)(jiti@2.6.1)(jsdom@27.2.0)(lightningcss@1.30.1)(tsx@4.21.0)(yaml@2.8.2)) + aws-cdk: + specifier: ^2.1033.0 + version: 2.1033.0 + dotenv: + specifier: ^17.2.3 + version: 17.2.3 + esbuild: + specifier: ^0.25.12 + version: 0.25.12 + eslint: + specifier: ^9.39.1 + version: 9.39.1(jiti@2.6.1) + eslint-import-resolver-typescript: + specifier: ^4.4.4 + version: 4.4.4(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint@9.39.1(jiti@2.6.1)))(eslint-plugin-import@2.32.0)(eslint@9.39.1(jiti@2.6.1)) + eslint-plugin-import: + specifier: ^2.32.0 + version: 2.32.0(@typescript-eslint/parser@8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1(jiti@2.6.1)) + eslint-plugin-promise: + specifier: ^7.2.1 + version: 7.2.1(eslint@9.39.1(jiti@2.6.1)) + jiti: + specifier: ^2.6.1 + version: 2.6.1 + tsx: + specifier: ^4.21.0 + version: 4.21.0 + typescript: + specifier: ^5.9.3 + version: 5.9.3 + typescript-eslint: + specifier: ^8.48.1 + version: 8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + vite: + specifier: ^7.2.6 + version: 7.2.6(@types/node@24.10.1)(jiti@2.6.1)(lightningcss@1.30.1)(tsx@4.21.0)(yaml@2.8.2) + vite-tsconfig-paths: + specifier: ^5.1.4 + version: 5.1.4(typescript@5.9.3)(vite@7.2.6(@types/node@24.10.1)(jiti@2.6.1)(lightningcss@1.30.1)(tsx@4.21.0)(yaml@2.8.2)) + vitest: + specifier: ^4.0.15 + version: 4.0.15(@opentelemetry/api@1.9.0)(@types/node@24.10.1)(jiti@2.6.1)(jsdom@27.2.0)(lightningcss@1.30.1)(tsx@4.21.0)(yaml@2.8.2) + agents/agent-voltagent: dependencies: '@ai-sdk/amazon-bedrock': @@ -177,22 +262,22 @@ importers: version: 3.0.67(zod@4.1.13) '@voltagent/cli': specifier: ^0.1.16 - version: 0.1.16(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@types/node@24.10.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + version: 0.1.16(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@types/node@24.10.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/core': specifier: ^1.2.15 - version: 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + version: 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/libsql': specifier: ^1.0.13 - version: 1.0.13(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13)) + version: 1.0.13(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13)) '@voltagent/logger': specifier: ^1.0.4 version: 1.0.4(@opentelemetry/api@1.9.0) '@voltagent/server-hono': specifier: ^1.2.5 - version: 1.2.5(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(zod@4.1.13) + version: 1.2.5(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(zod@4.1.13) ai: - specifier: ^5.0.106 - version: 5.0.106(zod@4.1.13) + specifier: ^5.0.107 + version: 5.0.107(zod@4.1.13) dotenv: specifier: ^16.6.1 version: 16.6.1 @@ -290,31 +375,31 @@ importers: dependencies: '@arizeai/openinference-instrumentation-bedrock': specifier: ^0.4.3 - version: 0.4.3(@aws-sdk/client-bedrock-runtime@3.943.0) + version: 0.4.3(@aws-sdk/client-bedrock-runtime@3.946.0) '@arizeai/openinference-instrumentation-langchain': specifier: ^3.4.6 - version: 3.4.6(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + version: 3.4.6(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@aws-lambda-powertools/logger': specifier: ^2.29.0 version: 2.29.0 '@aws-sdk/credential-provider-node': - specifier: ^3.943.0 - version: 3.943.0 + specifier: ^3.946.0 + version: 3.946.0 '@langchain/aws': specifier: ^1.1.0 - version: 1.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + version: 1.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@langchain/classic': specifier: ^1.0.5 - version: 1.0.5(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3) + version: 1.0.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3) '@langchain/core': - specifier: ^1.1.3 - version: 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + specifier: ^1.1.4 + version: 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@langchain/langgraph': specifier: ^1.0.4 - version: 1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) + version: 1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) '@langchain/openai': specifier: ^1.1.3 - version: 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + version: 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) '@llm-ts-example/common-backend': specifier: workspace:* version: link:../../common/backend @@ -349,8 +434,8 @@ importers: specifier: ^4.2.5 version: 4.2.5 aws-cdk-lib: - specifier: ^2.231.0 - version: 2.231.0(constructs@10.4.3) + specifier: ^2.232.1 + version: 2.232.1(constructs@10.4.3) constructs: specifier: ^10.4.3 version: 10.4.3 @@ -359,7 +444,7 @@ importers: version: 3.38.6 langfuse-langchain: specifier: ^3.38.6 - version: 3.38.6(langchain@1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))) + version: 3.38.6(langchain@1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))) source-map-support: specifier: ^0.5.21 version: 0.5.21 @@ -444,13 +529,13 @@ importers: version: 2.29.0 '@langchain/aws': specifier: ^1.1.0 - version: 1.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + version: 1.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@langchain/core': - specifier: ^1.1.3 - version: 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + specifier: ^1.1.4 + version: 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@langchain/openai': specifier: ^1.1.3 - version: 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + version: 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) '@llm-ts-example/common-core': specifier: workspace:* version: link:../core @@ -534,26 +619,26 @@ importers: mcp/clients/langgraph-mcp-client: dependencies: '@aws-sdk/client-bedrock-runtime': - specifier: ^3.943.0 - version: 3.943.0 + specifier: ^3.946.0 + version: 3.946.0 '@inquirer/prompts': specifier: ^7.10.1 version: 7.10.1(@types/node@24.10.1) '@langchain/aws': specifier: ^1.1.0 - version: 1.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + version: 1.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@langchain/core': - specifier: ^1.1.3 - version: 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + specifier: ^1.1.4 + version: 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@langchain/langgraph': specifier: ^1.0.4 - version: 1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) + version: 1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) '@langchain/mcp-adapters': specifier: ^1.0.3 - version: 1.0.3(@cfworker/json-schema@4.1.1)(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@langchain/langgraph@1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13)) + version: 1.0.3(@cfworker/json-schema@4.1.1)(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@langchain/langgraph@1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13)) '@langchain/openai': specifier: ^1.1.3 - version: 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + version: 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) '@modelcontextprotocol/sdk': specifier: ^1.24.3 version: 1.24.3(@cfworker/json-schema@4.1.1)(zod@4.1.13) @@ -564,14 +649,14 @@ importers: specifier: ^16.6.1 version: 16.6.1 langchain: - specifier: ^1.1.4 - version: 1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) + specifier: ^1.1.5 + version: 1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) langfuse: specifier: ^3.38.6 version: 3.38.6 langfuse-langchain: specifier: ^3.38.6 - version: 3.38.6(langchain@1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))) + version: 3.38.6(langchain@1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))) uuid: specifier: ^13.0.0 version: 13.0.0 @@ -647,7 +732,7 @@ importers: version: 0.14.4(@cfworker/json-schema@4.1.1)(@mastra/core@0.24.6(openapi-types@12.1.3)(zod@4.1.13))(@types/json-schema@7.0.15)(zod@4.1.13) langfuse-vercel: specifier: ^3.38.6 - version: 3.38.6(ai@5.0.106(zod@4.1.13)) + version: 3.38.6(ai@5.0.107(zod@4.1.13)) zod: specifier: ^4.1.13 version: 4.1.13 @@ -695,8 +780,8 @@ importers: specifier: ^0.69.0 version: 0.69.0(zod@4.1.13) '@aws-sdk/client-bedrock-runtime': - specifier: ^3.943.0 - version: 3.943.0 + specifier: ^3.946.0 + version: 3.946.0 '@inquirer/prompts': specifier: ^8.0.2 version: 8.0.2(@types/node@24.10.1) @@ -747,8 +832,8 @@ importers: specifier: ^0.69.0 version: 0.69.0(zod@4.1.13) '@aws-sdk/client-bedrock-runtime': - specifier: ^3.943.0 - version: 3.943.0 + specifier: ^3.946.0 + version: 3.946.0 '@inquirer/prompts': specifier: ^8.0.2 version: 8.0.2(@types/node@24.10.1) @@ -1096,25 +1181,25 @@ importers: dependencies: '@langchain/aws': specifier: ^1.1.0 - version: 1.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + version: 1.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@langchain/classic': specifier: ^1.0.5 - version: 1.0.5(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3) + version: 1.0.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3) '@langchain/community': specifier: ^1.0.7 - version: 1.0.7(ee9edf035d3124403fc21c2491f2a8b8) + version: 1.0.7(964061b1ee7e8f3b0e1fa21e45f97373) '@langchain/core': - specifier: ^1.1.3 - version: 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + specifier: ^1.1.4 + version: 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@langchain/langgraph': specifier: ^1.0.4 - version: 1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) + version: 1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) '@langchain/openai': specifier: ^1.1.3 - version: 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + version: 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) '@langchain/pinecone': specifier: ^1.0.1 - version: 1.0.1(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@pinecone-database/pinecone@6.1.3) + version: 1.0.1(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@pinecone-database/pinecone@6.1.3) '@pinecone-database/pinecone': specifier: ^6.1.3 version: 6.1.3 @@ -1134,8 +1219,8 @@ importers: specifier: ^27.2.0 version: 27.2.0 langchain: - specifier: ^1.1.4 - version: 1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) + specifier: ^1.1.5 + version: 1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) source-map-support: specifier: ^0.5.21 version: 0.5.21 @@ -1180,23 +1265,23 @@ importers: specifier: ^2.29.0 version: 2.29.0 '@aws-sdk/credential-provider-node': - specifier: ^3.943.0 - version: 3.943.0 + specifier: ^3.946.0 + version: 3.946.0 '@langchain/aws': specifier: ^1.1.0 - version: 1.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + version: 1.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@langchain/core': - specifier: ^1.1.3 - version: 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + specifier: ^1.1.4 + version: 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@langchain/langgraph': specifier: ^1.0.4 - version: 1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) + version: 1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) '@langchain/openai': specifier: ^1.1.3 - version: 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + version: 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) '@langchain/pinecone': specifier: ^1.0.1 - version: 1.0.1(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@pinecone-database/pinecone@6.1.3) + version: 1.0.1(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@pinecone-database/pinecone@6.1.3) '@llm-ts-example/common-backend': specifier: workspace:* version: link:../../common/backend @@ -1207,20 +1292,20 @@ importers: specifier: ^4.2.5 version: 4.2.5 aws-cdk-lib: - specifier: ^2.231.0 - version: 2.231.0(constructs@10.4.3) + specifier: ^2.232.1 + version: 2.232.1(constructs@10.4.3) constructs: specifier: ^10.4.3 version: 10.4.3 langchain: - specifier: ^1.1.4 - version: 1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) + specifier: ^1.1.5 + version: 1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) langfuse: specifier: ^3.38.6 version: 3.38.6 langfuse-langchain: specifier: ^3.38.6 - version: 3.38.6(langchain@1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))) + version: 3.38.6(langchain@1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))) source-map-support: specifier: ^0.5.21 version: 0.5.21 @@ -1444,8 +1529,8 @@ packages: peerDependencies: zod: ^3.25.76 || ^4.1.8 - '@anthropic-ai/claude-agent-sdk@0.1.59': - resolution: {integrity: sha512-9TMxQCkIOd9W3c+owLtTW7d1ZgWeYoz1tbUwqz1TiKJTZmsmAFHUfXebQsJBZ+W15g6msqA6ln9yYxOKlNnlGw==} + '@anthropic-ai/claude-agent-sdk@0.1.60': + resolution: {integrity: sha512-Kl7zo4yNiUs3fRc9CQ5kcRuihdPEzH26boC5E8szO9WMNwPFBfJExLfYZDAcYmFaE3+M6mLpuYzmTGLxSoXrhg==} engines: {node: '>=18.0.0'} peerDependencies: zod: ^3.24.1 @@ -1491,8 +1576,8 @@ packages: '@asamuzakjp/css-color@4.1.0': resolution: {integrity: sha512-9xiBAtLn4aNsa4mDnpovJvBn72tNEIACyvlqaNJ+ADemR+yeMJWnBudOi2qGDviJa7SwcDOU/TRh5dnET7qk0w==} - '@asamuzakjp/dom-selector@6.7.5': - resolution: {integrity: sha512-Eks6dY8zau4m4wNRQjRVaKQRTalNcPcBvU1ZQ35w5kKRk1gUeNCkVLsRiATurjASTp3TKM4H10wsI50nx3NZdw==} + '@asamuzakjp/dom-selector@6.7.6': + resolution: {integrity: sha512-hBaJER6A9MpdG3WgdlOolHmbOYvSk46y7IQN/1+iqiCuUu6iWdQrs9DGKF8ocqsEqWujWf/V7b7vaDgiUmIvUg==} '@asamuzakjp/nwsapi@2.3.9': resolution: {integrity: sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==} @@ -1547,96 +1632,96 @@ packages: '@middy/core': optional: true - '@aws-sdk/client-bedrock-agent-runtime@3.943.0': - resolution: {integrity: sha512-/Q6okJgiMDZfUjMbGgzWKItSsfqF94/ifV1gzia2wLRhEA8Hdgg+YeCIow0oLYiCg556juHDz4CqL03MApgwQw==} + '@aws-sdk/client-bedrock-agent-runtime@3.946.0': + resolution: {integrity: sha512-QKOp8y4Q9Rzt91ZYi9BFgZk2P40TTd4e5MiCk85JTp36VCSgYl9zOTPPxUllEV6wpegz4CtICdBISsQqI0IqXg==} engines: {node: '>=18.0.0'} - '@aws-sdk/client-bedrock-runtime@3.943.0': - resolution: {integrity: sha512-mEiv1g5BeZFIQjBrzM5nT//KYLOBwUkXtHzsufkV99TIEKW5qzgOgx9Q9O8IbFQk3c7C6HYkV/kNOUI3KGyH6g==} + '@aws-sdk/client-bedrock-runtime@3.946.0': + resolution: {integrity: sha512-ZuUBQh5VswxHp8xBUmSyn/6u/IZ/kjxC2B3kBQMoaJlEriokBvDkc6tKWEeWEM/gEwFhJxYfXgJSpAZUmsjGFQ==} engines: {node: '>=18.0.0'} '@aws-sdk/client-dynamodb@3.919.0': resolution: {integrity: sha512-RXIebz/xPJN0Sl00FX5dVElHAuWOmHN3c5JyuC72h4kXeDpULPa+I1rFdZ458+FequaLt4JGk7unrT7QO2noCA==} engines: {node: '>=18.0.0'} - '@aws-sdk/client-kendra@3.943.0': - resolution: {integrity: sha512-HSW2XDkylaLBnDqCYdmtRgqKMiY6W12+bxfycz13V8e5dU2JarFf8Z61oh6onvdtE2E/KSu8WBK4m55/smp7NQ==} + '@aws-sdk/client-kendra@3.946.0': + resolution: {integrity: sha512-arkkD4NKcOKeHvblpN4vBqfR5wuWkpRuG7gFdHpl6WbFgqcXgJr2zov8f16VxI5iGUGMX4SJDzIdsQrapGHyRQ==} engines: {node: '>=18.0.0'} '@aws-sdk/client-sso@3.919.0': resolution: {integrity: sha512-9DVw/1DCzZ9G7Jofnhpg/XDC3wdJ3NAJdNWY1TrgE5ZcpTM+UTIQMGyaljCv9rgxggutHBgmBI5lP3YMcPk9ZQ==} engines: {node: '>=18.0.0'} - '@aws-sdk/client-sso@3.943.0': - resolution: {integrity: sha512-kOTO2B8Ks2qX73CyKY8PAajtf5n39aMe2spoiOF5EkgSzGV7hZ/HONRDyADlyxwfsX39Q2F2SpPUaXzon32IGw==} + '@aws-sdk/client-sso@3.946.0': + resolution: {integrity: sha512-kGAs5iIVyUz4p6TX3pzG5q3cNxXnVpC4pwRC6DCSaSv9ozyPjc2d74FsK4fZ+J+ejtvCdJk72uiuQtWJc86Wuw==} engines: {node: '>=18.0.0'} '@aws-sdk/core@3.916.0': resolution: {integrity: sha512-1JHE5s6MD5PKGovmx/F1e01hUbds/1y3X8rD+Gvi/gWVfdg5noO7ZCerpRsWgfzgvCMZC9VicopBqNHCKLykZA==} engines: {node: '>=18.0.0'} - '@aws-sdk/core@3.943.0': - resolution: {integrity: sha512-8CBy2hI9ABF7RBVQuY1bgf/ue+WPmM/hl0adrXFlhnhkaQP0tFY5zhiy1Y+n7V+5f3/ORoHBmCCQmcHDDYJqJQ==} + '@aws-sdk/core@3.946.0': + resolution: {integrity: sha512-u2BkbLLVbMFrEiXrko2+S6ih5sUZPlbVyRPtXOqMHlCyzr70sE8kIiD6ba223rQeIFPcYfW/wHc6k4ihW2xxVg==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-env@3.916.0': resolution: {integrity: sha512-3gDeqOXcBRXGHScc6xb7358Lyf64NRG2P08g6Bu5mv1Vbg9PKDyCAZvhKLkG7hkdfAM8Yc6UJNhbFxr1ud/tCQ==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-env@3.943.0': - resolution: {integrity: sha512-WnS5w9fK9CTuoZRVSIHLOMcI63oODg9qd1vXMYb7QGLGlfwUm4aG3hdu7i9XvYrpkQfE3dzwWLtXF4ZBuL1Tew==} + '@aws-sdk/credential-provider-env@3.946.0': + resolution: {integrity: sha512-P4l+K6wX1tf8LmWUvZofdQ+BgCNyk6Tb9u1H10npvqpuCD+dCM4pXIBq3PQcv/juUBOvLGGREo+Govuh3lfD0Q==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-http@3.916.0': resolution: {integrity: sha512-NmooA5Z4/kPFJdsyoJgDxuqXC1C6oPMmreJjbOPqcwo6E/h2jxaG8utlQFgXe5F9FeJsMx668dtxVxSYnAAqHQ==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-http@3.943.0': - resolution: {integrity: sha512-SA8bUcYDEACdhnhLpZNnWusBpdmj4Vl67Vxp3Zke7SvoWSYbuxa+tiDiC+c92Z4Yq6xNOuLPW912ZPb9/NsSkA==} + '@aws-sdk/credential-provider-http@3.946.0': + resolution: {integrity: sha512-/zeOJ6E7dGZQ/l2k7KytEoPJX0APIhwt0A79hPf/bUpMF4dDs2P6JmchDrotk0a0Y/MIdNF8sBQ/MEOPnBiYoQ==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-ini@3.919.0': resolution: {integrity: sha512-fAWVfh0P54UFbyAK4tmIPh/X3COFAyXYSp8b2Pc1R6GRwDDMvrAigwGJuyZS4BmpPlXij1gB0nXbhM5Yo4MMMA==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-ini@3.943.0': - resolution: {integrity: sha512-BcLDb8l4oVW+NkuqXMlO7TnM6lBOWW318ylf4FRED/ply5eaGxkQYqdGvHSqGSN5Rb3vr5Ek0xpzSjeYD7C8Kw==} + '@aws-sdk/credential-provider-ini@3.946.0': + resolution: {integrity: sha512-Pdgcra3RivWj/TuZmfFaHbqsvvgnSKO0CxlRUMMr0PgBiCnUhyl+zBktdNOeGsOPH2fUzQpYhcUjYUgVSdcSDQ==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-login@3.943.0': - resolution: {integrity: sha512-9iCOVkiRW+evxiJE94RqosCwRrzptAVPhRhGWv4osfYDhjNAvUMyrnZl3T1bjqCoKNcETRKEZIU3dqYHnUkcwQ==} + '@aws-sdk/credential-provider-login@3.946.0': + resolution: {integrity: sha512-5iqLNc15u2Zx+7jOdQkIbP62N7n2031tw5hkmIG0DLnozhnk64osOh2CliiOE9x3c4P9Pf4frAwgyy9GzNTk2g==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-node@3.919.0': resolution: {integrity: sha512-GL5filyxYS+eZq8ZMQnY5hh79Wxor7Rljo0SUJxZVwEj8cf3zY0MMuwoXU1HQrVabvYtkPDOWSreX8GkIBtBCw==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-node@3.943.0': - resolution: {integrity: sha512-14eddaH/gjCWoLSAELVrFOQNyswUYwWphIt+PdsJ/FqVfP4ay2HsiZVEIYbQtmrKHaoLJhiZKwBQRjcqJDZG0w==} + '@aws-sdk/credential-provider-node@3.946.0': + resolution: {integrity: sha512-I7URUqnBPng1a5y81OImxrwERysZqMBREG6svhhGeZgxmqcpAZ8z5ywILeQXdEOCuuES8phUp/ojzxFjPXp/eA==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-process@3.916.0': resolution: {integrity: sha512-SXDyDvpJ1+WbotZDLJW1lqP6gYGaXfZJrgFSXIuZjHb75fKeNRgPkQX/wZDdUvCwdrscvxmtyJorp2sVYkMcvA==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-process@3.943.0': - resolution: {integrity: sha512-GIY/vUkthL33AdjOJ8r9vOosKf/3X+X7LIiACzGxvZZrtoOiRq0LADppdiKIB48vTL63VvW+eRIOFAxE6UDekw==} + '@aws-sdk/credential-provider-process@3.946.0': + resolution: {integrity: sha512-GtGHX7OGqIeVQ3DlVm5RRF43Qmf3S1+PLJv9svrdvAhAdy2bUb044FdXXqrtSsIfpzTKlHgQUiRo5MWLd35Ntw==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-sso@3.919.0': resolution: {integrity: sha512-oN1XG/frOc2K2KdVwRQjLTBLM1oSFJLtOhuV/6g9N0ASD+44uVJai1CF9JJv5GjHGV+wsqAt+/Dzde0tZEXirA==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-sso@3.943.0': - resolution: {integrity: sha512-1c5G11syUrru3D9OO6Uk+ul5e2lX1adb+7zQNyluNaLPXP6Dina6Sy6DFGRLu7tM8+M7luYmbS3w63rpYpaL+A==} + '@aws-sdk/credential-provider-sso@3.946.0': + resolution: {integrity: sha512-LeGSSt2V5iwYey1ENGY75RmoDP3bA2iE/py8QBKW8EDA8hn74XBLkprhrK5iccOvU3UGWY8WrEKFAFGNjJOL9g==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-web-identity@3.919.0': resolution: {integrity: sha512-Wi7RmyWA8kUJ++/8YceC7U5r4LyvOHGCnJLDHliP8rOC8HLdSgxw/Upeq3WmC+RPw1zyGOtEDRS/caop2xLXEA==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-web-identity@3.943.0': - resolution: {integrity: sha512-VtyGKHxICSb4kKGuaqotxso8JVM8RjCS3UYdIMOxUt9TaFE/CZIfZKtjTr+IJ7M0P7t36wuSUb/jRLyNmGzUUA==} + '@aws-sdk/credential-provider-web-identity@3.946.0': + resolution: {integrity: sha512-ocBCvjWfkbjxElBI1QUxOnHldsNhoU0uOICFvuRDAZAoxvypJHN3m5BJkqb7gqorBbcv3LRgmBdEnWXOAvq+7Q==} engines: {node: '>=18.0.0'} '@aws-sdk/endpoint-cache@3.893.0': @@ -1683,8 +1768,8 @@ packages: resolution: {integrity: sha512-mzF5AdrpQXc2SOmAoaQeHpDFsK2GE6EGcEACeNuoESluPI2uYMpuuNMYrUufdnIAIyqgKlis0NVxiahA5jG42w==} engines: {node: '>=18.0.0'} - '@aws-sdk/middleware-user-agent@3.943.0': - resolution: {integrity: sha512-956n4kVEwFNXndXfhSAN5wO+KRgqiWEEY+ECwLvxmmO8uQ0NWOa8l6l65nTtyuiWzMX81c9BvlyNR5EgUeeUvA==} + '@aws-sdk/middleware-user-agent@3.946.0': + resolution: {integrity: sha512-7QcljCraeaWQNuqmOoAyZs8KpZcuhPiqdeeKoRd397jVGNRehLFsZbIMOvwaluUDFY11oMyXOkQEERe1Zo2fCw==} engines: {node: '>=18.0.0'} '@aws-sdk/middleware-websocket@3.936.0': @@ -1695,8 +1780,8 @@ packages: resolution: {integrity: sha512-5D9OQsMPkbkp4KHM7JZv/RcGCpr3E1L7XX7U9sCxY+sFGeysltoviTmaIBXsJ2IjAJbBULtf0G/J+2cfH5OP+w==} engines: {node: '>=18.0.0'} - '@aws-sdk/nested-clients@3.943.0': - resolution: {integrity: sha512-anFtB0p2FPuyUnbOULwGmKYqYKSq1M73c9uZ08jR/NCq6Trjq9cuF5TFTeHwjJyPRb4wMf2Qk859oiVfFqnQiw==} + '@aws-sdk/nested-clients@3.946.0': + resolution: {integrity: sha512-rjAtEguukeW8mlyEQMQI56vxFoyWlaNwowmz1p1rav948SUjtrzjHAp4TOQWhibb7AR7BUTHBCgIcyCRjBEf4g==} engines: {node: '>=18.0.0'} '@aws-sdk/region-config-resolver@3.914.0': @@ -1711,8 +1796,8 @@ packages: resolution: {integrity: sha512-6aFv4lzXbfbkl0Pv37Us8S/ZkqplOQZIEgQg7bfMru7P96Wv2jVnDGsEc5YyxMnnRyIB90naQ5JgslZ4rkpknw==} engines: {node: '>=18.0.0'} - '@aws-sdk/token-providers@3.943.0': - resolution: {integrity: sha512-cRKyIzwfkS+XztXIFPoWORuaxlIswP+a83BJzelX4S1gUZ7FcXB4+lj9Jxjn8SbQhR4TPU3Owbpu+S7pd6IRbQ==} + '@aws-sdk/token-providers@3.946.0': + resolution: {integrity: sha512-a5c+rM6CUPX2ExmUZ3DlbLlS5rQr4tbdoGcgBsjnAHiYx8MuMNAI+8M7wfjF13i2yvUQj5WEIddvLpayfEZj9g==} engines: {node: '>=18.0.0'} '@aws-sdk/types@3.914.0': @@ -1754,8 +1839,8 @@ packages: aws-crt: optional: true - '@aws-sdk/util-user-agent-node@3.943.0': - resolution: {integrity: sha512-gn+ILprVRrgAgTIBk2TDsJLRClzIOdStQFeFTcN0qpL8Z4GBCqMFhw7O7X+MM55Stt5s4jAauQ/VvoqmCADnQg==} + '@aws-sdk/util-user-agent-node@3.946.0': + resolution: {integrity: sha512-a2UwwvzbK5AxHKUBupfg4s7VnkqRAHjYsuezHnKCniczmT4HZfP1NnfwwvLKEH8qaTrwenxjKSfq4UWmWkvG+Q==} engines: {node: '>=18.0.0'} peerDependencies: aws-crt: '>=1.0.0' @@ -2348,8 +2433,8 @@ packages: resolution: {integrity: sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@expo/devcert@1.2.0': - resolution: {integrity: sha512-Uilcv3xGELD5t/b0eM4cxBFEKQRIivB3v7i+VhWLV/gL98aw810unLKKJbGAxAIhY6Ipyz8ChWibFsKFXYwstA==} + '@expo/devcert@1.2.1': + resolution: {integrity: sha512-qC4eaxmKMTmJC2ahwyui6ud8f3W60Ss7pMkpBq40Hu3zyiAaugPXnZ24145U7K36qO9UHdZUVxsCvIpz2RYYCA==} '@expo/sudo-prompt@9.3.2': resolution: {integrity: sha512-HHQigo3rQWKMDzYDLkubN5WQOYXJJE2eNqIQC2axC2iO3mHdwnIR7FgZVvHWtBwAdzBgAP0ECp8KqS8TiMKvgw==} @@ -3186,8 +3271,8 @@ packages: youtubei.js: optional: true - '@langchain/core@1.1.3': - resolution: {integrity: sha512-jSxHL3GHamHYPm+Gy3Sz+mZ9LUfCY2ni8cU+ChcmNFNO63luqM8Bl36KZPX/EMTIaqk+ib+IVK/pOVAKZi4pTw==} + '@langchain/core@1.1.4': + resolution: {integrity: sha512-AZVHVoLJzhHU/jsjeNto1pvfHaPxGT+V3PcVyvUw0kCiWftdu1bxfwhwSsZJ9B9iJeXJdCIUe089+NYd3FsEuw==} engines: {node: '>=20'} '@langchain/langgraph-checkpoint@1.0.0': @@ -4979,6 +5064,10 @@ packages: '@standard-schema/spec@1.0.0': resolution: {integrity: sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==} + '@strands-agents/sdk@0.1.2': + resolution: {integrity: sha512-qVJ6V0EDVUYGticux0e0kUvPWxUQnqd3estEF1rOaytStH1yu6C+a8puOhVOq0ZeK9cTY8wwkCdLvLc3VfMfIQ==} + engines: {node: '>=20.0.0'} + '@stylistic/eslint-plugin@5.6.1': resolution: {integrity: sha512-JCs+MqoXfXrRPGbGmho/zGS/jMcn3ieKl/A8YImqib76C8kjgZwq5uUFzc30lJkMvcchuRn6/v8IApLxli3Jyw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -5498,8 +5587,8 @@ packages: resolution: {integrity: sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==} engines: {node: '>= 8.0.0'} - ai@5.0.106: - resolution: {integrity: sha512-M5obwavxSJJ3tGlAFqI6eltYNJB0D20X6gIBCFx/KVorb/X1fxVVfiZZpZb+Gslu4340droSOjT0aKQFCarNVg==} + ai@5.0.107: + resolution: {integrity: sha512-laZlS9ZC/DZfSaxPgrBqI4mM+kxRvTPBBQfa74ceBFskkunZKEsaGVFNEs4cfyGa3nCCCl1WO/fjxixp4V8Zag==} engines: {node: '>=18'} peerDependencies: zod: ^3.25.76 || ^4.1.8 @@ -5637,8 +5726,8 @@ packages: resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} engines: {node: '>= 0.4'} - aws-cdk-lib@2.231.0: - resolution: {integrity: sha512-RMt88F1vhsM28j81EjvIXRoPeYQdtk72EGh9xAP6LjuyF8df1hDBIy5cawUvagdp5eCBPVHrPJ2U0eaUUKtjFg==} + aws-cdk-lib@2.232.1: + resolution: {integrity: sha512-F1vNcpWBo85pSxa0DJ5DO4k7Ok4vVp0vh1cFO4Y12LLX07ixOcnJn/6B97/XVC0fgZNvzPx/sYgioEd0u8oKkQ==} engines: {node: '>= 18.0.0'} peerDependencies: constructs: ^10.0.0 @@ -5735,8 +5824,8 @@ packages: base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - baseline-browser-mapping@2.9.2: - resolution: {integrity: sha512-PxSsosKQjI38iXkmb3d0Y32efqyA0uW4s41u4IVBsLlWLhCiYNpH/AfNOVWRqCQBlD8TFJTz6OUWNd4DFJCnmw==} + baseline-browser-mapping@2.9.3: + resolution: {integrity: sha512-8QdH6czo+G7uBsNo0GiUfouPN1lRzKdJTGnKXwe12gkFbnnOUaUKGN55dMkfy+mnxmvjwl9zcI4VncczcVXDhA==} hasBin: true before-after-hook@4.0.0: @@ -6174,6 +6263,10 @@ packages: supports-color: optional: true + decamelize@1.2.0: + resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} + engines: {node: '>=0.10.0'} + decimal.js@10.6.0: resolution: {integrity: sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==} @@ -6301,8 +6394,8 @@ packages: ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - electron-to-chromium@1.5.265: - resolution: {integrity: sha512-B7IkLR1/AE+9jR2LtVF/1/6PFhY5TlnEHnlrKmGk7PvkJibg5jr+mLXLLzq3QYl6PA1T/vLDthQPqIPAlS/PPA==} + electron-to-chromium@1.5.266: + resolution: {integrity: sha512-kgWEglXvkEfMH7rxP5OSZZwnaDWT7J9EoZCujhnpLbfi0bbNtRkgdX2E3gt0Uer11c61qCYktB3hwkAS325sJg==} emoji-regex@10.6.0: resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==} @@ -6859,11 +6952,6 @@ packages: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} - glob@13.0.0: - resolution: {integrity: sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==} - engines: {node: 20 || >=22} - hasBin: true - global-dirs@3.0.1: resolution: {integrity: sha512-NBcGGFbBA9s1VzD41QXDG+3++t9Mn5t1FpLdhESY6oKY4gYTFpX4wO3sqGUa0Srjtbfj3szX0RnemmrVRUdULA==} engines: {node: '>=10'} @@ -7471,11 +7559,11 @@ packages: known-css-properties@0.30.0: resolution: {integrity: sha512-VSWXYUnsPu9+WYKkfmJyLKtIvaRJi1kXUqVmBACORXZQxT5oZDsoZ2vQP+bQFDnWtpI/4eq3MLoRMjI2fnLzTQ==} - langchain@1.1.4: - resolution: {integrity: sha512-aCc3r339qALNDqBs1ZA3FlciiH5j5qGRe7pcAUKjbutKCtroriUut8f+XmLFMYaedJknwBDJ1EdAvGk4O+VB6Q==} + langchain@1.1.5: + resolution: {integrity: sha512-tmJHdCsi4AQLEWDeTm9QTWgdwYgIaA4kfp14KFw6e1sUPxjsoHqdFqdf1ZJZxhs1h/n+hpIr3NBfGNBQnWxWEQ==} engines: {node: '>=20'} peerDependencies: - '@langchain/core': 1.1.3 + '@langchain/core': 1.1.4 langfuse-core@3.38.6: resolution: {integrity: sha512-EcZXa+DK9FJdi1I30+u19eKjuBJ04du6j2Nybk19KKCuraLczg/ppkTQcGvc4QOk//OAi3qUHrajUuV74RXsBQ==} @@ -7892,10 +7980,6 @@ packages: resolution: {integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==} engines: {node: '>=8'} - minipass@7.1.2: - resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} - engines: {node: '>=16 || 14 >=14.17'} - minizlib@2.1.2: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} @@ -8204,10 +8288,6 @@ packages: resolution: {integrity: sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==} engines: {node: '>=8'} - p-queue@9.0.1: - resolution: {integrity: sha512-RhBdVhSwJb7Ocn3e8ULk4NMwBEuOxe+1zcgphUy9c2e5aR/xbEsdVXxHJ3lynw6Qiqu7OINEyHlZkiblEpaq7w==} - engines: {node: '>=20'} - p-retry@4.6.2: resolution: {integrity: sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==} engines: {node: '>=8'} @@ -8220,10 +8300,6 @@ packages: resolution: {integrity: sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==} engines: {node: '>=8'} - p-timeout@7.0.1: - resolution: {integrity: sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg==} - engines: {node: '>=20'} - package-json@6.5.0: resolution: {integrity: sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==} engines: {node: '>=8'} @@ -8274,10 +8350,6 @@ packages: path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - path-scurry@2.0.1: - resolution: {integrity: sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA==} - engines: {node: 20 || >=22} - path-to-regexp@0.1.12: resolution: {integrity: sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==} @@ -9835,7 +9907,7 @@ snapshots: '@ai-sdk/provider-utils': 3.0.12(zod@4.1.13) zod: 4.1.13 - '@anthropic-ai/claude-agent-sdk@0.1.59(zod@4.1.13)': + '@anthropic-ai/claude-agent-sdk@0.1.60(zod@4.1.13)': dependencies: zod: 4.1.13 optionalDependencies: @@ -9883,22 +9955,22 @@ snapshots: '@opentelemetry/api': 1.9.0 '@opentelemetry/core': 1.30.1(@opentelemetry/api@1.9.0) - '@arizeai/openinference-instrumentation-bedrock@0.4.3(@aws-sdk/client-bedrock-runtime@3.943.0)': + '@arizeai/openinference-instrumentation-bedrock@0.4.3(@aws-sdk/client-bedrock-runtime@3.946.0)': dependencies: '@arizeai/openinference-core': 2.0.0 '@arizeai/openinference-semantic-conventions': 2.1.2 - '@aws-sdk/client-bedrock-runtime': 3.943.0 + '@aws-sdk/client-bedrock-runtime': 3.946.0 '@opentelemetry/api': 1.9.0 '@opentelemetry/core': 1.30.1(@opentelemetry/api@1.9.0) '@opentelemetry/instrumentation': 0.46.0(@opentelemetry/api@1.9.0) transitivePeerDependencies: - supports-color - '@arizeai/openinference-instrumentation-langchain@3.4.6(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': + '@arizeai/openinference-instrumentation-langchain@3.4.6(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': dependencies: '@arizeai/openinference-core': 2.0.0 '@arizeai/openinference-semantic-conventions': 2.1.2 - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@opentelemetry/api': 1.9.0 '@opentelemetry/core': 1.30.1(@opentelemetry/api@1.9.0) '@opentelemetry/instrumentation': 0.46.0(@opentelemetry/api@1.9.0) @@ -9915,7 +9987,7 @@ snapshots: '@csstools/css-tokenizer': 3.0.4 lru-cache: 11.2.4 - '@asamuzakjp/dom-selector@6.7.5': + '@asamuzakjp/dom-selector@6.7.6': dependencies: '@asamuzakjp/nwsapi': 2.3.9 bidi-js: 1.0.3 @@ -9987,21 +10059,21 @@ snapshots: '@aws/lambda-invoke-store': 0.2.1 lodash.merge: 4.6.2 - '@aws-sdk/client-bedrock-agent-runtime@3.943.0': + '@aws-sdk/client-bedrock-agent-runtime@3.946.0': dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/core': 3.943.0 - '@aws-sdk/credential-provider-node': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/credential-provider-node': 3.946.0 '@aws-sdk/middleware-host-header': 3.936.0 '@aws-sdk/middleware-logger': 3.936.0 '@aws-sdk/middleware-recursion-detection': 3.936.0 - '@aws-sdk/middleware-user-agent': 3.943.0 + '@aws-sdk/middleware-user-agent': 3.946.0 '@aws-sdk/region-config-resolver': 3.936.0 '@aws-sdk/types': 3.936.0 '@aws-sdk/util-endpoints': 3.936.0 '@aws-sdk/util-user-agent-browser': 3.936.0 - '@aws-sdk/util-user-agent-node': 3.943.0 + '@aws-sdk/util-user-agent-node': 3.946.0 '@smithy/config-resolver': 4.4.3 '@smithy/core': 3.18.7 '@smithy/eventstream-serde-browser': 4.2.5 @@ -10034,25 +10106,25 @@ snapshots: transitivePeerDependencies: - aws-crt - '@aws-sdk/client-bedrock-runtime@3.943.0': + '@aws-sdk/client-bedrock-runtime@3.946.0': dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/core': 3.943.0 - '@aws-sdk/credential-provider-node': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/credential-provider-node': 3.946.0 '@aws-sdk/eventstream-handler-node': 3.936.0 '@aws-sdk/middleware-eventstream': 3.936.0 '@aws-sdk/middleware-host-header': 3.936.0 '@aws-sdk/middleware-logger': 3.936.0 '@aws-sdk/middleware-recursion-detection': 3.936.0 - '@aws-sdk/middleware-user-agent': 3.943.0 + '@aws-sdk/middleware-user-agent': 3.946.0 '@aws-sdk/middleware-websocket': 3.936.0 '@aws-sdk/region-config-resolver': 3.936.0 - '@aws-sdk/token-providers': 3.943.0 + '@aws-sdk/token-providers': 3.946.0 '@aws-sdk/types': 3.936.0 '@aws-sdk/util-endpoints': 3.936.0 '@aws-sdk/util-user-agent-browser': 3.936.0 - '@aws-sdk/util-user-agent-node': 3.943.0 + '@aws-sdk/util-user-agent-node': 3.946.0 '@smithy/config-resolver': 4.4.3 '@smithy/core': 3.18.7 '@smithy/eventstream-serde-browser': 4.2.5 @@ -10134,21 +10206,21 @@ snapshots: - aws-crt optional: true - '@aws-sdk/client-kendra@3.943.0': + '@aws-sdk/client-kendra@3.946.0': dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/core': 3.943.0 - '@aws-sdk/credential-provider-node': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/credential-provider-node': 3.946.0 '@aws-sdk/middleware-host-header': 3.936.0 '@aws-sdk/middleware-logger': 3.936.0 '@aws-sdk/middleware-recursion-detection': 3.936.0 - '@aws-sdk/middleware-user-agent': 3.943.0 + '@aws-sdk/middleware-user-agent': 3.946.0 '@aws-sdk/region-config-resolver': 3.936.0 '@aws-sdk/types': 3.936.0 '@aws-sdk/util-endpoints': 3.936.0 '@aws-sdk/util-user-agent-browser': 3.936.0 - '@aws-sdk/util-user-agent-node': 3.943.0 + '@aws-sdk/util-user-agent-node': 3.946.0 '@smithy/config-resolver': 4.4.3 '@smithy/core': 3.18.7 '@smithy/fetch-http-handler': 5.3.6 @@ -10222,20 +10294,20 @@ snapshots: - aws-crt optional: true - '@aws-sdk/client-sso@3.943.0': + '@aws-sdk/client-sso@3.946.0': dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/core': 3.943.0 + '@aws-sdk/core': 3.946.0 '@aws-sdk/middleware-host-header': 3.936.0 '@aws-sdk/middleware-logger': 3.936.0 '@aws-sdk/middleware-recursion-detection': 3.936.0 - '@aws-sdk/middleware-user-agent': 3.943.0 + '@aws-sdk/middleware-user-agent': 3.946.0 '@aws-sdk/region-config-resolver': 3.936.0 '@aws-sdk/types': 3.936.0 '@aws-sdk/util-endpoints': 3.936.0 '@aws-sdk/util-user-agent-browser': 3.936.0 - '@aws-sdk/util-user-agent-node': 3.943.0 + '@aws-sdk/util-user-agent-node': 3.946.0 '@smithy/config-resolver': 4.4.3 '@smithy/core': 3.18.7 '@smithy/fetch-http-handler': 5.3.6 @@ -10282,7 +10354,7 @@ snapshots: tslib: 2.8.1 optional: true - '@aws-sdk/core@3.943.0': + '@aws-sdk/core@3.946.0': dependencies: '@aws-sdk/types': 3.936.0 '@aws-sdk/xml-builder': 3.930.0 @@ -10307,9 +10379,9 @@ snapshots: tslib: 2.8.1 optional: true - '@aws-sdk/credential-provider-env@3.943.0': + '@aws-sdk/credential-provider-env@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 + '@aws-sdk/core': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/property-provider': 4.2.5 '@smithy/types': 4.9.0 @@ -10329,9 +10401,9 @@ snapshots: tslib: 2.8.1 optional: true - '@aws-sdk/credential-provider-http@3.943.0': + '@aws-sdk/credential-provider-http@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 + '@aws-sdk/core': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/fetch-http-handler': 5.3.6 '@smithy/node-http-handler': 4.4.5 @@ -10361,16 +10433,16 @@ snapshots: - aws-crt optional: true - '@aws-sdk/credential-provider-ini@3.943.0': + '@aws-sdk/credential-provider-ini@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 - '@aws-sdk/credential-provider-env': 3.943.0 - '@aws-sdk/credential-provider-http': 3.943.0 - '@aws-sdk/credential-provider-login': 3.943.0 - '@aws-sdk/credential-provider-process': 3.943.0 - '@aws-sdk/credential-provider-sso': 3.943.0 - '@aws-sdk/credential-provider-web-identity': 3.943.0 - '@aws-sdk/nested-clients': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/credential-provider-env': 3.946.0 + '@aws-sdk/credential-provider-http': 3.946.0 + '@aws-sdk/credential-provider-login': 3.946.0 + '@aws-sdk/credential-provider-process': 3.946.0 + '@aws-sdk/credential-provider-sso': 3.946.0 + '@aws-sdk/credential-provider-web-identity': 3.946.0 + '@aws-sdk/nested-clients': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/credential-provider-imds': 4.2.5 '@smithy/property-provider': 4.2.5 @@ -10380,10 +10452,10 @@ snapshots: transitivePeerDependencies: - aws-crt - '@aws-sdk/credential-provider-login@3.943.0': + '@aws-sdk/credential-provider-login@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 - '@aws-sdk/nested-clients': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/nested-clients': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/property-provider': 4.2.5 '@smithy/protocol-http': 5.3.5 @@ -10411,14 +10483,14 @@ snapshots: - aws-crt optional: true - '@aws-sdk/credential-provider-node@3.943.0': + '@aws-sdk/credential-provider-node@3.946.0': dependencies: - '@aws-sdk/credential-provider-env': 3.943.0 - '@aws-sdk/credential-provider-http': 3.943.0 - '@aws-sdk/credential-provider-ini': 3.943.0 - '@aws-sdk/credential-provider-process': 3.943.0 - '@aws-sdk/credential-provider-sso': 3.943.0 - '@aws-sdk/credential-provider-web-identity': 3.943.0 + '@aws-sdk/credential-provider-env': 3.946.0 + '@aws-sdk/credential-provider-http': 3.946.0 + '@aws-sdk/credential-provider-ini': 3.946.0 + '@aws-sdk/credential-provider-process': 3.946.0 + '@aws-sdk/credential-provider-sso': 3.946.0 + '@aws-sdk/credential-provider-web-identity': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/credential-provider-imds': 4.2.5 '@smithy/property-provider': 4.2.5 @@ -10438,9 +10510,9 @@ snapshots: tslib: 2.8.1 optional: true - '@aws-sdk/credential-provider-process@3.943.0': + '@aws-sdk/credential-provider-process@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 + '@aws-sdk/core': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/property-provider': 4.2.5 '@smithy/shared-ini-file-loader': 4.4.0 @@ -10461,11 +10533,11 @@ snapshots: - aws-crt optional: true - '@aws-sdk/credential-provider-sso@3.943.0': + '@aws-sdk/credential-provider-sso@3.946.0': dependencies: - '@aws-sdk/client-sso': 3.943.0 - '@aws-sdk/core': 3.943.0 - '@aws-sdk/token-providers': 3.943.0 + '@aws-sdk/client-sso': 3.946.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/token-providers': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/property-provider': 4.2.5 '@smithy/shared-ini-file-loader': 4.4.0 @@ -10487,10 +10559,10 @@ snapshots: - aws-crt optional: true - '@aws-sdk/credential-provider-web-identity@3.943.0': + '@aws-sdk/credential-provider-web-identity@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 - '@aws-sdk/nested-clients': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/nested-clients': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/property-provider': 4.2.5 '@smithy/shared-ini-file-loader': 4.4.0 @@ -10585,9 +10657,9 @@ snapshots: tslib: 2.8.1 optional: true - '@aws-sdk/middleware-user-agent@3.943.0': + '@aws-sdk/middleware-user-agent@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 + '@aws-sdk/core': 3.946.0 '@aws-sdk/types': 3.936.0 '@aws-sdk/util-endpoints': 3.936.0 '@smithy/core': 3.18.7 @@ -10652,20 +10724,20 @@ snapshots: - aws-crt optional: true - '@aws-sdk/nested-clients@3.943.0': + '@aws-sdk/nested-clients@3.946.0': dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/core': 3.943.0 + '@aws-sdk/core': 3.946.0 '@aws-sdk/middleware-host-header': 3.936.0 '@aws-sdk/middleware-logger': 3.936.0 '@aws-sdk/middleware-recursion-detection': 3.936.0 - '@aws-sdk/middleware-user-agent': 3.943.0 + '@aws-sdk/middleware-user-agent': 3.946.0 '@aws-sdk/region-config-resolver': 3.936.0 '@aws-sdk/types': 3.936.0 '@aws-sdk/util-endpoints': 3.936.0 '@aws-sdk/util-user-agent-browser': 3.936.0 - '@aws-sdk/util-user-agent-node': 3.943.0 + '@aws-sdk/util-user-agent-node': 3.946.0 '@smithy/config-resolver': 4.4.3 '@smithy/core': 3.18.7 '@smithy/fetch-http-handler': 5.3.6 @@ -10724,10 +10796,10 @@ snapshots: - aws-crt optional: true - '@aws-sdk/token-providers@3.943.0': + '@aws-sdk/token-providers@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 - '@aws-sdk/nested-clients': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/nested-clients': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/property-provider': 4.2.5 '@smithy/shared-ini-file-loader': 4.4.0 @@ -10799,9 +10871,9 @@ snapshots: tslib: 2.8.1 optional: true - '@aws-sdk/util-user-agent-node@3.943.0': + '@aws-sdk/util-user-agent-node@3.946.0': dependencies: - '@aws-sdk/middleware-user-agent': 3.943.0 + '@aws-sdk/middleware-user-agent': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/node-config-provider': 4.3.5 '@smithy/types': 4.9.0 @@ -11315,11 +11387,10 @@ snapshots: '@eslint/core': 0.17.0 levn: 0.4.1 - '@expo/devcert@1.2.0': + '@expo/devcert@1.2.1': dependencies: '@expo/sudo-prompt': 9.3.2 debug: 3.2.7 - glob: 13.0.0 transitivePeerDependencies: - supports-color @@ -11366,9 +11437,9 @@ snapshots: '@humanwhocodes/retry@0.4.3': {} - '@ibm-cloud/watsonx-ai@1.6.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': + '@ibm-cloud/watsonx-ai@1.6.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': dependencies: - '@langchain/textsplitters': 0.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + '@langchain/textsplitters': 0.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@types/node': 18.19.130 extend: 3.0.2 ibm-cloud-sdk-core: 5.3.2 @@ -11722,21 +11793,21 @@ snapshots: '@kwsites/promise-deferred@1.1.1': optional: true - '@langchain/aws@1.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': + '@langchain/aws@1.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': dependencies: - '@aws-sdk/client-bedrock-agent-runtime': 3.943.0 - '@aws-sdk/client-bedrock-runtime': 3.943.0 - '@aws-sdk/client-kendra': 3.943.0 - '@aws-sdk/credential-provider-node': 3.943.0 - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@aws-sdk/client-bedrock-agent-runtime': 3.946.0 + '@aws-sdk/client-bedrock-runtime': 3.946.0 + '@aws-sdk/client-kendra': 3.946.0 + '@aws-sdk/credential-provider-node': 3.946.0 + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) transitivePeerDependencies: - aws-crt - '@langchain/classic@1.0.5(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3)': + '@langchain/classic@1.0.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3)': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) - '@langchain/openai': 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) - '@langchain/textsplitters': 1.0.1(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/openai': 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + '@langchain/textsplitters': 1.0.1(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) handlebars: 4.7.8 js-yaml: 4.1.1 jsonpointer: 5.0.1 @@ -11755,13 +11826,13 @@ snapshots: - openai - ws - '@langchain/community@1.0.7(ee9edf035d3124403fc21c2491f2a8b8)': + '@langchain/community@1.0.7(964061b1ee7e8f3b0e1fa21e45f97373)': dependencies: '@browserbasehq/stagehand': 1.14.0(@playwright/test@1.51.1)(deepmerge@4.3.1)(dotenv@17.2.3)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(zod@4.1.13) - '@ibm-cloud/watsonx-ai': 1.6.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) - '@langchain/classic': 1.0.5(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3) - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) - '@langchain/openai': 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + '@ibm-cloud/watsonx-ai': 1.6.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + '@langchain/classic': 1.0.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/openai': 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) binary-extensions: 2.3.0 flat: 5.0.2 ibm-cloud-sdk-core: 5.3.2 @@ -11773,7 +11844,7 @@ snapshots: optionalDependencies: '@aws-crypto/sha256-js': 5.2.0 '@aws-sdk/client-dynamodb': 3.919.0 - '@aws-sdk/credential-provider-node': 3.943.0 + '@aws-sdk/credential-provider-node': 3.946.0 '@browserbasehq/sdk': 2.6.0 '@libsql/client': 0.14.0 '@mlc-ai/web-llm': 0.2.79 @@ -11800,13 +11871,16 @@ snapshots: - '@opentelemetry/sdk-trace-base' - peggy - '@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))': + '@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))': dependencies: '@cfworker/json-schema': 4.1.1 + ansi-styles: 5.2.0 + camelcase: 6.3.0 + decamelize: 1.2.0 js-tiktoken: 1.0.21 langsmith: 0.3.82(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) mustache: 4.2.0 - p-queue: 9.0.1 + p-queue: 6.6.2 uuid: 10.0.0 zod: 4.1.13 transitivePeerDependencies: @@ -11815,25 +11889,25 @@ snapshots: - '@opentelemetry/sdk-trace-base' - openai - '@langchain/langgraph-checkpoint@1.0.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': + '@langchain/langgraph-checkpoint@1.0.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) uuid: 10.0.0 - '@langchain/langgraph-sdk@1.2.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)': + '@langchain/langgraph-sdk@1.2.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)': dependencies: p-queue: 6.6.2 p-retry: 4.6.2 uuid: 9.0.1 optionalDependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) react: 19.1.0 - '@langchain/langgraph@1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13)': + '@langchain/langgraph@1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13)': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) - '@langchain/langgraph-checkpoint': 1.0.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) - '@langchain/langgraph-sdk': 1.2.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/langgraph-checkpoint': 1.0.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + '@langchain/langgraph-sdk': 1.2.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0) uuid: 10.0.0 zod: 4.1.13 optionalDependencies: @@ -11842,10 +11916,10 @@ snapshots: - react - react-dom - '@langchain/mcp-adapters@1.0.3(@cfworker/json-schema@4.1.1)(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@langchain/langgraph@1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13))': + '@langchain/mcp-adapters@1.0.3(@cfworker/json-schema@4.1.1)(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@langchain/langgraph@1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13))': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) - '@langchain/langgraph': 1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/langgraph': 1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) '@modelcontextprotocol/sdk': 1.24.3(@cfworker/json-schema@4.1.1)(zod@4.1.13) debug: 4.4.3 zod: 4.1.13 @@ -11855,30 +11929,30 @@ snapshots: - '@cfworker/json-schema' - supports-color - '@langchain/openai@1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3)': + '@langchain/openai@1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3)': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) js-tiktoken: 1.0.21 openai: 6.10.0(ws@8.18.3)(zod@4.1.13) zod: 4.1.13 transitivePeerDependencies: - ws - '@langchain/pinecone@1.0.1(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@pinecone-database/pinecone@6.1.3)': + '@langchain/pinecone@1.0.1(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@pinecone-database/pinecone@6.1.3)': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@pinecone-database/pinecone': 6.1.3 flat: 5.0.2 uuid: 10.0.0 - '@langchain/textsplitters@0.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': + '@langchain/textsplitters@0.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) js-tiktoken: 1.0.21 - '@langchain/textsplitters@1.0.1(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': + '@langchain/textsplitters@1.0.1(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) js-tiktoken: 1.0.21 '@libsql/client@0.14.0': @@ -11996,8 +12070,8 @@ snapshots: '@ai-sdk/ui-utils': 1.2.11(zod@4.1.13) '@ai-sdk/xai-v5': '@ai-sdk/xai@2.0.26(zod@4.1.13)' '@isaacs/ttlcache': 1.4.1 - '@mastra/schema-compat': 0.11.8(ai@5.0.106(zod@4.1.13))(zod@4.1.13) - '@openrouter/ai-sdk-provider-v5': '@openrouter/ai-sdk-provider@1.2.3(ai@5.0.106(zod@4.1.13))(zod@4.1.13)' + '@mastra/schema-compat': 0.11.8(ai@5.0.107(zod@4.1.13))(zod@4.1.13) + '@openrouter/ai-sdk-provider-v5': '@openrouter/ai-sdk-provider@1.2.3(ai@5.0.107(zod@4.1.13))(zod@4.1.13)' '@opentelemetry/api': 1.9.0 '@opentelemetry/auto-instrumentations-node': 0.62.2(@opentelemetry/api@1.9.0)(@opentelemetry/core@2.2.0(@opentelemetry/api@1.9.0)) '@opentelemetry/core': 2.2.0(@opentelemetry/api@1.9.0) @@ -12012,7 +12086,7 @@ snapshots: '@opentelemetry/sdk-trace-node': 2.2.0(@opentelemetry/api@1.9.0) '@opentelemetry/semantic-conventions': 1.38.0 '@sindresorhus/slugify': 2.2.1 - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) ai-v5: ai@5.0.97(zod@4.1.13) date-fns: 3.6.0 dotenv: 16.6.1 @@ -12117,9 +12191,9 @@ snapshots: '@mastra/memory@0.15.12(@mastra/core@0.24.6(openapi-types@12.1.3)(zod@4.1.13))(zod@4.1.13)': dependencies: '@mastra/core': 0.24.6(openapi-types@12.1.3)(zod@4.1.13) - '@mastra/schema-compat': 0.11.8(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@mastra/schema-compat': 0.11.8(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@upstash/redis': 1.35.7 - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) ai-v5: ai@5.0.60(zod@4.1.13) async-mutex: 0.5.0 js-tiktoken: 1.0.21 @@ -12134,9 +12208,9 @@ snapshots: transitivePeerDependencies: - pg-native - '@mastra/schema-compat@0.11.8(ai@5.0.106(zod@4.1.13))(zod@4.1.13)': + '@mastra/schema-compat@0.11.8(ai@5.0.107(zod@4.1.13))(zod@4.1.13)': dependencies: - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) json-schema: 0.4.0 zod: 4.1.13 zod-from-json-schema: 0.5.2 @@ -12408,10 +12482,10 @@ snapshots: '@octokit/webhooks-methods': 6.0.0 optional: true - '@openrouter/ai-sdk-provider@1.2.3(ai@5.0.106(zod@4.1.13))(zod@4.1.13)': + '@openrouter/ai-sdk-provider@1.2.3(ai@5.0.107(zod@4.1.13))(zod@4.1.13)': dependencies: '@openrouter/sdk': 0.1.27 - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) zod: 4.1.13 '@openrouter/sdk@0.1.27': @@ -14049,6 +14123,19 @@ snapshots: '@standard-schema/spec@1.0.0': {} + '@strands-agents/sdk@0.1.2(@cfworker/json-schema@4.1.1)(ws@8.18.3)': + dependencies: + '@aws-sdk/client-bedrock-runtime': 3.946.0 + '@modelcontextprotocol/sdk': 1.24.3(@cfworker/json-schema@4.1.1)(zod@4.1.13) + zod: 4.1.13 + optionalDependencies: + openai: 6.10.0(ws@8.18.3)(zod@4.1.13) + transitivePeerDependencies: + - '@cfworker/json-schema' + - aws-crt + - supports-color + - ws + '@stylistic/eslint-plugin@5.6.1(eslint@9.39.1(jiti@2.6.1))': dependencies: '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1(jiti@2.6.1)) @@ -14504,20 +14591,20 @@ snapshots: '@vitest/pretty-format': 4.0.15 tinyrainbow: 3.0.3 - '@voltagent/a2a-server@1.0.2(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))': + '@voltagent/a2a-server@1.0.2(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))': dependencies: '@a2a-js/sdk': 0.2.5 - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.12 zod: 3.25.76 transitivePeerDependencies: - supports-color - '@voltagent/cli@0.1.16(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@types/node@24.10.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(zod@4.1.13)': + '@voltagent/cli@0.1.16(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@types/node@24.10.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(zod@4.1.13)': dependencies: - '@voltagent/evals': 1.0.4(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(@voltagent/sdk@1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13)) + '@voltagent/evals': 1.0.4(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(@voltagent/sdk@1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13)) '@voltagent/internal': 0.0.12 - '@voltagent/sdk': 1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/sdk': 1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) boxen: 5.1.2 bundle-require: 5.1.0(esbuild@0.25.12) chalk: 4.1.2 @@ -14547,7 +14634,7 @@ snapshots: - supports-color - zod - '@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13)': + '@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13)': dependencies: '@ai-sdk/provider-utils': 3.0.18(zod@4.1.13) '@modelcontextprotocol/sdk': 1.24.3(@cfworker/json-schema@4.1.1)(zod@4.1.13) @@ -14564,7 +14651,7 @@ snapshots: '@opentelemetry/sdk-trace-node': 2.2.0(@opentelemetry/api@1.9.0) '@opentelemetry/semantic-conventions': 1.38.0 '@voltagent/internal': 0.0.12 - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) ts-pattern: 5.9.0 type-fest: 4.41.0 uuid: 9.0.1 @@ -14577,11 +14664,11 @@ snapshots: - '@cfworker/json-schema' - supports-color - '@voltagent/evals@1.0.4(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(@voltagent/sdk@1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))': + '@voltagent/evals@1.0.4(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(@voltagent/sdk@1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))': dependencies: '@voltagent/internal': 0.0.12 - '@voltagent/scorers': 1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(ws@8.18.3)(zod@4.1.13) - '@voltagent/sdk': 1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/scorers': 1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(ws@8.18.3)(zod@4.1.13) + '@voltagent/sdk': 1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal@0.0.11': dependencies: @@ -14591,13 +14678,13 @@ snapshots: dependencies: type-fest: 4.41.0 - '@voltagent/libsql@1.0.13(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))': + '@voltagent/libsql@1.0.13(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))': dependencies: '@libsql/client': 0.15.15 - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.12 '@voltagent/logger': 1.0.4(@opentelemetry/api@1.9.0) - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) transitivePeerDependencies: - bufferutil - utf-8-validate @@ -14615,31 +14702,31 @@ snapshots: - '@opentelemetry/api' - supports-color - '@voltagent/mcp-server@1.0.3(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(zod@4.1.13)': + '@voltagent/mcp-server@1.0.3(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(zod@4.1.13)': dependencies: '@modelcontextprotocol/sdk': 1.24.3(@cfworker/json-schema@4.1.1)(zod@4.1.13) - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.12 zod: 4.1.13 transitivePeerDependencies: - '@cfworker/json-schema' - supports-color - '@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(ws@8.18.3)(zod@4.1.13)': + '@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(ws@8.18.3)(zod@4.1.13)': dependencies: - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.11 autoevals: 0.0.131(ws@8.18.3) zod: 4.1.13 optionalDependencies: - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) transitivePeerDependencies: - encoding - ws - '@voltagent/sdk@1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13)': + '@voltagent/sdk@1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13)': dependencies: - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.12 transitivePeerDependencies: - '@ai-sdk/provider-utils' @@ -14649,12 +14736,12 @@ snapshots: - supports-color - zod - '@voltagent/server-core@1.0.29(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(zod@4.1.13)': + '@voltagent/server-core@1.0.29(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(zod@4.1.13)': dependencies: '@modelcontextprotocol/sdk': 1.24.3(@cfworker/json-schema@4.1.1)(zod@4.1.13) - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.12 - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) jsonwebtoken: 9.0.3 ws: 8.18.3 zod: 4.1.13 @@ -14666,15 +14753,15 @@ snapshots: - supports-color - utf-8-validate - '@voltagent/server-hono@1.2.5(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(zod@4.1.13)': + '@voltagent/server-hono@1.2.5(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(zod@4.1.13)': dependencies: '@hono/node-server': 1.19.6(hono@4.10.7) '@hono/swagger-ui': 0.5.2(hono@4.10.7) - '@voltagent/a2a-server': 1.0.2(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13)) - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/a2a-server': 1.0.2(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13)) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.12 - '@voltagent/mcp-server': 1.0.3(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(zod@4.1.13) - '@voltagent/server-core': 1.0.29(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(zod@4.1.13) + '@voltagent/mcp-server': 1.0.3(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(zod@4.1.13) + '@voltagent/server-core': 1.0.29(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(zod@4.1.13) fetch-to-node: 2.1.0 hono: 4.10.7 openapi3-ts: 4.5.0 @@ -14733,7 +14820,7 @@ snapshots: dependencies: humanize-ms: 1.2.1 - ai@5.0.106(zod@4.1.13): + ai@5.0.107(zod@4.1.13): dependencies: '@ai-sdk/gateway': 2.0.18(zod@4.1.13) '@ai-sdk/provider': 2.0.0 @@ -14909,7 +14996,7 @@ snapshots: dependencies: possible-typed-array-names: 1.1.0 - aws-cdk-lib@2.231.0(constructs@10.4.3): + aws-cdk-lib@2.232.1(constructs@10.4.3): dependencies: '@aws-cdk/asset-awscli-v1': 2.2.242 '@aws-cdk/asset-node-proxy-agent-v6': 2.1.0 @@ -14999,7 +15086,7 @@ snapshots: base64-js@1.5.1: {} - baseline-browser-mapping@2.9.2: {} + baseline-browser-mapping@2.9.3: {} before-after-hook@4.0.0: optional: true @@ -15084,9 +15171,9 @@ snapshots: browserslist@4.28.1: dependencies: - baseline-browser-mapping: 2.9.2 + baseline-browser-mapping: 2.9.3 caniuse-lite: 1.0.30001759 - electron-to-chromium: 1.5.265 + electron-to-chromium: 1.5.266 node-releases: 2.0.27 update-browserslist-db: 1.2.2(browserslist@4.28.1) @@ -15459,6 +15546,8 @@ snapshots: dependencies: ms: 2.1.3 + decamelize@1.2.0: {} + decimal.js@10.6.0: {} decode-named-character-reference@1.2.0: @@ -15574,7 +15663,7 @@ snapshots: ee-first@1.1.1: {} - electron-to-chromium@1.5.265: {} + electron-to-chromium@1.5.266: {} emoji-regex@10.6.0: {} @@ -15943,7 +16032,8 @@ snapshots: eventemitter3@4.0.7: {} - eventemitter3@5.0.1: {} + eventemitter3@5.0.1: + optional: true events-universal@1.0.1: dependencies: @@ -16343,12 +16433,6 @@ snapshots: dependencies: is-glob: 4.0.3 - glob@13.0.0: - dependencies: - minimatch: 10.1.1 - minipass: 7.1.2 - path-scurry: 2.0.1 - global-dirs@3.0.1: dependencies: ini: 2.0.0 @@ -16865,7 +16949,7 @@ snapshots: jsdom@27.2.0: dependencies: '@acemir/cssom': 0.9.26 - '@asamuzakjp/dom-selector': 6.7.5 + '@asamuzakjp/dom-selector': 6.7.6 cssstyle: 5.3.3 data-urls: 6.0.0 decimal.js: 10.6.0 @@ -16967,11 +17051,11 @@ snapshots: known-css-properties@0.30.0: {} - langchain@1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)): + langchain@1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)): dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) - '@langchain/langgraph': 1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) - '@langchain/langgraph-checkpoint': 1.0.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/langgraph': 1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) + '@langchain/langgraph-checkpoint': 1.0.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) langsmith: 0.3.82(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) uuid: 10.0.0 zod: 4.1.13 @@ -16988,15 +17072,15 @@ snapshots: dependencies: mustache: 4.2.0 - langfuse-langchain@3.38.6(langchain@1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))): + langfuse-langchain@3.38.6(langchain@1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))): dependencies: - langchain: 1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) + langchain: 1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) langfuse: 3.38.6 langfuse-core: 3.38.6 - langfuse-vercel@3.38.6(ai@5.0.106(zod@4.1.13)): + langfuse-vercel@3.38.6(ai@5.0.107(zod@4.1.13)): dependencies: - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) langfuse: 3.38.6 langfuse-core: 3.38.6 @@ -17210,7 +17294,7 @@ snapshots: mastra@0.18.6(@mastra/core@0.24.6(openapi-types@12.1.3)(zod@4.1.13))(@opentelemetry/api@1.9.0)(typescript@5.9.3)(zod@4.1.13): dependencies: '@clack/prompts': 0.11.0 - '@expo/devcert': 1.2.0 + '@expo/devcert': 1.2.1 '@mastra/core': 0.24.6(openapi-types@12.1.3)(zod@4.1.13) '@mastra/deployer': 0.24.6(@mastra/core@0.24.6(openapi-types@12.1.3)(zod@4.1.13))(typescript@5.9.3)(zod@4.1.13) '@mastra/loggers': 0.10.19(@mastra/core@0.24.6(openapi-types@12.1.3)(zod@4.1.13)) @@ -17491,8 +17575,6 @@ snapshots: minipass@5.0.0: optional: true - minipass@7.1.2: {} - minizlib@2.1.2: dependencies: minipass: 3.3.6 @@ -17864,11 +17946,6 @@ snapshots: eventemitter3: 4.0.7 p-timeout: 3.2.0 - p-queue@9.0.1: - dependencies: - eventemitter3: 5.0.1 - p-timeout: 7.0.1 - p-retry@4.6.2: dependencies: '@types/retry': 0.12.0 @@ -17882,8 +17959,6 @@ snapshots: dependencies: p-finally: 1.0.0 - p-timeout@7.0.1: {} - package-json@6.5.0: dependencies: got: 14.6.5 @@ -17932,11 +18007,6 @@ snapshots: path-parse@1.0.7: {} - path-scurry@2.0.1: - dependencies: - lru-cache: 11.2.4 - minipass: 7.1.2 - path-to-regexp@0.1.12: {} path-to-regexp@8.3.0: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index a499c596..cdb73753 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -10,6 +10,7 @@ packages: - ./rag/cdk/function - ./agents/agent-mastra - ./agents/agent-sdk + - ./agents/agent-strands - ./agents/agent-voltagent - ./mcp/servers/postgresql-http - ./mcp/servers/weather diff --git a/rag/batch/package.json b/rag/batch/package.json index 14ab6d32..19c02ef3 100644 --- a/rag/batch/package.json +++ b/rag/batch/package.json @@ -17,7 +17,7 @@ "@langchain/aws": "^1.1.0", "@langchain/classic": "^1.0.5", "@langchain/community": "^1.0.7", - "@langchain/core": "^1.1.3", + "@langchain/core": "^1.1.4", "@langchain/langgraph": "^1.0.4", "@langchain/openai": "^1.1.3", "@langchain/pinecone": "^1.0.1", @@ -27,7 +27,7 @@ "dotenv": "^17.2.3", "html-to-text": "^9.0.5", "jsdom": "^27.2.0", - "langchain": "^1.1.4", + "langchain": "^1.1.5", "source-map-support": "^0.5.21" }, "devDependencies": { diff --git a/rag/cdk/package.json b/rag/cdk/package.json index f4511181..ddf86420 100644 --- a/rag/cdk/package.json +++ b/rag/cdk/package.json @@ -37,18 +37,18 @@ }, "dependencies": { "@aws-lambda-powertools/logger": "^2.29.0", - "@aws-sdk/credential-provider-node": "^3.943.0", + "@aws-sdk/credential-provider-node": "^3.946.0", "@langchain/aws": "^1.1.0", - "@langchain/core": "^1.1.3", + "@langchain/core": "^1.1.4", "@langchain/langgraph": "^1.0.4", "@langchain/openai": "^1.1.3", "@langchain/pinecone": "^1.0.1", "@llm-ts-example/common-backend": "workspace:*", "@pinecone-database/pinecone": "^6.1.3", "@smithy/eventstream-codec": "^4.2.5", - "aws-cdk-lib": "^2.231.0", + "aws-cdk-lib": "^2.232.1", "constructs": "^10.4.3", - "langchain": "^1.1.4", + "langchain": "^1.1.5", "langfuse": "^3.38.6", "langfuse-langchain": "^3.38.6", "source-map-support": "^0.5.21", From 2845ee3f68770e4c99711983be787c60de9b0669 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 6 Dec 2025 10:01:53 +0000 Subject: [PATCH 2/3] Bump actions/setup-node from 6.0.0 to 6.1.0 in the actions group Bumps the actions group with 1 update: [actions/setup-node](https://github.com/actions/setup-node). Updates `actions/setup-node` from 6.0.0 to 6.1.0 - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/2028fbc5c25fe9cf00d9f06a71cc4710d4507903...395ad3262231945c25e8478fd5baf05154b1d79f) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- .github/workflows/deploy.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19b95887..80d263fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Use Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 + uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 with: node-version: 'lts/*' check-latest: true diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 95eb3ebe..54c17e21 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -37,7 +37,7 @@ jobs: - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Use Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 + uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 with: node-version: 'lts/*' check-latest: true @@ -95,7 +95,7 @@ jobs: - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Use Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 + uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 with: node-version: 'lts/*' check-latest: true From bd838d2928eeab2b9621806da74cb249a65e70fe Mon Sep 17 00:00:00 2001 From: Kenji Saito Date: Sat, 6 Dec 2025 18:44:01 +0900 Subject: [PATCH 3/3] Add the Strands example --- .github/dependabot.yml | 1 + agents/agent-sdk/package.json | 2 +- agents/agent-strands/.gitignore | 108 +++ agents/agent-strands/bin/cdk.d.ts | 2 + agents/agent-strands/bin/cdk.js | 12 + agents/agent-strands/bin/cdk.ts | 15 + agents/agent-strands/cdk.context.json | 6 + agents/agent-strands/cdk.json | 25 + .../agent-strands-lambda-example.assets.json | 34 + ...agent-strands-lambda-example.template.json | 196 +++++ .../index.mjs | 238 ++++++ .../index.mjs | 238 ++++++ .../index.mjs | 238 ++++++ agents/agent-strands/cdk.out/cdk.out | 1 + agents/agent-strands/cdk.out/manifest.json | 521 +++++++++++++ agents/agent-strands/cdk.out/tree.json | 1 + agents/agent-strands/eslint.config.ts | 73 ++ agents/agent-strands/lambda/agent.d.ts | 5 + agents/agent-strands/lambda/agent.js | 12 + agents/agent-strands/lambda/agent.ts | 14 + agents/agent-strands/lambda/awslambda.d.ts | 24 + agents/agent-strands/lambda/index.d.ts | 7 + agents/agent-strands/lambda/index.js | 21 + agents/agent-strands/lambda/index.ts | 27 + agents/agent-strands/lib/cdk-stack.d.ts | 9 + agents/agent-strands/lib/cdk-stack.js | 64 ++ agents/agent-strands/lib/cdk-stack.ts | 77 ++ agents/agent-strands/package.json | 43 ++ agents/agent-strands/test/index.test.d.ts | 1 + agents/agent-strands/test/index.test.js | 20 + agents/agent-strands/test/index.test.ts | 23 + agents/agent-strands/tsconfig.json | 31 + agents/agent-voltagent/package.json | 2 +- basic/cdk/package.json | 6 +- common/backend/package.json | 2 +- mcp/clients/langgraph-mcp-client/package.json | 6 +- mcp/clients/mastra-mcp-client/tsconfig.json | 3 +- mcp/clients/mcp-client-http/package.json | 2 +- .../mcp-client-typescript/package.json | 2 +- pnpm-lock.yaml | 718 ++++++++++-------- pnpm-workspace.yaml | 1 + rag/batch/package.json | 4 +- rag/cdk/package.json | 8 +- 43 files changed, 2501 insertions(+), 342 deletions(-) create mode 100644 agents/agent-strands/.gitignore create mode 100644 agents/agent-strands/bin/cdk.d.ts create mode 100644 agents/agent-strands/bin/cdk.js create mode 100644 agents/agent-strands/bin/cdk.ts create mode 100644 agents/agent-strands/cdk.context.json create mode 100644 agents/agent-strands/cdk.json create mode 100644 agents/agent-strands/cdk.out/agent-strands-lambda-example.assets.json create mode 100644 agents/agent-strands/cdk.out/agent-strands-lambda-example.template.json create mode 100644 agents/agent-strands/cdk.out/asset.45d1724bd92ced9b013372e2515c63cb4bef12b5bc2c51651008462827d96d45/index.mjs create mode 100644 agents/agent-strands/cdk.out/asset.60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321/index.mjs create mode 100644 agents/agent-strands/cdk.out/asset.716071e6193d8d65285fec67182520a245dc4d4cf966b8c5765ff14412b10546/index.mjs create mode 100644 agents/agent-strands/cdk.out/cdk.out create mode 100644 agents/agent-strands/cdk.out/manifest.json create mode 100644 agents/agent-strands/cdk.out/tree.json create mode 100644 agents/agent-strands/eslint.config.ts create mode 100644 agents/agent-strands/lambda/agent.d.ts create mode 100644 agents/agent-strands/lambda/agent.js create mode 100644 agents/agent-strands/lambda/agent.ts create mode 100644 agents/agent-strands/lambda/awslambda.d.ts create mode 100644 agents/agent-strands/lambda/index.d.ts create mode 100644 agents/agent-strands/lambda/index.js create mode 100644 agents/agent-strands/lambda/index.ts create mode 100644 agents/agent-strands/lib/cdk-stack.d.ts create mode 100644 agents/agent-strands/lib/cdk-stack.js create mode 100644 agents/agent-strands/lib/cdk-stack.ts create mode 100644 agents/agent-strands/package.json create mode 100644 agents/agent-strands/test/index.test.d.ts create mode 100644 agents/agent-strands/test/index.test.js create mode 100644 agents/agent-strands/test/index.test.ts create mode 100644 agents/agent-strands/tsconfig.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5b83d7af..00aecf6e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -25,6 +25,7 @@ updates: - '/agents/agent-mastra/' - '/agents/agent-voltagent/' - '/agents/agent-sdk/' + - '/agents/agent-strands/' - '/basic/cdk/' - '/basic/app/' - '/mcp/clients/langgraph-mcp-client/' diff --git a/agents/agent-sdk/package.json b/agents/agent-sdk/package.json index b7740380..cee6b0fe 100644 --- a/agents/agent-sdk/package.json +++ b/agents/agent-sdk/package.json @@ -34,7 +34,7 @@ "vitest": "^4.0.15" }, "dependencies": { - "@anthropic-ai/claude-agent-sdk": "^0.1.59", + "@anthropic-ai/claude-agent-sdk": "^0.1.60", "source-map-support": "^0.5.21", "uuid": "^13.0.0", "zod": "^4.1.13" diff --git a/agents/agent-strands/.gitignore b/agents/agent-strands/.gitignore new file mode 100644 index 00000000..6cb1ff98 --- /dev/null +++ b/agents/agent-strands/.gitignore @@ -0,0 +1,108 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +# dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and *not* Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port +.DS_Store + +eslint.config.js +eslint.config.d.ts diff --git a/agents/agent-strands/bin/cdk.d.ts b/agents/agent-strands/bin/cdk.d.ts new file mode 100644 index 00000000..b7988016 --- /dev/null +++ b/agents/agent-strands/bin/cdk.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/agents/agent-strands/bin/cdk.js b/agents/agent-strands/bin/cdk.js new file mode 100644 index 00000000..62b8a152 --- /dev/null +++ b/agents/agent-strands/bin/cdk.js @@ -0,0 +1,12 @@ +#!/usr/bin/env node +import * as cdk from 'aws-cdk-lib'; +import { CloudfrontCdnTemplateStack, } from '../lib/cdk-stack.js'; +const app = new cdk.App(); +new CloudfrontCdnTemplateStack(app, 'agent-strands-lambda-example', { + appName: 'agent-strands-lambda-example', + env: { + account: app.account, + region: app.region, + }, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2RrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY2RrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxPQUFPLEtBQUssR0FBRyxNQUFNLGFBQWEsQ0FBQztBQUNuQyxPQUFPLEVBQ0wsMEJBQTBCLEdBQzNCLE1BQU0scUJBQXFCLENBQUM7QUFFN0IsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsSUFBSSwwQkFBMEIsQ0FBQyxHQUFHLEVBQUUsOEJBQThCLEVBQUU7SUFDbEUsT0FBTyxFQUFFLDhCQUE4QjtJQUN2QyxHQUFHLEVBQUU7UUFDSCxPQUFPLEVBQUUsR0FBRyxDQUFDLE9BQU87UUFDcEIsTUFBTSxFQUFFLEdBQUcsQ0FBQyxNQUFNO0tBQ25CO0NBQ0YsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiIyEvdXNyL2Jpbi9lbnYgbm9kZVxuaW1wb3J0ICogYXMgY2RrIGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCB7XG4gIENsb3VkZnJvbnRDZG5UZW1wbGF0ZVN0YWNrLFxufSBmcm9tICcuLi9saWIvY2RrLXN0YWNrLmpzJztcblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcblxubmV3IENsb3VkZnJvbnRDZG5UZW1wbGF0ZVN0YWNrKGFwcCwgJ2FnZW50LXN0cmFuZHMtbGFtYmRhLWV4YW1wbGUnLCB7XG4gIGFwcE5hbWU6ICdhZ2VudC1zdHJhbmRzLWxhbWJkYS1leGFtcGxlJyxcbiAgZW52OiB7XG4gICAgYWNjb3VudDogYXBwLmFjY291bnQsXG4gICAgcmVnaW9uOiBhcHAucmVnaW9uLFxuICB9LFxufSk7XG4iXX0= \ No newline at end of file diff --git a/agents/agent-strands/bin/cdk.ts b/agents/agent-strands/bin/cdk.ts new file mode 100644 index 00000000..8e038a02 --- /dev/null +++ b/agents/agent-strands/bin/cdk.ts @@ -0,0 +1,15 @@ +#!/usr/bin/env node +import * as cdk from 'aws-cdk-lib'; +import { + CloudfrontCdnTemplateStack, +} from '../lib/cdk-stack.js'; + +const app = new cdk.App(); + +new CloudfrontCdnTemplateStack(app, 'agent-strands-lambda-example', { + appName: 'agent-strands-lambda-example', + env: { + account: app.account, + region: app.region, + }, +}); diff --git a/agents/agent-strands/cdk.context.json b/agents/agent-strands/cdk.context.json new file mode 100644 index 00000000..57652ec2 --- /dev/null +++ b/agents/agent-strands/cdk.context.json @@ -0,0 +1,6 @@ +{ + "acknowledged-issue-numbers": [ + 34892 + ], + "cli-telemetry": false +} diff --git a/agents/agent-strands/cdk.json b/agents/agent-strands/cdk.json new file mode 100644 index 00000000..80477505 --- /dev/null +++ b/agents/agent-strands/cdk.json @@ -0,0 +1,25 @@ +{ + "app": "pnpm dlx tsx bin/cdk.ts", + "watch": { + "include": [ + "**" + ], + "exclude": [ + "README.md", + "cdk*.json", + "**/*.d.ts", + "**/*.js", + "tsconfig.json", + "package*.json", + "yarn.lock", + "node_modules", + "test", + "eslint.config.mjs" + ] + }, + "requireApproval": "never", + "versionReporting": false, + "pathMetadata": false, + "context": { + } +} diff --git a/agents/agent-strands/cdk.out/agent-strands-lambda-example.assets.json b/agents/agent-strands/cdk.out/agent-strands-lambda-example.assets.json new file mode 100644 index 00000000..5303b5c8 --- /dev/null +++ b/agents/agent-strands/cdk.out/agent-strands-lambda-example.assets.json @@ -0,0 +1,34 @@ +{ + "version": "48.0.0", + "files": { + "60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321": { + "displayName": "Lambda/Code", + "source": { + "path": "asset.60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region-956ec07c": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "3f8dbdc3ac62bea8df0a326a27741714ed2c72c72c4f444c3c879792383f5078": { + "displayName": "agent-strands-lambda-example Template", + "source": { + "path": "agent-strands-lambda-example.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region-e082d771": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "3f8dbdc3ac62bea8df0a326a27741714ed2c72c72c4f444c3c879792383f5078.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/agents/agent-strands/cdk.out/agent-strands-lambda-example.template.json b/agents/agent-strands/cdk.out/agent-strands-lambda-example.template.json new file mode 100644 index 00000000..d7e9011d --- /dev/null +++ b/agents/agent-strands/cdk.out/agent-strands-lambda-example.template.json @@ -0,0 +1,196 @@ +{ + "Resources": { + "ApolloLambdaFunctionLogGroup34540FC6": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/agent-strands-lambda-example", + "RetentionInDays": 1 + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "ApolloLambdaFunctionExecutionRole85D9D1FB": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/AWSLambdaExecute" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/CloudFrontReadOnlyAccess" + ] + ] + } + ], + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "bedrock:InvokeModel*", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "bedrock-policy" + } + ] + } + }, + "LambdaD247545B": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Architectures": [ + "arm64" + ], + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321.zip" + }, + "FunctionName": "agent-strands-lambda-example", + "Handler": "index.handler", + "LoggingConfig": { + "ApplicationLogLevel": "TRACE", + "LogFormat": "JSON" + }, + "MemorySize": 256, + "Role": { + "Fn::GetAtt": [ + "ApolloLambdaFunctionExecutionRole85D9D1FB", + "Arn" + ] + }, + "Runtime": "nodejs24.x", + "Timeout": 60 + }, + "DependsOn": [ + "ApolloLambdaFunctionExecutionRole85D9D1FB" + ], + "Metadata": { + "aws:asset:path": "asset.60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321", + "aws:asset:is-bundled": true, + "aws:asset:property": "Code" + } + }, + "LambdaEventInvokeConfig9A47C8EE": { + "Type": "AWS::Lambda::EventInvokeConfig", + "Properties": { + "FunctionName": { + "Ref": "LambdaD247545B" + }, + "MaximumRetryAttempts": 0, + "Qualifier": "$LATEST" + } + }, + "LambdainvokefunctionurlECBD6AC0": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunctionUrl", + "FunctionName": { + "Fn::GetAtt": [ + "LambdaD247545B", + "Arn" + ] + }, + "FunctionUrlAuthType": "NONE", + "Principal": "*" + } + }, + "LambdainvokefunctionCF40E9E5": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "LambdaD247545B", + "Arn" + ] + }, + "InvokedViaFunctionUrl": true, + "Principal": "*" + } + }, + "LambdaFunctionUrl62966E86": { + "Type": "AWS::Lambda::Url", + "Properties": { + "AuthType": "NONE", + "InvokeMode": "RESPONSE_STREAM", + "TargetFunctionArn": { + "Fn::GetAtt": [ + "LambdaD247545B", + "Arn" + ] + } + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/agents/agent-strands/cdk.out/asset.45d1724bd92ced9b013372e2515c63cb4bef12b5bc2c51651008462827d96d45/index.mjs b/agents/agent-strands/cdk.out/asset.45d1724bd92ced9b013372e2515c63cb4bef12b5bc2c51651008462827d96d45/index.mjs new file mode 100644 index 00000000..89fd0651 --- /dev/null +++ b/agents/agent-strands/cdk.out/asset.45d1724bd92ced9b013372e2515c63cb4bef12b5bc2c51651008462827d96d45/index.mjs @@ -0,0 +1,238 @@ +import { createRequire } from 'module';const require = createRequire(import.meta.url); +var FU=Object.create;var zb=Object.defineProperty;var BU=Object.getOwnPropertyDescriptor;var ZU=Object.getOwnPropertyNames;var qU=Object.getPrototypeOf,VU=Object.prototype.hasOwnProperty;var P=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),gi=(t,e)=>{for(var r in e)zb(t,r,{get:e[r],enumerable:!0})},GU=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ZU(e))!VU.call(t,o)&&o!==r&&zb(t,o,{get:()=>e[o],enumerable:!(n=BU(e,o))||n.enumerable});return t};var mn=(t,e,r)=>(r=t!=null?FU(qU(t)):{},GU(e||!t||!t.__esModule?zb(r,"default",{value:t,enumerable:!0}):r,t));var Xb=P((Kl,lc)=>{var JU=200,GT="__lodash_hash_undefined__",XU=800,YU=16,KT=9007199254740991,HT="[object Arguments]",QU="[object Array]",e4="[object AsyncFunction]",t4="[object Boolean]",r4="[object Date]",n4="[object Error]",WT="[object Function]",o4="[object GeneratorFunction]",i4="[object Map]",s4="[object Number]",a4="[object Null]",JT="[object Object]",c4="[object Proxy]",u4="[object RegExp]",l4="[object Set]",d4="[object String]",p4="[object Undefined]",f4="[object WeakMap]",m4="[object ArrayBuffer]",h4="[object DataView]",g4="[object Float32Array]",_4="[object Float64Array]",y4="[object Int8Array]",v4="[object Int16Array]",b4="[object Int32Array]",w4="[object Uint8Array]",x4="[object Uint8ClampedArray]",$4="[object Uint16Array]",I4="[object Uint32Array]",S4=/[\\^$.*+?()[\]{}|]/g,k4=/^\[object .+?Constructor\]$/,T4=/^(?:0|[1-9]\d*)$/,st={};st[g4]=st[_4]=st[y4]=st[v4]=st[b4]=st[w4]=st[x4]=st[$4]=st[I4]=!0;st[HT]=st[QU]=st[m4]=st[t4]=st[h4]=st[r4]=st[n4]=st[WT]=st[i4]=st[s4]=st[JT]=st[u4]=st[l4]=st[d4]=st[f4]=!1;var XT=typeof global=="object"&&global&&global.Object===Object&&global,E4=typeof self=="object"&&self&&self.Object===Object&&self,Jl=XT||E4||Function("return this")(),YT=typeof Kl=="object"&&Kl&&!Kl.nodeType&&Kl,Hl=YT&&typeof lc=="object"&&lc&&!lc.nodeType&&lc,QT=Hl&&Hl.exports===YT,Fb=QT&&XT.process,jT=(function(){try{var t=Hl&&Hl.require&&Hl.require("util").types;return t||Fb&&Fb.binding&&Fb.binding("util")}catch{}})(),DT=jT&&jT.isTypedArray;function A4(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function O4(t,e){for(var r=-1,n=Array(t);++r-1}function Y4(t,e){var r=this.__data__,n=pm(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}jo.prototype.clear=H4;jo.prototype.delete=W4;jo.prototype.get=J4;jo.prototype.has=X4;jo.prototype.set=Y4;function dc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(i=t.length>3&&typeof i=="function"?(o--,i):void 0,s&&T2(r[0],r[1],s)&&(i=o<3?void 0:i,o=1),e=Object(e);++n-1&&t%1==0&&t0){if(++e>=XU)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function z2(t){if(t!=null){try{return dm.call(t)}catch{}try{return t+""}catch{}}return""}function hm(t,e){return t===e||t!==t&&e!==e}var Vb=VT((function(){return arguments})())?VT:function(t){return Xl(t)&&Mo.call(t,"callee")&&!D4.call(t,"callee")},Gb=Array.isArray;function Wb(t){return t!=null&&aE(t.length)&&!Jb(t)}function M2(t){return Xl(t)&&Wb(t)}var sE=U4||F2;function Jb(t){if(!Ps(t))return!1;var e=fm(t);return e==WT||e==o4||e==e4||e==c4}function aE(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=KT}function Ps(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Xl(t){return t!=null&&typeof t=="object"}function j2(t){if(!Xl(t)||fm(t)!=JT)return!1;var e=tE(t);if(e===null)return!0;var r=Mo.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&dm.call(r)==M4}var cE=DT?P4(DT):f2;function D2(t){return x2(t,uE(t))}function uE(t){return Wb(t)?u2(t,!0):m2(t)}var L2=$2(function(t,e,r){nE(t,e,r)});function U2(t){return function(){return t}}function lE(t){return t}function F2(){return!1}lc.exports=L2});var xA=P((_de,wA)=>{"use strict";wA.exports=function(t,e){if(typeof t!="string")throw new TypeError("Expected a string");return e=typeof e>"u"?"_":e,t.replace(/([a-z\d])([A-Z])/g,"$1"+e+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+e+"$2").toLowerCase()}});var AA=P((yde,Zw)=>{"use strict";var dB=/[\p{Lu}]/u,pB=/[\p{Ll}]/u,$A=/^[\p{Lu}](?![\p{Lu}])/gu,kA=/([\p{Alpha}\p{N}_]|$)/u,TA=/[_.\- ]+/,fB=new RegExp("^"+TA.source),IA=new RegExp(TA.source+kA.source,"gu"),SA=new RegExp("\\d+"+kA.source,"gu"),mB=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let s=0;s($A.lastIndex=0,t.replace($A,r=>e(r))),gB=(t,e)=>(IA.lastIndex=0,SA.lastIndex=0,t.replace(IA,(r,n)=>e(n)).replace(SA,r=>e(r))),EA=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(t)?t=t.map(i=>i.trim()).filter(i=>i.length).join("-"):t=t.trim(),t.length===0)return"";let r=e.locale===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(e.locale),n=e.locale===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(e.locale);return t.length===1?e.pascalCase?n(t):r(t):(t!==r(t)&&(t=mB(t,r,n)),t=t.replace(fB,""),e.preserveConsecutiveUppercase?t=hB(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),gB(t,n))};Zw.exports=EA;Zw.exports.default=EA});var cP=P((ime,Ix)=>{"use strict";var v6=Object.prototype.hasOwnProperty,hr="~";function Cd(){}Object.create&&(Cd.prototype=Object.create(null),new Cd().__proto__||(hr=!1));function b6(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function aP(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new b6(r,n||t,o),s=hr?hr+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],i]:t._events[s].push(i):(t._events[s]=i,t._eventsCount++),t}function wh(t,e){--t._eventsCount===0?t._events=new Cd:delete t._events[e]}function tr(){this._events=new Cd,this._eventsCount=0}tr.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)v6.call(r,n)&&e.push(hr?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};tr.prototype.listeners=function(e){var r=hr?hr+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,s=new Array(i);o{"use strict";uP.exports=(t,e)=>(e=e||(()=>{}),t.then(r=>new Promise(n=>{n(e())}).then(()=>r),r=>new Promise(n=>{n(e())}).then(()=>{throw r})))});var pP=P((ame,$h)=>{"use strict";var w6=lP(),xh=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},dP=(t,e,r)=>new Promise((n,o)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){n(t);return}let i=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(c){o(c)}return}let s=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,a=r instanceof Error?r:new xh(s);typeof t.cancel=="function"&&t.cancel(),o(a)},e);w6(t.then(n,o),()=>{clearTimeout(i)})});$h.exports=dP;$h.exports.default=dP;$h.exports.TimeoutError=xh});var fP=P(Sx=>{"use strict";Object.defineProperty(Sx,"__esModule",{value:!0});function x6(t,e,r){let n=0,o=t.length;for(;o>0;){let i=o/2|0,s=n+i;r(t[s],e)<=0?(n=++s,o-=i+1):o=i}return n}Sx.default=x6});var mP=P(Tx=>{"use strict";Object.defineProperty(Tx,"__esModule",{value:!0});var $6=fP(),kx=class{constructor(){this._queue=[]}enqueue(e,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let o=$6.default(this._queue,n,(i,s)=>s.priority-i.priority);this._queue.splice(o,0,n)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this._queue.length}};Tx.default=kx});var Sh=P(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:!0});var I6=cP(),hP=pP(),S6=mP(),Ih=()=>{},k6=new hP.TimeoutError,Ex=class extends I6{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Ih,this._resolveIdle=Ih,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:S6.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(i=(o=e.interval)===null||o===void 0?void 0:o.toString())!==null&&i!==void 0?i:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||e.interval===0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=e.throwOnTimeout===!0,this._isPaused=e.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),e&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,r={}){return new Promise((n,o)=>{let i=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&r.timeout===void 0?e():hP.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(k6)});n(await s)}catch(s){o(s)}this._next()};this._queue.enqueue(i,r),this._tryToStartAnother(),this.emit("add")})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(e=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}};Ax.default=Ex});var Nd=P((mme,gP)=>{"use strict";var E6="2.0.0",A6=Number.MAX_SAFE_INTEGER||9007199254740991,O6=16,P6=250,C6=["major","premajor","minor","preminor","patch","prepatch","prerelease"];gP.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:O6,MAX_SAFE_BUILD_LENGTH:P6,MAX_SAFE_INTEGER:A6,RELEASE_TYPES:C6,SEMVER_SPEC_VERSION:E6,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var zd=P((hme,_P)=>{"use strict";var R6=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};_P.exports=R6});var lu=P((fo,yP)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Cx,MAX_SAFE_BUILD_LENGTH:N6,MAX_LENGTH:z6}=Nd(),M6=zd();fo=yP.exports={};var j6=fo.re=[],D6=fo.safeRe=[],X=fo.src=[],L6=fo.safeSrc=[],Y=fo.t={},U6=0,Rx="[a-zA-Z0-9-]",F6=[["\\s",1],["\\d",z6],[Rx,N6]],B6=t=>{for(let[e,r]of F6)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Ie=(t,e,r)=>{let n=B6(e),o=U6++;M6(t,o,e),Y[t]=o,X[o]=e,L6[o]=n,j6[o]=new RegExp(e,r?"g":void 0),D6[o]=new RegExp(n,r?"g":void 0)};Ie("NUMERICIDENTIFIER","0|[1-9]\\d*");Ie("NUMERICIDENTIFIERLOOSE","\\d+");Ie("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Rx}*`);Ie("MAINVERSION",`(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})`);Ie("MAINVERSIONLOOSE",`(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})`);Ie("PRERELEASEIDENTIFIER",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIER]})`);Ie("PRERELEASEIDENTIFIERLOOSE",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIERLOOSE]})`);Ie("PRERELEASE",`(?:-(${X[Y.PRERELEASEIDENTIFIER]}(?:\\.${X[Y.PRERELEASEIDENTIFIER]})*))`);Ie("PRERELEASELOOSE",`(?:-?(${X[Y.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${X[Y.PRERELEASEIDENTIFIERLOOSE]})*))`);Ie("BUILDIDENTIFIER",`${Rx}+`);Ie("BUILD",`(?:\\+(${X[Y.BUILDIDENTIFIER]}(?:\\.${X[Y.BUILDIDENTIFIER]})*))`);Ie("FULLPLAIN",`v?${X[Y.MAINVERSION]}${X[Y.PRERELEASE]}?${X[Y.BUILD]}?`);Ie("FULL",`^${X[Y.FULLPLAIN]}$`);Ie("LOOSEPLAIN",`[v=\\s]*${X[Y.MAINVERSIONLOOSE]}${X[Y.PRERELEASELOOSE]}?${X[Y.BUILD]}?`);Ie("LOOSE",`^${X[Y.LOOSEPLAIN]}$`);Ie("GTLT","((?:<|>)?=?)");Ie("XRANGEIDENTIFIERLOOSE",`${X[Y.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Ie("XRANGEIDENTIFIER",`${X[Y.NUMERICIDENTIFIER]}|x|X|\\*`);Ie("XRANGEPLAIN",`[v=\\s]*(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:${X[Y.PRERELEASE]})?${X[Y.BUILD]}?)?)?`);Ie("XRANGEPLAINLOOSE",`[v=\\s]*(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:${X[Y.PRERELEASELOOSE]})?${X[Y.BUILD]}?)?)?`);Ie("XRANGE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAIN]}$`);Ie("XRANGELOOSE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAINLOOSE]}$`);Ie("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Cx}})(?:\\.(\\d{1,${Cx}}))?(?:\\.(\\d{1,${Cx}}))?`);Ie("COERCE",`${X[Y.COERCEPLAIN]}(?:$|[^\\d])`);Ie("COERCEFULL",X[Y.COERCEPLAIN]+`(?:${X[Y.PRERELEASE]})?(?:${X[Y.BUILD]})?(?:$|[^\\d])`);Ie("COERCERTL",X[Y.COERCE],!0);Ie("COERCERTLFULL",X[Y.COERCEFULL],!0);Ie("LONETILDE","(?:~>?)");Ie("TILDETRIM",`(\\s*)${X[Y.LONETILDE]}\\s+`,!0);fo.tildeTrimReplace="$1~";Ie("TILDE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAIN]}$`);Ie("TILDELOOSE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAINLOOSE]}$`);Ie("LONECARET","(?:\\^)");Ie("CARETTRIM",`(\\s*)${X[Y.LONECARET]}\\s+`,!0);fo.caretTrimReplace="$1^";Ie("CARET",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAIN]}$`);Ie("CARETLOOSE",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAINLOOSE]}$`);Ie("COMPARATORLOOSE",`^${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]})$|^$`);Ie("COMPARATOR",`^${X[Y.GTLT]}\\s*(${X[Y.FULLPLAIN]})$|^$`);Ie("COMPARATORTRIM",`(\\s*)${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]}|${X[Y.XRANGEPLAIN]})`,!0);fo.comparatorTrimReplace="$1$2$3";Ie("HYPHENRANGE",`^\\s*(${X[Y.XRANGEPLAIN]})\\s+-\\s+(${X[Y.XRANGEPLAIN]})\\s*$`);Ie("HYPHENRANGELOOSE",`^\\s*(${X[Y.XRANGEPLAINLOOSE]})\\s+-\\s+(${X[Y.XRANGEPLAINLOOSE]})\\s*$`);Ie("STAR","(<|>)?=?\\s*\\*");Ie("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Ie("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Th=P((gme,vP)=>{"use strict";var Z6=Object.freeze({loose:!0}),q6=Object.freeze({}),V6=t=>t?typeof t!="object"?Z6:t:q6;vP.exports=V6});var Nx=P((_me,xP)=>{"use strict";var bP=/^[0-9]+$/,wP=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:twP(e,t);xP.exports={compareIdentifiers:wP,rcompareIdentifiers:G6}});var rr=P((yme,IP)=>{"use strict";var Eh=zd(),{MAX_LENGTH:$P,MAX_SAFE_INTEGER:Ah}=Nd(),{safeRe:Oh,t:Ph}=lu(),K6=Th(),{compareIdentifiers:zx}=Nx(),Mx=class t{constructor(e,r){if(r=K6(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>$P)throw new TypeError(`version is longer than ${$P} characters`);Eh("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Oh[Ph.LOOSE]:Oh[Ph.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Ah||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ah||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ah||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let i=+o;if(i>=0&&ie.major?1:this.minore.minor?1:this.patche.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(Eh("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return zx(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(Eh("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return zx(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?Oh[Ph.PRERELEASELOOSE]:Oh[Ph.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let i=[r,o];n===!1&&(i=[r]),zx(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};IP.exports=Mx});var pa=P((vme,kP)=>{"use strict";var SP=rr(),H6=(t,e,r=!1)=>{if(t instanceof SP)return t;try{return new SP(t,e)}catch(n){if(!r)return null;throw n}};kP.exports=H6});var EP=P((bme,TP)=>{"use strict";var W6=pa(),J6=(t,e)=>{let r=W6(t,e);return r?r.version:null};TP.exports=J6});var OP=P((wme,AP)=>{"use strict";var X6=pa(),Y6=(t,e)=>{let r=X6(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};AP.exports=Y6});var RP=P((xme,CP)=>{"use strict";var PP=rr(),Q6=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new PP(t instanceof PP?t.version:t,r).inc(e,n,o).version}catch{return null}};CP.exports=Q6});var MP=P(($me,zP)=>{"use strict";var NP=pa(),eZ=(t,e)=>{let r=NP(t,null,!0),n=NP(e,null,!0),o=r.compare(n);if(o===0)return null;let i=o>0,s=i?r:n,a=i?n:r,c=!!s.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0)return a.minor&&!a.patch?"minor":"patch"}let l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};zP.exports=eZ});var DP=P((Ime,jP)=>{"use strict";var tZ=rr(),rZ=(t,e)=>new tZ(t,e).major;jP.exports=rZ});var UP=P((Sme,LP)=>{"use strict";var nZ=rr(),oZ=(t,e)=>new nZ(t,e).minor;LP.exports=oZ});var BP=P((kme,FP)=>{"use strict";var iZ=rr(),sZ=(t,e)=>new iZ(t,e).patch;FP.exports=sZ});var qP=P((Tme,ZP)=>{"use strict";var aZ=pa(),cZ=(t,e)=>{let r=aZ(t,e);return r&&r.prerelease.length?r.prerelease:null};ZP.exports=cZ});var gn=P((Eme,GP)=>{"use strict";var VP=rr(),uZ=(t,e,r)=>new VP(t,r).compare(new VP(e,r));GP.exports=uZ});var HP=P((Ame,KP)=>{"use strict";var lZ=gn(),dZ=(t,e,r)=>lZ(e,t,r);KP.exports=dZ});var JP=P((Ome,WP)=>{"use strict";var pZ=gn(),fZ=(t,e)=>pZ(t,e,!0);WP.exports=fZ});var Ch=P((Pme,YP)=>{"use strict";var XP=rr(),mZ=(t,e,r)=>{let n=new XP(t,r),o=new XP(e,r);return n.compare(o)||n.compareBuild(o)};YP.exports=mZ});var eC=P((Cme,QP)=>{"use strict";var hZ=Ch(),gZ=(t,e)=>t.sort((r,n)=>hZ(r,n,e));QP.exports=gZ});var rC=P((Rme,tC)=>{"use strict";var _Z=Ch(),yZ=(t,e)=>t.sort((r,n)=>_Z(n,r,e));tC.exports=yZ});var Md=P((Nme,nC)=>{"use strict";var vZ=gn(),bZ=(t,e,r)=>vZ(t,e,r)>0;nC.exports=bZ});var Rh=P((zme,oC)=>{"use strict";var wZ=gn(),xZ=(t,e,r)=>wZ(t,e,r)<0;oC.exports=xZ});var jx=P((Mme,iC)=>{"use strict";var $Z=gn(),IZ=(t,e,r)=>$Z(t,e,r)===0;iC.exports=IZ});var Dx=P((jme,sC)=>{"use strict";var SZ=gn(),kZ=(t,e,r)=>SZ(t,e,r)!==0;sC.exports=kZ});var Nh=P((Dme,aC)=>{"use strict";var TZ=gn(),EZ=(t,e,r)=>TZ(t,e,r)>=0;aC.exports=EZ});var zh=P((Lme,cC)=>{"use strict";var AZ=gn(),OZ=(t,e,r)=>AZ(t,e,r)<=0;cC.exports=OZ});var Lx=P((Ume,uC)=>{"use strict";var PZ=jx(),CZ=Dx(),RZ=Md(),NZ=Nh(),zZ=Rh(),MZ=zh(),jZ=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return PZ(t,r,n);case"!=":return CZ(t,r,n);case">":return RZ(t,r,n);case">=":return NZ(t,r,n);case"<":return zZ(t,r,n);case"<=":return MZ(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};uC.exports=jZ});var dC=P((Fme,lC)=>{"use strict";var DZ=rr(),LZ=pa(),{safeRe:Mh,t:jh}=lu(),UZ=(t,e)=>{if(t instanceof DZ)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Mh[jh.COERCEFULL]:Mh[jh.COERCE]);else{let c=e.includePrerelease?Mh[jh.COERCERTLFULL]:Mh[jh.COERCERTL],u;for(;(u=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",i=r[4]||"0",s=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return LZ(`${n}.${o}.${i}${s}${a}`,e)};lC.exports=UZ});var fC=P((Bme,pC)=>{"use strict";var Ux=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};pC.exports=Ux});var _n=P((Zme,_C)=>{"use strict";var FZ=/\s+/g,Fx=class t{constructor(e,r){if(r=ZZ(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Bx)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(FZ," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(o=>!hC(o[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&JZ(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&HZ)|(this.options.loose&&WZ))+":"+e,o=mC.get(n);if(o)return o;let i=this.options.loose,s=i?gr[nr.HYPHENRANGELOOSE]:gr[nr.HYPHENRANGE];e=e.replace(s,s9(this.options.includePrerelease)),at("hyphen replace",e),e=e.replace(gr[nr.COMPARATORTRIM],VZ),at("comparator trim",e),e=e.replace(gr[nr.TILDETRIM],GZ),at("tilde trim",e),e=e.replace(gr[nr.CARETTRIM],KZ),at("caret trim",e);let a=e.split(" ").map(d=>XZ(d,this.options)).join(" ").split(/\s+/).map(d=>i9(d,this.options));i&&(a=a.filter(d=>(at("loose invalid filter",d,this.options),!!d.match(gr[nr.COMPARATORLOOSE])))),at("range list",a);let c=new Map,u=a.map(d=>new Bx(d,this.options));for(let d of u){if(hC(d))return[d];c.set(d.value,d)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return mC.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>gC(n,r)&&e.set.some(o=>gC(o,r)&&n.every(i=>o.every(s=>i.intersects(s,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new qZ(e,this.options)}catch{return!1}for(let r=0;rt.value==="<0.0.0-0",JZ=t=>t.value==="",gC=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(i=>o.intersects(i,e)),o=n.pop();return r},XZ=(t,e)=>(t=t.replace(gr[nr.BUILD],""),at("comp",t,e),t=e9(t,e),at("caret",t),t=YZ(t,e),at("tildes",t),t=r9(t,e),at("xrange",t),t=o9(t,e),at("stars",t),t),_r=t=>!t||t.toLowerCase()==="x"||t==="*",YZ=(t,e)=>t.trim().split(/\s+/).map(r=>QZ(r,e)).join(" "),QZ=(t,e)=>{let r=e.loose?gr[nr.TILDELOOSE]:gr[nr.TILDE];return t.replace(r,(n,o,i,s,a)=>{at("tilde",t,n,o,i,s,a);let c;return _r(o)?c="":_r(i)?c=`>=${o}.0.0 <${+o+1}.0.0-0`:_r(s)?c=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:a?(at("replaceTilde pr",a),c=`>=${o}.${i}.${s}-${a} <${o}.${+i+1}.0-0`):c=`>=${o}.${i}.${s} <${o}.${+i+1}.0-0`,at("tilde return",c),c})},e9=(t,e)=>t.trim().split(/\s+/).map(r=>t9(r,e)).join(" "),t9=(t,e)=>{at("caret",t,e);let r=e.loose?gr[nr.CARETLOOSE]:gr[nr.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,s,a,c)=>{at("caret",t,o,i,s,a,c);let u;return _r(i)?u="":_r(s)?u=`>=${i}.0.0${n} <${+i+1}.0.0-0`:_r(a)?i==="0"?u=`>=${i}.${s}.0${n} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.0${n} <${+i+1}.0.0-0`:c?(at("replaceCaret pr",c),i==="0"?s==="0"?u=`>=${i}.${s}.${a}-${c} <${i}.${s}.${+a+1}-0`:u=`>=${i}.${s}.${a}-${c} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.${a}-${c} <${+i+1}.0.0-0`):(at("no pr"),i==="0"?s==="0"?u=`>=${i}.${s}.${a}${n} <${i}.${s}.${+a+1}-0`:u=`>=${i}.${s}.${a}${n} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.${a} <${+i+1}.0.0-0`),at("caret return",u),u})},r9=(t,e)=>(at("replaceXRanges",t,e),t.split(/\s+/).map(r=>n9(r,e)).join(" ")),n9=(t,e)=>{t=t.trim();let r=e.loose?gr[nr.XRANGELOOSE]:gr[nr.XRANGE];return t.replace(r,(n,o,i,s,a,c)=>{at("xRange",t,n,o,i,s,a,c);let u=_r(i),l=u||_r(s),d=l||_r(a),f=d;return o==="="&&f&&(o=""),c=e.includePrerelease?"-0":"",u?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&f?(l&&(s=0),a=0,o===">"?(o=">=",l?(i=+i+1,s=0,a=0):(s=+s+1,a=0)):o==="<="&&(o="<",l?i=+i+1:s=+s+1),o==="<"&&(c="-0"),n=`${o+i}.${s}.${a}${c}`):l?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${s}.0${c} <${i}.${+s+1}.0-0`),at("xRange return",n),n})},o9=(t,e)=>(at("replaceStars",t,e),t.trim().replace(gr[nr.STAR],"")),i9=(t,e)=>(at("replaceGTE0",t,e),t.trim().replace(gr[e.includePrerelease?nr.GTE0PRE:nr.GTE0],"")),s9=t=>(e,r,n,o,i,s,a,c,u,l,d,f)=>(_r(n)?r="":_r(o)?r=`>=${n}.0.0${t?"-0":""}`:_r(i)?r=`>=${n}.${o}.0${t?"-0":""}`:s?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,_r(u)?c="":_r(l)?c=`<${+u+1}.0.0-0`:_r(d)?c=`<${u}.${+l+1}.0-0`:f?c=`<=${u}.${l}.${d}-${f}`:t?c=`<${u}.${l}.${+d+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),a9=(t,e,r)=>{for(let n=0;n0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var jd=P((qme,$C)=>{"use strict";var Dd=Symbol("SemVer ANY"),Vx=class t{static get ANY(){return Dd}constructor(e,r){if(r=yC(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),qx("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Dd?this.value="":this.value=this.operator+this.semver.version,qx("comp",this)}parse(e){let r=this.options.loose?vC[bC.COMPARATORLOOSE]:vC[bC.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new wC(n[2],this.options.loose):this.semver=Dd}toString(){return this.value}test(e){if(qx("Comparator.test",e,this.options.loose),this.semver===Dd||e===Dd)return!0;if(typeof e=="string")try{e=new wC(e,this.options)}catch{return!1}return Zx(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new xC(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new xC(this.value,r).test(e.semver):(r=yC(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Zx(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Zx(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};$C.exports=Vx;var yC=Th(),{safeRe:vC,t:bC}=lu(),Zx=Lx(),qx=zd(),wC=rr(),xC=_n()});var Ld=P((Vme,IC)=>{"use strict";var c9=_n(),u9=(t,e,r)=>{try{e=new c9(e,r)}catch{return!1}return e.test(t)};IC.exports=u9});var kC=P((Gme,SC)=>{"use strict";var l9=_n(),d9=(t,e)=>new l9(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));SC.exports=d9});var EC=P((Kme,TC)=>{"use strict";var p9=rr(),f9=_n(),m9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new f9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===-1)&&(n=s,o=new p9(n,r))}),n};TC.exports=m9});var OC=P((Hme,AC)=>{"use strict";var h9=rr(),g9=_n(),_9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new g9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===1)&&(n=s,o=new h9(n,r))}),n};AC.exports=_9});var RC=P((Wme,CC)=>{"use strict";var Gx=rr(),y9=_n(),PC=Md(),v9=(t,e)=>{t=new y9(t,e);let r=new Gx("0.0.0");if(t.test(r)||(r=new Gx("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n{let a=new Gx(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||PC(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),i&&(!r||PC(r,i))&&(r=i)}return r&&t.test(r)?r:null};CC.exports=v9});var zC=P((Jme,NC)=>{"use strict";var b9=_n(),w9=(t,e)=>{try{return new b9(t,e).range||"*"}catch{return null}};NC.exports=w9});var Dh=P((Xme,LC)=>{"use strict";var x9=rr(),DC=jd(),{ANY:$9}=DC,I9=_n(),S9=Ld(),MC=Md(),jC=Rh(),k9=zh(),T9=Nh(),E9=(t,e,r,n)=>{t=new x9(t,n),e=new I9(e,n);let o,i,s,a,c;switch(r){case">":o=MC,i=k9,s=jC,a=">",c=">=";break;case"<":o=jC,i=T9,s=MC,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(S9(t,e,n))return!1;for(let u=0;u{p.semver===$9&&(p=new DC(">=0.0.0")),d=d||p,f=f||p,o(p.semver,d.semver,n)?d=p:s(p.semver,f.semver,n)&&(f=p)}),d.operator===a||d.operator===c||(!f.operator||f.operator===a)&&i(t,f.semver))return!1;if(f.operator===c&&s(t,f.semver))return!1}return!0};LC.exports=E9});var FC=P((Yme,UC)=>{"use strict";var A9=Dh(),O9=(t,e,r)=>A9(t,e,">",r);UC.exports=O9});var ZC=P((Qme,BC)=>{"use strict";var P9=Dh(),C9=(t,e,r)=>P9(t,e,"<",r);BC.exports=C9});var GC=P((ehe,VC)=>{"use strict";var qC=_n(),R9=(t,e,r)=>(t=new qC(t,r),e=new qC(e,r),t.intersects(e,r));VC.exports=R9});var HC=P((the,KC)=>{"use strict";var N9=Ld(),z9=gn();KC.exports=(t,e,r)=>{let n=[],o=null,i=null,s=t.sort((l,d)=>z9(l,d,r));for(let l of s)N9(l,e,r)?(i=l,o||(o=l)):(i&&n.push([o,i]),i=null,o=null);o&&n.push([o,null]);let a=[];for(let[l,d]of n)l===d?a.push(l):!d&&l===s[0]?a.push("*"):d?l===s[0]?a.push(`<=${d}`):a.push(`${l} - ${d}`):a.push(`>=${l}`);let c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length{"use strict";var WC=_n(),Hx=jd(),{ANY:Kx}=Hx,Ud=Ld(),Wx=gn(),M9=(t,e,r={})=>{if(t===e)return!0;t=new WC(t,r),e=new WC(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let s=D9(o,i,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},j9=[new Hx(">=0.0.0-0")],JC=[new Hx(">=0.0.0")],D9=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Kx){if(e.length===1&&e[0].semver===Kx)return!0;r.includePrerelease?t=j9:t=JC}if(e.length===1&&e[0].semver===Kx){if(r.includePrerelease)return!0;e=JC}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=XC(o,p,r):p.operator==="<"||p.operator==="<="?i=YC(i,p,r):n.add(p.semver);if(n.size>1)return null;let s;if(o&&i){if(s=Wx(o.semver,i.semver,r),s>0)return null;if(s===0&&(o.operator!==">="||i.operator!=="<="))return null}for(let p of n){if(o&&!Ud(p,String(o),r)||i&&!Ud(p,String(i),r))return null;for(let m of e)if(!Ud(p,String(m),r))return!1;return!0}let a,c,u,l,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of e){if(l=l||p.operator===">"||p.operator===">=",u=u||p.operator==="<"||p.operator==="<=",o){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator===">"||p.operator===">="){if(a=XC(o,p,r),a===p&&a!==o)return!1}else if(o.operator===">="&&!Ud(o.semver,String(p),r))return!1}if(i){if(d&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===d.major&&p.semver.minor===d.minor&&p.semver.patch===d.patch&&(d=!1),p.operator==="<"||p.operator==="<="){if(c=YC(i,p,r),c===p&&c!==i)return!1}else if(i.operator==="<="&&!Ud(i.semver,String(p),r))return!1}if(!p.operator&&(i||o)&&s!==0)return!1}return!(o&&u&&!i&&s!==0||i&&l&&!o&&s!==0||f||d)},XC=(t,e,r)=>{if(!t)return e;let n=Wx(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},YC=(t,e,r)=>{if(!t)return e;let n=Wx(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};QC.exports=M9});var oR=P((nhe,nR)=>{"use strict";var Jx=lu(),tR=Nd(),L9=rr(),rR=Nx(),U9=pa(),F9=EP(),B9=OP(),Z9=RP(),q9=MP(),V9=DP(),G9=UP(),K9=BP(),H9=qP(),W9=gn(),J9=HP(),X9=JP(),Y9=Ch(),Q9=eC(),eq=rC(),tq=Md(),rq=Rh(),nq=jx(),oq=Dx(),iq=Nh(),sq=zh(),aq=Lx(),cq=dC(),uq=jd(),lq=_n(),dq=Ld(),pq=kC(),fq=EC(),mq=OC(),hq=RC(),gq=zC(),_q=Dh(),yq=FC(),vq=ZC(),bq=GC(),wq=HC(),xq=eR();nR.exports={parse:U9,valid:F9,clean:B9,inc:Z9,diff:q9,major:V9,minor:G9,patch:K9,prerelease:H9,compare:W9,rcompare:J9,compareLoose:X9,compareBuild:Y9,sort:Q9,rsort:eq,gt:tq,lt:rq,eq:nq,neq:oq,gte:iq,lte:sq,cmp:aq,coerce:cq,Comparator:uq,Range:lq,satisfies:dq,toComparators:pq,maxSatisfying:fq,minSatisfying:mq,minVersion:hq,validRange:gq,outside:_q,gtr:yq,ltr:vq,intersects:bq,simplifyRange:wq,subset:xq,SemVer:L9,re:Jx.re,src:Jx.src,tokens:Jx.t,SEMVER_SPEC_VERSION:tR.SEMVER_SPEC_VERSION,RELEASE_TYPES:tR.RELEASE_TYPES,compareIdentifiers:rR.compareIdentifiers,rcompareIdentifiers:rR.rcompareIdentifiers}});var IR=P((Ghe,$R)=>{"use strict";var wR=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,xR=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function qq(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",e.color.ansi256=wR(),e.color.ansi16m=xR(),e.bgColor.ansi256=wR(10),e.bgColor.ansi16m=xR(10),Object.defineProperties(e,{rgbToAnsi256:{value:(r,n,o)=>r===n&&n===o?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:o}=n.groups;o.length===3&&(o=o.split("").map(s=>s+s).join(""));let i=Number.parseInt(o,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:r=>e.rgbToAnsi256(...e.hexToRgb(r)),enumerable:!1}}),e}Object.defineProperty($R,"exports",{enumerable:!0,get:qq})});var KM=P(dv=>{"use strict";dv.byteLength=AW;dv.toByteArray=PW;dv.fromByteArray=NW;var So=[],Sn=[],EW=typeof Uint8Array<"u"?Uint8Array:Array,BI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Va=0,VM=BI.length;Va0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function AW(t){var e=GM(t),r=e[0],n=e[1];return(r+n)*3/4-n}function OW(t,e,r){return(e+r)*3/4-r}function PW(t){var e,r=GM(t),n=r[0],o=r[1],i=new EW(OW(t,n,o)),s=0,a=o>0?n-4:n,c;for(c=0;c>16&255,i[s++]=e>>8&255,i[s++]=e&255;return o===2&&(e=Sn[t.charCodeAt(c)]<<2|Sn[t.charCodeAt(c+1)]>>4,i[s++]=e&255),o===1&&(e=Sn[t.charCodeAt(c)]<<10|Sn[t.charCodeAt(c+1)]<<4|Sn[t.charCodeAt(c+2)]>>2,i[s++]=e>>8&255,i[s++]=e&255),i}function CW(t){return So[t>>18&63]+So[t>>12&63]+So[t>>6&63]+So[t&63]}function RW(t,e,r){for(var n,o=[],i=e;ia?a:s+i));return n===1?(e=t[r-1],o.push(So[e>>2]+So[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(So[e>>10]+So[e>>4&63]+So[e<<2&63]+"=")),o.join("")}});var Cf=P(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.regexpCode=Fe.getEsmExportName=Fe.getProperty=Fe.safeStringify=Fe.stringify=Fe.strConcat=Fe.addCodeArg=Fe.str=Fe._=Fe.nil=Fe._Code=Fe.Name=Fe.IDENTIFIER=Fe._CodeOrName=void 0;var Of=class{};Fe._CodeOrName=Of;Fe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Qa=class extends Of{constructor(e){if(super(),!Fe.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Fe.Name=Qa;var Tn=class extends Of{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Qa&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Fe._Code=Tn;Fe.nil=new Tn("");function Xj(t,...e){let r=[t[0]],n=0;for(;n{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.ValueScope=Br.ValueScopeName=Br.Scope=Br.varKinds=Br.UsedValueState=void 0;var Fr=Cf(),DS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Hv;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Hv||(Br.UsedValueState=Hv={}));Br.varKinds={const:new Fr.Name("const"),let:new Fr.Name("let"),var:new Fr.Name("var")};var Wv=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Fr.Name?e:this.name(e)}name(e){return new Fr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Br.Scope=Wv;var Jv=class extends Fr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Fr._)`.${new Fr.Name(r)}[${n}]`}};Br.ValueScopeName=Jv;var z7=(0,Fr._)`\n`,LS=class extends Wv{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?z7:Fr.nil}}get(){return this._scope}name(e){return new Jv(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:i}=o,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[i];if(a){let l=a.get(s);if(l)return l}else a=this._values[i]=new Map;a.set(s,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Fr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let i=Fr.nil;for(let s in e){let a=e[s];if(!a)continue;let c=n[s]=n[s]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Hv.Started);let l=r(u);if(l){let d=this.opts.es5?Br.varKinds.var:Br.varKinds.const;i=(0,Fr._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Fr._)`${i}${l}${this.opts._n}`;else throw new DS(u);c.set(u,Hv.Completed)})}return i}};Br.ValueScope=LS});var Oe=P(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.or=Ce.and=Ce.not=Ce.CodeGen=Ce.operators=Ce.varKinds=Ce.ValueScopeName=Ce.ValueScope=Ce.Scope=Ce.Name=Ce.regexpCode=Ce.stringify=Ce.getProperty=Ce.nil=Ce.strConcat=Ce.str=Ce._=void 0;var Le=Cf(),Xn=US(),_s=Cf();Object.defineProperty(Ce,"_",{enumerable:!0,get:function(){return _s._}});Object.defineProperty(Ce,"str",{enumerable:!0,get:function(){return _s.str}});Object.defineProperty(Ce,"strConcat",{enumerable:!0,get:function(){return _s.strConcat}});Object.defineProperty(Ce,"nil",{enumerable:!0,get:function(){return _s.nil}});Object.defineProperty(Ce,"getProperty",{enumerable:!0,get:function(){return _s.getProperty}});Object.defineProperty(Ce,"stringify",{enumerable:!0,get:function(){return _s.stringify}});Object.defineProperty(Ce,"regexpCode",{enumerable:!0,get:function(){return _s.regexpCode}});Object.defineProperty(Ce,"Name",{enumerable:!0,get:function(){return _s.Name}});var eb=US();Object.defineProperty(Ce,"Scope",{enumerable:!0,get:function(){return eb.Scope}});Object.defineProperty(Ce,"ValueScope",{enumerable:!0,get:function(){return eb.ValueScope}});Object.defineProperty(Ce,"ValueScopeName",{enumerable:!0,get:function(){return eb.ValueScopeName}});Object.defineProperty(Ce,"varKinds",{enumerable:!0,get:function(){return eb.varKinds}});Ce.operators={GT:new Le._Code(">"),GTE:new Le._Code(">="),LT:new Le._Code("<"),LTE:new Le._Code("<="),EQ:new Le._Code("==="),NEQ:new Le._Code("!=="),NOT:new Le._Code("!"),OR:new Le._Code("||"),AND:new Le._Code("&&"),ADD:new Le._Code("+")};var di=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},FS=class extends di{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Xn.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Sl(this.rhs,e,r)),this}get names(){return this.rhs instanceof Le._CodeOrName?this.rhs.names:{}}},Xv=class extends di{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Le.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Sl(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Le.Name?{}:{...this.lhs.names};return Qv(e,this.rhs)}},BS=class extends Xv{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},ZS=class extends di{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qS=class extends di{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},VS=class extends di{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},GS=class extends di{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Sl(this.code,e,r),this}get names(){return this.code instanceof Le._CodeOrName?this.code.names:{}}},Rf=class extends di{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(e,r)||(M7(e,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rc(e,r.names),{})}},pi=class extends Rf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},KS=class extends Rf{},Il=class extends pi{};Il.kind="else";var ec=class t extends pi{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Il(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Qj(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Sl(this.condition,e,r),this}get names(){let e=super.names;return Qv(e,this.condition),this.else&&rc(e,this.else.names),e}};ec.kind="if";var tc=class extends pi{};tc.kind="for";var HS=class extends tc{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Sl(this.iteration,e,r),this}get names(){return rc(super.names,this.iteration.names)}},WS=class extends tc{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?Xn.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=Qv(super.names,this.from);return Qv(e,this.to)}},Yv=class extends tc{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Sl(this.iterable,e,r),this}get names(){return rc(super.names,this.iterable.names)}},Nf=class extends pi{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Nf.kind="func";var zf=class extends Rf{render(e){return"return "+super.render(e)}};zf.kind="return";var JS=class extends pi{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rc(e,this.catch.names),this.finally&&rc(e,this.finally.names),e}},Mf=class extends pi{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Mf.kind="catch";var jf=class extends pi{render(e){return"finally"+super.render(e)}};jf.kind="finally";var XS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?` +`:""},this._extScope=e,this._scope=new Xn.Scope({parent:e}),this._nodes=[new KS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new FS(e,i,n)),i}const(e,r,n){return this._def(Xn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Xn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Xn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Xv(e,r,n))}add(e,r){return this._leafNode(new BS(e,Ce.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Le.nil&&this._leafNode(new GS(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Le.addCodeArg)(r,o));return r.push("}"),new Le._Code(r)}if(e,r,n){if(this._blockNode(new ec(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ec(e))}else(){return this._elseNode(new Il)}endIf(){return this._endBlockNode(ec,Il)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new HS(e),r)}forRange(e,r,n,o,i=this.opts.es5?Xn.varKinds.var:Xn.varKinds.let){let s=this._scope.toName(e);return this._for(new WS(i,s,r,n),()=>o(s))}forOf(e,r,n,o=Xn.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let s=r instanceof Le.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Le._)`${s}.length`,a=>{this.var(i,(0,Le._)`${s}[${a}]`),n(i)})}return this._for(new Yv("of",o,i,r),()=>n(i))}forIn(e,r,n,o=this.opts.es5?Xn.varKinds.var:Xn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Le._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new Yv("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(tc)}label(e){return this._leafNode(new ZS(e))}break(e){return this._leafNode(new qS(e))}return(e){let r=new zf;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(zf)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new JS;if(this._blockNode(o),this.code(e),r){let i=this.name("e");this._currNode=o.catch=new Mf(i),r(i)}return n&&(this._currNode=o.finally=new jf,this.code(n)),this._endBlockNode(Mf,jf)}throw(e){return this._leafNode(new VS(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Le.nil,n,o){return this._blockNode(new Nf(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Nf)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof ec))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ce.CodeGen=XS;function rc(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Qv(t,e){return e instanceof Le._CodeOrName?rc(t,e.names):t}function Sl(t,e,r){if(t instanceof Le.Name)return n(t);if(!o(t))return t;return new Le._Code(t._items.reduce((i,s)=>(s instanceof Le.Name&&(s=n(s)),s instanceof Le._Code?i.push(...s._items):i.push(s),i),[]));function n(i){let s=r[i.str];return s===void 0||e[i.str]!==1?i:(delete e[i.str],s)}function o(i){return i instanceof Le._Code&&i._items.some(s=>s instanceof Le.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function M7(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Qj(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Le._)`!${YS(t)}`}Ce.not=Qj;var j7=eD(Ce.operators.AND);function D7(...t){return t.reduce(j7)}Ce.and=D7;var L7=eD(Ce.operators.OR);function U7(...t){return t.reduce(L7)}Ce.or=U7;function eD(t){return(e,r)=>e===Le.nil?r:r===Le.nil?e:(0,Le._)`${YS(e)} ${t} ${YS(r)}`}function YS(t){return t instanceof Le.Name?t:(0,Le._)`(${t})`}});var Be=P(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.checkStrictMode=Ne.getErrorPath=Ne.Type=Ne.useFunc=Ne.setEvaluated=Ne.evaluatedPropsToName=Ne.mergeEvaluated=Ne.eachItem=Ne.unescapeJsonPointer=Ne.escapeJsonPointer=Ne.escapeFragment=Ne.unescapeFragment=Ne.schemaRefOrVal=Ne.schemaHasRulesButRef=Ne.schemaHasRules=Ne.checkUnknownRules=Ne.alwaysValidSchema=Ne.toHash=void 0;var rt=Oe(),F7=Cf();function B7(t){let e={};for(let r of t)e[r]=!0;return e}Ne.toHash=B7;function Z7(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(nD(t,e),!oD(e,t.self.RULES.all))}Ne.alwaysValidSchema=Z7;function nD(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let i in e)o[i]||aD(t,`unknown keyword: "${i}"`)}Ne.checkUnknownRules=nD;function oD(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Ne.schemaHasRules=oD;function q7(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Ne.schemaHasRulesButRef=q7;function V7({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,rt._)`${r}`}return(0,rt._)`${t}${e}${(0,rt.getProperty)(n)}`}Ne.schemaRefOrVal=V7;function G7(t){return iD(decodeURIComponent(t))}Ne.unescapeFragment=G7;function K7(t){return encodeURIComponent(ek(t))}Ne.escapeFragment=K7;function ek(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Ne.escapeJsonPointer=ek;function iD(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Ne.unescapeJsonPointer=iD;function H7(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Ne.eachItem=H7;function tD({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,i,s,a)=>{let c=s===void 0?i:s instanceof rt.Name?(i instanceof rt.Name?t(o,i,s):e(o,i,s),s):i instanceof rt.Name?(e(o,s,i),i):r(i,s);return a===rt.Name&&!(c instanceof rt.Name)?n(o,c):c}}Ne.mergeEvaluated={props:tD({mergeNames:(t,e,r)=>t.if((0,rt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,rt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,rt._)`${r} || {}`).code((0,rt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,rt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,rt._)`${r} || {}`),tk(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:sD}),items:tD({mergeNames:(t,e,r)=>t.if((0,rt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,rt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,rt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,rt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function sD(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,rt._)`{}`);return e!==void 0&&tk(t,r,e),r}Ne.evaluatedPropsToName=sD;function tk(t,e,r){Object.keys(r).forEach(n=>t.assign((0,rt._)`${e}${(0,rt.getProperty)(n)}`,!0))}Ne.setEvaluated=tk;var rD={};function W7(t,e){return t.scopeValue("func",{ref:e,code:rD[e.code]||(rD[e.code]=new F7._Code(e.code))})}Ne.useFunc=W7;var QS;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(QS||(Ne.Type=QS={}));function J7(t,e,r){if(t instanceof rt.Name){let n=e===QS.Num;return r?n?(0,rt._)`"[" + ${t} + "]"`:(0,rt._)`"['" + ${t} + "']"`:n?(0,rt._)`"/" + ${t}`:(0,rt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,rt.getProperty)(t).toString():"/"+ek(t)}Ne.getErrorPath=J7;function aD(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Ne.checkStrictMode=aD});var fi=P(rk=>{"use strict";Object.defineProperty(rk,"__esModule",{value:!0});var ur=Oe(),X7={data:new ur.Name("data"),valCxt:new ur.Name("valCxt"),instancePath:new ur.Name("instancePath"),parentData:new ur.Name("parentData"),parentDataProperty:new ur.Name("parentDataProperty"),rootData:new ur.Name("rootData"),dynamicAnchors:new ur.Name("dynamicAnchors"),vErrors:new ur.Name("vErrors"),errors:new ur.Name("errors"),this:new ur.Name("this"),self:new ur.Name("self"),scope:new ur.Name("scope"),json:new ur.Name("json"),jsonPos:new ur.Name("jsonPos"),jsonLen:new ur.Name("jsonLen"),jsonPart:new ur.Name("jsonPart")};rk.default=X7});var Df=P(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.extendErrors=lr.resetErrorsCount=lr.reportExtraError=lr.reportError=lr.keyword$DataError=lr.keywordError=void 0;var Ue=Oe(),tb=Be(),kr=fi();lr.keywordError={message:({keyword:t})=>(0,Ue.str)`must pass "${t}" keyword validation`};lr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ue.str)`"${t}" keyword must be ${e} ($data)`:(0,Ue.str)`"${t}" keyword is invalid ($data)`};function Y7(t,e=lr.keywordError,r,n){let{it:o}=t,{gen:i,compositeRule:s,allErrors:a}=o,c=lD(t,e,r);n??(s||a)?cD(i,c):uD(o,(0,Ue._)`[${c}]`)}lr.reportError=Y7;function Q7(t,e=lr.keywordError,r){let{it:n}=t,{gen:o,compositeRule:i,allErrors:s}=n,a=lD(t,e,r);cD(o,a),i||s||uD(n,kr.default.vErrors)}lr.reportExtraError=Q7;function eX(t,e){t.assign(kr.default.errors,e),t.if((0,Ue._)`${kr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ue._)`${kr.default.vErrors}.length`,e),()=>t.assign(kr.default.vErrors,null)))}lr.resetErrorsCount=eX;function tX({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",o,kr.default.errors,a=>{t.const(s,(0,Ue._)`${kr.default.vErrors}[${a}]`),t.if((0,Ue._)`${s}.instancePath === undefined`,()=>t.assign((0,Ue._)`${s}.instancePath`,(0,Ue.strConcat)(kr.default.instancePath,i.errorPath))),t.assign((0,Ue._)`${s}.schemaPath`,(0,Ue.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,Ue._)`${s}.schema`,r),t.assign((0,Ue._)`${s}.data`,n))})}lr.extendErrors=tX;function cD(t,e){let r=t.const("err",e);t.if((0,Ue._)`${kr.default.vErrors} === null`,()=>t.assign(kr.default.vErrors,(0,Ue._)`[${r}]`),(0,Ue._)`${kr.default.vErrors}.push(${r})`),t.code((0,Ue._)`${kr.default.errors}++`)}function uD(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,Ue._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ue._)`${n}.errors`,e),r.return(!1))}var nc={keyword:new Ue.Name("keyword"),schemaPath:new Ue.Name("schemaPath"),params:new Ue.Name("params"),propertyName:new Ue.Name("propertyName"),message:new Ue.Name("message"),schema:new Ue.Name("schema"),parentSchema:new Ue.Name("parentSchema")};function lD(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Ue._)`{}`:rX(t,e,r)}function rX(t,e,r={}){let{gen:n,it:o}=t,i=[nX(o,r),oX(t,r)];return iX(t,e,i),n.object(...i)}function nX({errorPath:t},{instancePath:e}){let r=e?(0,Ue.str)`${t}${(0,tb.getErrorPath)(e,tb.Type.Str)}`:t;return[kr.default.instancePath,(0,Ue.strConcat)(kr.default.instancePath,r)]}function oX({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,Ue.str)`${e}/${t}`;return r&&(o=(0,Ue.str)`${o}${(0,tb.getErrorPath)(r,tb.Type.Str)}`),[nc.schemaPath,o]}function iX(t,{params:e,message:r},n){let{keyword:o,data:i,schemaValue:s,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([nc.keyword,o],[nc.params,typeof e=="function"?e(t):e||(0,Ue._)`{}`]),c.messages&&n.push([nc.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([nc.schema,s],[nc.parentSchema,(0,Ue._)`${l}${d}`],[kr.default.data,i]),u&&n.push([nc.propertyName,u])}});var pD=P(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.boolOrEmptySchema=kl.topBoolOrEmptySchema=void 0;var sX=Df(),aX=Oe(),cX=fi(),uX={message:"boolean schema is false"};function lX(t){let{gen:e,schema:r,validateName:n}=t;r===!1?dD(t,!1):typeof r=="object"&&r.$async===!0?e.return(cX.default.data):(e.assign((0,aX._)`${n}.errors`,null),e.return(!0))}kl.topBoolOrEmptySchema=lX;function dX(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),dD(t)):r.var(e,!0)}kl.boolOrEmptySchema=dX;function dD(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,sX.reportError)(o,uX,void 0,e)}});var nk=P(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.getRules=Tl.isJSONType=void 0;var pX=["string","number","integer","boolean","null","object","array"],fX=new Set(pX);function mX(t){return typeof t=="string"&&fX.has(t)}Tl.isJSONType=mX;function hX(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Tl.getRules=hX});var ok=P(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.shouldUseRule=ys.shouldUseGroup=ys.schemaHasRulesForType=void 0;function gX({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&fD(t,n)}ys.schemaHasRulesForType=gX;function fD(t,e){return e.rules.some(r=>mD(t,r))}ys.shouldUseGroup=fD;function mD(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ys.shouldUseRule=mD});var Lf=P(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.reportTypeError=dr.checkDataTypes=dr.checkDataType=dr.coerceAndCheckDataType=dr.getJSONTypes=dr.getSchemaTypes=dr.DataType=void 0;var _X=nk(),yX=ok(),vX=Df(),Te=Oe(),hD=Be(),El;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(El||(dr.DataType=El={}));function bX(t){let e=gD(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}dr.getSchemaTypes=bX;function gD(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(_X.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}dr.getJSONTypes=gD;function wX(t,e){let{gen:r,data:n,opts:o}=t,i=xX(e,o.coerceTypes),s=e.length>0&&!(i.length===0&&e.length===1&&(0,yX.schemaHasRulesForType)(t,e[0]));if(s){let a=sk(e,n,o.strictNumbers,El.Wrong);r.if(a,()=>{i.length?$X(t,e,i):ak(t)})}return s}dr.coerceAndCheckDataType=wX;var _D=new Set(["string","number","integer","boolean","null"]);function xX(t,e){return e?t.filter(r=>_D.has(r)||e==="array"&&r==="array"):[]}function $X(t,e,r){let{gen:n,data:o,opts:i}=t,s=n.let("dataType",(0,Te._)`typeof ${o}`),a=n.let("coerced",(0,Te._)`undefined`);i.coerceTypes==="array"&&n.if((0,Te._)`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,Te._)`${o}[0]`).assign(s,(0,Te._)`typeof ${o}`).if(sk(e,o,i.strictNumbers),()=>n.assign(a,o))),n.if((0,Te._)`${a} !== undefined`);for(let u of r)(_D.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),ak(t),n.endIf(),n.if((0,Te._)`${a} !== undefined`,()=>{n.assign(o,a),IX(t,a)});function c(u){switch(u){case"string":n.elseIf((0,Te._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,Te._)`"" + ${o}`).elseIf((0,Te._)`${o} === null`).assign(a,(0,Te._)`""`);return;case"number":n.elseIf((0,Te._)`${s} == "boolean" || ${o} === null + || (${s} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,Te._)`+${o}`);return;case"integer":n.elseIf((0,Te._)`${s} === "boolean" || ${o} === null + || (${s} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,Te._)`+${o}`);return;case"boolean":n.elseIf((0,Te._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,Te._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,Te._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,Te._)`${s} === "string" || ${s} === "number" + || ${s} === "boolean" || ${o} === null`).assign(a,(0,Te._)`[${o}]`)}}}function IX({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Te._)`${e} !== undefined`,()=>t.assign((0,Te._)`${e}[${r}]`,n))}function ik(t,e,r,n=El.Correct){let o=n===El.Correct?Te.operators.EQ:Te.operators.NEQ,i;switch(t){case"null":return(0,Te._)`${e} ${o} null`;case"array":i=(0,Te._)`Array.isArray(${e})`;break;case"object":i=(0,Te._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=s((0,Te._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=s();break;default:return(0,Te._)`typeof ${e} ${o} ${t}`}return n===El.Correct?i:(0,Te.not)(i);function s(a=Te.nil){return(0,Te.and)((0,Te._)`typeof ${e} == "number"`,a,r?(0,Te._)`isFinite(${e})`:Te.nil)}}dr.checkDataType=ik;function sk(t,e,r,n){if(t.length===1)return ik(t[0],e,r,n);let o,i=(0,hD.toHash)(t);if(i.array&&i.object){let s=(0,Te._)`typeof ${e} != "object"`;o=i.null?s:(0,Te._)`!${e} || ${s}`,delete i.null,delete i.array,delete i.object}else o=Te.nil;i.number&&delete i.integer;for(let s in i)o=(0,Te.and)(o,ik(s,e,r,n));return o}dr.checkDataTypes=sk;var SX={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Te._)`{type: ${t}}`:(0,Te._)`{type: ${e}}`};function ak(t){let e=kX(t);(0,vX.reportError)(e,SX)}dr.reportTypeError=ak;function kX(t){let{gen:e,data:r,schema:n}=t,o=(0,hD.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var vD=P(rb=>{"use strict";Object.defineProperty(rb,"__esModule",{value:!0});rb.assignDefaults=void 0;var Al=Oe(),TX=Be();function EX(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)yD(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,i)=>yD(t,i,o.default))}rb.assignDefaults=EX;function yD(t,e,r){let{gen:n,compositeRule:o,data:i,opts:s}=t;if(r===void 0)return;let a=(0,Al._)`${i}${(0,Al.getProperty)(e)}`;if(o){(0,TX.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Al._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,Al._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Al._)`${a} = ${(0,Al.stringify)(r)}`)}});var En=P(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.validateUnion=Xe.validateArray=Xe.usePattern=Xe.callValidateCode=Xe.schemaProperties=Xe.allSchemaProperties=Xe.noPropertyInData=Xe.propertyInData=Xe.isOwnProperty=Xe.hasPropFunc=Xe.reportMissingProp=Xe.checkMissingProp=Xe.checkReportMissingProp=void 0;var ut=Oe(),ck=Be(),vs=fi(),AX=Be();function OX(t,e){let{gen:r,data:n,it:o}=t;r.if(lk(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,ut._)`${e}`},!0),t.error()})}Xe.checkReportMissingProp=OX;function PX({gen:t,data:e,it:{opts:r}},n,o){return(0,ut.or)(...n.map(i=>(0,ut.and)(lk(t,e,i,r.ownProperties),(0,ut._)`${o} = ${i}`)))}Xe.checkMissingProp=PX;function CX(t,e){t.setParams({missingProperty:e},!0),t.error()}Xe.reportMissingProp=CX;function bD(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ut._)`Object.prototype.hasOwnProperty`})}Xe.hasPropFunc=bD;function uk(t,e,r){return(0,ut._)`${bD(t)}.call(${e}, ${r})`}Xe.isOwnProperty=uk;function RX(t,e,r,n){let o=(0,ut._)`${e}${(0,ut.getProperty)(r)} !== undefined`;return n?(0,ut._)`${o} && ${uk(t,e,r)}`:o}Xe.propertyInData=RX;function lk(t,e,r,n){let o=(0,ut._)`${e}${(0,ut.getProperty)(r)} === undefined`;return n?(0,ut.or)(o,(0,ut.not)(uk(t,e,r))):o}Xe.noPropertyInData=lk;function wD(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Xe.allSchemaProperties=wD;function NX(t,e){return wD(e).filter(r=>!(0,ck.alwaysValidSchema)(t,e[r]))}Xe.schemaProperties=NX;function zX({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:s},a,c,u){let l=u?(0,ut._)`${t}, ${e}, ${n}${o}`:e,d=[[vs.default.instancePath,(0,ut.strConcat)(vs.default.instancePath,i)],[vs.default.parentData,s.parentData],[vs.default.parentDataProperty,s.parentDataProperty],[vs.default.rootData,vs.default.rootData]];s.opts.dynamicRef&&d.push([vs.default.dynamicAnchors,vs.default.dynamicAnchors]);let f=(0,ut._)`${l}, ${r.object(...d)}`;return c!==ut.nil?(0,ut._)`${a}.call(${c}, ${f})`:(0,ut._)`${a}(${f})`}Xe.callValidateCode=zX;var MX=(0,ut._)`new RegExp`;function jX({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,i=o(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ut._)`${o.code==="new RegExp"?MX:(0,AX.useFunc)(t,o)}(${r}, ${n})`})}Xe.usePattern=jX;function DX(t){let{gen:e,data:r,keyword:n,it:o}=t,i=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(i,!0),s(()=>e.break()),i;function s(a){let c=e.const("len",(0,ut._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:ck.Type.Num},i),e.if((0,ut.not)(i),a)})}}Xe.validateArray=DX;function LX(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,ck.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(s,(0,ut._)`${s} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,ut.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}Xe.validateUnion=LX});var ID=P(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.validateKeywordUsage=Eo.validSchemaType=Eo.funcKeywordCode=Eo.macroKeywordCode=void 0;var Tr=Oe(),oc=fi(),UX=En(),FX=Df();function BX(t,e){let{gen:r,keyword:n,schema:o,parentSchema:i,it:s}=t,a=e.macro.call(s.self,o,i,s),c=$D(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:Tr.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Eo.macroKeywordCode=BX;function ZX(t,e){var r;let{gen:n,keyword:o,schema:i,parentSchema:s,$data:a,it:c}=t;VX(c,e);let u=!a&&e.compile?e.compile.call(c.self,i,s,c):e.validate,l=$D(n,o,u),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&xD(t),_(()=>t.error());else{let v=e.async?p():m();e.modifying&&xD(t),_(()=>qX(t,v))}}function p(){let v=n.let("ruleErrs",null);return n.try(()=>h((0,Tr._)`await `),b=>n.assign(d,!1).if((0,Tr._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,Tr._)`${b}.errors`),()=>n.throw(b))),v}function m(){let v=(0,Tr._)`${l}.errors`;return n.assign(v,null),h(Tr.nil),v}function h(v=e.async?(0,Tr._)`await `:Tr.nil){let b=c.opts.passContext?oc.default.this:oc.default.self,x=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Tr._)`${v}${(0,UX.callValidateCode)(t,l,b,x)}`,e.modifying)}function _(v){var b;n.if((0,Tr.not)((b=e.valid)!==null&&b!==void 0?b:d),v)}}Eo.funcKeywordCode=ZX;function xD(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Tr._)`${n.parentData}[${n.parentDataProperty}]`))}function qX(t,e){let{gen:r}=t;r.if((0,Tr._)`Array.isArray(${e})`,()=>{r.assign(oc.default.vErrors,(0,Tr._)`${oc.default.vErrors} === null ? ${e} : ${oc.default.vErrors}.concat(${e})`).assign(oc.default.errors,(0,Tr._)`${oc.default.vErrors}.length`),(0,FX.extendErrors)(t)},()=>t.error())}function VX({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function $D(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Tr.stringify)(r)})}function GX(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Eo.validSchemaType=GX;function KX({schema:t,opts:e,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let s=o.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Eo.validateKeywordUsage=KX});var kD=P(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.extendSubschemaMode=bs.extendSubschemaData=bs.getSubschema=void 0;var Ao=Oe(),SD=Be();function HX(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ao._)`${t.schemaPath}${(0,Ao.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ao._)`${t.schemaPath}${(0,Ao.getProperty)(e)}${(0,Ao.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,SD.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:s,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}bs.getSubschema=HX;function WX(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:s}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,f=a.let("data",(0,Ao._)`${e.data}${(0,Ao.getProperty)(r)}`,!0);c(f),t.errorPath=(0,Ao.str)`${u}${(0,SD.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ao._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Ao.Name?o:a.let("data",o,!0);c(u),s!==void 0&&(t.propertyName=s)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}bs.extendSubschemaData=WX;function JX(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}bs.extendSubschemaMode=JX});var dk=P((Z2e,TD)=>{"use strict";TD.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var s=i[o];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var AD=P((q2e,ED)=>{"use strict";var ws=ED.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};nb(e,n,o,t,"",t)};ws.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ws.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ws.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ws.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function nb(t,e,r,n,o,i,s,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,i,s,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ws.arrayKeywords)for(var f=0;f{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.getSchemaRefs=Zr.resolveUrl=Zr.normalizeId=Zr._getFullPath=Zr.getFullPath=Zr.inlineRef=void 0;var YX=Be(),QX=dk(),eY=AD(),tY=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function rY(t,e=!0){return typeof t=="boolean"?!0:e===!0?!pk(t):e?OD(t)<=e:!1}Zr.inlineRef=rY;var nY=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function pk(t){for(let e in t){if(nY.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(pk)||typeof r=="object"&&pk(r))return!0}return!1}function OD(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!tY.has(r)&&(typeof t[r]=="object"&&(0,YX.eachItem)(t[r],n=>e+=OD(n)),e===1/0))return 1/0}return e}function PD(t,e="",r){r!==!1&&(e=Ol(e));let n=t.parse(e);return CD(t,n)}Zr.getFullPath=PD;function CD(t,e){return t.serialize(e).split("#")[0]+"#"}Zr._getFullPath=CD;var oY=/#\/?$/;function Ol(t){return t?t.replace(oY,""):""}Zr.normalizeId=Ol;function iY(t,e,r){return r=Ol(r),t.resolve(e,r)}Zr.resolveUrl=iY;var sY=/^[a-z_][-a-z0-9._]*$/i;function aY(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Ol(t[r]||e),i={"":o},s=PD(n,o,!1),a={},c=new Set;return eY(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=s+f,_=i[m];typeof d[r]=="string"&&(_=v.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),i[f]=_;function v(x){let k=this.opts.uriResolver.resolve;if(x=Ol(_?k(_,x):x),c.has(x))throw l(x);c.add(x);let T=this.refs[x];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?u(d,T.schema,x):x!==Ol(h)&&(x[0]==="#"?(u(d,a[x],x),a[x]=d):this.refs[x]=h),x}function b(x){if(typeof x=="string"){if(!sY.test(x))throw new Error(`invalid anchor "${x}"`);v.call(this,`#${x}`)}}}),a;function u(d,f,p){if(f!==void 0&&!QX(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Zr.getSchemaRefs=aY});var Zf=P(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.getData=xs.KeywordCxt=xs.validateFunctionCode=void 0;var jD=pD(),RD=Lf(),mk=ok(),ob=Lf(),cY=vD(),Bf=ID(),fk=kD(),ae=Oe(),we=fi(),uY=Uf(),mi=Be(),Ff=Df();function lY(t){if(UD(t)&&(FD(t),LD(t))){fY(t);return}DD(t,()=>(0,jD.topBoolOrEmptySchema)(t))}xs.validateFunctionCode=lY;function DD({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,ae._)`${we.default.data}, ${we.default.valCxt}`,n.$async,()=>{t.code((0,ae._)`"use strict"; ${ND(r,o)}`),pY(t,o),t.code(i)}):t.func(e,(0,ae._)`${we.default.data}, ${dY(o)}`,n.$async,()=>t.code(ND(r,o)).code(i))}function dY(t){return(0,ae._)`{${we.default.instancePath}="", ${we.default.parentData}, ${we.default.parentDataProperty}, ${we.default.rootData}=${we.default.data}${t.dynamicRef?(0,ae._)`, ${we.default.dynamicAnchors}={}`:ae.nil}}={}`}function pY(t,e){t.if(we.default.valCxt,()=>{t.var(we.default.instancePath,(0,ae._)`${we.default.valCxt}.${we.default.instancePath}`),t.var(we.default.parentData,(0,ae._)`${we.default.valCxt}.${we.default.parentData}`),t.var(we.default.parentDataProperty,(0,ae._)`${we.default.valCxt}.${we.default.parentDataProperty}`),t.var(we.default.rootData,(0,ae._)`${we.default.valCxt}.${we.default.rootData}`),e.dynamicRef&&t.var(we.default.dynamicAnchors,(0,ae._)`${we.default.valCxt}.${we.default.dynamicAnchors}`)},()=>{t.var(we.default.instancePath,(0,ae._)`""`),t.var(we.default.parentData,(0,ae._)`undefined`),t.var(we.default.parentDataProperty,(0,ae._)`undefined`),t.var(we.default.rootData,we.default.data),e.dynamicRef&&t.var(we.default.dynamicAnchors,(0,ae._)`{}`)})}function fY(t){let{schema:e,opts:r,gen:n}=t;DD(t,()=>{r.$comment&&e.$comment&&ZD(t),yY(t),n.let(we.default.vErrors,null),n.let(we.default.errors,0),r.unevaluated&&mY(t),BD(t),wY(t)})}function mY(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,ae._)`${r}.evaluated`),e.if((0,ae._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ae._)`${t.evaluated}.props`,(0,ae._)`undefined`)),e.if((0,ae._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ae._)`${t.evaluated}.items`,(0,ae._)`undefined`))}function ND(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,ae._)`/*# sourceURL=${r} */`:ae.nil}function hY(t,e){if(UD(t)&&(FD(t),LD(t))){gY(t,e);return}(0,jD.boolOrEmptySchema)(t,e)}function LD({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function UD(t){return typeof t.schema!="boolean"}function gY(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&ZD(t),vY(t),bY(t);let i=n.const("_errs",we.default.errors);BD(t,i),n.var(e,(0,ae._)`${i} === ${we.default.errors}`)}function FD(t){(0,mi.checkUnknownRules)(t),_Y(t)}function BD(t,e){if(t.opts.jtd)return zD(t,[],!1,e);let r=(0,RD.getSchemaTypes)(t.schema),n=(0,RD.coerceAndCheckDataType)(t,r);zD(t,r,!n,e)}function _Y(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,mi.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function yY(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,mi.checkStrictMode)(t,"default is ignored in the schema root")}function vY(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,uY.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function bY(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function ZD({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,ae._)`${we.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let s=(0,ae.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,ae._)`${we.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function wY(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=t;r.$async?e.if((0,ae._)`${we.default.errors} === 0`,()=>e.return(we.default.data),()=>e.throw((0,ae._)`new ${o}(${we.default.vErrors})`)):(e.assign((0,ae._)`${n}.errors`,we.default.vErrors),i.unevaluated&&xY(t),e.return((0,ae._)`${we.default.errors} === 0`))}function xY({gen:t,evaluated:e,props:r,items:n}){r instanceof ae.Name&&t.assign((0,ae._)`${e}.props`,r),n instanceof ae.Name&&t.assign((0,ae._)`${e}.items`,n)}function zD(t,e,r,n){let{gen:o,schema:i,data:s,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,mi.schemaHasRulesButRef)(i,l))){o.block(()=>VD(t,"$ref",l.all.$ref.definition));return}c.jtd||$Y(t,e),o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,mk.shouldUseGroup)(i,f)&&(f.type?(o.if((0,ob.checkDataType)(f.type,s,c.strictNumbers)),MD(t,f),e.length===1&&e[0]===f.type&&r&&(o.else(),(0,ob.reportTypeError)(t)),o.endIf()):MD(t,f),a||o.if((0,ae._)`${we.default.errors} === ${n||0}`))}}function MD(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,cY.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,mk.shouldUseRule)(n,i)&&VD(t,i.keyword,i.definition,e.type)})}function $Y(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(IY(t,e),t.opts.allowUnionTypes||SY(t,e),kY(t,t.dataTypes))}function IY(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{qD(t.dataTypes,r)||hk(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),EY(t,e)}}function SY(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&hk(t,"use allowUnionTypes to allow union type keyword")}function kY(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,mk.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(s=>TY(e,s))&&hk(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function TY(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function qD(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function EY(t,e){let r=[];for(let n of t.dataTypes)qD(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function hk(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,mi.checkStrictMode)(t,e,t.opts.strictTypes)}var ib=class{constructor(e,r,n){if((0,Bf.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,mi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",GD(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Bf.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",we.default.errors))}result(e,r,n){this.failResult((0,ae.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,ae.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,ae._)`${r} !== undefined && (${(0,ae.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Ff.reportExtraError:Ff.reportError)(this,this.def.error,r)}$dataError(){(0,Ff.reportError)(this,this.def.$dataError||Ff.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ff.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=ae.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=ae.nil,r=ae.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:s}=this;n.if((0,ae.or)((0,ae._)`${o} === undefined`,r)),e!==ae.nil&&n.assign(e,!0),(i.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==ae.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,ae.or)(s(),a());function s(){if(n.length){if(!(r instanceof ae.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,ae._)`${(0,ob.checkDataTypes)(c,r,i.opts.strictNumbers,ob.DataType.Wrong)}`}return ae.nil}function a(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,ae._)`!${c}(${r})`}return ae.nil}}subschema(e,r){let n=(0,fk.getSubschema)(this.it,e);(0,fk.extendSubschemaData)(n,this.it,e),(0,fk.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return hY(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=mi.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=mi.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,ae.Name)),!0}};xs.KeywordCxt=ib;function VD(t,e,r,n){let o=new ib(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Bf.funcKeywordCode)(o,r):"macro"in r?(0,Bf.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Bf.funcKeywordCode)(o,r)}var AY=/^\/(?:[^~]|~0|~1)*$/,OY=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function GD(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return we.default.rootData;if(t[0]==="/"){if(!AY.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=we.default.rootData}else{let u=OY.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!o)return i}let s=i,a=o.split("/");for(let u of a)u&&(i=(0,ae._)`${i}${(0,ae.getProperty)((0,mi.unescapeJsonPointer)(u))}`,s=(0,ae._)`${s} && ${i}`);return s;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}xs.getData=GD});var sb=P(_k=>{"use strict";Object.defineProperty(_k,"__esModule",{value:!0});var gk=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};_k.default=gk});var qf=P(bk=>{"use strict";Object.defineProperty(bk,"__esModule",{value:!0});var yk=Uf(),vk=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,yk.resolveUrl)(e,r,n),this.missingSchema=(0,yk.normalizeId)((0,yk.getFullPath)(e,this.missingRef))}};bk.default=vk});var cb=P(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.resolveSchema=An.getCompilingSchema=An.resolveRef=An.compileSchema=An.SchemaEnv=void 0;var Yn=Oe(),PY=sb(),ic=fi(),Qn=Uf(),KD=Be(),CY=Zf(),Pl=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Qn.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};An.SchemaEnv=Pl;function xk(t){let e=HD.call(this,t);if(e)return e;let r=(0,Qn.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,s=new Yn.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),a;t.$async&&(a=s.scopeValue("Error",{ref:PY.default,code:(0,Yn._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");t.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:ic.default.data,parentData:ic.default.parentData,parentDataProperty:ic.default.parentDataProperty,dataNames:[ic.default.data],dataPathArr:[Yn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Yn.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Yn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Yn._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,CY.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let d=s.toString();l=`${s.scopeRefs(ic.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let p=new Function(`${ic.default.self}`,`${ic.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=u;p.evaluated={props:m instanceof Yn.Name?void 0:m,items:h instanceof Yn.Name?void 0:h,dynamicProps:m instanceof Yn.Name,dynamicItems:h instanceof Yn.Name},p.source&&(p.source.evaluated=(0,Yn.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}An.compileSchema=xk;function RY(t,e,r){var n;r=(0,Qn.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let i=MY.call(this,t,r);if(i===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(i=new Pl({schema:s,schemaId:a,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=NY.call(this,i)}An.resolveRef=RY;function NY(t){return(0,Qn.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:xk.call(this,t)}function HD(t){for(let e of this._compilations)if(zY(e,t))return e}An.getCompilingSchema=HD;function zY(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function MY(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||ab.call(this,t,e)}function ab(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Qn._getFullPath)(this.opts.uriResolver,r),o=(0,Qn.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return wk.call(this,r,t);let i=(0,Qn.normalizeId)(n),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){let a=ab.call(this,t,s);return typeof a?.schema!="object"?void 0:wk.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||xk.call(this,s),i===(0,Qn.normalizeId)(e)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,Qn.resolveUrl)(this.opts.uriResolver,o,u)),new Pl({schema:a,schemaId:c,root:t,baseId:o})}return wk.call(this,r,s)}}An.resolveSchema=ab;var jY=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function wk(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,KD.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!jY.has(a)&&u&&(e=(0,Qn.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,KD.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Qn.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=ab.call(this,n,a)}let{schemaId:s}=this.opts;if(i=i||new Pl({schema:r,schemaId:s,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var WD=P((J2e,DY)=>{DY.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Ik=P((X2e,QD)=>{"use strict";var LY=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),XD=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function $k(t){let e="",r=0,n=0;for(n=0;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var UY=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function JD(t){return t.length=0,!0}function FY(t,e,r){if(t.length){let n=$k(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function BY(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,s=!1,a=FY;for(let c=0;c7){r.error=!0;break}c>0&&t[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=JD}else{o.push(u);continue}}return o.length&&(a===JD?r.zone=o.join(""):s?n.push(o.join("")):n.push($k(o))),r.address=n.join(""),r}function YD(t){if(ZY(t,":")<2)return{host:t,isIPV6:!1};let e=BY(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function ZY(t,e){let r=0;for(let n=0;n{"use strict";var{isUUID:KY}=Ik(),HY=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,WY=["http","https","ws","wss","urn","urn:uuid"];function JY(t){return WY.indexOf(t)!==-1}function Sk(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function eL(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function tL(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function XY(t){return t.secure=Sk(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function YY(t){if((t.port===(Sk(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function QY(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(HY);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,i=kk(o);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function eQ(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,i=kk(o);i&&(t=i.serialize(t,e));let s=t,a=t.nss;return s.path=`${n||e.nid}:${a}`,e.skipEscape=!0,s}function tQ(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!KY(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function rQ(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var rL={scheme:"http",domainHost:!0,parse:eL,serialize:tL},nQ={scheme:"https",domainHost:rL.domainHost,parse:eL,serialize:tL},ub={scheme:"ws",domainHost:!0,parse:XY,serialize:YY},oQ={scheme:"wss",domainHost:ub.domainHost,parse:ub.parse,serialize:ub.serialize},iQ={scheme:"urn",parse:QY,serialize:eQ,skipNormalize:!0},sQ={scheme:"urn:uuid",parse:tQ,serialize:rQ,skipNormalize:!0},lb={http:rL,https:nQ,ws:ub,wss:oQ,urn:iQ,"urn:uuid":sQ};Object.setPrototypeOf(lb,null);function kk(t){return t&&(lb[t]||lb[t.toLowerCase()])||void 0}nL.exports={wsIsSecure:Sk,SCHEMES:lb,isValidSchemeName:JY,getSchemeHandler:kk}});var aL=P((Q2e,pb)=>{"use strict";var{normalizeIPv6:aQ,removeDotSegments:Vf,recomposeAuthority:cQ,normalizeComponentEncoding:db,isIPv4:uQ,nonSimpleDomain:lQ}=Ik(),{SCHEMES:dQ,getSchemeHandler:iL}=oL();function pQ(t,e){return typeof t=="string"?t=Oo(hi(t,e),e):typeof t=="object"&&(t=hi(Oo(t,e),e)),t}function fQ(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=sL(hi(t,n),hi(e,n),n,!0);return n.skipEscape=!0,Oo(o,n)}function sL(t,e,r,n){let o={};return n||(t=hi(Oo(t,r),r),e=hi(Oo(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Vf(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Vf(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=Vf(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=Vf(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function mQ(t,e,r){return typeof t=="string"?(t=unescape(t),t=Oo(db(hi(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Oo(db(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Oo(db(hi(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Oo(db(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Oo(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],i=iL(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let s=cQ(r);if(s!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(s),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(a=Vf(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var hQ=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function hi(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(hQ);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(uQ(n.host)===!1){let c=aQ(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let s=iL(r.scheme||n.scheme);if(!r.unicodeSupport&&(!s||!s.unicodeSupport)&&n.host&&(r.domainHost||s&&s.domainHost)&&o===!1&&lQ(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!s||s&&!s.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),s&&s.parse&&s.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Tk={SCHEMES:dQ,normalize:pQ,resolve:fQ,resolveComponent:sL,equal:mQ,serialize:Oo,parse:hi};pb.exports=Tk;pb.exports.default=Tk;pb.exports.fastUri=Tk});var uL=P(Ek=>{"use strict";Object.defineProperty(Ek,"__esModule",{value:!0});var cL=aL();cL.code='require("ajv/dist/runtime/uri").default';Ek.default=cL});var _L=P(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.CodeGen=Xt.Name=Xt.nil=Xt.stringify=Xt.str=Xt._=Xt.KeywordCxt=void 0;var gQ=Zf();Object.defineProperty(Xt,"KeywordCxt",{enumerable:!0,get:function(){return gQ.KeywordCxt}});var Cl=Oe();Object.defineProperty(Xt,"_",{enumerable:!0,get:function(){return Cl._}});Object.defineProperty(Xt,"str",{enumerable:!0,get:function(){return Cl.str}});Object.defineProperty(Xt,"stringify",{enumerable:!0,get:function(){return Cl.stringify}});Object.defineProperty(Xt,"nil",{enumerable:!0,get:function(){return Cl.nil}});Object.defineProperty(Xt,"Name",{enumerable:!0,get:function(){return Cl.Name}});Object.defineProperty(Xt,"CodeGen",{enumerable:!0,get:function(){return Cl.CodeGen}});var _Q=sb(),mL=qf(),yQ=nk(),Gf=cb(),vQ=Oe(),Kf=Uf(),fb=Lf(),Ok=Be(),lL=WD(),bQ=uL(),hL=(t,e)=>new RegExp(t,e);hL.code="new RegExp";var wQ=["removeAdditional","useDefaults","coerceTypes"],xQ=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),$Q={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},IQ={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},dL=200;function SQ(t){var e,r,n,o,i,s,a,c,u,l,d,f,p,m,h,_,v,b,x,k,T,F,J,w,Z;let oe=t.strict,Q=(e=t.code)===null||e===void 0?void 0:e.optimize,wt=Q===!0||Q===void 0?1:Q||0,dn=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:hL,pn=(o=t.uriResolver)!==null&&o!==void 0?o:bQ.default;return{strictSchema:(s=(i=t.strictSchema)!==null&&i!==void 0?i:oe)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:oe)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:oe)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:oe)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:oe)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:wt,regExp:dn}:{optimize:wt,regExp:dn},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:dL,loopEnum:(_=t.loopEnum)!==null&&_!==void 0?_:dL,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(x=t.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(k=t.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(F=t.validateSchema)!==null&&F!==void 0?F:!0,validateFormats:(J=t.validateFormats)!==null&&J!==void 0?J:!0,unicodeRegExp:(w=t.unicodeRegExp)!==null&&w!==void 0?w:!0,int32range:(Z=t.int32range)!==null&&Z!==void 0?Z:!0,uriResolver:pn}}var Hf=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...SQ(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new vQ.ValueScope({scope:{},prefixes:xQ,es5:r,lines:n}),this.logger=PQ(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,yQ.getRules)(),pL.call(this,$Q,e,"NOT SUPPORTED"),pL.call(this,IQ,e,"DEPRECATED","warn"),this._metaOpts=AQ.call(this),e.formats&&TQ.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&EQ.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),kQ.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=lL;n==="id"&&(o={...lL},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await i.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||s.call(this,f)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof mL.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,o);return this}let i;if(typeof e=="object"){let{schemaId:s}=this.opts;if(i=e[s],i!==void 0&&typeof i!="string")throw new Error(`schema ${s} must be string`)}return r=(0,Kf.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(e){let r;for(;typeof(r=fL.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Gf.SchemaEnv({schema:{},schemaId:n});if(r=Gf.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=fL.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Kf.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(RQ.call(this,n,r),!r)return(0,Ok.eachItem)(n,i=>Ak.call(this,i)),this;zQ.call(this,r);let o={...r,type:(0,fb.getJSONTypes)(r.type),schemaType:(0,fb.getJSONTypes)(r.schemaType)};return(0,Ok.eachItem)(n,o.type.length===0?i=>Ak.call(this,i,o):i=>o.type.forEach(s=>Ak.call(this,i,o,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let i=o.split("/").slice(1),s=e;for(let a of i)s=s[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=s[a];u&&l&&(s[a]=gL(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Kf.normalizeId)(s||n);let u=Kf.getSchemaRefs.call(this,e,n);return c=new Gf.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Gf.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Gf.compileSchema.call(this,e)}finally{this.opts=r}}};Hf.ValidationError=_Q.default;Hf.MissingRefError=mL.default;Xt.default=Hf;function pL(t,e,r,n="error"){for(let o in t){let i=o;i in e&&this.logger[n](`${r}: option ${o}. ${t[i]}`)}}function fL(t){return t=(0,Kf.normalizeId)(t),this.schemas[t]||this.refs[t]}function kQ(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function TQ(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function EQ(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function AQ(){let t={...this.opts};for(let e of wQ)delete t[e];return t}var OQ={log(){},warn(){},error(){}};function PQ(t){if(t===!1)return OQ;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var CQ=/^[a-z_$][a-z0-9_$:-]*$/i;function RQ(t,e){let{RULES:r}=this;if((0,Ok.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!CQ.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Ak(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=o?i.post:i.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,fb.getJSONTypes)(e.type),schemaType:(0,fb.getJSONTypes)(e.schemaType)}};e.before?NQ.call(this,s,a,e.before):s.rules.push(a),i.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function NQ(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function zQ(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=gL(e)),t.validateSchema=this.compile(e,!0))}var MQ={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function gL(t){return{anyOf:[t,MQ]}}});var yL=P(Pk=>{"use strict";Object.defineProperty(Pk,"__esModule",{value:!0});var jQ={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Pk.default=jQ});var xL=P(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.callRef=sc.getValidate=void 0;var DQ=qf(),vL=En(),qr=Oe(),Rl=fi(),bL=cb(),mb=Be(),LQ={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:i,validateName:s,opts:a,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=bL.resolveRef.call(c,u,o,r);if(l===void 0)throw new DQ.default(n.opts.uriResolver,o,r);if(l instanceof bL.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return hb(t,s,i,i.$async);let m=e.scopeValue("root",{ref:u});return hb(t,(0,qr._)`${m}.validate`,u,u.$async)}function f(m){let h=wL(t,m);hb(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,qr.stringify)(m)}:{ref:m}),_=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:qr.nil,topSchemaRef:h,errSchemaPath:r},_);t.mergeEvaluated(v),t.ok(_)}}};function wL(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,qr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}sc.getValidate=wL;function hb(t,e,r,n){let{gen:o,it:i}=t,{allErrors:s,schemaEnv:a,opts:c}=i,u=c.passContext?Rl.default.this:qr.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{o.code((0,qr._)`await ${(0,vL.callValidateCode)(t,e,u)}`),p(e),s||o.assign(m,!0)},h=>{o.if((0,qr._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),f(h),s||o.assign(m,!1)}),t.ok(m)}function d(){t.result((0,vL.callValidateCode)(t,e,u),()=>p(e),()=>f(e))}function f(m){let h=(0,qr._)`${m}.errors`;o.assign(Rl.default.vErrors,(0,qr._)`${Rl.default.vErrors} === null ? ${h} : ${Rl.default.vErrors}.concat(${h})`),o.assign(Rl.default.errors,(0,qr._)`${Rl.default.vErrors}.length`)}function p(m){var h;if(!i.opts.unevaluated)return;let _=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(i.props=mb.mergeEvaluated.props(o,_.props,i.props));else{let v=o.var("props",(0,qr._)`${m}.evaluated.props`);i.props=mb.mergeEvaluated.props(o,v,i.props,qr.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=mb.mergeEvaluated.items(o,_.items,i.items));else{let v=o.var("items",(0,qr._)`${m}.evaluated.items`);i.items=mb.mergeEvaluated.items(o,v,i.items,qr.Name)}}}sc.callRef=hb;sc.default=LQ});var $L=P(Ck=>{"use strict";Object.defineProperty(Ck,"__esModule",{value:!0});var UQ=yL(),FQ=xL(),BQ=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",UQ.default,FQ.default];Ck.default=BQ});var IL=P(Rk=>{"use strict";Object.defineProperty(Rk,"__esModule",{value:!0});var gb=Oe(),$s=gb.operators,_b={maximum:{okStr:"<=",ok:$s.LTE,fail:$s.GT},minimum:{okStr:">=",ok:$s.GTE,fail:$s.LT},exclusiveMaximum:{okStr:"<",ok:$s.LT,fail:$s.GTE},exclusiveMinimum:{okStr:">",ok:$s.GT,fail:$s.LTE}},ZQ={message:({keyword:t,schemaCode:e})=>(0,gb.str)`must be ${_b[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,gb._)`{comparison: ${_b[t].okStr}, limit: ${e}}`},qQ={keyword:Object.keys(_b),type:"number",schemaType:"number",$data:!0,error:ZQ,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,gb._)`${r} ${_b[e].fail} ${n} || isNaN(${r})`)}};Rk.default=qQ});var SL=P(Nk=>{"use strict";Object.defineProperty(Nk,"__esModule",{value:!0});var Wf=Oe(),VQ={message:({schemaCode:t})=>(0,Wf.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Wf._)`{multipleOf: ${t}}`},GQ={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:VQ,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,i=o.opts.multipleOfPrecision,s=e.let("res"),a=i?(0,Wf._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:(0,Wf._)`${s} !== parseInt(${s})`;t.fail$data((0,Wf._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};Nk.default=GQ});var TL=P(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});function kL(t){let e=t.length,r=0,n=0,o;for(;n=55296&&o<=56319&&n{"use strict";Object.defineProperty(Mk,"__esModule",{value:!0});var ac=Oe(),KQ=Be(),HQ=TL(),WQ={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,ac.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,ac._)`{limit: ${t}}`},JQ={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:WQ,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,i=e==="maxLength"?ac.operators.GT:ac.operators.LT,s=o.opts.unicode===!1?(0,ac._)`${r}.length`:(0,ac._)`${(0,KQ.useFunc)(t.gen,HQ.default)}(${r})`;t.fail$data((0,ac._)`${s} ${i} ${n}`)}};Mk.default=JQ});var AL=P(jk=>{"use strict";Object.defineProperty(jk,"__esModule",{value:!0});var XQ=En(),yb=Oe(),YQ={message:({schemaCode:t})=>(0,yb.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,yb._)`{pattern: ${t}}`},QQ={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:YQ,code(t){let{data:e,$data:r,schema:n,schemaCode:o,it:i}=t,s=i.opts.unicodeRegExp?"u":"",a=r?(0,yb._)`(new RegExp(${o}, ${s}))`:(0,XQ.usePattern)(t,n);t.fail$data((0,yb._)`!${a}.test(${e})`)}};jk.default=QQ});var OL=P(Dk=>{"use strict";Object.defineProperty(Dk,"__esModule",{value:!0});var Jf=Oe(),eee={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Jf.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Jf._)`{limit: ${t}}`},tee={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:eee,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Jf.operators.GT:Jf.operators.LT;t.fail$data((0,Jf._)`Object.keys(${r}).length ${o} ${n}`)}};Dk.default=tee});var PL=P(Lk=>{"use strict";Object.defineProperty(Lk,"__esModule",{value:!0});var Xf=En(),Yf=Oe(),ree=Be(),nee={message:({params:{missingProperty:t}})=>(0,Yf.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Yf._)`{missingProperty: ${t}}`},oee={keyword:"required",type:"object",schemaType:"array",$data:!0,error:nee,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:i,it:s}=t,{opts:a}=s;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?u():l(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let _=s.schemaEnv.baseId+s.errSchemaPath,v=`required property "${h}" is not defined at "${_}" (strictRequired)`;(0,ree.checkStrictMode)(s,v,s.opts.strictRequired)}}function u(){if(c||i)t.block$data(Yf.nil,d);else for(let p of r)(0,Xf.checkReportMissingProp)(t,p)}function l(){let p=e.let("missing");if(c||i){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,Xf.checkMissingProp)(t,r,p)),(0,Xf.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Xf.noPropertyInData)(e,o,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,Xf.propertyInData)(e,o,p,a.ownProperties)),e.if((0,Yf.not)(m),()=>{t.error(),e.break()})},Yf.nil)}}};Lk.default=oee});var CL=P(Uk=>{"use strict";Object.defineProperty(Uk,"__esModule",{value:!0});var Qf=Oe(),iee={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Qf.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Qf._)`{limit: ${t}}`},see={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:iee,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Qf.operators.GT:Qf.operators.LT;t.fail$data((0,Qf._)`${r}.length ${o} ${n}`)}};Uk.default=see});var vb=P(Fk=>{"use strict";Object.defineProperty(Fk,"__esModule",{value:!0});var RL=dk();RL.code='require("ajv/dist/runtime/equal").default';Fk.default=RL});var NL=P(Zk=>{"use strict";Object.defineProperty(Zk,"__esModule",{value:!0});var Bk=Lf(),Yt=Oe(),aee=Be(),cee=vb(),uee={message:({params:{i:t,j:e}})=>(0,Yt.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Yt._)`{i: ${t}, j: ${e}}`},lee={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:uee,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:i,schemaCode:s,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=i.items?(0,Bk.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Yt._)`${s} === false`),t.ok(c);function l(){let m=e.let("i",(0,Yt._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,Yt._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,h){let _=e.name("item"),v=(0,Bk.checkDataTypes)(u,_,a.opts.strictNumbers,Bk.DataType.Wrong),b=e.const("indices",(0,Yt._)`{}`);e.for((0,Yt._)`;${m}--;`,()=>{e.let(_,(0,Yt._)`${r}[${m}]`),e.if(v,(0,Yt._)`continue`),u.length>1&&e.if((0,Yt._)`typeof ${_} == "string"`,(0,Yt._)`${_} += "_"`),e.if((0,Yt._)`typeof ${b}[${_}] == "number"`,()=>{e.assign(h,(0,Yt._)`${b}[${_}]`),t.error(),e.assign(c,!1).break()}).code((0,Yt._)`${b}[${_}] = ${m}`)})}function p(m,h){let _=(0,aee.useFunc)(e,cee.default),v=e.name("outer");e.label(v).for((0,Yt._)`;${m}--;`,()=>e.for((0,Yt._)`${h} = ${m}; ${h}--;`,()=>e.if((0,Yt._)`${_}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Zk.default=lee});var zL=P(Vk=>{"use strict";Object.defineProperty(Vk,"__esModule",{value:!0});var qk=Oe(),dee=Be(),pee=vb(),fee={message:"must be equal to constant",params:({schemaCode:t})=>(0,qk._)`{allowedValue: ${t}}`},mee={keyword:"const",$data:!0,error:fee,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,qk._)`!${(0,dee.useFunc)(e,pee.default)}(${r}, ${o})`):t.fail((0,qk._)`${i} !== ${r}`)}};Vk.default=mee});var ML=P(Gk=>{"use strict";Object.defineProperty(Gk,"__esModule",{value:!0});var em=Oe(),hee=Be(),gee=vb(),_ee={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,em._)`{allowedValues: ${t}}`},yee={keyword:"enum",schemaType:"array",$data:!0,error:_ee,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:s}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=s.opts.loopEnum,c,u=()=>c??(c=(0,hee.useFunc)(e,gee.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let p=e.const("vSchema",i);l=(0,em.or)(...o.map((m,h)=>f(p,h)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,p=>e.if((0,em._)`${u()}(${r}, ${p})`,()=>e.assign(l,!0).break()))}function f(p,m){let h=o[m];return typeof h=="object"&&h!==null?(0,em._)`${u()}(${r}, ${p}[${m}])`:(0,em._)`${r} === ${h}`}}};Gk.default=yee});var jL=P(Kk=>{"use strict";Object.defineProperty(Kk,"__esModule",{value:!0});var vee=IL(),bee=SL(),wee=EL(),xee=AL(),$ee=OL(),Iee=PL(),See=CL(),kee=NL(),Tee=zL(),Eee=ML(),Aee=[vee.default,bee.default,wee.default,xee.default,$ee.default,Iee.default,See.default,kee.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Tee.default,Eee.default];Kk.default=Aee});var Wk=P(tm=>{"use strict";Object.defineProperty(tm,"__esModule",{value:!0});tm.validateAdditionalItems=void 0;var cc=Oe(),Hk=Be(),Oee={message:({params:{len:t}})=>(0,cc.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,cc._)`{limit: ${t}}`},Pee={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Oee,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Hk.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}DL(t,n)}};function DL(t,e){let{gen:r,schema:n,data:o,keyword:i,it:s}=t;s.items=!0;let a=r.const("len",(0,cc._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,cc._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Hk.alwaysValidSchema)(s,n)){let u=r.var("valid",(0,cc._)`${a} <= ${e.length}`);r.if((0,cc.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:Hk.Type.Num},u),s.allErrors||r.if((0,cc.not)(u),()=>r.break())})}}tm.validateAdditionalItems=DL;tm.default=Pee});var Jk=P(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});rm.validateTuple=void 0;var LL=Oe(),bb=Be(),Cee=En(),Ree={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return UL(t,"additionalItems",e);r.items=!0,!(0,bb.alwaysValidSchema)(r,e)&&t.ok((0,Cee.validateArray)(t))}};function UL(t,e,r=t.schema){let{gen:n,parentSchema:o,data:i,keyword:s,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=bb.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,LL._)`${i}.length`);r.forEach((d,f)=>{(0,bb.alwaysValidSchema)(a,d)||(n.if((0,LL._)`${u} > ${f}`,()=>t.subschema({keyword:s,schemaProp:f,dataProp:f},c)),t.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let _=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,bb.checkStrictMode)(a,_,f.strictTuples)}}}rm.validateTuple=UL;rm.default=Ree});var FL=P(Xk=>{"use strict";Object.defineProperty(Xk,"__esModule",{value:!0});var Nee=Jk(),zee={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Nee.validateTuple)(t,"items")};Xk.default=zee});var ZL=P(Yk=>{"use strict";Object.defineProperty(Yk,"__esModule",{value:!0});var BL=Oe(),Mee=Be(),jee=En(),Dee=Wk(),Lee={message:({params:{len:t}})=>(0,BL.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,BL._)`{limit: ${t}}`},Uee={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Lee,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,Mee.alwaysValidSchema)(n,e)&&(o?(0,Dee.validateAdditionalItems)(t,o):t.ok((0,jee.validateArray)(t)))}};Yk.default=Uee});var qL=P(Qk=>{"use strict";Object.defineProperty(Qk,"__esModule",{value:!0});var On=Oe(),wb=Be(),Fee={message:({params:{min:t,max:e}})=>e===void 0?(0,On.str)`must contain at least ${t} valid item(s)`:(0,On.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,On._)`{minContains: ${t}}`:(0,On._)`{minContains: ${t}, maxContains: ${e}}`},Bee={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Fee,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t,s,a,{minContains:c,maxContains:u}=n;i.opts.next?(s=c===void 0?1:c,a=u):s=1;let l=e.const("len",(0,On._)`${o}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,wb.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,wb.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,wb.alwaysValidSchema)(i,r)){let h=(0,On._)`${l} >= ${s}`;a!==void 0&&(h=(0,On._)`${h} && ${l} <= ${a}`),t.pass(h);return}i.items=!0;let d=e.name("valid");a===void 0&&s===1?p(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,On._)`${o}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),_=e.let("count",0);p(h,()=>e.if(h,()=>m(_)))}function p(h,_){e.forRange("i",0,l,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:wb.Type.Num,compositeRule:!0},h),_()})}function m(h){e.code((0,On._)`${h}++`),a===void 0?e.if((0,On._)`${h} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,On._)`${h} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,On._)`${h} >= ${s}`,()=>e.assign(d,!0)))}}};Qk.default=Bee});var KL=P(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.validateSchemaDeps=Po.validatePropertyDeps=Po.error=void 0;var eT=Oe(),Zee=Be(),nm=En();Po.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,eT.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,eT._)`{property: ${t}, + missingProperty: ${n}, + depsCount: ${e}, + deps: ${r}}`};var qee={keyword:"dependencies",type:"object",schemaType:"object",error:Po.error,code(t){let[e,r]=Vee(t);VL(t,e),GL(t,r)}};function Vee({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function VL(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let c=(0,nm.propertyInData)(r,n,s,o.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,nm.checkReportMissingProp)(t,u)}):(r.if((0,eT._)`${c} && (${(0,nm.checkMissingProp)(t,a,i)})`),(0,nm.reportMissingProp)(t,i),r.else())}}Po.validatePropertyDeps=VL;function GL(t,e=t.schema){let{gen:r,data:n,keyword:o,it:i}=t,s=r.name("valid");for(let a in e)(0,Zee.alwaysValidSchema)(i,e[a])||(r.if((0,nm.propertyInData)(r,n,a,i.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},s);t.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),t.ok(s))}Po.validateSchemaDeps=GL;Po.default=qee});var WL=P(tT=>{"use strict";Object.defineProperty(tT,"__esModule",{value:!0});var HL=Oe(),Gee=Be(),Kee={message:"property name must be valid",params:({params:t})=>(0,HL._)`{propertyName: ${t.propertyName}}`},Hee={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Kee,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,Gee.alwaysValidSchema)(o,r))return;let i=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),e.if((0,HL.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};tT.default=Hee});var nT=P(rT=>{"use strict";Object.defineProperty(rT,"__esModule",{value:!0});var xb=En(),eo=Oe(),Wee=fi(),$b=Be(),Jee={message:"must NOT have additional properties",params:({params:t})=>(0,eo._)`{additionalProperty: ${t.additionalProperty}}`},Xee={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Jee,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,$b.alwaysValidSchema)(s,r))return;let u=(0,xb.allSchemaProperties)(n.properties),l=(0,xb.allSchemaProperties)(n.patternProperties);d(),t.ok((0,eo._)`${i} === ${Wee.default.errors}`);function d(){e.forIn("key",o,_=>{!u.length&&!l.length?m(_):e.if(f(_),()=>m(_))})}function f(_){let v;if(u.length>8){let b=(0,$b.schemaRefOrVal)(s,n.properties,"properties");v=(0,xb.isOwnProperty)(e,b,_)}else u.length?v=(0,eo.or)(...u.map(b=>(0,eo._)`${_} === ${b}`)):v=eo.nil;return l.length&&(v=(0,eo.or)(v,...l.map(b=>(0,eo._)`${(0,xb.usePattern)(t,b)}.test(${_})`))),(0,eo.not)(v)}function p(_){e.code((0,eo._)`delete ${o}[${_}]`)}function m(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(_);return}if(r===!1){t.setParams({additionalProperty:_}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,$b.alwaysValidSchema)(s,r)){let v=e.name("valid");c.removeAdditional==="failing"?(h(_,v,!1),e.if((0,eo.not)(v),()=>{t.reset(),p(_)})):(h(_,v),a||e.if((0,eo.not)(v),()=>e.break()))}}function h(_,v,b){let x={keyword:"additionalProperties",dataProp:_,dataPropType:$b.Type.Str};b===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,v)}}};rT.default=Xee});var YL=P(iT=>{"use strict";Object.defineProperty(iT,"__esModule",{value:!0});var Yee=Zf(),JL=En(),oT=Be(),XL=nT(),Qee={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&XL.default.code(new Yee.KeywordCxt(i,XL.default,"additionalProperties"));let s=(0,JL.allSchemaProperties)(r);for(let d of s)i.definedProperties.add(d);i.opts.unevaluated&&s.length&&i.props!==!0&&(i.props=oT.mergeEvaluated.props(e,(0,oT.toHash)(s),i.props));let a=s.filter(d=>!(0,oT.alwaysValidSchema)(i,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,JL.propertyInData)(e,o,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};iT.default=Qee});var rU=P(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0});var QL=En(),Ib=Oe(),eU=Be(),tU=Be(),ete={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:i}=t,{opts:s}=i,a=(0,QL.allSchemaProperties)(r),c=a.filter(h=>(0,eU.alwaysValidSchema)(i,r[h]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&o.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof Ib.Name)&&(i.props=(0,tU.evaluatedPropsToName)(e,i.props));let{props:d}=i;f();function f(){for(let h of a)u&&p(h),i.allErrors?m(h):(e.var(l,!0),m(h),e.if(l))}function p(h){for(let _ in u)new RegExp(h).test(_)&&(0,eU.checkStrictMode)(i,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,_=>{e.if((0,Ib._)`${(0,QL.usePattern)(t,h)}.test(${_})`,()=>{let v=c.includes(h);v||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:tU.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,Ib._)`${d}[${_}]`,!0):!v&&!i.allErrors&&e.if((0,Ib.not)(l),()=>e.break())})})}}};sT.default=ete});var nU=P(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});var tte=Be(),rte={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,tte.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};aT.default=rte});var oU=P(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});var nte=En(),ote={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:nte.validateUnion,error:{message:"must match a schema in anyOf"}};cT.default=ote});var iU=P(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});var Sb=Oe(),ite=Be(),ste={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Sb._)`{passingSchemas: ${t.passing}}`},ate={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:ste,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,s=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(s,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let f;(0,ite.alwaysValidSchema)(o,l)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Sb._)`${c} && ${s}`).assign(s,!1).assign(a,(0,Sb._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(s,!0),e.assign(a,d),f&&t.mergeEvaluated(f,Sb.Name)})})}}};uT.default=ate});var sU=P(lT=>{"use strict";Object.defineProperty(lT,"__esModule",{value:!0});var cte=Be(),ute={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((i,s)=>{if((0,cte.alwaysValidSchema)(n,i))return;let a=t.subschema({keyword:"allOf",schemaProp:s},o);t.ok(o),t.mergeEvaluated(a)})}};lT.default=ute});var uU=P(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0});var kb=Oe(),cU=Be(),lte={message:({params:t})=>(0,kb.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,kb._)`{failingKeyword: ${t.ifClause}}`},dte={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:lte,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,cU.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=aU(n,"then"),i=aU(n,"else");if(!o&&!i)return;let s=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else o?e.if(a,u("then")):e.if((0,kb.not)(a),u("else"));t.pass(s,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let f=t.subschema({keyword:l},a);e.assign(s,a),t.mergeValidEvaluated(f,s),d?e.assign(d,(0,kb._)`${l}`):t.setParams({ifClause:l})}}}};function aU(t,e){let r=t.schema[e];return r!==void 0&&!(0,cU.alwaysValidSchema)(t,r)}dT.default=dte});var lU=P(pT=>{"use strict";Object.defineProperty(pT,"__esModule",{value:!0});var pte=Be(),fte={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,pte.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};pT.default=fte});var dU=P(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});var mte=Wk(),hte=FL(),gte=Jk(),_te=ZL(),yte=qL(),vte=KL(),bte=WL(),wte=nT(),xte=YL(),$te=rU(),Ite=nU(),Ste=oU(),kte=iU(),Tte=sU(),Ete=uU(),Ate=lU();function Ote(t=!1){let e=[Ite.default,Ste.default,kte.default,Tte.default,Ete.default,Ate.default,bte.default,wte.default,vte.default,xte.default,$te.default];return t?e.push(hte.default,_te.default):e.push(mte.default,gte.default),e.push(yte.default),e}fT.default=Ote});var pU=P(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});var kt=Oe(),Pte={message:({schemaCode:t})=>(0,kt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,kt._)`{format: ${t}}`},Cte={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Pte,code(t,e){let{gen:r,data:n,$data:o,schema:i,schemaCode:s,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,kt._)`${m}[${s}]`),_=r.let("fType"),v=r.let("format");r.if((0,kt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(_,(0,kt._)`${h}.type || "string"`).assign(v,(0,kt._)`${h}.validate`),()=>r.assign(_,(0,kt._)`"string"`).assign(v,h)),t.fail$data((0,kt.or)(b(),x()));function b(){return c.strictSchema===!1?kt.nil:(0,kt._)`${s} && !${v}`}function x(){let k=l.$async?(0,kt._)`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,kt._)`${v}(${n})`,T=(0,kt._)`(typeof ${v} == "function" ? ${k} : ${v}.test(${n}))`;return(0,kt._)`${v} && ${v} !== true && ${_} === ${e} && !${T}`}}function p(){let m=d.formats[i];if(!m){b();return}if(m===!0)return;let[h,_,v]=x(m);h===e&&t.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function x(T){let F=T instanceof RegExp?(0,kt.regexpCode)(T):c.code.formats?(0,kt._)`${c.code.formats}${(0,kt.getProperty)(i)}`:void 0,J=r.scopeValue("formats",{key:i,ref:T,code:F});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,kt._)`${J}.validate`]:["string",T,J]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,kt._)`await ${v}(${n})`}return typeof _=="function"?(0,kt._)`${v}(${n})`:(0,kt._)`${v}.test(${n})`}}}};mT.default=Cte});var fU=P(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});var Rte=pU(),Nte=[Rte.default];hT.default=Nte});var mU=P(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.contentVocabulary=Nl.metadataVocabulary=void 0;Nl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Nl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var gU=P(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});var zte=$L(),Mte=jL(),jte=dU(),Dte=fU(),hU=mU(),Lte=[zte.default,Mte.default,(0,jte.default)(),Dte.default,hU.metadataVocabulary,hU.contentVocabulary];gT.default=Lte});var yU=P(Tb=>{"use strict";Object.defineProperty(Tb,"__esModule",{value:!0});Tb.DiscrError=void 0;var _U;(function(t){t.Tag="tag",t.Mapping="mapping"})(_U||(Tb.DiscrError=_U={}))});var bU=P(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});var zl=Oe(),_T=yU(),vU=cb(),Ute=qf(),Fte=Be(),Bte={message:({params:{discrError:t,tagName:e}})=>t===_T.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,zl._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},Zte={keyword:"discriminator",type:"object",schemaType:"object",error:Bte,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:i}=t,{oneOf:s}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,zl._)`${r}${(0,zl.getProperty)(a)}`);e.if((0,zl._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:_T.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,zl._)`${u} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:_T.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(h,zl.Name),m}function f(){var p;let m={},h=v(o),_=!0;for(let k=0;k{qte.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var bT=P((lt,vT)=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.MissingRefError=lt.ValidationError=lt.CodeGen=lt.Name=lt.nil=lt.stringify=lt.str=lt._=lt.KeywordCxt=lt.Ajv=void 0;var Vte=_L(),Gte=gU(),Kte=bU(),xU=wU(),Hte=["/properties"],Eb="http://json-schema.org/draft-07/schema",Ml=class extends Vte.default{_addVocabularies(){super._addVocabularies(),Gte.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Kte.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(xU,Hte):xU;this.addMetaSchema(e,Eb,!1),this.refs["http://json-schema.org/schema"]=Eb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Eb)?Eb:void 0)}};lt.Ajv=Ml;vT.exports=lt=Ml;vT.exports.Ajv=Ml;Object.defineProperty(lt,"__esModule",{value:!0});lt.default=Ml;var Wte=Zf();Object.defineProperty(lt,"KeywordCxt",{enumerable:!0,get:function(){return Wte.KeywordCxt}});var jl=Oe();Object.defineProperty(lt,"_",{enumerable:!0,get:function(){return jl._}});Object.defineProperty(lt,"str",{enumerable:!0,get:function(){return jl.str}});Object.defineProperty(lt,"stringify",{enumerable:!0,get:function(){return jl.stringify}});Object.defineProperty(lt,"nil",{enumerable:!0,get:function(){return jl.nil}});Object.defineProperty(lt,"Name",{enumerable:!0,get:function(){return jl.Name}});Object.defineProperty(lt,"CodeGen",{enumerable:!0,get:function(){return jl.CodeGen}});var Jte=sb();Object.defineProperty(lt,"ValidationError",{enumerable:!0,get:function(){return Jte.default}});var Xte=qf();Object.defineProperty(lt,"MissingRefError",{enumerable:!0,get:function(){return Xte.default}})});var OU=P(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.formatNames=Ro.fastFormats=Ro.fullFormats=void 0;function Co(t,e){return{validate:t,compare:e}}Ro.fullFormats={date:Co(kU,IT),time:Co(xT(!0),ST),"date-time":Co($U(!0),EU),"iso-time":Co(xT(),TU),"iso-date-time":Co($U(),AU),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:nre,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:lre,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:ore,int32:{type:"number",validate:are},int64:{type:"number",validate:cre},float:{type:"number",validate:SU},double:{type:"number",validate:SU},password:!0,binary:!0};Ro.fastFormats={...Ro.fullFormats,date:Co(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,IT),time:Co(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ST),"date-time":Co(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,EU),"iso-time":Co(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,TU),"iso-date-time":Co(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,AU),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Ro.formatNames=Object.keys(Ro.fullFormats);function Yte(t){return t%4===0&&(t%100!==0||t%400===0)}var Qte=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,ere=[0,31,28,31,30,31,30,31,31,30,31,30,31];function kU(t){let e=Qte.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&Yte(r)?29:ere[n])}function IT(t,e){if(t&&e)return t>e?1:t23||l>59||t&&!a)return!1;if(o<=23&&i<=59&&s<60)return!0;let d=i-l*c,f=o-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&s<61}}function ST(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function TU(t,e){if(!(t&&e))return;let r=wT.exec(t),n=wT.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t=ire}function cre(t){return Number.isInteger(t)}function SU(){return!0}var ure=/[^\\]\\Z/;function lre(t){if(ure.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var PU=P(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.formatLimitDefinition=void 0;var dre=bT(),to=Oe(),Is=to.operators,Ab={formatMaximum:{okStr:"<=",ok:Is.LTE,fail:Is.GT},formatMinimum:{okStr:">=",ok:Is.GTE,fail:Is.LT},formatExclusiveMaximum:{okStr:"<",ok:Is.LT,fail:Is.GTE},formatExclusiveMinimum:{okStr:">",ok:Is.GT,fail:Is.LTE}},pre={message:({keyword:t,schemaCode:e})=>(0,to.str)`should be ${Ab[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,to._)`{comparison: ${Ab[t].okStr}, limit: ${e}}`};Dl.formatLimitDefinition={keyword:Object.keys(Ab),type:"string",schemaType:"string",$data:!0,error:pre,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:i}=t,{opts:s,self:a}=i;if(!s.validateFormats)return;let c=new dre.KeywordCxt(i,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),p=e.const("fmt",(0,to._)`${f}[${c.schemaCode}]`);t.fail$data((0,to.or)((0,to._)`typeof ${p} != "object"`,(0,to._)`${p} instanceof RegExp`,(0,to._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${f}" does not define "compare" function`);let m=e.scopeValue("formats",{key:f,ref:p,code:s.code.formats?(0,to._)`${s.code.formats}${(0,to.getProperty)(f)}`:void 0});t.fail$data(d(m))}function d(f){return(0,to._)`${f}.compare(${r}, ${n}) ${Ab[o].fail} 0`}},dependencies:["format"]};var fre=t=>(t.addKeyword(Dl.formatLimitDefinition),t);Dl.default=fre});var zU=P((om,NU)=>{"use strict";Object.defineProperty(om,"__esModule",{value:!0});var Ll=OU(),mre=PU(),kT=Oe(),CU=new kT.Name("fullFormats"),hre=new kT.Name("fastFormats"),TT=(t,e={keywords:!0})=>{if(Array.isArray(e))return RU(t,e,Ll.fullFormats,CU),t;let[r,n]=e.mode==="fast"?[Ll.fastFormats,hre]:[Ll.fullFormats,CU],o=e.formats||Ll.formatNames;return RU(t,o,r,n),e.keywords&&(0,mre.default)(t),t};TT.get=(t,e="full")=>{let n=(e==="fast"?Ll.fastFormats:Ll.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function RU(t,e,r,n){var o,i;(o=(i=t.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,kT._)`require("ajv-formats/dist/formats").${n}`);for(let s of e)t.addFormat(s,r[s])}NU.exports=om=TT;Object.defineProperty(om,"__esModule",{value:!0});om.default=TT});var Mb={PRETTY:4,COMPACT:0};var Ke={TRACE:6,DEBUG:8,INFO:12,WARN:16,ERROR:20,CRITICAL:24,SILENT:28},OT=["level","message","sampling_rate","service","timestamp"],PT="Uncaught error detected, flushing log buffer before exit";var ql={REQUEST_ID:Symbol.for("_AWS_LAMBDA_REQUEST_ID"),X_RAY_TRACE_ID:Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),TENANT_ID:Symbol.for("_AWS_LAMBDA_TENANT_ID")},jb=["true","1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??"");jb||(globalThis.awslambda=globalThis.awslambda||{});var sm=class{static PROTECTED_KEYS=ql;isProtectedKey(e){return Object.values(ql).includes(e)}getRequestId(){return this.get(ql.REQUEST_ID)??"-"}getXRayTraceId(){return this.get(ql.X_RAY_TRACE_ID)}getTenantId(){return this.get(ql.TENANT_ID)}},Db=class extends sm{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==void 0}get(e){return this.currentContext?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);this.currentContext=this.currentContext||{},this.currentContext[e]=r}run(e,r){this.currentContext=e;try{return r()}finally{this.currentContext=void 0}}},Lb=class t extends sm{als;static async create(){let e=new t,r=await import("node:async_hooks");return e.als=new r.AsyncLocalStorage,e}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==void 0}get(e){return this.als.getStore()?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);let n=this.als.getStore();if(!n)throw new Error("No context available");n[e]=r}run(e,r){return this.als.run(e,r)}},CT;(function(t){let e=null;async function r(){return e||(e=(async()=>{let o="AWS_LAMBDA_MAX_CONCURRENCY"in process.env?await Lb.create():new Db;return!jb&&globalThis.awslambda?.InvokeStore?globalThis.awslambda.InvokeStore:(!jb&&globalThis.awslambda&&(globalThis.awslambda.InvokeStore=o),o)})()),e}t.getInstanceAsync=r,t._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE==="1"?{reset:()=>{e=null,globalThis.awslambda?.InvokeStore&&delete globalThis.awslambda.InvokeStore,globalThis.awslambda={}}}:void 0})(CT||(CT={}));var RT="AWS_LAMBDA_MAX_CONCURRENCY",NT="POWERTOOLS_DEV";var zT="_X_AMZN_TRACE_ID";var Vr=({key:t,defaultValue:e,errorMessage:r})=>{let n=process.env[t];if(n===void 0){if(e!==void 0)return e;throw r?new Error(r):new Error(`Environment variable ${t} is required`)}return n.trim()},MT=({key:t,defaultValue:e,errorMessage:r})=>{let n=Vr({key:t,defaultValue:String(e),errorMessage:r}),o=Number(n);if(Number.isNaN(o))throw new TypeError(`Environment variable ${t} must be a number`);return o},KU=new Set(["1","y","yes","t","true","on"]),HU=new Set(["0","n","no","f","false","off"]),Ub=({key:t,defaultValue:e,errorMessage:r,extendedParsing:n})=>{let i=Vr({key:t,defaultValue:String(e),errorMessage:r}).toLowerCase();if(n){if(KU.has(i))return!0;if(HU.has(i))return!1}if(i!=="true"&&i!=="false")throw new Error(`Environment variable ${t} must be a boolean`);return i==="true"},Vl=()=>{try{return Ub({key:NT,extendedParsing:!0})}catch{return!1}};var WU=()=>{let t=globalThis.awslambda?.InvokeStore?.getXRayTraceId()??Vr({key:zT,defaultValue:""});if(t==="")return;if(!t.includes("="))return{Root:t};let e={};for(let r of t.split(";")){let[n,o]=r.split("=");e[n]=o}return e};var am=()=>Vr({key:RT,defaultValue:""})!=="",Gl=()=>WU()?.Root;var Es=class{formatError(e){let{name:r,message:n,stack:o,cause:i,...s}=e,a={name:r,location:this.getCodeLocation(e.stack),message:n,stack:Vl()&&typeof o=="string"?o?.split(` +`):o,cause:i instanceof Error?this.formatError(i):i};for(let c in e)typeof c=="string"&&!["name","message","stack","cause"].includes(c)&&(a[c]=s[c]);return a}formatTimestamp(e){let n=Vr({key:"TZ",defaultValue:""});return n&&!n.includes("UTC")?this.#r(e,n):e.toISOString()}getCodeLocation(e){if(!e)return"";let r=e.split(` +`),n=/\(([^()]*?):(\d+?):(\d+?)\)\\?$/;for(let o of r){let i=n.exec(o);if(Array.isArray(i))return`${i[1]}:${Number(i[2])}`}return""}#e=e=>{let r="2-digit",n=Intl.supportedValuesOf("timeZone").includes(e)?e:"UTC";return new Intl.DateTimeFormat("en",{hourCycle:"h23",year:"numeric",month:r,day:r,hour:r,minute:r,second:r,timeZone:n})};#r(e,r){let{year:n,month:o,day:i,hour:s,minute:a,second:c}=this.#e(r).formatToParts(e).reduce((_,v)=>(_[v.type]=v.value,_),{}),u=`${n}-${o}-${i}T${s}:${a}:${c}`,l=-e.getTimezoneOffset(),d=l>=0?"+":"-",f=Math.abs(Math.floor(l/60)).toString().padStart(2,"0"),p=Math.abs(l%60).toString().padStart(2,"0"),m=e.getMilliseconds().toString().padStart(3,"0"),h=`${d}${f}:${p}`;return`${u}.${m}${h}`}};var dE=mn(Xb(),1),_i=class{attributes={};constructor(e){this.setAttributes(e.attributes)}addAttributes(e){return(0,dE.default)(this.attributes,e),this}getAttributes(){return this.attributes}prepareForPrint(){this.attributes=this.removeEmptyKeys(this.getAttributes())}removeEmptyKeys(e){let r={};for(let n in e)e[n]!==void 0&&e[n]!==""&&e[n]!==null&&(r[n]=e[n]);return r}setAttributes(e){this.attributes=e}};import{Console as B2}from"node:console";import{randomInt as Z2}from"node:crypto";var Yl="2.29.0";var Rre=process.env.AWS_EXECUTION_ENV||"NA";var gm="powertools-for-aws",pE=`${gm}.tracer`,fE=`${gm}.metrics`,mE=`${gm}.logger`,hE=`${gm}.idempotency`;var Yb=t=>typeof t=="string";var gE=t=>Object.is(t,null),Qb=t=>gE(t)||Object.is(t,void 0);var Ql=class{#e;coldStart=!0;defaultServiceName="service_undefined";constructor(){this.#e=this.getInitializationType(),this.#e!=="on-demand"&&(this.coldStart=!1)}getInitializationType(){let e=process.env.AWS_LAMBDA_INITIALIZATION_TYPE?.trim();return e==="on-demand"?"on-demand":e==="provisioned-concurrency"?"provisioned-concurrency":"unknown"}getColdStart(){return this.#e!=="on-demand"?!1:this.coldStart?(this.coldStart=!1,!0):!1}isValidServiceName(e){return typeof e=="string"&&e.trim().length>0}};var _E=process.env.AWS_EXECUTION_ENV||"NA";process.env.AWS_SDK_UA_APP_ID?process.env.AWS_SDK_UA_APP_ID=`${process.env.AWS_SDK_UA_APP_ID}/PT/NO-OP/${Yl}/PTEnv/${_E}`:process.env.AWS_SDK_UA_APP_ID=`PT/NO-OP/${Yl}/PTEnv/${_E}`;var bm=mn(Xb(),1);var _m=class extends Es{#e;constructor(e){super(),this.#e=e?.logRecordOrder}formatAttributes(e,r){let n={level:e.logLevel,message:e.message,timestamp:this.formatTimestamp(e.timestamp),service:e.serviceName,cold_start:e.lambdaContext?.coldStart,function_arn:e.lambdaContext?.invokedFunctionArn,function_memory_size:e.lambdaContext?.memoryLimitInMB,function_name:e.lambdaContext?.functionName,function_request_id:e.lambdaContext?.awsRequestId,sampling_rate:e.sampleRateValue,xray_trace_id:e.xRayTraceId};if(this.#e===void 0)return new _i({attributes:n}).addAttributes(r);let o={};for(let s of this.#e)s in n&&!(s in o)?o[s]=n[s]:s in r&&!(s in o)&&(o[s]=r[s]);for(let s in n)s in o||(o[s]=n[s]);for(let s in r)s in o||(o[s]=r[s]);return new _i({attributes:o})}};var ym=class{#e=Symbol("powertools.logger.temporaryAttributes");#r=Symbol("powertools.logger.keys");#i={};#c=new Map;#n={};#o(){if(!am())return this.#i;if(globalThis.awslambda?.InvokeStore===void 0)throw new Error("InvokeStore is not available");let e=globalThis.awslambda.InvokeStore,r=e.get(this.#e);return r==null&&(r={},e.set(this.#e,r)),r}#t(){if(!am())return this.#c;if(globalThis.awslambda?.InvokeStore===void 0)throw new Error("InvokeStore is not available");let e=globalThis.awslambda.InvokeStore,r=e.get(this.#r);return r==null&&(r=new Map,e.set(this.#r,r)),r}appendTemporaryKeys(e){let r=this.#o(),n=this.#t();for(let[o,i]of Object.entries(e))r[o]=i,n.set(o,"temp")}removeTemporaryKeys(e){let r=this.#o(),n=this.#t();for(let o of e)r[o]=void 0,this.#n[o]?n.set(o,"persistent"):n.delete(o)}getTemporaryAttributes(){return{...this.#o()}}clearTemporaryAttributes(){let e=this.#o(),r=this.#t();for(let n of Object.keys(e))this.#n[n]?r.set(n,"persistent"):r.delete(n);if(!am()){this.#i={};return}globalThis.awslambda.InvokeStore?.set(this.#e,{})}setPersistentAttributes(e){let r=this.#t();this.#n={...e};for(let n of Object.keys(e))r.set(n,"persistent")}getPersistentAttributes(){return{...this.#n}}getAllAttributes(){let e={},r=this.#o(),n=this.#t();for(let[o,i]of Object.entries(this.#n))i!==void 0&&(e[o]=i);for(let[o,i]of n.entries())i==="temp"&&r[o]!==void 0&&(e[o]=r[o]);return e}removePersistentKeys(e){let r=this.#t(),n=this.#o();for(let o of e)this.#n[o]=void 0,n[o]?r.set(o,"temp"):r.delete(o)}};var ew=class{value;logLevel;byteSize;constructor(e,r){if(!Yb(e))throw new Error("Value should be a string");this.value=e,this.logLevel=r,this.byteSize=Buffer.byteLength(e)}},tw=class extends Set{currentBytesSize=0;hasEvictedLog=!1;add(e){return this.currentBytesSize+=e.byteSize,super.add(e),this}delete(e){let r=super.delete(e);return r&&(this.currentBytesSize-=e.byteSize),r}clear(){super.clear(),this.currentBytesSize=0}shift(){let e=this.values().next().value;return e&&this.delete(e),e}},vm=class extends Map{#e;#r;constructor({maxBytesSize:e,onBufferOverflow:r}){super(),this.#e=e,this.#r=r}setItem(e,r,n){let o=new ew(r,n);if(o.byteSize>this.#e)throw new Error("Item too big");let i=this.get(e)||new tw;return i.currentBytesSize!==0&&i.currentBytesSize+o.byteSize>=this.#e&&(this.#i(i,o),this.#r&&this.#r()),i.add(o),super.set(e,i),this}#i(e,r){for(;e.size!==0&&e.currentBytesSize+r.byteSize>=this.#e;)e.shift(),e.hasEvictedLog=!0}};var ed=class t extends Ql{console;customConfigService;logEvent=!1;logFormatter;logIndentation=Mb.COMPACT;logLevel=Ke.INFO;#e;powertoolsLogData={sampleRateValue:0};#r=new ym;#i=[];#c=!1;#n=Ke.INFO;#o;#t={enabled:!1,flushOnErrorLog:!0,maxBytes:20480,bufferAtVerbosity:Ke.DEBUG};#s;#u;#a={sampleRateValue:0,refreshedTimes:0};#p=new Map;get level(){return this.logLevel}constructor(e={}){super();let{customConfigService:r,...n}=e;this.customConfigService=r||void 0,this.setOptions(n),this.#c=!0;for(let[o,i]of this.#i)this.printLog(o,this.createAndPopulateLogItem(...i));this.#i=[]}addContext(e){this.addToPowertoolsLogData({lambdaContext:{invokedFunctionArn:e.invokedFunctionArn,coldStart:this.getColdStart(),awsRequestId:e.awsRequestId,memoryLimitInMB:e.memoryLimitInMB,functionName:e.functionName,functionVersion:e.functionVersion}})}addPersistentLogAttributes(e){this.appendPersistentKeys(e)}appendKeys(e){this.#m(e,"temp")}appendPersistentKeys(e){this.#m(e,"persistent")}createChild(e={}){let r="persistentLogAttributes"in e&&!("persistentKeys"in e)?"persistentLogAttributes":"persistentKeys",n=this.createLogger((0,bm.default)({},{logLevel:this.getLevelName(),serviceName:this.powertoolsLogData.serviceName,sampleRateValue:this.#a.sampleRateValue,logFormatter:this.getLogFormatter(),customConfigService:this.getCustomConfigService(),environment:this.powertoolsLogData.environment,[r]:this.#r.getPersistentAttributes(),jsonReplacerFn:this.#o,correlationIdSearchFn:this.#u,...this.#t.enabled&&{logBufferOptions:{maxBytes:this.#t.maxBytes,bufferAtVerbosity:this.getLogLevelNameFromNumber(this.#t.bufferAtVerbosity),flushOnErrorLog:this.#t.flushOnErrorLog}}},e));this.powertoolsLogData.lambdaContext&&n.addContext(this.powertoolsLogData.lambdaContext);let o=this.#r.getTemporaryAttributes();return Object.keys(o).length>0&&n.appendKeys(o),n}critical(e,...r){this.processLogItem(Ke.CRITICAL,e,r)}debug(e,...r){this.processLogItem(Ke.DEBUG,e,r)}error(e,...r){this.#t.enabled&&this.#t.flushOnErrorLog&&this.flushBuffer(),this.processLogItem(Ke.ERROR,e,r)}getLevelName(){return this.getLogLevelNameFromNumber(this.logLevel)}getLogEvent(){return this.logEvent}getPersistentLogAttributes(){return this.#r.getPersistentAttributes()}info(e,...r){this.processLogItem(Ke.INFO,e,r)}injectLambdaContext(e){return(r,n,o)=>{let i=o.value,s=this;o.value=async function(...a){s.refreshSampleRateCalculation(),s.addContext(a[1]),s.logEventIfEnabled(a[0],e?.logEvent),e?.correlationIdPath&&s.setCorrelationId(a[0],e?.correlationIdPath);try{return await i.apply(this,a)}catch(c){throw e?.flushBufferOnUncaughtError&&(s.flushBuffer(),s.error({message:PT,error:c})),c}finally{(e?.clearState||e?.resetKeys)&&s.resetKeys(),s.clearBuffer()}}}}static injectLambdaContextAfterOrOnError(e,r,n){n&&(n.clearState||n?.resetKeys)&&e.resetKeys()}static injectLambdaContextBefore(e,r,n,o){e.addContext(n),e.logEventIfEnabled(r,o?.logEvent)}logEventIfEnabled(e,r){this.shouldLogEvent(r)&&this.info("Lambda invocation event",{event:e})}refreshSampleRateCalculation(){if(this.#a.refreshedTimes===0){this.#a.refreshedTimes++;return}this.#h()&&this.logLevel>Ke.TRACE?(this.setLogLevel("DEBUG"),this.debug("Setting log level to DEBUG due to sampling rate")):this.setLogLevel(this.getLogLevelNameFromNumber(this.#n))}removeKeys(e){this.#r.removeTemporaryKeys(e)}removePersistentKeys(e){this.#r.removePersistentKeys(e)}removePersistentLogAttributes(e){this.removePersistentKeys(e)}resetKeys(){this.#r.clearTemporaryAttributes()}setLogLevel(e){if(!this.awsLogLevelShortCircuit(e))if(this.isValidLogLevel(e))this.logLevel=Ke[e];else throw new Error(`Invalid log level: ${e}`)}setPersistentLogAttributes(e){let r=this.#f(e);this.#r.setPersistentAttributes(r)}get persistentLogAttributes(){return this.#r.getPersistentAttributes()}shouldLogEvent(e){return typeof e=="boolean"?e:this.getLogEvent()}trace(e,...r){this.processLogItem(Ke.TRACE,e,r)}warn(e,...r){this.processLogItem(Ke.WARN,e,r)}#l(e){this.#p.has(e)||(this.#p.set(e,!0),this.warn(e))}createLogger(e){return new t(e)}getJsonReplacer(){let e=new WeakSet;return(r,n)=>{let o=n;if(this.#o&&(o=this.#o?.(r,o)),o instanceof Error&&(o=this.getLogFormatter().formatError(o)),typeof o=="bigint")return o.toString();if(typeof o=="object"&&o!==null){if(e.has(o))return;e.add(o)}return o}}addToPowertoolsLogData(e){(0,bm.default)(this.powertoolsLogData,e)}#f(e){let r={};for(let[n,o]of Object.entries(e))this.#d(n)||(r[n]=o);return r}#m(e,r){let n=this.#f(e);if(r==="temp")this.#r.appendTemporaryKeys(n);else{let o=this.#r.getPersistentAttributes();this.#r.setPersistentAttributes((0,bm.default)(o,n))}}awsLogLevelShortCircuit(e){return this.#e!==void 0?(this.logLevel=Ke[this.#e],this.isValidLogLevel(e)&&this.logLevel>Ke[e]&&this.#l(`Current log level (${e}) does not match AWS Lambda Advanced Logging Controls minimum log level (${this.#e}). This can lead to data loss, consider adjusting them.`),!0):!1}createAndPopulateLogItem(e,r,n){let o={logLevel:this.getLogLevelNameFromNumber(e),timestamp:new Date,xRayTraceId:Gl(),...this.getPowertoolsLogData(),message:""},i=this.#r.getAllAttributes();return this.#g(r,o,i),this.#_(n,i),this.getLogFormatter().formatAttributes(o,i)}#g(e,r,n){if(typeof e=="string"){r.message=e;return}let{message:o,...i}=e;r.message=o;for(let[s,a]of Object.entries(i))this.#d(s)||(n[s]=a)}#_(e,r){for(let n of e)Qb(n)||(n instanceof Error?r.error=n:typeof n=="string"?r.extra=n:this.#y(n,r))}#y(e,r){for(let[n,o]of Object.entries(e))this.#d(n)||(r[n]=o)}#h(){return this.#a.sampleRateValue&&Z2(0,100)/100<=this.#a.sampleRateValue}#d(e){return OT.includes(e)?(this.warn(`The key "${e}" is a reserved key and will be dropped.`),!0):!1}getCustomConfigService(){return this.customConfigService}getLogFormatter(){return this.logFormatter}getLogLevelNameFromNumber(e){let r;for(let[n,o]of Object.entries(Ke))if(o===e){r=n;break}return r}getPowertoolsLogData(){return this.powertoolsLogData}isValidLogLevel(e){return typeof e=="string"&&e in Ke}isValidSampleRate(e){return typeof e=="number"&&0<=e&&e<=1}printLog(e,r){r.prepareForPrint();let n=e===Ke.CRITICAL?"error":this.getLogLevelNameFromNumber(e).toLowerCase();this.console[n](JSON.stringify(r.getAttributes(),this.getJsonReplacer(),this.logIndentation))}processLogItem(e,r,n){let o=Gl();if(o!==void 0&&this.shouldBufferLog(o,e)){try{this.bufferLogItem(o,this.createAndPopulateLogItem(e,r,n),e)}catch(i){this.printLog(Ke.WARN,this.createAndPopulateLogItem(Ke.WARN,`Unable to buffer log: ${i.message}`,[i])),this.printLog(e,this.createAndPopulateLogItem(e,r,n))}return}e>=this.logLevel&&(this.#c?this.printLog(e,this.createAndPopulateLogItem(e,r,n)):this.#i.push([e,[e,r,n]]))}setConsole(){Vl()?this.console=console:this.console=new B2({stdout:process.stdout,stderr:process.stderr}),this.console.trace=(e,...r)=>{this.console.log(e,...r)}}setInitialLogLevel(e){let r=e?.toUpperCase();if(this.awsLogLevelShortCircuit(r)){this.#n=this.logLevel;return}if(this.isValidLogLevel(r)){this.logLevel=Ke[r],this.#n=this.logLevel;return}let n=this.getCustomConfigService()?.getLogLevel()?.toUpperCase();if(this.isValidLogLevel(n)){this.logLevel=Ke[n],this.#n=this.logLevel;return}let o=Vr({key:"POWERTOOLS_LOG_LEVEL",defaultValue:""}),i=Vr({key:"LOG_LEVEL",defaultValue:""}),s=o!==""?o:i;this.isValidLogLevel(s)&&(this.logLevel=Ke[s],this.#n=this.logLevel)}setInitialSampleRate(e){let r=e,n=this.getCustomConfigService()?.getSampleRateValue(),o=MT({key:"POWERTOOLS_LOGGER_SAMPLE_RATE",defaultValue:0});for(let i of[r,n,o])if(this.isValidSampleRate(i)){this.#a.sampleRateValue=i,this.powertoolsLogData.sampleRateValue=i,this.#h()&&this.logLevel>Ke.TRACE&&(this.setLogLevel("DEBUG"),this.debug("Setting log level to DEBUG due to sampling rate"));break}}setLogEvent(){this.logEvent=Ub({key:"POWERTOOLS_LOGGER_LOG_EVENT",defaultValue:!1})}setLogFormatter(e,r){this.logFormatter=e??new _m({logRecordOrder:r})}setLogIndentation(){Vl()&&(this.logIndentation=Mb.PRETTY)}setOptions(e){let{logLevel:r,serviceName:n,sampleRateValue:o,logFormatter:i,persistentKeys:s,persistentLogAttributes:a,environment:c,jsonReplacerFn:u,logRecordOrder:l,logBufferOptions:d,correlationIdSearchFn:f}=e;a&&Object.keys(a).length>0&&s&&Object.keys(s).length>0&&this.warn("Both persistentLogAttributes and persistentKeys options were provided. Using persistentKeys as persistentLogAttributes is deprecated and will be removed in future releases"),this.setPowertoolsLogData(n,c,s||a);let p=Vr({key:"AWS_LAMBDA_LOG_LEVEL",defaultValue:""}),m=p==="FATAL"?"CRITICAL":p;return this.isValidLogLevel(m)&&(this.#e=m),this.setLogEvent(),this.setInitialLogLevel(r),this.setInitialSampleRate(o),this.setLogFormatter(i,l),this.setConsole(),this.setLogIndentation(),this.#o=u,this.#v(d),this.#u=f,this}setPowertoolsLogData(e,r,n){this.addToPowertoolsLogData({awsRegion:Vr({key:"AWS_REGION",defaultValue:""}),environment:r||this.getCustomConfigService()?.getCurrentEnvironment()||Vr({key:"ENVIRONMENT",defaultValue:""}),serviceName:e||this.getCustomConfigService()?.getServiceName()||Vr({key:"POWERTOOLS_SERVICE_NAME",defaultValue:""})||this.defaultServiceName}),n&&this.appendPersistentKeys(n)}#v(e){if(e===void 0||(this.#t.enabled=e?.enabled!==!1,this.#t.enabled===!1))return;e?.maxBytes!==void 0&&(this.#t.maxBytes=e.maxBytes),this.#s=new vm({maxBytesSize:this.#t.maxBytes}),e?.flushOnErrorLog===!1&&(this.#t.flushOnErrorLog=!1);let r=e?.bufferAtVerbosity?.toUpperCase();this.isValidLogLevel(r)&&(this.#t.bufferAtVerbosity=Ke[r]),this.#e!==void 0&&Ke[this.#e]>this.#t.bufferAtVerbosity&&this.#l("Advanced Loggging Controls (ALC) Log Level is less verbose than Log Buffering Log Level. Buffered logs will be filtered by ALC")}bufferLogItem(e,r,n){r.prepareForPrint(),this.#s?.has(e)===!1&&this.#s?.clear(),this.#s?.setItem(e,JSON.stringify(r.getAttributes(),this.getJsonReplacer(),this.logIndentation),n)}flushBuffer(){let e=Gl();if(e===void 0)return;let r=this.#s?.get(e);if(r!==void 0){for(let n of r){let o=this.getLogLevelNameFromNumber(n.logLevel).toLowerCase();this.console[o](n.value)}r.hasEvictedLog&&this.printLog(Ke.WARN,this.createAndPopulateLogItem(Ke.WARN,"Some logs are not displayed because they were evicted from the buffer. Increase buffer size to store more logs in the buffer",[])),this.#e!==void 0&&Ke[this.#e]>this.#t.bufferAtVerbosity&&this.#l("Advanced Loggging Controls (ALC) Log Level is less verbose than Log Buffering Log Level. Some logs might be missing."),this.#s?.delete(e)}}clearBuffer(){let e=Gl();e!==void 0&&this.#s?.delete(e)}shouldBufferLog(e,r){return this.#t.enabled&&e!==void 0&&r<=this.#t.bufferAtVerbosity}setCorrelationId(e,r){if(typeof r=="string"){if(!this.#u){this.#l("correlationIdPath is set but no search function was provided. The correlation ID will not be added to the log attributes.");return}let n=this.#u(r,e);n&&this.appendKeys({correlation_id:n});return}this.appendKeys({correlation_id:e})}getCorrelationId(){return this.#r.getTemporaryAttributes().correlation_id}};var rw=class extends Es{formatAttributes(e,r){let n={logLevel:e.logLevel,timestamp:this.formatTimestamp(e.timestamp),message:e.message},o=new _i({attributes:n});return o.addAttributes(r),o}},wm=new ed({logFormatter:new rw});function ce(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function S(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var nw=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return nw=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function td(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var rd=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var V=class extends Error{},Pt=class t extends V{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("x-request-id"),this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new yi({message:n,cause:rd(r)});let i=r?.error;return e===400?new fc(e,i,n,o):e===401?new mc(e,i,n,o):e===403?new hc(e,i,n,o):e===404?new gc(e,i,n,o):e===409?new _c(e,i,n,o):e===422?new yc(e,i,n,o):e===429?new vc(e,i,n,o):e>=500?new bc(e,i,n,o):new t(e,i,n,o)}},xt=class extends Pt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},yi=class extends Pt{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Do=class extends yi{constructor({message:e}={}){super({message:e??"Request timed out."})}},fc=class extends Pt{},mc=class extends Pt{},hc=class extends Pt{},gc=class extends Pt{},_c=class extends Pt{},yc=class extends Pt{},vc=class extends Pt{},bc=class extends Pt{},wc=class extends V{constructor(){super("Could not parse response content as the length limit was reached")}},xc=class extends V{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},ro=class extends Error{constructor(e){super(e)}};var V2=/^[a-z][a-z0-9+.-]*:/i,yE=t=>V2.test(t),Qt=t=>(Qt=Array.isArray,Qt(t)),ow=Qt;function iw(t){return typeof t!="object"?{}:t??{}}function vE(t){if(!t)return!0;for(let e in t)return!1;return!0}function bE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function nd(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var wE=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new V(`${t} must be an integer`);if(e<0)throw new V(`${t} must be a positive integer`);return e};var xE=t=>{try{return JSON.parse(t)}catch{return}};var no=t=>new Promise(e=>setTimeout(e,t));var vi="6.10.0";var kE=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function G2(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var K2=()=>{let t=G2();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":IE(Deno.build.os),"X-Stainless-Arch":$E(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":IE(globalThis.process.platform??"unknown"),"X-Stainless-Arch":$E(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=H2();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function H2(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,s=n[3]||0;return{browser:e,version:`${o}.${i}.${s}`}}}return null}var $E=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",IE=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),SE,TE=()=>SE??(SE=K2());function EE(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function sw(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function xm(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return sw({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function aw(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function AE(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var OE=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var $m="RFC3986",cw=t=>String(t),Im={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:cw},uw="RFC1738";var Sm=(t,e)=>(Sm=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Sm(t,e)),oo=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var lw=1024,PE=(t,e,r,n,o)=>{if(t.length===0)return t;let i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a=lw?i.slice(a,a+lw):i,u=[];for(let l=0;l=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===uw&&(d===40||d===41)){u[u.length]=c.charAt(l);continue}if(d<128){u[u.length]=oo[d];continue}if(d<2048){u[u.length]=oo[192|d>>6]+oo[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=oo[224|d>>12]+oo[128|d>>6&63]+oo[128|d&63];continue}l+=1,d=65536+((d&1023)<<10|c.charCodeAt(l)&1023),u[u.length]=oo[240|d>>18]+oo[128|d>>12&63]+oo[128|d>>6&63]+oo[128|d&63]}s+=u.join("")}return s};function CE(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function dw(t,e){if(Qt(t)){let r=[];for(let n=0;n"u"&&(k=0)}if(typeof u=="function"?b=u(e,b):b instanceof Date?b=f?.(b):r==="comma"&&Qt(b)&&(b=dw(b,function(oe){return oe instanceof Date?f?.(oe):oe})),b===null){if(i)return c&&!h?c(e,Ct.encoder,_,"key",p):e;b=""}if(X2(b)||CE(b)){if(c){let oe=h?e:c(e,Ct.encoder,_,"key",p);return[m?.(oe)+"="+m?.(c(b,Ct.encoder,_,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let F=[];if(typeof b>"u")return F;let J;if(r==="comma"&&Qt(b))h&&c&&(b=dw(b,c)),J=[{value:b.length>0?b.join(",")||null:void 0}];else if(Qt(u))J=u;else{let oe=Object.keys(b);J=l?oe.sort(l):oe}let w=a?String(e).replace(/\./g,"%2E"):String(e),Z=n&&Qt(b)&&b.length===1?w+"[]":w;if(o&&Qt(b)&&b.length===0)return Z+"[]";for(let oe=0;oe"u"?t.encodeDotInKeys?!0:Ct.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Ct.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Ct.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Ct.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Ct.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Ct.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Ct.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Ct.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Ct.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Ct.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Ct.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Ct.strictNullHandling}}function fw(t,e={}){let r=t,n=Y2(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Qt(n.filter)&&(i=n.filter,o=i);let s=[];if(typeof r!="object"||r===null)return"";let a=NE[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);let u=new WeakMap;for(let f=0;f0?d+l:""}function LE(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}var jE;function $c(t){let e;return(jE??(e=new globalThis.TextEncoder,jE=e.encode.bind(e)))(t)}var DE;function mw(t){let e;return(DE??(e=new globalThis.TextDecoder,DE=e.decode.bind(e)))(t)}var Gr,Kr,Cs=class{constructor(){Gr.set(this,void 0),Kr.set(this,void 0),ce(this,Gr,new Uint8Array,"f"),ce(this,Kr,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?$c(e):e;ce(this,Gr,LE([S(this,Gr,"f"),r]),"f");let n=[],o;for(;(o=eF(S(this,Gr,"f"),S(this,Kr,"f")))!=null;){if(o.carriage&&S(this,Kr,"f")==null){ce(this,Kr,o.index,"f");continue}if(S(this,Kr,"f")!=null&&(o.index!==S(this,Kr,"f")+1||o.carriage)){n.push(mw(S(this,Gr,"f").subarray(0,S(this,Kr,"f")-1))),ce(this,Gr,S(this,Gr,"f").subarray(S(this,Kr,"f")),"f"),ce(this,Kr,null,"f");continue}let i=S(this,Kr,"f")!==null?o.preceding-1:o.preceding,s=mw(S(this,Gr,"f").subarray(0,i));n.push(s),ce(this,Gr,S(this,Gr,"f").subarray(o.index),"f"),ce(this,Kr,null,"f")}return n}flush(){return S(this,Gr,"f").length?this.decode(` +`):[]}};Gr=new WeakMap,Kr=new WeakMap;Cs.NEWLINE_CHARS=new Set([` +`,"\r"]);Cs.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function eF(t,e){for(let o=e??0;o{if(t){if(bE(Tm,t))return t;$t(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Tm))}`)}};function od(){}function km(t,e,r){return!e||Tm[t]>Tm[r]?od:e[t].bind(e)}var tF={error:od,warn:od,info:od,debug:od},FE=new WeakMap;function $t(t){let e=t.logger,r=t.logLevel??"off";if(!e)return tF;let n=FE.get(e);if(n&&n[0]===r)return n[1];let o={error:km("error",e,r),warn:km("warn",e,r),info:km("info",e,r),debug:km("debug",e,r)};return FE.set(e,[r,o]),o}var Lo=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var id,io=class t{constructor(e,r,n){this.iterator=e,id.set(this,void 0),this.controller=r,ce(this,id,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?$t(n):console;async function*s(){if(o)throw new V("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let c of rF(e,r))if(!a){if(c.data.startsWith("[DONE]")){a=!0;continue}if(c.event===null||!c.event.startsWith("thread.")){let u;try{u=JSON.parse(c.data)}catch(l){throw i.error("Could not parse message into JSON:",c.data),i.error("From chunk:",c.raw),l}if(u&&u.error)throw new Pt(void 0,u.error,void 0,e.headers);yield u}else{let u;try{u=JSON.parse(c.data)}catch(l){throw console.error("Could not parse message into JSON:",c.data),console.error("From chunk:",c.raw),l}if(c.event=="error")throw new Pt(void 0,u.error,u.message,void 0);yield{event:c.event,data:u}}}a=!0}catch(c){if(td(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*i(){let a=new Cs,c=aw(e);for await(let u of c)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*s(){if(o)throw new V("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let c of i())a||c&&(yield JSON.parse(c));a=!0}catch(c){if(td(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}[(id=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let s=n.next();e.push(s),r.push(s)}return i.shift()}});return[new t(()=>o(e),this.controller,S(this,id,"f")),new t(()=>o(r),this.controller,S(this,id,"f"))]}toReadableStream(){let e=this,r;return sw({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:i}=await r.next();if(i)return n.close();let s=$c(JSON.stringify(o)+` +`);n.enqueue(s)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};async function*rF(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new V("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new V("Attempted to iterate over a response with no body");let r=new gw,n=new Cs,o=aw(t.body);for await(let i of nF(o))for(let s of n.decode(i)){let a=r.decode(s);a&&(yield a)}for(let i of n.flush()){let s=r.decode(i);s&&(yield s)}}async function*nF(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?$c(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=UE(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var gw=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(` +`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=oF(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function oF(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function Em(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,s=await(async()=>{if(e.options.stream)return $t(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):io.fromSSEResponse(r,e.controller,t);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let c=r.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){let d=await r.json();return _w(d,r)}return await r.text()})();return $t(t).debug(`[${n}] response parsed`,Lo({retryOfRequestLogID:o,url:r.url,status:r.status,body:s,durationMs:Date.now()-i})),s}function _w(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var sd,Rs=class t extends Promise{constructor(e,r,n=Em){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,sd.set(this,void 0),ce(this,sd,e,"f")}_thenUnwrap(e){return new t(S(this,sd,"f"),this.responsePromise,async(r,n)=>_w(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(S(this,sd,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};sd=new WeakMap;var Am,ad=class{constructor(e,r,n,o){Am.set(this,void 0),ce(this,Am,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new V("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await S(this,Am,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Am=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},cd=class extends Rs{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await Em(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},so=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},ke=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),r=e[e.length-1]?.id;return r?{...this.options,query:{...iw(this.options.query),after:r}}:null}},Uo=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1,this.last_id=n.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.last_id;return e?{...this.options,query:{...iw(this.options.query),after:e}}:null}};var bw=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Ic(t,e,r){return bw(),new File(t,e??"unknown_file",r)}function ud(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}var Om=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",ww=async(t,e)=>yw(t.body)?{...t,body:await ZE(t.body,e)}:t,Hr=async(t,e)=>({...t,body:await ZE(t.body,e)}),BE=new WeakMap;function sF(t){let e=typeof t=="function"?t:t.fetch,r=BE.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new o(i).text()}catch{return!0}})();return BE.set(e,n),n}var ZE=async(t,e)=>{if(!await sF(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>vw(r,n,o))),r},qE=t=>t instanceof Blob&&"name"in t,aF=t=>typeof t=="object"&&t!==null&&(t instanceof Response||Om(t)||qE(t)),yw=t=>{if(aF(t))return!0;if(Array.isArray(t))return t.some(yw);if(t&&typeof t=="object"){for(let e in t)if(yw(t[e]))return!0}return!1},vw=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response)t.append(e,Ic([await r.blob()],ud(r)));else if(Om(r))t.append(e,Ic([await new Response(xm(r)).blob()],ud(r)));else if(qE(r))t.append(e,r,ud(r));else if(Array.isArray(r))await Promise.all(r.map(n=>vw(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>vw(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var VE=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",cF=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&VE(t),uF=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";async function ld(t,e,r){if(bw(),t=await t,cF(t))return t instanceof File?t:Ic([await t.arrayBuffer()],t.name);if(uF(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),Ic(await xw(o),e,r)}let n=await xw(t);if(e||(e=ud(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return Ic(n,e,r)}async function xw(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(VE(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(Om(t))for await(let r of t)e.push(...await xw(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${lF(t)}`)}return e}function lF(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var C=class{constructor(e){this._client=e}};function KE(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var GE=Object.freeze(Object.create(null)),pF=(t=KE)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],s=r.reduce((l,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=n[f],m=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??GE)??GE)?.toString)&&(m=p+"",i.push({start:l.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),l+d+(f===n.length?"":m)},""),a=s.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,u;for(;(u=c.exec(a))!==null;)i.push({start:u.index,length:u[0].length,error:`Value "${u[0]}" can't be safely passed as a path parameter`});if(i.sort((l,d)=>l.start-d.start),i.length>0){let l=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-l),h="^".repeat(p.length);return l=p.start+p.length,f+m+h},"");throw new V(`Path parameters result in path with invalid segments: +${i.map(f=>f.error).join(` +`)} +${s} +${d}`)}return s},O=pF(KE);var Ns=class extends C{list(e,r={},n){return this._client.getAPIList(O`/chat/completions/${e}/messages`,ke,{query:r,...n})}};function dd(t){return t!==void 0&&"function"in t&&t.function!==void 0}function pd(t){return t?.$brand==="auto-parseable-response-format"}function zs(t){return t?.$brand==="auto-parseable-tool"}function HE(t,e){return!e||!$w(e)?{...t,choices:t.choices.map(r=>(JE(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:fd(t,e)}function fd(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new wc;if(n.finish_reason==="content_filter")throw new xc;return JE(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>gF(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?hF(e,n.message.content):null}}});return{...t,choices:r}}function hF(t,e){return t.response_format?.type!=="json_schema"?null:t.response_format?.type==="json_schema"?"$parseRaw"in t.response_format?t.response_format.$parseRaw(e):JSON.parse(e):null}function gF(t,e){let r=t.tools?.find(n=>dd(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:zs(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function WE(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>dd(n)&&n.function?.name===e.function.name);return dd(r)&&(zs(r)||r?.function.strict||!1)}function $w(t){return pd(t.response_format)?!0:t.tools?.some(e=>zs(e)||e.type==="function"&&e.function.strict===!0)??!1}function JE(t){for(let e of t||[])if(e.type!=="function")throw new V(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function XE(t){for(let e of t??[]){if(e.type!=="function")throw new V(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new V(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Sc=t=>t?.role==="assistant",Iw=t=>t?.role==="tool";var Sw,Pm,Cm,md,hd,Rm,gd,Fo,_d,Nm,zm,kc,YE,bi=class{constructor(){Sw.add(this),this.controller=new AbortController,Pm.set(this,void 0),Cm.set(this,()=>{}),md.set(this,()=>{}),hd.set(this,void 0),Rm.set(this,()=>{}),gd.set(this,()=>{}),Fo.set(this,{}),_d.set(this,!1),Nm.set(this,!1),zm.set(this,!1),kc.set(this,!1),ce(this,Pm,new Promise((e,r)=>{ce(this,Cm,e,"f"),ce(this,md,r,"f")}),"f"),ce(this,hd,new Promise((e,r)=>{ce(this,Rm,e,"f"),ce(this,gd,r,"f")}),"f"),S(this,Pm,"f").catch(()=>{}),S(this,hd,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},S(this,Sw,"m",YE).bind(this))},0)}_connected(){this.ended||(S(this,Cm,"f").call(this),this._emit("connect"))}get ended(){return S(this,_d,"f")}get errored(){return S(this,Nm,"f")}get aborted(){return S(this,zm,"f")}abort(){this.controller.abort()}on(e,r){return(S(this,Fo,"f")[e]||(S(this,Fo,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=S(this,Fo,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(S(this,Fo,"f")[e]||(S(this,Fo,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ce(this,kc,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ce(this,kc,!0,"f"),await S(this,hd,"f")}_emit(e,...r){if(S(this,_d,"f"))return;e==="end"&&(ce(this,_d,!0,"f"),S(this,Rm,"f").call(this));let n=S(this,Fo,"f")[e];if(n&&(S(this,Fo,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!S(this,kc,"f")&&!n?.length&&Promise.reject(o),S(this,md,"f").call(this,o),S(this,gd,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!S(this,kc,"f")&&!n?.length&&Promise.reject(o),S(this,md,"f").call(this,o),S(this,gd,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Pm=new WeakMap,Cm=new WeakMap,md=new WeakMap,hd=new WeakMap,Rm=new WeakMap,gd=new WeakMap,Fo=new WeakMap,_d=new WeakMap,Nm=new WeakMap,zm=new WeakMap,kc=new WeakMap,Sw=new WeakSet,YE=function(e){if(ce(this,Nm,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new xt),e instanceof xt)return ce(this,zm,!0,"f"),this._emit("abort",e);if(e instanceof V)return this._emit("error",e);if(e instanceof Error){let r=new V(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new V(String(e)))};function QE(t){return typeof t.parse=="function"}var pr,kw,Mm,Tw,Ew,Aw,eA,tA,_F=10,Tc=class extends bi{constructor(){super(...arguments),pr.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let r=e.choices[0]?.message;return r&&this._addMessage(r),e}_addMessage(e,r=!0){if("content"in e||(e.content=null),this.messages.push(e),r){if(this._emit("message",e),Iw(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(Sc(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionToolCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new V("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),S(this,pr,"m",kw).call(this)}async finalMessage(){return await this.done(),S(this,pr,"m",Mm).call(this)}async finalFunctionToolCall(){return await this.done(),S(this,pr,"m",Tw).call(this)}async finalFunctionToolCallResult(){return await this.done(),S(this,pr,"m",Ew).call(this)}async totalUsage(){return await this.done(),S(this,pr,"m",Aw).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=S(this,pr,"m",Mm).call(this);r&&this._emit("finalMessage",r);let n=S(this,pr,"m",kw).call(this);n&&this._emit("finalContent",n);let o=S(this,pr,"m",Tw).call(this);o&&this._emit("finalFunctionToolCall",o);let i=S(this,pr,"m",Ew).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(s=>s.usage)&&this._emit("totalUsage",S(this,pr,"m",Aw).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,pr,"m",eA).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(fd(i,r))}async _runChatCompletion(e,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,r,n)}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:s,...a}=r,c=typeof i!="string"&&i.type==="function"&&i?.function?.name,{maxChatCompletions:u=_F}=n||{},l=r.tools.map(p=>{if(zs(p)){if(!p.$callback)throw new V("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of l)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?l.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;pJSON.stringify(Z)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:v,content:w});continue}let T;try{T=QE(k)?await k.parse(x):x}catch(w){let Z=w instanceof Error?w.message:String(w);this._addMessage({role:o,tool_call_id:v,content:Z});continue}let F=await k.function(T,this),J=S(this,pr,"m",tA).call(this,F);if(this._addMessage({role:o,tool_call_id:v,content:J}),c)return}}}};pr=new WeakSet,kw=function(){return S(this,pr,"m",Mm).call(this).content??null},Mm=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(Sc(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new V("stream ended without producing a ChatCompletionMessage with role=assistant")},Tw=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Sc(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},Ew=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Iw(r)&&r.content!=null&&typeof r.content=="string"&&this.messages.some(n=>n.role==="assistant"&&n.tool_calls?.some(o=>o.type==="function"&&o.id===r.tool_call_id)))return r.content}},Aw=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:r}of this._chatCompletions)r&&(e.completion_tokens+=r.completion_tokens,e.prompt_tokens+=r.prompt_tokens,e.total_tokens+=r.total_tokens);return e},eA=function(e){if(e.n!=null&&e.n>1)throw new V("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},tA=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};var yd=class t extends Tc{static runTools(e,r,n){let o=new t,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}_addMessage(e,r=!0){super._addMessage(e,r),Sc(e)&&e.content&&this._emit("content",e.content)}};var Mt={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511},Ow=class extends Error{},Pw=class extends Error{};function yF(t,e=Mt.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return vF(t.trim(),e)}var vF=(t,e)=>{let r=t.length,n=0,o=f=>{throw new Ow(`${f} at position ${n}`)},i=f=>{throw new Pw(`${f} at position ${n}`)},s=()=>(d(),n>=r&&o("Unexpected end of input"),t[n]==='"'?a():t[n]==="{"?c():t[n]==="["?u():t.substring(n,n+4)==="null"||Mt.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Mt.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Mt.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Mt.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Mt.MINUS_INFINITY&e&&1{let f=n,p=!1;for(n++;n{n++,d();let f={};try{for(;t[n]!=="}";){if(d(),n>=r&&Mt.OBJ&e)return f;let p=a();d(),n++;try{let m=s();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(Mt.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Mt.OBJ&e)return f;o("Expected '}' at end of object")}return n++,f},u=()=>{n++;let f=[];try{for(;t[n]!=="]";)f.push(s()),d(),t[n]===","&&n++}catch{if(Mt.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},l=()=>{if(n===0){t==="-"&&Mt.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Mt.NUM&e)try{return t[t.length-1]==="."?JSON.parse(t.substring(0,t.lastIndexOf("."))):JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch{}i(String(p))}}let f=n;for(t[n]==="-"&&n++;t[n]&&!",]}".includes(t[n]);)n++;n==r&&!(Mt.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Mt.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;nyF(t,Mt.ALL^Mt.NUM);var Rt,Bo,Ec,wi,Rw,jm,Nw,zw,Mw,Dm,jw,rA,Ms=class t extends Tc{constructor(e){super(),Rt.add(this),Bo.set(this,void 0),Ec.set(this,void 0),wi.set(this,void 0),ce(this,Bo,e,"f"),ce(this,Ec,[],"f")}get currentChatCompletionSnapshot(){return S(this,wi,"f")}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createChatCompletion(e,r,n){let o=new t(r);return o._run(()=>o._runChatCompletion(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(e,r,n){super._createChatCompletion;let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,Rt,"m",Rw).call(this);let i=await e.chat.completions.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let s of i)S(this,Rt,"m",Nw).call(this,s);if(i.controller.signal?.aborted)throw new xt;return this._addChatCompletion(S(this,Rt,"m",Dm).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),S(this,Rt,"m",Rw).call(this),this._connected();let o=io.fromReadableStream(e,this.controller),i;for await(let s of o)i&&i!==s.id&&this._addChatCompletion(S(this,Rt,"m",Dm).call(this)),S(this,Rt,"m",Nw).call(this,s),i=s.id;if(o.controller.signal?.aborted)throw new xt;return this._addChatCompletion(S(this,Rt,"m",Dm).call(this))}[(Bo=new WeakMap,Ec=new WeakMap,wi=new WeakMap,Rt=new WeakSet,Rw=function(){this.ended||ce(this,wi,void 0,"f")},jm=function(r){let n=S(this,Ec,"f")[r.index];return n||(n={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},S(this,Ec,"f")[r.index]=n,n)},Nw=function(r){if(this.ended)return;let n=S(this,Rt,"m",rA).call(this,r);this._emit("chunk",r,n);for(let o of r.choices){let i=n.choices[o.index];o.delta.content!=null&&i.message?.role==="assistant"&&i.message?.content&&(this._emit("content",o.delta.content,i.message.content),this._emit("content.delta",{delta:o.delta.content,snapshot:i.message.content,parsed:i.message.parsed})),o.delta.refusal!=null&&i.message?.role==="assistant"&&i.message?.refusal&&this._emit("refusal.delta",{delta:o.delta.refusal,snapshot:i.message.refusal}),o.logprobs?.content!=null&&i.message?.role==="assistant"&&this._emit("logprobs.content.delta",{content:o.logprobs?.content,snapshot:i.logprobs?.content??[]}),o.logprobs?.refusal!=null&&i.message?.role==="assistant"&&this._emit("logprobs.refusal.delta",{refusal:o.logprobs?.refusal,snapshot:i.logprobs?.refusal??[]});let s=S(this,Rt,"m",jm).call(this,i);i.finish_reason&&(S(this,Rt,"m",Mw).call(this,i),s.current_tool_call_index!=null&&S(this,Rt,"m",zw).call(this,i,s.current_tool_call_index));for(let a of o.delta.tool_calls??[])s.current_tool_call_index!==a.index&&(S(this,Rt,"m",Mw).call(this,i),s.current_tool_call_index!=null&&S(this,Rt,"m",zw).call(this,i,s.current_tool_call_index)),s.current_tool_call_index=a.index;for(let a of o.delta.tool_calls??[]){let c=i.message.tool_calls?.[a.index];c?.type&&(c?.type==="function"?this._emit("tool_calls.function.arguments.delta",{name:c.function?.name,index:a.index,arguments:c.function.arguments,parsed_arguments:c.function.parsed_arguments,arguments_delta:a.function?.arguments??""}):(c?.type,void 0))}}},zw=function(r,n){if(S(this,Rt,"m",jm).call(this,r).done_tool_calls.has(n))return;let i=r.message.tool_calls?.[n];if(!i)throw new Error("no tool call snapshot");if(!i.type)throw new Error("tool call snapshot missing `type`");if(i.type==="function"){let s=S(this,Bo,"f")?.tools?.find(a=>dd(a)&&a.function.name===i.function.name);this._emit("tool_calls.function.arguments.done",{name:i.function.name,index:n,arguments:i.function.arguments,parsed_arguments:zs(s)?s.$parseRaw(i.function.arguments):s?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Mw=function(r){let n=S(this,Rt,"m",jm).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=S(this,Rt,"m",jw).call(this);this._emit("content.done",{content:r.message.content,parsed:o?o.$parseRaw(r.message.content):null})}r.message.refusal&&!n.refusal_done&&(n.refusal_done=!0,this._emit("refusal.done",{refusal:r.message.refusal})),r.logprobs?.content&&!n.logprobs_content_done&&(n.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:r.logprobs.content})),r.logprobs?.refusal&&!n.logprobs_refusal_done&&(n.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:r.logprobs.refusal}))},Dm=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");let r=S(this,wi,"f");if(!r)throw new V("request ended without sending any chunks");return ce(this,wi,void 0,"f"),ce(this,Ec,[],"f"),bF(r,S(this,Bo,"f"))},jw=function(){let r=S(this,Bo,"f")?.response_format;return pd(r)?r:null},rA=function(r){var n,o,i,s;let a=S(this,wi,"f"),{choices:c,...u}=r;a?Object.assign(a,u):a=ce(this,wi,{...u,choices:[]},"f");for(let{delta:l,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=a.choices[f];if(h||(h=a.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:F,refusal:J,...w}=p;Object.assign(h.logprobs,w),F&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...F)),J&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...J))}if(d&&(h.finish_reason=d,S(this,Bo,"f")&&$w(S(this,Bo,"f")))){if(d==="length")throw new wc;if(d==="content_filter")throw new xc}if(Object.assign(h,m),!l)continue;let{content:_,refusal:v,function_call:b,role:x,tool_calls:k,...T}=l;if(Object.assign(h.message,T),v&&(h.message.refusal=(h.message.refusal||"")+v),x&&(h.message.role=x),b&&(h.message.function_call?(b.name&&(h.message.function_call.name=b.name),b.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=b.arguments)):h.message.function_call=b),_&&(h.message.content=(h.message.content||"")+_,!h.message.refusal&&S(this,Rt,"m",jw).call(this)&&(h.message.parsed=Cw(h.message.content))),k){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:F,id:J,type:w,function:Z,...oe}of k){let Q=(s=h.message.tool_calls)[F]??(s[F]={});Object.assign(Q,oe),J&&(Q.id=J),w&&(Q.type=w),Z&&(Q.function??(Q.function={name:Z.name??"",arguments:""})),Z?.name&&(Q.function.name=Z.name),Z?.arguments&&(Q.function.arguments+=Z.arguments,WE(S(this,Bo,"f"),Q)&&(Q.function.parsed_arguments=Cw(Q.function.arguments)))}}}return a},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("chunk",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new io(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function bF(t,e){let{id:r,choices:n,created:o,model:i,system_fingerprint:s,...a}=t,c={...a,id:r,choices:n.map(({message:u,finish_reason:l,index:d,logprobs:f,...p})=>{if(!l)throw new V(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:_,...v}=u,b=u.role;if(!b)throw new V(`missing role for choice ${d}`);if(h){let{arguments:x,name:k}=h;if(x==null)throw new V(`missing function_call.arguments for choice ${d}`);if(!k)throw new V(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:x,name:k},role:b,refusal:u.refusal??null},finish_reason:l,index:d,logprobs:f}}return _?{...p,index:d,finish_reason:l,logprobs:f,message:{...v,role:b,content:m,refusal:u.refusal??null,tool_calls:_.map((x,k)=>{let{function:T,type:F,id:J,...w}=x,{arguments:Z,name:oe,...Q}=T||{};if(J==null)throw new V(`missing choices[${d}].tool_calls[${k}].id +${Lm(t)}`);if(F==null)throw new V(`missing choices[${d}].tool_calls[${k}].type +${Lm(t)}`);if(oe==null)throw new V(`missing choices[${d}].tool_calls[${k}].function.name +${Lm(t)}`);if(Z==null)throw new V(`missing choices[${d}].tool_calls[${k}].function.arguments +${Lm(t)}`);return{...w,id:J,type:F,function:{...Q,name:oe,arguments:Z}}})}}:{...p,message:{...v,content:m,role:b,refusal:u.refusal??null},finish_reason:l,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...s?{system_fingerprint:s}:{}};return HE(c,e)}function Lm(t){return JSON.stringify(t)}var vd=class t extends Ms{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runTools(e,r,n){let o=new t(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}};var Zo=class extends C{constructor(){super(...arguments),this.messages=new Ns(this._client)}create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1})}retrieve(e,r){return this._client.get(O`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(O`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/chat/completions/${e}`,r)}parse(e,r){return XE(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>fd(n,e))}runTools(e,r){return e.stream?vd.runTools(this._client,e,r):yd.runTools(this._client,e,r)}stream(e,r){return Ms.createChatCompletion(this._client,e,r)}};Zo.Messages=Ns;var xi=class extends C{constructor(){super(...arguments),this.completions=new Zo(this._client)}};xi.Completions=Zo;var nA=Symbol("brand.privateNullableHeaders");function*xF(t){if(!t)return;if(nA in t){let{values:n,nulls:o}=t;yield*n.entries();for(let i of o)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():ow(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=ow(n[1])?n[1]:[n[1]],s=!1;for(let a of i)a!==void 0&&(e&&!s&&(s=!0,yield[o,null]),yield[o,a])}}var L=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,s]of xF(n)){let a=i.toLowerCase();o.has(a)||(e.delete(i),o.add(a)),s===null?(e.delete(i),r.add(a)):(e.append(i,s),r.delete(a))}}return{[nA]:!0,values:e,nulls:r}};var Ac=class extends C{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:L([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}};var Oc=class extends C{create(e,r){return this._client.post("/audio/transcriptions",Hr({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}};var Pc=class extends C{create(e,r){return this._client.post("/audio/translations",Hr({body:e,...r,__metadata:{model:e.model}},this._client))}};var ao=class extends C{constructor(){super(...arguments),this.transcriptions=new Oc(this._client),this.translations=new Pc(this._client),this.speech=new Ac(this._client)}};ao.Transcriptions=Oc;ao.Translations=Pc;ao.Speech=Ac;var js=class extends C{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(O`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",ke,{query:e,...r})}cancel(e,r){return this._client.post(O`/batches/${e}/cancel`,r)}};var Cc=class extends C{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/assistants/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/assistants/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",ke,{query:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(O`/assistants/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var Rc=class extends C{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var Nc=class extends C{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var $i=class extends C{constructor(){super(...arguments),this.sessions=new Rc(this._client),this.transcriptionSessions=new Nc(this._client)}};$i.Sessions=Rc;$i.TranscriptionSessions=Nc;var zc=class extends C{create(e,r){return this._client.post("/chatkit/sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}cancel(e,r){return this._client.post(O`/chatkit/sessions/${e}/cancel`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}};var Mc=class extends C{retrieve(e,r){return this._client.get(O`/chatkit/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}list(e={},r){return this._client.getAPIList("/chatkit/threads",Uo,{query:e,...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}delete(e,r){return this._client.delete(O`/chatkit/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}listItems(e,r={},n){return this._client.getAPIList(O`/chatkit/threads/${e}/items`,Uo,{query:r,...n,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers])})}};var Ii=class extends C{constructor(){super(...arguments),this.sessions=new zc(this._client),this.threads=new Mc(this._client)}};Ii.Sessions=zc;Ii.Threads=Mc;var jc=class extends C{create(e,r,n){return this._client.post(O`/threads/${e}/messages`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(O`/threads/${o}/messages/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/messages/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/threads/${e}/messages`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(O`/threads/${o}/messages/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var Dc=class extends C{retrieve(e,r,n){let{thread_id:o,run_id:i,...s}=r;return this._client.get(O`/threads/${o}/runs/${i}/steps/${e}`,{query:s,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r,n){let{thread_id:o,...i}=r;return this._client.getAPIList(O`/threads/${o}/runs/${e}/steps`,ke,{query:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var oA=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()};var Zt,Ls,Dw,co,Um,Nn,Us,Lc,Ds,Zm,Wr,Fm,Bm,xd,bd,wd,iA,sA,aA,cA,uA,lA,dA,qo=class extends bi{constructor(){super(...arguments),Zt.add(this),Dw.set(this,[]),co.set(this,{}),Um.set(this,{}),Nn.set(this,void 0),Us.set(this,void 0),Lc.set(this,void 0),Ds.set(this,void 0),Zm.set(this,void 0),Wr.set(this,void 0),Fm.set(this,void 0),Bm.set(this,void 0),xd.set(this,void 0)}[(Dw=new WeakMap,co=new WeakMap,Um=new WeakMap,Nn=new WeakMap,Us=new WeakMap,Lc=new WeakMap,Ds=new WeakMap,Zm=new WeakMap,Wr=new WeakMap,Fm=new WeakMap,Bm=new WeakMap,xd=new WeakMap,Zt=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new Ls;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=io.fromReadableStream(e,this.controller);for await(let i of o)S(this,Zt,"m",bd).call(this,i);if(o.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}toReadableStream(){return new io(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new Ls;return i._run(()=>i._runToolAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...n,stream:!0},a=await e.submitToolOutputs(r,s,{...o,signal:this.controller.signal});this._connected();for await(let c of a)S(this,Zt,"m",bd).call(this,c);if(a.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}static createThreadAssistantStream(e,r,n){let o=new Ls;return o._run(()=>o._threadAssistantStream(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,r,n,o){let i=new Ls;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return S(this,Fm,"f")}currentRun(){return S(this,Bm,"f")}currentMessageSnapshot(){return S(this,Nn,"f")}currentRunStepSnapshot(){return S(this,xd,"f")}async finalRunSteps(){return await this.done(),Object.values(S(this,co,"f"))}async finalMessages(){return await this.done(),Object.values(S(this,Um,"f"))}async finalRun(){if(await this.done(),!S(this,Us,"f"))throw Error("Final run was not received.");return S(this,Us,"f")}async _createThreadAssistantStream(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));let i={...r,stream:!0},s=await e.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let a of s)S(this,Zt,"m",bd).call(this,a);if(s.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}async _createAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...n,stream:!0},a=await e.create(r,s,{...o,signal:this.controller.signal});this._connected();for await(let c of a)S(this,Zt,"m",bd).call(this,c);if(a.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}static accumulateDelta(e,r){for(let[n,o]of Object.entries(r)){if(!e.hasOwnProperty(n)){e[n]=o;continue}let i=e[n];if(i==null){e[n]=o;continue}if(n==="index"||n==="type"){e[n]=o;continue}if(typeof i=="string"&&typeof o=="string")i+=o;else if(typeof i=="number"&&typeof o=="number")i+=o;else if(nd(i)&&nd(o))i=this.accumulateDelta(i,o);else if(Array.isArray(i)&&Array.isArray(o)){if(i.every(s=>typeof s=="string"||typeof s=="number")){i.push(...o);continue}for(let s of o){if(!nd(s))throw new Error(`Expected array delta entry to be an object but got: ${s}`);let a=s.index;if(a==null)throw console.error(s),new Error("Expected array delta entry to have an `index` property");if(typeof a!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${a}`);let c=i[a];c==null?i.push(s):i[a]=this.accumulateDelta(c,s)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${o}, accValue: ${i}`);e[n]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,r,n){return await this._createThreadAssistantStream(r,e,n)}async _runAssistantStream(e,r,n,o){return await this._createAssistantStream(r,e,n,o)}async _runToolAssistantStream(e,r,n,o){return await this._createToolAssistantStream(r,e,n,o)}};Ls=qo,bd=function(e){if(!this.ended)switch(ce(this,Fm,e,"f"),S(this,Zt,"m",aA).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":S(this,Zt,"m",dA).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":S(this,Zt,"m",sA).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":S(this,Zt,"m",iA).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},wd=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");if(!S(this,Us,"f"))throw Error("Final run has not been received");return S(this,Us,"f")},iA=function(e){let[r,n]=S(this,Zt,"m",uA).call(this,e,S(this,Nn,"f"));ce(this,Nn,r,"f"),S(this,Um,"f")[r.id]=r;for(let o of n){let i=r.content[o.index];i?.type=="text"&&this._emit("textCreated",i.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,r),e.data.delta.content)for(let o of e.data.delta.content){if(o.type=="text"&&o.text){let i=o.text,s=r.content[o.index];if(s&&s.type=="text")this._emit("textDelta",i,s.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(o.index!=S(this,Lc,"f")){if(S(this,Ds,"f"))switch(S(this,Ds,"f").type){case"text":this._emit("textDone",S(this,Ds,"f").text,S(this,Nn,"f"));break;case"image_file":this._emit("imageFileDone",S(this,Ds,"f").image_file,S(this,Nn,"f"));break}ce(this,Lc,o.index,"f")}ce(this,Ds,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(S(this,Lc,"f")!==void 0){let o=e.data.content[S(this,Lc,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,S(this,Nn,"f"));break;case"text":this._emit("textDone",o.text,S(this,Nn,"f"));break}}S(this,Nn,"f")&&this._emit("messageDone",e.data),ce(this,Nn,void 0,"f")}},sA=function(e){let r=S(this,Zt,"m",cA).call(this,e);switch(ce(this,xd,r,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let n=e.data.delta;if(n.step_details&&n.step_details.type=="tool_calls"&&n.step_details.tool_calls&&r.step_details.type=="tool_calls")for(let i of n.step_details.tool_calls)i.index==S(this,Zm,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(S(this,Wr,"f")&&this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Zm,i.index,"f"),ce(this,Wr,r.step_details.tool_calls[i.index],"f"),S(this,Wr,"f")&&this._emit("toolCallCreated",S(this,Wr,"f")));this._emit("runStepDelta",e.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":ce(this,xd,void 0,"f"),e.data.step_details.type=="tool_calls"&&S(this,Wr,"f")&&(this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Wr,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},aA=function(e){S(this,Dw,"f").push(e),this._emit("event",e)},cA=function(e){switch(e.event){case"thread.run.step.created":return S(this,co,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=S(this,co,"f")[e.data.id];if(!r)throw Error("Received a RunStepDelta before creation of a snapshot");let n=e.data;if(n.delta){let o=Ls.accumulateDelta(r,n.delta);S(this,co,"f")[e.data.id]=o}return S(this,co,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":S(this,co,"f")[e.data.id]=e.data;break}if(S(this,co,"f")[e.data.id])return S(this,co,"f")[e.data.id];throw new Error("No snapshot available")},uA=function(e,r){let n=[];switch(e.event){case"thread.message.created":return[e.data,n];case"thread.message.delta":if(!r)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let o=e.data;if(o.delta.content)for(let i of o.delta.content)if(i.index in r.content){let s=r.content[i.index];r.content[i.index]=S(this,Zt,"m",lA).call(this,i,s)}else r.content[i.index]=i,n.push(i);return[r,n];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(r)return[r,n];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},lA=function(e,r){return Ls.accumulateDelta(r,e)},dA=function(e){switch(ce(this,Bm,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":ce(this,Us,e.data,"f"),S(this,Wr,"f")&&(this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Wr,void 0,"f"));break;case"thread.run.cancelling":break}};var Fs=class extends C{constructor(){super(...arguments),this.steps=new Dc(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(O`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(O`/threads/${o}/runs/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/runs/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/threads/${e}/runs`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(O`/threads/${o}/runs/${e}/cancel`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(o.id,{thread_id:e},n)}createAndStream(e,r,n){return qo.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(e,r,{...n,headers:{...n?.headers,...o}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return qo.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}async submitToolOutputsAndPoll(e,r,n){let o=await this.submitToolOutputs(e,r,n);return await this.poll(o.id,r,n)}submitToolOutputsStream(e,r,n){return qo.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};Fs.Steps=Dc;var ki=class extends C{constructor(){super(...arguments),this.runs=new Fs(this._client),this.messages=new jc(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/threads/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete(O`/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:e.stream??!1})}async createAndRunPoll(e,r){let n=await this.createAndRun(e,r);return await this.runs.poll(n.id,{thread_id:n.thread_id},r)}createAndRunStream(e,r){return qo.createThreadAssistantStream(e,this._client.beta.threads,r)}};ki.Runs=Fs;ki.Messages=jc;var zn=class extends C{constructor(){super(...arguments),this.realtime=new $i(this._client),this.chatkit=new Ii(this._client),this.assistants=new Cc(this._client),this.threads=new ki(this._client)}};zn.Realtime=$i;zn.ChatKit=Ii;zn.Assistants=Cc;zn.Threads=ki;var Bs=class extends C{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}};var Uc=class extends C{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(O`/containers/${o}/files/${e}/content`,{...n,headers:L([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}};var Zs=class extends C{constructor(){super(...arguments),this.content=new Uc(this._client)}create(e,r,n){return this._client.post(O`/containers/${e}/files`,Hr({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(O`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList(O`/containers/${e}/files`,ke,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(O`/containers/${o}/files/${e}`,{...n,headers:L([{Accept:"*/*"},n?.headers])})}};Zs.Content=Uc;var Ti=class extends C{constructor(){super(...arguments),this.files=new Zs(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get(O`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/containers/${e}`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}};Ti.Files=Zs;var Fc=class extends C{create(e,r,n){let{include:o,...i}=r;return this._client.post(O`/conversations/${e}/items`,{query:{include:o},body:i,...n})}retrieve(e,r,n){let{conversation_id:o,...i}=r;return this._client.get(O`/conversations/${o}/items/${e}`,{query:i,...n})}list(e,r={},n){return this._client.getAPIList(O`/conversations/${e}/items`,Uo,{query:r,...n})}delete(e,r,n){let{conversation_id:o}=r;return this._client.delete(O`/conversations/${o}/items/${e}`,n)}};var Ei=class extends C{constructor(){super(...arguments),this.items=new Fc(this._client)}create(e={},r){return this._client.post("/conversations",{body:e,...r})}retrieve(e,r){return this._client.get(O`/conversations/${e}`,r)}update(e,r,n){return this._client.post(O`/conversations/${e}`,{body:r,...n})}delete(e,r){return this._client.delete(O`/conversations/${e}`,r)}};Ei.Items=Fc;var qs=class extends C{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&$t(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:($t(this._client).debug("embeddings/decoding base64 embeddings from base64"),i._thenUnwrap(s=>(s&&s.data&&s.data.forEach(a=>{let c=a.embedding;a.embedding=oA(c)}),s)))}};var Bc=class extends C{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get(O`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList(O`/evals/${o}/runs/${e}/output_items`,ke,{query:i,...n})}};var Vs=class extends C{constructor(){super(...arguments),this.outputItems=new Bc(this._client)}create(e,r,n){return this._client.post(O`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(O`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList(O`/evals/${e}/runs`,ke,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(O`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(O`/evals/${o}/runs/${e}`,n)}};Vs.OutputItems=Bc;var Ai=class extends C{constructor(){super(...arguments),this.runs=new Vs(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(O`/evals/${e}`,r)}update(e,r,n){return this._client.post(O`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/evals/${e}`,r)}};Ai.Runs=Vs;var Gs=class extends C{create(e,r){return this._client.post("/files",Hr({body:e,...r},this._client))}retrieve(e,r){return this._client.get(O`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/files/${e}`,r)}content(e,r){return this._client.get(O`/files/${e}/content`,{...r,headers:L([{Accept:"application/binary"},r?.headers]),__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:n=1800*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),s=await this.retrieve(e);for(;!s.status||!o.has(s.status);)if(await no(r),s=await this.retrieve(e),Date.now()-i>n)throw new Do({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return s}};var Zc=class extends C{};var qc=class extends C{run(e,r){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...r})}validate(e,r){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...r})}};var Ks=class extends C{constructor(){super(...arguments),this.graders=new qc(this._client)}};Ks.Graders=qc;var Vc=class extends C{create(e,r,n){return this._client.getAPIList(O`/fine_tuning/checkpoints/${e}/permissions`,so,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get(O`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(O`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}};var Hs=class extends C{constructor(){super(...arguments),this.permissions=new Vc(this._client)}};Hs.Permissions=Vc;var Gc=class extends C{list(e,r={},n){return this._client.getAPIList(O`/fine_tuning/jobs/${e}/checkpoints`,ke,{query:r,...n})}};var Ws=class extends C{constructor(){super(...arguments),this.checkpoints=new Gc(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(O`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",ke,{query:e,...r})}cancel(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList(O`/fine_tuning/jobs/${e}/events`,ke,{query:r,...n})}pause(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/resume`,r)}};Ws.Checkpoints=Gc;var Mn=class extends C{constructor(){super(...arguments),this.methods=new Zc(this._client),this.jobs=new Ws(this._client),this.checkpoints=new Hs(this._client),this.alpha=new Ks(this._client)}};Mn.Methods=Zc;Mn.Jobs=Ws;Mn.Checkpoints=Hs;Mn.Alpha=Ks;var Kc=class extends C{};var Oi=class extends C{constructor(){super(...arguments),this.graderModels=new Kc(this._client)}};Oi.GraderModels=Kc;var Js=class extends C{createVariation(e,r){return this._client.post("/images/variations",Hr({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",Hr({body:e,...r,stream:e.stream??!1},this._client))}generate(e,r){return this._client.post("/images/generations",{body:e,...r,stream:e.stream??!1})}};var Xs=class extends C{retrieve(e,r){return this._client.get(O`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",so,e)}delete(e,r){return this._client.delete(O`/models/${e}`,r)}};var Ys=class extends C{create(e,r){return this._client.post("/moderations",{body:e,...r})}};var Hc=class extends C{accept(e,r,n){return this._client.post(O`/realtime/calls/${e}/accept`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}hangup(e,r){return this._client.post(O`/realtime/calls/${e}/hangup`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}refer(e,r,n){return this._client.post(O`/realtime/calls/${e}/refer`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}reject(e,r={},n){return this._client.post(O`/realtime/calls/${e}/reject`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}};var Wc=class extends C{create(e,r){return this._client.post("/realtime/client_secrets",{body:e,...r})}};var Vo=class extends C{constructor(){super(...arguments),this.clientSecrets=new Wc(this._client),this.calls=new Hc(this._client)}};Vo.ClientSecrets=Wc;Vo.Calls=Hc;function pA(t,e){return!e||!QF(e)?{...t,output_parsed:null,output:t.output.map(r=>r.type==="function_call"?{...r,parsed_arguments:null}:r.type==="message"?{...r,content:r.content.map(n=>({...n,parsed:null}))}:r)}:Lw(t,e)}function Lw(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:rB(e,o)};if(o.type==="message"){let i=o.content.map(s=>s.type==="output_text"?{...s,parsed:YF(e,s.text)}:s);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||qm(n),Object.defineProperty(n,"output_parsed",{enumerable:!0,get(){for(let o of n.output)if(o.type==="message"){for(let i of o.content)if(i.type==="output_text"&&i.parsed!==null)return i.parsed}return null}}),n}function YF(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function QF(t){return!!pd(t.text?.format)}function eB(t){return t?.$brand==="auto-parseable-tool"}function tB(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function rB(t,e){let r=tB(t.tools??[],e.name);return{...e,...e,parsed_arguments:eB(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function qm(t){let e=[];for(let r of t.output)if(r.type==="message")for(let n of r.content)n.type==="output_text"&&e.push(n.text);t.output_text=e.join("")}var Jc,Vm,Pi,Gm,fA,mA,hA,gA,Km=class t extends bi{constructor(e){super(),Jc.add(this),Vm.set(this,void 0),Pi.set(this,void 0),Gm.set(this,void 0),ce(this,Vm,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createOrRetrieveResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createOrRetrieveResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,Jc,"m",fA).call(this);let i,s=null;"response_id"in r?(i=await e.responses.retrieve(r.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),s=r.starting_after??null):i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(let a of i)S(this,Jc,"m",mA).call(this,a,s);if(i.controller.signal?.aborted)throw new xt;return S(this,Jc,"m",hA).call(this)}[(Vm=new WeakMap,Pi=new WeakMap,Gm=new WeakMap,Jc=new WeakSet,fA=function(){this.ended||ce(this,Pi,void 0,"f")},mA=function(r,n){if(this.ended)return;let o=(s,a)=>{(n==null||a.sequence_number>n)&&this._emit(s,a)},i=S(this,Jc,"m",gA).call(this,r);switch(o("event",r),r.type){case"response.output_text.delta":{let s=i.output[r.output_index];if(!s)throw new V(`missing output at index ${r.output_index}`);if(s.type==="message"){let a=s.content[r.content_index];if(!a)throw new V(`missing content at index ${r.content_index}`);if(a.type!=="output_text")throw new V(`expected content to be 'output_text', got ${a.type}`);o("response.output_text.delta",{...r,snapshot:a.text})}break}case"response.function_call_arguments.delta":{let s=i.output[r.output_index];if(!s)throw new V(`missing output at index ${r.output_index}`);s.type==="function_call"&&o("response.function_call_arguments.delta",{...r,snapshot:s.arguments});break}default:o(r.type,r);break}},hA=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");let r=S(this,Pi,"f");if(!r)throw new V("request ended without sending any events");ce(this,Pi,void 0,"f");let n=nB(r,S(this,Vm,"f"));return ce(this,Gm,n,"f"),n},gA=function(r){let n=S(this,Pi,"f");if(!n){if(r.type!=="response.created")throw new V(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=ce(this,Pi,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);let i=o.type,s=r.part;i==="message"&&s.type!=="reasoning_text"?o.content.push(s):i==="reasoning"&&s.type==="reasoning_text"&&(o.content||(o.content=[]),o.content.push(s));break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new V(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new V(`expected content to be 'output_text', got ${i.type}`);i.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.reasoning_text.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);if(o.type==="reasoning"){let i=o.content?.[r.content_index];if(!i)throw new V(`missing content at index ${r.content_index}`);if(i.type!=="reasoning_text")throw new V(`expected content to be 'reasoning_text', got ${i.type}`);i.text+=r.delta}break}case"response.completed":{ce(this,Pi,r.response,"f");break}}return n},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=S(this,Gm,"f");if(!e)throw new V("stream ended without producing a ChatCompletion");return e}};function nB(t,e){return pA(t,e)}var Xc=class extends C{list(e,r={},n){return this._client.getAPIList(O`/responses/${e}/input_items`,ke,{query:r,...n})}};var Yc=class extends C{count(e={},r){return this._client.post("/responses/input_tokens",{body:e,...r})}};var Go=class extends C{constructor(){super(...arguments),this.inputItems=new Xc(this._client),this.inputTokens=new Yc(this._client)}create(e,r){return this._client.post("/responses",{body:e,...r,stream:e.stream??!1})._thenUnwrap(n=>("object"in n&&n.object==="response"&&qm(n),n))}retrieve(e,r={},n){return this._client.get(O`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&qm(o),o))}delete(e,r){return this._client.delete(O`/responses/${e}`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>Lw(n,e))}stream(e,r){return Km.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(O`/responses/${e}/cancel`,r)}compact(e={},r){return this._client.post("/responses/compact",{body:e,...r})}};Go.InputItems=Xc;Go.InputTokens=Yc;var Qc=class extends C{create(e,r,n){return this._client.post(O`/uploads/${e}/parts`,Hr({body:r,...n},this._client))}};var Ci=class extends C{constructor(){super(...arguments),this.parts=new Qc(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(O`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(O`/uploads/${e}/complete`,{body:r,...n})}};Ci.Parts=Qc;var _A=async t=>{let e=await Promise.allSettled(t),r=e.filter(o=>o.status==="rejected");if(r.length){for(let o of r)console.error(o.reason);throw new Error(`${r.length} promise(s) failed - see the above errors`)}let n=[];for(let o of e)o.status==="fulfilled"&&n.push(o.value);return n};var eu=class extends C{create(e,r,n){return this._client.post(O`/vector_stores/${e}/file_batches`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(O`/vector_stores/${o}/file_batches/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{vector_store_id:o}=r;return this._client.post(O`/vector_stores/${o}/file_batches/${e}/cancel`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r);return await this.poll(e,o.id,n)}listFiles(e,r,n){let{vector_store_id:o,...i}=r;return this._client.getAPIList(O`/vector_stores/${o}/file_batches/${e}/files`,ke,{query:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse();switch(i.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,s=Math.min(i,r.length),a=this._client,c=r.values(),u=[...n];async function l(f){for(let p of f){let m=await a.files.create({file:p,purpose:"assistants"},o);u.push(m.id)}}let d=Array(s).fill(c).map(l);return await _A(d),await this.createAndPoll(e,{file_ids:u})}};var tu=class extends C{create(e,r,n){return this._client.post(O`/vector_stores/${e}/files`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(O`/vector_stores/${o}/files/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{vector_store_id:o,...i}=r;return this._client.post(O`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/vector_stores/${e}/files`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{vector_store_id:o}=r;return this._client.delete(O`/vector_stores/${o}/files/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse(),s=i.data;switch(s.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=i.response.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"failed":case"completed":return s}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}content(e,r,n){let{vector_store_id:o}=r;return this._client.getAPIList(O`/vector_stores/${o}/files/${e}/content`,so,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var Ko=class extends C{constructor(){super(...arguments),this.files=new tu(this._client),this.fileBatches=new eu(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/vector_stores/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/vector_stores/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",ke,{query:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(O`/vector_stores/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList(O`/vector_stores/${e}/search`,so,{body:r,method:"post",...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};Ko.Files=tu;Ko.FileBatches=eu;var Qs=class extends C{create(e,r){return this._client.post("/videos",ww({body:e,...r},this._client))}retrieve(e,r){return this._client.get(O`/videos/${e}`,r)}list(e={},r){return this._client.getAPIList("/videos",Uo,{query:e,...r})}delete(e,r){return this._client.delete(O`/videos/${e}`,r)}downloadContent(e,r={},n){return this._client.get(O`/videos/${e}/content`,{query:r,...n,headers:L([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}remix(e,r,n){return this._client.post(O`/videos/${e}/remix`,ww({body:r,...n},this._client))}};var ru,yA,Hm,ea=class extends C{constructor(){super(...arguments),ru.add(this)}async unwrap(e,r,n=this._client.webhookSecret,o=300){return await this.verifySignature(e,r,n,o),JSON.parse(e)}async verifySignature(e,r,n=this._client.webhookSecret,o=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");S(this,ru,"m",yA).call(this,n);let i=L([r]).values,s=S(this,ru,"m",Hm).call(this,i,"webhook-signature"),a=S(this,ru,"m",Hm).call(this,i,"webhook-timestamp"),c=S(this,ru,"m",Hm).call(this,i,"webhook-id"),u=parseInt(a,10);if(isNaN(u))throw new ro("Invalid webhook timestamp format");let l=Math.floor(Date.now()/1e3);if(l-u>o)throw new ro("Webhook timestamp is too old");if(u>l+o)throw new ro("Webhook timestamp is too new");let d=s.split(" ").map(h=>h.startsWith("v1,")?h.substring(3):h),f=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),p=c?`${c}.${a}.${e}`:`${a}.${e}`,m=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let h of d)try{let _=Buffer.from(h,"base64");if(await crypto.subtle.verify("HMAC",m,_,new TextEncoder().encode(p)))return}catch{continue}throw new ro("The given webhook signature does not match the expected signature")}};ru=new WeakSet,yA=function(e){if(typeof e!="string"||e.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},Hm=function(e,r){if(!e)throw new Error("Headers are required");let n=e.get(r);if(n==null)throw new Error(`Missing required header: ${r}`);return n};var Uw,Fw,Wm,vA,fe=class{constructor({baseURL:e=Si("OPENAI_BASE_URL"),apiKey:r=Si("OPENAI_API_KEY"),organization:n=Si("OPENAI_ORG_ID")??null,project:o=Si("OPENAI_PROJECT_ID")??null,webhookSecret:i=Si("OPENAI_WEBHOOK_SECRET")??null,...s}={}){if(Uw.add(this),Wm.set(this,void 0),this.completions=new Bs(this),this.chat=new xi(this),this.embeddings=new qs(this),this.files=new Gs(this),this.images=new Js(this),this.audio=new ao(this),this.moderations=new Ys(this),this.models=new Xs(this),this.fineTuning=new Mn(this),this.graders=new Oi(this),this.vectorStores=new Ko(this),this.webhooks=new ea(this),this.beta=new zn(this),this.batches=new js(this),this.uploads=new Ci(this),this.responses=new Go(this),this.realtime=new Vo(this),this.conversations=new Ei(this),this.evals=new Ai(this),this.containers=new Ti(this),this.videos=new Qs(this),r===void 0)throw new V("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");let a={apiKey:r,organization:n,project:o,webhookSecret:i,...s,baseURL:e||"https://api.openai.com/v1"};if(!a.dangerouslyAllowBrowser&&kE())throw new V(`It looks like you're running in a browser-like environment. + +This is disabled by default, as it risks exposing your secret API credentials to attackers. +If you understand the risks and have appropriate mitigations in place, +you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g., + +new OpenAI({ apiKey, dangerouslyAllowBrowser: true }); + +https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety +`);this.baseURL=a.baseURL,this.timeout=a.timeout??Fw.DEFAULT_TIMEOUT,this.logger=a.logger??console;let c="warn";this.logLevel=c,this.logLevel=hw(a.logLevel,"ClientOptions.logLevel",this)??hw(Si("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??c,this.fetchOptions=a.fetchOptions,this.maxRetries=a.maxRetries??2,this.fetch=a.fetch??EE(),ce(this,Wm,OE,"f"),this._options=a,this.apiKey=typeof r=="string"?r:"Missing Key",this.organization=n,this.project=o,this.webhookSecret=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return L([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return fw(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${vi}`}defaultIdempotencyKey(){return`stainless-node-retry-${nw()}`}makeStatusError(e,r,n,o){return Pt.generate(e,r,n,o)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(n){throw n instanceof V?n:new V(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new V(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let o=!S(this,Uw,"m",vA).call(this)&&n||this.baseURL,i=yE(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery();return vE(s)||(r={...s,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}async prepareOptions(e){await this._callApiKey()}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(o=>({method:e,path:r,...o})))}request(e,r=null){return new Rs(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,i=o.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(o);let{req:s,url:a,timeout:c}=await this.buildRequest(o,{retryCount:i-r});await this.prepareRequest(s,{url:a,options:o});let u="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),l=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if($t(this).debug(`[${u}] sending request`,Lo({retryOfRequestLogID:n,method:o.method,url:a,options:o,headers:s.headers})),o.signal?.aborted)throw new xt;let f=new AbortController,p=await this.fetchWithTimeout(a,s,c,f).catch(rd),m=Date.now();if(p instanceof globalThis.Error){let v=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new xt;let b=td(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return $t(this).info(`[${u}] connection ${b?"timed out":"failed"} - ${v}`),$t(this).debug(`[${u}] connection ${b?"timed out":"failed"} (${v})`,Lo({retryOfRequestLogID:n,url:a,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??u);throw $t(this).info(`[${u}] connection ${b?"timed out":"failed"} - error; no more retries left`),$t(this).debug(`[${u}] connection ${b?"timed out":"failed"} (error; no more retries left)`,Lo({retryOfRequestLogID:n,url:a,durationMs:m-d,message:p.message})),b?new Do:new yi({cause:p})}let h=[...p.headers.entries()].filter(([v])=>v==="x-request-id").map(([v,b])=>", "+v+": "+JSON.stringify(b)).join(""),_=`[${u}${l}${h}] ${s.method} ${a} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let v=await this.shouldRetry(p);if(r&&v){let J=`retrying, ${r} attempts remaining`;return await AE(p.body),$t(this).info(`${_} - ${J}`),$t(this).debug(`[${u}] response error (${J})`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??u,p.headers)}let b=v?"error; no more retries left":"error; not retryable";$t(this).info(`${_} - ${b}`);let x=await p.text().catch(J=>rd(J).message),k=xE(x),T=k?void 0:x;throw $t(this).debug(`[${u}] response error (${b})`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:T,durationMs:Date.now()-d})),this.makeStatusError(p.status,k,T,p.headers)}return $t(this).info(_),$t(this).debug(`[${u}] response start`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),{response:p,options:o,controller:f,requestLogID:u,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new cd(this,n,e)}async fetchWithTimeout(e,r,n,o){let{signal:i,method:s,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let c=setTimeout(()=>o.abort(),n),u=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,l={signal:o.signal,...u?{duplex:"half"}:{},method:"GET",...a};s&&(l.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,l)}finally{clearTimeout(c)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,o){let i,s=o?.get("retry-after-ms");if(s){let c=parseFloat(s);Number.isNaN(c)||(i=c)}let a=o?.get("retry-after");if(a&&!i){let c=parseFloat(a);Number.isNaN(c)?i=Date.parse(a)-Date.now():i=c*1e3}if(!(i&&0<=i&&i<60*1e3)){let c=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,c)}return await no(i),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,s=Math.min(.5*Math.pow(2,i),8),a=1-Math.random()*.25;return s*a*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:s,defaultBaseURL:a}=n,c=this.buildURL(i,s,a);"timeout"in n&&wE("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:u,body:l}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:u,retryCount:r});return{req:{method:o,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:c,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let s=L([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...TE(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=L([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:xm(e)}:S(this,Wm,"f").call(this,{body:e,headers:n})}};Fw=fe,Wm=new WeakMap,Uw=new WeakSet,vA=function(){return this.baseURL!=="https://api.openai.com/v1"};fe.OpenAI=Fw;fe.DEFAULT_TIMEOUT=6e5;fe.OpenAIError=V;fe.APIError=Pt;fe.APIConnectionError=yi;fe.APIConnectionTimeoutError=Do;fe.APIUserAbortError=xt;fe.NotFoundError=gc;fe.ConflictError=_c;fe.RateLimitError=vc;fe.BadRequestError=fc;fe.AuthenticationError=mc;fe.InternalServerError=bc;fe.PermissionDeniedError=hc;fe.UnprocessableEntityError=yc;fe.InvalidWebhookSignatureError=ro;fe.toFile=ld;fe.Completions=Bs;fe.Chat=xi;fe.Embeddings=qs;fe.Files=Gs;fe.Images=Js;fe.Audio=ao;fe.Moderations=Ys;fe.Models=Xs;fe.FineTuning=Mn;fe.Graders=Oi;fe.VectorStores=Ko;fe.Webhooks=ea;fe.Beta=zn;fe.Batches=js;fe.Uploads=Ci;fe.Responses=Go;fe.Realtime=Vo;fe.Conversations=Ei;fe.Evals=Ai;fe.Containers=Ti;fe.Videos=Qs;var lB=Object.defineProperty,G=(t,e)=>{for(var r in e)lB(t,r,{get:e[r],enumerable:!0})};function Jr(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function nu(t){return Jr(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function ou(t){return Jr(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function bA(t){return Jr(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function Jm(t){return Jr(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function Xm(t){if(Jr(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function Ym(t){let e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);let r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);let o={};for(let i of t.split(";").slice(1)){let s=i.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);let a=s[0].trim(),c=s[1].trim();if(a==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);o[a]=c}return{type:r,subtype:n,parameters:o}}function ta({dataUrl:t,asTypedArray:e=!1}){let r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let o=e?Uint8Array.from(atob(r[2]),i=>i.charCodeAt(0)):r[2];return{mime_type:n,data:o}}}function $d(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}function Qm(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var OA=mn(xA(),1),_B=mn(AA(),1);function PA(t,e){return e?.[t]||(0,OA.default)(t)}function CA(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var yB={};G(yB,{Serializable:()=>uo,get_lc_unique_name:()=>eh});function RA(t){return Array.isArray(t)?[...t]:{...t}}function vB(t,e){let r=RA(t);for(let[n,o]of Object.entries(e)){let[i,...s]=n.split(".").reverse(),a=r;for(let c of s.reverse()){if(a[c]===void 0)break;a[c]=RA(a[c]),a=a[c]}a[i]!==void 0&&(a[i]={lc:1,type:"secret",id:[o]})}return r}function eh(t){let e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var uo=class NA{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eh(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof NA||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((o,i)=>(o[i]=i in this?this[i]:this.lc_kwargs[i],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(e,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));return Object.keys(r).forEach(o=>{let i=this,s=n,[a,...c]=o.split(".").reverse();for(let u of c.reverse()){if(!(u in i)||i[u]===void 0)return;(!(u in s)||s[u]===void 0)&&(typeof i[u]=="object"&&i[u]!=null?s[u]={}:Array.isArray(i[u])&&(s[u]=[])),i=i[u],s=s[u]}a in i&&i[a]!==void 0&&(s[a]=s[a]||i[a])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:CA(Object.keys(r).length?vB(n,r):n,PA,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function re(t,e){return me(t)&&t.type===e}function me(t){return typeof t=="object"&&t!==null}function Ar(t){return Array.isArray(t)}function K(t){return typeof t=="string"}function Xr(t){return typeof t=="number"}function th(t){return t instanceof Uint8Array}function qw(t){try{return JSON.parse(t)}catch{return}}var Ho=t=>t();function bB(t){if(t.type==="char_location"&&K(t.document_title)&&Xr(t.start_char_index)&&Xr(t.end_char_index)&&K(t.cited_text)){let{document_title:e,start_char_index:r,end_char_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"char",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="page_location"&&K(t.document_title)&&Xr(t.start_page_number)&&Xr(t.end_page_number)&&K(t.cited_text)){let{document_title:e,start_page_number:r,end_page_number:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"page",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="content_block_location"&&K(t.document_title)&&Xr(t.start_block_index)&&Xr(t.end_block_index)&&K(t.cited_text)){let{document_title:e,start_block_index:r,end_block_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"block",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="web_search_result_location"&&K(t.url)&&K(t.title)&&K(t.encrypted_index)&&K(t.cited_text)){let{url:e,title:r,encrypted_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"url",url:e,title:r,startIndex:Number(n),endIndex:Number(n),citedText:o}}if(t.type==="search_result_location"&&K(t.source)&&K(t.title)&&Xr(t.start_block_index)&&Xr(t.end_block_index)&&K(t.cited_text)){let{source:e,title:r,start_block_index:n,end_block_index:o,cited_text:i,...s}=t;return{...s,type:"citation",source:"search",url:e,title:r??void 0,startIndex:n,endIndex:o,citedText:i}}}function MA(t){if(re(t,"document")&&me(t.source)&&"type"in t.source){if(t.source.type==="base64"&&K(t.source.media_type)&&K(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&K(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&K(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&K(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(re(t,"image")&&me(t.source)&&"type"in t.source){if(t.source.type==="base64"&&K(t.source.media_type)&&K(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&K(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&K(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function jA(t){function*e(){for(let r of t){let n=MA(r);n?yield n:yield r}}return Array.from(e())}function zA(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"text")&&K(n.text)){let{text:o,citations:i,...s}=n;if(Ar(i)&&i.length){let a=i.reduce((c,u)=>{let l=bB(u);return l?[...c,l]:c},[]);yield{...s,type:"text",text:o,annotations:a};continue}else{yield{...s,type:"text",text:o};continue}}else if(re(n,"thinking")&&K(n.thinking)){let{thinking:o,signature:i,...s}=n;yield{...s,type:"reasoning",reasoning:o,signature:i};continue}else if(re(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(re(n,"tool_use")&&K(n.name)&&K(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(re(n,"input_json_delta")){if(wB(t)&&t.tool_call_chunks?.length){let o=t.tool_call_chunks[0];yield{type:"tool_call_chunk",id:o.id,name:o.name,args:o.args,index:o.index};continue}}else if(re(n,"server_tool_use")&&K(n.name)&&K(n.id)){let{name:o,id:i}=n;if(o==="web_search"){let s=Ho(()=>{if(typeof n.input=="string")return n.input;if(me(n.input)&&K(n.input.query))return n.input.query;if(K(n.partial_json)){let a=qw(n.partial_json);if(a?.query)return a.query}return""});yield{id:i,type:"server_tool_call",name:"web_search",args:{query:s}};continue}else if(n.name==="code_execution"){let s=Ho(()=>{if(typeof n.input=="string")return n.input;if(me(n.input)&&K(n.input.code))return n.input.code;if(K(n.partial_json)){let a=qw(n.partial_json);if(a?.code)return a.code}return""});yield{id:i,type:"server_tool_call",name:"code_execution",args:{code:s}};continue}}else if(re(n,"web_search_tool_result")&&K(n.tool_use_id)&&Ar(n.content)){let{content:o,tool_use_id:i}=n,s=o.reduce((a,c)=>re(c,"web_search_result")?[...a,c.url]:a,[]);yield{type:"server_tool_call_result",name:"web_search",toolCallId:i,status:"success",output:{urls:s}};continue}else if(re(n,"code_execution_tool_result")&&K(n.tool_use_id)&&me(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(re(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(re(n,"mcp_tool_result")&&K(n.tool_use_id)&&me(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(re(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(re(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(re(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let o=MA(n);if(o){yield o;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var DA={translateContent:zA,translateContentChunk:zA};function wB(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}function xB(t){return nu(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:ou(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:Jm(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function LA(t){return t.map(xB)}function UA(t){return!!(re(t,"image_url")&&me(t.image_url)||re(t,"input_audio")&&me(t.input_audio)||re(t,"file")&&me(t.file))}function FA(t){if(re(t,"image_url")&&me(t.image_url)&&K(t.image_url.url)){let e=ta({dataUrl:t.image_url.url});return e?{type:"image",mimeType:e.mime_type,data:e.data}:{type:"image",url:t.image_url.url}}else{if(re(t,"input_audio")&&me(t.input_audio)&&K(t.input_audio.data)&&K(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(re(t,"file")&&me(t.file)&&K(t.file.data)){let e=ta({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(K(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}function $B(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...rh(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function IB(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...rh(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function rh(t){let e=[];for(let r of t)UA(r)?e.push(FA(r)):e.push(r);return e}function SB(t){if(t.type==="url_citation"){let{url:e,title:r,start_index:n,end_index:o}=t;return{type:"citation",url:e,title:r,startIndex:n,endIndex:o}}if(t.type==="file_citation"){let{file_id:e,filename:r,index:n}=t;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:e}}return t}function BA(t){function*e(){me(t.additional_kwargs?.reasoning)&&Ar(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((o,i)=>me(i)&&K(i.text)?`${o}${i.text}`:o,"")});let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r)if(re(n,"text")){let{text:o,annotations:i,...s}=n;Array.isArray(i)?yield{...s,type:"text",text:String(o),annotations:i.map(SB)}:yield{...s,type:"text",text:String(o)}}for(let n of t.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(me(t.additional_kwargs)&&Ar(t.additional_kwargs.tool_outputs))for(let n of t.additional_kwargs.tool_outputs){if(re(n,"web_search_call")){yield{id:n.id,type:"server_tool_call",name:"web_search",args:{query:n.query}};continue}else if(re(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{query:n.query}};continue}else if(re(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(re(n,"code_interpreter_call")){if(K(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),Ar(n.outputs)){let o=Ho(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(let i of n.outputs)if(re(i,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:o??0,stderr:[0,void 0].includes(o)?void 0:String(i.logs),stdout:[0,void 0].includes(o)?String(i.logs):void 0}};continue}}continue}else if(re(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(re(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(re(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(re(n,"image_generation_call")){yield{type:"non_standard",value:n};continue}me(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function kB(t){function*e(){yield*BA(t);for(let r of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(e())}var ZA={translateContent:t=>typeof t.content=="string"?$B(t):BA(t),translateContentChunk:t=>typeof t.content=="string"?IB(t):kB(t)};function qA(t,e="pretty"){return e==="pretty"?TB(t):JSON.stringify(t)}function TB(t){let e=[],r=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),o="=".repeat(n),i=r.length%2===0?o:`${o}=`;if(e.push(`${o}${r}${i}`),t.type==="ai"){let s=t;if(s.tool_calls&&s.tool_calls.length>0){e.push("Tool Calls:");for(let a of s.tool_calls){e.push(` ${a.name} (${a.id})`),e.push(` Call ID: ${a.id}`),e.push(" Args:");for(let[c,u]of Object.entries(a.args))e.push(` ${c}: ${u}`)}}}if(t.type==="tool"){let s=t;s.name&&e.push(`Name: ${s.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(` +`)}var Vw=Symbol.for("langchain.message");function er(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.length===0?t:Array.isArray(e)&&e.some(r=>Jr(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?ra(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>Jr(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function nh(t,e){return t==="error"||e==="error"?"error":"success"}function EB(t,e){function r(n,o){if(typeof n!="object"||n===null||n===void 0)return n;if(o>=e)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(s=>r(s,o+1));let i={};for(let s of Object.keys(n))i[s]=r(n[s],o+1);return i}return JSON.stringify(r(t,0),null,2)}var qt=class extends uo{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[Vw]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(t){let e=typeof t=="string"||Array.isArray(t)?{content:t}:t;e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),this.name=e.name,e.content===void 0&&e.contentBlocks!==void 0?(this.content=e.contentBlocks,this.response_metadata={output_version:"v1",...e.response_metadata}):e.content!==void 0?(this.content=e.content??[],this.response_metadata=e.response_metadata):(this.content=[],this.response_metadata=e.response_metadata),this.additional_kwargs=e.additional_kwargs,this.id=e.id}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(t=>typeof t=="string"?t:t.type==="text"?t.text:"").join(""):""}get contentBlocks(){let t=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[LA,rh,jA].reduce((n,o)=>o(n),t)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(t){return typeof t=="object"&&t!==null&&Vw in t&&t[Vw]===!0&&Qm(t)}_updateId(t){this.id=t,this.lc_kwargs.id=t}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](t){if(t===null)return this;let e=EB(this._printableFields,Math.max(4,t));return`${this.constructor.lc_name()} ${e}`}toFormattedString(t="pretty"){return qA(this,t)}};function VA(t){return Array.isArray(t)&&t.every(e=>typeof e.index=="number")}function dt(t={},e={}){let r={...t};for(let[n,o]of Object.entries(e))if(r[n]==null)r[n]=o;else{if(o==null)continue;if(typeof r[n]!=typeof o||Array.isArray(r[n])!==Array.isArray(o))throw new Error(`field[${n}] already exists in the message chunk, but with a different type.`);if(typeof r[n]=="string"){if(n==="type")continue;["id","name","output_version","model_provider"].includes(n)?o&&(r[n]=o):r[n]+=o}else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=dt(r[n],o);else if(Array.isArray(r[n]))r[n]=ra(r[n],o);else{if(r[n]===o)continue;console.warn(`field[${n}] already exists in this message chunk and value has unsupported type.`)}}return r}function ra(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)return t||e;{let r=[...t];for(let n of e)if(typeof n=="object"&&n!==null&&"index"in n&&typeof n.index=="number"){let o=r.findIndex(i=>{let s=typeof i=="object",a="index"in i&&i.index===n.index,c="id"in i&&"id"in n&&i?.id===n?.id,u=!("id"in i)||!i?.id||!("id"in n)||!n?.id;return s&&a&&(c||u)});o!==-1&&typeof r[o]=="object"&&r[o]!==null?r[o]=dt(r[o],n):r.push(n)}else{if(typeof n=="object"&&n!==null&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function oh(t,e){if(!t&&!e)throw new Error("Cannot merge two undefined objects.");if(!t||!e)return t||e;if(typeof t!=typeof e)throw new Error(`Cannot merge objects of different types. +Left ${typeof t} +Right ${typeof e}`);if(typeof t=="string"&&typeof e=="string")return t+e;if(Array.isArray(t)&&Array.isArray(e))return ra(t,e);if(typeof t=="object"&&typeof e=="object")return dt(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types. +Left ${t} +Right ${e}`)}var fr=class GA extends qt{static isInstance(e){if(!super.isInstance(e))return!1;let r=Object.getPrototypeOf(e);for(;r!==null;){if(r===GA.prototype)return!0;r=Object.getPrototypeOf(r)}return!1}};function ih(t){return typeof t.role=="string"}function Yr(t){return typeof t?._getType=="function"}function iu(t){return fr.isInstance(t)}function sh(t,e){return dt(t??{},e??{})}function KA(t,e){let r={};return(t?.audio!==void 0||e?.audio!==void 0)&&(r.audio=(t?.audio??0)+(e?.audio??0)),(t?.image!==void 0||e?.image!==void 0)&&(r.image=(t?.image??0)+(e?.image??0)),(t?.video!==void 0||e?.video!==void 0)&&(r.video=(t?.video??0)+(e?.video??0)),(t?.document!==void 0||e?.document!==void 0)&&(r.document=(t?.document??0)+(e?.document??0)),(t?.text!==void 0||e?.text!==void 0)&&(r.text=(t?.text??0)+(e?.text??0)),r}function AB(t,e){let r={...KA(t,e)};return(t?.cache_read!==void 0||e?.cache_read!==void 0)&&(r.cache_read=(t?.cache_read??0)+(e?.cache_read??0)),(t?.cache_creation!==void 0||e?.cache_creation!==void 0)&&(r.cache_creation=(t?.cache_creation??0)+(e?.cache_creation??0)),r}function OB(t,e){let r={...KA(t,e)};return(t?.reasoning!==void 0||e?.reasoning!==void 0)&&(r.reasoning=(t?.reasoning??0)+(e?.reasoning??0)),r}function ah(t,e){return{input_tokens:(t?.input_tokens??0)+(e?.input_tokens??0),output_tokens:(t?.output_tokens??0)+(e?.output_tokens??0),total_tokens:(t?.total_tokens??0)+(e?.total_tokens??0),input_token_details:AB(t?.input_token_details,e?.input_token_details),output_token_details:OB(t?.output_token_details,e?.output_token_details)}}var PB={};G(PB,{ToolMessage:()=>Or,ToolMessageChunk:()=>na,defaultToolCallParser:()=>Sd,isDirectToolOutput:()=>Id,isToolMessage:()=>Gw,isToolMessageChunk:()=>Kw});function Id(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}var Or=class extends qt{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}lc_direct_tool_output=!0;type="tool";status;tool_call_id;metadata;artifact;constructor(t,e,r){let n=typeof t=="string"||Array.isArray(t)?{content:t,name:r,tool_call_id:e}:t;super(n),this.tool_call_id=n.tool_call_id,this.artifact=n.artifact,this.status=n.status,this.metadata=n.metadata}static isInstance(t){return super.isInstance(t)&&t.type==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},na=class extends fr{type="tool";tool_call_id;status;artifact;constructor(t){super(t),this.tool_call_id=t.tool_call_id,this.artifact=t.artifact,this.status=t.status}static lc_name(){return"ToolMessageChunk"}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),artifact:oh(this.artifact,t.artifact),tool_call_id:this.tool_call_id,id:this.id??t.id,status:nh(this.status,t.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}};function Sd(t){let e=[],r=[];for(let n of t)if(n.function){let o=n.function.name;try{let i=JSON.parse(n.function.arguments);e.push({name:o||"",args:i||{},id:n.id})}catch{r.push({name:o,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[e,r]}function Gw(t){return typeof t=="object"&&t!==null&&"getType"in t&&typeof t.getType=="function"&&t.getType()==="tool"}function Kw(t){return t._getType()==="tool"}var jn=class HA extends qt{static lc_name(){return"ChatMessage"}type="generic";role;static _chatMessageClass(){return HA}constructor(e,r){(typeof e=="string"||Array.isArray(e))&&(e={content:e,role:r}),super(e),this.role=e.role}static isInstance(e){return super.isInstance(e)&&e.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},Ri=class extends fr{static lc_name(){return"ChatMessageChunk"}type="generic";role;constructor(t,e){(typeof t=="string"||Array.isArray(t))&&(t={content:t,role:e}),super(t),this.role=t.role}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),role:this.role,id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}};function WA(t){return t._getType()==="generic"}function JA(t){return t._getType()==="generic"}var oa=class extends qt{static lc_name(){return"FunctionMessage"}type="function";name;constructor(t){super(t),this.name=t.name}},Ni=class extends fr{static lc_name(){return"FunctionMessageChunk"}type="function";concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),name:this.name??"",id:this.id??t.id})}};function XA(t){return t._getType()==="function"}function YA(t){return t._getType()==="function"}var mr=class extends qt{static lc_name(){return"HumanMessage"}type="human";constructor(t){super(t)}static isInstance(t){return super.isInstance(t)&&t.type==="human"}},zi=class extends fr{static lc_name(){return"HumanMessageChunk"}type="human";constructor(t){super(t)}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="human"}};function QA(t){return t.getType()==="human"}function eO(t){return t.getType()==="human"}var ia=class extends qt{type="remove";id;constructor(t){super({...t,content:[]}),this.id=t.id}get _printableFields(){return{...super._printableFields,id:this.id}}static isInstance(t){return super.isInstance(t)&&t.type==="remove"}};var hn=class ch extends qt{static lc_name(){return"SystemMessage"}type="system";constructor(e){super(e)}concat(e){if(typeof e=="string")return new ch({...this,content:er(this.content,e)});if(ch.isInstance(e))return new ch({...this,additional_kwargs:{...this.additional_kwargs,...e.additional_kwargs},response_metadata:{...this.response_metadata,...e.response_metadata},content:er(this.content,e.content)});throw new Error("Unexpected chunk type for system message")}static isInstance(e){return super.isInstance(e)&&e.type==="system"}},lo=class extends fr{static lc_name(){return"SystemMessageChunk"}type="system";constructor(t){super(t)}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="system"}};function tO(t){return t._getType()==="system"}function rO(t){return t._getType()==="system"}function uh(t,e){return t.lc_error_code=e,t.message=`${t.message} + +Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/ +`,t}function Mi(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function nO(t){return!!(t&&typeof t=="object"&&"toolCall"in t&&t.toolCall!=null&&typeof t.toolCall=="object"&&"id"in t.toolCall&&typeof t.toolCall.id=="string")}var su=class extends Error{output;constructor(t,e){super(t),this.output=e}};function kd(t,e=sa){t=t.trim();let r=t.indexOf("```");if(r===-1)return e(t);let n=t.substring(r+3);n.startsWith(`json +`)?n=n.substring(5):n.startsWith("json")?n=n.substring(4):n.startsWith(` +`)&&(n=n.substring(1));let o=n.indexOf("```"),i=n;return o!==-1&&(i=n.substring(0,o)),e(i.trim())}function CB(t){try{return JSON.parse(t)}catch{}let e=t.trim();if(e.length===0)throw new Error("Unexpected end of JSON input");let r=0;function n(){for(;r="0"&&e[r]<="9"))throw new Error(`Invalid number at position ${l}`);if(r="1"&&e[r]<="9")for(;r="0"&&e[r]<="9";)d+=e[r],r+=1;if(r="0"&&e[r]<="9";)d+=e[r],r+=1;if(r="0"&&e[r]<="9";)d+=e[r],r+=1;if(d==="-")return-0;let f=Number.parseFloat(d);if(Number.isNaN(f))throw r=l,new Error(`Invalid number '${d}' at position ${l}`);return f}function s(){if(n(),r>=e.length)throw new Error(`Unexpected end of input at position ${r}`);let l=e[r];if(l==="{")return c();if(l==="[")return a();if(l==='"')return o();if("null".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),null;if("true".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),!0;if("false".startsWith(e.substring(r,r+5)))return r+=Math.min(5,e.length-r),!1;if(l==="-"||l>="0"&&l<="9")return i();throw new Error(`Unexpected character '${l}' at position ${r}`)}function a(){if(e[r]!=="[")throw new Error(`Expected '[' at position ${r}, got '${e[r]}'`);let l=[];if(r+=1,n(),r>=e.length)return l;if(e[r]==="]")return r+=1,l;for(;r=e.length||(l.push(s()),n(),r>=e.length))return l;if(e[r]==="]")return r+=1,l;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or ']' at position ${r}, got '${e[r]}'`)}return l}function c(){if(e[r]!=="{")throw new Error(`Expected '{' at position ${r}, got '${e[r]}'`);let l={};if(r+=1,n(),r>=e.length)return l;if(e[r]==="}")return r+=1,l;for(;r=e.length)return l;let d=o();if(n(),r>=e.length)return l;if(e[r]!==":")throw new Error(`Expected ':' at position ${r}, got '${e[r]}'`);if(r+=1,n(),r>=e.length||(l[d]=s(),n(),r>=e.length))return l;if(e[r]==="}")return r+=1,l;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or '}' at position ${r}, got '${e[r]}'`)}return l}let u=s();if(n(),r"u"?null:CB(t)}catch{return null}}function Hw(t){switch(t){case"csv":return"text/csv";case"doc":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"html":return"text/html";case"md":return"text/markdown";case"pdf":return"application/pdf";case"txt":return"text/plain";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"gif":return"image/gif";case"jpeg":return"image/jpeg";case"jpg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"flv":return"video/flv";case"mkv":return"video/mkv";case"mov":return"video/mov";case"mp4":return"video/mp4";case"mpeg":return"video/mpeg";case"mpg":return"video/mpg";case"three_gp":return"video/three_gp";case"webm":return"video/webm";case"wmv":return"video/wmv";default:return"application/octet-stream"}}function RB(t){if(me(t.document)&&me(t.document.source)){let e=me(t.document)&&K(t.document.format)?t.document.format:"",r=Hw(e);if(me(t.document.source)){if(me(t.document.source.s3Location)&&K(t.document.source.s3Location.uri))return{type:"file",mimeType:r,fileId:t.document.source.s3Location.uri};if(th(t.document.source.bytes))return{type:"file",mimeType:r,data:t.document.source.bytes};if(K(t.document.source.text))return{type:"file",mimeType:r,data:Buffer.from(t.document.source.text).toString("base64")};if(Ar(t.document.source.content)){let n=t.document.source.content.reduce((o,i)=>me(i)&&K(i.text)?o+i.text:o,"");return{type:"file",mimeType:r,data:n}}}}return{type:"non_standard",value:t}}function NB(t){if(re(t,"image")&&me(t.image)){let e=me(t.image)&&K(t.image.format)?t.image.format:"",r=Hw(e);if(me(t.image.source)){if(me(t.image.source.s3Location)&&K(t.image.source.s3Location.uri))return{type:"image",mimeType:r,fileId:t.image.source.s3Location.uri};if(th(t.image.source.bytes))return{type:"image",mimeType:r,data:t.image.source.bytes}}}return{type:"non_standard",value:t}}function zB(t){if(re(t,"video")&&me(t.video)){let e=me(t.video)&&K(t.video.format)?t.video.format:"",r=Hw(e);if(me(t.video.source)){if(me(t.video.source.s3Location)&&K(t.video.source.s3Location.uri))return{type:"video",mimeType:r,fileId:t.video.source.s3Location.uri};if(th(t.video.source.bytes))return{type:"video",mimeType:r,data:t.video.source.bytes}}}return{type:"non_standard",value:t}}function oO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"cache_point")){yield{type:"non_standard",value:n};continue}else if(re(n,"citations_content")&&me(n.citationsContent)){let o=Ar(n.citationsContent.content)?n.citationsContent.content.reduce((s,a)=>me(a)&&K(a.text)?s+a.text:s,""):"",i=Ar(n.citationsContent.citations)?n.citationsContent.citations.reduce((s,a)=>{if(me(a)){let c=Ar(a.sourceContent)?a.sourceContent.reduce((l,d)=>me(d)&&K(d.text)?l+d.text:l,""):"",u=Ho(()=>{if(me(a.location)){let l=a.location.documentChar||a.location.documentPage||a.location.documentChunk;if(me(l))return{source:Xr(l.documentIndex)?l.documentIndex.toString():void 0,startIndex:Xr(l.start)?l.start:void 0,endIndex:Xr(l.end)?l.end:void 0}}return{}});s.push({type:"citation",citedText:c,...u})}return s},[]):[];yield{type:"text",text:o,annotations:i};continue}else if(re(n,"document")&&me(n.document)){yield RB(n);continue}else if(re(n,"guard_content")){yield{type:"non_standard",value:n};continue}else if(re(n,"image")&&me(n.image)){yield NB(n);continue}else if(re(n,"reasoning_content")&&K(n.reasoningText)){yield{type:"reasoning",reasoning:n.reasoningText};continue}else if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"tool_result")){yield{type:"non_standard",value:n};continue}else{if(re(n,"tool_call"))continue;if(re(n,"video")&&me(n.video)){yield zB(n);continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var iO={translateContent:oO,translateContentChunk:oO};function sO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"inlineData")&&me(n.inlineData)&&K(n.inlineData.mimeType)&&K(n.inlineData.data)){yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data};continue}else if(re(n,"functionCall")&&me(n.functionCall)&&K(n.functionCall.name)&&me(n.functionCall.args)){yield{type:"tool_call",id:t.id,name:n.functionCall.name,args:n.functionCall.args};continue}else if(re(n,"functionResponse")){yield{type:"non_standard",value:n};continue}else if(re(n,"fileData")&&me(n.fileData)&&K(n.fileData.mimeType)&&K(n.fileData.fileUri)){yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri};continue}else if(re(n,"executableCode")){yield{type:"non_standard",value:n};continue}else if(re(n,"codeExecutionResult")){yield{type:"non_standard",value:n};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var aO={translateContent:sO,translateContentChunk:sO};function cO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"reasoning")&&K(n.reasoning)){let o=Ho(()=>{let i=r.indexOf(n);if(Ar(t.additional_kwargs?.signatures)&&i>=0)return t.additional_kwargs.signatures.at(i)});K(o)?yield{type:"reasoning",reasoning:n.reasoning,signature:o}:yield{type:"reasoning",reasoning:n.reasoning};continue}else if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"image_url")){if(K(n.image_url))if(n.image_url.startsWith("data:")){let o=/^data:([^;]+);base64,(.+)$/,i=n.image_url.match(o);i?yield{type:"image",data:i[2],mimeType:i[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url};continue}else if(re(n,"media")&&K(n.mimeType)&&K(n.data)){yield{type:"file",mimeType:n.mimeType,data:n.data};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var uO={translateContent:cO,translateContentChunk:cO};globalThis.lc_block_translators_registry??=new Map([["anthropic",DA],["bedrock-converse",iO],["google-genai",aO],["google-vertexai",uO],["openai",ZA]]);function Ww(t){return globalThis.lc_block_translators_registry.get(t)}var jt=class extends qt{type="ai";tool_calls=[];invalid_tool_calls=[];usage_metadata;get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls"}}constructor(t){let e;if(typeof t=="string"||Array.isArray(t))e={content:t,tool_calls:[],invalid_tool_calls:[],additional_kwargs:{}};else{e=t;let r=e.additional_kwargs?.tool_calls,n=e.tool_calls;r!=null&&r.length>0&&(n===void 0||n.length===0)&&console.warn(["New LangChain packages are available that more efficiently handle",`tool calling. + +Please upgrade your packages to versions that set`,"message tool calls. e.g., `pnpm install @langchain/anthropic`,","pnpm install @langchain/openai`, etc."].join(" "));try{if(r!=null&&n===void 0){let[o,i]=Sd(r);e.tool_calls=o??[],e.invalid_tool_calls=i??[]}else e.tool_calls=e.tool_calls??[],e.invalid_tool_calls=e.invalid_tool_calls??[]}catch{e.tool_calls=[],e.invalid_tool_calls=[]}if(e.response_metadata!==void 0&&"output_version"in e.response_metadata&&e.response_metadata.output_version==="v1"&&(e.contentBlocks=e.content,e.content=void 0),e.contentBlocks!==void 0){e.contentBlocks.push(...e.tool_calls.map(i=>({type:"tool_call",id:i.id,name:i.name,args:i.args})));let o=e.contentBlocks.filter(i=>i.type==="tool_call").filter(i=>!e.tool_calls?.some(s=>s.id===i.id&&s.name===i.name));o.length>0&&(e.tool_calls=o.map(i=>({type:"tool_call",id:i.id,name:i.name,args:i.args})))}}super(e),typeof e!="string"&&(this.tool_calls=e.tool_calls??this.tool_calls,this.invalid_tool_calls=e.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=e.usage_metadata}static lc_name(){return"AIMessage"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let e=Ww(this.response_metadata.model_provider);if(e)return e.translateContent(this)}let t=super.contentBlocks;if(this.tool_calls){let e=this.tool_calls.filter(r=>!t.some(n=>n.id===r.id&&n.name===r.name));t.push(...e.map(r=>({...r,type:"tool_call",id:r.id,name:r.name,args:r.args})))}return t}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}static isInstance(t){return super.isInstance(t)&&t.type==="ai"}};function aa(t){return t._getType()==="ai"}function Td(t){return t._getType()==="ai"}var Dt=class extends fr{type="ai";tool_calls=[];invalid_tool_calls=[];tool_call_chunks=[];usage_metadata;constructor(t){let e;typeof t=="string"||Array.isArray(t)?e={content:t,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]}:t.tool_call_chunks===void 0||t.tool_call_chunks.length===0?e={...t,tool_calls:t.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:t.usage_metadata!==void 0?t.usage_metadata:void 0}:e={...t,...lh(t.tool_call_chunks??[]),usage_metadata:t.usage_metadata!==void 0?t.usage_metadata:void 0},super(e),this.tool_call_chunks=e.tool_call_chunks??this.tool_call_chunks,this.tool_calls=e.tool_calls??this.tool_calls,this.invalid_tool_calls=e.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=e.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks"}}static lc_name(){return"AIMessageChunk"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let e=Ww(this.response_metadata.model_provider);if(e)return e.translateContent(this)}let t=super.contentBlocks;if(this.tool_calls&&typeof this.content!="string"){let e=this.content.filter(r=>r.type==="tool_call").map(r=>r.id);for(let r of this.tool_calls)r.id&&!e.includes(r.id)&&t.push({...r,type:"tool_call",id:r.id,name:r.name,args:r.args})}return t}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(t){let e={content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:sh(this.response_metadata,t.response_metadata),tool_call_chunks:[],id:this.id??t.id};if(this.tool_call_chunks!==void 0||t.tool_call_chunks!==void 0){let n=ra(this.tool_call_chunks,t.tool_call_chunks);n!==void 0&&n.length>0&&(e.tool_call_chunks=n)}(this.usage_metadata!==void 0||t.usage_metadata!==void 0)&&(e.usage_metadata=ah(this.usage_metadata,t.usage_metadata));let r=this.constructor;return new r(e)}static isInstance(t){return super.isInstance(t)&&t.type==="ai"}};var Xw=t=>t();function MB(t){return Mi(t)?t:typeof t.id=="string"&&t.type==="function"&&typeof t.function=="object"&&t.function!==null&&"arguments"in t.function&&typeof t.function.arguments=="string"&&"name"in t.function&&typeof t.function.name=="string"?{id:t.id,args:JSON.parse(t.function.arguments),name:t.function.name,type:"tool_call"}:t}function jB(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function Jw(t){let e,r;if(jB(t)){let n=t.id.at(-1);n==="HumanMessage"||n==="HumanMessageChunk"?e="user":n==="AIMessage"||n==="AIMessageChunk"?e="assistant":n==="SystemMessage"||n==="SystemMessageChunk"?e="system":n==="FunctionMessage"||n==="FunctionMessageChunk"?e="function":n==="ToolMessage"||n==="ToolMessageChunk"?e="tool":e="unknown",r=t.kwargs}else{let{type:n,...o}=t;e=n,r=o}if(e==="human"||e==="user")return new mr(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new jt(r);let i=n.map(MB);return new jt({...o,tool_calls:i})}else{if(e==="system")return new hn(r);if(e==="developer")return new hn({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new Or({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});if(e==="remove"&&"id"in r&&typeof r.id=="string")return new ia({...r,id:r.id});throw uh(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported. + +Received: ${JSON.stringify(t,null,2)}`),"MESSAGE_COERCION_FAILURE")}}function ji(t){if(typeof t=="string")return new mr(t);if(Yr(t))return t;if(Array.isArray(t)){let[e,r]=t;return Jw({type:e,content:r})}else if(ih(t)){let{role:e,...r}=t;return Jw({...r,type:e})}else return Jw(t)}function au(t,e="Human",r="AI"){let n=[];for(let o of t){let i;if(o._getType()==="human")i=e;else if(o._getType()==="ai")i=r;else if(o._getType()==="system")i="System";else if(o._getType()==="tool")i="Tool";else if(o._getType()==="generic")i=o.role;else throw new Error(`Got unsupported message type: ${o._getType()}`);let s=o.name?`${o.name}, `:"",a=typeof o.content=="string"?o.content:JSON.stringify(o.content,null,2);n.push(`${i}: ${s}${a}`)}return n.join(` +`)}function DB(t){if(t.data!==void 0)return t;{let e=t;return{type:e.type,data:{content:e.text,role:e.role,name:void 0,tool_call_id:void 0}}}}function Ed(t){let e=DB(t);switch(e.type){case"human":return new mr(e.data);case"ai":return new jt(e.data);case"system":return new hn(e.data);case"function":if(e.data.name===void 0)throw new Error("Name must be defined for function messages");return new oa(e.data);case"tool":if(e.data.tool_call_id===void 0)throw new Error("Tool call ID must be defined for tool messages");return new Or(e.data);case"generic":if(e.data.role===void 0)throw new Error("Role must be defined for chat messages");return new jn(e.data);default:throw new Error(`Got unexpected type: ${e.type}`)}}function lO(t){return t.map(Ed)}function dO(t){return t.map(e=>e.toDict())}function ca(t){let e=t._getType();if(e==="human")return new zi({...t});if(e==="ai"){let r={...t};return"tool_calls"in r&&(r={...r,tool_call_chunks:r.tool_calls?.map(n=>({...n,type:"tool_call_chunk",index:void 0,args:JSON.stringify(n.args)}))}),new Dt({...r})}else{if(e==="system")return new lo({...t});if(e==="function")return new Ni({...t});if(jn.isInstance(t))return new Ri({...t});throw new Error("Unknown message type.")}}function lh(t){let e=t.reduce((o,i)=>{let s=o.findIndex(([a])=>"id"in i&&i.id&&"index"in i&&i.index!==void 0?i.id===a.id&&i.index===a.index:"id"in i&&i.id?i.id===a.id:"index"in i&&i.index!==void 0?i.index===a.index:!1);return s!==-1?o[s].push(i):o.push([i]),o},[]),r=[],n=[];for(let o of e){let i=null,s=o[0]?.name??"",a=o.map(l=>l.args||"").join("").trim(),c=a.length?a:"{}",u=o[0]?.id;try{if(i=sa(c),!u||i===null||typeof i!="object"||Array.isArray(i))throw new Error("Malformed tool call chunk args.");r.push({name:s,args:i,id:u,type:"tool_call"})}catch{n.push({name:s,args:c,id:u,error:"Malformed args.",type:"invalid_tool_call"})}}return{tool_call_chunks:t,tool_calls:r,invalid_tool_calls:n}}var pO=Symbol.for("ls:tracing_async_local_storage"),Di=Symbol.for("lc:context_variables"),fO=t=>{globalThis[pO]=t},Li=()=>globalThis[pO];var LB={};G(LB,{getEnv:()=>Qw,getEnvironmentVariable:()=>It,getRuntimeEnvironment:()=>ex,isBrowser:()=>mO,isDeno:()=>dh,isJsDom:()=>gO,isNode:()=>_O,isWebWorker:()=>hO});var mO=()=>typeof window<"u"&&typeof window.document<"u",hO=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",gO=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),dh=()=>typeof Deno<"u",_O=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!dh(),Qw=()=>{let t;return mO()?t="browser":_O()?t="node":hO()?t="webworker":gO()?t="jsdom":dh()?t="deno":t="other",t},Yw;function ex(){return Yw===void 0&&(Yw={library:"langchain-js",runtime:Qw()}),Yw}function It(t){try{return typeof process<"u"?process.env?.[t]:dh()?Deno?.env.get(t):void 0}catch{return}}var yO=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function UB(t){return typeof t=="string"&&yO.test(t)}var Ui=UB;function FB(t){if(!Ui(t))throw TypeError("Invalid UUID");let e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var vO=FB;var Vt=[];for(let t=0;t<256;++t)Vt.push((t+256).toString(16).slice(1));function cu(t,e=0){return(Vt[t[e+0]]+Vt[t[e+1]]+Vt[t[e+2]]+Vt[t[e+3]]+"-"+Vt[t[e+4]]+Vt[t[e+5]]+"-"+Vt[t[e+6]]+Vt[t[e+7]]+"-"+Vt[t[e+8]]+Vt[t[e+9]]+"-"+Vt[t[e+10]]+Vt[t[e+11]]+Vt[t[e+12]]+Vt[t[e+13]]+Vt[t[e+14]]+Vt[t[e+15]]).toLowerCase()}import BB from"node:crypto";var fh=new Uint8Array(256),ph=fh.length;function Ad(){return ph>fh.length-16&&(BB.randomFillSync(fh),ph=0),fh.slice(ph,ph+=16)}function ZB(t){t=unescape(encodeURIComponent(t));let e=[];for(let r=0;rDn&&t.msecs===void 0&&(Dn=s,a!==null&&(c=null,u=null)),a!==null&&(a>2147483647&&(a=2147483647),c=a>>>19&4095,u=a&524287),(c===null||u===null)&&(c=i[6]&127,c=c<<8|i[7],u=i[8]&63,u=u<<8|i[9],u=u<<5|i[10]>>>3),s+1e4>Dn&&a===null?++u>524287&&(u=0,++c>4095&&(c=0,Dn++)):Dn=s,xO=c,wO=u,o[n++]=Dn/1099511627776&255,o[n++]=Dn/4294967296&255,o[n++]=Dn/16777216&255,o[n++]=Dn/65536&255,o[n++]=Dn/256&255,o[n++]=Dn&255,o[n++]=c>>>4&15|112,o[n++]=c&255,o[n++]=u>>>13&63|128,o[n++]=u>>>5&255,o[n++]=u<<3&255|i[10]&7,o[n++]=i[11],o[n++]=i[12],o[n++]=i[13],o[n++]=i[14],o[n++]=i[15],e||cu(o)}var nx=XB;var YB={};G(YB,{BaseCallbackHandler:()=>la,callbackHandlerPrefersStreaming:()=>Od,isBaseCallbackHandler:()=>ox});var QB=class{};function Od(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var la=class extends QB{lc_serializable=!1;get lc_namespace(){return["langchain_core","callbacks",this.name]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eh(this.constructor)]}lc_kwargs;ignoreLLM=!1;ignoreChain=!1;ignoreAgent=!1;ignoreRetriever=!1;ignoreCustomEvent=!1;raiseError=!1;awaitHandlers=It("LANGCHAIN_CALLBACKS_BACKGROUND")==="false";constructor(t){super(),this.lc_kwargs=t||{},t&&(this.ignoreLLM=t.ignoreLLM??this.ignoreLLM,this.ignoreChain=t.ignoreChain??this.ignoreChain,this.ignoreAgent=t.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=t.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=t.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=t.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(t._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return uo.prototype.toJSON.call(this)}toJSONNotImplemented(){return uo.prototype.toJSONNotImplemented.call(this)}static fromMethods(t){class e extends la{name=Et();constructor(){super(),Object.assign(this,t)}}return new e}},ox=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"};var IO="gen_ai.operation.name",SO="gen_ai.system",ix="gen_ai.request.model",kO="gen_ai.response.model",sx="gen_ai.usage.input_tokens",ax="gen_ai.usage.output_tokens",cx="gen_ai.usage.total_tokens",TO="gen_ai.request.max_tokens",EO="gen_ai.request.temperature",AO="gen_ai.request.top_p",OO="gen_ai.request.frequency_penalty",PO="gen_ai.request.presence_penalty",CO="gen_ai.response.finish_reasons",RO="gen_ai.prompt",NO="gen_ai.completion",zO="gen_ai.request.extra_query",MO="gen_ai.request.extra_body",jO="gen_ai.serialized.name",DO="gen_ai.serialized.signature",LO="gen_ai.serialized.doc",UO="gen_ai.response.id",FO="gen_ai.response.service_tier",BO="gen_ai.response.system_fingerprint",ZO="gen_ai.usage.input_token_details",qO="gen_ai.usage.output_token_details",VO="langsmith.trace.session_id",GO="langsmith.trace.session_name",KO="langsmith.span.kind",HO="langsmith.trace.name",WO="langsmith.metadata",ux="langsmith.span.tags";var JO="langsmith.request.streaming",XO="langsmith.request.headers";var t6=(...t)=>fetch(...t),YO=Symbol.for("ls:fetch_implementation");var QO=()=>{let t=globalThis[YO];return t?typeof t=="function"&&"Headers"in t&&"Request"in t&&"Response"in t:!1},eP=t=>async(...e)=>{if(t||At("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[YO]??t6)(...e);return(t||At("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r};var Pd=()=>At("PROJECT")??Qr("LANGCHAIN_SESSION")??"default";var tP={};function uu(t){tP[t]||(console.warn(t),tP[t]=!0)}var r6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function $e(t,e){if(!r6.test(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}function mh(t){let e=typeof t=="string"?Date.parse(t):t;return nx({msecs:e,seq:0})}var hh="0.3.82";var po,n6=()=>typeof window<"u"&&typeof window.document<"u",o6=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",i6=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),rP=()=>typeof Deno<"u",s6=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!rP(),px=()=>po||(typeof Bun<"u"?po="bun":n6()?po="browser":s6()?po="node":o6()?po="webworker":i6()?po="jsdom":rP()?po="deno":po="other",po),lx;function gh(){if(lx===void 0){let t=px(),e=c6();lx={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:hh,...e}}return lx}function fx(){let t=a6(),e={},r=["LANGCHAIN_API_KEY","LANGCHAIN_ENDPOINT","LANGCHAIN_TRACING_V2","LANGCHAIN_PROJECT","LANGCHAIN_SESSION","LANGSMITH_API_KEY","LANGSMITH_ENDPOINT","LANGSMITH_TRACING_V2","LANGSMITH_PROJECT","LANGSMITH_SESSION"];for(let[n,o]of Object.entries(t))typeof o=="string"&&!r.includes(n)&&!n.toLowerCase().includes("key")&&!n.toLowerCase().includes("secret")&&!n.toLowerCase().includes("token")&&(n==="LANGCHAIN_REVISION_ID"?e.revision_id=o:e[n]=o);return e}function a6(){let t={};try{if(typeof process<"u"&&process.env)for(let[e,r]of Object.entries(process.env))(e.startsWith("LANGCHAIN_")||e.startsWith("LANGSMITH_"))&&r!=null&&((e.toLowerCase().includes("key")||e.toLowerCase().includes("secret")||e.toLowerCase().includes("token"))&&typeof r=="string"?t[e]=r.slice(0,2)+"*".repeat(r.length-4)+r.slice(-2):t[e]=r)}catch{}return t}function Qr(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function At(t){return Qr(`LANGSMITH_${t}`)||Qr(`LANGCHAIN_${t}`)}var dx;function c6(){if(dx!==void 0)return dx;let t=["VERCEL_GIT_COMMIT_SHA","NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA","COMMIT_REF","RENDER_GIT_COMMIT","CI_COMMIT_SHA","CIRCLE_SHA1","CF_PAGES_COMMIT_SHA","REACT_APP_GIT_SHA","SOURCE_VERSION","GITHUB_SHA","TRAVIS_COMMIT","GIT_COMMIT","BUILD_VCS_NUMBER","bamboo_planRepository_revision","Build.SourceVersion","BITBUCKET_COMMIT","DRONE_COMMIT_SHA","SEMAPHORE_GIT_SHA","BUILDKITE_COMMIT"],e={};for(let r of t){let n=Qr(r);n!==void 0&&(e[r]=n)}return dx=e,e}function _h(){return Qr("OTEL_ENABLED")==="true"||At("OTEL_ENABLED")==="true"}var gx=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&_h()&&(console.warn('You have enabled OTEL export via the `OTEL_ENABLED` or `LANGSMITH_OTEL_ENABLED` environment variable, but have not initialized the required OTEL instances. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0);let n;if(r.length===1&&typeof r[0]=="function"?n=r[0]:r.length===2&&typeof r[1]=="function"?n=r[1]:r.length===3&&typeof r[2]=="function"&&(n=r[2]),typeof n=="function")return n()}},_x=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new gx})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},yx=class{active(){return{}}with(e,r){return r()}},mx=Symbol.for("ls:otel_trace"),hx=Symbol.for("ls:otel_context"),nP=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),u6=new _x,l6=new yx,vx=class{getTraceInstance(){return globalThis[mx]??u6}getContextInstance(){return globalThis[hx]??l6}initializeGlobalInstances(e){globalThis[mx]===void 0&&(globalThis[mx]=e.trace),globalThis[hx]===void 0&&(globalThis[hx]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[nP]=e}getDefaultOTLPTracerComponents(){return globalThis[nP]??void 0}},bx=new vx;function yh(){return bx.getTraceInstance()}function oP(){return bx.getContextInstance()}function iP(){return bx.getDefaultOTLPTracerComponents()}var d6={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};function p6(t){return d6[t]||t}var vh=class{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(e,r){for(let n of e)try{if(!n.run)continue;if(n.operation==="post"){let o=this.createSpanForRun(n,n.run,r.get(n.id));o&&!n.run.end_time&&this.spans.set(n.id,o)}else this.updateSpanForRun(n,n.run)}catch(o){console.error(`Error processing operation ${n.id}:`,o)}}createSpanForRun(e,r,n){let o=n&&yh().getSpan(n);if(o)try{return this.finishSpanSetup(o,r,e)}catch(i){console.error(`Failed to create span for run ${e.id}:`,i);return}}finishSpanSetup(e,r,n){return this.setSpanAttributes(e,r,n),r.error?(e.setStatus({code:2}),e.recordException(new Error(r.error))):e.setStatus({code:1}),r.end_time&&e.end(new Date(r.end_time)),e}updateSpanForRun(e,r){try{let n=this.spans.get(e.id);if(!n){console.debug(`No span found for run ${e.id} during update`);return}this.setSpanAttributes(n,r,e),r.error?(n.setStatus({code:2}),n.recordException(new Error(r.error))):n.setStatus({code:1});let o=r.end_time;o&&(n.end(new Date(o)),this.spans.delete(e.id))}catch(n){console.error(`Failed to update span for run ${e.id}:`,n)}}extractModelName(e){if(e.extra?.metadata){let r=e.extra.metadata;if(r.ls_model_name)return r.ls_model_name;if(r.invocation_params){let n=r.invocation_params;if(n.model)return n.model;if(n.model_name)return n.model_name}}}setSpanAttributes(e,r,n){if("run_type"in r&&r.run_type){e.setAttribute(KO,r.run_type);let a=p6(r.run_type||"chain");e.setAttribute(IO,a)}"name"in r&&r.name&&e.setAttribute(HO,r.name),"session_id"in r&&r.session_id&&e.setAttribute(VO,r.session_id),"session_name"in r&&r.session_name&&e.setAttribute(GO,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute(ix,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute(sx,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(ax,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(cx,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[a,c]of Object.entries(i))c!=null&&e.setAttribute(`${WO}.${a}`,String(c));let s=r.tags;if(s&&Array.isArray(s)?e.setAttribute(ux,s.join(", ")):s&&e.setAttribute(ux,String(s)),"serialized"in r&&typeof r.serialized=="object"){let a=r.serialized;a.name&&e.setAttribute(jO,String(a.name)),a.signature&&e.setAttribute(DO,String(a.signature)),a.doc&&e.setAttribute(LO,String(a.doc))}this.setIOAttributes(e,n)}setGenAiSystem(e,r){let n="langchain",o=this.extractModelName(r);if(o){let i=o.toLowerCase();i.includes("anthropic")||i.startsWith("claude")?n="anthropic":i.includes("bedrock")?n="aws.bedrock":i.includes("azure")&&i.includes("openai")?n="az.ai.openai":i.includes("azure")&&i.includes("inference")?n="az.ai.inference":i.includes("cohere")?n="cohere":i.includes("deepseek")?n="deepseek":i.includes("gemini")?n="gemini":i.includes("groq")?n="groq":i.includes("watson")||i.includes("ibm")?n="ibm.watsonx.ai":i.includes("mistral")?n="mistral_ai":i.includes("gpt")||i.includes("openai")?n="openai":i.includes("perplexity")||i.includes("sonar")?n="perplexity":i.includes("vertex")?n="vertex_ai":(i.includes("xai")||i.includes("grok"))&&(n="xai")}e.setAttribute(SO,n)}setInvocationParameters(e,r){if(!r.extra?.metadata?.invocation_params)return;let n=r.extra.metadata.invocation_params;n.max_tokens!==void 0&&e.setAttribute(TO,n.max_tokens),n.temperature!==void 0&&e.setAttribute(EO,n.temperature),n.top_p!==void 0&&e.setAttribute(AO,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(OO,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute(PO,n.presence_penalty)}setIOAttributes(e,r){if(r.run.inputs)try{let n=r.run.inputs;typeof n=="object"&&n!==null&&(n.model&&Array.isArray(n.messages)&&e.setAttribute(ix,n.model),n.stream!==void 0&&e.setAttribute(JO,n.stream),n.extra_headers&&e.setAttribute(XO,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute(zO,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(MO,JSON.stringify(n.extra_body))),e.setAttribute(RO,JSON.stringify(n))}catch(n){console.debug(`Failed to process inputs for run ${r.id}`,n)}if(r.run.outputs)try{let n=r.run.outputs,o=this.getUnifiedRunTokens(n);if(o&&(e.setAttribute(sx,o[0]),e.setAttribute(ax,o[1]),e.setAttribute(cx,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(kO,String(n.model)),n.id&&e.setAttribute(UO,n.id),n.choices&&Array.isArray(n.choices)){let i=n.choices.map(s=>s.finish_reason).filter(s=>s).map(String);i.length>0&&e.setAttribute(CO,i.join(", "))}if(n.service_tier&&e.setAttribute(FO,n.service_tier),n.system_fingerprint&&e.setAttribute(BO,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let i=n.usage_metadata;i.input_token_details&&e.setAttribute(ZO,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(qO,JSON.stringify(i.output_token_details))}}e.setAttribute(NO,JSON.stringify(n))}catch(n){console.debug(`Failed to process outputs for run ${r.id}`,n)}}getUnifiedRunTokens(e){if(!e)return null;let r=this.extractUnifiedRunTokens(e.usage_metadata);if(r)return r;let n=Object.keys(e);for(let s of n){let a=e[s];if(!(!a||typeof a!="object")&&(r=this.extractUnifiedRunTokens(a.usage_metadata),r||a.lc===1&&a.kwargs&&typeof a.kwargs=="object"&&(r=this.extractUnifiedRunTokens(a.kwargs.usage_metadata),r)))return r}let o=e.generations||[];if(!Array.isArray(o))return null;let i=Array.isArray(o[0])?o.flat():o;for(let s of i)if(typeof s=="object"&&s.message&&typeof s.message=="object"&&s.message.kwargs&&typeof s.message.kwargs=="object"&&(r=this.extractUnifiedRunTokens(s.message.kwargs.usage_metadata),r))return r;return null}extractUnifiedRunTokens(e){return!e||typeof e!="object"||typeof e.input_tokens!="number"||typeof e.output_tokens!="number"?null:[e.input_tokens,e.output_tokens]}};var f6=Object.prototype.toString,m6=t=>f6.call(t)==="[object Error]",h6=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function wx(t){if(!(t&&m6(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:h6.has(r)}function g6(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function bh(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(_),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},_=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&_.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function $x(t,e={}){if(e={...e},g6(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,bh("factor",e.factor,{min:0,allowInfinity:!1}),bh("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),bh("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),bh("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await y6({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var kh=mn(Sh(),1),T6=[408,425,429,500,502,503,504],Rd=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxQueueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.maxQueueSizeBytes=e.maxQueueSizeBytes,"default"in kh.default?this.queue=new kh.default.default({concurrency:this.maxConcurrency}):this.queue=new kh.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){return this.callWithOptions({},e,...r)}callWithOptions(e,r,...n){let o=e.sizeBytes??0;if(this.maxQueueSizeBytes!==void 0&&o>0&&this.queueSizeBytes+o>this.maxQueueSizeBytes)return Promise.reject(new Error(`Queue size limit (${this.maxQueueSizeBytes} bytes) exceeded. Current queue size: ${this.queueSizeBytes} bytes, attempted addition: ${o} bytes.`));o>0&&(this.queueSizeBytes+=o);let i=this.onFailedResponseHook,s=this.queue.add(()=>$x(()=>r(...n).catch(a=>{throw a instanceof Error?a:new Error(a)}),{async onFailedAttempt({error:a}){if(a.message.startsWith("Cancel")||a.message.startsWith("TimeoutError")||a.name==="TimeoutError"||a.message.startsWith("AbortError")||a?.code==="ECONNABORTED")throw a;let c=a?.response;if(i&&await i(c))return;let u=c?.status??a?.status;if(u&&!T6.includes(+u))throw a},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0});return o>0&&(s=s.finally(()=>{this.queueSizeBytes-=o})),e.signal?Promise.race([s,new Promise((a,c)=>{e.signal?.addEventListener("abort",()=>{c(new Error("AbortError"))})})]):s}};function Ox(t){return typeof t?._getType=="function"}function Px(t){let e={type:t._getType(),data:{content:t.content}};return t?.additional_kwargs&&Object.keys(t.additional_kwargs).length>0&&(e.data.additional_kwargs={...t.additional_kwargs}),e}var $q=mn(oR(),1);function Wo(t){if(!t||t.split("/").length>2||t.startsWith("/")||t.endsWith("/")||t.split(":").length>2)throw new Error(`Invalid identifier format: ${t}`);let[e,r]=t.split(":"),n=r||"latest";if(e.includes("/")){let[o,i]=e.split("/",2);if(!o||!i)throw new Error(`Invalid identifier format: ${t}`);return[o,i,n]}else{if(!e)throw new Error(`Invalid identifier format: ${t}`);return["-",e,n]}}var Xx=class extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}};async function ue(t,e,r){let n;if(t.ok){r&&(n=await t.text());return}if(t.status===403)try{(await t.json())?.error==="org_scoped_key_requires_workspace"&&(n="This API key is org-scoped and requires workspace specification. Please provide 'workspaceId' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.")}catch{let a=new Error(`${t.status} ${t.statusText}`);throw a.status=t?.status,a}if(n===void 0)try{n=await t.text()}catch{n=""}let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Message: ${n}`;if(t.status===409)throw new Xx(o);let i=new Error(o);throw i.status=t.status,i}var iR="ERR_CONFLICTING_ENDPOINTS",Lh=class extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:iR}),this.name="ConflictingEndpointsError"}};function sR(t){return typeof t=="object"&&t!==null&&t.code===iR}var aR="[...]",Iq={result:"[Circular]"},Fh=[],du=[],Sq=new TextEncoder;function kq(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Uh(t){return Sq.encode(t)}function cR(t){if(t&&typeof t=="object"&&t!==null){if(t instanceof Map)return Object.fromEntries(t);if(t instanceof Set)return Array.from(t);if(t instanceof Date)return t.toISOString();if(t instanceof RegExp)return t.toString();if(t instanceof Error)return{name:t.name,message:t.message}}else if(typeof t=="bigint")return t.toString();return t}function Tq(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return cR(r)}}function Pr(t,e,r,n,o){try{let i=JSON.stringify(t,Tq(r),n);return Uh(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?` +Context: ${e}`:""}`),Uh("[Unserializable]");At("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?` +Context: ${e}`:""}`),typeof o>"u"&&(o=kq()),Qx(t,"",0,[],void 0,0,o);let s;try{du.length===0?s=JSON.stringify(t,r,n):s=JSON.stringify(t,Eq(r),n)}catch{return Uh("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Fh.length!==0;){let a=Fh.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return Uh(s)}}function Yx(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),Fh.push([n,r,e,o])):du.push([e,r,t]):(n[r]=t,Fh.push([n,r,e]))}function Qx(t,e,r,n,o,i,s){i+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;as.depthLimit){Yx(aR,t,e,o);return}if(typeof s.edgesLimit<"u"&&r+1>s.edgesLimit){Yx(aR,t,e,o);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n{let e=t?.toString()??At("TRACING_SAMPLING_RATE");if(e===void 0)return;let r=parseFloat(e);if(r<0||r>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${r}`);return r},Oq=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};async function Pq(t){let e=[];for await(let r of t)e.push(r);return e}function Bh(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}var Cq=async t=>{if(t?.status===429){let e=parseInt(t.headers.get("retry-after")??"10",10)*1e3;if(e>0)return await new Promise(r=>setTimeout(r,e)),!0}return!1};function lR(t){return typeof t=="number"?Number(t.toFixed(4)):t}var Rq=24*1024*1024,fR=1024*1024*1024,Nq=1e4,zq=100,dR="https://api.smith.langchain.com",e0=class{constructor(e){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSizeBytes=e??fR}peek(){return this.items[0]}push(e){let r,n=new Promise(i=>{r=i}),o=Pr(e.item,`Serializing run with id: ${e.item.id}`).length;return this.sizeBytes+o>this.maxSizeBytes&&this.items.length>0?(console.warn(`AutoBatchQueue size limit (${this.maxSizeBytes} bytes) exceeded. Dropping run with id: ${e.item.id}. Current queue size: ${this.sizeBytes} bytes, attempted addition: ${o} bytes.`),r(),n):(this.items.push({action:e.action,payload:e.item,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n)}pop({upToSizeBytes:e,upToSize:r}){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let n=[],o=0;for(;o+(this.peek()?.size??0)0&&n.length0){let i=this.items.shift();n.push(i),o+=i.size,this.sizeBytes-=i.size}return[n.map(i=>({action:i.action,item:i.payload,otelContext:i.otelContext,apiKey:i.apiKey,apiUrl:i.apiUrl,size:i.size})),()=>n.forEach(i=>i.itemPromiseResolve())]}},da=class t{get _fetch(){return this.fetchImplementation||eP(this.debug)}constructor(e={}){Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"webUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"workspaceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchIngestCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout_ms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tenantId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filteredPostUuids",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchAggregationDelayMs",{enumerable:!0,configurable:!0,writable:!0,value:250}),Object.defineProperty(this,"batchSizeBytesLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSizeLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"blockOnRootRunFinalization",{enumerable:!0,configurable:!0,writable:!0,value:Qr("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"langSmithToOTELTranslator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchImplementation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cachedLSEnvVarsForMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Qr("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=Aq(e.tracingSamplingRate),this.apiUrl=Bh(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=Bh(e.apiKey??r.apiKey),this.webUrl=Bh(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=Bh(e.workspaceId??At("WORKSPACE_ID")),this.timeout_ms=e.timeout_ms??9e4,this.caller=new Rd({...e.callerOptions??{},maxRetries:4,debug:e.debug??this.debug}),this.traceBatchConcurrency=e.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.debug=e.debug??this.debug,this.fetchImplementation=e.fetchImplementation;let n=e.maxIngestMemoryBytes??fR;this.batchIngestCaller=new Rd({maxRetries:4,maxConcurrency:this.traceBatchConcurrency,maxQueueSizeBytes:n,...e.callerOptions??{},onFailedResponseHook:Cq,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.autoBatchQueue=new e0(n),this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.batchSizeLimit=e.batchSizeLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode,_h()&&(this.langSmithToOTELTranslator=new vh),this.cachedLSEnvVarsForMetadata=fx()}static getDefaultClientConfig(){let e=At("API_KEY"),r=At("ENDPOINT")??dR,n=At("HIDE_INPUTS")==="true",o=At("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:Oq(this.apiUrl)?(this.webUrl="http://localhost:3000",this.webUrl):this.apiUrl.endsWith("/api/v1")?(this.webUrl=this.apiUrl.replace("/api/v1",""),this.webUrl):this.apiUrl.includes("/api")&&!this.apiUrl.split(".",1)[0].endsWith("api")?(this.webUrl=this.apiUrl.replace("/api",""),this.webUrl):this.apiUrl.split(".",1)[0].includes("dev")?(this.webUrl="https://dev.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("eu")?(this.webUrl="https://eu.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("beta")?(this.webUrl="https://beta.smith.langchain.com",this.webUrl):(this.webUrl="https://smith.langchain.com",this.webUrl)}get headers(){let e={"User-Agent":`langsmith-js/${hh}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),this.workspaceId&&(e["x-tenant-id"]=this.workspaceId),e}_getPlatformEndpointPath(e){return this.apiUrl.slice(-3)!=="/v1"&&this.apiUrl.slice(-4)!=="/v1/"?`/v1/platform/${e}`:`/platform/${e}`}async processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}async processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}async prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`;return await this.caller.call(async()=>{let s=await this._fetch(o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,`fetch ${e}`),s})}async _get(e,r){return(await this._getResponse(e,r)).json()}async*_getPaginated(e,r=new URLSearchParams,n){let o=Number(r.get("offset"))||0,i=Number(r.get("limit"))||100;for(;;){r.set("offset",String(o)),r.set("limit",String(i));let s=`${this.apiUrl}${e}?${r}`,a=await this.caller.call(async()=>{let u=await this._fetch(s,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(u,`fetch ${e}`),u}),c=n?n(await a.json()):await a.json();if(c.length===0||(yield c,c.length{let l=await this._fetch(`${this.apiUrl}${e}`,{method:n,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(l,`fetch ${e}`),l})).json();if(!c||!c[o])break;yield c[o];let u=c.cursors;if(!u||!u.next)break;i.cursor=u.next}}_shouldSample(){return this.tracingSampleRate===void 0?!0:Math.random()0;){let[o,i]=this.autoBatchQueue.pop({upToSizeBytes:e,upToSize:r});if(!o.length){i();break}let s=o.reduce((u,l)=>{let d=l.apiUrl??this.apiUrl,f=l.apiKey??this.apiKey,m=l.apiKey===this.apiKey&&l.apiUrl===this.apiUrl?"default":`${d}|${f}`;return u[m]||(u[m]=[]),u[m].push(l),u},{}),a=[];for(let[u,l]of Object.entries(s)){let d=this._processBatch(l,{apiUrl:u==="default"?void 0:u.split("|")[0],apiKey:u==="default"?void 0:u.split("|")[1]});a.push(d)}let c=Promise.all(a).finally(i);n.push(c)}return Promise.all(n)}async _processBatch(e,r){if(!e.length)return;let n=e.reduce((o,i)=>o+(i.size??0),0);try{if(this.langSmithToOTELTranslator!==void 0)this._sendBatchToOTELTranslator(e);else{let o={runCreates:e.filter(s=>s.action==="create").map(s=>s.item),runUpdates:e.filter(s=>s.action==="update").map(s=>s.item)},i=await this._ensureServerInfo();if(i?.batch_ingest_config?.use_multipart_endpoint){let s=i?.instance_flags?.gzip_body_enabled;await this.multipartIngestRuns(o,{...r,useGzip:s,sizeBytes:n})}else await this.batchIngestRuns(o,{...r,sizeBytes:n})}}catch(o){console.error("Error exporting batch:",o)}}_sendBatchToOTELTranslator(e){if(this.langSmithToOTELTranslator!==void 0){let r=new Map,n=[];for(let o of e)o.item.id&&o.otelContext&&(r.set(o.item.id,o.otelContext),o.action==="create"?n.push({operation:"post",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}):n.push({operation:"patch",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}));this.langSmithToOTELTranslator.exportBatch(n,r)}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.item=uR(e.item,this.cachedLSEnvVarsForMetadata);let r=this.autoBatchQueue.push(e);if(this.manualFlushMode)return r;let n=await this._getBatchSizeLimitBytes(),o=await this._getBatchSizeLimit();return(this.autoBatchQueue.sizeBytes>n||this.autoBatchQueue.items.length>o)&&this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o}),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o})},this.autoBatchAggregationDelayMs)),r}async _getServerInfo(){let r=await(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(Nq),...this.fetchOptions});return await ue(n,"get server info"),n})).json();return this.debug&&console.log(` +=== LangSmith Server Configuration === +`+JSON.stringify(r,null,2)+` +`),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch(e){console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${e.status??"Unspecified status code"} ${e.message}`)}return this._serverInfo??{}})()),this._getServerInfoPromise.then(e=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),e))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let e=await this._getBatchSizeLimitBytes(),r=await this._getBatchSizeLimit();await this.drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:r})}_cloneCurrentOTELContext(){let e=yh(),r=oP();if(this.langSmithToOTELTranslator!==void 0){let n=e.getActiveSpan();if(n)return e.setSpan(r.active(),n)}}async createRun(e,r){if(!this._filterForSampling([e]).length)return;let n={...this.headers,"Content-Type":"application/json"},o=e.project_name;delete e.project_name;let i=await this.prepareRunCreateOrUpdateInputs({session_name:o,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&i.trace_id!==void 0&&i.dotted_order!==void 0){let c=this._cloneCurrentOTELContext();this.processRunOperation({action:"create",item:i,otelContext:c,apiKey:r?.apiKey,apiUrl:r?.apiUrl}).catch(console.error);return}let s=uR(i,this.cachedLSEnvVarsForMetadata);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),r?.workspaceId!==void 0&&(n["x-tenant-id"]=r.workspaceId);let a=Pr(s,`Creating run with id: ${s.id}`);await this.caller.call(async()=>{let c=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"create run",!0),c})}async batchIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o=await Promise.all(e?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]),i=await Promise.all(r?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]);if(o.length>0&&i.length>0){let c=o.reduce((l,d)=>(d.id&&(l[d.id]=d),l),{}),u=[];for(let l of i)l.id!==void 0&&c[l.id]?c[l.id]={...c[l.id],...l}:u.push(l);o=Object.values(c),i=u}let s={post:o,patch:i};if(!s.post.length&&!s.patch.length)return;let a={post:[],patch:[]};for(let c of["post","patch"]){let u=c,l=s[u].reverse(),d=l.pop();for(;d!==void 0;)a[u].push(d),d=l.pop()}if(a.post.length>0||a.patch.length>0){let c=a.post.map(u=>u.id).concat(a.patch.map(u=>u.id)).join(",");await this._postBatchIngestRuns(Pr(a,`Ingesting runs with ids: ${c}`),n)}}async _postBatchIngestRuns(e,r){let n={...this.headers,"Content-Type":"application/json",Accept:"application/json"};r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),await this.batchIngestCaller.callWithOptions({sizeBytes:r?.sizeBytes},async()=>{let o=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:e});return await ue(o,"batch create run",!0),o})}async multipartIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o={},i=[];for(let d of e??[]){let f=await this.prepareRunCreateOrUpdateInputs(d);f.id!==void 0&&f.attachments!==void 0&&(o[f.id]=f.attachments),delete f.attachments,i.push(f)}let s=[];for(let d of r??[])s.push(await this.prepareRunCreateOrUpdateInputs(d));if(i.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(s.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(i.length>0&&s.length>0){let d=i.reduce((p,m)=>(m.id&&(p[m.id]=m),p),{}),f=[];for(let p of s)p.id!==void 0&&d[p.id]?d[p.id]={...d[p.id],...p}:f.push(p);i=Object.values(d),s=f}if(i.length===0&&s.length===0)return;let u=[],l=[];for(let[d,f]of[["post",i],["patch",s]])for(let p of f){let{inputs:m,outputs:h,events:_,extra:v,error:b,serialized:x,attachments:k,...T}=p,F={inputs:m,outputs:h,events:_,extra:v,error:b,serialized:x},J=Pr(T,`Serializing for multipart ingestion of run with id: ${T.id}`);l.push({name:`${d}.${T.id}`,payload:new Blob([J],{type:`application/json; length=${J.length}`})});for(let[w,Z]of Object.entries(F)){if(Z===void 0)continue;let oe=Pr(Z,`Serializing ${w} for multipart ingestion of run with id: ${T.id}`);l.push({name:`${d}.${T.id}.${w}`,payload:new Blob([oe],{type:`application/json; length=${oe.length}`})})}if(T.id!==void 0){let w=o[T.id];if(w){delete o[T.id];for(let[Z,oe]of Object.entries(w)){let Q,wt;if(Array.isArray(oe)?[Q,wt]=oe:(Q=oe.mimeType,wt=oe.data),Z.includes(".")){console.warn(`Skipping attachment '${Z}' for run ${T.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}l.push({name:`attachment.${T.id}.${Z}`,payload:new Blob([wt],{type:`${Q}; length=${wt.byteLength}`})})}}}u.push(`trace=${T.trace_id},id=${T.id}`)}await this._sendMultipartRequest(l,u.join("; "),n)}async _createNodeFetchBody(e,r){let n=[];for(let s of e)n.push(new Blob([`--${r}\r +`])),n.push(new Blob([`Content-Disposition: form-data; name="${s.name}"\r +`,`Content-Type: ${s.payload.type}\r +\r +`])),n.push(s.payload),n.push(new Blob([`\r +`]));return n.push(new Blob([`--${r}--\r +`])),await new Blob(n).arrayBuffer()}async _createMultipartStream(e,r){let n=new TextEncoder;return new ReadableStream({async start(i){let s=async a=>{typeof a=="string"?i.enqueue(n.encode(a)):i.enqueue(a)};for(let a of e){await s(`--${r}\r +`),await s(`Content-Disposition: form-data; name="${a.name}"\r +`),await s(`Content-Type: ${a.payload.type}\r +\r +`);let u=a.payload.stream().getReader();try{let l;for(;!(l=await u.read()).done;)i.enqueue(l.value)}finally{u.releaseLock()}await s(`\r +`)}await s(`--${r}--\r +`),i.close()}})}async _sendMultipartRequest(e,r,n){let o="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),i=QO(),s=()=>this._createNodeFetchBody(e,o),a=()=>this._createMultipartStream(e,o),c=async u=>this.batchIngestCaller.callWithOptions({sizeBytes:n?.sizeBytes},async()=>{let l=await u(),d={...this.headers,"Content-Type":`multipart/form-data; boundary=${o}`};n?.apiKey!==void 0&&(d["x-api-key"]=n.apiKey);let f=l;n?.useGzip&&typeof l=="object"&&"pipeThrough"in l&&(f=l.pipeThrough(new CompressionStream("gzip")),d["Content-Encoding"]="gzip");let p=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:d,body:f,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(p,"Failed to send multipart request",!0),p});try{let u,l=!1;!i&&!this.multipartStreamingDisabled&&px()!=="bun"?(l=!0,u=await c(a)):u=await c(s),(!this.multipartStreamingDisabled||l)&&u.status===422&&(n?.apiUrl??this.apiUrl)!==dR&&(console.warn(`Streaming multipart upload to ${n?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${r}".`),this.multipartStreamingDisabled=!0,u=await c(s))}catch(u){console.warn(`${u.message.trim()} + +Context: ${r}`)}}async updateRun(e,r,n){$e(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let o={...r,id:e};if(!this._filterForSampling([o],!0).length)return;if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){let a=this._cloneCurrentOTELContext();if(r.end_time!==void 0&&o.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}else this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}let i={...this.headers,"Content-Type":"application/json"};n?.apiKey!==void 0&&(i["x-api-key"]=n.apiKey),n?.workspaceId!==void 0&&(i["x-tenant-id"]=n.workspaceId);let s=Pr(r,`Serializing payload to update run with id: ${e}`);await this.caller.call(async()=>{let a=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(a,"update run",!0),a})}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){$e(e);let n=await this._get(`/runs/${e}`);return r&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:r,projectOpts:n}){if(r!==void 0){let o;r.session_id?o=r.session_id:n?.projectName?o=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?o=n?.projectId:o=(await this.readProject({projectName:At("PROJECT")||"default"})).id;let i=await this._getTenantId();return`${this.getHostUrl()}/o/${i}/projects/p/${o}/r/${r.id}?poll=true`}else if(e!==void 0){let o=await this.readRun(e);if(!o.app_path)throw new Error(`Run ${e} has no app_path`);return`${this.getHostUrl()}${o.app_path}`}else throw new Error("Must provide either runId or run")}async _loadChildRuns(e){let r=await Pq(this.listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),n={},o={};r.sort((i,s)=>(i?.dotted_order??"").localeCompare(s?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.dotted_order?.startsWith(e.dotted_order??"")&&i.id!==e.id&&(i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i)}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:s,startTime:a,executionOrder:c,isRoot:u,runType:l,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:_,limit:v,select:b,order:x}=e,k=[];if(r&&(k=Array.isArray(r)?r:[r]),n){let w=Array.isArray(n)?n:[n],Z=await Promise.all(w.map(oe=>this.readProject({projectName:oe}).then(Q=>Q.id)));k.push(...Z)}let T=["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],F={session:k.length?k:null,run_type:l,reference_example:s,query:p,filter:m,trace_filter:h,tree_filter:_,execution_order:c,parent_run:o,start_time:a?a.toISOString():null,error:d,id:f,limit:v,trace:i,select:b||T,is_root:u,order:x};F.select.includes("child_run_ids")&&uu("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let J=0;for await(let w of this._getCursorPaginatedList("/runs/query",F))if(v){if(J>=v)break;if(w.length+J>v){yield*w.slice(0,v-J);break}J+=w.length,yield*w}else yield*w}async*listGroupRuns(e){let{projectId:r,projectName:n,groupBy:o,filter:i,startTime:s,endTime:a,limit:c,offset:u}=e,d={session_id:r||(await this.readProject({projectName:n})).id,group_by:o,filter:i,start_time:s?s.toISOString():null,end_time:a?a.toISOString():null,limit:Number(c)||100},f=Number(u)||0,p="/runs/group",m=`${this.apiUrl}${p}`;for(;;){let h={...d,offset:f},_=Object.fromEntries(Object.entries(h).filter(([F,J])=>J!==void 0)),v=JSON.stringify(_),x=await(await this.caller.call(async()=>{let F=await this._fetch(m,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:v});return await ue(F,`Failed to fetch ${p}`),F})).json(),{groups:k,total:T}=x;if(k.length===0)break;for(let F of k)yield F;if(f+=k.length,f>=T)break}}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:s,referenceExampleIds:a,startTime:c,endTime:u,error:l,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:_}){let v=s||[];i&&(v=[...s||[],...await Promise.all(i.map(J=>this.readProject({projectName:J}).then(w=>w.id)))]);let x=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:v,reference_example:a,start_time:c,end_time:u,error:l,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:_}).filter(([J,w])=>w!==void 0)),k=JSON.stringify(x);return await(await this.caller.call(async()=>{let J=await this._fetch(`${this.apiUrl}/runs/stats`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:k});return await ue(J,"get run stats"),J})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||Et()};$e(e);let o=JSON.stringify(n),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ue(a,"share run"),a})).json();if(s===null||!("share_token"in s))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${s.share_token}/r`}async unshareRun(e){$e(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"unshare run",!0),r})}async readRunSharedLink(e){$e(e);let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"read run shared link"),o})).json();if(!(n===null||!("share_token"in n)))return`${this.getHostUrl()}/public/${n.share_token}/r`}async listSharedRuns(e,{runIds:r}={}){let n=new URLSearchParams({share_token:e});if(r!==void 0)for(let s of r)n.append("id",s);return $e(e),await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"list shared runs"),s})).json()}async readDatasetSharedSchema(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id),$e(e);let o=await(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,"read dataset shared schema"),i})).json();return o.url=`${this.getHostUrl()}/public/${o.share_token}/d`,o}async shareDataset(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id);let n={dataset_id:e};$e(e);let o=JSON.stringify(n),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ue(a,"share dataset"),a})).json();return s.url=`${this.getHostUrl()}/public/${s.share_token}/d`,s}async unshareDataset(e){$e(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"unshare dataset",!0),r})}async readSharedDataset(e){return $e(e),await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"read shared dataset"),o})).json()}async listSharedExamples(e,r){let n={};r?.exampleIds&&(n.id=r.exampleIds);let o=new URLSearchParams;Object.entries(n).forEach(([a,c])=>{Array.isArray(c)?c.forEach(u=>o.append(a,u)):o.append(a,c)});let i=await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/public/${e}/examples?${o.toString()}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(a,"list shared examples"),a}),s=await i.json();if(!i.ok)throw"detail"in s?new Error(`Failed to list shared examples. +Status: ${i.status} +Message: ${Array.isArray(s.detail)?s.detail.join(` +`):"Unspecified error"}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return s.map(a=>({...a,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:r=null,metadata:n=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:s=null}){let a=o?"?upsert=true":"",c=`${this.apiUrl}/sessions${a}`,u=i||{};n&&(u.metadata=n);let l={name:e,extra:u,description:r};s!==null&&(l.reference_dataset_id=s);let d=JSON.stringify(l);return await(await this.caller.call(async()=>{let m=await this._fetch(c,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:d});return await ue(m,"create project"),m})).json()}async updateProject(e,{name:r=null,description:n=null,metadata:o=null,projectExtra:i=null,endTime:s=null}){let a=`${this.apiUrl}/sessions/${e}`,c=i;o&&(c={...c||{},metadata:o});let u=JSON.stringify({name:r,extra:c,description:n,end_time:s?new Date(s).toISOString():null});return await(await this.caller.call(async()=>{let f=await this._fetch(a,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"update project"),f})).json()}async hasProject({projectId:e,projectName:r}){let n="/sessions",o=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)$e(e),n+=`/${e}`;else if(r!==void 0)o.append("name",r);else throw new Error("Must provide projectName or projectId");let i=await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${n}?${o}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"has project"),s});try{let s=await i.json();return i.ok?Array.isArray(s)?s.length>0:!0:!1}catch{return!1}}async readProject({projectId:e,projectName:r,includeStats:n}){let o="/sessions",i=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)$e(e),o+=`/${e}`;else if(r!==void 0)i.append("name",r);else throw new Error("Must provide projectName or projectId");n!==void 0&&i.append("include_stats",n.toString());let s=await this._get(o,i),a;if(Array.isArray(s)){if(s.length===0)throw new Error(`Project[id=${e}, name=${r}] not found`);a=s[0]}else a=s;return a}async getProjectUrl({projectId:e,projectName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either projectName or projectId");let n=await this.readProject({projectId:e,projectName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/projects/p/${n.id}`}async getDatasetUrl({datasetId:e,datasetName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");let n=await this.readDataset({datasetId:e,datasetName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/datasets/${n.id}`}async _getTenantId(){if(this._tenantId!==null)return this._tenantId;let e=new URLSearchParams({limit:"1"});for await(let r of this._getPaginated("/sessions",e))return this._tenantId=r[0].tenant_id,r[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:e,name:r,nameContains:n,referenceDatasetId:o,referenceDatasetName:i,includeStats:s,datasetVersion:a,referenceFree:c,metadata:u}={}){let l=new URLSearchParams;if(e!==void 0)for(let d of e)l.append("id",d);if(r!==void 0&&l.append("name",r),n!==void 0&&l.append("name_contains",n),o!==void 0)l.append("reference_dataset",o);else if(i!==void 0){let d=await this.readDataset({datasetName:i});l.append("reference_dataset",d.id)}s!==void 0&&l.append("include_stats",s.toString()),a!==void 0&&l.append("dataset_version",a),c!==void 0&&l.append("reference_free",c.toString()),u!==void 0&&l.append("metadata",JSON.stringify(u));for await(let d of this._getPaginated("/sessions",l))yield*d}async deleteProject({projectId:e,projectName:r}){let n;if(e===void 0&&r===void 0)throw new Error("Must provide projectName or projectId");if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");e===void 0?n=(await this.readProject({projectName:r})).id:n=e,$e(n),await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,`delete session ${n} (${r})`,!0),o})}async uploadCsv({csvFile:e,fileName:r,inputKeys:n,outputKeys:o,description:i,dataType:s,name:a}){let c=`${this.apiUrl}/datasets/upload`,u=new FormData;return u.append("file",e,r),n.forEach(f=>{u.append("input_keys",f)}),o.forEach(f=>{u.append("output_keys",f)}),i&&u.append("description",i),s&&u.append("data_type",s),a&&u.append("name",a),await(await this.caller.call(async()=>{let f=await this._fetch(c,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"upload CSV"),f})).json()}async createDataset(e,{description:r,dataType:n,inputsSchema:o,outputsSchema:i,metadata:s}={}){let a={name:e,description:r,extra:s?{metadata:s}:void 0};n&&(a.data_type=n),o&&(a.inputs_schema_definition=o),i&&(a.outputs_schema_definition=i);let c=JSON.stringify(a);return await(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(d,"create dataset"),d})).json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e&&r)throw new Error("Must provide either datasetName or datasetId, not both");if(e)$e(e),n+=`/${e}`;else if(r)o.append("name",r);else throw new Error("Must provide datasetName or datasetId");let i=await this._get(n,o),s;if(Array.isArray(i)){if(i.length===0)throw new Error(`Dataset[id=${e}, name=${r}] not found`);s=i[0]}else s=i;return s}async hasDataset({datasetId:e,datasetName:r}){try{return await this.readDataset({datasetId:e,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:r,fromVersion:n,toVersion:o}){let i=e;if(i===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:r})).id);let s=new URLSearchParams({from_version:typeof n=="string"?n:n.toISOString(),to_version:typeof o=="string"?o:o.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,s)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:r}){let n="/datasets";if(e===void 0)if(r!==void 0)e=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide either datasetName or datasetId");return(await(await this._getResponse(`${n}/${e}/openai_ft`)).text()).trim().split(` +`).map(a=>JSON.parse(a))}async*listDatasets({limit:e=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:s}={}){let a="/datasets",c=new URLSearchParams({limit:e.toString(),offset:r.toString()});if(n!==void 0)for(let u of n)c.append("id",u);o!==void 0&&c.append("name",o),i!==void 0&&c.append("name_contains",i),s!==void 0&&c.append("metadata",JSON.stringify(s));for await(let u of this._getPaginated(a,c))yield*u}async updateDataset(e){let{datasetId:r,datasetName:n,...o}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;$e(i);let s=JSON.stringify(o);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${i}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"update dataset"),c})).json()}async updateDatasetTag(e){let{datasetId:r,datasetName:n,asOf:o,tag:i}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let s=r??(await this.readDataset({datasetName:n})).id;$e(s);let a=JSON.stringify({as_of:typeof o=="string"?o:o.toISOString(),tag:i});await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${s}/tags`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"update dataset tags",!0),c})}async deleteDataset({datasetId:e,datasetName:r}){let n="/datasets",o=e;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(r!==void 0&&(o=(await this.readDataset({datasetName:r})).id),o!==void 0)$e(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");await this.caller.call(async()=>{let i=await this._fetch(this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,`delete ${n}`,!0),i})}async indexDataset({datasetId:e,datasetName:r,tag:n}){let o=e;if(!o&&!r)throw new Error("Must provide either datasetName or datasetId");if(o&&r)throw new Error("Must provide either datasetName or datasetId, not both");o||(o=(await this.readDataset({datasetName:r})).id),$e(o);let s=JSON.stringify({tag:n});await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${o}/index`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"index dataset"),c})).json()}async similarExamples(e,r,n,{filter:o}={}){let i={limit:n,inputs:e};o!==void 0&&(i.filter=o),$e(r);let s=JSON.stringify(i);return(await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${r}/search`,{headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,method:"POST",body:s});return await ue(u,"fetch similar examples"),u})).json()).examples}async createExample(e,r,n){if(pR(e)&&(r!==void 0||n!==void 0))throw new Error("Cannot provide outputs or options when using ExampleCreate object");let o=r?n?.datasetId:e.dataset_id,i=r?n?.datasetName:e.dataset_name;if(o===void 0&&i===void 0)throw new Error("Must provide either datasetName or datasetId");if(o!==void 0&&i!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");o===void 0&&(o=(await this.readDataset({datasetName:i})).id);let s=(r?n?.createdAt:e.created_at)||new Date,a;pR(e)?a=e:a={inputs:e,outputs:r,created_at:s?.toISOString(),id:n?.exampleId,metadata:n?.metadata,split:n?.split,source_run_id:n?.sourceRunId,use_source_run_io:n?.useSourceRunIO,use_source_run_attachments:n?.useSourceRunAttachments,attachments:n?.attachments};let c=await this._uploadExamplesMultipart(o,[a]);return await this.readExample(c.example_ids?.[0]??Et())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let b=e,x=b[0].dataset_id,k=b[0].dataset_name;if(x===void 0&&k===void 0)throw new Error("Must provide either datasetName or datasetId");if(x!==void 0&&k!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");x===void 0&&(x=(await this.readDataset({datasetName:k})).id);let T=await this._uploadExamplesMultipart(x,b);return await Promise.all(T.example_ids.map(J=>this.readExample(J)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:s,useSourceRunIOs:a,useSourceRunAttachments:c,attachments:u,exampleIds:l,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((b,x)=>({dataset_id:p,inputs:b,outputs:n?.[x],metadata:o?.[x],split:i?.[x],id:l?.[x],attachments:u?.[x],source_run_id:s?.[x],use_source_run_io:a?.[x],use_source_run_attachments:c?.[x]})),_=await this._uploadExamplesMultipart(p,h);return await Promise.all(_.example_ids.map(b=>this.readExample(b)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(s=>Ox(s)?Px(s):s),i=Ox(r)?Px(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){$e(e);let r=`/examples/${e}`,n=await this._get(r),{attachment_urls:o,...i}=n,s=i;return o&&(s.attachments=Object.entries(o).reduce((a,[c,u])=>(a[c.slice(11)]={presigned_url:u.presigned_url,mime_type:u.mime_type},a),{})),s}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:s,metadata:a,limit:c,offset:u,filter:l,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=o?typeof o=="string"?o:o?.toISOString():void 0;m&&p.append("as_of",m);let h=s??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let v of n)p.append("id",v);if(i!==void 0)for(let v of i)p.append("splits",v);if(a!==void 0){let v=JSON.stringify(a);p.append("metadata",v)}c!==void 0&&p.append("limit",c.toString()),u!==void 0&&p.append("offset",u.toString()),l!==void 0&&p.append("filter",l),d===!0&&["attachment_urls","outputs","metadata"].forEach(v=>p.append("select",v));let _=0;for await(let v of this._getPaginated("/examples",p)){for(let b of v){let{attachment_urls:x,...k}=b,T=k;x&&(T.attachments=Object.entries(x).reduce((F,[J,w])=>(F[J.slice(11)]={presigned_url:w.presigned_url,mime_type:w.mime_type||void 0},F),{})),yield T,_++}if(c!==void 0&&_>=c)break}}async deleteExample(e){$e(e);let r=`/examples/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,`delete ${r}`,!0),n})}async updateExample(e,r){let n;r?n=e:n=e.id,$e(n);let o;r?o={id:n,...r}:o=e;let i;return o.dataset_id!==void 0?i=o.dataset_id:i=(await this.readExample(n)).dataset_id,this._updateExamplesMultipart(i,[o])}async updateExamples(e){let r;return e[0].dataset_id===void 0?r=(await this.readExample(e[0].id)).dataset_id:r=e[0].dataset_id,this._updateExamplesMultipart(r,e)}async readDatasetVersion({datasetId:e,datasetName:r,asOf:n,tag:o}){let i;if(e?i=e:i=(await this.readDataset({datasetName:r})).id,$e(i),n&&o||!n&&!o)throw new Error("Exactly one of asOf and tag must be specified.");let s=new URLSearchParams;return n!==void 0&&s.append("as_of",typeof n=="string"?n:n.toISOString()),o!==void 0&&s.append("tag",o),await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${i}/version?${s.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(c,"read dataset version"),c})).json()}async listDatasetSplits({datasetId:e,datasetName:r,asOf:n}){let o;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?o=(await this.readDataset({datasetName:r})).id:o=e,$e(o);let i=new URLSearchParams,s=n?typeof n=="string"?n:n?.toISOString():void 0;return s&&i.append("as_of",s),await this._get(`/datasets/${o}/splits`,i)}async updateDatasetSplits({datasetId:e,datasetName:r,splitName:n,exampleIds:o,remove:i=!1}){let s;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?s=(await this.readDataset({datasetName:r})).id:s=e,$e(s);let a={split_name:n,examples:o.map(u=>($e(u),u)),remove:i},c=JSON.stringify(a);await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${s}/splits`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(u,"update dataset splits",!0),u})}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){uu("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let s;if(typeof e=="string")s=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)s=e;else throw new Error(`Invalid run type: ${typeof e}`);s.reference_example_id!==null&&s.reference_example_id!==void 0&&(i=await this.readExample(s.reference_example_id));let a=await r.evaluateRun(s,i),[c,u]=await this._logEvaluationFeedback(a,s,n);return u[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:s,sourceInfo:a,feedbackSourceType:c="api",sourceRunId:u,feedbackId:l,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:c??"api",metadata:a??{}};u!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:u}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&$e(m.metadata.__run.run_id);let h={id:l??Et(),run_id:e,key:r,score:lR(n),value:o,correction:i,comment:s,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},_=JSON.stringify(h),v=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{let b=await this._fetch(v,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:_});return await ue(b,"create feedback",!0),b}),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let s={};r!=null&&(s.score=lR(r)),n!=null&&(s.value=n),o!=null&&(s.correction=o),i!=null&&(s.comment=i),$e(e);let a=JSON.stringify(s);await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"update feedback",!0),c})}async readFeedback(e){$e(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){$e(e);let r=`/feedback/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,`delete ${r}`,!0),n})}async*listFeedback({runIds:e,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(e)for(let i of e)$e(i),o.append("run",i);if(r)for(let i of r)o.append("key",i);if(n)for(let i of n)o.append("source",i);for await(let i of this._getPaginated("/feedback",o))yield*i}async createPresignedFeedbackToken(e,r,{expiration:n,feedbackConfig:o}={}){let i={run_id:e,feedback_key:r,feedback_config:o};n?typeof n=="string"?i.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(i.expires_in=n):i.expires_in={hours:3};let s=JSON.stringify(i);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"create presigned feedback token"),c})).json()}async createComparativeExperiment({name:e,experimentIds:r,referenceDatasetId:n,createdAt:o,description:i,metadata:s,id:a}){if(r.length===0)throw new Error("At least one experiment is required");if(n||(n=(await this.readProject({projectId:r[0]})).reference_dataset_id),!n==null)throw new Error("A reference dataset is required");let c={id:a,name:e,experiment_ids:r,reference_dataset_id:n,description:i,created_at:(o??new Date)?.toISOString(),extra:{}};s&&(c.extra.metadata=s);let u=JSON.stringify(c);return(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(d,"create comparative experiment"),d})).json()}async*listPresignedFeedbackTokens(e){$e(e);let r=new URLSearchParams({run_id:e});for await(let n of this._getPaginated("/feedback/tokens",r))yield*n}_selectEvalResults(e){let r;return"results"in e?r=e.results:Array.isArray(e)?r=e:r=[e],r}async _logEvaluationFeedback(e,r,n){let o=this._selectEvalResults(e),i=[];for(let s of o){let a=n||{};s.evaluatorInfo&&(a={...s.evaluatorInfo,...a});let c=null;s.targetRunId?c=s.targetRunId:r&&(c=r.id),i.push(await this.createFeedback(c,s.key,{score:s.score,value:s.value,comment:s.comment,correction:s.correction,sourceInfo:a,sourceRunId:s.sourceRunId,feedbackConfig:s.feedbackConfig,feedbackSourceType:"model"}))}return[o,i]}async logEvaluationFeedback(e,r,n){let[o]=await this._logEvaluationFeedback(e,r,n);return o}async*listAnnotationQueues(e={}){let{queueIds:r,name:n,nameContains:o,limit:i}=e,s=new URLSearchParams;r&&r.forEach((c,u)=>{$e(c,`queueIds[${u}]`),s.append("ids",c)}),n&&s.append("name",n),o&&s.append("name_contains",o),s.append("limit",(i!==void 0?Math.min(i,100):100).toString());let a=0;for await(let c of this._getPaginated("/annotation-queues",s))if(yield*c,a++,i!==void 0&&a>=i)break}async createAnnotationQueue(e){let{name:r,description:n,queueId:o,rubricInstructions:i}=e,s={name:r,description:n,id:o||Et(),rubric_instructions:i},a=JSON.stringify(Object.fromEntries(Object.entries(s).filter(([u,l])=>l!==void 0)));return(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(u,"create annotation queue"),u})).json()}async readAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"read annotation queue"),n})).json()}async updateAnnotationQueue(e,r){let{name:n,description:o,rubricInstructions:i}=r,s=JSON.stringify({name:n,description:o,rubric_instructions:i});await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(a,"update annotation queue",!0),a})}async deleteAnnotationQueue(e){await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"delete annotation queue",!0),r})}async addRunsToAnnotationQueue(e,r){let n=JSON.stringify(r.map((o,i)=>$e(o,`runIds[${i}]`).toString()));await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(o,"add runs to annotation queue",!0),o})}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${$e(e,"queueId")}/run`;return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,"get run from annotation queue"),i})).json()}async deleteRunFromAnnotationQueue(e,r){await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/runs/${$e(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"delete run from annotation queue",!0),n})}async getSizeFromAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"get size from annotation queue"),n})).json()}async _currentTenantIsOwner(e){let r=await this._getSettings();return e=="-"||r.tenant_handle===e}async _ownerConflictError(e,r){let n=await this._getSettings();return new Error(`Cannot ${e} for another tenant. + + Current tenant: ${n.tenant_handle} + + Requested tenant: ${r}`)}async _getLatestCommitHash(e){let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/commits/${e}/?limit=1&offset=0`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"get latest commit hash"),o})).json();if(n.commits.length!==0)return n.commits[0].commit_hash}async _likeOrUnlikePrompt(e,r){let[n,o,i]=Wo(e),s=JSON.stringify({like:r});return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/likes/${n}/${o}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,`${r?"like":"unlike"} prompt`),c})).json()}async _getPromptUrl(e){let[r,n,o]=Wo(e);if(await this._currentTenantIsOwner(r)){let i=await this._getSettings();return o!=="latest"?`${this.getHostUrl()}/prompts/${n}/${o.substring(0,8)}?organizationId=${i.id}`:`${this.getHostUrl()}/prompts/${n}?organizationId=${i.id}`}else return o!=="latest"?`${this.getHostUrl()}/hub/${r}/${n}/${o.substring(0,8)}`:`${this.getHostUrl()}/hub/${r}/${n}`}async promptExists(e){return!!await this.getPrompt(e)}async likePrompt(e){return this._likeOrUnlikePrompt(e,!0)}async unlikePrompt(e){return this._likeOrUnlikePrompt(e,!1)}async*listCommits(e){for await(let r of this._getPaginated(`/commits/${e}/`,new URLSearchParams,n=>n.commits))yield*r}async*listPrompts(e){let r=new URLSearchParams;r.append("sort_field",e?.sortField??"updated_at"),r.append("sort_direction","desc"),r.append("is_archived",(!!e?.isArchived).toString()),e?.isPublic!==void 0&&r.append("is_public",e.isPublic.toString()),e?.query&&r.append("query",e.query);for await(let n of this._getPaginated("/repos",r,o=>o.repos))yield*n}async getPrompt(e){let[r,n,o]=Wo(e),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return a?.status===404?null:(await ue(a,"get prompt"),a)}))?.json();return s?.repo?s.repo:null}async createPrompt(e,r){let n=await this._getSettings();if(r?.isPublic&&!n.tenant_handle)throw new Error(`Cannot create a public prompt without first + + creating a LangChain Hub handle. + You can add a handle by creating a public prompt at: + + https://smith.langchain.com/prompts`);let[o,i,s]=Wo(e);if(!await this._currentTenantIsOwner(o))throw await this._ownerConflictError("create a prompt",o);let a={repo_handle:i,...r?.description&&{description:r.description},...r?.readme&&{readme:r.readme},...r?.tags&&{tags:r.tags},is_public:!!r?.isPublic},c=JSON.stringify(a),u=await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(d,"create prompt"),d}),{repo:l}=await u.json();return l}async createCommit(e,r,n){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[o,i,s]=Wo(e),a=n?.parentCommitHash==="latest"||!n?.parentCommitHash?await this._getLatestCommitHash(`${o}/${i}`):n?.parentCommitHash,c={manifest:JSON.parse(JSON.stringify(r)),parent_commit:a},u=JSON.stringify(c),d=await(await this.caller.call(async()=>{let f=await this._fetch(`${this.apiUrl}/commits/${o}/${i}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"create commit"),f})).json();return this._getPromptUrl(`${o}/${i}${d.commit_hash?`:${d.commit_hash}`:""}`)}async updateExamplesMultipart(e,r=[]){return this._updateExamplesMultipart(e,r)}async _updateExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let s of r){let a=s.id,c={...s.metadata&&{metadata:s.metadata},...s.split&&{split:s.split}},u=Pr(c,`Serializing body for example with id: ${a}`),l=new Blob([u],{type:"application/json"});if(n.append(a,l),s.inputs){let d=Pr(s.inputs,`Serializing inputs for example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.inputs`,f)}if(s.outputs){let d=Pr(s.outputs,`Serializing outputs whle updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.outputs`,f)}if(s.attachments)for(let[d,f]of Object.entries(s.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${a}.attachment.${d}`,h)}if(s.attachments_operations){let d=Pr(s.attachments_operations,`Serializing attachments while updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.attachments_operations`,f)}}let o=e??r[0]?.dataset_id;return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${o}/examples`)}`,{method:"PATCH",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(s,"update examples"),s})).json()}async uploadExamplesMultipart(e,r=[]){return this._uploadExamplesMultipart(e,r)}async _uploadExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let i of r){let s=(i.id??Et()).toString(),a={created_at:i.created_at,...i.metadata&&{metadata:i.metadata},...i.split&&{split:i.split},...i.source_run_id&&{source_run_id:i.source_run_id},...i.use_source_run_io&&{use_source_run_io:i.use_source_run_io},...i.use_source_run_attachments&&{use_source_run_attachments:i.use_source_run_attachments}},c=Pr(a,`Serializing body for uploaded example with id: ${s}`),u=new Blob([c],{type:"application/json"});if(n.append(s,u),i.inputs){let l=Pr(i.inputs,`Serializing inputs for uploaded example with id: ${s}`),d=new Blob([l],{type:"application/json"});n.append(`${s}.inputs`,d)}if(i.outputs){let l=Pr(i.outputs,`Serializing outputs for uploaded example with id: ${s}`),d=new Blob([l],{type:"application/json"});n.append(`${s}.outputs`,d)}if(i.attachments)for(let[l,d]of Object.entries(i.attachments)){let f,p;Array.isArray(d)?[f,p]=d:(f=d.mimeType,p=d.data);let m=new Blob([p],{type:`${f}; length=${p.byteLength}`});n.append(`${s}.attachment.${l}`,m)}}return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(i,"upload examples"),i})).json()}async updatePrompt(e,r){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[n,o]=Wo(e);if(!await this._currentTenantIsOwner(n))throw await this._ownerConflictError("update a prompt",n);let i={};if(r?.description!==void 0&&(i.description=r.description),r?.readme!==void 0&&(i.readme=r.readme),r?.tags!==void 0&&(i.tags=r.tags),r?.isPublic!==void 0&&(i.is_public=r.isPublic),r?.isArchived!==void 0&&(i.is_archived=r.isArchived),Object.keys(i).length===0)throw new Error("No valid update options provided");let s=JSON.stringify(i);return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/repos/${n}/${o}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"update prompt"),c})).json()}async deletePrompt(e){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[r,n,o]=Wo(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"delete prompt"),s})).json()}async pullPromptCommit(e,r){let[n,o,i]=Wo(e),a=await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/commits/${n}/${o}/${i}${r?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(c,"pull prompt commit"),c})).json();return{owner:n,repo:o,commit_hash:a.commit_hash,manifest:a.manifest,examples:a.examples}}async _pullPrompt(e,r){let n=await this.pullPromptCommit(e,{includeModel:r?.includeModel});return JSON.stringify(n.manifest)}async pushPrompt(e,r){return await this.promptExists(e)?r&&Object.keys(r).some(o=>o!=="object")&&await this.updatePrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}):await this.createPrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}),r?.object?await this.createCommit(e,r?.object,{parentCommitHash:r?.parentCommitHash}):await this._getPromptUrl(e)}async clonePublicDataset(e,r={}){let{sourceApiUrl:n=this.apiUrl,datasetName:o}=r,[i,s]=this.parseTokenOrUrl(e,n),a=new t({apiUrl:i,apiKey:"placeholder"}),c=await a.readSharedDataset(s),u=o||c.name;try{if(await this.hasDataset({datasetId:u})){console.log(`Dataset ${u} already exists in your tenant. Skipping.`);return}}catch{}let l=await a.listSharedExamples(s),d=await this.createDataset(u,{description:c.description,dataType:c.data_type||"kv",inputsSchema:c.inputs_schema_definition??void 0,outputsSchema:c.outputs_schema_definition??void 0});try{await this.createExamples({inputs:l.map(f=>f.inputs),outputs:l.flatMap(f=>f.outputs?[f.outputs]:[]),datasetId:d.id})}catch(f){throw console.error(`An error occurred while creating dataset ${u}. You should delete it manually.`),f}}parseTokenOrUrl(e,r,n=2,o="dataset"){try{return $e(e),[r,e]}catch{}try{let s=new URL(e).pathname.split("/").filter(a=>a!=="");if(s.length>=n){let a=s[s.length-n];return[r,a]}else throw new Error(`Invalid public ${o} URL: ${e}`)}catch{throw new Error(`Invalid public ${o} URL or token: ${e}`)}}async awaitPendingTraceBatches(){if(this.manualFlushMode)return console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve();await Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()]),this.langSmithToOTELTranslator!==void 0&&await iP()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}};function pR(t){return"dataset_id"in t||"dataset_name"in t}var mR=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>At(r)==="true");var mo=Symbol.for("lc:context_variables"),Zh=Symbol.for("langsmith:replica_trace_roots");function t0(t,e){if(mo in t)return t[mo][e]}function hR(t,e,r){let n=mo in t?t[mo]:{};n[e]=r,t[mo]=n}var Fd=36,Bd="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function gR(t){let r=Object.keys(t).sort().map(n=>`${n}:${t[n]??""}`).join("|");return ua(r,Bd)}function Mq(t){return t.replace(/[-:.]/g,"")}function yR(t,e=1){let r=e.toFixed(0).slice(0,3).padStart(3,"0");return`${new Date(t).toISOString().slice(0,-1)}${r}Z`}function r0(t,e,r=1){let n=yR(t,r);return{dottedOrder:Mq(n)+e,microsecondPrecisionDatestring:n}}var qh=class t{constructor(e,r,n,o){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n,this.replicas=o}static fromHeader(e){let r=e.split(","),n={},o=[],i,s;for(let a of r){let[c,u]=a.split("="),l=decodeURIComponent(u);c==="langsmith-metadata"?n=JSON.parse(l):c==="langsmith-tags"?o=l.split(","):c==="langsmith-project"?i=l:c==="langsmith-replicas"&&(s=JSON.parse(l))}return new t(n,o,i,s)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}},Ln=class t{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"distributedParentId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),vR(e)){Object.assign(this,{...e});return}let r=t.getDefaultConfig(),{metadata:n,...o}=e,i=o.client??t.getSharedClient(),s={...n,...o?.extra?.metadata};if(o.extra={...o.extra,metadata:s},"id"in o&&o.id==null&&delete o.id,Object.assign(this,{...r,...o,client:i}),this.execution_order??=1,this.child_execution_order??=1,this.dotted_order||(this._serialized_start_time=yR(this.start_time,this.execution_order)),this.id||(this.id=mh(this._serialized_start_time??this.start_time)),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.replicas=Uq(this.replicas),!this.dotted_order){let{dottedOrder:a}=r0(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+a:this.dotted_order=a}}set metadata(e){this.extra={...this.extra,metadata:{...this.extra?.metadata,...e}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){let e=Date.now();return{run_type:"chain",project_name:Pd(),child_runs:[],api_url:Qr("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Qr("LANGCHAIN_API_KEY"),caller_options:{},start_time:e,serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new da),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=this.replicas?.map(l=>{let{reroot:d,...f}=l;return f}),o=e.replicas??n,i=new t({...e,parent_run:this,project_name:this.project_name,replicas:o,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});mo in this&&(i[mo]=this[mo]);let s=Symbol.for("lc:child_config"),a=e.extra?.[s]??this.extra[s];if(Dq(a)){let l={...a},d=jq(l.callbacks)?l.callbacks.copy?.():void 0;d&&(Object.assign(d,{_parentRunId:i.id}),d.handlers?.find(bR)?.updateFromRunTree?.(i),l.callbacks=d),i.extra[s]=l}let c=new Set,u=this;for(;u!=null&&!c.has(u.id);)c.add(u.id),u.child_execution_order=Math.max(u.child_execution_order,r),u=u.parent_run;return this.child_runs.push(i),i}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o?.runtime?.library===void 0&&(o.runtime||(o.runtime={}),r))for(let[a,c]of Object.entries(r))o.runtime[a]||(o.runtime[a]=c);let i,s;return n?(s=e.parent_run?.id??e.parent_run_id,i=[]):(i=e.child_runs.map(a=>this._convertToCreate(a,r,n)),s=void 0),{id:e.id,name:e.name,start_time:e._serialized_start_time??e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:o,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:i,parent_run_id:s,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments,events:e.events}}_sliceParentId(e,r){if(r.dotted_order){let n=r.dotted_order.split("."),o=null;for(let i=0;i0?r.trace_id=i[0].slice(-Fd):r.trace_id=r.id}}r.parent_run_id===e&&(r.parent_run_id=void 0)}_setReplicaTraceRoot(e,r){let n=t0(this,Zh)??{};n[e]=r,hR(this,Zh,n);for(let o of this.child_runs)o._setReplicaTraceRoot(e,r)}_remapForProject(e){let{projectName:r,runtimeEnv:n,excludeChildRuns:o=!0,reroot:i=!1,distributedParentId:s,apiUrl:a,apiKey:c,workspaceId:u}=e,l=this._convertToCreate(this,n,o);if(r===this.project_name)return{...l,session_name:r};if(i){if(s)this._sliceParentId(s,l);else if(l.parent_run_id=void 0,l.dotted_order){let b=l.dotted_order.split(".");b.length>0&&(l.dotted_order=b[b.length-1],l.trace_id=l.id)}let v=gR({projectName:r,apiUrl:a,apiKey:c,workspaceId:u});this._setReplicaTraceRoot(v,l.id)}let d;if(!i){let v=t0(this,Zh)??{},b=gR({projectName:r,apiUrl:a,apiKey:c,workspaceId:u});if(d=v[b],d&&(l.trace_id=d,l.dotted_order)){let x=l.dotted_order.split("."),k=null;for(let T=0;T{let k=x.slice(-Fd),T=ua(`${k}:${r}`,Bd);return x.slice(0,-Fd)+T}).join(".")),{...l,id:p,trace_id:m,parent_run_id:h,dotted_order:_,session_name:r}}async postRun(e=!0){try{let r=gh();if(this.replicas&&this.replicas.length>0)for(let{projectName:n,apiKey:o,apiUrl:i,workspaceId:s,reroot:a}of this.replicas){let c=this._remapForProject({projectName:n??this.project_name,runtimeEnv:r,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:i,apiKey:o,workspaceId:s});await this.client.createRun(c,{apiKey:o,apiUrl:i,workspaceId:s})}else{let n=this._convertToCreate(this,r,e);await this.client.createRun(n)}if(!e){uu("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let n of this.child_runs)await n.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(e){if(this.replicas&&this.replicas.length>0)for(let{projectName:r,apiKey:n,apiUrl:o,workspaceId:i,updates:s,reroot:a}of this.replicas){let c=this._remapForProject({projectName:r??this.project_name,runtimeEnv:void 0,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:o,apiKey:n,workspaceId:i}),u={id:c.id,name:c.name,run_type:c.run_type,start_time:c.start_time,outputs:c.outputs,error:c.error,parent_run_id:c.parent_run_id,session_name:c.session_name,reference_example_id:c.reference_example_id,end_time:c.end_time,dotted_order:c.dotted_order,trace_id:c.trace_id,events:c.events,tags:c.tags,extra:c.extra,attachments:this.attachments,...s};e?.excludeInputs||(u.inputs=c.inputs),await this.client.updateRun(c.id,u,{apiKey:n,apiUrl:o,workspaceId:i})}else try{let r={name:this.name,run_type:this.run_type,start_time:this._serialized_start_time??this.start_time,end_time:this.end_time,error:this.error,outputs:this.outputs,parent_run_id:this.parent_run?.id??this.parent_run_id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};e?.excludeInputs||(r.inputs=this.inputs),await this.client.updateRun(this.id,r)}catch(r){console.error(`Error in patchRun for run ${this.id}`,r)}}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(e){this.events||(this.events=[]),typeof e=="string"?this.events.push({name:"event",time:new Date().toISOString(),message:e}):this.events.push({...e,time:e.time??new Date().toISOString()})}static fromRunnableConfig(e,r){let n=e?.callbacks,o,i,s,a=mR();if(n){let u=n?.getParentRunId?.()??"",l=n?.handlers?.find(d=>d?.name=="langchain_tracer");o=l?.getRun?.(u),i=l?.projectName,s=l?.client,a=a||!!l}return o?new t({name:o.name,id:o.id,trace_id:o.trace_id,dotted_order:o.dotted_order,client:s,tracingEnabled:a,project_name:i,tags:[...new Set((o?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...o?.extra?.metadata,...e?.metadata}}}).createChild(r):new t({...r,client:s,tracingEnabled:a,project_name:i})}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,r){let n="get"in e&&typeof e.get=="function"?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,o=n["langsmith-trace"];if(!o||typeof o!="string")return;let i=o.trim(),s=i.split(".").map(l=>{let[d,f]=l.split("Z");return{strTime:d,time:Date.parse(d+"Z"),uuid:f}}),a=s[0].uuid,c={...r,name:r?.name??"parent",run_type:r?.run_type??"chain",start_time:r?.start_time??Date.now(),id:s.at(-1)?.uuid,trace_id:a,dotted_order:i};if(n.baggage&&typeof n.baggage=="string"){let l=qh.fromHeader(n.baggage);c.metadata=l.metadata,c.tags=l.tags,c.project_name=l.project_name,c.replicas=l.replicas}let u=new t(c);return u.distributedParentId=u.id,u}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new qh(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(Ln,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null});function vR(t){return t!=null&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function bR(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function _R(t){return Array.isArray(t)&&t.some(e=>bR(e))}function jq(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function Dq(t){return t!=null&&typeof t.callbacks=="object"&&(_R(t.callbacks?.handlers)||_R(t.callbacks))}function Lq(){let t=Qr("LANGSMITH_RUNS_ENDPOINTS");if(!t)return[];try{let e=JSON.parse(t);if(Array.isArray(e)){let r=[];for(let n of e){if(typeof n!="object"||n===null){console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got ${typeof n}`);continue}if(typeof n.api_url!="string"){console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_url}`);continue}if(typeof n.api_key!="string"){console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_key}`);continue}r.push({apiUrl:n.api_url.replace(/\/$/,""),apiKey:n.api_key})}return r}else if(typeof e=="object"&&e!==null){Fq(e);let r=[];for(let[n,o]of Object.entries(e)){let i=n.replace(/\/$/,"");if(typeof o=="string")r.push({apiUrl:i,apiKey:o});else{console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${n}: expected string, got ${typeof o}`);continue}}return r}else return console.warn(`Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey, got ${typeof e}`),[]}catch(e){if(sR(e))throw e;return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey"),[]}}function Uq(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):Lq()}function Fq(t){if(Object.keys(t).length>0&&At("ENDPOINT"))throw new Lh}var Bq={};G(Bq,{BaseTracer:()=>Un,isBaseTracer:()=>fa});var Zq=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};function o0(t,e){if(t)return new Ln({...t,start_time:t._serialized_start_time??t.start_time,parent_run:o0(e),child_runs:t.child_runs.map(r=>o0(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:ex()},tracingEnabled:!1})}function n0(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function fa(t){return typeof t._addRunToRunMap=="function"}var Un=class extends la{runMap=new Map;runTreeMap=new Map;usesRunTreeMap=!1;constructor(t){super(...arguments)}copy(){return this}getRunById(t){if(t!==void 0)return this.usesRunTreeMap?Zq(this.runTreeMap.get(t)):this.runMap.get(t)}stringifyError(t){return t instanceof Error?t.message+(t?.stack?` + +${t.stack}`:""):typeof t=="string"?t:`${t}`}_addChildRun(t,e){t.child_runs.push(e)}_addRunToRunMap(t){let{dottedOrder:e,microsecondPrecisionDatestring:r}=r0(new Date(t.start_time).getTime(),t.id,t.execution_order),n={...t},o=this.getRunById(n.parent_run_id);if(n.parent_run_id!==void 0?o&&(this._addChildRun(o,n),o.child_execution_order=Math.max(o.child_execution_order,n.child_execution_order),n.trace_id=o.trace_id,o.dotted_order!==void 0&&(n.dotted_order=[o.dotted_order,e].join("."),n._serialized_start_time=r)):(n.trace_id=n.id,n.dotted_order=e,n._serialized_start_time=r),this.usesRunTreeMap){let i=o0(n,o);i!==void 0&&this.runTreeMap.set(n.id,i)}else this.runMap.set(n.id,n);return n}async _endTrace(t){let e=t.parent_run_id!==void 0&&this.getRunById(t.parent_run_id);e?e.child_execution_order=Math.max(e.child_execution_order,t.child_execution_order):await this.persistRun(t),await this.onRunUpdate?.(t),this.usesRunTreeMap?this.runTreeMap.delete(t.id):this.runMap.delete(t.id)}_getExecutionOrder(t){let e=t!==void 0&&this.getRunById(t);return e?e.child_execution_order+1:1}_createRunForLLMStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l=s?{...o,metadata:s}:o,d={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{prompts:e},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:l??{},tags:i||[]};return this._addRunToRunMap(d)}async handleLLMStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForLLMStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}_createRunForChatModelStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l=s?{...o,metadata:s}:o,d={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{messages:e},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:l??{},tags:i||[]};return this._addRunToRunMap(d)}async handleChatModelStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForChatModelStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}async handleLLMEnd(t,e,r,n,o){let i=this.getRunById(e);if(!i||i?.run_type!=="llm")throw new Error("No LLM run to end.");return i.end_time=Date.now(),i.outputs=t,i.events.push({name:"end",time:new Date(i.end_time).toISOString()}),i.extra={...i.extra,...o},await this.onLLMEnd?.(i),await this._endTrace(i),i}async handleLLMError(t,e,r,n,o){let i=this.getRunById(e);if(!i||i?.run_type!=="llm")throw new Error("No LLM run to end.");return i.end_time=Date.now(),i.error=this.stringifyError(t),i.events.push({name:"error",time:new Date(i.end_time).toISOString()}),i.extra={...i.extra,...o},await this.onLLMError?.(i),await this._endTrace(i),i}_createRunForChainStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:e,execution_order:c,child_execution_order:c,run_type:s??"chain",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(l)}async handleChainStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForChainStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onChainStart?.(c),c}async handleChainEnd(t,e,r,n,o){let i=this.getRunById(e);if(!i)throw new Error("No chain run to end.");return i.end_time=Date.now(),i.outputs=n0(t,"output"),i.events.push({name:"end",time:new Date(i.end_time).toISOString()}),o?.inputs!==void 0&&(i.inputs=n0(o.inputs,"input")),await this.onChainEnd?.(i),await this._endTrace(i),i}async handleChainError(t,e,r,n,o){let i=this.getRunById(e);if(!i)throw new Error("No chain run to end.");return i.end_time=Date.now(),i.error=this.stringifyError(t),i.events.push({name:"error",time:new Date(i.end_time).toISOString()}),o?.inputs!==void 0&&(i.inputs=n0(o.inputs,"input")),await this.onChainError?.(i),await this._endTrace(i),i}_createRunForToolStart(t,e,r,n,o,i,s){let a=this._getExecutionOrder(n),c=Date.now(),u={id:r,name:s??t.id[t.id.length-1],parent_run_id:n,start_time:c,serialized:t,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{input:e},execution_order:a,child_execution_order:a,run_type:"tool",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(u)}async handleToolStart(t,e,r,n,o,i,s){let a=this.getRunById(r)??this._createRunForToolStart(t,e,r,n,o,i,s);return await this.onRunCreate?.(a),await this.onToolStart?.(a),a}async handleToolEnd(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.outputs={output:t},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onToolEnd?.(r),await this._endTrace(r),r}async handleToolError(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.error=this.stringifyError(t),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onToolError?.(r),await this._endTrace(r),r}async handleAgentAction(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="chain")return;let n=r;n.actions=n.actions||[],n.actions.push(t),n.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentAction?.(r)}async handleAgentEnd(t,e){let r=this.getRunById(e);!r||r?.run_type!=="chain"||(r.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentEnd?.(r))}_createRunForRetrieverStart(t,e,r,n,o,i,s){let a=this._getExecutionOrder(n),c=Date.now(),u={id:r,name:s??t.id[t.id.length-1],parent_run_id:n,start_time:c,serialized:t,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{query:e},execution_order:a,child_execution_order:a,run_type:"retriever",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(u)}async handleRetrieverStart(t,e,r,n,o,i,s){let a=this.getRunById(r)??this._createRunForRetrieverStart(t,e,r,n,o,i,s);return await this.onRunCreate?.(a),await this.onRetrieverStart?.(a),a}async handleRetrieverEnd(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.outputs={documents:t},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onRetrieverEnd?.(r),await this._endTrace(r),r}async handleRetrieverError(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.error=this.stringifyError(t),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onRetrieverError?.(r),await this._endTrace(r),r}async handleText(t,e){let r=this.getRunById(e);!r||r?.run_type!=="chain"||(r.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:t}}),await this.onText?.(r))}async handleLLMNewToken(t,e,r,n,o,i){let s=this.getRunById(r);if(!s||s?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return s.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:t,idx:e,chunk:i?.chunk}}),await this.onLLMNewToken?.(s,t,{chunk:i?.chunk}),s}};var i0=mn(IR(),1),Vq={};G(Vq,{ConsoleCallbackHandler:()=>Vh});function yr(t,e){return`${t.open}${e}${t.close}`}function yn(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function SR(t){return typeof t=="string"?t.trim():t==null?t:yn(t,t.toString())}function Fi(t){if(!t.end_time)return"";let e=t.end_time-t.start_time;return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}var{color:Cr}=i0.default,Vh=class extends Un{name="console_callback_handler";persistRun(t){return Promise.resolve()}getParents(t){let e=[],r=t;for(;r.parent_run_id;){let n=this.runMap.get(r.parent_run_id);if(n)e.push(n),r=n;else break}return e}getBreadcrumbs(t){let r=[...this.getParents(t).reverse(),t].map((n,o,i)=>{let s=`${n.execution_order}:${n.run_type}:${n.name}`;return o===i.length-1?yr(i0.default.bold,s):s}).join(" > ");return yr(Cr.grey,r)}onChainStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[chain/start]")} [${e}] Entering Chain run with input: ${yn(t.inputs,"[inputs]")}`)}onChainEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[chain/end]")} [${e}] [${Fi(t)}] Exiting Chain run with output: ${yn(t.outputs,"[outputs]")}`)}onChainError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[chain/error]")} [${e}] [${Fi(t)}] Chain run errored with error: ${yn(t.error,"[error]")}`)}onLLMStart(t){let e=this.getBreadcrumbs(t),r="prompts"in t.inputs?{prompts:t.inputs.prompts.map(n=>n.trim())}:t.inputs;console.log(`${yr(Cr.green,"[llm/start]")} [${e}] Entering LLM run with input: ${yn(r,"[inputs]")}`)}onLLMEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[llm/end]")} [${e}] [${Fi(t)}] Exiting LLM run with output: ${yn(t.outputs,"[response]")}`)}onLLMError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[llm/error]")} [${e}] [${Fi(t)}] LLM run errored with error: ${yn(t.error,"[error]")}`)}onToolStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[tool/start]")} [${e}] Entering Tool run with input: "${SR(t.inputs.input)}"`)}onToolEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[tool/end]")} [${e}] [${Fi(t)}] Exiting Tool run with output: "${SR(t.outputs?.output)}"`)}onToolError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[tool/error]")} [${e}] [${Fi(t)}] Tool run errored with error: ${yn(t.error,"[error]")}`)}onRetrieverStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[retriever/start]")} [${e}] Entering Retriever run with input: ${yn(t.inputs,"[inputs]")}`)}onRetrieverEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[retriever/end]")} [${e}] [${Fi(t)}] Exiting Retriever run with output: ${yn(t.outputs,"[outputs]")}`)}onRetrieverError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[retriever/error]")} [${e}] [${Fi(t)}] Retriever run errored with error: ${yn(t.error,"[error]")}`)}onAgentAction(t){let e=t,r=this.getBreadcrumbs(t);console.log(`${yr(Cr.blue,"[agent/action]")} [${r}] Agent selected action: ${yn(e.actions[e.actions.length-1],"[action]")}`)}};var s0,Gh=()=>{if(s0===void 0){let t=It("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};s0=new da(t)}return s0};var c0=class{getStore(){}run(e,r){return r()}},a0=Symbol.for("ls:tracing_async_local_storage"),Gq=new c0,u0=class{getInstance(){return globalThis[a0]??Gq}initializeGlobalInstance(e){globalThis[a0]===void 0&&(globalThis[a0]=e)}},Kq=new u0;function kR(t=!1){let e=Kq.getInstance().getStore();if(!t&&e===void 0)throw new Error(`Could not get the current run tree. + +Please make sure you are calling this method within a traceable function and that tracing is enabled.`);return e}var rge=Symbol.for("langsmith:traceable:root");function Kh(t){return typeof t=="function"&&"langsmith:traceable"in t}var Hq={};G(Hq,{LangChainTracer:()=>Zd});var Zd=class TR extends Un{name="langchain_tracer";projectName;exampleId;client;replicas;usesRunTreeMap=!0;constructor(e={}){super(e);let{exampleId:r,projectName:n,client:o,replicas:i}=e;this.projectName=n??Pd(),this.replicas=i,this.exampleId=r,this.client=o??Gh();let s=TR.getTraceableRunTree();s&&this.updateFromRunTree(s)}async persistRun(e){}async onRunCreate(e){await this.getRunTreeWithTracingConfig(e.id)?.postRun()}async onRunUpdate(e){await this.getRunTreeWithTracingConfig(e.id)?.patchRun()}getRun(e){return this.runTreeMap.get(e)}updateFromRunTree(e){this.runTreeMap.set(e.id,e);let r=e,n=new Set;for(;r.parent_run&&!(n.has(r.id)||(n.add(r.id),!r.parent_run));)r=r.parent_run;n.clear();let o=[r];for(;o.length>0;){let i=o.shift();!i||n.has(i.id)||(n.add(i.id),this.runTreeMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.replicas=e.replicas??this.replicas,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}getRunTreeWithTracingConfig(e){let r=this.runTreeMap.get(e);if(r)return new Ln({...r,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return kR(!0)}catch{return}}};var Hh=mn(Sh(),1),ma;function Wq(){let t="default"in Hh.default?Hh.default.default:Hh.default;return new t({autoStart:!0,concurrency:1})}function Jq(){return typeof ma>"u"&&(ma=Wq()),ma}async function gt(t,e){if(e===!0){let r=Li();r!==void 0?await r.run(void 0,async()=>t()):await t()}else ma=Jq(),ma.add(async()=>{let r=Li();r!==void 0?await r.run(void 0,async()=>t()):await t()})}async function ER(){let t=Gh();await Promise.allSettled([typeof ma<"u"?ma.onIdle():Promise.resolve(),t.awaitPendingTraceBatches()])}var Xq={};G(Xq,{awaitAllCallbacks:()=>ER,consumeCallback:()=>gt});var AR=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>It(r)==="true");function l0(t){let e=Li();return e===void 0?void 0:e.getStore()?.[Di]?.[t]}var Yq=Symbol("lc:configure_hooks"),OR=()=>l0(Yq)||[];var Qq={};G(Qq,{BaseCallbackManager:()=>PR,BaseRunManager:()=>Vd,CallbackManager:()=>St,CallbackManagerForChainRun:()=>RR,CallbackManagerForLLMRun:()=>d0,CallbackManagerForRetrieverRun:()=>CR,CallbackManagerForToolRun:()=>NR,ensureHandler:()=>pu,parseCallbackConfigArg:()=>ha});function ha(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}var PR=class{setHandler(t){return this.setHandlers([t])}},Vd=class{constructor(t,e,r,n,o,i,s,a){this.runId=t,this.handlers=e,this.inheritableHandlers=r,this.tags=n,this.inheritableTags=o,this.metadata=i,this.inheritableMetadata=s,this._parentRunId=a}get parentRunId(){return this._parentRunId}async handleText(t){await Promise.all(this.handlers.map(e=>gt(async()=>{try{await e.handleText?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleText: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleCustomEvent(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{try{await i.handleCustomEvent?.(t,e,this.runId,this.tags,this.metadata)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleCustomEvent: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},CR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleRetrieverEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetriever`),e.raiseError)throw r}},e.awaitHandlers)))}async handleRetrieverError(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetrieverError: ${r}`),e.raiseError)throw t}},e.awaitHandlers)))}},d0=class extends Vd{async handleLLMNewToken(t,e,r,n,o,i){await Promise.all(this.handlers.map(s=>gt(async()=>{if(!s.ignoreLLM)try{await s.handleLLMNewToken?.(t,e??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,i)}catch(a){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleLLMNewToken: ${a}`),s.raiseError)throw a}},s.awaitHandlers)))}async handleLLMError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreLLM)try{await i.handleLLMError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleLLMEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreLLM)try{await i.handleLLMEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},RR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleChainError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreChain)try{await i.handleChainError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleChainEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreChain)try{await i.handleChainEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleAgentAction(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleAgentAction?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentAction: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleAgentEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleAgentEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},NR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleToolError(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleToolError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolError: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleToolEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleToolEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},St=class qd extends PR{handlers=[];inheritableHandlers=[];tags=[];inheritableTags=[];metadata={};inheritableMetadata={};name="callback_manager";_parentRunId;constructor(e,r){super(),this.handlers=r?.handlers??this.handlers,this.inheritableHandlers=r?.inheritableHandlers??this.inheritableHandlers,this.tags=r?.tags??this.tags,this.inheritableTags=r?.inheritableTags??this.inheritableTags,this.metadata=r?.metadata??this.metadata,this.inheritableMetadata=r?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=e}getParentRunId(){return this._parentRunId}async handleLLMStart(e,r,n=void 0,o=void 0,i=void 0,s=void 0,a=void 0,c=void 0){return Promise.all(r.map(async(u,l)=>{let d=l===0&&n?n:Et();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return fa(f)&&f._createRunForLLMStart(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c),gt(async()=>{try{await f.handleLLMStart?.(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c)}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new d0(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(e,r,n=void 0,o=void 0,i=void 0,s=void 0,a=void 0,c=void 0){return Promise.all(r.map(async(u,l)=>{let d=l===0&&n?n:Et();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return fa(f)&&f._createRunForChatModelStart(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c),gt(async()=>{try{if(f.handleChatModelStart)await f.handleChatModelStart?.(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c);else if(f.handleLLMStart){let p=au(u);await f.handleLLMStart?.(e,[p],d,this._parentRunId,i,this.tags,this.metadata,c)}}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new d0(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreChain)return fa(c)&&c._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,a),gt(async()=>{try{await c.handleChainStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,o,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleChainStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new RR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreAgent)return fa(c)&&c._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,a),gt(async()=>{try{await c.handleToolStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleToolStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new NR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreRetriever)return fa(c)&&c._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,a),gt(async()=>{try{await c.handleRetrieverStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleRetrieverStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new CR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(e,r,n,o,i){await Promise.all(this.handlers.map(s=>gt(async()=>{if(!s.ignoreCustomEvent)try{await s.handleCustomEvent?.(e,r,n,this.tags,this.metadata)}catch(a){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleCustomEvent: ${a}`),s.raiseError)throw a}},s.awaitHandlers)))}addHandler(e,r=!0){this.handlers.push(e),r&&this.inheritableHandlers.push(e)}removeHandler(e){this.handlers=this.handlers.filter(r=>r!==e),this.inheritableHandlers=this.inheritableHandlers.filter(r=>r!==e)}setHandlers(e,r=!0){this.handlers=[],this.inheritableHandlers=[];for(let n of e)this.addHandler(n,r)}addTags(e,r=!0){this.removeTags(e),this.tags.push(...e),r&&this.inheritableTags.push(...e)}removeTags(e){this.tags=this.tags.filter(r=>!e.includes(r)),this.inheritableTags=this.inheritableTags.filter(r=>!e.includes(r))}addMetadata(e,r=!0){this.metadata={...this.metadata,...e},r&&(this.inheritableMetadata={...this.inheritableMetadata,...e})}removeMetadata(e){for(let r of Object.keys(e))delete this.metadata[r],delete this.inheritableMetadata[r]}copy(e=[],r=!0){let n=new qd(this._parentRunId);for(let o of this.handlers){let i=this.inheritableHandlers.includes(o);n.addHandler(o,i)}for(let o of this.tags){let i=this.inheritableTags.includes(o);n.addTags([o],i)}for(let o of Object.keys(this.metadata)){let i=Object.keys(this.inheritableMetadata).includes(o);n.addMetadata({[o]:this.metadata[o]},i)}for(let o of e)n.handlers.filter(i=>i.name==="console_callback_handler").some(i=>i.name===o.name)||n.addHandler(o,r);return n}static fromHandlers(e){class r extends la{name=Et();constructor(){super(),Object.assign(this,e)}}let n=new this;return n.addHandler(new r),n}static configure(e,r,n,o,i,s,a){return this._configureSync(e,r,n,o,i,s,a)}static _configureSync(e,r,n,o,i,s,a){let c;(e||r)&&(Array.isArray(e)||!e?(c=new qd,c.setHandlers(e?.map(pu)??[],!0)):c=e,c=c.copy(Array.isArray(r)?r.map(pu):r?.handlers,!1));let u=It("LANGCHAIN_VERBOSE")==="true"||a?.verbose,l=Zd.getTraceableRunTree()?.tracingEnabled||AR(),d=l||(It("LANGCHAIN_TRACING")??!1);if(u||d){if(c||(c=new qd),u&&!c.handlers.some(f=>f.name===Vh.prototype.name)){let f=new Vh;c.addHandler(f,!0)}if(d&&!c.handlers.some(f=>f.name==="langchain_tracer")&&l){let f=new Zd;c.addHandler(f,!0)}if(l){let f=Zd.getTraceableRunTree();f&&c._parentRunId===void 0&&(c._parentRunId=f.id,c.handlers.find(m=>m.name==="langchain_tracer")?.updateFromRunTree(f))}}for(let{contextVar:f,inheritable:p=!0,handlerClass:m,envVar:h}of OR()){let _=h&&It(h)==="true"&&m,v,b=f!==void 0?l0(f):void 0;b&&ox(b)?v=b:_&&(v=new m({})),v!==void 0&&(c||(c=new qd),c.handlers.some(x=>x.name===v.name)||c.addHandler(v,p))}return(n||o)&&c&&(c.addTags(n??[]),c.addTags(o??[],!1)),(i||s)&&c&&(c.addMetadata(i??{}),c.addMetadata(s??{},!1)),c}};function pu(t){return"name"in t?t:la.fromMethods(t)}var p0=class{getStore(){}run(t,e){return e()}enterWith(t){}},eV=new p0,zR=Symbol.for("lc:child_config"),tV=class{getInstance(){return Li()??eV}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[zR]}runWithConfig(t,e,r){let n=St._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata),o=this.getInstance(),i=o.getStore(),s=n?.getParentRunId(),a=n?.handlers?.find(u=>u?.name==="langchain_tracer"),c;return a&&s?c=a.getRunTreeWithTracingConfig(s):r||(c=new Ln({name:"",tracingEnabled:!1})),c&&(c.extra={...c.extra,[zR]:t}),i!==void 0&&i[Di]!==void 0&&(c===void 0&&(c={}),c[Di]=i[Di]),o.run(c,e)}initializeGlobalInstance(t){Li()===void 0&&fO(t)}},Lt=new tV;var rV={};G(rV,{AsyncLocalStorageProviderSingleton:()=>Lt,MockAsyncLocalStorage:()=>p0,_CONTEXT_VARIABLES_KEY:()=>Di});var Wh=25;async function or(t){return St._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function ga(...t){let e={};for(let r of t.filter(n=>!!n))for(let n of Object.keys(r))if(n==="metadata")e[n]={...e[n],...r[n]};else if(n==="tags"){let o=e[n]??[];e[n]=[...new Set(o.concat(r[n]??[]))]}else if(n==="configurable")e[n]={...e[n],...r[n]};else if(n==="timeout")e.timeout===void 0?e.timeout=r.timeout:r.timeout!==void 0&&(e.timeout=Math.min(e.timeout,r.timeout));else if(n==="signal")e.signal===void 0?e.signal=r.signal:r.signal!==void 0&&("any"in AbortSignal?e.signal=AbortSignal.any([e.signal,r.signal]):e.signal=r.signal);else if(n==="callbacks"){let o=e.callbacks,i=r.callbacks;if(Array.isArray(i))if(!o)e.callbacks=i;else if(Array.isArray(o))e.callbacks=o.concat(i);else{let s=o.copy();for(let a of i)s.addHandler(pu(a),!0);e.callbacks=s}else if(i)if(!o)e.callbacks=i;else if(Array.isArray(o)){let s=i.copy();for(let a of o)s.addHandler(pu(a),!0);e.callbacks=s}else e.callbacks=new St(i._parentRunId,{handlers:o.handlers.concat(i.handlers),inheritableHandlers:o.inheritableHandlers.concat(i.inheritableHandlers),tags:Array.from(new Set(o.tags.concat(i.tags))),inheritableTags:Array.from(new Set(o.inheritableTags.concat(i.inheritableTags))),metadata:{...o.metadata,...i.metadata}})}else{let o=n;e[o]=r[o]??e[o]}return e}var nV=new Set(["string","number","boolean"]);function Pe(t){let e=Lt.getRunnableConfig(),r={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(e){let{runId:n,runName:o,...i}=e;r=Object.entries(i).reduce((s,[a,c])=>(c!==void 0&&(s[a]=c),s),r)}if(t&&(r=Object.entries(t).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),r)),r?.configurable)for(let n of Object.keys(r.configurable))nV.has(typeof r.configurable[n])&&!r.metadata?.[n]&&(r.metadata||(r.metadata={}),r.metadata[n]=r.configurable[n]);if(r.timeout!==void 0){if(r.timeout<=0)throw new Error("Timeout must be a positive number");let n=AbortSignal.timeout(r.timeout);r.signal!==void 0?"any"in AbortSignal&&(r.signal=AbortSignal.any([r.signal,n])):r.signal=n,delete r.timeout}return r}function Ve(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:s}={}){let a=Pe(t);return e!==void 0&&(delete a.runName,a.callbacks=e),n!==void 0&&(a.recursionLimit=n),r!==void 0&&(a.maxConcurrency=r),o!==void 0&&(a.runName=o),i!==void 0&&(a.configurable={...a.configurable,...i}),s!==void 0&&delete a.runId,a}function vr(t){if(t)return{configurable:t.configurable,recursionLimit:t.recursionLimit,callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,maxConcurrency:t.maxConcurrency,timeout:t.timeout,signal:t.signal,store:t.store}}async function vn(t,e){if(e===void 0)return t;let r;return Promise.race([t.catch(n=>{if(!e?.aborted)throw n}),new Promise((n,o)=>{r=()=>{o(Bi(e))},e.addEventListener("abort",r),e.aborted&&o(Bi(e))})]).finally(()=>e.removeEventListener("abort",r))}function Bi(t){return t?.reason instanceof Error?t.reason:typeof t?.reason=="string"?new Error(t.reason):new Error("Aborted")}var oV={};G(oV,{AsyncGeneratorWithSetup:()=>Zi,IterableReadableStream:()=>br,atee:()=>Jh,concat:()=>en,pipeGeneratorWithSetup:()=>m0});var br=class f0 extends ReadableStream{reader;ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let e=await this.reader.read();return e.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}throw e}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(e){let r=e.getReader();return new f0({start(n){return o();function o(){return r.read().then(({done:i,value:s})=>{if(i){n.close();return}return n.enqueue(s),o()})}},cancel(){r.releaseLock()}})}static fromAsyncGenerator(e){return new f0({async pull(r){let{value:n,done:o}=await e.next();o&&r.close(),r.enqueue(n)},async cancel(r){await e.return(r)}})}};function Jh(t,e=2){let r=Array.from({length:e},()=>[]);return r.map(async function*(o){for(;;)if(o.length===0){let i=await t.next();for(let s of r)s.push(i)}else{if(o[0].done)return;yield o.shift().value}})}function en(t,e){if(Array.isArray(t)&&Array.isArray(e))return t.concat(e);if(typeof t=="string"&&typeof e=="string")return t+e;if(typeof t=="number"&&typeof e=="number")return t+e;if("concat"in t&&typeof t.concat=="function")return t.concat(e);if(typeof t=="object"&&typeof e=="object"){let r={...t};for(let[n,o]of Object.entries(e))n in r&&!Array.isArray(r[n])?r[n]=en(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}var Zi=class{generator;setup;config;signal;firstResult;firstResultUsed=!1;constructor(t){this.generator=t.generator,this.config=t.config,this.signal=t.signal??this.config?.signal,this.setup=new Promise((e,r)=>{Lt.runWithConfig(vr(t.config),async()=>{this.firstResult=t.generator.next(),t.startSetup?this.firstResult.then(t.startSetup).then(e,r):this.firstResult.then(n=>e(void 0),r)},!0)})}async next(...t){return this.signal?.throwIfAborted(),this.firstResultUsed?Lt.runWithConfig(vr(this.config),this.signal?async()=>vn(this.generator.next(...t),this.signal):async()=>this.generator.next(...t),!0):(this.firstResultUsed=!0,this.firstResult)}async return(t){return this.generator.return(t)}async throw(t){return this.generator.throw(t)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}};async function m0(t,e,r,n,...o){let i=new Zi({generator:e,startSetup:r,signal:n}),s=await i.setup;return{output:t(i,s,...o),setup:s}}var iV=Object.prototype.hasOwnProperty;function Yh(t,e){return iV.call(t,e)}function Qh(t){if(Array.isArray(t)){let r=new Array(t.length);for(let n=0;n=48&&n<=57){e++;continue}return!1}return!0}function Jo(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function tg(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function Xh(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r_t,_areEquals:()=>Gd,applyOperation:()=>_a,applyPatch:()=>qi,applyReducer:()=>cV,deepClone:()=>sV,getValueByPointer:()=>ng,validate:()=>jR,validator:()=>og});var _t=rg,sV=wr,fu={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){let n=ng(r,this.path);n&&(n=wr(n));let o=_a(r,{op:"remove",path:this.from}).removed;return _a(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=ng(r,this.from);return _a(r,{op:"add",path:this.path,value:wr(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:Gd(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},aV={add:function(t,e,r){return eg(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:fu.move,copy:fu.copy,test:fu.test,_get:fu._get};function ng(t,e){if(e=="")return t;var r={op:"_get",path:e};return _a(t,r),r.value}function _a(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):og(e,0)),e.path===""){let s={newDocument:t};if(e.op==="add")return s.newDocument=e.value,s;if(e.op==="replace")return s.newDocument=e.value,s.removed=t,s;if(e.op==="move"||e.op==="copy")return s.newDocument=ng(t,e.from),e.op==="move"&&(s.removed=t),s;if(e.op==="test"){if(s.test=Gd(t,e.value),s.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return s.newDocument=t,s}else{if(e.op==="remove")return s.removed=t,s.newDocument=null,s;if(e.op==="_get")return e.value=t,s;if(r)throw new _t("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return s}}else{n||(t=wr(t));let a=(e.path||"").split("/"),c=t,u=1,l=a.length,d,f,p;for(typeof r=="function"?p=r:p=og;;){if(f=a[u],f&&f.indexOf("~")!=-1&&(f=tg(f)),o&&(f=="__proto__"||f=="prototype"&&u>0&&a[u-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&d===void 0&&(c[f]===void 0?d=a.slice(0,u).join("/"):u==l-1&&(d=e.path),d!==void 0&&p(e,0,t,d)),u++,Array.isArray(c)){if(f==="-")f=c.length;else{if(r&&!eg(f))throw new _t("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,e,t);eg(f)&&(f=~~f)}if(u>=l){if(r&&e.op==="add"&&f>c.length)throw new _t("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let m=aV[e.op].call(e,c,f,t);if(m.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(u>=l){let m=fu[e.op].call(e,c,f,t);if(m.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(c=c[f],r&&u0)throw new _t('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new _t("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new _t("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&Xh(t.value))throw new _t("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var o=t.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new _t("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==n)throw new _t("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var s={op:"_get",path:t.from,value:void 0},a=jR([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new _t("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new _t("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function jR(t,e,r){try{if(!Array.isArray(t))throw new _t("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)qi(wr(e),wr(t),r||!0);else{r=r||og;for(var n=0;n=0;u--){var l=s[u],d=t[l];if(Yh(e,l)&&!(e[l]===void 0&&d!==void 0&&Array.isArray(e)===!1)){var f=e[l];typeof d=="object"&&d!=null&&typeof f=="object"&&f!=null&&Array.isArray(d)===Array.isArray(f)?DR(d,f,r,n+"/"+Jo(l),o):d!==f&&(a=!0,o&&r.push({op:"test",path:n+"/"+Jo(l),value:wr(d)}),r.push({op:"replace",path:n+"/"+Jo(l),value:wr(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+Jo(l),value:wr(d)}),r.push({op:"remove",path:n+"/"+Jo(l)}),c=!0):(o&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),a=!0)}if(!(!c&&i.length==s.length))for(var u=0;usg,RunLog:()=>ig,RunLogPatch:()=>ho,isLogStreamHandler:()=>_0});var ho=class{ops;constructor(t){this.ops=t.ops??[]}concat(t){let e=this.ops.concat(t.ops),r=qi({},e);return new ig({ops:e,state:r[r.length-1].newDocument})}},ig=class g0 extends ho{state;constructor(e){super(e),this.state=e.state}concat(e){let r=this.ops.concat(e.ops),n=qi(this.state,e.ops);return new g0({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=qi({},e.ops);return new g0({ops:e.ops,state:r[r.length-1].newDocument})}},_0=t=>t.name==="log_stream_tracer";async function LR(t,e){if(e==="original")throw new Error("Do not assign inputs with original schema drop the key for now. When inputs are added to streamLog they should be added with standardized schema for streaming events.");let{inputs:r}=t;if(["retriever","llm","prompt"].includes(t.run_type))return r;if(!(Object.keys(r).length===1&&r?.input===""))return r.input}async function UR(t,e){let{outputs:r}=t;return e==="original"||["retriever","llm","prompt"].includes(t.run_type)?r:r!==void 0&&Object.keys(r).length===1&&r?.output!==void 0?r.output:r}function lV(t){return t!==void 0&&t.message!==void 0}var sg=class extends Un{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;_schemaFormat="original";rootId;keyMapByRunId={};counterMapByRunName={};transformStream;writer;receiveStream;name="log_stream_tracer";lc_prefer_streaming=!0;constructor(t){super({_awaitHandler:!0,...t}),this.autoClose=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this._schemaFormat=t?._schemaFormat??this._schemaFormat,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=br.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){if(t.id===this.rootId)return!1;let e=t.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(t.run_type)),this.includeTags!==void 0&&(r=r||e.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(t.run_type)),this.excludeTags!==void 0&&(r=r&&e.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(t,e){for await(let r of e){if(t!==this.rootId){let n=this.keyMapByRunId[t];n&&await this.writer.write(new ho({ops:[{op:"add",path:`/logs/${n}/streamed_output/-`,value:r}]}))}yield r}}async onRunCreate(t){if(this.rootId===void 0&&(this.rootId=t.id,await this.writer.write(new ho({ops:[{op:"replace",path:"",value:{id:t.id,name:t.name,type:t.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(t))return;this.counterMapByRunName[t.name]===void 0&&(this.counterMapByRunName[t.name]=0),this.counterMapByRunName[t.name]+=1;let e=this.counterMapByRunName[t.name];this.keyMapByRunId[t.id]=e===1?t.name:`${t.name}:${e}`;let r={id:t.id,name:t.name,type:t.run_type,tags:t.tags??[],metadata:t.extra?.metadata??{},start_time:new Date(t.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};this._schemaFormat==="streaming_events"&&(r.inputs=await LR(t,this._schemaFormat)),await this.writer.write(new ho({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[t.id]}`,value:r}]}))}async onRunUpdate(t){try{let e=this.keyMapByRunId[t.id];if(e===void 0)return;let r=[];this._schemaFormat==="streaming_events"&&r.push({op:"replace",path:`/logs/${e}/inputs`,value:await LR(t,this._schemaFormat)}),r.push({op:"add",path:`/logs/${e}/final_output`,value:await UR(t,this._schemaFormat)}),t.end_time!==void 0&&r.push({op:"add",path:`/logs/${e}/end_time`,value:new Date(t.end_time).toISOString()});let n=new ho({ops:r});await this.writer.write(n)}finally{if(t.id===this.rootId){let e=new ho({ops:[{op:"replace",path:"/final_output",value:await UR(t,this._schemaFormat)}]});await this.writer.write(e),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(t,e,r){let n=this.keyMapByRunId[t.id];if(n===void 0)return;let o=t.inputs.messages!==void 0,i;o?lV(r?.chunk)?i=r?.chunk:i=new Dt({id:`run-${t.id}`,content:e}):i=e;let s=new ho({ops:[{op:"add",path:`/logs/${n}/streamed_output_str/-`,value:e},{op:"add",path:`/logs/${n}/streamed_output/-`,value:i}]});await this.writer.write(s)}};var dV={};G(dV,{ChatGenerationChunk:()=>Vi,GenerationChunk:()=>go,RUN_KEY:()=>ya});var ya="__run",go=class FR{text;generationInfo;constructor(e){this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new FR({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},Vi=class BR extends go{message;constructor(e){super(e),this.message=e.message}concat(e){return new BR({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo},message:this.message.concat(e.message)})}};function ag({name:t,serialized:e}){return t!==void 0?t:e?.name!==void 0?e.name:e?.id!==void 0&&Array.isArray(e?.id)?e.id[e.id.length-1]:"Unnamed"}var ZR=t=>t.name==="event_stream_tracer",qR=class extends Un{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;runInfoMap=new Map;tappedPromises=new Map;transformStream;writer;receiveStream;name="event_stream_tracer";lc_prefer_streaming=!0;constructor(t){super({_awaitHandler:!0,...t}),this.autoClose=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=br.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){let e=t.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(t.runType)),this.includeTags!==void 0&&(r=r||e.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(t.runType)),this.excludeTags!==void 0&&(r=r&&e.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(t,e){let r=await e.next();if(r.done)return;let n=this.runInfoMap.get(t);if(n===void 0){yield r.value;return}function o(s,a){return s==="llm"&&typeof a=="string"?new go({text:a}):a}let i=this.tappedPromises.get(t);if(i===void 0){let s;i=new Promise(a=>{s=a}),this.tappedPromises.set(t,i);try{let a={event:`on_${n.runType}_stream`,run_id:t,name:n.name,tags:n.tags,metadata:n.metadata,data:{}};await this.send({...a,data:{chunk:o(n.runType,r.value)}},n),yield r.value;for await(let c of e)n.runType!=="tool"&&n.runType!=="retriever"&&await this.send({...a,data:{chunk:o(n.runType,c)}},n),yield c}finally{s?.()}}else{yield r.value;for await(let s of e)yield s}}async send(t,e){this._includeRun(e)&&await this.writer.write(t)}async sendEndEvent(t,e){let r=this.tappedPromises.get(t.run_id);r!==void 0?r.then(()=>{this.send(t,e)}):await this.send(t,e)}async onLLMStart(t){let e=ag(t),r=t.inputs.messages!==void 0?"chat_model":"llm",n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:r,inputs:t.inputs};this.runInfoMap.set(t.id,n);let o=`on_${r}_start`;await this.send({event:o,data:{input:t.inputs},name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onLLMNewToken(t,e,r){let n=this.runInfoMap.get(t.id),o,i;if(n===void 0)throw new Error(`onLLMNewToken: Run ID ${t.id} not found in run map.`);if(this.runInfoMap.size!==1){if(n.runType==="chat_model")i="on_chat_model_stream",r?.chunk===void 0?o=new Dt({content:e,id:`run-${t.id}`}):o=r.chunk.message;else if(n.runType==="llm")i="on_llm_stream",r?.chunk===void 0?o=new go({text:e}):o=r.chunk;else throw new Error(`Unexpected run type ${n.runType}`);await this.send({event:i,data:{chunk:o},run_id:t.id,name:n.name,tags:n.tags,metadata:n.metadata},n)}}async onLLMEnd(t){let e=this.runInfoMap.get(t.id);this.runInfoMap.delete(t.id);let r;if(e===void 0)throw new Error(`onLLMEnd: Run ID ${t.id} not found in run map.`);let n=t.outputs?.generations,o;if(e.runType==="chat_model"){for(let i of n??[]){if(o!==void 0)break;o=i[0]?.message}r="on_chat_model_end"}else if(e.runType==="llm")o={generations:n?.map(i=>i.map(s=>({text:s.text,generationInfo:s.generationInfo}))),llmOutput:t.outputs?.llmOutput??{}},r="on_llm_end";else throw new Error(`onLLMEnd: Unexpected run type: ${e.runType}`);await this.sendEndEvent({event:r,data:{output:o,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async onChainStart(t){let e=ag(t),r=t.run_type??"chain",n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:t.run_type},o={};t.inputs.input===""&&Object.keys(t.inputs).length===1?(o={},n.inputs={}):t.inputs.input!==void 0?(o.input=t.inputs.input,n.inputs=t.inputs.input):(o.input=t.inputs,n.inputs=t.inputs),this.runInfoMap.set(t.id,n),await this.send({event:`on_${r}_start`,data:o,name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onChainEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onChainEnd: Run ID ${t.id} not found in run map.`);let r=`on_${t.run_type}_end`,n=t.inputs??e.inputs??{},i={output:t.outputs?.output??t.outputs,input:n};n.input&&Object.keys(n).length===1&&(i.input=n.input,e.inputs=n.input),await this.sendEndEvent({event:r,data:i,run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata??{}},e)}async onToolStart(t){let e=ag(t),r={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:"tool",inputs:t.inputs??{}};this.runInfoMap.set(t.id,r),await this.send({event:"on_tool_start",data:{input:t.inputs??{}},name:e,run_id:t.id,tags:t.tags??[],metadata:t.extra?.metadata??{}},r)}async onToolEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onToolEnd: Run ID ${t.id} not found in run map.`);if(e.inputs===void 0)throw new Error(`onToolEnd: Run ID ${t.id} is a tool call, and is expected to have traced inputs.`);let r=t.outputs?.output===void 0?t.outputs:t.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:r,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async onRetrieverStart(t){let e=ag(t),n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:"retriever",inputs:{query:t.inputs.query}};this.runInfoMap.set(t.id,n),await this.send({event:"on_retriever_start",data:{input:{query:t.inputs.query}},name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onRetrieverEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onRetrieverEnd: Run ID ${t.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:t.outputs?.documents??t.outputs,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async handleCustomEvent(t,e,r){let n=this.runInfoMap.get(r);if(n===void 0)throw new Error(`handleCustomEvent: Run ID ${r} not found in run map.`);await this.send({event:"on_custom_event",run_id:r,name:t,tags:n.tags,metadata:n.metadata,data:e},n)}async finish(){let t=[...this.tappedPromises.values()];Promise.all(t).finally(()=>{this.writer.close()})}};var pV=Object.prototype.toString,fV=t=>pV.call(t)==="[object Error]",mV=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function VR(t){if(!(t&&fV(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:mV.has(r)}function hV(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function cg(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(_),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},_=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&_.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function Kd(t,e={}){if(e={...e},hV(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,cg("factor",e.factor,{min:0,allowInfinity:!1}),cg("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),cg("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),cg("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await yV({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var ug=mn(Sh(),1),vV={};G(vV,{AsyncCaller:()=>Xo});var bV=[400,401,402,403,404,405,406,407,409],wV=t=>{if(t.message.startsWith("Cancel")||t.message.startsWith("AbortError")||t.name==="AbortError"||t?.code==="ECONNABORTED")throw t;let e=t?.response?.status??t?.status;if(e&&bV.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},Xo=class{maxConcurrency;maxRetries;onFailedAttempt;queue;constructor(t){this.maxConcurrency=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??6,this.onFailedAttempt=t.onFailedAttempt??wV;let e="default"in ug.default?ug.default.default:ug.default;this.queue=new e({concurrency:this.maxConcurrency})}async call(t,...e){return this.queue.add(()=>Kd(()=>t(...e).catch(r=>{throw r instanceof Error?r:new Error(r)}),{onFailedAttempt:({error:r})=>this.onFailedAttempt?.(r),retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(t,e,...r){if(t.signal){let n;return Promise.race([this.call(e,...r),new Promise((o,i)=>{n=()=>{i(Bi(t.signal))},t.signal?.addEventListener("abort",n)})]).finally(()=>{t.signal&&n&&t.signal.removeEventListener("abort",n)})}return this.call(e,...r)}fetch(...t){return this.call(()=>fetch(...t).then(e=>e.ok?e:Promise.reject(e)))}};var y0=class extends Un{name="RootListenersTracer";rootId;config;argOnStart;argOnEnd;argOnError;constructor({config:t,onStart:e,onEnd:r,onError:n}){super({_awaitHandler:!0}),this.config=t,this.argOnStart=e,this.argOnEnd=r,this.argOnError=n}persistRun(t){return Promise.resolve()}async onRunCreate(t){this.rootId||(this.rootId=t.id,this.argOnStart&&await this.argOnStart(t,this.config))}async onRunUpdate(t){t.id===this.rootId&&(t.error?this.argOnError&&await this.argOnError(t,this.config):this.argOnEnd&&await this.argOnEnd(t,this.config))}};function Hd(t){return t?t.lc_runnable:!1}var KR=class{includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;constructor(t){this.includeNames=t.includeNames,this.includeTypes=t.includeTypes,this.includeTags=t.includeTags,this.excludeNames=t.excludeNames,this.excludeTypes=t.excludeTypes,this.excludeTags=t.excludeTags}includeEvent(t,e){let r=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,n=t.tags??[];return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(e)),this.includeTags!==void 0&&(r=r||n.some(o=>this.includeTags?.includes(o))),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(e)),this.excludeTags!==void 0&&(r=r&&n.every(o=>!this.excludeTags?.includes(o))),r}},HR=t=>btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");var nn={};gi(nn,{$ZodAny:()=>a_,$ZodArray:()=>l_,$ZodAsyncError:()=>Fn,$ZodBase64:()=>Xg,$ZodBase64URL:()=>Yg,$ZodBigInt:()=>cp,$ZodBigIntFormat:()=>n_,$ZodBoolean:()=>ku,$ZodCIDRv4:()=>Wg,$ZodCIDRv6:()=>Jg,$ZodCUID:()=>jg,$ZodCUID2:()=>Dg,$ZodCatch:()=>S_,$ZodCheck:()=>Je,$ZodCheckBigIntFormat:()=>s$,$ZodCheckEndsWith:()=>y$,$ZodCheckGreaterThan:()=>Sg,$ZodCheckIncludes:()=>g$,$ZodCheckLengthEquals:()=>p$,$ZodCheckLessThan:()=>Ig,$ZodCheckLowerCase:()=>m$,$ZodCheckMaxLength:()=>l$,$ZodCheckMaxSize:()=>a$,$ZodCheckMimeType:()=>b$,$ZodCheckMinLength:()=>d$,$ZodCheckMinSize:()=>c$,$ZodCheckMultipleOf:()=>o$,$ZodCheckNumberFormat:()=>i$,$ZodCheckOverwrite:()=>w$,$ZodCheckProperty:()=>v$,$ZodCheckRegex:()=>f$,$ZodCheckSizeEquals:()=>u$,$ZodCheckStartsWith:()=>_$,$ZodCheckStringFormat:()=>Su,$ZodCheckUpperCase:()=>h$,$ZodCodec:()=>Au,$ZodCustom:()=>R_,$ZodCustomStringFormat:()=>t_,$ZodDate:()=>u_,$ZodDefault:()=>w_,$ZodDiscriminatedUnion:()=>d_,$ZodE164:()=>Qg,$ZodEmail:()=>Rg,$ZodEmoji:()=>zg,$ZodEncodeError:()=>Gi,$ZodEnum:()=>g_,$ZodError:()=>np,$ZodFile:()=>y_,$ZodFunction:()=>O_,$ZodGUID:()=>Pg,$ZodIPv4:()=>Gg,$ZodIPv6:()=>Kg,$ZodISODate:()=>Zg,$ZodISODateTime:()=>Bg,$ZodISODuration:()=>Vg,$ZodISOTime:()=>qg,$ZodIntersection:()=>p_,$ZodJWT:()=>e_,$ZodKSUID:()=>Fg,$ZodLazy:()=>C_,$ZodLiteral:()=>__,$ZodMAC:()=>Hg,$ZodMap:()=>m_,$ZodNaN:()=>k_,$ZodNanoID:()=>Mg,$ZodNever:()=>Eu,$ZodNonOptional:()=>$_,$ZodNull:()=>s_,$ZodNullable:()=>b_,$ZodNumber:()=>ap,$ZodNumberFormat:()=>r_,$ZodObject:()=>S$,$ZodObjectJIT:()=>k$,$ZodOptional:()=>xa,$ZodPipe:()=>T_,$ZodPrefault:()=>x_,$ZodPromise:()=>P_,$ZodReadonly:()=>E_,$ZodRealError:()=>Rr,$ZodRecord:()=>f_,$ZodRegistry:()=>Pu,$ZodSet:()=>h_,$ZodString:()=>Yi,$ZodStringFormat:()=>He,$ZodSuccess:()=>I_,$ZodSymbol:()=>o_,$ZodTemplateLiteral:()=>A_,$ZodTransform:()=>v_,$ZodTuple:()=>lp,$ZodType:()=>ye,$ZodULID:()=>Lg,$ZodURL:()=>Ng,$ZodUUID:()=>Cg,$ZodUndefined:()=>i_,$ZodUnion:()=>up,$ZodUnknown:()=>Tu,$ZodVoid:()=>c_,$ZodXID:()=>Ug,$brand:()=>Jd,$constructor:()=>$,$input:()=>D_,$output:()=>j_,Doc:()=>sp,JSONSchema:()=>$z,JSONSchemaGenerator:()=>zp,NEVER:()=>lg,TimePrecision:()=>B_,_any:()=>uy,_array:()=>T$,_base64:()=>Op,_base64url:()=>Pp,_bigint:()=>ry,_boolean:()=>ey,_catch:()=>j5,_check:()=>xz,_cidrv4:()=>Ep,_cidrv6:()=>Ap,_coercedBigint:()=>ny,_coercedBoolean:()=>ty,_coercedDate:()=>py,_coercedNumber:()=>H_,_coercedString:()=>U_,_cuid:()=>wp,_cuid2:()=>xp,_custom:()=>by,_date:()=>dy,_decode:()=>gg,_decodeAsync:()=>yg,_default:()=>N5,_discriminatedUnion:()=>x5,_e164:()=>Cp,_email:()=>mp,_emoji:()=>vp,_encode:()=>hg,_encodeAsync:()=>_g,_endsWith:()=>Bu,_enum:()=>E5,_file:()=>vy,_float32:()=>J_,_float64:()=>X_,_gt:()=>yo,_gte:()=>ir,_guid:()=>Cu,_includes:()=>Uu,_int:()=>W_,_int32:()=>Y_,_int64:()=>oy,_intersection:()=>$5,_ipv4:()=>kp,_ipv6:()=>Tp,_isoDate:()=>q_,_isoDateTime:()=>Z_,_isoDuration:()=>G_,_isoTime:()=>V_,_jwt:()=>Rp,_ksuid:()=>Sp,_lazy:()=>F5,_length:()=>Sa,_literal:()=>O5,_lowercase:()=>Du,_lt:()=>_o,_lte:()=>zr,_mac:()=>F_,_map:()=>k5,_max:()=>zr,_maxLength:()=>Ia,_maxSize:()=>$a,_mime:()=>Zu,_min:()=>ir,_minLength:()=>Qo,_minSize:()=>es,_multipleOf:()=>Qi,_nan:()=>fy,_nanoid:()=>bp,_nativeEnum:()=>A5,_negative:()=>hy,_never:()=>zu,_nonnegative:()=>_y,_nonoptional:()=>z5,_nonpositive:()=>gy,_normalize:()=>qu,_null:()=>cy,_nullable:()=>R5,_number:()=>K_,_optional:()=>C5,_overwrite:()=>Zn,_parse:()=>bu,_parseAsync:()=>wu,_pipe:()=>D5,_positive:()=>my,_promise:()=>B5,_property:()=>yy,_readonly:()=>L5,_record:()=>S5,_refine:()=>wy,_regex:()=>ju,_safeDecode:()=>bg,_safeDecodeAsync:()=>xg,_safeEncode:()=>vg,_safeEncodeAsync:()=>wg,_safeParse:()=>xu,_safeParseAsync:()=>$u,_set:()=>T5,_size:()=>Mu,_slugify:()=>Np,_startsWith:()=>Fu,_string:()=>L_,_stringFormat:()=>ka,_stringbool:()=>Sy,_success:()=>M5,_superRefine:()=>xy,_symbol:()=>sy,_templateLiteral:()=>U5,_toLowerCase:()=>Gu,_toUpperCase:()=>Ku,_transform:()=>P5,_trim:()=>Vu,_tuple:()=>I5,_uint32:()=>Q_,_uint64:()=>iy,_ulid:()=>$p,_undefined:()=>ay,_union:()=>w5,_unknown:()=>Nu,_uppercase:()=>Lu,_url:()=>Ru,_uuid:()=>hp,_uuidv4:()=>gp,_uuidv6:()=>_p,_uuidv7:()=>yp,_void:()=>ly,_xid:()=>Ip,clone:()=>Qe,config:()=>yt,decode:()=>tN,decodeAsync:()=>nN,describe:()=>$y,encode:()=>eN,encodeAsync:()=>rN,flattenError:()=>yu,formatError:()=>vu,globalConfig:()=>Wd,globalRegistry:()=>Ge,isValidBase64:()=>I$,isValidBase64URL:()=>IN,isValidJWT:()=>SN,locales:()=>Ou,meta:()=>Iy,parse:()=>Bn,parseAsync:()=>Yo,prettifyError:()=>mg,regexes:()=>Nr,registry:()=>fp,safeDecode:()=>iN,safeDecodeAsync:()=>aN,safeEncode:()=>oN,safeEncodeAsync:()=>sN,safeParse:()=>ba,safeParseAsync:()=>Iu,toDotPath:()=>QR,toJSONSchema:()=>vo,treeifyError:()=>fg,util:()=>M,version:()=>x$});var lg=Object.freeze({status:"aborted"});function $(t,e,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let u=s.prototype,l=Object.keys(u);for(let d=0;dr?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var Jd=Symbol("zod_brand"),Fn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Gi=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Wd={};function yt(t){return t&&Object.assign(Wd,t),Wd}var M={};gi(M,{BIGINT_FORMAT_RANGES:()=>E0,Class:()=>b0,NUMBER_FORMAT_RANGES:()=>T0,aborted:()=>Xi,allowsEval:()=>$0,assert:()=>kV,assertEqual:()=>xV,assertIs:()=>IV,assertNever:()=>SV,assertNotEqual:()=>$V,assignProp:()=>Hi,base64ToUint8Array:()=>JR,base64urlToUint8Array:()=>ZV,cached:()=>gu,captureStackTrace:()=>pg,cleanEnum:()=>BV,cleanRegex:()=>Qd,clone:()=>Qe,cloneDef:()=>EV,createTransparentProxy:()=>NV,defineLazy:()=>Me,esc:()=>dg,escapeRegex:()=>bn,extend:()=>jV,finalizeIssue:()=>rn,floatSafeRemainder:()=>w0,getElementAtPath:()=>AV,getEnumValues:()=>Yd,getLengthableOrigin:()=>rp,getParsedType:()=>RV,getSizableOrigin:()=>tp,hexToUint8Array:()=>VV,isObject:()=>va,isPlainObject:()=>Ji,issue:()=>_u,joinValues:()=>E,jsonStringifyReplacer:()=>hu,merge:()=>LV,mergeDefs:()=>Wi,normalizeParams:()=>D,nullish:()=>Ki,numKeys:()=>CV,objectClone:()=>TV,omit:()=>MV,optionalKeys:()=>k0,partial:()=>UV,pick:()=>zV,prefixIssues:()=>tn,primitiveTypes:()=>S0,promiseAllObject:()=>OV,propertyKeyTypes:()=>ep,randomString:()=>PV,required:()=>FV,safeExtend:()=>DV,shallowClone:()=>I0,slugify:()=>x0,stringifyPrimitive:()=>j,uint8ArrayToBase64:()=>XR,uint8ArrayToBase64url:()=>qV,uint8ArrayToHex:()=>GV,unwrapMessage:()=>Xd});function xV(t){return t}function $V(t){return t}function IV(t){}function SV(t){throw new Error}function kV(t){}function Yd(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function E(t,e="|"){return t.map(r=>j(r)).join(e)}function hu(t,e){return typeof e=="bigint"?e.toString():e}function gu(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ki(t){return t==null}function Qd(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function w0(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,s=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return s%a/10**i}var WR=Symbol("evaluating");function Me(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==WR)return n===void 0&&(n=WR,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function TV(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Hi(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Wi(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function EV(t){return Wi(t._zod.def)}function AV(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function OV(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i{};function va(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var $0=gu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Ji(t){if(va(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(va(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function I0(t){return Ji(t)?{...t}:Array.isArray(t)?[...t]:t}function CV(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var RV=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},ep=new Set(["string","number","symbol"]),S0=new Set(["string","number","bigint","boolean","symbol","undefined"]);function bn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qe(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function D(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function NV(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function j(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function k0(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var T0={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},E0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zV(t,e){let r=t._zod.def,n=Wi(t._zod.def,{get shape(){let o={};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&(o[i]=r.shape[i])}return Hi(this,"shape",o),o},checks:[]});return Qe(t,n)}function MV(t,e){let r=t._zod.def,n=Wi(t._zod.def,{get shape(){let o={...t._zod.def.shape};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&delete o[i]}return Hi(this,"shape",o),o},checks:[]});return Qe(t,n)}function jV(t,e){if(!Ji(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let o=Wi(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return Hi(this,"shape",i),i},checks:[]});return Qe(t,o)}function DV(t,e){if(!Ji(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return Hi(this,"shape",n),n},checks:t._zod.def.checks};return Qe(t,r)}function LV(t,e){let r=Wi(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return Hi(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Qe(t,r)}function UV(t,e,r){let n=Wi(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=t?new t({type:"optional",innerType:o[s]}):o[s])}else for(let s in o)i[s]=t?new t({type:"optional",innerType:o[s]}):o[s];return Hi(this,"shape",i),i},checks:[]});return Qe(e,n)}function FV(t,e,r){let n=Wi(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new t({type:"nonoptional",innerType:o[s]}))}else for(let s in o)i[s]=new t({type:"nonoptional",innerType:o[s]});return Hi(this,"shape",i),i},checks:[]});return Qe(e,n)}function Xi(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Xd(t){return typeof t=="string"?t:t?.message}function rn(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=Xd(t.inst?._zod.def?.error?.(t))??Xd(e?.error?.(t))??Xd(r.customError?.(t))??Xd(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function tp(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function rp(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function _u(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function BV(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function JR(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;ne.toString(16).padStart(2,"0")).join("")}var b0=class{constructor(...e){}};var YR=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,hu,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},np=$("$ZodError",YR),Rr=$("$ZodError",YR,{Parent:Error});function yu(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function vu(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>n({issues:s}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let s=r,a=0;for(;ar.message){let r={errors:[]},n=(o,i=[])=>{var s,a;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>n({issues:u},c.path));else if(c.code==="invalid_key")n({issues:c.issues},c.path);else if(c.code==="invalid_element")n({issues:c.issues},c.path);else{let u=[...i,...c.path];if(u.length===0){r.errors.push(e(c));continue}let l=r,d=0;for(;dtypeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function mg(t){let e=[],r=[...t.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${QR(n.path)}`);return e.join(` +`)}var bu=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Fn;if(s.issues.length){let a=new(o?.Err??t)(s.issues.map(c=>rn(c,i,yt())));throw pg(a,o?.callee),a}return s.value},Bn=bu(Rr),wu=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(o?.Err??t)(s.issues.map(c=>rn(c,i,yt())));throw pg(a,o?.callee),a}return s.value},Yo=wu(Rr),xu=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Fn;return i.issues.length?{success:!1,error:new(t??np)(i.issues.map(s=>rn(s,o,yt())))}:{success:!0,data:i.value}},ba=xu(Rr),$u=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(s=>rn(s,o,yt())))}:{success:!0,data:i.value}},Iu=$u(Rr),hg=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return bu(t)(e,r,o)},eN=hg(Rr),gg=t=>(e,r,n)=>bu(t)(e,r,n),tN=gg(Rr),_g=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wu(t)(e,r,o)},rN=_g(Rr),yg=t=>async(e,r,n)=>wu(t)(e,r,n),nN=yg(Rr),vg=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return xu(t)(e,r,o)},oN=vg(Rr),bg=t=>(e,r,n)=>xu(t)(e,r,n),iN=bg(Rr),wg=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return $u(t)(e,r,o)},sN=wg(Rr),xg=t=>async(e,r,n)=>$u(t)(e,r,n),aN=xg(Rr);var Nr={};gi(Nr,{base64:()=>q0,base64url:()=>$g,bigint:()=>J0,boolean:()=>Q0,browserEmail:()=>t3,cidrv4:()=>B0,cidrv6:()=>Z0,cuid:()=>A0,cuid2:()=>O0,date:()=>G0,datetime:()=>H0,domain:()=>o3,duration:()=>z0,e164:()=>V0,email:()=>j0,emoji:()=>D0,extendedDuration:()=>HV,guid:()=>M0,hex:()=>i3,hostname:()=>n3,html5Email:()=>YV,idnEmail:()=>e3,integer:()=>X0,ipv4:()=>L0,ipv6:()=>U0,ksuid:()=>R0,lowercase:()=>r$,mac:()=>F0,md5_base64:()=>a3,md5_base64url:()=>c3,md5_hex:()=>s3,nanoid:()=>N0,null:()=>e$,number:()=>Y0,rfc5322Email:()=>QV,sha1_base64:()=>l3,sha1_base64url:()=>d3,sha1_hex:()=>u3,sha256_base64:()=>f3,sha256_base64url:()=>m3,sha256_hex:()=>p3,sha384_base64:()=>g3,sha384_base64url:()=>_3,sha384_hex:()=>h3,sha512_base64:()=>v3,sha512_base64url:()=>b3,sha512_hex:()=>y3,string:()=>W0,time:()=>K0,ulid:()=>P0,undefined:()=>t$,unicodeEmail:()=>cN,uppercase:()=>n$,uuid:()=>wa,uuid4:()=>WV,uuid6:()=>JV,uuid7:()=>XV,xid:()=>C0});var A0=/^[cC][^\s-]{8,}$/,O0=/^[0-9a-z]+$/,P0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,C0=/^[0-9a-vA-V]{20}$/,R0=/^[A-Za-z0-9]{27}$/,N0=/^[a-zA-Z0-9_-]{21}$/,z0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,HV=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,M0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,wa=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,WV=wa(4),JV=wa(6),XV=wa(7),j0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,YV=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,QV=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,cN=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,e3=cN,t3=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,r3="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function D0(){return new RegExp(r3,"u")}var L0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,U0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,F0=t=>{let e=bn(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},B0=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Z0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,q0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$g=/^[A-Za-z0-9_-]*$/,n3=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,o3=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,V0=/^\+(?:[0-9]){6,14}[0-9]$/,uN="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",G0=new RegExp(`^${uN}$`);function lN(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function K0(t){return new RegExp(`^${lN(t)}$`)}function H0(t){let e=lN({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${uN}T(?:${n})$`)}var W0=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},J0=/^-?\d+n?$/,X0=/^-?\d+$/,Y0=/^-?\d+(?:\.\d+)?/,Q0=/^(?:true|false)$/i,e$=/^null$/i;var t$=/^undefined$/i;var r$=/^[^A-Z]*$/,n$=/^[^a-z]*$/,i3=/^[0-9a-fA-F]*$/;function op(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function ip(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var s3=/^[0-9a-fA-F]{32}$/,a3=op(22,"=="),c3=ip(22),u3=/^[0-9a-fA-F]{40}$/,l3=op(27,"="),d3=ip(27),p3=/^[0-9a-fA-F]{64}$/,f3=op(43,"="),m3=ip(43),h3=/^[0-9a-fA-F]{96}$/,g3=op(64,""),_3=ip(64),y3=/^[0-9a-fA-F]{128}$/,v3=op(86,"=="),b3=ip(86);var Je=$("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),pN={number:"number",bigint:"bigint",object:"date"},Ig=$("$ZodCheckLessThan",(t,e)=>{Je.init(t,e);let r=pN[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?n.value<=e.value:n.value{Je.init(t,e);let r=pN[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),o$=$("$ZodCheckMultipleOf",(t,e)=>{Je.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):w0(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),i$=$("$ZodCheckNumberFormat",(t,e)=>{Je.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=T0[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=o,a.maximum=i,r&&(a.pattern=X0)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}ai&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:t})}}),s$=$("$ZodCheckBigIntFormat",(t,e)=>{Je.init(t,e);let[r,n]=E0[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;in&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inst:t})}}),a$=$("$ZodCheckMaxSize",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=n.value;o.size<=e.maximum||n.issues.push({origin:tp(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),c$=$("$ZodCheckMinSize",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:tp(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),u$=$("$ZodCheckSizeEquals",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let s=i>e.size;n.issues.push({origin:tp(o),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),l$=$("$ZodCheckMaxLength",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=n.value;if(o.length<=e.maximum)return;let s=rp(o);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),d$=$("$ZodCheckMinLength",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let s=rp(o);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),p$=$("$ZodCheckLengthEquals",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let s=rp(o),a=i>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Su=$("$ZodCheckStringFormat",(t,e)=>{var r,n;Je.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),f$=$("$ZodCheckRegex",(t,e)=>{Su.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),m$=$("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=r$),Su.init(t,e)}),h$=$("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=n$),Su.init(t,e)}),g$=$("$ZodCheckIncludes",(t,e)=>{Je.init(t,e);let r=bn(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),_$=$("$ZodCheckStartsWith",(t,e)=>{Je.init(t,e);let r=new RegExp(`^${bn(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),y$=$("$ZodCheckEndsWith",(t,e)=>{Je.init(t,e);let r=new RegExp(`.*${bn(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function dN(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues))}var v$=$("$ZodCheckProperty",(t,e)=>{Je.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>dN(o,r,e.property));dN(n,r,e.property)}}),b$=$("$ZodCheckMimeType",(t,e)=>{Je.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),w$=$("$ZodCheckOverwrite",(t,e)=>{Je.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var sp=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(` +`).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,o.join(` +`))}};var x$={major:4,minor:1,patch:13};var ye=$("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=x$;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(s,a,c)=>{let u=Xi(s),l;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(u)continue;let f=s.issues.length,p=d._zod.check(s);if(p instanceof Promise&&c?.async===!1)throw new Fn;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,s.issues.length!==f&&(u||(u=Xi(s,f)))});else{if(s.issues.length===f)continue;u||(u=Xi(s,f))}}return l?l.then(()=>s):s},i=(s,a,c)=>{if(Xi(s))return s.aborted=!0,s;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new Fn;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let u=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,s,a)):i(u,s,a)}let c=t._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Fn;return c.then(u=>o(u,n,a))}return o(c,n,a)}}t["~standard"]={validate:o=>{try{let i=ba(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Iu(t,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),Yi=$("$ZodString",(t,e)=>{ye.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??W0(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),He=$("$ZodStringFormat",(t,e)=>{Su.init(t,e),Yi.init(t,e)}),Pg=$("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=M0),He.init(t,e)}),Cg=$("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=wa(n))}else e.pattern??(e.pattern=wa());He.init(t,e)}),Rg=$("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=j0),He.init(t,e)}),Ng=$("$ZodURL",(t,e)=>{He.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),zg=$("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=D0()),He.init(t,e)}),Mg=$("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=N0),He.init(t,e)}),jg=$("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=A0),He.init(t,e)}),Dg=$("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=O0),He.init(t,e)}),Lg=$("$ZodULID",(t,e)=>{e.pattern??(e.pattern=P0),He.init(t,e)}),Ug=$("$ZodXID",(t,e)=>{e.pattern??(e.pattern=C0),He.init(t,e)}),Fg=$("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=R0),He.init(t,e)}),Bg=$("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=H0(e)),He.init(t,e)}),Zg=$("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=G0),He.init(t,e)}),qg=$("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=K0(e)),He.init(t,e)}),Vg=$("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=z0),He.init(t,e)}),Gg=$("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=L0),He.init(t,e),t._zod.bag.format="ipv4"}),Kg=$("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=U0),He.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Hg=$("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=F0(e.delimiter)),He.init(t,e),t._zod.bag.format="mac"}),Wg=$("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=B0),He.init(t,e)}),Jg=$("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Z0),He.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function I$(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Xg=$("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=q0),He.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{I$(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function IN(t){if(!$g.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return I$(r)}var Yg=$("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=$g),He.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{IN(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Qg=$("$ZodE164",(t,e)=>{e.pattern??(e.pattern=V0),He.init(t,e)});function SN(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var e_=$("$ZodJWT",(t,e)=>{He.init(t,e),t._zod.check=r=>{SN(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),t_=$("$ZodCustomStringFormat",(t,e)=>{He.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),ap=$("$ZodNumber",(t,e)=>{ye.init(t,e),t._zod.pattern=t._zod.bag.pattern??Y0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),r_=$("$ZodNumberFormat",(t,e)=>{i$.init(t,e),ap.init(t,e)}),ku=$("$ZodBoolean",(t,e)=>{ye.init(t,e),t._zod.pattern=Q0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),cp=$("$ZodBigInt",(t,e)=>{ye.init(t,e),t._zod.pattern=J0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),n_=$("$ZodBigIntFormat",(t,e)=>{s$.init(t,e),cp.init(t,e)}),o_=$("$ZodSymbol",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),i_=$("$ZodUndefined",(t,e)=>{ye.init(t,e),t._zod.pattern=t$,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),s_=$("$ZodNull",(t,e)=>{ye.init(t,e),t._zod.pattern=e$,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),a_=$("$ZodAny",(t,e)=>{ye.init(t,e),t._zod.parse=r=>r}),Tu=$("$ZodUnknown",(t,e)=>{ye.init(t,e),t._zod.parse=r=>r}),Eu=$("$ZodNever",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),c_=$("$ZodVoid",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),u_=$("$ZodDate",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});function mN(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues)),e.value[r]=t.value}var l_=$("$ZodArray",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let s=0;smN(u,r,s))):mN(c,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function Og(t,e,r,n){t.issues.length&&e.issues.push(...tn(r,t.issues)),t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function kN(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=k0(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function TN(t,e,r,n,o,i){let s=[],a=o.keySet,c=o.catchall._zod,u=c.def.type;for(let l in e){if(a.has(l))continue;if(u==="never"){s.push(l);continue}let d=c.run({value:e[l],issues:[]},n);d instanceof Promise?t.push(d.then(f=>Og(f,r,l,e))):Og(d,r,l,e)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var S$=$("$ZodObject",(t,e)=>{if(ye.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=gu(()=>kN(e));Me(t._zod,"propValues",()=>{let a=e.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=va,i=e.catchall,s;t._zod.parse=(a,c)=>{s??(s=n.value);let u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),a;a.value={};let l=[],d=s.shape;for(let f of s.keys){let m=d[f]._zod.run({value:u[f],issues:[]},c);m instanceof Promise?l.push(m.then(h=>Og(h,a,f,u))):Og(m,a,f,u)}return i?TN(l,u,a,c,n.value,t):l.length?Promise.all(l).then(()=>a):a}}),k$=$("$ZodObjectJIT",(t,e)=>{S$.init(t,e);let r=t._zod.parse,n=gu(()=>kN(e)),o=f=>{let p=new sp(["shape","payload","ctx"]),m=n.value,h=x=>{let k=dg(x);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};p.write("const input = payload.value;");let _=Object.create(null),v=0;for(let x of m.keys)_[x]=`key_${v++}`;p.write("const newResult = {};");for(let x of m.keys){let k=_[x],T=dg(x);p.write(`const ${k} = ${h(x)};`),p.write(` + if (${k}.issues.length) { + payload.issues = payload.issues.concat(${k}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${T}, ...iss.path] : [${T}] + }))); + } + + + if (${k}.value === undefined) { + if (${T} in input) { + newResult[${T}] = undefined; + } + } else { + newResult[${T}] = ${k}.value; + } + + `)}p.write("payload.value = newResult;"),p.write("return payload;");let b=p.compile();return(x,k)=>b(f,x,k)},i,s=va,a=!Wd.jitless,u=a&&$0.value,l=e.catchall,d;t._zod.parse=(f,p)=>{d??(d=n.value);let m=f.value;return s(m)?a&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(e.shape)),f=i(f,p),l?TN([],m,f,p,d,t):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function hN(t,e,r,n){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let o=t.filter(i=>!Xi(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(s=>rn(s,n,yt())))}),e)}var up=$("$ZodUnion",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Me(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Me(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),Me(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Qd(i.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1,a=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}return s?Promise.all(a).then(c=>hN(c,o,t,i)):hN(a,o,t,i)}}),d_=$("$ZodDiscriminatedUnion",(t,e)=>{up.init(t,e);let r=t._zod.parse;Me(t._zod,"propValues",()=>{let o={};for(let i of e.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=gu(()=>{let o=e.options,i=new Map;for(let s of o){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});t._zod.parse=(o,i)=>{let s=o.value;if(!va(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),o;let a=n.value.get(s?.[e.discriminator]);return a?a._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:s,path:[e.discriminator],inst:t}),o)}}),p_=$("$ZodIntersection",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),s=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>gN(r,c,u)):gN(r,i,s)}});function $$(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Ji(t)&&Ji(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let s=$$(t[i],e[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n{ye.init(t,e);let r=e.items;t._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let s=[],a=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=a===-1?0:r.length-a;if(!e.rest){let l=i.length>r.length,d=i.length=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?s.push(d.then(f=>kg(f,n,u))):kg(d,n,u)}if(e.rest){let l=i.slice(r.length);for(let d of l){u++;let f=e.rest._zod.run({value:d,issues:[]},o);f instanceof Promise?s.push(f.then(p=>kg(p,n,u))):kg(f,n,u)}}return s.length?Promise.all(s).then(()=>n):n}});function kg(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues)),e.value[r]=t.value}var f_=$("$ZodRecord",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Ji(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...tn(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...tn(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let c=e.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(l=>rn(l,n,yt())),input:a,path:[a],inst:t}),r.value[c.value]=c.value;continue}let u=e.valueType._zod.run({value:o[a],issues:[]},n);u instanceof Promise?i.push(u.then(l=>{l.issues.length&&r.issues.push(...tn(a,l.issues)),r.value[c.value]=l.value})):(u.issues.length&&r.issues.push(...tn(a,u.issues)),r.value[c.value]=u.value)}}return i.length?Promise.all(i).then(()=>r):r}}),m_=$("$ZodMap",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[s,a]of o){let c=e.keyType._zod.run({value:s,issues:[]},n),u=e.valueType._zod.run({value:a,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{_N(l,d,r,s,o,t,n)})):_N(c,u,r,s,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});function _N(t,e,r,n,o,i,s){t.issues.length&&(ep.has(typeof n)?r.issues.push(...tn(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(a=>rn(a,s,yt()))})),e.issues.length&&(ep.has(typeof n)?r.issues.push(...tn(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(a=>rn(a,s,yt()))})),r.value.set(t.value,e.value)}var h_=$("$ZodSet",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of o){let a=e.valueType._zod.run({value:s,issues:[]},n);a instanceof Promise?i.push(a.then(c=>yN(c,r))):yN(a,r)}return i.length?Promise.all(i).then(()=>r):r}});function yN(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var g_=$("$ZodEnum",(t,e)=>{ye.init(t,e);let r=Yd(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>ep.has(typeof o)).map(o=>typeof o=="string"?bn(o):o.toString()).join("|")})$`),t._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:t}),o}}),__=$("$ZodLiteral",(t,e)=>{if(ye.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?bn(n):n?bn(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),y_=$("$ZodFile",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),v_=$("$ZodTransform",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new Fn;return r.value=o,r}});function vN(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var xa=$("$ZodOptional",(t,e)=>{ye.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Me(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Me(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qd(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>vN(i,r.value)):vN(o,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),b_=$("$ZodNullable",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.innerType._zod.optin),Me(t._zod,"optout",()=>e.innerType._zod.optout),Me(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qd(r.source)}|null)$`):void 0}),Me(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),w_=$("$ZodDefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>bN(i,e)):bN(o,e)}});function bN(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var x_=$("$ZodPrefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),$_=$("$ZodNonOptional",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>wN(i,t)):wN(o,t)}});function wN(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var I_=$("$ZodSuccess",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi("ZodSuccess");let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),S_=$("$ZodCatch",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.innerType._zod.optin),Me(t._zod,"optout",()=>e.innerType._zod.optout),Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(s=>rn(s,n,yt()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>rn(i,n,yt()))},input:r.value}),r.issues=[]),r)}}),k_=$("$ZodNaN",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),T_=$("$ZodPipe",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>e.in._zod.values),Me(t._zod,"optin",()=>e.in._zod.optin),Me(t._zod,"optout",()=>e.out._zod.optout),Me(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Tg(s,e.in,n)):Tg(i,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Tg(i,e.out,n)):Tg(o,e.out,n)}});function Tg(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var Au=$("$ZodCodec",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>e.in._zod.values),Me(t._zod,"optin",()=>e.in._zod.optin),Me(t._zod,"optout",()=>e.out._zod.optout),Me(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(s=>Eg(s,e,n)):Eg(i,e,n)}else{let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Eg(s,e,n)):Eg(i,e,n)}}});function Eg(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(i=>Ag(t,i,e.out,r)):Ag(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(i=>Ag(t,i,e.in,r)):Ag(t,o,e.in,r)}}function Ag(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}var E_=$("$ZodReadonly",(t,e)=>{ye.init(t,e),Me(t._zod,"propValues",()=>e.innerType._zod.propValues),Me(t._zod,"values",()=>e.innerType._zod.values),Me(t._zod,"optin",()=>e.innerType?._zod?.optin),Me(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(xN):xN(o)}});function xN(t){return t.value=Object.freeze(t.value),t}var A_=$("$ZodTemplateLiteral",(t,e)=>{ye.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,s=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,s))}else if(n===null||S0.has(typeof n))r.push(bn(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"template_literal",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),O_=$("$ZodFunction",(t,e)=>(ye.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=t._def.input?Bn(t._def.input,n):n,i=Reflect.apply(r,this,o);return t._def.output?Bn(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=t._def.input?await Yo(t._def.input,n):n,i=await Reflect.apply(r,this,o);return t._def.output?await Yo(t._def.output,i):i}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new lp({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),P_=$("$ZodPromise",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),C_=$("$ZodLazy",(t,e)=>{ye.init(t,e),Me(t._zod,"innerType",()=>e.getter()),Me(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),Me(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),Me(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),Me(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),R_=$("$ZodCustom",(t,e)=>{Je.init(t,e),ye.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>$N(i,r,n,t));$N(o,r,n,t)}});function $N(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(_u(o))}}var Ou={};gi(Ou,{ar:()=>EN,az:()=>AN,be:()=>PN,bg:()=>CN,ca:()=>RN,cs:()=>NN,da:()=>zN,de:()=>MN,en:()=>N_,eo:()=>jN,es:()=>DN,fa:()=>LN,fi:()=>UN,fr:()=>FN,frCA:()=>BN,he:()=>ZN,hu:()=>qN,id:()=>VN,is:()=>GN,it:()=>KN,ja:()=>HN,ka:()=>WN,kh:()=>JN,km:()=>z_,ko:()=>XN,lt:()=>QN,mk:()=>ez,ms:()=>tz,nl:()=>rz,no:()=>nz,ota:()=>oz,pl:()=>sz,ps:()=>iz,pt:()=>az,ru:()=>uz,sl:()=>lz,sv:()=>dz,ta:()=>pz,th:()=>fz,tr:()=>mz,ua:()=>hz,uk:()=>M_,ur:()=>gz,vi:()=>_z,yo:()=>bz,zhCN:()=>yz,zhTW:()=>vz});var x3=()=>{let t={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return o=>{switch(o.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${j(o.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${o.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${n[i.format]??o.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${o.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${o.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${o.keys.length>1?"\u0629":""}: ${E(o.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function EN(){return{localeError:x3()}}var $3=()=>{let t={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o.expected}, daxil olan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${j(o.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${n[i.format]??o.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${o.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${o.keys.length>1?"lar":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${o.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function AN(){return{localeError:$3()}}function ON(t,e,r,n){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?n:i===1?e:i>=2&&i<=4?r:n}var I3=()=>{let t={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0456\u045E";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${j(o.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),c=ON(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${o.maximum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),c=ON(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${o.minimum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${o.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${o.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function PN(){return{localeError:I3()}}var S3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(t))return"\u043C\u0430\u0441\u0438\u0432";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},k3=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function e(n){return t[n]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"};return n=>{switch(n.code){case"invalid_type":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${S3(n.input)}`;case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${j(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.maximum.toString()} ${i.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.minimum.toString()} ${i.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;if(o.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${o.prefix}"`;if(o.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${o.suffix}"`;if(o.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${o.includes}"`;if(o.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${o.pattern}`;let i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return o.format==="emoji"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="datetime"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="date"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),o.format==="time"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="duration"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${i} ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${E(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function CN(){return{localeError:k3()}}var T3=()=>{let t={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${o.expected}, s'ha rebut ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Valor inv\xE0lid: s'esperava ${j(o.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${E(o.values," o ")}`;case"too_big":{let i=o.inclusive?"com a m\xE0xim":"menys de",s=e(o.origin);return s?`Massa gran: s'esperava que ${o.origin??"el valor"} contingu\xE9s ${i} ${o.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${o.origin??"el valor"} fos ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"com a m\xEDnim":"m\xE9s de",s=e(o.origin);return s?`Massa petit: s'esperava que ${o.origin} contingu\xE9s ${i} ${o.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${o.origin} fos ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${n[i.format]??o.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${o.divisor}`;case"unrecognized_keys":return`Clau${o.keys.length>1?"s":""} no reconeguda${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${o.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${o.origin}`;default:return"Entrada inv\xE0lida"}}};function RN(){return{localeError:T3()}}var E3=()=>{let t={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(o))return"pole";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return o=>{switch(o.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o.expected}, obdr\u017Eeno ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${j(o.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${n[i.format]??o.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${o.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${E(o.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${o.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${o.origin}`;default:return"Neplatn\xFD vstup"}}};function NN(){return{localeError:E3()}}var A3=()=>{let t={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},e={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};function r(s){return t[s]??null}function n(s){return e[s]??s}let o=s=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"tal";case"object":return Array.isArray(s)?"liste":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype&&s.constructor?s.constructor.name:"objekt"}return a},i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return s=>{switch(s.code){case"invalid_type":return`Ugyldigt input: forventede ${n(s.expected)}, fik ${n(o(s.input))}`;case"invalid_value":return s.values.length===1?`Ugyldig v\xE6rdi: forventede ${j(s.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${E(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=r(s.origin),u=n(s.origin);return c?`For stor: forventede ${u??"value"} ${c.verb} ${a} ${s.maximum.toString()} ${c.unit??"elementer"}`:`For stor: forventede ${u??"value"} havde ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=r(s.origin),u=n(s.origin);return c?`For lille: forventede ${u} ${c.verb} ${a} ${s.minimum.toString()} ${c.unit}`:`For lille: forventede ${u} havde ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Ugyldig streng: skal starte med "${a.prefix}"`:a.format==="ends_with"?`Ugyldig streng: skal ende med "${a.suffix}"`:a.format==="includes"?`Ugyldig streng: skal indeholde "${a.includes}"`:a.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${a.pattern}`:`Ugyldig ${i[a.format]??s.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${s.divisor}`;case"unrecognized_keys":return`${s.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${E(s.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${s.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${s.origin}`;default:return"Ugyldigt input"}}};function zN(){return{localeError:A3()}}var O3=()=>{let t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"Zahl";case"object":{if(Array.isArray(o))return"Array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return o=>{switch(o.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${o.expected}, erhalten ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ung\xFCltige Eingabe: erwartet ${j(o.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ist`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ist`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${o.divisor} sein`;case"unrecognized_keys":return`${o.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${o.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${o.origin}`;default:return"Ung\xFCltige Eingabe"}}};function MN(){return{localeError:O3()}}var P3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},C3=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${P3(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${j(n.values[0])}`:`Invalid option: expected one of ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function N_(){return{localeError:C3()}}var R3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"nombro";case"object":{if(Array.isArray(t))return"tabelo";if(t===null)return"senvalora";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},N3=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(n){return t[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return n=>{switch(n.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${n.expected}, ricevi\u011Dis ${R3(n.input)}`;case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${j(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()} ${i.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${o}${n.minimum.toString()} ${i.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${r[o.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function jN(){return{localeError:N3()}}var z3=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},e={string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};function r(s){return t[s]??null}function n(s){return e[s]??s}let o=s=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"number";case"object":return Array.isArray(s)?"array":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype?s.constructor.name:"object"}return a},i={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return s=>{switch(s.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${n(s.expected)}, recibido ${n(o(s.input))}`;case"invalid_value":return s.values.length===1?`Entrada inv\xE1lida: se esperaba ${j(s.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${E(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=r(s.origin),u=n(s.origin);return c?`Demasiado grande: se esperaba que ${u??"valor"} tuviera ${a}${s.maximum.toString()} ${c.unit??"elementos"}`:`Demasiado grande: se esperaba que ${u??"valor"} fuera ${a}${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=r(s.origin),u=n(s.origin);return c?`Demasiado peque\xF1o: se esperaba que ${u} tuviera ${a}${s.minimum.toString()} ${c.unit}`:`Demasiado peque\xF1o: se esperaba que ${u} fuera ${a}${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${a.prefix}"`:a.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${a.suffix}"`:a.format==="includes"?`Cadena inv\xE1lida: debe incluir "${a.includes}"`:a.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${a.pattern}`:`Inv\xE1lido ${i[a.format]??s.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${s.divisor}`;case"unrecognized_keys":return`Llave${s.keys.length>1?"s":""} desconocida${s.keys.length>1?"s":""}: ${E(s.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${n(s.origin)}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${n(s.origin)}`;default:return"Entrada inv\xE1lida"}}};function DN(){return{localeError:z3()}}var M3=()=>{let t={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0622\u0631\u0627\u06CC\u0647";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return o=>{switch(o.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${r(o.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":return o.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${j(o.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${E(o.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${n[i.format]??o.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${o.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${o.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${E(o.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${o.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${o.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function LN(){return{localeError:M3()}}var j3=()=>{let t={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return o=>{switch(o.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${o.expected}, oli ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${j(o.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${i}${o.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${i}${o.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${n[i.format]??o.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${o.divisor} monikerta`;case"unrecognized_keys":return`${o.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${E(o.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function UN(){return{localeError:j3()}}var D3=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombre";case"object":{if(Array.isArray(o))return"tableau";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : ${o.expected} attendu, ${r(o.input)} re\xE7u`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : ${j(o.values[0])} attendu`:`Option invalide : une valeur parmi ${E(o.values,"|")} attendue`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Trop grand : ${o.origin??"valeur"} doit ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o.origin??"valeur"} doit \xEAtre ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Trop petit : ${o.origin} doit ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Trop petit : ${o.origin} doit \xEAtre ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${E(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function FN(){return{localeError:D3()}}var L3=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${o.expected}, re\xE7u ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : attendu ${j(o.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u2264":"<",s=e(o.origin);return s?`Trop grand : attendu que ${o.origin??"la valeur"} ait ${i}${o.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${o.origin??"la valeur"} soit ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u2265":">",s=e(o.origin);return s?`Trop petit : attendu que ${o.origin} ait ${i}${o.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${o.origin} soit ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${E(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function BN(){return{localeError:L3()}}var U3=()=>{let t={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},e={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=u=>u?t[u]:void 0,n=u=>{let l=r(u);return l?l.label:u??t.unknown.label},o=u=>`\u05D4${n(u)}`,i=u=>(r(u)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",s=u=>u?e[u]??null:null,a=u=>{let l=typeof u;switch(l){case"number":return Number.isNaN(u)?"NaN":"number";case"object":return Array.isArray(u)?"array":u===null?"null":Object.getPrototypeOf(u)!==Object.prototype&&u.constructor?u.constructor.name:"object";default:return l}},c={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}};return u=>{switch(u.code){case"invalid_type":{let l=u.expected,d=n(l),f=a(u.input),p=t[f]?.label??f;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`}case"invalid_value":{if(u.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${j(u.values[0])}`;let l=u.values.map(p=>j(p));if(u.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l[0]} \u05D0\u05D5 ${l[1]}`;let d=l[l.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let l=s(u.origin),d=o(u.origin??"value");if(u.origin==="string")return`${l?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${u.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=u.inclusive?`${u.maximum} ${l?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${l?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?"<=":"<",p=i(u.origin??"value");return l?.unit?`${l.longLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()} ${l.unit}`:`${l?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()}`}case"too_small":{let l=s(u.origin),d=o(u.origin??"value");if(u.origin==="string")return`${l?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${u.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let _=(u.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${_}`}let h=u.inclusive?`${u.minimum} ${l?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${l?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?">=":">",p=i(u.origin??"value");return l?.unit?`${l.shortLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()} ${l.unit}`:`${l?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()}`}case"invalid_format":{let l=u;if(l.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${l.prefix}"`;if(l.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${l.suffix}"`;if(l.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${l.includes}"`;if(l.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${l.pattern}`;let d=c[l.format],f=d?.label??l.format,m=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${f} \u05DC\u05D0 ${m}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${u.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${u.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${u.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${E(u.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${o(u.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function ZN(){return{localeError:U3()}}var F3=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(o))return"t\xF6mb";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return o=>{switch(o.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o.expected}, a kapott \xE9rt\xE9k ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${j(o.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`T\xFAl nagy: ${o.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${o.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${o.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} m\xE9rete t\xFAl kicsi ${i}${o.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} t\xFAl kicsi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${n[i.format]??o.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${o.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${o.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${o.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function qN(){return{localeError:F3()}}var B3=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak valid: diharapkan ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak valid: diharapkan ${j(o.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: diharapkan ${o.origin??"value"} memiliki ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${o.origin??"value"} menjadi ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: diharapkan ${o.origin} memiliki ${i}${o.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${o.origin} menjadi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${n[i.format]??o.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${o.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${o.origin}`;default:return"Input tidak valid"}}};function VN(){return{localeError:B3()}}var Z3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"n\xFAmer";case"object":{if(Array.isArray(t))return"fylki";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},q3=()=>{let t={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function e(n){return t[n]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"};return n=>{switch(n.code){case"invalid_type":return`Rangt gildi: \xDE\xFA sl\xF3st inn ${Z3(n.input)} \xFEar sem \xE1 a\xF0 vera ${n.expected}`;case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${j(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${o}${n.maximum.toString()} ${i.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${o}${n.minimum.toString()} ${i.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${o.prefix}"`:o.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${o.suffix}"`:o.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${o.includes}"`:o.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${o.pattern}`:`Rangt ${r[o.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${E(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}};function GN(){return{localeError:q3()}}var V3=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numero";case"object":{if(Array.isArray(o))return"vettore";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input non valido: atteso ${o.expected}, ricevuto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input non valido: atteso ${j(o.values[0])}`:`Opzione non valida: atteso uno tra ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Troppo grande: ${o.origin??"valore"} deve avere ${i}${o.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${o.origin??"valore"} deve essere ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Troppo piccolo: ${o.origin} deve avere ${i}${o.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${o.origin} deve essere ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${o.divisor}`;case"unrecognized_keys":return`Chiav${o.keys.length>1?"i":"e"} non riconosciut${o.keys.length>1?"e":"a"}: ${E(o.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${o.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${o.origin}`;default:return"Input non valido"}}};function KN(){return{localeError:V3()}}var G3=()=>{let t={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(o))return"\u914D\u5217";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${o.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${r(o.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":return o.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${j(o.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${E(o.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=o.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=e(o.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${s.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=o.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=e(o.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${s.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${o.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${o.keys.length>1?"\u7FA4":""}: ${E(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function HN(){return{localeError:G3()}}var K3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8";case"object":{if(Array.isArray(t))return"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return{string:"\u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0"}[e]??e},H3=()=>{let t={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function e(n){return t[n]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",json_string:"JSON \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"};return n=>{switch(n.code){case"invalid_type":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${K3(n.input)}`;case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${j(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${E(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${i.verb} ${o}${n.maximum.toString()} ${i.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${i.verb} ${o}${n.minimum.toString()} ${i.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.prefix}"-\u10D8\u10D7`:o.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.suffix}"-\u10D8\u10D7`:o.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${o.includes}"-\u10E1`:o.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${o.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${E(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function WN(){return{localeError:H3()}}var W3=()=>{let t={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(o))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(o===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return o=>{switch(o.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${j(o.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${o.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${E(o.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function z_(){return{localeError:W3()}}function JN(){return z_()}var J3=()=>{let t={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return o=>{switch(o.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${r(o.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":return o.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${j(o.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${E(o.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=o.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),c=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()}${c} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()} ${i}${s}`}case"too_small":{let i=o.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),c=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()}${c} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${n[i.format]??o.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${o.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${E(o.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${o.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${o.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function XN(){return{localeError:J3()}}var X3=t=>pp(typeof t,t),pp=(t,e=void 0)=>{switch(t){case"number":return Number.isNaN(e)?"NaN":"skai\u010Dius";case"bigint":return"sveikasis skai\u010Dius";case"string":return"eilut\u0117";case"boolean":return"login\u0117 reik\u0161m\u0117";case"undefined":case"void":return"neapibr\u0117\u017Eta reik\u0161m\u0117";case"function":return"funkcija";case"symbol":return"simbolis";case"object":return e===void 0?"ne\u017Einomas objektas":e===null?"nulin\u0117 reik\u0161m\u0117":Array.isArray(e)?"masyvas":Object.getPrototypeOf(e)!==Object.prototype&&e.constructor?e.constructor.name:"objektas";case"null":return"nulin\u0117 reik\u0161m\u0117"}return t},dp=t=>t.charAt(0).toUpperCase()+t.slice(1);function YN(t){let e=Math.abs(t),r=e%10,n=e%100;return n>=11&&n<=19||r===0?"many":r===1?"one":"few"}var Y3=()=>{let t={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function e(n,o,i,s){let a=t[n]??null;return a===null?a:{unit:a.unit[o],verb:a.verb[s][i?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"};return n=>{switch(n.code){case"invalid_type":return`Gautas tipas ${X3(n.input)}, o tik\u0117tasi - ${pp(n.expected)}`;case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${j(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${E(n.values,"|")} pasirinkim\u0173`;case"too_big":{let o=pp(n.origin),i=e(n.origin,YN(Number(n.maximum)),n.inclusive??!1,"smaller");if(i?.verb)return`${dp(o??n.origin??"reik\u0161m\u0117")} ${i.verb} ${n.maximum.toString()} ${i.unit??"element\u0173"}`;let s=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${dp(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.maximum.toString()} ${i?.unit}`}case"too_small":{let o=pp(n.origin),i=e(n.origin,YN(Number(n.minimum)),n.inclusive??!1,"bigger");if(i?.verb)return`${dp(o??n.origin??"reik\u0161m\u0117")} ${i.verb} ${n.minimum.toString()} ${i.unit??"element\u0173"}`;let s=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${dp(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.minimum.toString()} ${i?.unit}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${o.prefix}"`:o.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${o.includes}"`:o.format==="regex"?`Eilut\u0117 privalo atitikti ${o.pattern}`:`Neteisingas ${r[o.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${E(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let o=pp(n.origin);return`${dp(o??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function QN(){return{localeError:Y3()}}var Q3=()=>{let t={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(o))return"\u043D\u0438\u0437\u0430";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return o=>{switch(o.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${j(o.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${o.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${o.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function ez(){return{localeError:Q3()}}var e5=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombor";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak sah: dijangka ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak sah: dijangka ${j(o.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: dijangka ${o.origin??"nilai"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${o.origin??"nilai"} adalah ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: dijangka ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${o.origin} adalah ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${n[i.format]??o.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${E(o.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${o.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${o.origin}`;default:return"Input tidak sah"}}};function tz(){return{localeError:e5()}}var t5=()=>{let t={string:{unit:"tekens",verb:"te hebben"},file:{unit:"bytes",verb:"te hebben"},array:{unit:"elementen",verb:"te hebben"},set:{unit:"elementen",verb:"te hebben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"getal";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return o=>{switch(o.code){case"invalid_type":return`Ongeldige invoer: verwacht ${o.expected}, ontving ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ongeldige invoer: verwacht ${j(o.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Te groot: verwacht dat ${o.origin??"waarde"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"elementen"}`:`Te groot: verwacht dat ${o.origin??"waarde"} ${i}${o.maximum.toString()} is`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Te klein: verwacht dat ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Te klein: verwacht dat ${o.origin} ${i}${o.minimum.toString()} is`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${o.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${o.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${o.origin}`;default:return"Ongeldige invoer"}}};function rz(){return{localeError:t5()}}var r5=()=>{let t={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"tall";case"object":{if(Array.isArray(o))return"liste";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Ugyldig input: forventet ${o.expected}, fikk ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ugyldig verdi: forventet ${j(o.values[0])}`:`Ugyldig valg: forventet en av ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${n[i.format]??o.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${o.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${o.origin}`;default:return"Ugyldig input"}}};function nz(){return{localeError:r5()}}var n5=()=>{let t={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numara";case"object":{if(Array.isArray(o))return"saf";if(o===null)return"gayb";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return o=>{switch(o.code){case"invalid_type":return`F\xE2sit giren: umulan ${o.expected}, al\u0131nan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`F\xE2sit giren: umulan ${j(o.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=o;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${n[i.format]??o.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${o.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${o.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function oz(){return{localeError:n5()}}var o5=()=>{let t={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0627\u0631\u06D0";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return o=>{switch(o.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${r(o.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":return o.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${j(o.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${E(o.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0648\u064A`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${n[i.format]??o.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${o.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${o.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${o.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${o.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function iz(){return{localeError:o5()}}var i5=()=>{let t={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"liczba";case"object":{if(Array.isArray(o))return"tablica";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return o=>{switch(o.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o.expected}, otrzymano ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${j(o.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${n[i.format]??o.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${o.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${o.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${o.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function sz(){return{localeError:i5()}}var s5=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(o))return"array";if(o===null)return"nulo";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${o.expected}, recebido ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: esperado ${j(o.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Muito grande: esperado que ${o.origin??"valor"} tivesse ${i}${o.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${o.origin??"valor"} fosse ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Muito pequeno: esperado que ${o.origin} tivesse ${i}${o.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${o.origin} fosse ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`:i.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inv\xE1lido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`:`${n[i.format]??o.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${o.divisor}`;case"unrecognized_keys":return`Chave${o.keys.length>1?"s":""} desconhecida${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${o.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${o.origin}`;default:return"Campo inv\xE1lido"}}};function az(){return{localeError:s5()}}function cz(t,e,r,n){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?n:i===1?e:i>=2&&i<=4?r:n}var a5=()=>{let t={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${j(o.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),c=cz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.maximum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),c=cz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.minimum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${o.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0438":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${o.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function uz(){return{localeError:a5()}}var c5=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(o))return"tabela";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return o=>{switch(o.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${o.expected}, prejeto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${j(o.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} imelo ${i}${o.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${o.origin} imelo ${i}${o.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${n[i.format]??o.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${o.divisor}`;case"unrecognized_keys":return`Neprepoznan${o.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${E(o.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${o.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${o.origin}`;default:return"Neveljaven vnos"}}};function lz(){return{localeError:c5()}}var u5=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"antal";case"object":{if(Array.isArray(o))return"lista";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return o=>{switch(o.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${o.expected}, fick ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${j(o.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${n[i.format]??o.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${o.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${o.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function dz(){return{localeError:u5()}}var l5=()=>{let t={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(o))return"\u0B85\u0BA3\u0BBF";if(o===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${j(o.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${E(o.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${o.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${o.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function pz(){return{localeError:l5()}}var d5=()=>{let t={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(o))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(o===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return o=>{switch(o.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${j(o.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=e(o.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=e(o.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${o.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${E(o.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function fz(){return{localeError:d5()}}var p5=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},f5=()=>{let t={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(n){return t[n]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return n=>{switch(n.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${n.expected}, al\u0131nan ${p5(n.input)}`;case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${j(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()} ${i.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()} ${i.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[o.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function mz(){return{localeError:f5()}}var m5=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${j(o.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} \u0431\u0443\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0456":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${o.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function M_(){return{localeError:m5()}}function hz(){return M_()}var h5=()=>{let t={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(o))return"\u0622\u0631\u06D2";if(o===null)return"\u0646\u0644";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return o=>{switch(o.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${r(o.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":return o.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${j(o.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${E(o.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${o.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u06D2 ${i}${o.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u0627 ${i}${o.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${o.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${o.keys.length>1?"\u0632":""}: ${E(o.keys,"\u060C ")}`;case"invalid_key":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function gz(){return{localeError:h5()}}var g5=()=>{let t={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(o))return"m\u1EA3ng";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return o=>{switch(o.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${j(o.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${n[i.format]??o.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${o.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${E(o.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function _z(){return{localeError:g5()}}var _5=()=>{let t={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(o))return"\u6570\u7EC4";if(o===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${j(o.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${n[i.format]??o.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${o.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${o.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function yz(){return{localeError:_5()}}var y5=()=>{let t={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o.expected}\uFF0C\u4F46\u6536\u5230 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${j(o.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${o.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${o.keys.length>1?"\u5011":""}\uFF1A${E(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function vz(){return{localeError:y5()}}var v5=()=>{let t={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\u1ECD\u0301mb\xE0";case"object":{if(Array.isArray(o))return"akop\u1ECD";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"};return o=>{switch(o.code){case"invalid_type":return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${o.expected}, \xE0m\u1ECD\u0300 a r\xED ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${j(o.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin??"iye"} ${s.verb} ${i}${o.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${o.maximum}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin} ${s.verb} ${i}${o.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${o.minimum}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`:i.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`:i.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`:i.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`:`A\u1E63\xEC\u1E63e: ${n[i.format]??o.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${o.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${E(o.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function bz(){return{localeError:v5()}}var wz,j_=Symbol("ZodOutput"),D_=Symbol("ZodInput"),Pu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function fp(){return new Pu}(wz=globalThis).__zod_globalRegistry??(wz.__zod_globalRegistry=fp());var Ge=globalThis.__zod_globalRegistry;function L_(t,e){return new t({type:"string",...D(e)})}function U_(t,e){return new t({type:"string",coerce:!0,...D(e)})}function mp(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...D(e)})}function Cu(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...D(e)})}function hp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...D(e)})}function gp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(e)})}function _p(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(e)})}function yp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(e)})}function Ru(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...D(e)})}function vp(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...D(e)})}function bp(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(e)})}function wp(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...D(e)})}function xp(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(e)})}function $p(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...D(e)})}function Ip(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...D(e)})}function Sp(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(e)})}function kp(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(e)})}function Tp(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(e)})}function F_(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...D(e)})}function Ep(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(e)})}function Ap(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(e)})}function Op(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...D(e)})}function Pp(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...D(e)})}function Cp(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...D(e)})}function Rp(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...D(e)})}var B_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Z_(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(e)})}function q_(t,e){return new t({type:"string",format:"date",check:"string_format",...D(e)})}function V_(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...D(e)})}function G_(t,e){return new t({type:"string",format:"duration",check:"string_format",...D(e)})}function K_(t,e){return new t({type:"number",checks:[],...D(e)})}function H_(t,e){return new t({type:"number",coerce:!0,checks:[],...D(e)})}function W_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...D(e)})}function J_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...D(e)})}function X_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...D(e)})}function Y_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...D(e)})}function Q_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...D(e)})}function ey(t,e){return new t({type:"boolean",...D(e)})}function ty(t,e){return new t({type:"boolean",coerce:!0,...D(e)})}function ry(t,e){return new t({type:"bigint",...D(e)})}function ny(t,e){return new t({type:"bigint",coerce:!0,...D(e)})}function oy(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...D(e)})}function iy(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...D(e)})}function sy(t,e){return new t({type:"symbol",...D(e)})}function ay(t,e){return new t({type:"undefined",...D(e)})}function cy(t,e){return new t({type:"null",...D(e)})}function uy(t){return new t({type:"any"})}function Nu(t){return new t({type:"unknown"})}function zu(t,e){return new t({type:"never",...D(e)})}function ly(t,e){return new t({type:"void",...D(e)})}function dy(t,e){return new t({type:"date",...D(e)})}function py(t,e){return new t({type:"date",coerce:!0,...D(e)})}function fy(t,e){return new t({type:"nan",...D(e)})}function _o(t,e){return new Ig({check:"less_than",...D(e),value:t,inclusive:!1})}function zr(t,e){return new Ig({check:"less_than",...D(e),value:t,inclusive:!0})}function yo(t,e){return new Sg({check:"greater_than",...D(e),value:t,inclusive:!1})}function ir(t,e){return new Sg({check:"greater_than",...D(e),value:t,inclusive:!0})}function my(t){return yo(0,t)}function hy(t){return _o(0,t)}function gy(t){return zr(0,t)}function _y(t){return ir(0,t)}function Qi(t,e){return new o$({check:"multiple_of",...D(e),value:t})}function $a(t,e){return new a$({check:"max_size",...D(e),maximum:t})}function es(t,e){return new c$({check:"min_size",...D(e),minimum:t})}function Mu(t,e){return new u$({check:"size_equals",...D(e),size:t})}function Ia(t,e){return new l$({check:"max_length",...D(e),maximum:t})}function Qo(t,e){return new d$({check:"min_length",...D(e),minimum:t})}function Sa(t,e){return new p$({check:"length_equals",...D(e),length:t})}function ju(t,e){return new f$({check:"string_format",format:"regex",...D(e),pattern:t})}function Du(t){return new m$({check:"string_format",format:"lowercase",...D(t)})}function Lu(t){return new h$({check:"string_format",format:"uppercase",...D(t)})}function Uu(t,e){return new g$({check:"string_format",format:"includes",...D(e),includes:t})}function Fu(t,e){return new _$({check:"string_format",format:"starts_with",...D(e),prefix:t})}function Bu(t,e){return new y$({check:"string_format",format:"ends_with",...D(e),suffix:t})}function yy(t,e,r){return new v$({check:"property",property:t,schema:e,...D(r)})}function Zu(t,e){return new b$({check:"mime_type",mime:t,...D(e)})}function Zn(t){return new w$({check:"overwrite",tx:t})}function qu(t){return Zn(e=>e.normalize(t))}function Vu(){return Zn(t=>t.trim())}function Gu(){return Zn(t=>t.toLowerCase())}function Ku(){return Zn(t=>t.toUpperCase())}function Np(){return Zn(t=>x0(t))}function T$(t,e,r){return new t({type:"array",element:e,...D(r)})}function w5(t,e,r){return new t({type:"union",options:e,...D(r)})}function x5(t,e,r,n){return new t({type:"union",options:r,discriminator:e,...D(n)})}function $5(t,e,r){return new t({type:"intersection",left:e,right:r})}function I5(t,e,r,n){let o=r instanceof ye,i=o?n:r,s=o?r:null;return new t({type:"tuple",items:e,rest:s,...D(i)})}function S5(t,e,r,n){return new t({type:"record",keyType:e,valueType:r,...D(n)})}function k5(t,e,r,n){return new t({type:"map",keyType:e,valueType:r,...D(n)})}function T5(t,e,r){return new t({type:"set",valueType:e,...D(r)})}function E5(t,e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new t({type:"enum",entries:n,...D(r)})}function A5(t,e,r){return new t({type:"enum",entries:e,...D(r)})}function O5(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...D(r)})}function vy(t,e){return new t({type:"file",...D(e)})}function P5(t,e){return new t({type:"transform",transform:e})}function C5(t,e){return new t({type:"optional",innerType:e})}function R5(t,e){return new t({type:"nullable",innerType:e})}function N5(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():I0(r)}})}function z5(t,e,r){return new t({type:"nonoptional",innerType:e,...D(r)})}function M5(t,e){return new t({type:"success",innerType:e})}function j5(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function D5(t,e,r){return new t({type:"pipe",in:e,out:r})}function L5(t,e){return new t({type:"readonly",innerType:e})}function U5(t,e,r){return new t({type:"template_literal",parts:e,...D(r)})}function F5(t,e){return new t({type:"lazy",getter:e})}function B5(t,e){return new t({type:"promise",innerType:e})}function by(t,e,r){let n=D(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function wy(t,e,r){return new t({type:"custom",check:"custom",fn:e,...D(r)})}function xy(t){let e=xz(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(_u(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(_u(o))}},t(r.value,r)));return e}function xz(t,e){let r=new Je({check:"custom",...D(e)});return r._zod.check=t,r}function $y(t){let e=new Je({check:"describe"});return e._zod.onattach=[r=>{let n=Ge.get(r)??{};Ge.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function Iy(t){let e=new Je({check:"meta"});return e._zod.onattach=[r=>{let n=Ge.get(r)??{};Ge.add(r,{...n,...t})}],e._zod.check=()=>{},e}function Sy(t,e){let r=D(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(n),s=new Set(o),a=t.Codec??Au,c=t.Boolean??ku,u=t.String??Yi,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new a({type:"pipe",in:l,out:d,transform:((p,m)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:s.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((p,m)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return f}function ka(t,e,r,n={}){let o=D(n),i={...D(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:a=>r.test(a),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}var zp=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Ge,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},f=e._zod.parent;if(f)a.ref=f,this.process(f,d),this.seen.get(f).isParent=!0;else{let p=a.schema;switch(o.type){case"string":{let m=p;m.type="string";let{minimum:h,maximum:_,format:v,patterns:b,contentEncoding:x}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof _=="number"&&(m.maxLength=_),v&&(m.format=i[v]??v,m.format===""&&delete m.format),x&&(m.contentEncoding=x),b&&b.size>0){let k=[...b];k.length===1?m.pattern=k[0].source:k.length>1&&(a.schema.allOf=[...k.map(T=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:T.source}))])}break}case"number":{let m=p,{minimum:h,maximum:_,format:v,multipleOf:b,exclusiveMaximum:x,exclusiveMinimum:k}=e._zod.bag;typeof v=="string"&&v.includes("int")?m.type="integer":m.type="number",typeof k=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.minimum=k,m.exclusiveMinimum=!0):m.exclusiveMinimum=k),typeof h=="number"&&(m.minimum=h,typeof k=="number"&&this.target!=="draft-4"&&(k>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof x=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.maximum=x,m.exclusiveMaximum=!0):m.exclusiveMaximum=x),typeof _=="number"&&(m.maximum=_,typeof x=="number"&&this.target!=="draft-4"&&(x<=_?delete m.maximum:delete m.exclusiveMaximum)),typeof b=="number"&&(m.multipleOf=b);break}case"boolean":{let m=p;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{this.target==="openapi-3.0"?(p.type="string",p.nullable=!0,p.enum=[null]):p.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{p.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let m=p,{minimum:h,maximum:_}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof _=="number"&&(m.maxItems=_),m.type="array",m.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let m=p;m.type="object",m.properties={};let h=o.shape;for(let b in h)m.properties[b]=this.process(h[b],{...d,path:[...d.path,"properties",b]});let _=new Set(Object.keys(h)),v=new Set([..._].filter(b=>{let x=o.shape[b]._zod;return this.io==="input"?x.optin===void 0:x.optout===void 0}));v.size>0&&(m.required=Array.from(v)),o.catchall?._zod.def.type==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{let m=p,h=o.discriminator!==void 0,_=o.options.map((v,b)=>this.process(v,{...d,path:[...d.path,h?"oneOf":"anyOf",b]}));h?m.oneOf=_:m.anyOf=_;break}case"intersection":{let m=p,h=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),_=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),v=x=>"allOf"in x&&Object.keys(x).length===1,b=[...v(h)?h.allOf:[h],...v(_)?_.allOf:[_]];m.allOf=b;break}case"tuple":{let m=p;m.type="array";let h=this.target==="draft-2020-12"?"prefixItems":"items",_=this.target==="draft-2020-12"||this.target==="openapi-3.0"?"items":"additionalItems",v=o.items.map((T,F)=>this.process(T,{...d,path:[...d.path,h,F]})),b=o.rest?this.process(o.rest,{...d,path:[...d.path,_,...this.target==="openapi-3.0"?[o.items.length]:[]]}):null;this.target==="draft-2020-12"?(m.prefixItems=v,b&&(m.items=b)):this.target==="openapi-3.0"?(m.items={anyOf:v},b&&m.items.anyOf.push(b),m.minItems=v.length,b||(m.maxItems=v.length)):(m.items=v,b&&(m.additionalItems=b));let{minimum:x,maximum:k}=e._zod.bag;typeof x=="number"&&(m.minItems=x),typeof k=="number"&&(m.maxItems=k);break}case"record":{let m=p;m.type="object",(this.target==="draft-7"||this.target==="draft-2020-12")&&(m.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]})),m.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=p,h=Yd(o.entries);h.every(_=>typeof _=="number")&&(m.type="number"),h.every(_=>typeof _=="string")&&(m.type="string"),m.enum=h;break}case"literal":{let m=p,h=[];for(let _ of o.values)if(_===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof _=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(_))}else h.push(_);if(h.length!==0)if(h.length===1){let _=h[0];m.type=_===null?"null":typeof _,this.target==="draft-4"||this.target==="openapi-3.0"?m.enum=[_]:m.const=_}else h.every(_=>typeof _=="number")&&(m.type="number"),h.every(_=>typeof _=="string")&&(m.type="string"),h.every(_=>typeof _=="boolean")&&(m.type="string"),h.every(_=>_===null)&&(m.type="null"),m.enum=h;break}case"file":{let m=p,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:_,maximum:v,mime:b}=e._zod.bag;_!==void 0&&(h.minLength=_),v!==void 0&&(h.maxLength=v),b?b.length===1?(h.contentMediaType=b[0],Object.assign(m,h)):m.anyOf=b.map(x=>({...h,contentMediaType:x})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,d);this.target==="openapi-3.0"?(a.ref=o.innerType,p.nullable=!0):p.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"success":{let m=p;m.type="boolean";break}case"default":{this.process(o.innerType,d),a.ref=o.innerType,p.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),a.ref=o.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),a.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}p.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=p,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,d),a.ref=m;break}case"readonly":{this.process(o.innerType,d),a.ref=o.innerType,p.readOnly=!0;break}case"promise":{this.process(o.innerType,d),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,d),a.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&xr(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let h=n.external.registry.get(l[0])?.id,_=n.external.uri??(b=>b);if(h)return{ref:_(h)};let v=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=v,{defId:v,ref:`${_("__shared")}#/${d}/${v}`}}if(l[1]===o)return{ref:"#"};let p=`#/${d}/`,m=l[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:p+m}},s=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:f,defId:p}=i(l);d.def={...d.schema},p&&(d.defId=p);let m=d.schema;for(let h in m)delete m[h];m.$ref=f};if(n.cycles==="throw")for(let l of this.seen.entries()){let d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/ + +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(e===l[0]){s(l);continue}if(n.external){let p=n.external.registry.get(l[0])?.id;if(e!==l[0]&&p){s(l);continue}}if(this.metadataRegistry.get(l[0])?.id){s(l);continue}if(d.cycle){s(l);continue}if(d.count>1&&n.reused==="ref"){s(l);continue}}let a=(l,d)=>{let f=this.seen.get(l),p=f.def??f.schema,m={...p};if(f.ref===null)return;let h=f.ref;if(f.ref=null,h){a(h,d);let _=this.seen.get(h).schema;_.$ref&&(d.target==="draft-7"||d.target==="draft-4"||d.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(_)):(Object.assign(p,_),Object.assign(p,m))}f.isParent||this.override({zodSchema:l,jsonSchema:p,path:f.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?c.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,o.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let d=l[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function vo(t,e){if(t instanceof Pu){let n=new zp(e),o={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let i={},s={registry:t,uri:e?.uri,defs:o};for(let a of t._idmap.entries()){let[c,u]=a;i[c]=n.emit(u,{...e,external:s})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}let r=new zp(e);return r.process(t),r.emit(t,e)}function xr(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return xr(n.element,r);if(n.type==="set")return xr(n.valueType,r);if(n.type==="lazy")return xr(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return xr(n.innerType,r);if(n.type==="intersection")return xr(n.left,r)||xr(n.right,r);if(n.type==="record"||n.type==="map")return xr(n.keyType,r)||xr(n.valueType,r);if(n.type==="pipe")return xr(n.in,r)||xr(n.out,r);if(n.type==="object"){for(let o in n.shape)if(xr(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(xr(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(xr(o,r))return!0;return!!(n.rest&&xr(n.rest,r))}return!1}var $z={};function nt(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_zod"in e))return!1;let r=e._zod;return typeof r=="object"&&r!==null&&"def"in r}function vt(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_def"in e)||"_zod"in e)return!1;let r=e._def;return typeof r=="object"&&r!=null&&"typeName"in r}function Iz(t){return nt(t)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),vt(t)}function on(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(nt(t)||vt(t))}function E$(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodLiteral"}function A$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="literal":!1}function Sz(t){return!!(E$(t)||A$(t))}async function Ey(t,e){if(nt(t))try{return{success:!0,data:await Yo(t,e)}}catch(r){return{success:!1,error:r}}if(vt(t))return await t.safeParseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function ts(t,e){if(nt(t))return await Yo(t,e);if(vt(t))return await t.parseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function kz(t,e){if(nt(t))try{return{success:!0,data:Bn(t,e)}}catch(r){return{success:!1,error:r}}if(vt(t))return t.safeParse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Tz(t,e){if(nt(t))return Bn(t,e);if(vt(t))return t.parse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function rs(t){if(nt(t))return Ge.get(t)?.description;if(vt(t)||"description"in t&&typeof t.description=="string")return t.description}function Ez(t){if(!on(t))return!1;if(vt(t)){let e=t._def;if(e.typeName==="ZodObject"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.typeName==="ZodRecord")return!0}if(nt(t)){let e=t._zod.def;if(e.type==="object"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.type==="record")return!0}return typeof t=="object"&&t!==null&&!("shape"in t)}function Wu(t){return on(t)?vt(t)?t._def.typeName==="ZodString":nt(t)?t._zod.def.type==="string":!1:!1}function Ay(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodObject"}function wn(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="object":!1}function Mp(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="array":!1}function O$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="optional":!1}function P$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="nullable":!1}function Az(t){return!!(Ay(t)||wn(t))}function ky(t){if(vt(t))return t.shape;if(nt(t))return t._zod.def.shape;throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Oz(t,e){if(vt(t))return t.extend(e);if(nt(t))return M.extend(t,e);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Pz(t){if(vt(t))return t.partial();if(nt(t))return M.partial(xa,t,void 0);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Hu(t,e=!1){if(vt(t))return t.strict();if(wn(t)){let r=t._zod.def.shape;if(e)for(let[i,s]of Object.entries(t._zod.def.shape)){if(wn(s)){let c=Hu(s,e);r[i]=c}else if(Mp(s)){let c=s._zod.def.element;wn(c)&&(c=Hu(c,e)),r[i]=Qe(s,{...s._zod.def,element:c})}else r[i]=s;let a=Ge.get(s);a&&Ge.add(r[i],a)}let n=Qe(t,{...t._zod.def,shape:r,catchall:zu(Eu)}),o=Ge.get(t);return o&&Ge.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Ty(t,e=!1){if(Ay(t))return t.passthrough();if(wn(t)){let r=t._zod.def.shape;if(e)for(let[i,s]of Object.entries(t._zod.def.shape)){if(wn(s)){let c=Ty(s,e);r[i]=c}else if(Mp(s)){let c=s._zod.def.element;wn(c)&&(c=Ty(c,e)),r[i]=Qe(s,{...s._zod.def,element:c})}else r[i]=s;let a=Ge.get(s);a&&Ge.add(r[i],a)}let n=Qe(t,{...t._zod.def,shape:r,catchall:Nu(Tu)}),o=Ge.get(t);return o&&Ge.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Cz(t){if(vt(t))try{let e=t.parse(void 0);return()=>e}catch{return}if(nt(t))try{let e=Bn(t,void 0);return()=>e}catch{return}}function Z5(t){return vt(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function q5(t){return nt(t)&&t._zod.def.type==="pipe"}function Ta(t,e,r){let n=r.get(t);if(n!==void 0)return n;if(vt(t))return Z5(t)?Ta(t._def.schema,e,r):t;if(nt(t)){let o=t;if(q5(t)&&(o=Ta(t._zod.def.in,e,r)),e){if(wn(o)){let s=o._zod.def.shape;for(let[a,c]of Object.entries(o._zod.def.shape))s[a]=Ta(c,e,r);o=Qe(o,{...o._zod.def,shape:s})}else if(Mp(o)){let s=Ta(o._zod.def.element,e,r);o=Qe(o,{...o._zod.def,element:s})}else if(O$(o)){let s=Ta(o._zod.def.innerType,e,r);o=Qe(o,{...o._zod.def,innerType:s})}else if(P$(o)){let s=Ta(o._zod.def.innerType,e,r);o=Qe(o,{...o._zod.def,innerType:s})}}let i=Ge.get(t);return i&&Ge.add(o,i),r.set(t,o),o}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Oy(t,e=!1){return Ta(t,e,new WeakMap)}function Rz(t,e){if(vt(t)){let r=ky(t),n={};for(let[o,i]of Object.entries(r))e(o,i)?n[o]=i.optional():n[o]=i;return t.extend(n)}if(nt(t)){let r=ky(t),n={...t._zod.def.shape};for(let[s,a]of Object.entries(r))e(s,a)&&(n[s]=new xa({type:"optional",innerType:a}));let o=Qe(t,{...t._zod.def,shape:n}),i=Ge.get(t);return i&&Ge.add(o,i),o}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Py(t){return t instanceof Error&&(t.constructor.name==="ZodError"||t.constructor.name==="$ZodError")}function C$(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}var V5=["*","_","`"];function G5(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n}; +`;return e}function Nz(t,e,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:s=!0,curveStyle:a="linear",wrapLabelNWords:c=9}=r??{},u=s?`%%{init: {'flowchart': {'curve': '${a}'}}}%% +graph TD; +`:`graph TD; +`;if(s){let p="default",m={[p]:"{0}({1})"};n!==void 0&&(m[n]="{0}([{1}]):::first"),o!==void 0&&(m[o]="{0}([{1}]):::last");for(let[h,_]of Object.entries(t)){let v=_.name.split(":").pop()??"",x=V5.some(T=>v.startsWith(T)&&v.endsWith(T))?`

${v}

`:v;Object.keys(_.metadata??{}).length&&(x+=`
${Object.entries(_.metadata??{}).map(([T,F])=>`${T} = ${F}`).join(` +`)}`);let k=(m[h]??m[p]).replace("{0}",C$(h)).replace("{1}",x);u+=` ${k} +`}}let l={};for(let p of e){let m=p.source.split(":"),h=p.target.split(":"),_=m.filter((v,b)=>v===h[b]).join(":");l[_]||(l[_]=[]),l[_].push(p)}let d=new Set;function f(p,m){let h=p.length===1&&p[0].source===p[0].target;if(m&&!h){let _=m.split(":").pop();if(d.has(_))throw new Error(`Found duplicate subgraph '${_}' -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);d.add(_),u+=` subgraph ${_} +`}for(let _ of p){let{source:v,target:b,data:x,conditional:k}=_,T="";if(x!==void 0){let F=x,J=F.split(" ");J.length>c&&(F=Array.from({length:Math.ceil(J.length/c)},(w,Z)=>J.slice(Z*c,(Z+1)*c).join(" ")).join(" 
 ")),T=k?` -.  ${F}  .-> `:` --  ${F}  --> `}else T=k?" -.-> ":" --> ";u+=` ${C$(v)}${T}${C$(b)}; +`}for(let _ in l)_.startsWith(`${m}:`)&&_!==m&&f(l[_],_);m&&!h&&(u+=` end +`)}f(l[""]??[],"");for(let p in l)!p.includes(":")&&p!==""&&f(l[p],p);return s&&(u+=G5(i??{})),u}async function zz(t,e){let r=e?.backgroundColor??"white",n=e?.imageType??"png",o=HR(t);r!==void 0&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(r)||(r=`!${r}`));let i=`https://mermaid.ink/img/${o}?bgColor=${r}&type=${n}`,s=await fetch(i);if(!s.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${s.status}`,`Status text: ${s.statusText}`].join(` +`));return await s.blob()}var jz=Symbol("Let zodToJsonSchema decide on which parser to use"),Mz={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Dz=t=>typeof t=="string"?{...Mz,name:t}:{...Mz,...t};var Lz=t=>{let e=Dz(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};var Cy=(t,e)=>{let r=0;for(;ryG,DIRTY:()=>Ea,EMPTY_PATH:()=>J5,INVALID:()=>pe,NEVER:()=>tK,OK:()=>sr,ParseStatus:()=>Gt,Schema:()=>Ee,ZodAny:()=>is,ZodArray:()=>ni,ZodBigInt:()=>Oa,ZodBoolean:()=>Pa,ZodBranded:()=>Dp,ZodCatch:()=>Ba,ZodDate:()=>Ca,ZodDefault:()=>Fa,ZodDiscriminatedUnion:()=>zy,ZodEffects:()=>In,ZodEnum:()=>La,ZodError:()=>Mr,ZodFirstPartyTypeKind:()=>N,ZodFunction:()=>jy,ZodIntersection:()=>Ma,ZodIssueCode:()=>z,ZodLazy:()=>ja,ZodLiteral:()=>Da,ZodMap:()=>tl,ZodNaN:()=>nl,ZodNativeEnum:()=>Ua,ZodNever:()=>qn,ZodNull:()=>Na,ZodNullable:()=>xo,ZodNumber:()=>Aa,ZodObject:()=>jr,ZodOptional:()=>xn,ZodParsedType:()=>W,ZodPipeline:()=>Lp,ZodPromise:()=>ss,ZodReadonly:()=>Za,ZodRecord:()=>My,ZodSchema:()=>Ee,ZodSet:()=>rl,ZodString:()=>os,ZodSymbol:()=>Qu,ZodTransformer:()=>In,ZodTuple:()=>wo,ZodType:()=>Ee,ZodUndefined:()=>Ra,ZodUnion:()=>za,ZodUnknown:()=>ri,ZodVoid:()=>el,addIssueToContext:()=>B,any:()=>TG,array:()=>PG,bigint:()=>xG,boolean:()=>Jz,coerce:()=>eK,custom:()=>Kz,date:()=>$G,datetimeRegex:()=>Vz,defaultErrorMap:()=>ei,discriminatedUnion:()=>NG,effect:()=>GG,enum:()=>ZG,function:()=>UG,getErrorMap:()=>Ju,getParsedType:()=>bo,instanceof:()=>bG,intersection:()=>zG,isAborted:()=>Ry,isAsync:()=>Xu,isDirty:()=>Ny,isValid:()=>ns,late:()=>vG,lazy:()=>FG,literal:()=>BG,makeIssue:()=>jp,map:()=>DG,nan:()=>wG,nativeEnum:()=>qG,never:()=>AG,null:()=>kG,nullable:()=>HG,number:()=>Wz,object:()=>Xz,objectUtil:()=>N$,oboolean:()=>QG,onumber:()=>YG,optional:()=>KG,ostring:()=>XG,pipeline:()=>JG,preprocess:()=>WG,promise:()=>VG,quotelessJson:()=>K5,record:()=>jG,set:()=>LG,setErrorMap:()=>W5,strictObject:()=>CG,string:()=>Hz,symbol:()=>IG,transformer:()=>GG,tuple:()=>MG,undefined:()=>SG,union:()=>RG,unknown:()=>EG,util:()=>je,void:()=>OG});var je;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(je||(je={}));var N$;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(N$||(N$={}));var W=je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bo=t=>{switch(typeof t){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(t)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(t)?W.array:t===null?W.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?W.promise:typeof Map<"u"&&t instanceof Map?W.map:typeof Set<"u"&&t instanceof Set?W.set:typeof Date<"u"&&t instanceof Date?W.date:W.object;default:return W.unknown}};var z=je.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),K5=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Mr=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;cr.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Mr.create=t=>new Mr(t);var H5=(t,e)=>{let r;switch(t.code){case z.invalid_type:t.received===W.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,je.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${je.joinValues(t.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${je.joinValues(t.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${je.joinValues(t.options)}, received '${t.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:je.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case z.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case z.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=e.defaultError,je.assertNever(t)}return{message:r}},ei=H5;var Uz=ei;function W5(t){Uz=t}function Ju(){return Uz}var jp=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}},J5=[];function B(t,e){let r=Ju(),n=jp({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ei?void 0:ei].filter(o=>!!o)});t.common.issues.push(n)}var Gt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return pe;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return pe;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}},pe=Object.freeze({status:"aborted"}),Ea=t=>({status:"dirty",value:t}),sr=t=>({status:"valid",value:t}),Ry=t=>t.status==="aborted",Ny=t=>t.status==="dirty",ns=t=>t.status==="valid",Xu=t=>typeof Promise<"u"&&t instanceof Promise;var ne;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ne||(ne={}));var $n=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Fz=(t,e)=>{if(ns(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Mr(t.common.issues);return this._error=r,this._error}}};function Se(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var Ee=class{get description(){return this._def.description}_getType(e){return bo(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Gt,ctx:{common:e.parent.common,data:e.data,parsedType:bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Xu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Fz(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return ns(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>ns(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Xu(o)?o:Promise.resolve(o));return Fz(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:z.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new In({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return xn.create(this,this._def)}nullable(){return xo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ni.create(this)}promise(){return ss.create(this,this._def)}or(e){return za.create([this,e],this._def)}and(e){return Ma.create(this,e,this._def)}transform(e){return new In({...Se(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Fa({...Se(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new Dp({typeName:N.ZodBranded,type:this,...Se(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Ba({...Se(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Lp.create(this,e)}readonly(){return Za.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},X5=/^c[^\s-]{8,}$/i,Y5=/^[0-9a-z]+$/,Q5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,eG=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tG=/^[a-z0-9_-]{21}$/i,rG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,nG=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",z$,sG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,aG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,cG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,uG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zz="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",pG=new RegExp(`^${Zz}$`);function qz(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function fG(t){return new RegExp(`^${qz(t)}$`)}function Vz(t){let e=`${Zz}T${qz(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function mG(t,e){return!!((e==="v4"||!e)&&sG.test(t)||(e==="v6"||!e)&&cG.test(t))}function hG(t,e){if(!rG.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function gG(t,e){return!!((e==="v4"||!e)&&aG.test(t)||(e==="v6"||!e)&&uG.test(t))}var os=class t extends Ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.string,received:i.parsedType}),pe}let n=new Gt,o;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(o=this._getOrReturnCtx(e,o),B(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.lengthe.test(o),{validation:r,code:z.invalid_string,...ne.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ne.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ne.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ne.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ne.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ne.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ne.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ne.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ne.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ne.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ne.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ne.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ne.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ne.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ne.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ne.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ne.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ne.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ne.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ne.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ne.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ne.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ne.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ne.errToObj(r)})}nonempty(e){return this.min(1,ne.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew os({checks:[],typeName:N.ZodString,coerce:t?.coerce??!1,...Se(t)});function _G(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var Aa=class t extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==W.number){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.number,received:i.parsedType}),pe}let n,o=new Gt;for(let i of this._def.checks)i.kind==="int"?je.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?_G(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_finite,message:i.message}),o.dirty()):je.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ne.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ne.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ne.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ne.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ne.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ne.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ne.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ne.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ne.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ne.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&je.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew Aa({checks:[],typeName:N.ZodNumber,coerce:t?.coerce||!1,...Se(t)});var Oa=class t extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==W.bigint)return this._getInvalidInput(e);let n,o=new Gt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):je.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return B(r,{code:z.invalid_type,expected:W.bigint,received:r.parsedType}),pe}gte(e,r){return this.setLimit("min",e,!0,ne.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ne.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ne.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ne.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ne.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ne.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Oa({checks:[],typeName:N.ZodBigInt,coerce:t?.coerce??!1,...Se(t)});var Pa=class extends Ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.boolean,received:n.parsedType}),pe}return sr(e.data)}};Pa.create=t=>new Pa({typeName:N.ZodBoolean,coerce:t?.coerce||!1,...Se(t)});var Ca=class t extends Ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.date,received:i.parsedType}),pe}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_date}),pe}let n=new Gt,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(o=this._getOrReturnCtx(e,o),B(o,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):je.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ne.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ne.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ca({checks:[],coerce:t?.coerce||!1,typeName:N.ZodDate,...Se(t)});var Qu=class extends Ee{_parse(e){if(this._getType(e)!==W.symbol){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.symbol,received:n.parsedType}),pe}return sr(e.data)}};Qu.create=t=>new Qu({typeName:N.ZodSymbol,...Se(t)});var Ra=class extends Ee{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.undefined,received:n.parsedType}),pe}return sr(e.data)}};Ra.create=t=>new Ra({typeName:N.ZodUndefined,...Se(t)});var Na=class extends Ee{_parse(e){if(this._getType(e)!==W.null){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.null,received:n.parsedType}),pe}return sr(e.data)}};Na.create=t=>new Na({typeName:N.ZodNull,...Se(t)});var is=class extends Ee{constructor(){super(...arguments),this._any=!0}_parse(e){return sr(e.data)}};is.create=t=>new is({typeName:N.ZodAny,...Se(t)});var ri=class extends Ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return sr(e.data)}};ri.create=t=>new ri({typeName:N.ZodUnknown,...Se(t)});var qn=class extends Ee{_parse(e){let r=this._getOrReturnCtx(e);return B(r,{code:z.invalid_type,expected:W.never,received:r.parsedType}),pe}};qn.create=t=>new qn({typeName:N.ZodNever,...Se(t)});var el=class extends Ee{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.void,received:n.parsedType}),pe}return sr(e.data)}};el.create=t=>new el({typeName:N.ZodVoid,...Se(t)});var ni=class t extends Ee{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==W.array)return B(r,{code:z.invalid_type,expected:W.array,received:r.parsedType}),pe;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.lengtho.maxLength.value&&(B(r,{code:z.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new $n(r,s,r.path,a)))).then(s=>Gt.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new $n(r,s,r.path,a)));return Gt.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:ne.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:ne.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:ne.toString(r)}})}nonempty(e){return this.min(1,e)}};ni.create=(t,e)=>new ni({type:t,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...Se(e)});function Yu(t){if(t instanceof jr){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=xn.create(Yu(n))}return new jr({...t._def,shape:()=>e})}else return t instanceof ni?new ni({...t._def,type:Yu(t.element)}):t instanceof xn?xn.create(Yu(t.unwrap())):t instanceof xo?xo.create(Yu(t.unwrap())):t instanceof wo?wo.create(t.items.map(e=>Yu(e))):t}var jr=class t extends Ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=je.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==W.object){let u=this._getOrReturnCtx(e);return B(u,{code:z.invalid_type,expected:W.object,received:u.parsedType}),pe}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof qn&&this._def.unknownKeys==="strip"))for(let u in o.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new $n(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof qn){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(B(o,{code:z.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new $n(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Gt.mergeObjectSync(n,u)):Gt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return ne.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ne.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of je.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of je.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Yu(this)}partial(e){let r={};for(let n of je.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of je.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof xn;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Gz(je.objectKeys(this.shape))}};jr.create=(t,e)=>new jr({shape:()=>t,unknownKeys:"strip",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});jr.strictCreate=(t,e)=>new jr({shape:()=>t,unknownKeys:"strict",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});jr.lazycreate=(t,e)=>new jr({shape:t,unknownKeys:"strip",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});var za=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new Mr(a.ctx.common.issues));return B(r,{code:z.invalid_union,unionErrors:s}),pe}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new Mr(c));return B(r,{code:z.invalid_union,unionErrors:a}),pe}}get options(){return this._def.options}};za.create=(t,e)=>new za({options:t,typeName:N.ZodUnion,...Se(e)});var ti=t=>t instanceof ja?ti(t.schema):t instanceof In?ti(t.innerType()):t instanceof Da?[t.value]:t instanceof La?t.options:t instanceof Ua?je.objectValues(t.enum):t instanceof Fa?ti(t._def.innerType):t instanceof Ra?[void 0]:t instanceof Na?[null]:t instanceof xn?[void 0,...ti(t.unwrap())]:t instanceof xo?[null,...ti(t.unwrap())]:t instanceof Dp||t instanceof Za?ti(t.unwrap()):t instanceof Ba?ti(t._def.innerType):[],zy=class t extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.object)return B(r,{code:z.invalid_type,expected:W.object,received:r.parsedType}),pe;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(B(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=ti(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Se(n)})}};function M$(t,e){let r=bo(t),n=bo(e);if(t===e)return{valid:!0,data:t};if(r===W.object&&n===W.object){let o=je.objectKeys(e),i=je.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let c=M$(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===W.array&&n===W.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i{if(Ry(i)||Ry(s))return pe;let a=M$(i.value,s.value);return a.valid?((Ny(i)||Ny(s))&&r.dirty(),{status:r.value,value:a.data}):(B(n,{code:z.invalid_intersection_types}),pe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ma.create=(t,e,r)=>new Ma({left:t,right:e,typeName:N.ZodIntersection,...Se(r)});var wo=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.array)return B(n,{code:z.invalid_type,expected:W.array,received:n.parsedType}),pe;if(n.data.lengththis._def.items.length&&(B(n,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new $n(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>Gt.mergeArray(r,s)):Gt.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};wo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wo({items:t,typeName:N.ZodTuple,rest:null,...Se(e)})};var My=class t extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.object)return B(n,{code:z.invalid_type,expected:W.object,received:n.parsedType}),pe;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new $n(n,a,n.path,a)),value:s._parse(new $n(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Gt.mergeObjectAsync(r,o):Gt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ee?new t({keyType:e,valueType:r,typeName:N.ZodRecord,...Se(n)}):new t({keyType:os.create(),valueType:e,typeName:N.ZodRecord,...Se(r)})}},tl=class extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.map)return B(n,{code:z.invalid_type,expected:W.map,received:n.parsedType}),pe;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new $n(n,a,n.path,[u,"key"])),value:i._parse(new $n(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return pe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return pe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};tl.create=(t,e,r)=>new tl({valueType:e,keyType:t,typeName:N.ZodMap,...Se(r)});var rl=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.set)return B(n,{code:z.invalid_type,expected:W.set,received:n.parsedType}),pe;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&(B(n,{code:z.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return pe;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>i._parse(new $n(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:ne.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:ne.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};rl.create=(t,e)=>new rl({valueType:t,minSize:null,maxSize:null,typeName:N.ZodSet,...Se(e)});var jy=class t extends Ee{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.function)return B(r,{code:z.invalid_type,expected:W.function,received:r.parsedType}),pe;function n(a,c){return jp({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ju(),ei].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function o(a,c){return jp({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ju(),ei].filter(u=>!!u),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof ss){let a=this;return sr(async function(...c){let u=new Mr([]),l=await a._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(o(d,p)),u})})}else{let a=this;return sr(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new Mr([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new Mr([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:wo.create(e).rest(ri.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||wo.create([]).rest(ri.create()),returns:r||ri.create(),typeName:N.ZodFunction,...Se(n)})}},ja=class extends Ee{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ja.create=(t,e)=>new ja({getter:t,typeName:N.ZodLazy,...Se(e)});var Da=class extends Ee{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return B(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}};Da.create=(t,e)=>new Da({value:t,typeName:N.ZodLiteral,...Se(e)});function Gz(t,e){return new La({values:t,typeName:N.ZodEnum,...Se(e)})}var La=class t extends Ee{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{expected:je.joinValues(n),received:r.parsedType,code:z.invalid_type}),pe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{received:r.data,code:z.invalid_enum_value,options:n}),pe}return sr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};La.create=Gz;var Ua=class extends Ee{_parse(e){let r=je.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==W.string&&n.parsedType!==W.number){let o=je.objectValues(r);return B(n,{expected:je.joinValues(o),received:n.parsedType,code:z.invalid_type}),pe}if(this._cache||(this._cache=new Set(je.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=je.objectValues(r);return B(n,{received:n.data,code:z.invalid_enum_value,options:o}),pe}return sr(e.data)}get enum(){return this._def.values}};Ua.create=(t,e)=>new Ua({values:t,typeName:N.ZodNativeEnum,...Se(e)});var ss=class extends Ee{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.promise&&r.common.async===!1)return B(r,{code:z.invalid_type,expected:W.promise,received:r.parsedType}),pe;let n=r.parsedType===W.promise?r.data:Promise.resolve(r.data);return sr(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ss.create=(t,e)=>new ss({type:t,typeName:N.ZodPromise,...Se(e)});var In=class extends Ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{B(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return pe;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?pe:c.status==="dirty"?Ea(c.value):r.value==="dirty"?Ea(c.value):c});{if(r.value==="aborted")return pe;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?pe:a.status==="dirty"?Ea(a.value):r.value==="dirty"?Ea(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?pe:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?pe:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ns(s))return pe;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>ns(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):pe);je.assertNever(o)}};In.create=(t,e,r)=>new In({schema:t,typeName:N.ZodEffects,effect:e,...Se(r)});In.createWithPreprocess=(t,e,r)=>new In({schema:e,effect:{type:"preprocess",transform:t},typeName:N.ZodEffects,...Se(r)});var xn=class extends Ee{_parse(e){return this._getType(e)===W.undefined?sr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xn.create=(t,e)=>new xn({innerType:t,typeName:N.ZodOptional,...Se(e)});var xo=class extends Ee{_parse(e){return this._getType(e)===W.null?sr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xo.create=(t,e)=>new xo({innerType:t,typeName:N.ZodNullable,...Se(e)});var Fa=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===W.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Fa.create=(t,e)=>new Fa({innerType:t,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Se(e)});var Ba=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Xu(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Se(e)});var nl=class extends Ee{_parse(e){if(this._getType(e)!==W.nan){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.nan,received:n.parsedType}),pe}return{status:"valid",value:e.data}}};nl.create=t=>new nl({typeName:N.ZodNaN,...Se(t)});var yG=Symbol("zod_brand"),Dp=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Lp=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?pe:i.status==="dirty"?(r.dirty(),Ea(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?pe:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:N.ZodPipeline})}},Za=class extends Ee{_parse(e){let r=this._def.innerType._parse(e),n=o=>(ns(o)&&(o.value=Object.freeze(o.value)),o);return Xu(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Za.create=(t,e)=>new Za({innerType:t,typeName:N.ZodReadonly,...Se(e)});function Bz(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Kz(t,e={},r){return t?is.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=Bz(e,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!i){let s=Bz(e,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):is.create()}var vG={object:jr.lazycreate},N;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(N||(N={}));var bG=(t,e={message:`Input not instance of ${t.name}`})=>Kz(r=>r instanceof t,e),Hz=os.create,Wz=Aa.create,wG=nl.create,xG=Oa.create,Jz=Pa.create,$G=Ca.create,IG=Qu.create,SG=Ra.create,kG=Na.create,TG=is.create,EG=ri.create,AG=qn.create,OG=el.create,PG=ni.create,Xz=jr.create,CG=jr.strictCreate,RG=za.create,NG=zy.create,zG=Ma.create,MG=wo.create,jG=My.create,DG=tl.create,LG=rl.create,UG=jy.create,FG=ja.create,BG=Da.create,ZG=La.create,qG=Ua.create,VG=ss.create,GG=In.create,KG=xn.create,HG=xo.create,WG=In.createWithPreprocess,JG=Lp.create,XG=()=>Hz().optional(),YG=()=>Wz().optional(),QG=()=>Jz().optional(),eK={string:(t=>os.create({...t,coerce:!0})),number:(t=>Aa.create({...t,coerce:!0})),boolean:(t=>Pa.create({...t,coerce:!0})),bigint:(t=>Oa.create({...t,coerce:!0})),date:(t=>Ca.create({...t,coerce:!0}))};var tK=pe;function Yz(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==N.ZodAny&&(r.items=he(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&De(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&De(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(De(r,"minItems",t.exactLength.value,t.exactLength.message,e),De(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Qz(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?De(r,"minimum",n.value,n.message,e):De(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),De(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?De(r,"maximum",n.value,n.message,e):De(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),De(r,"maximum",n.value,n.message,e));break;case"multipleOf":De(r,"multipleOf",n.value,n.message,e);break}return r}function e1(){return{type:"boolean"}}function Dy(t,e){return he(t.type._def,e)}var t1=(t,e)=>he(t.innerType._def,e);function j$(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map(o=>j$(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return nK(t,e)}}var nK=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":De(r,"minimum",n.value,n.message,e);break;case"max":De(r,"maximum",n.value,n.message,e);break}return r};function r1(t,e){return{...he(t.innerType._def,e),default:t.defaultValue()}}function n1(t,e){return e.effectStrategy==="input"?he(t.schema._def,e):pt(e)}function o1(t){return{type:"string",enum:Array.from(t.values)}}var oK=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function i1(t,e){let r=[he(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),he(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(oK(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...c}=i;s=c}else n=void 0;o.push(s)}}),o.length?{allOf:o,...n}:void 0}function s1(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var D$,Vn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(D$===void 0&&(D$=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),D$),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Ly(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":De(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":De(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Gn(r,"email",n.message,e);break;case"format:idn-email":Gn(r,"idn-email",n.message,e);break;case"pattern:zod":Ir(r,Vn.email,n.message,e);break}break;case"url":Gn(r,"uri",n.message,e);break;case"uuid":Gn(r,"uuid",n.message,e);break;case"regex":Ir(r,n.regex,n.message,e);break;case"cuid":Ir(r,Vn.cuid,n.message,e);break;case"cuid2":Ir(r,Vn.cuid2,n.message,e);break;case"startsWith":Ir(r,RegExp(`^${L$(n.value,e)}`),n.message,e);break;case"endsWith":Ir(r,RegExp(`${L$(n.value,e)}$`),n.message,e);break;case"datetime":Gn(r,"date-time",n.message,e);break;case"date":Gn(r,"date",n.message,e);break;case"time":Gn(r,"time",n.message,e);break;case"duration":Gn(r,"duration",n.message,e);break;case"length":De(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),De(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":Ir(r,RegExp(L$(n.value,e)),n.message,e);break;case"ip":n.version!=="v6"&&Gn(r,"ipv4",n.message,e),n.version!=="v4"&&Gn(r,"ipv6",n.message,e);break;case"base64url":Ir(r,Vn.base64url,n.message,e);break;case"jwt":Ir(r,Vn.jwt,n.message,e);break;case"cidr":n.version!=="v6"&&Ir(r,Vn.ipv4Cidr,n.message,e),n.version!=="v4"&&Ir(r,Vn.ipv6Cidr,n.message,e);break;case"emoji":Ir(r,Vn.emoji(),n.message,e);break;case"ulid":Ir(r,Vn.ulid,n.message,e);break;case"base64":switch(e.base64Strategy){case"format:binary":Gn(r,"binary",n.message,e);break;case"contentEncoding:base64":De(r,"contentEncoding","base64",n.message,e);break;case"pattern:zod":Ir(r,Vn.base64,n.message,e);break}break;case"nanoid":Ir(r,Vn.nanoid,n.message,e);break;case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function L$(t,e){return e.patternStrategy==="escape"?sK(t):t}var iK=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function sK(t){let e="";for(let r=0;ro.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):De(t,"format",e,r,n)}function Ir(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:a1(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):De(t,"pattern",a1(e,n),r,n)}function a1(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",i=!1,s=!1,a=!1;for(let c=0;c({...n,[o]:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??pt(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===N.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=Ly(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===N.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===N.ZodBranded&&t.keyType._def.type._def.typeName===N.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=Dy(t.keyType._def,e);return{...r,propertyNames:o}}}return r}function c1(t,e){if(e.mapStrategy==="record")return Uy(t,e);let r=he(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||pt(e),n=he(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||pt(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function u1(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function l1(t){return t.target==="openAi"?void 0:{not:pt({...t,currentPath:[...t.currentPath,"not"]})}}function d1(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Up={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function f1(t,e){if(e.target==="openApi3")return p1(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Up&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let s=Up[i._def.typeName];return s&&!o.includes(s)?[...o,s]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,i)=>{let s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];case"bigint":return[...o,"integer"];case"object":return i._def.value===null?[...o,"null"]:o;case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((i,s,a)=>a.indexOf(i)===s);return{type:o.length>1?o:o[0],enum:r.reduce((i,s)=>i.includes(s._def.value)?i:[...i,s._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return p1(t,e)}var p1=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>he(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function m1(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Up[t.innerType._def.typeName],nullable:!0}:{type:[Up[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=he(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function h1(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",R$(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?De(r,"minimum",n.value,n.message,e):De(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),De(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?De(r,"maximum",n.value,n.message,e):De(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),De(r,"maximum",n.value,n.message,e));break;case"multipleOf":De(r,"multipleOf",n.value,n.message,e);break}return r}function g1(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},o=[],i=t.shape();for(let a in i){let c=i[a];if(c===void 0||c._def===void 0)continue;let u=cK(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=he(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||o.push(a))}o.length&&(n.required=o);let s=aK(t,e);return s!==void 0&&(n.additionalProperties=s),n}function aK(t,e){if(t.catchall._def.typeName!=="ZodNever")return he(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function cK(t){try{return t.isOptional()}catch{return!0}}var _1=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return he(t.innerType._def,e);let r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:pt(e)},r]}:pt(e)};var y1=(t,e)=>{if(e.pipeStrategy==="input")return he(t.in._def,e);if(e.pipeStrategy==="output")return he(t.out._def,e);let r=he(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=he(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function v1(t,e){return he(t.type._def,e)}function b1(t,e){let n={type:"array",uniqueItems:!0,items:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&De(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&De(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function w1(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>he(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:he(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>he(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function x1(t){return{not:pt(t)}}function $1(t){return pt(t)}var I1=(t,e)=>he(t.innerType._def,e);var S1=(t,e,r)=>{switch(e){case N.ZodString:return Ly(t,r);case N.ZodNumber:return h1(t,r);case N.ZodObject:return g1(t,r);case N.ZodBigInt:return Qz(t,r);case N.ZodBoolean:return e1();case N.ZodDate:return j$(t,r);case N.ZodUndefined:return x1(r);case N.ZodNull:return d1(r);case N.ZodArray:return Yz(t,r);case N.ZodUnion:case N.ZodDiscriminatedUnion:return f1(t,r);case N.ZodIntersection:return i1(t,r);case N.ZodTuple:return w1(t,r);case N.ZodRecord:return Uy(t,r);case N.ZodLiteral:return s1(t,r);case N.ZodEnum:return o1(t);case N.ZodNativeEnum:return u1(t);case N.ZodNullable:return m1(t,r);case N.ZodOptional:return _1(t,r);case N.ZodMap:return c1(t,r);case N.ZodSet:return b1(t,r);case N.ZodLazy:return()=>t.getter()._def;case N.ZodPromise:return v1(t,r);case N.ZodNaN:case N.ZodNever:return l1(r);case N.ZodEffects:return n1(t,r);case N.ZodAny:return pt(r);case N.ZodUnknown:return $1(r);case N.ZodDefault:return r1(t,r);case N.ZodBranded:return Dy(t,r);case N.ZodReadonly:return I1(t,r);case N.ZodCatch:return t1(t,r);case N.ZodPipeline:return y1(t,r);case N.ZodFunction:case N.ZodVoid:case N.ZodSymbol:return;default:return(n=>{})(e)}};function he(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==jz)return a}if(n&&!r){let a=uK(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=S1(t,t.typeName,e),s=typeof i=="function"?he(i(),e):i;if(s&&lK(t,e,s),e.postProcess){let a=e.postProcess(s,t,e);return o.jsonSchema=s,a}return o.jsonSchema=s,s}var uK=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Cy(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),pt(e)):e.$refStrategy==="seen"?pt(e):void 0}},lK=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var k1=(t,e)=>{let r=Lz(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:he(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??pt(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=he(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??pt(r),s=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;s!==void 0&&(i.title=s),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=o===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function $o(t,e){let r=typeof t;if(r!==typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let n=t.length;if(n!==e.length)return!1;for(let o=0;o1?e[s.href]=t:(s.hash="",n===""?r=s:Kn(t,e,r))}}else if(t!==!0&&t!==!1)return e;let o=r.href+(n?"#"+n:"");if(e[o]!==void 0)throw new Error(`Duplicate schema URI "${o}".`);if(e[o]=t,t===!0||t===!1)return e;if(t.__absolute_uri__===void 0&&Object.defineProperty(t,"__absolute_uri__",{enumerable:!1,value:o}),t.$ref&&t.__absolute_ref__===void 0){let i=new URL(t.$ref,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_ref__",{enumerable:!1,value:i.href})}if(t.$recursiveRef&&t.__absolute_recursive_ref__===void 0){let i=new URL(t.$recursiveRef,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(t.$anchor){let i=new URL("#"+t.$anchor,r.href);e[i.href]=t}for(let i in t){if(mK[i])continue;let s=`${n}/${sn(i)}`,a=t[i];if(Array.isArray(a)){if(pK[i]){let c=a.length;for(let u=0;u%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,xK=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,$K=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,IK=/^(?:\/(?:[^~/]|~0|~1)*)*$/,SK=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,kK=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,TK=t=>{if(t[0]==='"')return!1;let[e,r,...n]=t.split("@");return!e||!r||n.length!==0||e.length>64||r.length>253||e[0]==="."||e.endsWith(".")||e.includes("..")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(e)?!1:r.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},EK=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,AK=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,OK=t=>t.length>1&&t.length<80&&(/^P\d+([.,]\d+)?W$/.test(t)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(t)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(t));function Io(t){return t.test.bind(t)}var U$={date:T1,time:E1.bind(void 0,!1),"date-time":RK,duration:OK,uri:MK,"uri-reference":Io(bK),"uri-template":Io(wK),url:Io(xK),email:TK,hostname:Io(vK),ipv4:Io(EK),ipv6:Io(AK),regex:DK,uuid:Io($K),"json-pointer":Io(IK),"json-pointer-uri-fragment":Io(SK),"relative-json-pointer":Io(kK)};function PK(t){return t%4===0&&(t%100!==0||t%400===0)}function T1(t){let e=t.match(gK);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&PK(r)?29:_K[n])}function E1(t,e){let r=e.match(yK);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3],s=!!r[5];return(n<=23&&o<=59&&i<=59||n==23&&o==59&&i==60)&&(!t||s)}var CK=/t|\s/i;function RK(t){let e=t.split(CK);return e.length==2&&T1(e[0])&&E1(!0,e[1])}var NK=/\/|:/,zK=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function MK(t){return NK.test(t)&&zK.test(t)}var jK=/[^\\]\\Z/;function DK(t){if(jK.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var A1;(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(A1||(A1={}));function O1(t){let e=0,r=t.length,n=0,o;for(;n=55296&&o<=56319&&n$o(t,ge))||H.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`}):_.some(ge=>t===ge)||H.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`})),b!==void 0){let ge=`${a}/not`;ot(t,b,r,n,o,i,s,ge).valid&&H.push({instanceLocation:s,keyword:"not",keywordLocation:ge,error:'Instance matched "not" schema.'})}let Ts=[];if(x!==void 0){let ge=`${a}/anyOf`,le=H.length,xe=!1;for(let ee=0;ee{let ve=Object.create(c),_e=ot(t,ee,r,n,o,p===!0?i:null,s,`${ge}/${q}`,ve);return H.push(..._e.errors),_e.valid&&Ts.push(ve),_e.valid}).length;xe===1?H.length=le:H.splice(le,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:ge,error:`Instance does not match exactly one subschema (${xe} matches).`})}if((l==="object"||l==="array")&&Object.assign(c,...Ts),F!==void 0){let ge=`${a}/if`;if(ot(t,F,r,n,o,i,s,ge,c).valid){if(J!==void 0){let xe=ot(t,J,r,n,o,i,s,`${a}/then`,c);xe.valid||H.push({instanceLocation:s,keyword:"if",keywordLocation:ge,error:'Instance does not match "then" schema.'},...xe.errors)}}else if(w!==void 0){let xe=ot(t,w,r,n,o,i,s,`${a}/else`,c);xe.valid||H.push({instanceLocation:s,keyword:"if",keywordLocation:ge,error:'Instance does not match "else" schema.'},...xe.errors)}}if(l==="object"){if(v!==void 0)for(let ee of v)ee in t||H.push({instanceLocation:s,keyword:"required",keywordLocation:`${a}/required`,error:`Instance does not have required property "${ee}".`});let ge=Object.keys(t);if(pn!==void 0&&ge.lengthNo&&H.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${No} properties.`}),qe!==void 0){let ee=`${a}/propertyNames`;for(let q in t){let ve=`${s}/${sn(q)}`,_e=ot(q,qe,r,n,o,i,ve,ee);_e.valid||H.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:ee,error:`Property name "${q}" does not match schema.`},..._e.errors)}}if(Ul!==void 0){let ee=`${a}/dependantRequired`;for(let q in Ul)if(q in t){let ve=Ul[q];for(let _e of ve)_e in t||H.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:ee,error:`Instance has "${q}" but does not have "${_e}".`})}}if(Ss!==void 0)for(let ee in Ss){let q=`${a}/dependentSchemas`;if(ee in t){let ve=ot(t,Ss[ee],r,n,o,i,s,`${q}/${sn(ee)}`,c);ve.valid||H.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:q,error:`Instance has "${ee}" but does not match dependant schema.`},...ve.errors)}}if(ks!==void 0){let ee=`${a}/dependencies`;for(let q in ks)if(q in t){let ve=ks[q];if(Array.isArray(ve))for(let _e of ve)_e in t||H.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ee,error:`Instance has "${q}" but does not have "${_e}".`});else{let _e=ot(t,ve,r,n,o,i,s,`${ee}/${sn(q)}`);_e.valid||H.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ee,error:`Instance has "${q}" but does not match dependant schema.`},..._e.errors)}}}let le=Object.create(null),xe=!1;if(oe!==void 0){let ee=`${a}/properties`;for(let q in oe){if(!(q in t))continue;let ve=`${s}/${sn(q)}`,_e=ot(t[q],oe[q],r,n,o,i,ve,`${ee}/${sn(q)}`);if(_e.valid)c[q]=le[q]=!0;else if(xe=o,H.push({instanceLocation:s,keyword:"properties",keywordLocation:ee,error:`Property "${q}" does not match schema.`},..._e.errors),xe)break}}if(!xe&&Q!==void 0){let ee=`${a}/patternProperties`;for(let q in Q){let ve=new RegExp(q,"u"),_e=Q[q];for(let Er in t){if(!ve.test(Er))continue;let ET=`${s}/${sn(Er)}`,AT=ot(t[Er],_e,r,n,o,i,ET,`${ee}/${sn(q)}`);AT.valid?c[Er]=le[Er]=!0:(xe=o,H.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:ee,error:`Property "${Er}" matches pattern "${q}" but does not match associated schema.`},...AT.errors))}}}if(!xe&&wt!==void 0){let ee=`${a}/additionalProperties`;for(let q in t){if(le[q])continue;let ve=`${s}/${sn(q)}`,_e=ot(t[q],wt,r,n,o,i,ve,ee);_e.valid?c[q]=!0:(xe=o,H.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:ee,error:`Property "${q}" does not match additional properties schema.`},..._e.errors))}}else if(!xe&&dn!==void 0){let ee=`${a}/unevaluatedProperties`;for(let q in t)if(!c[q]){let ve=`${s}/${sn(q)}`,_e=ot(t[q],dn,r,n,o,i,ve,ee);_e.valid?c[q]=!0:H.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:ee,error:`Property "${q}" does not match unevaluated properties schema.`},..._e.errors)}}}else if(l==="array"){R!==void 0&&t.length>R&&H.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${t.length} > ${R}).`}),g!==void 0&&t.length=(Cn||0)&&(H.length=q),Cn===void 0&&y===void 0&&ve===0?H.splice(q,0,{instanceLocation:s,keyword:"contains",keywordLocation:ee,error:"Array does not contain item matching schema."}):Cn!==void 0&&vey&&H.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${y} items matching schema. ${ve} items were found.`})}if(!xe&&Bl!==void 0){let ee=`${a}/unevaluatedItems`;for(le;le=Ye||t>Ye)&&H.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${Tt?"or equal to ":""} ${Ye}.`})):(ze!==void 0&&tYe&&H.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${Ye}.`}),it!==void 0&&t<=it&&H.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${a}/exclusiveMinimum`,error:`${t} is less than ${it}.`}),Tt!==void 0&&t>=Tt&&H.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${a}/exclusiveMaximum`,error:`${t} is greater than or equal to ${Tt}.`})),Bt!==void 0){let ge=t%Bt;Math.abs(0-ge)>=11920929e-14&&Math.abs(Bt-ge)>=11920929e-14&&H.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${a}/multipleOf`,error:`${t} is not a multiple of ${Bt}.`})}}else if(l==="string"){let ge=Rn===void 0&&ht===void 0?0:O1(t);Rn!==void 0&&geht&&H.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${a}/maxLength`,error:`String is too long (${ge} > ${ht}).`}),fn!==void 0&&!new RegExp(fn,"u").test(t)&&H.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${a}/pattern`,error:"String does not match pattern."}),Z!==void 0&&U$[Z]&&!U$[Z](t)&&H.push({instanceLocation:s,keyword:"format",keywordLocation:`${a}/format`,error:`String does not match format "${Z}".`})}return{valid:H.length===0,errors:H}}var Fy=class{schema;draft;shortCircuit;lookup;constructor(e,r="2019-09",n=!0){this.schema=e,this.draft=r,this.shortCircuit=n,this.lookup=Kn(e)}validate(e){return ot(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,r){r&&(e={...e,$id:r}),Kn(e,this.lookup)}};var LK={};G(LK,{Validator:()=>Fy,deepCompareStrict:()=>$o,toJsonSchema:()=>an,validatesOnlyStrings:()=>ol});function an(t){if(nt(t)){let e=Oy(t,!0);if(wn(e)){let r=Hu(e,!0);return vo(r)}else return vo(t)}return vt(t)?k1(t):t}function ol(t){if(!t||typeof t!="object"||Object.keys(t).length===0||Array.isArray(t))return!1;if("type"in t)return typeof t.type=="string"?t.type==="string":Array.isArray(t.type)?t.type.every(e=>e==="string"):!1;if("enum"in t)return Array.isArray(t.enum)&&t.enum.length>0&&t.enum.every(e=>typeof e=="string");if("const"in t)return typeof t.const=="string";if("allOf"in t&&Array.isArray(t.allOf))return t.allOf.some(e=>ol(e));if("anyOf"in t&&Array.isArray(t.anyOf)||"oneOf"in t&&Array.isArray(t.oneOf)){let e="anyOf"in t?t.anyOf:t.oneOf;return e.length>0&&e.every(r=>ol(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=Kn(t);return r[e]?ol(r[e]):!1}return!1}var UK={};G(UK,{Graph:()=>By});function FK(t,e){if(t!==void 0&&!Ui(t))return t;if(Hd(e))try{let r=e.getName();return r=r.startsWith("Runnable")?r.slice(8):r,r}catch{return e.getName()}else return e.name??"UnknownSchema"}function BK(t){return Hd(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...an(t.data.schema),title:t.data.name}}}var By=class R1{nodes={};edges=[];constructor(e){this.nodes=e?.nodes??this.nodes,this.edges=e?.edges??this.edges}toJSON(){let e={};return Object.values(this.nodes).forEach((r,n)=>{e[r.id]=Ui(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...BK(r)})),edges:this.edges.map(r=>{let n={source:e[r.source],target:e[r.target]};return typeof r.data<"u"&&(n.data=r.data),typeof r.conditional<"u"&&(n.conditional=r.conditional),n})}}addNode(e,r,n){if(r!==void 0&&this.nodes[r]!==void 0)throw new Error(`Node with id ${r} already exists`);let o=r??Et(),i={id:o,data:e,name:FK(r,e),metadata:n};return this.nodes[o]=i,i}removeNode(e){delete this.nodes[e.id],this.edges=this.edges.filter(r=>r.source!==e.id&&r.target!==e.id)}addEdge(e,r,n,o){if(this.nodes[e.id]===void 0)throw new Error(`Source node ${e.id} not in graph`);if(this.nodes[r.id]===void 0)throw new Error(`Target node ${r.id} not in graph`);let i={source:e.id,target:r.id,data:n,conditional:o};return this.edges.push(i),i}firstNode(){return P1(this)}lastNode(){return C1(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(u=>u.id).every(Ui)&&(n="");let i=u=>n?`${n}:${u}`:u;Object.entries(e.nodes).forEach(([u,l])=>{this.nodes[i(u)]={...l,id:i(u)}});let s=e.edges.map(u=>({...u,source:i(u.source),target:i(u.target)}));this.edges=[...this.edges,...s];let a=e.firstNode(),c=e.lastNode();return[a?{id:i(a.id),data:a.data}:void 0,c?{id:i(c.id),data:c.data}:void 0]}trimFirstNode(){let e=this.firstNode();e&&P1(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&C1(this,[e.id])&&this.removeNode(e)}reid(){let e=Object.fromEntries(Object.values(this.nodes).map(o=>[o.id,o.name])),r=new Map;Object.values(e).forEach(o=>{r.set(o,(r.get(o)||0)+1)});let n=o=>{let i=e[o];return Ui(o)&&r.get(i)===1?i:o};return new R1({nodes:Object.fromEntries(Object.entries(this.nodes).map(([o,i])=>[n(o),{...i,id:n(o)}])),edges:this.edges.map(o=>({...o,source:n(o.source),target:n(o.target)}))})}drawMermaid(e){let{withStyles:r,curveStyle:n,nodeColors:o={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=e??{},s=this.reid(),a=s.firstNode(),c=s.lastNode();return Nz(s.nodes,s.edges,{firstNode:a?.id,lastNode:c?.id,withStyles:r,curveStyle:n,nodeColors:o,wrapLabelNWords:i})}async drawMermaidPng(e){let r=this.drawMermaid(e);return zz(r,{backgroundColor:e?.backgroundColor})}};function P1(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.source)).map(o=>o.target)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function C1(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.target)).map(o=>o.source)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function N1(t){let e=new TextEncoder,r=new ReadableStream({async start(n){for await(let o of t)n.enqueue(e.encode(`event: data +data: ${JSON.stringify(o)} + +`));n.enqueue(e.encode(`event: end + +`)),n.close()}});return br.fromReadableStream(r)}function F$(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}var z1=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function";function Zy(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*B$(t,e){for(;;){let{value:r,done:n}=Lt.runWithConfig(vr(t),e.next.bind(e),!0);if(n)break;yield r}}async function*qy(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Lt.runWithConfig(vr(t),r.next.bind(e),!0);if(o)break;yield n}}function Ot(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}var Ze=class extends uo{lc_runnable=!0;name;getName(t){let e=this.name??this.constructor.lc_name()??this.constructor.name;return t?`${e}${t}`:e}withRetry(t){return new Gy({bound:this,kwargs:{},config:{},maxAttemptNumber:t?.stopAfterAttempt,...t})}withConfig(t){return new as({bound:this,config:t,kwargs:{}})}withFallbacks(t){let e=Array.isArray(t)?t:t.fallbacks;return new Z$({runnable:this,fallbacks:e})}_getOptionsList(t,e=0){if(Array.isArray(t)&&t.length!==e)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${t.length} options for ${e} inputs`);if(Array.isArray(t))return t.map(Pe);if(e>1&&!Array.isArray(t)&&t.runId){console.warn("Provided runId will be used only for the first element of the batch.");let r=Object.fromEntries(Object.entries(t).filter(([n])=>n!=="runId"));return Array.from({length:e},(n,o)=>Pe(o===0?t:r))}return Array.from({length:e},()=>Pe(t))}async batch(t,e,r){let n=this._getOptionsList(e??{},t.length),o=n[0]?.maxConcurrency??r?.maxConcurrency,i=new Xo({maxConcurrency:o,onFailedAttempt:a=>{throw a}}),s=t.map((a,c)=>i.call(async()=>{try{return await this.invoke(a,n[c])}catch(u){if(r?.returnExceptions)return u;throw u}}));return Promise.all(s)}async*_streamIterator(t,e){yield this.invoke(t,e)}async stream(t,e){let r=Pe(e),n=new Zi({generator:this._streamIterator(t,r),config:r});return await n.setup,br.fromAsyncGenerator(n)}_separateRunnableConfigFromCallOptions(t){let e;t===void 0?e=Pe(t):e=Pe({callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,runName:t.runName,configurable:t.configurable,recursionLimit:t.recursionLimit,maxConcurrency:t.maxConcurrency,runId:t.runId,timeout:t.timeout,signal:t.signal});let r={...t};return delete r.callbacks,delete r.tags,delete r.metadata,delete r.runName,delete r.configurable,delete r.recursionLimit,delete r.maxConcurrency,delete r.runId,delete r.timeout,delete r.signal,[e,r]}async _callWithConfig(t,e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),Ot(e,"input"),n.runId,n?.runType,void 0,void 0,n?.runName??this.getName());delete n.runId;let s;try{let a=t.call(this,e,n,i);s=await vn(a,r?.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(Ot(s,"output")),s}async _batchWithConfig(t,e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(or)),s=await Promise.all(i.map(async(c,u)=>{let l=await c?.handleChainStart(this.toJSON(),Ot(e[u],"input"),o[u].runId,o[u].runType,void 0,void 0,o[u].runName??this.getName());return delete o[u].runId,l})),a;try{let c=t.call(this,e,o,s,n);a=await vn(c,o?.[0]?.signal)}catch(c){throw await Promise.all(s.map(u=>u?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(Ot(a,"output")))),a}_concatOutputChunks(t,e){return en(t,e)}async*_transformStreamWithConfig(t,e,r){let n,o=!0,i,s=!0,a=Pe(r),c=await or(a),u=this;async function*l(){for await(let f of t){if(o)if(n===void 0)n=f;else try{n=u._concatOutputChunks(n,f)}catch{n=void 0,o=!1}yield f}}let d;try{let f=await m0(e.bind(this),l(),async()=>c?.handleChainStart(this.toJSON(),{input:""},a.runId,a.runType,void 0,void 0,a.runName??this.getName()),r?.signal,a);delete a.runId,d=f.setup;let p=d?.handlers.find(ZR),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(_0);h!==void 0&&d!==void 0&&(m=h.tapOutputIterable(d.runId,m));for await(let _ of m)if(yield _,s)if(i===void 0)i=_;else try{i=this._concatOutputChunks(i,_)}catch{i=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:Ot(n,"input")}),f}await d?.handleChainEnd(i??{},void 0,void 0,void 0,{inputs:Ot(n,"input")})}getGraph(t){let e=new By,r=e.addNode({name:`${this.getName()}Input`,schema:$r.any()}),n=e.addNode(this),o=e.addNode({name:`${this.getName()}Output`,schema:$r.any()});return e.addEdge(r,n),e.addEdge(n,o),e}pipe(t){return new cs({first:this,last:cn(t)})}pick(t){return this.pipe(new q$(t))}assign(t){return this.pipe(new Bp(new us({steps:t})))}async*transform(t,e){let r;for await(let n of t)r===void 0?r=n:r=this._concatOutputChunks(r,n);yield*this._streamIterator(r,Pe(e))}async*streamLog(t,e,r){let n=new sg({...r,autoClose:!1,_schemaFormat:"original"}),o=Pe(e);yield*this._streamLog(t,n,o)}async*_streamLog(t,e,r){let{callbacks:n}=r;if(n===void 0)r.callbacks=[e];else if(Array.isArray(n))r.callbacks=n.concat([e]);else{let a=n.copy();a.addHandler(e,!0),r.callbacks=a}let o=this.stream(t,r);async function i(){try{let a=await o;for await(let c of a){let u=new ho({ops:[{op:"add",path:"/streamed_output/-",value:c}]});await e.writer.write(u)}}finally{await e.writer.close()}}let s=i();try{for await(let a of e)yield a}finally{await s}}streamEvents(t,e,r){let n;if(e.version==="v1")n=this._streamEventsV1(t,e,r);else if(e.version==="v2")n=this._streamEventsV2(t,e,r);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return e.encoding==="text/event-stream"?N1(n):br.fromAsyncGenerator(n)}async*_streamEventsV2(t,e,r){let n=new qR({...r,autoClose:!1}),o=Pe(e),i=o.runId??Et();o.runId=i;let s=o.callbacks;if(s===void 0)o.callbacks=[n];else if(Array.isArray(s))o.callbacks=s.concat(n);else{let p=s.copy();p.addHandler(n,!0),o.callbacks=p}let a=new AbortController,c=this;async function u(){let p,m=null;try{e?.signal?"any"in AbortSignal?p=AbortSignal.any([a.signal,e.signal]):(p=e.signal,m=()=>{a.abort()},e.signal.addEventListener("abort",m,{once:!0})):p=a.signal;let h=await c.stream(t,{...o,signal:p}),_=n.tapOutputIterable(i,h);for await(let v of _)if(a.signal.aborted)break}finally{await n.finish(),p&&m&&p.removeEventListener("abort",m)}}let l=u(),d=!1,f;try{for await(let p of n){if(!d){p.data.input=t,d=!0,f=p.run_id,yield p;continue}p.run_id===f&&p.event.endsWith("_end")&&p.data?.input&&delete p.data.input,yield p}}finally{a.abort(),await l}}async*_streamEventsV1(t,e,r){let n,o=!1,i=Pe(e),s=i.tags??[],a=i.metadata??{},c=i.runName??this.getName(),u=new sg({...r,autoClose:!1,_schemaFormat:"streaming_events"}),l=new KR({...r}),d=this._streamLog(t,u,i);for await(let p of d){if(n?n=n.concat(p):n=ig.fromRunLogPatch(p),n.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!o){o=!0;let v={...n.state},b={run_id:v.id,event:`on_${v.type}_start`,name:c,tags:s,metadata:a,data:{input:t}};l.includeEvent(b,v.type)&&(yield b)}let m=p.ops.filter(v=>v.path.startsWith("/logs/")).map(v=>v.path.split("/")[2]),h=[...new Set(m)];for(let v of h){let b,x={},k=n.state.logs[v];if(k.end_time===void 0?k.streamed_output.length>0?b="stream":b="start":b="end",b==="start")k.inputs!==void 0&&(x.input=k.inputs);else if(b==="end")k.inputs!==void 0&&(x.input=k.inputs),x.output=k.final_output;else if(b==="stream"){let T=k.streamed_output.length;if(T!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${T} instead. Encountered in: "${k.name}"`);x={chunk:k.streamed_output[0]},k.streamed_output=[]}yield{event:`on_${k.type}_${b}`,name:k.name,run_id:k.id,tags:k.tags,metadata:k.metadata,data:x}}let{state:_}=n;if(_.streamed_output.length>0){let v=_.streamed_output.length;if(v!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${v} instead. Encountered in: "${_.name}"`);let b={chunk:_.streamed_output[0]};_.streamed_output=[];let x={event:`on_${_.type}_stream`,run_id:_.id,tags:s,metadata:a,name:c,data:b};l.includeEvent(x,_.type)&&(yield x)}}let f=n?.state;if(f!==void 0){let p={event:`on_${f.type}_end`,name:c,run_id:f.id,tags:s,metadata:a,data:{output:f.final_output}};l.includeEvent(p,f.type)&&(yield p)}}static isRunnable(t){return Hd(t)}withListeners({onStart:t,onEnd:e,onError:r}){return new as({bound:this,config:{},configFactories:[n=>({callbacks:[new y0({config:n,onStart:t,onEnd:e,onError:r})]})]})}asTool(t){return VK(this,t)}},as=class M1 extends Ze{static lc_name(){return"RunnableBinding"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;bound;config;kwargs;configFactories;constructor(e){super(e),this.bound=e.bound,this.kwargs=e.kwargs,this.config=e.config,this.configFactories=e.configFactories}getName(e){return this.bound.getName(e)}async _mergeConfig(...e){let r=ga(this.config,...e);return ga(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new Gy({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:e?.stopAfterAttempt,...e})}async invoke(e,r){return this.bound.invoke(e,await this._mergeConfig(r,this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(Pe(i),this.kwargs))):await this._mergeConfig(Pe(r),this.kwargs);return this.bound.batch(e,o,n)}_concatOutputChunks(e,r){return this.bound._concatOutputChunks(e,r)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(Pe(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(Pe(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(Pe(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(Pe(r),o.kwargs),version:r.version},n)};return br.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&Ze.isRunnable(e.bound)}withListeners({onStart:e,onEnd:r,onError:n}){return new M1({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[o=>({callbacks:[new y0({config:o,onStart:e,onEnd:r,onError:n})]})]})}},j1=class D1 extends Ze{static lc_name(){return"RunnableEach"}lc_serializable=!0;lc_namespace=["langchain_core","runnables"];bound;constructor(e){super(e),this.bound=e.bound}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _invoke(e,r,n){return this.bound.batch(e,Ve(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new D1({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},Gy=class extends as{static lc_name(){return"RunnableRetry"}lc_namespace=["langchain_core","runnables"];maxAttemptNumber=3;onFailedAttempt=()=>{};constructor(t){super(t),this.maxAttemptNumber=t.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=t.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(t,e,r){let n=t>1?`retry:attempt:${t}`:void 0;return Ve(e,{callbacks:r?.getChild(n)})}async _invoke(t,e,r){return Kd(n=>super.invoke(t,this._patchConfigForRetry(n,e,r)),{onFailedAttempt:({error:n})=>this.onFailedAttempt(n,t),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(t,e){return this._callWithConfig(this._invoke.bind(this),t,e)}async _batch(t,e,r,n){let o={};try{await Kd(async i=>{let s=t.map((d,f)=>f).filter(d=>o[d.toString()]===void 0||o[d.toString()]instanceof Error),a=s.map(d=>t[d]),c=s.map(d=>this._patchConfigForRetry(i,e?.[d],r?.[d])),u=await super.batch(a,c,{...n,returnExceptions:!0}),l;for(let d=0;dthis.onFailedAttempt(i,i.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(i){if(n?.returnExceptions!==!0)throw i}return Object.keys(o).sort((i,s)=>parseInt(i,10)-parseInt(s,10)).map(i=>o[parseInt(i,10)])}async batch(t,e,r){return this._batchWithConfig(this._batch.bind(this),t,e,r)}},cs=class Fp extends Ze{static lc_name(){return"RunnableSequence"}first;middle=[];last;omitSequenceTags=!1;lc_serializable=!0;lc_namespace=["langchain_core","runnables"];constructor(e){super(e),this.first=e.first,this.middle=e.middle??this.middle,this.last=e.last,this.name=e.name,this.omitSequenceTags=e.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),Ot(e,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let s=e,a;try{let c=[this.first,...this.middle];for(let u=0;u{let l=await c?.handleChainStart(this.toJSON(),Ot(e[u],"input"),o[u].runId,void 0,void 0,void 0,o[u].runName);return delete o[u].runId,l})),a=e;try{for(let c=0;c{let p=d?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`);return Ve(o[f],{callbacks:p})}),n);a=await vn(l,o[0]?.signal)}}catch(c){throw await Promise.all(s.map(u=>u?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(Ot(a,"output")))),a}_concatOutputChunks(e,r){return this.last._concatOutputChunks(e,r)}async*_streamIterator(e,r){let n=await or(r),{runId:o,...i}=r??{},s=await n?.handleChainStart(this.toJSON(),Ot(e,"input"),o,void 0,void 0,void 0,i?.runName),a=[this.first,...this.middle,this.last],c=!0,u;async function*l(){yield e}try{let d=a[0].transform(l(),Ve(i,{callbacks:s?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let f=1;f{let s=o.getGraph(e);i!==0&&s.trimFirstNode(),i!==this.steps.length-1&&s.trimLastNode(),r.extend(s);let a=s.firstNode();if(!a)throw new Error(`Runnable ${o} has no first node`);n&&r.addEdge(n,a),n=s.lastNode()}),r}pipe(e){return Fp.isRunnableSequence(e)?new Fp({first:this.first,middle:this.middle.concat([this.last,e.first,...e.middle]),last:e.last,name:this.name??e.name}):new Fp({first:this.first,middle:[...this.middle,this.last],last:cn(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&Ze.isRunnable(e)}static from([e,...r],n){let o={};return typeof n=="string"?o.name=n:n!==void 0&&(o=n),new Fp({...o,first:cn(e),middle:r.slice(0,-1).map(cn),last:cn(r[r.length-1])})}},us=class L1 extends Ze{static lc_name(){return"RunnableMap"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;steps;getStepsKeys(){return Object.keys(this.steps)}constructor(e){super(e),this.steps={};for(let[r,n]of Object.entries(e.steps))this.steps[r]=cn(n)}static from(e){return new L1({steps:e})}async invoke(e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),{input:e},n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let s={};try{let a=Object.entries(this.steps).map(async([c,u])=>{s[c]=await u.invoke(e,Ve(n,{callbacks:i?.getChild(`map:key:${c}`)}))});await vn(Promise.all(a),r?.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(s),s}async*_transform(e,r,n){let o={...this.steps},i=Jh(e,Object.keys(o).length),s=new Map(Object.entries(o).map(([a,c],u)=>{let l=c.transform(i[u],Ve(n,{callbacks:r?.getChild(`map:key:${a}`)}));return[a,l.next().then(d=>({key:a,gen:l,result:d}))]}));for(;s.size;){let a=Promise.race(s.values()),{key:c,result:u,gen:l}=await vn(a,n?.signal);s.delete(c),u.done||(yield{[c]:u.value},s.set(c,l.next().then(d=>({key:c,gen:l,result:d}))))}}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Pe(r),i=new Zi({generator:this.transform(n(),o),config:o});return await i.setup,br.fromAsyncGenerator(i)}},ZK=class U1 extends Ze{lc_serializable=!1;lc_namespace=["langchain_core","runnables"];func;constructor(e){if(super(e),!Kh(e.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=e.func}async invoke(e,r){let[n]=this._getOptionsList(r??{},1),o=await or(n),i=this.func(Ve(n,{callbacks:o}),e);return vn(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(Zy(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(z1(o)){for(;;){n?.signal?.throwIfAborted();let i=o.next();if(i.done)break;yield i.value}return}yield o}static from(e){return new U1({func:e})}};function qK(t){if(Kh(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}var Dr=class F1 extends Ze{static lc_name(){return"RunnableLambda"}lc_namespace=["langchain_core","runnables"];func;constructor(e){if(Kh(e.func))return ZK.from(e.func);super(e),qK(e.func),this.func=e.func}static from(e){return new F1({func:e})}async _invoke(e,r,n){return new Promise((o,i)=>{let s=Ve(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??Wh)-1});Lt.runWithConfig(vr(s),async()=>{try{let a=await this.func(e,{...s});if(a&&Ze.isRunnable(a)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");a=await a.invoke(e,{...s,recursionLimit:(s.recursionLimit??Wh)-1})}else if(Zy(a)){let c;for await(let u of qy(s,a))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}a=c}else if(F$(a)){let c;for(let u of B$(s,a))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}a=c}o(a)}catch(a){i(a)}})})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async*_transform(e,r,n){let o;for await(let a of e)if(o===void 0)o=a;else try{o=this._concatOutputChunks(o,a)}catch{o=a}let i=Ve(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??Wh)-1}),s=await new Promise((a,c)=>{Lt.runWithConfig(vr(i),async()=>{try{let u=await this.func(o,{...i,config:i});a(u)}catch(u){c(u)}})});if(s&&Ze.isRunnable(s)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");let a=await s.stream(o,i);for await(let c of a)yield c}else if(Zy(s))for await(let a of qy(i,s))n?.signal?.throwIfAborted(),yield a;else if(F$(s))for(let a of B$(i,s))n?.signal?.throwIfAborted(),yield a;else yield s}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Pe(r),i=new Zi({generator:this.transform(n(),o),config:o});return await i.setup,br.fromAsyncGenerator(i)}},B1=class extends us{},Z$=class extends Ze{static lc_name(){return"RunnableWithFallbacks"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnable;fallbacks;constructor(t){super(t),this.runnable=t.runnable,this.fallbacks=t.fallbacks}*runnables(){yield this.runnable;for(let t of this.fallbacks)yield t}async invoke(t,e){let r=Pe(e),n=await or(r),{runId:o,...i}=r,s=await n?.handleChainStart(this.toJSON(),Ot(t,"input"),o,void 0,void 0,void 0,i?.runName),a=Ve(i,{callbacks:s?.getChild()});return await Lt.runWithConfig(a,async()=>{let u;for(let l of this.runnables()){r?.signal?.throwIfAborted();try{let d=await l.invoke(t,a);return await s?.handleChainEnd(Ot(d,"output")),d}catch(d){u===void 0&&(u=d)}}throw u===void 0?new Error("No error stored at end of fallback."):(await s?.handleChainError(u),u)})}async*_streamIterator(t,e){let r=Pe(e),n=await or(r),{runId:o,...i}=r,s=await n?.handleChainStart(this.toJSON(),Ot(t,"input"),o,void 0,void 0,void 0,i?.runName),a,c;for(let l of this.runnables()){r?.signal?.throwIfAborted();let d=Ve(i,{callbacks:s?.getChild()});try{let f=await l.stream(t,d);c=qy(d,f);break}catch(f){a===void 0&&(a=f)}}if(c===void 0){let l=a??new Error("No error stored at end of fallback.");throw await s?.handleChainError(l),l}let u;try{for await(let l of c){yield l;try{u=u===void 0?u:this._concatOutputChunks(u,l)}catch{u=void 0}}}catch(l){throw await s?.handleChainError(l),l}await s?.handleChainEnd(Ot(u,"output"))}async batch(t,e,r){if(r?.returnExceptions)throw new Error("Not implemented.");let n=this._getOptionsList(e??{},t.length),o=await Promise.all(n.map(a=>or(a))),i=await Promise.all(o.map(async(a,c)=>{let u=await a?.handleChainStart(this.toJSON(),Ot(t[c],"input"),n[c].runId,void 0,void 0,void 0,n[c].runName);return delete n[c].runId,u})),s;for(let a of this.runnables()){n[0].signal?.throwIfAborted();try{let c=await a.batch(t,i.map((u,l)=>Ve(n[l],{callbacks:u?.getChild()})),r);return await Promise.all(i.map((u,l)=>u?.handleChainEnd(Ot(c[l],"output")))),c}catch(c){s===void 0&&(s=c)}}throw s?(await Promise.all(i.map(a=>a?.handleChainError(s))),s):new Error("No error stored at end of fallbacks.")}};function cn(t){if(typeof t=="function")return new Dr({func:t});if(Ze.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=cn(n);return new us({steps:e})}else throw new Error(`Expected a Runnable, function or object. +Instead got an unsupported type.`)}var Bp=class extends Ze{static lc_name(){return"RunnableAssign"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;mapper;constructor(t){t instanceof us&&(t={mapper:t}),super(t),this.mapper=t.mapper}async invoke(t,e){let r=await this.mapper.invoke(t,e);return{...t,...r}}async*_transform(t,e,r){let n=this.mapper.getStepsKeys(),[o,i]=Jh(t),s=this.mapper.transform(i,Ve(r,{callbacks:e?.getChild()})),a=s.next();for await(let c of o){if(typeof c!="object"||Array.isArray(c))throw new Error(`RunnableAssign can only be used with objects as input, got ${typeof c}`);let u=Object.fromEntries(Object.entries(c).filter(([l])=>!n.includes(l)));Object.keys(u).length>0&&(yield u)}yield(await a).value;for await(let c of s)yield c}transform(t,e){return this._transformStreamWithConfig(t,this._transform.bind(this),e)}async stream(t,e){async function*r(){yield t}let n=Pe(e),o=new Zi({generator:this.transform(r(),n),config:n});return await o.setup,br.fromAsyncGenerator(o)}},q$=class extends Ze{static lc_name(){return"RunnablePick"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;keys;constructor(t){(typeof t=="string"||Array.isArray(t))&&(t={keys:t}),super(t),this.keys=t.keys}async _pick(t){if(typeof this.keys=="string")return t[this.keys];{let e=this.keys.map(r=>[r,t[r]]).filter(r=>r[1]!==void 0);return e.length===0?void 0:Object.fromEntries(e)}}async invoke(t,e){return this._callWithConfig(this._pick.bind(this),t,e)}async*_transform(t){for await(let e of t){let r=await this._pick(e);r!==void 0&&(yield r)}}transform(t,e){return this._transformStreamWithConfig(t,this._transform.bind(this),e)}async stream(t,e){async function*r(){yield t}let n=Pe(e),o=new Zi({generator:this.transform(r(),n),config:n});return await o.setup,br.fromAsyncGenerator(o)}},Vy=class extends as{name;description;schema;constructor(t){let e=cs.from([Dr.from(async r=>{let n;if(Mi(r))try{n=await ts(this.schema,r.args)}catch{throw new su("Received tool input did not match expected schema",JSON.stringify(r.args))}else n=r;return n}).withConfig({runName:`${t.name}:parse_input`}),t.bound]).withConfig({runName:t.name});super({bound:e,config:t.config??{}}),this.name=t.name,this.description=t.description,this.schema=t.schema}static lc_name(){return"RunnableToolLike"}};function VK(t,e){let r=e.name??t.getName(),n=e.description??rs(e.schema);return Wu(e.schema)?new Vy({name:r,description:n,schema:$r.object({input:$r.string()}).transform(o=>o.input),bound:t}):new Vy({name:r,description:n,schema:e.schema,bound:t})}var Ky=(t,e)=>{let r=[...new Set(e?.map(o=>{if(typeof o=="string")return o;let i=new o({});if(!("getType"in i)||typeof i.getType!="function")throw new Error("Invalid type provided.");return i.getType()}))],n=t.getType();return r.some(o=>o===n)};function K1(t,e){return Array.isArray(t)?Z1(t,e):Dr.from(r=>Z1(r,t))}function Z1(t,e={}){let{includeNames:r,excludeNames:n,includeTypes:o,excludeTypes:i,includeIds:s,excludeIds:a}=e,c=[];for(let u of t)if(!(n&&u.name&&n.includes(u.name))){{if(i&&Ky(u,i))continue;if(a&&u.id&&a.includes(u.id))continue}o||s||r?(r&&u.name&&r.some(l=>l===u.name)||o&&Ky(u,o)||s&&u.id&&s.some(l=>l===u.id))&&c.push(u):c.push(u)}return c}function H1(t){return Array.isArray(t)?q1(t):Dr.from(q1)}function q1(t){if(!t.length)return[];let e=[];for(let r of t){let n=r,o=e.pop();if(!o)e.push(n);else if(n.getType()==="tool"||n.getType()!==o.getType())e.push(o,n);else{let i=ca(o),s=ca(n),a=i.concat(s);typeof i.content=="string"&&typeof s.content=="string"&&(a.content=`${i.content} +${s.content}`),e.push(KK(a))}}return e}function W1(t,e){if(Array.isArray(t)){let r=t;if(!e)throw new Error("Options parameter is required when providing messages.");return V1(r,e)}else{let r=t;return Dr.from(n=>V1(n,r)).withConfig({runName:"trim_messages"})}}async function V1(t,e){let{maxTokens:r,tokenCounter:n,strategy:o="last",allowPartial:i=!1,endOn:s,startOn:a,includeSystem:c=!1,textSplitter:u}=e;if(a&&o==="first")throw new Error("`startOn` should only be specified if `strategy` is 'last'.");if(c&&o==="first")throw new Error("`includeSystem` should only be specified if `strategy` is 'last'.");let l;"getNumTokens"in n?l=async f=>(await Promise.all(f.map(m=>n.getNumTokens(m.content)))).reduce((m,h)=>m+h,0):l=async f=>n(f);let d=G$;if(u&&("splitText"in u?d=u.splitText:d=async f=>u(f)),o==="first")return J1(t,{maxTokens:r,tokenCounter:l,textSplitter:d,partialStrategy:i?"first":void 0,endOn:s});if(o==="last")return GK(t,{maxTokens:r,tokenCounter:l,textSplitter:d,allowPartial:i,includeSystem:c,startOn:a,endOn:s});throw new Error(`Unrecognized strategy: '${o}'. Must be one of 'first' or 'last'.`)}async function J1(t,e){let{maxTokens:r,tokenCounter:n,textSplitter:o,partialStrategy:i,endOn:s}=e,a=[...t],c=0;for(let u=0;u0?a.slice(0,-u):a;if(await n(l)<=r){c=a.length-u;break}}if(cb!=="type"&&!b.startsWith("lc_"))),_=V$(l.getType(),{...h,content:m}),v=[...a.slice(0,c),_];if(await n(v)<=r)a=v,c+=1,u=!0;else break}u&&i==="last"&&(l.content=[...f].reverse())}if(!u){let l=a[c],d;if(Array.isArray(l.content)&&l.content.some(f=>typeof f=="string"||f.type==="text")?d=l.content.find(p=>p.type==="text"&&p.text)?.text:typeof l.content=="string"&&(d=l.content),d){let f=await o(d),p=f.length;i==="last"&&f.reverse();for(let m=0;m0&&!Ky(a[c-1],u);)c-=1}return a.slice(0,c)}async function GK(t,e){let{allowPartial:r=!1,includeSystem:n=!1,endOn:o,startOn:i,...s}=e,a=t.map(l=>{let d=Object.fromEntries(Object.entries(l).filter(([f])=>f!=="type"&&!f.startsWith("lc_")));return V$(l.getType(),d,iu(l))});if(o){let l=Array.isArray(o)?o:[o];for(;a.length>0&&!Ky(a[a.length-1],l);)a=a.slice(0,-1)}let c=n&&a[0]?.getType()==="system",u=c?a.slice(0,1).concat(a.slice(1).reverse()):a.reverse();return u=await J1(u,{...s,partialStrategy:r?"last":void 0,endOn:i}),c?[u[0],...u.slice(1).reverse()]:u.reverse()}var G1={human:{message:mr,messageChunk:zi},ai:{message:jt,messageChunk:Dt},system:{message:hn,messageChunk:lo},developer:{message:hn,messageChunk:lo},tool:{message:Or,messageChunk:na},function:{message:oa,messageChunk:Ni},generic:{message:jn,messageChunk:Ri},remove:{message:ia,messageChunk:ia}};function V$(t,e,r){let n,o;switch(t){case"human":r?n=new zi(e):o=new mr(e);break;case"ai":if(r){let i={...e};"tool_calls"in i&&(i={...i,tool_call_chunks:i.tool_calls?.map(s=>({...s,type:"tool_call_chunk",index:void 0,args:JSON.stringify(s.args)}))}),n=new Dt(i)}else o=new jt(e);break;case"system":r?n=new lo(e):o=new hn(e);break;case"developer":r?n=new lo({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}}):o=new hn({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in e)r?n=new na(e):o=new Or(e);else throw new Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(r)n=new Ni(e);else{if(!e.name)throw new Error("FunctionMessage must have a 'name' field");o=new oa(e)}break;case"generic":if("role"in e)r?n=new Ri(e):o=new jn(e);else throw new Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw new Error(`Unrecognized message type ${t}`)}if(r&&n)return n;if(o)return o;throw new Error(`Unrecognized message type ${t}`)}function KK(t){let e=t.getType(),r,n=Object.fromEntries(Object.entries(t).filter(([o])=>!["type","tool_call_chunks"].includes(o)&&!o.startsWith("lc_")));if(e in G1&&(r=V$(e,n)),!r)throw new Error(`Unrecognized message chunk class ${e}. Supported classes are ${Object.keys(G1)}`);return r}function G$(t){let e=t.split(` +`);return Promise.resolve([...e.slice(0,-1).map(r=>`${r} +`),e[e.length-1]])}var X1=["tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result"];var Y1=["image","video","audio","text-plain","file"];var Q1=["text","reasoning",...X1,...Y1];var HK={};G(HK,{AIMessage:()=>jt,AIMessageChunk:()=>Dt,BaseMessage:()=>qt,BaseMessageChunk:()=>fr,ChatMessage:()=>jn,ChatMessageChunk:()=>Ri,FunctionMessage:()=>oa,FunctionMessageChunk:()=>Ni,HumanMessage:()=>mr,HumanMessageChunk:()=>zi,KNOWN_BLOCK_TYPES:()=>Q1,RemoveMessage:()=>ia,SystemMessage:()=>hn,SystemMessageChunk:()=>lo,ToolMessage:()=>Or,ToolMessageChunk:()=>na,_isMessageFieldWithRole:()=>ih,_mergeDicts:()=>dt,_mergeLists:()=>ra,_mergeObj:()=>oh,_mergeStatus:()=>nh,coerceMessageLikeToMessage:()=>ji,collapseToolCallChunks:()=>lh,convertToChunk:()=>ca,convertToOpenAIImageBlock:()=>Xm,convertToProviderContentBlock:()=>$d,defaultTextSplitter:()=>G$,defaultToolCallParser:()=>Sd,filterMessages:()=>K1,getBufferString:()=>au,iife:()=>Xw,isAIMessage:()=>aa,isAIMessageChunk:()=>Td,isBase64ContentBlock:()=>ou,isBaseMessage:()=>Yr,isBaseMessageChunk:()=>iu,isChatMessage:()=>WA,isChatMessageChunk:()=>JA,isDataContentBlock:()=>Jr,isDirectToolOutput:()=>Id,isFunctionMessage:()=>XA,isFunctionMessageChunk:()=>YA,isHumanMessage:()=>QA,isHumanMessageChunk:()=>eO,isIDContentBlock:()=>Jm,isMessage:()=>Qm,isOpenAIToolCallArray:()=>VA,isPlainTextContentBlock:()=>bA,isSystemMessage:()=>tO,isSystemMessageChunk:()=>rO,isToolMessage:()=>Gw,isToolMessageChunk:()=>Kw,isURLContentBlock:()=>nu,mapChatMessagesToStoredMessages:()=>dO,mapStoredMessageToChatMessage:()=>Ed,mapStoredMessagesToChatMessages:()=>lO,mergeContent:()=>er,mergeMessageRuns:()=>H1,mergeResponseMetadata:()=>sh,mergeUsageMetadata:()=>ah,parseBase64DataUrl:()=>ta,parseMimeType:()=>Ym,trimMessages:()=>W1});function Zp(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function qp(t){return t!==void 0&&Ze.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function Vp(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(on(t.schema)||t.schema!=null&&typeof t.schema=="object"&&"type"in t.schema&&typeof t.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(t.schema.type))}function qa(t){return Vp(t)||qp(t)||Zp(t)}var JK={};G(JK,{convertToOpenAIFunction:()=>eM,convertToOpenAITool:()=>tM,isLangChainTool:()=>qa,isRunnableToolLike:()=>qp,isStructuredTool:()=>Zp,isStructuredToolParams:()=>Vp});function eM(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:an(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function tM(t,e){let r=typeof e=="number"?void 0:e,n;return qa(t)?n={type:"function",function:eM(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var XK={};G(XK,{extendInteropZodObject:()=>Oz,getInteropZodDefaultGetter:()=>Cz,getInteropZodObjectShape:()=>ky,getSchemaDescription:()=>rs,interopParse:()=>Tz,interopParseAsync:()=>ts,interopSafeParse:()=>kz,interopSafeParseAsync:()=>Ey,interopZodObjectMakeFieldsOptional:()=>Rz,interopZodObjectPartial:()=>Pz,interopZodObjectPassthrough:()=>Ty,interopZodObjectStrict:()=>Hu,interopZodTransformInputSchema:()=>Oy,isInteropZodError:()=>Py,isInteropZodLiteral:()=>Sz,isInteropZodObject:()=>Az,isInteropZodSchema:()=>on,isShapelessZodSchema:()=>Ez,isSimpleStringZodSchema:()=>Wu,isZodArrayV4:()=>Mp,isZodLiteralV3:()=>E$,isZodLiteralV4:()=>A$,isZodNullableV4:()=>P$,isZodObjectV3:()=>Ay,isZodObjectV4:()=>wn,isZodOptionalV4:()=>O$,isZodSchema:()=>Iz,isZodSchemaV3:()=>vt,isZodSchemaV4:()=>nt});var av={};gi(av,{$brand:()=>Jd,$input:()=>D_,$output:()=>j_,NEVER:()=>lg,TimePrecision:()=>B_,ZodAny:()=>cM,ZodArray:()=>pM,ZodBase64:()=>$I,ZodBase64URL:()=>II,ZodBigInt:()=>Xp,ZodBigIntFormat:()=>TI,ZodBoolean:()=>Jp,ZodCIDRv4:()=>wI,ZodCIDRv6:()=>xI,ZodCUID:()=>mI,ZodCUID2:()=>hI,ZodCatch:()=>AM,ZodCodec:()=>zI,ZodCustom:()=>iv,ZodCustomStringFormat:()=>Hp,ZodDate:()=>rv,ZodDefault:()=>$M,ZodDiscriminatedUnion:()=>fM,ZodE164:()=>SI,ZodEmail:()=>dI,ZodEmoji:()=>pI,ZodEnum:()=>Gp,ZodError:()=>QK,ZodFile:()=>bM,ZodFirstPartyTypeKind:()=>jI,ZodFunction:()=>DM,ZodGUID:()=>Yy,ZodIPv4:()=>vI,ZodIPv6:()=>bI,ZodISODate:()=>Wy,ZodISODateTime:()=>Hy,ZodISODuration:()=>Xy,ZodISOTime:()=>Jy,ZodIntersection:()=>mM,ZodIssueCode:()=>aW,ZodJWT:()=>kI,ZodKSUID:()=>yI,ZodLazy:()=>zM,ZodLiteral:()=>vM,ZodMAC:()=>oM,ZodMap:()=>_M,ZodNaN:()=>PM,ZodNanoID:()=>fI,ZodNever:()=>lM,ZodNonOptional:()=>RI,ZodNull:()=>aM,ZodNullable:()=>xM,ZodNumber:()=>Wp,ZodNumberFormat:()=>sl,ZodObject:()=>nv,ZodOptional:()=>CI,ZodPipe:()=>NI,ZodPrefault:()=>SM,ZodPromise:()=>jM,ZodReadonly:()=>CM,ZodRealError:()=>Lr,ZodRecord:()=>OI,ZodSet:()=>yM,ZodString:()=>Kp,ZodStringFormat:()=>et,ZodSuccess:()=>EM,ZodSymbol:()=>iM,ZodTemplateLiteral:()=>NM,ZodTransform:()=>wM,ZodTuple:()=>hM,ZodType:()=>Ae,ZodULID:()=>gI,ZodURL:()=>tv,ZodUUID:()=>oi,ZodUndefined:()=>sM,ZodUnion:()=>AI,ZodUnknown:()=>uM,ZodVoid:()=>dM,ZodXID:()=>_I,_ZodString:()=>lI,_default:()=>IM,_function:()=>eW,any:()=>DH,array:()=>Re,base64:()=>wH,base64url:()=>xH,bigint:()=>RH,boolean:()=>Nt,catch:()=>OM,check:()=>tW,cidrv4:()=>vH,cidrv6:()=>bH,clone:()=>Qe,codec:()=>XH,coerce:()=>DI,config:()=>yt,core:()=>nn,cuid:()=>dH,cuid2:()=>pH,custom:()=>MI,date:()=>UH,decode:()=>rI,decodeAsync:()=>oI,describe:()=>rW,discriminatedUnion:()=>ov,e164:()=>$H,email:()=>tH,emoji:()=>uH,encode:()=>tI,encodeAsync:()=>nI,endsWith:()=>Bu,enum:()=>zt,file:()=>KH,flattenError:()=>yu,float32:()=>AH,float64:()=>OH,formatError:()=>vu,function:()=>eW,getErrorMap:()=>uW,globalRegistry:()=>Ge,gt:()=>yo,gte:()=>ir,guid:()=>rH,hash:()=>EH,hex:()=>TH,hostname:()=>kH,httpUrl:()=>cH,includes:()=>Uu,instanceof:()=>oW,int:()=>uI,int32:()=>PH,int64:()=>NH,intersection:()=>Qp,ipv4:()=>gH,ipv6:()=>yH,iso:()=>il,json:()=>sW,jwt:()=>IH,keyof:()=>FH,ksuid:()=>hH,lazy:()=>MM,length:()=>Sa,literal:()=>se,locales:()=>Ou,looseObject:()=>un,lowercase:()=>Du,lt:()=>_o,lte:()=>zr,mac:()=>_H,map:()=>qH,maxLength:()=>Ia,maxSize:()=>$a,meta:()=>nW,mime:()=>Zu,minLength:()=>Qo,minSize:()=>es,multipleOf:()=>Qi,nan:()=>JH,nanoid:()=>lH,nativeEnum:()=>GH,negative:()=>hy,never:()=>EI,nonnegative:()=>_y,nonoptional:()=>TM,nonpositive:()=>gy,normalize:()=>qu,null:()=>Yp,nullable:()=>Qy,nullish:()=>HH,number:()=>We,object:()=>U,optional:()=>ie,overwrite:()=>Zn,parse:()=>X$,parseAsync:()=>Y$,partialRecord:()=>ZH,pipe:()=>ev,positive:()=>my,prefault:()=>kM,preprocess:()=>sv,prettifyError:()=>mg,promise:()=>QH,property:()=>yy,readonly:()=>RM,record:()=>bt,refine:()=>LM,regex:()=>ju,regexes:()=>Nr,registry:()=>fp,safeDecode:()=>sI,safeDecodeAsync:()=>cI,safeEncode:()=>iI,safeEncodeAsync:()=>aI,safeParse:()=>Q$,safeParseAsync:()=>eI,set:()=>VH,setErrorMap:()=>cW,size:()=>Mu,slugify:()=>Np,startsWith:()=>Fu,strictObject:()=>BH,string:()=>A,stringFormat:()=>SH,stringbool:()=>iW,success:()=>WH,superRefine:()=>UM,symbol:()=>MH,templateLiteral:()=>YH,toJSONSchema:()=>vo,toLowerCase:()=>Gu,toUpperCase:()=>Ku,transform:()=>PI,treeifyError:()=>fg,trim:()=>Vu,tuple:()=>gM,uint32:()=>CH,uint64:()=>zH,ulid:()=>fH,undefined:()=>jH,union:()=>tt,unknown:()=>ft,uppercase:()=>Lu,url:()=>aH,util:()=>M,uuid:()=>nH,uuidv4:()=>oH,uuidv6:()=>iH,uuidv7:()=>sH,void:()=>LH,xid:()=>mH});var il={};gi(il,{ZodISODate:()=>Wy,ZodISODateTime:()=>Hy,ZodISODuration:()=>Xy,ZodISOTime:()=>Jy,date:()=>H$,datetime:()=>K$,duration:()=>J$,time:()=>W$});var Hy=$("ZodISODateTime",(t,e)=>{Bg.init(t,e),et.init(t,e)});function K$(t){return Z_(Hy,t)}var Wy=$("ZodISODate",(t,e)=>{Zg.init(t,e),et.init(t,e)});function H$(t){return q_(Wy,t)}var Jy=$("ZodISOTime",(t,e)=>{qg.init(t,e),et.init(t,e)});function W$(t){return V_(Jy,t)}var Xy=$("ZodISODuration",(t,e)=>{Vg.init(t,e),et.init(t,e)});function J$(t){return G_(Xy,t)}var nM=(t,e)=>{np.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>vu(t,r)},flatten:{value:r=>yu(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,hu,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,hu,2)}},isEmpty:{get(){return t.issues.length===0}}})},QK=$("ZodError",nM),Lr=$("ZodError",nM,{Parent:Error});var X$=bu(Lr),Y$=wu(Lr),Q$=xu(Lr),eI=$u(Lr),tI=hg(Lr),rI=gg(Lr),nI=_g(Lr),oI=yg(Lr),iI=vg(Lr),sI=bg(Lr),aI=wg(Lr),cI=xg(Lr);var Ae=$("ZodType",(t,e)=>(ye.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(M.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>Qe(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>X$(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Q$(t,r,n),t.parseAsync=async(r,n)=>Y$(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>eI(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>tI(t,r,n),t.decode=(r,n)=>rI(t,r,n),t.encodeAsync=async(r,n)=>nI(t,r,n),t.decodeAsync=async(r,n)=>oI(t,r,n),t.safeEncode=(r,n)=>iI(t,r,n),t.safeDecode=(r,n)=>sI(t,r,n),t.safeEncodeAsync=async(r,n)=>aI(t,r,n),t.safeDecodeAsync=async(r,n)=>cI(t,r,n),t.refine=(r,n)=>t.check(LM(r,n)),t.superRefine=r=>t.check(UM(r)),t.overwrite=r=>t.check(Zn(r)),t.optional=()=>ie(t),t.nullable=()=>Qy(t),t.nullish=()=>ie(Qy(t)),t.nonoptional=r=>TM(t,r),t.array=()=>Re(t),t.or=r=>tt([t,r]),t.and=r=>Qp(t,r),t.transform=r=>ev(t,PI(r)),t.default=r=>IM(t,r),t.prefault=r=>kM(t,r),t.catch=r=>OM(t,r),t.pipe=r=>ev(t,r),t.readonly=()=>RM(t),t.describe=r=>{let n=t.clone();return Ge.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ge.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ge.get(t);let n=t.clone();return Ge.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),lI=$("_ZodString",(t,e)=>{Yi.init(t,e),Ae.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(ju(...n)),t.includes=(...n)=>t.check(Uu(...n)),t.startsWith=(...n)=>t.check(Fu(...n)),t.endsWith=(...n)=>t.check(Bu(...n)),t.min=(...n)=>t.check(Qo(...n)),t.max=(...n)=>t.check(Ia(...n)),t.length=(...n)=>t.check(Sa(...n)),t.nonempty=(...n)=>t.check(Qo(1,...n)),t.lowercase=n=>t.check(Du(n)),t.uppercase=n=>t.check(Lu(n)),t.trim=()=>t.check(Vu()),t.normalize=(...n)=>t.check(qu(...n)),t.toLowerCase=()=>t.check(Gu()),t.toUpperCase=()=>t.check(Ku()),t.slugify=()=>t.check(Np())}),Kp=$("ZodString",(t,e)=>{Yi.init(t,e),lI.init(t,e),t.email=r=>t.check(mp(dI,r)),t.url=r=>t.check(Ru(tv,r)),t.jwt=r=>t.check(Rp(kI,r)),t.emoji=r=>t.check(vp(pI,r)),t.guid=r=>t.check(Cu(Yy,r)),t.uuid=r=>t.check(hp(oi,r)),t.uuidv4=r=>t.check(gp(oi,r)),t.uuidv6=r=>t.check(_p(oi,r)),t.uuidv7=r=>t.check(yp(oi,r)),t.nanoid=r=>t.check(bp(fI,r)),t.guid=r=>t.check(Cu(Yy,r)),t.cuid=r=>t.check(wp(mI,r)),t.cuid2=r=>t.check(xp(hI,r)),t.ulid=r=>t.check($p(gI,r)),t.base64=r=>t.check(Op($I,r)),t.base64url=r=>t.check(Pp(II,r)),t.xid=r=>t.check(Ip(_I,r)),t.ksuid=r=>t.check(Sp(yI,r)),t.ipv4=r=>t.check(kp(vI,r)),t.ipv6=r=>t.check(Tp(bI,r)),t.cidrv4=r=>t.check(Ep(wI,r)),t.cidrv6=r=>t.check(Ap(xI,r)),t.e164=r=>t.check(Cp(SI,r)),t.datetime=r=>t.check(K$(r)),t.date=r=>t.check(H$(r)),t.time=r=>t.check(W$(r)),t.duration=r=>t.check(J$(r))});function A(t){return L_(Kp,t)}var et=$("ZodStringFormat",(t,e)=>{He.init(t,e),lI.init(t,e)}),dI=$("ZodEmail",(t,e)=>{Rg.init(t,e),et.init(t,e)});function tH(t){return mp(dI,t)}var Yy=$("ZodGUID",(t,e)=>{Pg.init(t,e),et.init(t,e)});function rH(t){return Cu(Yy,t)}var oi=$("ZodUUID",(t,e)=>{Cg.init(t,e),et.init(t,e)});function nH(t){return hp(oi,t)}function oH(t){return gp(oi,t)}function iH(t){return _p(oi,t)}function sH(t){return yp(oi,t)}var tv=$("ZodURL",(t,e)=>{Ng.init(t,e),et.init(t,e)});function aH(t){return Ru(tv,t)}function cH(t){return Ru(tv,{protocol:/^https?$/,hostname:Nr.domain,...M.normalizeParams(t)})}var pI=$("ZodEmoji",(t,e)=>{zg.init(t,e),et.init(t,e)});function uH(t){return vp(pI,t)}var fI=$("ZodNanoID",(t,e)=>{Mg.init(t,e),et.init(t,e)});function lH(t){return bp(fI,t)}var mI=$("ZodCUID",(t,e)=>{jg.init(t,e),et.init(t,e)});function dH(t){return wp(mI,t)}var hI=$("ZodCUID2",(t,e)=>{Dg.init(t,e),et.init(t,e)});function pH(t){return xp(hI,t)}var gI=$("ZodULID",(t,e)=>{Lg.init(t,e),et.init(t,e)});function fH(t){return $p(gI,t)}var _I=$("ZodXID",(t,e)=>{Ug.init(t,e),et.init(t,e)});function mH(t){return Ip(_I,t)}var yI=$("ZodKSUID",(t,e)=>{Fg.init(t,e),et.init(t,e)});function hH(t){return Sp(yI,t)}var vI=$("ZodIPv4",(t,e)=>{Gg.init(t,e),et.init(t,e)});function gH(t){return kp(vI,t)}var oM=$("ZodMAC",(t,e)=>{Hg.init(t,e),et.init(t,e)});function _H(t){return F_(oM,t)}var bI=$("ZodIPv6",(t,e)=>{Kg.init(t,e),et.init(t,e)});function yH(t){return Tp(bI,t)}var wI=$("ZodCIDRv4",(t,e)=>{Wg.init(t,e),et.init(t,e)});function vH(t){return Ep(wI,t)}var xI=$("ZodCIDRv6",(t,e)=>{Jg.init(t,e),et.init(t,e)});function bH(t){return Ap(xI,t)}var $I=$("ZodBase64",(t,e)=>{Xg.init(t,e),et.init(t,e)});function wH(t){return Op($I,t)}var II=$("ZodBase64URL",(t,e)=>{Yg.init(t,e),et.init(t,e)});function xH(t){return Pp(II,t)}var SI=$("ZodE164",(t,e)=>{Qg.init(t,e),et.init(t,e)});function $H(t){return Cp(SI,t)}var kI=$("ZodJWT",(t,e)=>{e_.init(t,e),et.init(t,e)});function IH(t){return Rp(kI,t)}var Hp=$("ZodCustomStringFormat",(t,e)=>{t_.init(t,e),et.init(t,e)});function SH(t,e,r={}){return ka(Hp,t,e,r)}function kH(t){return ka(Hp,"hostname",Nr.hostname,t)}function TH(t){return ka(Hp,"hex",Nr.hex,t)}function EH(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=Nr[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return ka(Hp,n,o,e)}var Wp=$("ZodNumber",(t,e)=>{ap.init(t,e),Ae.init(t,e),t.gt=(n,o)=>t.check(yo(n,o)),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.lt=(n,o)=>t.check(_o(n,o)),t.lte=(n,o)=>t.check(zr(n,o)),t.max=(n,o)=>t.check(zr(n,o)),t.int=n=>t.check(uI(n)),t.safe=n=>t.check(uI(n)),t.positive=n=>t.check(yo(0,n)),t.nonnegative=n=>t.check(ir(0,n)),t.negative=n=>t.check(_o(0,n)),t.nonpositive=n=>t.check(zr(0,n)),t.multipleOf=(n,o)=>t.check(Qi(n,o)),t.step=(n,o)=>t.check(Qi(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function We(t){return K_(Wp,t)}var sl=$("ZodNumberFormat",(t,e)=>{r_.init(t,e),Wp.init(t,e)});function uI(t){return W_(sl,t)}function AH(t){return J_(sl,t)}function OH(t){return X_(sl,t)}function PH(t){return Y_(sl,t)}function CH(t){return Q_(sl,t)}var Jp=$("ZodBoolean",(t,e)=>{ku.init(t,e),Ae.init(t,e)});function Nt(t){return ey(Jp,t)}var Xp=$("ZodBigInt",(t,e)=>{cp.init(t,e),Ae.init(t,e),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.gt=(n,o)=>t.check(yo(n,o)),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.lt=(n,o)=>t.check(_o(n,o)),t.lte=(n,o)=>t.check(zr(n,o)),t.max=(n,o)=>t.check(zr(n,o)),t.positive=n=>t.check(yo(BigInt(0),n)),t.negative=n=>t.check(_o(BigInt(0),n)),t.nonpositive=n=>t.check(zr(BigInt(0),n)),t.nonnegative=n=>t.check(ir(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(Qi(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function RH(t){return ry(Xp,t)}var TI=$("ZodBigIntFormat",(t,e)=>{n_.init(t,e),Xp.init(t,e)});function NH(t){return oy(TI,t)}function zH(t){return iy(TI,t)}var iM=$("ZodSymbol",(t,e)=>{o_.init(t,e),Ae.init(t,e)});function MH(t){return sy(iM,t)}var sM=$("ZodUndefined",(t,e)=>{i_.init(t,e),Ae.init(t,e)});function jH(t){return ay(sM,t)}var aM=$("ZodNull",(t,e)=>{s_.init(t,e),Ae.init(t,e)});function Yp(t){return cy(aM,t)}var cM=$("ZodAny",(t,e)=>{a_.init(t,e),Ae.init(t,e)});function DH(){return uy(cM)}var uM=$("ZodUnknown",(t,e)=>{Tu.init(t,e),Ae.init(t,e)});function ft(){return Nu(uM)}var lM=$("ZodNever",(t,e)=>{Eu.init(t,e),Ae.init(t,e)});function EI(t){return zu(lM,t)}var dM=$("ZodVoid",(t,e)=>{c_.init(t,e),Ae.init(t,e)});function LH(t){return ly(dM,t)}var rv=$("ZodDate",(t,e)=>{u_.init(t,e),Ae.init(t,e),t.min=(n,o)=>t.check(ir(n,o)),t.max=(n,o)=>t.check(zr(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function UH(t){return dy(rv,t)}var pM=$("ZodArray",(t,e)=>{l_.init(t,e),Ae.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Qo(r,n)),t.nonempty=r=>t.check(Qo(1,r)),t.max=(r,n)=>t.check(Ia(r,n)),t.length=(r,n)=>t.check(Sa(r,n)),t.unwrap=()=>t.element});function Re(t,e){return T$(pM,t,e)}function FH(t){let e=t._zod.def.shape;return zt(Object.keys(e))}var nv=$("ZodObject",(t,e)=>{k$.init(t,e),Ae.init(t,e),M.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>zt(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ft()}),t.loose=()=>t.clone({...t._zod.def,catchall:ft()}),t.strict=()=>t.clone({...t._zod.def,catchall:EI()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>M.extend(t,r),t.safeExtend=r=>M.safeExtend(t,r),t.merge=r=>M.merge(t,r),t.pick=r=>M.pick(t,r),t.omit=r=>M.omit(t,r),t.partial=(...r)=>M.partial(CI,t,r[0]),t.required=(...r)=>M.required(RI,t,r[0])});function U(t,e){let r={type:"object",shape:t??{},...M.normalizeParams(e)};return new nv(r)}function BH(t,e){return new nv({type:"object",shape:t,catchall:EI(),...M.normalizeParams(e)})}function un(t,e){return new nv({type:"object",shape:t,catchall:ft(),...M.normalizeParams(e)})}var AI=$("ZodUnion",(t,e)=>{up.init(t,e),Ae.init(t,e),t.options=e.options});function tt(t,e){return new AI({type:"union",options:t,...M.normalizeParams(e)})}var fM=$("ZodDiscriminatedUnion",(t,e)=>{AI.init(t,e),d_.init(t,e)});function ov(t,e,r){return new fM({type:"union",options:e,discriminator:t,...M.normalizeParams(r)})}var mM=$("ZodIntersection",(t,e)=>{p_.init(t,e),Ae.init(t,e)});function Qp(t,e){return new mM({type:"intersection",left:t,right:e})}var hM=$("ZodTuple",(t,e)=>{lp.init(t,e),Ae.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});function gM(t,e,r){let n=e instanceof ye,o=n?r:e,i=n?e:null;return new hM({type:"tuple",items:t,rest:i,...M.normalizeParams(o)})}var OI=$("ZodRecord",(t,e)=>{f_.init(t,e),Ae.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function bt(t,e,r){return new OI({type:"record",keyType:t,valueType:e,...M.normalizeParams(r)})}function ZH(t,e,r){let n=Qe(t);return n._zod.values=void 0,new OI({type:"record",keyType:n,valueType:e,...M.normalizeParams(r)})}var _M=$("ZodMap",(t,e)=>{m_.init(t,e),Ae.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function qH(t,e,r){return new _M({type:"map",keyType:t,valueType:e,...M.normalizeParams(r)})}var yM=$("ZodSet",(t,e)=>{h_.init(t,e),Ae.init(t,e),t.min=(...r)=>t.check(es(...r)),t.nonempty=r=>t.check(es(1,r)),t.max=(...r)=>t.check($a(...r)),t.size=(...r)=>t.check(Mu(...r))});function VH(t,e){return new yM({type:"set",valueType:t,...M.normalizeParams(e)})}var Gp=$("ZodEnum",(t,e)=>{g_.init(t,e),Ae.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Gp({...e,checks:[],...M.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Gp({...e,checks:[],...M.normalizeParams(o),entries:i})}});function zt(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Gp({type:"enum",entries:r,...M.normalizeParams(e)})}function GH(t,e){return new Gp({type:"enum",entries:t,...M.normalizeParams(e)})}var vM=$("ZodLiteral",(t,e)=>{__.init(t,e),Ae.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function se(t,e){return new vM({type:"literal",values:Array.isArray(t)?t:[t],...M.normalizeParams(e)})}var bM=$("ZodFile",(t,e)=>{y_.init(t,e),Ae.init(t,e),t.min=(r,n)=>t.check(es(r,n)),t.max=(r,n)=>t.check($a(r,n)),t.mime=(r,n)=>t.check(Zu(Array.isArray(r)?r:[r],n))});function KH(t){return vy(bM,t)}var wM=$("ZodTransform",(t,e)=>{v_.init(t,e),Ae.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(M.issue(i,r.value,e));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(M.issue(s))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function PI(t){return new wM({type:"transform",transform:t})}var CI=$("ZodOptional",(t,e)=>{xa.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function ie(t){return new CI({type:"optional",innerType:t})}var xM=$("ZodNullable",(t,e)=>{b_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Qy(t){return new xM({type:"nullable",innerType:t})}function HH(t){return ie(Qy(t))}var $M=$("ZodDefault",(t,e)=>{w_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function IM(t,e){return new $M({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var SM=$("ZodPrefault",(t,e)=>{x_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function kM(t,e){return new SM({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var RI=$("ZodNonOptional",(t,e)=>{$_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function TM(t,e){return new RI({type:"nonoptional",innerType:t,...M.normalizeParams(e)})}var EM=$("ZodSuccess",(t,e)=>{I_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function WH(t){return new EM({type:"success",innerType:t})}var AM=$("ZodCatch",(t,e)=>{S_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function OM(t,e){return new AM({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var PM=$("ZodNaN",(t,e)=>{k_.init(t,e),Ae.init(t,e)});function JH(t){return fy(PM,t)}var NI=$("ZodPipe",(t,e)=>{T_.init(t,e),Ae.init(t,e),t.in=e.in,t.out=e.out});function ev(t,e){return new NI({type:"pipe",in:t,out:e})}var zI=$("ZodCodec",(t,e)=>{NI.init(t,e),Au.init(t,e)});function XH(t,e,r){return new zI({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var CM=$("ZodReadonly",(t,e)=>{E_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function RM(t){return new CM({type:"readonly",innerType:t})}var NM=$("ZodTemplateLiteral",(t,e)=>{A_.init(t,e),Ae.init(t,e)});function YH(t,e){return new NM({type:"template_literal",parts:t,...M.normalizeParams(e)})}var zM=$("ZodLazy",(t,e)=>{C_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.getter()});function MM(t){return new zM({type:"lazy",getter:t})}var jM=$("ZodPromise",(t,e)=>{P_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function QH(t){return new jM({type:"promise",innerType:t})}var DM=$("ZodFunction",(t,e)=>{O_.init(t,e),Ae.init(t,e)});function eW(t){return new DM({type:"function",input:Array.isArray(t?.input)?gM(t?.input):t?.input??Re(ft()),output:t?.output??ft()})}var iv=$("ZodCustom",(t,e)=>{R_.init(t,e),Ae.init(t,e)});function tW(t){let e=new Je({check:"custom"});return e._zod.check=t,e}function MI(t,e){return by(iv,t??(()=>!0),e)}function LM(t,e={}){return wy(iv,t,e)}function UM(t){return xy(t)}var rW=$y,nW=Iy;function oW(t,e={error:`Input not instance of ${t.name}`}){let r=new iv({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...M.normalizeParams(e)});return r._zod.bag.Class=t,r}var iW=(...t)=>Sy({Codec:zI,Boolean:Jp,String:Kp},...t);function sW(t){let e=MM(()=>tt([A(t),We(),Nt(),Yp(),Re(e),bt(A(),e)]));return e}function sv(t,e){return ev(PI(t),e)}var aW={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function cW(t){yt({customError:t})}function uW(){return yt().customError}var jI;jI||(jI={});var DI={};gi(DI,{bigint:()=>fW,boolean:()=>pW,date:()=>mW,number:()=>dW,string:()=>lW});function lW(t){return U_(Kp,t)}function dW(t){return H_(Wp,t)}function pW(t){return ty(Jp,t)}function fW(t){return ny(Xp,t)}function mW(t){return py(rv,t)}yt(N_());var hW=Symbol("Let zodToJsonSchema decide on which parser to use");var bW={};G(bW,{BasePromptValue:()=>cv,ChatPromptValue:()=>UI,ImagePromptValue:()=>wW,StringPromptValue:()=>LI});var cv=class extends uo{},LI=class extends cv{static lc_name(){return"StringPromptValue"}lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;value;constructor(t){super({value:t}),this.value=t}toString(){return this.value}toChatMessages(){return[new mr(this.value)]}},UI=class extends cv{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ChatPromptValue"}messages;constructor(t){Array.isArray(t)&&(t={messages:t}),super(t),this.messages=t.messages}toString(){return au(this.messages)}toChatMessages(){return this.messages}},wW=class extends cv{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ImagePromptValue"}imageUrl;value;constructor(t){"imageUrl"in t||(t={imageUrl:t}),super(t),this.imageUrl=t.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new mr({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}};var te="0123456789abcdef".split(""),xW=[-2147483648,8388608,32768,128],Hn=[24,16,8,0],uv=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Ut=[];function Wn(t,e){e?(Ut[0]=Ut[16]=Ut[1]=Ut[2]=Ut[3]=Ut[4]=Ut[5]=Ut[6]=Ut[7]=Ut[8]=Ut[9]=Ut[10]=Ut[11]=Ut[12]=Ut[13]=Ut[14]=Ut[15]=0,this.blocks=Ut):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}Wn.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if(r!=="string"){if(r==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);e=!0}for(var n,o=0,i,s=t.length,a=this.blocks;o>>2]|=t[o]<>>2]|=n<>>2]|=(192|n>>>6)<>>2]|=(128|n&63)<=57344?(a[i>>>2]|=(224|n>>>12)<>>2]|=(128|n>>>6&63)<>>2]|=(128|n&63)<>>2]|=(240|n>>>18)<>>2]|=(128|n>>>12&63)<>>2]|=(128|n>>>6&63)<>>2]|=(128|n&63)<=64?(this.block=a[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};Wn.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=xW[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}};Wn.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=this.blocks,u,l,d,f,p,m,h,_,v,b,x;for(u=16;u<64;++u)p=c[u-15],l=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=c[u-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,c[u]=c[u-16]+l+c[u-7]+d<<0;for(x=e&r,u=0;u<64;u+=4)this.first?(this.is224?(_=300032,p=c[0]-1413257819,a=p-150054599<<0,n=p+24177077<<0):(_=704751109,p=c[0]-210244248,a=p-1521486534<<0,n=p+143694565<<0),this.first=!1):(l=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),_=t&e,f=_^t&r^x,h=o&i^~o&s,p=a+d+h+uv[u]+c[u],m=l+f,a=n+p<<0,n=p+m<<0),l=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),v=n&t,f=v^n&e^_,h=s&a^~s&o,p=i+d+h+uv[u+1]+c[u+1],m=l+f,s=r+p<<0,r=p+m<<0,l=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=r&n,f=b^r&t^v,h=i&s^~i&a,p=o+d+h+uv[u+2]+c[u+2],m=l+f,i=e+p<<0,e=p+m<<0,l=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),x=e&r,f=x^e&n^b,h=i&s^~i&a,p=o+d+h+uv[u+3]+c[u+3],m=l+f,o=t+p<<0,t=p+m<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0,this.h5=this.h5+i<<0,this.h6=this.h6+s<<0,this.h7=this.h7+a<<0};Wn.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=te[t>>>28&15]+te[t>>>24&15]+te[t>>>20&15]+te[t>>>16&15]+te[t>>>12&15]+te[t>>>8&15]+te[t>>>4&15]+te[t&15]+te[e>>>28&15]+te[e>>>24&15]+te[e>>>20&15]+te[e>>>16&15]+te[e>>>12&15]+te[e>>>8&15]+te[e>>>4&15]+te[e&15]+te[r>>>28&15]+te[r>>>24&15]+te[r>>>20&15]+te[r>>>16&15]+te[r>>>12&15]+te[r>>>8&15]+te[r>>>4&15]+te[r&15]+te[n>>>28&15]+te[n>>>24&15]+te[n>>>20&15]+te[n>>>16&15]+te[n>>>12&15]+te[n>>>8&15]+te[n>>>4&15]+te[n&15]+te[o>>>28&15]+te[o>>>24&15]+te[o>>>20&15]+te[o>>>16&15]+te[o>>>12&15]+te[o>>>8&15]+te[o>>>4&15]+te[o&15]+te[i>>>28&15]+te[i>>>24&15]+te[i>>>20&15]+te[i>>>16&15]+te[i>>>12&15]+te[i>>>8&15]+te[i>>>4&15]+te[i&15]+te[s>>>28&15]+te[s>>>24&15]+te[s>>>20&15]+te[s>>>16&15]+te[s>>>12&15]+te[s>>>8&15]+te[s>>>4&15]+te[s&15];return this.is224||(c+=te[a>>>28&15]+te[a>>>24&15]+te[a>>>20&15]+te[a>>>16&15]+te[a>>>12&15]+te[a>>>8&15]+te[a>>>4&15]+te[a&15]),c};Wn.prototype.toString=Wn.prototype.hex;Wn.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=[t>>>24&255,t>>>16&255,t>>>8&255,t&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255];return this.is224||c.push(a>>>24&255,a>>>16&255,a>>>8&255,a&255),c};Wn.prototype.array=Wn.prototype.digest;Wn.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};var lv=(...t)=>new Wn(!1,!0).update(t.join("")).hex();var $W={};G($W,{sha256:()=>lv});var IW={};G(IW,{BaseCache:()=>ZM,InMemoryCache:()=>FI,defaultHashKeyEncoder:()=>BM,deserializeStoredGeneration:()=>SW,serializeGeneration:()=>kW});var BM=(...t)=>lv(t.join("_"));function SW(t){return t.message!==void 0?{text:t.text,message:Ed(t.message)}:{text:t.text}}function kW(t){let e={text:t.text};return t.message!==void 0&&(e.message=t.message.toDict()),e}var ZM=class{keyEncoder=BM;makeDefaultKeyEncoder(t){this.keyEncoder=t}},TW=new Map,FI=class qM extends ZM{cache;constructor(e){super(),this.cache=e??new Map}lookup(e,r){return Promise.resolve(this.cache.get(this.keyEncoder(e,r))??null)}async update(e,r,n){this.cache.set(this.keyEncoder(e,r),n)}static global(){return new qM(TW)}};var HM=mn(KM(),1),zW=Object.defineProperty,MW=(t,e,r)=>e in t?zW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jW=(t,e,r)=>(MW(t,typeof e!="symbol"?e+"":e,r),r);function DW(t,e){let r=Array.from({length:t.length},(n,o)=>({start:o,end:o+1}));for(;r.length>1;){let n=null;for(let o=0;oe.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function UW(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}var ZI=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(t,e){this.patStr=t.pat_str;let r=t.bpe_ranks.split(` +`).filter(Boolean).reduce((n,o)=>{let[i,s,...a]=o.split(" "),c=Number.parseInt(s,10);return a.forEach((u,l)=>n[u]=c+l),n},{});for(let[n,o]of Object.entries(r)){let i=HM.default.toByteArray(n);this.rankMap.set(i.join(","),o),this.textMap.set(o,i)}this.specialTokens={...t.special_tokens,...e},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((n,[o,i])=>(n[i]=this.textEncoder.encode(o),n),{})}encode(t,e=[],r="all"){let n=new RegExp(this.patStr,"ug"),o=ZI.specialTokenRegex(Object.keys(this.specialTokens)),i=[],s=new Set(e==="all"?Object.keys(this.specialTokens):e),a=new Set(r==="all"?Object.keys(this.specialTokens).filter(u=>!s.has(u)):r);if(a.size>0){let u=ZI.specialTokenRegex([...a]),l=t.match(u);if(l!=null)throw new Error(`The text contains a special token that is not allowed: ${l[0]}`)}let c=0;for(;;){let u=null,l=c;for(;o.lastIndex=l,u=o.exec(t),!(u==null||s.has(u[0]));)l=u.index+1;let d=u?.index??t.length;for(let p of t.substring(c,d).matchAll(n)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){i.push(h);continue}i.push(...LW(m,this.rankMap))}if(u==null)break;let f=this.specialTokens[u[0]];i.push(f),c=u.index+u[0].length}return i}decode(t){let e=[],r=0;for(let i=0;inew RegExp(t.map(e=>UW(e)).join("|"),"g"));function qI(t){switch(t){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw new Error("Unknown model")}}var FW={};G(FW,{encodingForModel:()=>mv,getEncoding:()=>WM});var fv={},BW=new Xo({});async function WM(t){return t in fv||(fv[t]=BW.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new pv(e)).catch(e=>{throw delete fv[t],e})),await fv[t]}async function mv(t){return WM(qI(t))}var ZW={};G(ZW,{BaseLangChain:()=>_v,BaseLanguageModel:()=>tf,calculateMaxTokens:()=>XM,getEmbeddingContextSize:()=>qW,getModelContextSize:()=>JM,getModelNameForTiktoken:()=>hv,isOpenAITool:()=>gv});var hv=t=>t.startsWith("gpt-5")?"gpt-5":t.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":t.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":t.startsWith("gpt-4-32k")?"gpt-4-32k":t.startsWith("gpt-4-")?"gpt-4":t.startsWith("gpt-4o")?"gpt-4o":t,qW=t=>{switch(t){case"text-embedding-ada-002":return 8191;default:return 2046}},JM=t=>{switch(hv(t)){case"gpt-5":case"gpt-5-turbo":case"gpt-5-turbo-preview":return 4e5;case"gpt-4o":case"gpt-4o-mini":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":return 128e3;case"gpt-4-turbo":case"gpt-4-turbo-preview":case"gpt-4-turbo-2024-04-09":case"gpt-4-0125-preview":case"gpt-4-1106-preview":return 128e3;case"gpt-4-32k":case"gpt-4-32k-0314":case"gpt-4-32k-0613":return 32768;case"gpt-4":case"gpt-4-0314":case"gpt-4-0613":return 8192;case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-16k-0613":return 16384;case"gpt-3.5-turbo":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-1106":case"gpt-3.5-turbo-0125":return 4096;case"text-davinci-003":case"text-davinci-002":return 4097;case"text-davinci-001":return 2049;case"text-curie-001":case"text-babbage-001":case"text-ada-001":return 2048;case"code-davinci-002":case"code-davinci-001":return 8e3;case"code-cushman-001":return 2048;case"claude-3-5-sonnet-20241022":case"claude-3-5-sonnet-20240620":case"claude-3-opus-20240229":case"claude-3-sonnet-20240229":case"claude-3-haiku-20240307":case"claude-2.1":return 2e5;case"claude-2.0":case"claude-instant-1.2":return 1e5;case"gemini-1.5-pro":case"gemini-1.5-pro-latest":case"gemini-1.5-flash":case"gemini-1.5-flash-latest":return 1e6;case"gemini-pro":case"gemini-pro-vision":return 32768;default:return 4097}};function gv(t){return typeof t!="object"||!t?!1:!!("type"in t&&t.type==="function"&&"function"in t&&typeof t.function=="object"&&t.function&&"name"in t.function&&"parameters"in t.function)}var XM=async({prompt:t,modelName:e})=>{let r;try{r=(await mv(hv(e))).encode(t).length}catch{console.warn("Failed to calculate number of tokens, falling back to approximate count"),r=Math.ceil(t.length/4)}return JM(e)-r},VW=()=>!1,_v=class extends Ze{verbose;callbacks;tags;metadata;get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(t){super(t),this.verbose=t.verbose??VW(),this.callbacks=t.callbacks,this.tags=t.tags??[],this.metadata=t.metadata??{}}},tf=class extends _v{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}caller;cache;constructor({callbacks:t,callbackManager:e,...r}){let{cache:n,...o}=r;super({callbacks:t??e,...o}),typeof n=="object"?this.cache=n:n?this.cache=FI.global():this.cache=void 0,this.caller=new Xo(r??{})}_encoding;async getNumTokens(t){let e;typeof t=="string"?e=t:e=t.map(n=>typeof n=="string"?n:n.type==="text"&&"text"in n?n.text:"").join("");let r=Math.ceil(e.length/4);if(!this._encoding)try{this._encoding=await mv("modelName"in this?hv(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(e).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(t){return typeof t=="string"?new LI(t):Array.isArray(t)?new UI(t.map(ji)):t}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:t,...e}){let r={...this._identifyingParams(),...e,_type:this._llmType(),_model:this._modelType()};return Object.entries(r).filter(([i,s])=>s!==void 0).map(([i,s])=>`${i}:${JSON.stringify(s)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(t){throw new Error("Use .toJSON() instead")}get profile(){return{}}};var ii=class extends Ze{static lc_name(){return"RunnablePassthrough"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;func;constructor(t){super(t),t&&(this.func=t.func)}async invoke(t,e){let r=Pe(e);return this.func&&await this.func(t,r),this._callWithConfig(n=>Promise.resolve(n),t,r)}async*transform(t,e){let r=Pe(e),n,o=!0;for await(let i of this._transformStreamWithConfig(t,s=>s,r))if(yield i,o)if(n===void 0)n=i;else try{n=en(n,i)}catch{n=void 0,o=!1}this.func&&n!==void 0&&await this.func(n,r)}static assign(t){return new Bp(new us({steps:t}))}};var YM=t=>t();function yv(t){let e=t.constructor;return new e({...t,content:t.contentBlocks,response_metadata:{...t.response_metadata,output_version:"v1"}})}var GW={};G(GW,{BaseChatModel:()=>vv,SimpleChatModel:()=>KW});function VI(t){let e=[];for(let r of t){let n=r;if(Array.isArray(r.content))for(let o=0;o{let r=e.outputVersion??It("LC_OUTPUT_VERSION");return r&&["v0","v1"].includes(r)?r:"v0"})}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async invoke(e,r){let n=Ga._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].message}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}async*_streamIterator(e,r){if(this._streamResponseChunks===Ga.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(e,r);else{let o=Ga._convertInputToPromptValue(e).toChatMessages(),[i,s]=this._separateRunnableConfigFromCallOptionsCompat(r),a={...i.metadata,...this.getLsParams(s)},c=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,a,this.metadata,{verbose:this.verbose}),u={options:s,invocation_params:this?.invocationParams(s),batch_size:1},l=s.outputVersion??this.outputVersion,d=await c?.handleChatModelStart(this.toJSON(),[VI(o)],i.runId,void 0,u,void 0,void 0,i.runName),f,p;try{for await(let m of this._streamResponseChunks(o,s,d?.[0])){if(m.message.id==null){let h=d?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}m.message.response_metadata={...m.generationInfo,...m.message.response_metadata},l==="v1"?yield yv(m.message):yield m.message,f?f=f.concat(m):f=m,Td(m.message)&&m.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:m.message.usage_metadata.input_tokens,completionTokens:m.message.usage_metadata.output_tokens,totalTokens:m.message.usage_metadata.total_tokens}})}}catch(m){throw await Promise.all((d??[]).map(h=>h?.handleLLMError(m))),m}await Promise.all((d??[]).map(m=>m?.handleLLMEnd({generations:[[f]],llmOutput:p})))}}getLsParams(e){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:r}}async _generateUncached(e,r,n,o){let i=e.map(f=>f.map(ji)),s;if(o!==void 0&&o.length===i.length)s=o;else{let f={...n.metadata,...this.getLsParams(r)},p=await St.configure(n.callbacks,this.callbacks,n.tags,this.tags,f,this.metadata,{verbose:this.verbose}),m={options:r,invocation_params:this?.invocationParams(r),batch_size:1};s=await p?.handleChatModelStart(this.toJSON(),i.map(VI),n.runId,void 0,m,void 0,void 0,n.runName)}let a=r.outputVersion??this.outputVersion,c=[],u=[];if(!!s?.[0].handlers.find(Od)&&!this.disableStreaming&&i.length===1&&this._streamResponseChunks!==Ga.prototype._streamResponseChunks)try{let f=await this._streamResponseChunks(i[0],r,s?.[0]),p,m;for await(let h of f){if(h.message.id==null){let _=s?.at(0)?.runId;_!=null&&h.message._updateId(`run-${_}`)}p===void 0?p=h:p=en(p,h),Td(h.message)&&h.message.usage_metadata!==void 0&&(m={tokenUsage:{promptTokens:h.message.usage_metadata.input_tokens,completionTokens:h.message.usage_metadata.output_tokens,totalTokens:h.message.usage_metadata.total_tokens}})}if(p===void 0)throw new Error("Received empty response from chat model call.");c.push([p]),await s?.[0].handleLLMEnd({generations:c,llmOutput:m})}catch(f){throw await s?.[0].handleLLMError(f),f}else{let f=await Promise.allSettled(i.map(async(p,m)=>{let h=await this._generate(p,{...r,promptIndex:m},s?.[m]);if(a==="v1")for(let _ of h.generations)_.message=yv(_.message);return h}));await Promise.all(f.map(async(p,m)=>{if(p.status==="fulfilled"){let h=p.value;for(let _ of h.generations){if(_.message.id==null){let v=s?.at(0)?.runId;v!=null&&_.message._updateId(`run-${v}`)}_.message.response_metadata={..._.generationInfo,..._.message.response_metadata}}return h.generations.length===1&&(h.generations[0].message.response_metadata={...h.llmOutput,...h.generations[0].message.response_metadata}),c[m]=h.generations,u[m]=h.llmOutput,s?.[m]?.handleLLMEnd({generations:[h.generations],llmOutput:h.llmOutput})}else return await s?.[m]?.handleLLMError(p.reason),Promise.reject(p.reason)}))}let d={generations:c,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(d,ya,{value:s?{runIds:s?.map(f=>f.runId)}:void 0,configurable:!0}),d}async _generateCached({messages:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i}){let s=e.map(v=>v.map(ji)),a={...i.metadata,...this.getLsParams(o)},c=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,a,this.metadata,{verbose:this.verbose}),u={options:o,invocation_params:this?.invocationParams(o),batch_size:1},l=await c?.handleChatModelStart(this.toJSON(),s.map(VI),i.runId,void 0,u,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(s.map(async(v,b)=>{let x=Ga._convertInputToPromptValue(v).toString(),k=await r.lookup(x,n);return k==null&&d.push(b),k}))).map((v,b)=>({result:v,runManager:l?.[b]})).filter(({result:v})=>v.status==="fulfilled"&&v.value!=null||v.status==="rejected"),m=o.outputVersion??this.outputVersion,h=[];await Promise.all(p.map(async({result:v,runManager:b},x)=>{if(v.status==="fulfilled"){let k=v.value;return h[x]=k.map(T=>("message"in T&&Yr(T.message)&&aa(T.message)&&(T.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},m==="v1"&&(T.message=yv(T.message))),T.generationInfo={...T.generationInfo,tokenUsage:{}},T)),k.length&&await b?.handleLLMNewToken(k[0].text),b?.handleLLMEnd({generations:[k]},void 0,void 0,void 0,{cached:!0})}else return await b?.handleLLMError(v.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(v.reason)}));let _={generations:h,missingPromptIndices:d,startedRunManagers:l};return Object.defineProperty(_,ya,{value:l?{runIds:l?.map(v=>v.runId)}:void 0,configurable:!0}),_}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(m=>m.map(ji)),[s,a]=this._separateRunnableConfigFromCallOptionsCompat(o);if(s.callbacks=s.callbacks??n,!this.cache)return this._generateUncached(i,a,s);let{cache:c}=this,u=this._getSerializedCacheKeyParametersForCall(a),{generations:l,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:i,cache:c,llmStringKey:u,parsedOptions:a,handledOptions:s}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>i[h]),a,s,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,_)=>{let v=d[_];l[v]=h;let b=Ga._convertInputToPromptValue(i[v]).toString();return c.update(b,u,h)})),p=m.llmOutput??{}}return{generations:l,llmOutput:p}}invocationParams(e){return{}}_modelType(){return"base_chat_model"}async generatePrompt(e,r,n){let o=e.map(i=>i.toChatMessages());return this.generate(o,r,n)}withStructuredOutput(e,r){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(r?.strict)throw new Error('"strict" mode is not supported for this model by default.');let n=e,o=r?.name,i=rs(n)??"A function available to call.",s=r?.method,a=r?.includeRaw;if(s==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let c=o??"extract",u;on(n)?u=[{type:"function",function:{name:c,description:i,parameters:an(n)}}]:("name"in n&&(c=n.name),u=[{type:"function",function:{name:c,description:i,parameters:n}}]);let l=this.bindTools(u),d=Dr.from(h=>{if(!Dt.isInstance(h))throw new Error("Input is not an AIMessageChunk.");if(!h.tool_calls||h.tool_calls.length===0)throw new Error("No tool calls found in the response.");let _=h.tool_calls.find(v=>v.name===c);if(!_)throw new Error(`No tool call found with name ${c}.`);return _.args});if(!a)return l.pipe(d).withConfig({runName:"StructuredOutput"});let f=ii.assign({parsed:(h,_)=>d.invoke(h.raw,_)}),p=ii.assign({parsed:()=>null}),m=f.withFallbacks({fallbacks:[p]});return cs.from([{raw:l},m]).withConfig({runName:"StructuredOutputRunnable"})}},KW=class extends vv{async _generate(t,e,r){let n=await this._call(t,e,r),o=new jt(n);if(typeof o.content!="string")throw new Error("Cannot generate with a simple chat model when output is not a string.");return{generations:[{text:o.content,message:o}]}}};var QM=class extends Ze{static lc_name(){return"RouterRunnable"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnables;constructor(t){super(t),this.runnables=t.runnables}async invoke(t,e){let{key:r,input:n}=t,o=this.runnables[r];if(o===void 0)throw new Error(`No runnable associated with key "${r}".`);return o.invoke(n,Pe(e))}async batch(t,e,r){let n=t.map(d=>d.key),o=t.map(d=>d.input);if(n.find(d=>this.runnables[d]===void 0)!==void 0)throw new Error("One or more keys do not have a corresponding runnable.");let s=n.map(d=>this.runnables[d]),a=this._getOptionsList(e??{},t.length),c=a[0]?.maxConcurrency??r?.maxConcurrency,u=c&&c>0?c:t.length,l=[];for(let d=0;ds[h].invoke(m,a[h])),p=await Promise.all(f);l.push(p)}return l.flat()}async stream(t,e){let{key:r,input:n}=t,o=this.runnables[r];if(o===void 0)throw new Error(`No runnable associated with key "${r}".`);return o.stream(n,e)}};var ej=class extends Ze{static lc_name(){return"RunnableBranch"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;default;branches;constructor(t){super(t),this.branches=t.branches,this.default=t.default}static from(t){if(t.length<1)throw new Error("RunnableBranch requires at least one branch");let r=t.slice(0,-1).map(([o,i])=>[cn(o),cn(i)]),n=cn(t[t.length-1]);return new this({branches:r,default:n})}async _invoke(t,e,r){let n;for(let o=0;othis._enterHistory(i,s??{})).withConfig({runName:"loadHistory"}),r=t.historyMessagesKey??t.inputMessagesKey;r&&(e=ii.assign({[r]:e}).withConfig({runName:"insertHistory"}));let n=e.pipe(t.runnable.withListeners({onEnd:(i,s)=>this._exitHistory(i,s??{})})).withConfig({runName:"RunnableWithMessageHistory"}),o=t.config??{};super({...t,config:o,bound:n}),this.runnable=t.runnable,this.getMessageHistory=t.getMessageHistory,this.inputMessagesKey=t.inputMessagesKey,this.outputMessagesKey=t.outputMessagesKey,this.historyMessagesKey=t.historyMessagesKey}_getInputMessages(t){let e;if(typeof t=="object"&&!Array.isArray(t)&&!Yr(t)){let r;this.inputMessagesKey?r=this.inputMessagesKey:Object.keys(t).length===1?r=Object.keys(t)[0]:r="input",Array.isArray(t[r])&&Array.isArray(t[r][0])?e=t[r][0]:e=t[r]}else e=t;if(typeof e=="string")return[new mr(e)];if(Array.isArray(e))return e;if(Yr(e))return[e];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. +Got ${JSON.stringify(e,null,2)}`)}_getOutputMessages(t){let e;if(!Array.isArray(t)&&!Yr(t)&&typeof t!="string"){let r;this.outputMessagesKey!==void 0?r=this.outputMessagesKey:Object.keys(t).length===1?r=Object.keys(t)[0]:r="output",t.generations!==void 0?e=t.generations[0][0].message:e=t[r]}else e=t;if(typeof e=="string")return[new jt(e)];if(Array.isArray(e))return e;if(Yr(e))return[e];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. Received: ${JSON.stringify(e,null,2)}`)}async _enterHistory(t,e){let n=await(e?.configurable?.messageHistory).getMessages();return this.historyMessagesKey===void 0?n.concat(this._getInputMessages(t)):n}async _exitHistory(t,e){let r=e.configurable?.messageHistory,n;Array.isArray(t.inputs)&&Array.isArray(t.inputs[0])?n=t.inputs[0]:n=t.inputs;let o=this._getInputMessages(n);if(this.historyMessagesKey===void 0){let a=await r.getMessages();o=o.slice(a.length)}let i=t.outputs;if(!i)throw new Error(`Output values from 'Run' undefined. Run: ${JSON.stringify(t,null,2)}`);let s=this._getOutputMessages(i);await r.addMessages([...o,...s])}async _mergeConfig(...t){let e=await super._mergeConfig(...t);if(!e.configurable||!e.configurable.sessionId){let n={[this.inputMessagesKey??"input"]:"foo"},o={configurable:{sessionId:"123"}};throw new Error(`sessionId is required. Pass it in as part of the config argument to .invoke() or .stream() +eg. chain.invoke(${JSON.stringify(n)}, ${JSON.stringify(o)})`)}let{sessionId:r}=e.configurable;return e.configurable.messageHistory=await this.getMessageHistory(r),e}};var HW={};G(HW,{RouterRunnable:()=>QM,Runnable:()=>Ze,RunnableAssign:()=>Bp,RunnableBinding:()=>as,RunnableBranch:()=>ej,RunnableEach:()=>j1,RunnableLambda:()=>Dr,RunnableMap:()=>us,RunnableParallel:()=>B1,RunnablePassthrough:()=>ii,RunnablePick:()=>q$,RunnableRetry:()=>Gy,RunnableSequence:()=>cs,RunnableToolLike:()=>Vy,RunnableWithFallbacks:()=>Z$,RunnableWithMessageHistory:()=>tj,_coerceToRunnable:()=>cn,ensureConfig:()=>Pe,getCallbackManagerForConfig:()=>or,mergeConfigs:()=>ga,patchConfig:()=>Ve,pickRunnableConfigKeys:()=>vr,raceWithSignal:()=>vn});var GI=class extends Ze{parseResultWithPrompt(t,e,r){return this.parseResult(t,r)}_baseMessageToString(t){return typeof t.content=="string"?t.content:this._baseMessageContentToString(t.content)}_baseMessageContentToString(t){return JSON.stringify(t)}async invoke(t,e){return typeof t=="string"?this._callWithConfig(async(r,n)=>this.parseResult([{text:r}],n?.callbacks),t,{...e,runType:"parser"}):this._callWithConfig(async(r,n)=>this.parseResult([{message:r,text:this._baseMessageToString(r)}],n?.callbacks),t,{...e,runType:"parser"})}},Ka=class extends GI{parseResult(t,e){return this.parse(t[0].text,e)}async parseWithPrompt(t,e,r){return this.parse(t,r)}_type(){throw new Error("_type not implemented")}},ln=class extends Error{llmOutput;observation;sendToLLM;constructor(t,e,r,n=!1){if(super(t),this.llmOutput=e,this.observation=r,this.sendToLLM=n,n&&(r===void 0||e===void 0))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");uh(this,"OUTPUT_PARSING_FAILURE")}};var si=class extends Ka{async*_transform(t){for await(let e of t)typeof e=="string"?yield this.parseResult([{text:e}]):yield this.parseResult([{message:e,text:this._baseMessageToString(e)}])}async*transform(t,e){yield*this._transformStreamWithConfig(t,this._transform.bind(this),{...e,runType:"parser"})}},ls=class extends si{diff=!1;constructor(t){super(t),this.diff=t?.diff??this.diff}async*_transform(t){let e,r;for await(let n of t){if(typeof n!="string"&&typeof n.content!="string")throw new Error("Cannot handle non-string output.");let o;if(iu(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");o=new Vi({message:n,text:n.content})}else if(Yr(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");o=new Vi({message:ca(n),text:n.content})}else o=new go({text:n});r===void 0?r=o:r=r.concat(o);let i=await this.parsePartialResult([r]);i!=null&&!$o(i,e)&&(this.diff?yield this._diff(e,i):yield i,e=i)}}getFormatInstructions(){return""}};var WW={};G(WW,{applyPatch:()=>qi,compare:()=>mu});var KI=class extends ls{static lc_name(){return"JsonOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_concatOutputChunks(t,e){return this.diff?super._concatOutputChunks(t,e):e}_diff(t,e){if(e)return t?mu(t,e):[{op:"replace",path:"",value:e}]}async parsePartialResult(t){return kd(t[0].text)}async parse(t){return kd(t,JSON.parse)}getFormatInstructions(){return""}};var rj=class extends si{static lc_name(){return"BytesOutputParser"}lc_namespace=["langchain_core","output_parsers","bytes"];lc_serializable=!0;textEncoder=new TextEncoder;parse(t){return Promise.resolve(this.textEncoder.encode(t))}getFormatInstructions(){return""}};var al=class extends si{re;async*_transform(t){let e="";for await(let r of t)if(typeof r=="string"?e+=r:e+=r.content,this.re){let n=[...e.matchAll(this.re)];if(n.length>1){let o=0;for(let i of n.slice(0,-1))yield[i[1]],o+=(i.index??0)+i[0].length;e=e.slice(o)}}else{let n=await this.parse(e);if(n.length>1){for(let o of n.slice(0,-1))yield[o];e=n[n.length-1]}}for(let r of await this.parse(e))yield[r]}},nj=class extends al{static lc_name(){return"CommaSeparatedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;async parse(t){try{return t.trim().split(",").map(e=>e.trim())}catch{throw new ln(`Could not parse output: ${t}`,t)}}getFormatInstructions(){return"Your response should be a list of comma separated values, eg: `foo, bar, baz`"}},oj=class extends al{lc_namespace=["langchain_core","output_parsers","list"];length;separator;constructor({length:t,separator:e}){super(...arguments),this.length=t,this.separator=e||","}async parse(t){try{let e=t.trim().split(this.separator).map(r=>r.trim());if(this.length!==void 0&&e.length!==this.length)throw new ln(`Incorrect number of items. Expected ${this.length}, got ${e.length}.`);return e}catch(e){throw Object.getPrototypeOf(e)===ln.prototype?e:new ln(`Could not parse output: ${t}`)}}getFormatInstructions(){return`Your response should be a list of ${this.length===void 0?"":`${this.length} `}items separated by "${this.separator}" (eg: \`foo${this.separator} bar${this.separator} baz\`)`}},ij=class extends al{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example: + +1. foo + +2. bar + +3. baz`}re=/\d+\.\s([^\n]+)/g;async parse(t){return[...t.matchAll(this.re)??[]].map(e=>e[1])}},sj=class extends al{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example: + +1. foo + +2. bar + +3. baz`}re=/^\s*[-*]\s([^\n]+)$/gm;async parse(t){return[...t.matchAll(this.re)??[]].map(e=>e[1])}};var aj=class extends si{static lc_name(){return"StrOutputParser"}lc_namespace=["langchain_core","output_parsers","string"];lc_serializable=!0;parse(t){return Promise.resolve(t)}getFormatInstructions(){return""}_textContentToString(t){return t.text}_imageUrlContentToString(t){throw new Error('Cannot coerce a multimodal "image_url" message part into a string.')}_messageContentToString(t){switch(t.type){case"text":case"text_delta":if("text"in t)return this._textContentToString(t);break;case"image_url":if("image_url"in t)return this._imageUrlContentToString(t);break;default:throw new Error(`Cannot coerce "${t.type}" message part into a string.`)}throw new Error(`Invalid content type: ${t.type}`)}_baseMessageContentToString(t){return t.reduce((e,r)=>e+this._messageContentToString(r),"")}};var bv=class extends Ka{static lc_name(){return"StructuredOutputParser"}lc_namespace=["langchain","output_parsers","structured"];toJSON(){return this.toJSONNotImplemented()}constructor(t){super(t),this.schema=t}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=$r.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,$r.string().describe(n)])));return new this(e)}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance. + +"JSON Schema" is a declarative language that allows you to annotate and validate JSON documents. + +For example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}} +would match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings. +Thus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted. + +Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas! + +Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock: +\`\`\`json +${JSON.stringify(an(this.schema))} +\`\`\` +`}async parse(t){try{let e=t.trim(),n=(e.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||e.match(/```json\s*([\s\S]*?)```/)?.[1]||e).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(o,i)=>`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await ts(this.schema,JSON.parse(n))}catch(e){throw new ln(`Failed to parse. Text: "${t}". Error: ${e}`,t)}}},HI=class extends bv{static lc_name(){return"JsonMarkdownStructuredOutputParser"}getFormatInstructions(t){let e=t?.interpolationDepth??1;if(e<1)throw new Error("f string interpolation depth must be at least 1");return`Return a markdown code snippet with a JSON object formatted to look like: +\`\`\`json +${this._schemaToInstruction(an(this.schema)).replaceAll("{","{".repeat(e)).replaceAll("}","}".repeat(e))} +\`\`\``}_schemaToInstruction(t,e=2){let r=t;if("type"in r){let n=!1,o;if(Array.isArray(r.type)){let a=r.type.findIndex(c=>c==="null");a!==-1&&(n=!0,r.type.splice(a,1)),o=r.type.join(" | ")}else o=r.type;if(r.type==="object"&&r.properties){let a=r.description?` // ${r.description}`:"";return`{ +${Object.entries(r.properties).map(([u,l])=>{let d=r.required?.includes(u)?"":" (optional)";return`${" ".repeat(e)}"${u}": ${this._schemaToInstruction(l,e+2)}${d}`}).join(` +`)} +${" ".repeat(e-2)}}${a}`}if(r.type==="array"&&r.items){let a=r.description?` // ${r.description}`:"";return`array[ +${" ".repeat(e)}${this._schemaToInstruction(r.items,e+2)} +${" ".repeat(e-2)}] ${a}`}let i=n?" (nullable)":"",s=r.description?` // ${r.description}`:"";return`${o}${s}${i}`}if("anyOf"in r)return r.anyOf.map(n=>this._schemaToInstruction(n,e)).join(` +${" ".repeat(e-2)}`);throw new Error("unsupported schema type")}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=$r.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,$r.string().describe(n)])));return new this(e)}},cj=class extends Ka{structuredInputParser;constructor({inputSchema:t}){super(...arguments),this.structuredInputParser=new HI(t)}async parse(t){let e;try{e=await this.structuredInputParser.parse(t)}catch(r){throw new ln(`Failed to parse. Text: "${t}". Error: ${r}`,t)}return this.outputProcessor(e)}getFormatInstructions(){return this.structuredInputParser.getFormatInstructions()}};var JW=function(){let t={};t.parser=function(y,g){return new r(y,g)},t.SAXParser=r,t.SAXStream=u,t.createStream=c,t.MAX_BUFFER_LENGTH=65536;let e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(y,g){if(!(this instanceof r))return new r(y,g);var R=this;o(R),R.q=R.c="",R.bufferCheckPosition=t.MAX_BUFFER_LENGTH,R.opt=g||{},R.opt.lowercase=R.opt.lowercase||R.opt.lowercasetags,R.looseCase=R.opt.lowercase?"toLowerCase":"toUpperCase",R.tags=[],R.closed=R.closedRoot=R.sawRoot=!1,R.tag=R.error=null,R.strict=!!y,R.noscript=!!(y||R.opt.noscript),R.state=w.BEGIN,R.strictEntities=R.opt.strictEntities,R.ENTITIES=R.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),R.attribList=[],R.opt.xmlns&&(R.ns=Object.create(m)),R.trackPosition=R.opt.position!==!1,R.trackPosition&&(R.position=R.line=R.column=0),oe(R,"onready")}Object.create||(Object.create=function(y){function g(){}g.prototype=y;var R=new g;return R}),Object.keys||(Object.keys=function(y){var g=[];for(var R in y)y.hasOwnProperty(R)&&g.push(R);return g});function n(y){for(var g=Math.max(t.MAX_BUFFER_LENGTH,10),R=0,I=0,ze=e.length;Ig)switch(e[I]){case"textNode":wt(y);break;case"cdata":Q(y,"oncdata",y.cdata),y.cdata="";break;case"script":Q(y,"onscript",y.script),y.script="";break;default:pn(y,"Max buffer length exceeded: "+e[I])}R=Math.max(R,Ye)}var it=t.MAX_BUFFER_LENGTH-R;y.bufferCheckPosition=it+y.position}function o(y){for(var g=0,R=e.length;g"||x(y)}function F(y,g){return y.test(g)}function J(y,g){return!F(y,g)}var w=0;t.STATE={BEGIN:w++,BEGIN_WHITESPACE:w++,TEXT:w++,TEXT_ENTITY:w++,OPEN_WAKA:w++,SGML_DECL:w++,SGML_DECL_QUOTED:w++,DOCTYPE:w++,DOCTYPE_QUOTED:w++,DOCTYPE_DTD:w++,DOCTYPE_DTD_QUOTED:w++,COMMENT_STARTING:w++,COMMENT:w++,COMMENT_ENDING:w++,COMMENT_ENDED:w++,CDATA:w++,CDATA_ENDING:w++,CDATA_ENDING_2:w++,PROC_INST:w++,PROC_INST_BODY:w++,PROC_INST_ENDING:w++,OPEN_TAG:w++,OPEN_TAG_SLASH:w++,ATTRIB:w++,ATTRIB_NAME:w++,ATTRIB_NAME_SAW_WHITE:w++,ATTRIB_VALUE:w++,ATTRIB_VALUE_QUOTED:w++,ATTRIB_VALUE_CLOSED:w++,ATTRIB_VALUE_UNQUOTED:w++,ATTRIB_VALUE_ENTITY_Q:w++,ATTRIB_VALUE_ENTITY_U:w++,CLOSE_TAG:w++,CLOSE_TAG_SAW_WHITE:w++,SCRIPT:w++,SCRIPT_ENDING:w++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(y){var g=t.ENTITIES[y],R=typeof g=="number"?String.fromCharCode(g):g;t.ENTITIES[y]=R});for(var Z in t.STATE)t.STATE[t.STATE[Z]]=Z;w=t.STATE;function oe(y,g,R){y[g]&&y[g](R)}function Q(y,g,R){y.textNode&&wt(y),oe(y,g,R)}function wt(y){y.textNode=dn(y.opt,y.textNode),y.textNode&&oe(y,"ontext",y.textNode),y.textNode=""}function dn(y,g){return y.trim&&(g=g.trim()),y.normalize&&(g=g.replace(/\s+/g," ")),g}function pn(y,g){return wt(y),y.trackPosition&&(g+=` +Line: `+y.line+` +Column: `+y.column+` +Char: `+y.c),g=new Error(g),y.error=g,oe(y,"onerror",g),y}function No(y){return y.sawRoot&&!y.closedRoot&&qe(y,"Unclosed root tag"),y.state!==w.BEGIN&&y.state!==w.BEGIN_WHITESPACE&&y.state!==w.TEXT&&pn(y,"Unexpected end"),wt(y),y.c="",y.closed=!0,oe(y,"onend"),r.call(y,y.strict,y.opt),y}function qe(y,g){if(typeof y!="object"||!(y instanceof r))throw new Error("bad call to strictFail");y.strict&&pn(y,g)}function Ul(y){y.strict||(y.tagName=y.tagName[y.looseCase]());var g=y.tags[y.tags.length-1]||y,R=y.tag={name:y.tagName,attributes:{}};y.opt.xmlns&&(R.ns=g.ns),y.attribList.length=0,Q(y,"onopentagstart",R)}function Ss(y,g){var R=y.indexOf(":"),I=R<0?["",y]:y.split(":"),ze=I[0],Ye=I[1];return g&&y==="xmlns"&&(ze="xmlns",Ye=""),{prefix:ze,local:Ye}}function ks(y){if(y.strict||(y.attribName=y.attribName[y.looseCase]()),y.attribList.indexOf(y.attribName)!==-1||y.tag.attributes.hasOwnProperty(y.attribName)){y.attribName=y.attribValue="";return}if(y.opt.xmlns){var g=Ss(y.attribName,!0),R=g.prefix,I=g.local;if(R==="xmlns")if(I==="xml"&&y.attribValue!==f)qe(y,"xml: prefix must be bound to "+f+` +Actual: `+y.attribValue);else if(I==="xmlns"&&y.attribValue!==p)qe(y,"xmlns: prefix must be bound to "+p+` +Actual: `+y.attribValue);else{var ze=y.tag,Ye=y.tags[y.tags.length-1]||y;ze.ns===Ye.ns&&(ze.ns=Object.create(Ye.ns)),ze.ns[I]=y.attribValue}y.attribList.push([y.attribName,y.attribValue])}else y.tag.attributes[y.attribName]=y.attribValue,Q(y,"onattribute",{name:y.attribName,value:y.attribValue});y.attribName=y.attribValue=""}function Pn(y,g){if(y.opt.xmlns){var R=y.tag,I=Ss(y.tagName);R.prefix=I.prefix,R.local=I.local,R.uri=R.ns[I.prefix]||"",R.prefix&&!R.uri&&(qe(y,"Unbound namespace prefix: "+JSON.stringify(y.tagName)),R.uri=I.prefix);var ze=y.tags[y.tags.length-1]||y;R.ns&&ze.ns!==R.ns&&Object.keys(R.ns).forEach(function(Ts){Q(y,"onopennamespace",{prefix:Ts,uri:R.ns[Ts]})});for(var Ye=0,it=y.attribList.length;Ye",y.tagName="",y.state=w.SCRIPT;return}Q(y,"onscript",y.script),y.script=""}var g=y.tags.length,R=y.tagName;y.strict||(R=R[y.looseCase]());for(var I=R;g--;){var ze=y.tags[g];if(ze.name!==I)qe(y,"Unexpected close tag");else break}if(g<0){qe(y,"Unmatched closing tag: "+y.tagName),y.textNode+="",y.state=w.TEXT;return}y.tagName=R;for(var Ye=y.tags.length;Ye-- >g;){var it=y.tag=y.tags.pop();y.tagName=y.tag.name,Q(y,"onclosetag",y.tagName);var Tt={};for(var Bt in it.ns)Tt[Bt]=it.ns[Bt];var Rn=y.tags[y.tags.length-1]||y;y.opt.xmlns&&it.ns!==Rn.ns&&Object.keys(it.ns).forEach(function(ht){var fn=it.ns[ht];Q(y,"onclosenamespace",{prefix:ht,uri:fn})})}g===0&&(y.closedRoot=!0),y.tagName=y.attribValue=y.attribName="",y.attribList.length=0,y.state=w.TEXT}function Fl(y){var g=y.entity,R=g.toLowerCase(),I,ze="";return y.ENTITIES[g]?y.ENTITIES[g]:y.ENTITIES[R]?y.ENTITIES[R]:(g=R,g.charAt(0)==="#"&&(g.charAt(1)==="x"?(g=g.slice(2),I=parseInt(g,16),ze=I.toString(16)):(g=g.slice(1),I=parseInt(g,10),ze=I.toString(10))),g=g.replace(/^0+/,""),isNaN(I)||ze.toLowerCase()!==g?(qe(y,"Invalid character entity"),"&"+y.entity+";"):String.fromCodePoint(I))}function Bl(y,g){g==="<"?(y.state=w.OPEN_WAKA,y.startTagPosition=y.position):x(g)||(qe(y,"Non-whitespace before first tag."),y.textNode=g,y.state=w.TEXT)}function Zl(y,g){var R="";return g"?(Q(g,"onsgmldeclaration",g.sgmlDecl),g.sgmlDecl="",g.state=w.TEXT):(k(I)&&(g.state=w.SGML_DECL_QUOTED),g.sgmlDecl+=I);continue;case w.SGML_DECL_QUOTED:I===g.q&&(g.state=w.SGML_DECL,g.q=""),g.sgmlDecl+=I;continue;case w.DOCTYPE:I===">"?(g.state=w.TEXT,Q(g,"ondoctype",g.doctype),g.doctype=!0):(g.doctype+=I,I==="["?g.state=w.DOCTYPE_DTD:k(I)&&(g.state=w.DOCTYPE_QUOTED,g.q=I));continue;case w.DOCTYPE_QUOTED:g.doctype+=I,I===g.q&&(g.q="",g.state=w.DOCTYPE);continue;case w.DOCTYPE_DTD:g.doctype+=I,I==="]"?g.state=w.DOCTYPE:k(I)&&(g.state=w.DOCTYPE_DTD_QUOTED,g.q=I);continue;case w.DOCTYPE_DTD_QUOTED:g.doctype+=I,I===g.q&&(g.state=w.DOCTYPE_DTD,g.q="");continue;case w.COMMENT:I==="-"?g.state=w.COMMENT_ENDING:g.comment+=I;continue;case w.COMMENT_ENDING:I==="-"?(g.state=w.COMMENT_ENDED,g.comment=dn(g.opt,g.comment),g.comment&&Q(g,"oncomment",g.comment),g.comment=""):(g.comment+="-"+I,g.state=w.COMMENT);continue;case w.COMMENT_ENDED:I!==">"?(qe(g,"Malformed comment"),g.comment+="--"+I,g.state=w.COMMENT):g.state=w.TEXT;continue;case w.CDATA:I==="]"?g.state=w.CDATA_ENDING:g.cdata+=I;continue;case w.CDATA_ENDING:I==="]"?g.state=w.CDATA_ENDING_2:(g.cdata+="]"+I,g.state=w.CDATA);continue;case w.CDATA_ENDING_2:I===">"?(g.cdata&&Q(g,"oncdata",g.cdata),Q(g,"onclosecdata"),g.cdata="",g.state=w.TEXT):I==="]"?g.cdata+="]":(g.cdata+="]]"+I,g.state=w.CDATA);continue;case w.PROC_INST:I==="?"?g.state=w.PROC_INST_ENDING:x(I)?g.state=w.PROC_INST_BODY:g.procInstName+=I;continue;case w.PROC_INST_BODY:if(!g.procInstBody&&x(I))continue;I==="?"?g.state=w.PROC_INST_ENDING:g.procInstBody+=I;continue;case w.PROC_INST_ENDING:I===">"?(Q(g,"onprocessinginstruction",{name:g.procInstName,body:g.procInstBody}),g.procInstName=g.procInstBody="",g.state=w.TEXT):(g.procInstBody+="?"+I,g.state=w.PROC_INST_BODY);continue;case w.OPEN_TAG:F(_,I)?g.tagName+=I:(Ul(g),I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:(x(I)||qe(g,"Invalid character in tag name"),g.state=w.ATTRIB));continue;case w.OPEN_TAG_SLASH:I===">"?(Pn(g,!0),zo(g)):(qe(g,"Forward-slash in opening tag not followed by >"),g.state=w.ATTRIB);continue;case w.ATTRIB:if(x(I))continue;I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:F(h,I)?(g.attribName=I,g.attribValue="",g.state=w.ATTRIB_NAME):qe(g,"Invalid attribute name");continue;case w.ATTRIB_NAME:I==="="?g.state=w.ATTRIB_VALUE:I===">"?(qe(g,"Attribute without value"),g.attribValue=g.attribName,ks(g),Pn(g)):x(I)?g.state=w.ATTRIB_NAME_SAW_WHITE:F(_,I)?g.attribName+=I:qe(g,"Invalid attribute name");continue;case w.ATTRIB_NAME_SAW_WHITE:if(I==="=")g.state=w.ATTRIB_VALUE;else{if(x(I))continue;qe(g,"Attribute without value"),g.tag.attributes[g.attribName]="",g.attribValue="",Q(g,"onattribute",{name:g.attribName,value:""}),g.attribName="",I===">"?Pn(g):F(h,I)?(g.attribName=I,g.state=w.ATTRIB_NAME):(qe(g,"Invalid attribute name"),g.state=w.ATTRIB)}continue;case w.ATTRIB_VALUE:if(x(I))continue;k(I)?(g.q=I,g.state=w.ATTRIB_VALUE_QUOTED):(qe(g,"Unquoted attribute value"),g.state=w.ATTRIB_VALUE_UNQUOTED,g.attribValue=I);continue;case w.ATTRIB_VALUE_QUOTED:if(I!==g.q){I==="&"?g.state=w.ATTRIB_VALUE_ENTITY_Q:g.attribValue+=I;continue}ks(g),g.q="",g.state=w.ATTRIB_VALUE_CLOSED;continue;case w.ATTRIB_VALUE_CLOSED:x(I)?g.state=w.ATTRIB:I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:F(h,I)?(qe(g,"No whitespace between attributes"),g.attribName=I,g.attribValue="",g.state=w.ATTRIB_NAME):qe(g,"Invalid attribute name");continue;case w.ATTRIB_VALUE_UNQUOTED:if(!T(I)){I==="&"?g.state=w.ATTRIB_VALUE_ENTITY_U:g.attribValue+=I;continue}ks(g),I===">"?Pn(g):g.state=w.ATTRIB;continue;case w.CLOSE_TAG:if(g.tagName)I===">"?zo(g):F(_,I)?g.tagName+=I:g.script?(g.script+=""?zo(g):qe(g,"Invalid characters in closing tag");continue;case w.TEXT_ENTITY:case w.ATTRIB_VALUE_ENTITY_Q:case w.ATTRIB_VALUE_ENTITY_U:var it,Tt;switch(g.state){case w.TEXT_ENTITY:it=w.TEXT,Tt="textNode";break;case w.ATTRIB_VALUE_ENTITY_Q:it=w.ATTRIB_VALUE_QUOTED,Tt="attribValue";break;case w.ATTRIB_VALUE_ENTITY_U:it=w.ATTRIB_VALUE_UNQUOTED,Tt="attribValue";break}if(I===";")if(g.opt.unparsedEntities){var Bt=Fl(g);g.entity="",g.state=it,g.write(Bt)}else g[Tt]+=Fl(g),g.entity="",g.state=it;else F(g.entity.length?b:v,I)?g.entity+=I:(qe(g,"Invalid character in entity name"),g[Tt]+="&"+g.entity+I,g.entity="",g.state=it);continue;default:throw new Error(g,"Unknown state: "+g.state)}return g.position>=g.bufferCheckPosition&&n(g),g}return String.fromCodePoint||(function(){var y=String.fromCharCode,g=Math.floor,R=function(){var I=16384,ze=[],Ye,it,Tt=-1,Bt=arguments.length;if(!Bt)return"";for(var Rn="";++Tt1114111||g(ht)!==ht)throw RangeError("Invalid code point: "+ht);ht<=65535?ze.push(ht):(ht-=65536,Ye=(ht>>10)+55296,it=ht%1024+56320,ze.push(Ye,it)),(Tt+1===Bt||ze.length>I)&&(Rn+=y.apply(null,ze),ze.length=0)}return Rn};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:R,configurable:!0,writable:!0}):String.fromCodePoint=R})(),t},uj=JW();var wv=`The output should be formatted as a XML file. +1. Output should conform to the tags below. +2. If tags are not given, make them on your own. +3. Remember to always open and close all the tags. + +As an example, for the tags ["foo", "bar", "baz"]: +1. String " + + + +" is a well-formatted instance of the schema. +2. String " + + " is a badly-formatted instance. +3. String " + + +" is a badly-formatted instance. + +Here are the output tags: +\`\`\` +{tags} +\`\`\``,lj=class extends ls{tags;constructor(t){super(t),this.tags=t?.tags}static lc_name(){return"XMLOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_diff(t,e){if(e)return t?mu(t,e):[{op:"replace",path:"",value:e}]}async parsePartialResult(t){return xv(t[0].text)}async parse(t){return xv(t)}getFormatInstructions(){return!!(this.tags&&this.tags.length>0)?wv.replace("{tags}",this.tags?.join(", ")??""):wv}},XW=t=>t.split(` +`).map(e=>e.replace(/^\s+/,"")).join(` +`).trim(),dj=t=>{if(Object.keys(t).length===0)return{};let e={};return t.children.length>0?(e[t.name]=t.children.map(dj),e):(e[t.name]=t.text??void 0,e)};function xv(t){let e=XW(t),r=uj.parser(!0),n={},o=[];r.onopentag=a=>{let c={name:a.name,attributes:a.attributes,children:[],text:"",isSelfClosing:a.isSelfClosing};o.length>0?o[o.length-1].children.push(c):n=c,a.isSelfClosing||o.push(c)},r.onclosetag=()=>{if(o.length>0){let a=o.pop();o.length===0&&a&&(n=a)}},r.ontext=a=>{if(o.length>0){let c=o[o.length-1];c.text+=a}},r.onattribute=a=>{if(o.length>0){let c=o[o.length-1];c.attributes[a.name]=a.value}};let i=/```(xml)?(.*)```/s.exec(e),s=i?i[2]:e;return r.write(s).close(),n&&n.name==="?xml"&&(n=n.children[0]),dj(n)}var YW={};G(YW,{AsymmetricStructuredOutputParser:()=>cj,BaseCumulativeTransformOutputParser:()=>ls,BaseLLMOutputParser:()=>GI,BaseOutputParser:()=>Ka,BaseTransformOutputParser:()=>si,BytesOutputParser:()=>rj,CommaSeparatedListOutputParser:()=>nj,CustomListOutputParser:()=>oj,JsonMarkdownStructuredOutputParser:()=>HI,JsonOutputParser:()=>KI,ListOutputParser:()=>al,MarkdownListOutputParser:()=>sj,NumberedListOutputParser:()=>ij,OutputParserException:()=>ln,StringOutputParser:()=>aj,StructuredOutputParser:()=>bv,XMLOutputParser:()=>lj,XML_FORMAT_INSTRUCTIONS:()=>wv,parseJsonMarkdown:()=>kd,parsePartialJson:()=>sa,parseXMLMarkdown:()=>xv});function rf(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=sa(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new ln([`Function "${t.function.name}" arguments:`,"",t.function.arguments,"","are not valid JSON.",`Error: ${o.message}`].join(` +`))}let n={name:t.function.name,args:r,type:"tool_call"};return e?.returnId&&(n.id=t.id),n}function WI(t){if(t.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:t.id,type:"function",function:{name:t.name,arguments:JSON.stringify(t.args)}}}function $v(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var JI=class extends ls{static lc_name(){return"JsonOutputToolsParser"}returnId=!1;lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;constructor(t){super(t),this.returnId=t?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(t){return await this.parsePartialResult(t,!1)}async parsePartialResult(t,e=!0){let r=t[0].message,n;if(aa(r)&&r.tool_calls?.length?n=r.tool_calls.map(i=>{let{id:s,...a}=i;return this.returnId?{id:s,...a}:a}):r.additional_kwargs.tool_calls!==void 0&&(n=JSON.parse(JSON.stringify(r.additional_kwargs.tool_calls)).map(s=>rf(s,{returnId:this.returnId,partial:e}))),!n)return[];let o=[];for(let i of n)if(i!==void 0){let s={type:i.name,args:i.args,id:i.id};o.push(s)}return o}},XI=class extends JI{static lc_name(){return"JsonOutputKeyToolsParser"}lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(t){super(t),this.keyName=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){if(this.zodSchema===void 0)return t;let e=await Ey(this.zodSchema,t);if(e.success)return e.data;throw new ln(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(e.error?.issues)}`,JSON.stringify(t,null,2))}async parsePartialResult(t){let r=(await super.parsePartialResult(t)).filter(o=>o.type===this.keyName),n=r;if(r.length)return this.returnId||(n=r.map(o=>o.args)),this.returnSingle?n[0]:n}async parseResult(t){let r=(await super.parsePartialResult(t,!1)).filter(i=>i.type===this.keyName),n=r;return r.length?(this.returnId||(n=r.map(i=>i.args)),this.returnSingle?this._validateResult(n[0]):await Promise.all(n.map(i=>this._validateResult(i)))):void 0}};var QW={};G(QW,{JsonOutputKeyToolsParser:()=>XI,JsonOutputToolsParser:()=>JI,convertLangChainToolCallToOpenAI:()=>WI,makeInvalidToolCall:()=>$v,parseToolCall:()=>rf});var p8={};G(p8,{BaseLLM:()=>tS,LLM:()=>f8});var tS=class of extends tf{lc_namespace=["langchain","llms",this._llmType()];async invoke(e,r){let n=of._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].text}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async*_streamIterator(e,r){if(this._streamResponseChunks===of.prototype._streamResponseChunks)yield this.invoke(e,r);else{let n=of._convertInputToPromptValue(e),[o,i]=this._separateRunnableConfigFromCallOptionsCompat(r),s=await St.configure(o.callbacks,this.callbacks,o.tags,this.tags,o.metadata,this.metadata,{verbose:this.verbose}),a={options:i,invocation_params:this?.invocationParams(i),batch_size:1},c=await s?.handleLLMStart(this.toJSON(),[n.toString()],o.runId,void 0,a,void 0,void 0,o.runName),u=new go({text:""});try{for await(let l of this._streamResponseChunks(n.toString(),i,c?.[0]))u?u=u.concat(l):u=l,typeof l.text=="string"&&(yield l.text)}catch(l){throw await Promise.all((c??[]).map(d=>d?.handleLLMError(l))),l}await Promise.all((c??[]).map(l=>l?.handleLLMEnd({generations:[[u]]})))}}async generatePrompt(e,r,n){let o=e.map(i=>i.toString());return this.generate(o,r,n)}invocationParams(e){return{}}_flattenLLMResult(e){let r=[];for(let n=0;nd?.handleLLMError(l))),l}let u=this._flattenLLMResult(a);await Promise.all((i??[]).map((l,d)=>l?.handleLLMEnd(u[d])))}let c=i?.map(u=>u.runId)||void 0;return Object.defineProperty(a,ya,{value:c?{runIds:c}:void 0,configurable:!0}),a}async _generateCached({prompts:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i,runId:s}){let a=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,i.metadata,this.metadata,{verbose:this.verbose}),c={options:o,invocation_params:this?.invocationParams(o),batch_size:e.length},u=await a?.handleLLMStart(this.toJSON(),e,s,void 0,c,void 0,void 0,i?.runName),l=[],f=(await Promise.allSettled(e.map(async(h,_)=>{let v=await r.lookup(h,n);return v==null&&l.push(_),v}))).map((h,_)=>({result:h,runManager:u?.[_]})).filter(({result:h})=>h.status==="fulfilled"&&h.value!=null||h.status==="rejected"),p=[];await Promise.all(f.map(async({result:h,runManager:_},v)=>{if(h.status==="fulfilled"){let b=h.value;return p[v]=b.map(x=>(x.generationInfo={...x.generationInfo,tokenUsage:{}},x)),b.length&&await _?.handleLLMNewToken(b[0].text),_?.handleLLMEnd({generations:[b]},void 0,void 0,void 0,{cached:!0})}else return await _?.handleLLMError(h.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(h.reason)}));let m={generations:p,missingPromptIndices:l,startedRunManagers:u};return Object.defineProperty(m,ya,{value:u?{runIds:u?.map(h=>h.runId)}:void 0,configurable:!0}),m}async generate(e,r,n){if(!Array.isArray(e))throw new Error("Argument 'prompts' is expected to be a string[]");let o;Array.isArray(r)?o={stop:r}:o=r;let[i,s]=this._separateRunnableConfigFromCallOptionsCompat(o);if(i.callbacks=i.callbacks??n,!this.cache)return this._generateUncached(e,s,i);let{cache:a}=this,c=this._getSerializedCacheKeyParametersForCall(s),{generations:u,missingPromptIndices:l,startedRunManagers:d}=await this._generateCached({prompts:e,cache:a,llmStringKey:c,parsedOptions:s,handledOptions:i,runId:i.runId}),f={};if(l.length>0){let p=await this._generateUncached(l.map(m=>e[m]),s,i,d!==void 0?l.map(m=>d?.[m]):void 0);await Promise.all(p.generations.map(async(m,h)=>{let _=l[h];return u[_]=m,a.update(e[_],c,m)})),f=p.llmOutput??{}}return{generations:u,llmOutput:f}}_identifyingParams(){return{}}_modelType(){return"base_llm"}},f8=class extends tS{async _generate(t,e,r){return{generations:await Promise.all(t.map((o,i)=>this._call(o,{...e,promptIndex:i},r).then(s=>[{text:s}])))}}};var m8={};G(m8,{chunkArray:()=>rS});var rS=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),s=r[i]||[];return r[i]=s.concat([n]),r},[]);var g8={};G(g8,{Embeddings:()=>nS});var nS=class{caller;constructor(t){this.caller=new Xo(t??{})}};var y8={};G(y8,{BaseToolkit:()=>v8,DynamicStructuredTool:()=>xj,DynamicTool:()=>sS,StructuredTool:()=>oS,Tool:()=>iS,ToolInputParsingException:()=>su,isLangChainTool:()=>qa,isRunnableToolLike:()=>qp,isStructuredTool:()=>Zp,isStructuredToolParams:()=>Vp,tool:()=>b8});var oS=class extends _v{extras;returnDirect=!1;verboseParsingErrors=!1;get lc_namespace(){return["langchain","tools"]}responseFormat="content";defaultConfig;constructor(t){super(t??{}),this.verboseParsingErrors=t?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=t?.responseFormat??this.responseFormat,this.defaultConfig=t?.defaultConfig??this.defaultConfig,this.metadata=t?.metadata??this.metadata,this.extras=t?.extras??this.extras}async invoke(t,e){let r,n=Pe(ga(this.defaultConfig,e));return Mi(t)?(r=t.args,n={...n,toolCall:t}):r=t,this.call(r,n)}async call(t,e,r){let n=Mi(t)?t.args:t,o;if(on(this.schema))try{o=await ts(this.schema,n)}catch(p){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m} +Details: ${p.message}`),Py(p)&&(m=`${m} + +${av.prettifyError(p)}`),new su(m,JSON.stringify(t))}else{let p=ot(n,this.schema);if(!p.valid){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m} +Details: ${p.errors.map(h=>`${h.keywordLocation}: ${h.error}`).join(` +`)}`),new su(m,JSON.stringify(t))}o=n}let i=ha(e),a=await St.configure(i.callbacks,this.callbacks,i.tags||r,this.tags,i.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof t=="string"?t:JSON.stringify(t),i.runId,void 0,void 0,void 0,i.runName);delete i.runId;let c;try{c=await this._call(o,a,i)}catch(p){throw await a?.handleToolError(p),p}let u,l;if(this.responseFormat==="content_and_artifact")if(Array.isArray(c)&&c.length===2)[u,l]=c;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple. +Result: ${JSON.stringify(c)}`);else u=c;let d;Mi(t)&&(d=t.id),!d&&nO(i)&&(d=i.toolCall.id);let f=w8({content:u,artifact:l,toolCallId:d,name:this.name,metadata:this.metadata});return await a?.handleToolEnd(f),f}},iS=class extends oS{schema=$r.object({input:$r.string().optional()}).transform(t=>t.input);constructor(t){super(t)}call(t,e){let r=typeof t=="string"||t==null?{input:t}:t;return super.call(r,e)}},sS=class extends iS{static lc_name(){return"DynamicTool"}name;description;func;constructor(t){super(t),this.name=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect}async call(t,e){let r=ha(e);return r.runName===void 0&&(r.runName=this.name),super.call(t,r)}async _call(t,e,r){return this.func(t,e,r)}},xj=class extends oS{static lc_name(){return"DynamicStructuredTool"}name;description;func;schema;constructor(t){super(t),this.name=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect,this.schema=t.schema}async call(t,e,r){let n=ha(e);return n.runName===void 0&&(n.runName=this.name),super.call(t,n,r)}_call(t,e,r){return this.func(t,e,r)}},v8=class{getTools(){return this.tools}};function b8(t,e){let r=Wu(e.schema),n=ol(e.schema);if(!e.schema||r||n)return new sS({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(s,a,c)=>new Promise((u,l)=>{let d=Ve(c,{callbacks:a?.getChild()});Lt.runWithConfig(vr(d),async()=>{try{u(t(s,d))}catch(f){l(f)}})})});let o=e.schema,i=e.description??e.schema.description??`${e.name} tool`;return new xj({...e,description:i,schema:o,func:async(s,a,c)=>new Promise((u,l)=>{let d,f=()=>{c?.signal&&d&&c.signal.removeEventListener("abort",d)};c?.signal&&(d=()=>{f(),l(Bi(c.signal))},c.signal.addEventListener("abort",d));let p=Ve(c,{callbacks:a?.getChild()});Lt.runWithConfig(vr(p),async()=>{try{let m=await t(s,p);if(c?.signal?.aborted){f();return}f(),u(m)}catch(m){f(),l(m)}})})})}function w8(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!Id(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new Or({status:"success",content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new Or({status:"success",content:x8(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function x8(t){try{return JSON.stringify(t,null,2)??""}catch{return`${t}`}}import{BedrockRuntimeClient as G1e,ConverseCommand as K1e,ConverseStreamCommand as H1e}from"@aws-sdk/client-bedrock-runtime";import{defaultProvider as Y1e}from"@aws-sdk/credential-provider-node";import{BedrockAgentRuntimeClient as lMe,RetrieveCommand as dMe}from"@aws-sdk/client-bedrock-agent-runtime";var I8={};G(I8,{BaseRetriever:()=>aS});var aS=class extends Ze{callbacks;tags;metadata;verbose;constructor(t){super(t),this.callbacks=t?.callbacks,this.tags=t?.tags??[],this.metadata=t?.metadata??{},this.verbose=t?.verbose??!1}_getRelevantDocuments(t,e){throw new Error("Not implemented!")}async invoke(t,e){let r=Pe(ha(e)),o=await(await St.configure(r.callbacks,this.callbacks,r.tags,this.tags,r.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),t,r.runId,void 0,void 0,void 0,r.runName);try{let i=await this._getRelevantDocuments(t,o);return await o?.handleRetrieverEnd(i),i}catch(i){throw await o?.handleRetrieverError(i),i}}};import{KendraClient as kMe,QueryCommand as TMe,RetrieveCommand as EMe}from"@aws-sdk/client-kendra";var cS=class{pageContent;metadata;id;constructor(t){this.pageContent=t.pageContent!==void 0?t.pageContent.toString():"",this.metadata=t.metadata??{},this.id=t.id}};var uS=class extends Ze{lc_namespace=["langchain_core","documents","transformers"];invoke(t,e){return this.transformDocuments(t)}},$j=class extends uS{async transformDocuments(t){let e=[];for(let r of t){let n=await this._transformDocument(r);e.push(n)}return e}};var S8={};G(S8,{BaseDocumentTransformer:()=>uS,Document:()=>cS,MappingDocumentTransformer:()=>$j});import{BedrockRuntimeClient as MMe,InvokeModelCommand as jMe}from"@aws-sdk/client-bedrock-runtime";var ll=class{uri;bucketOwner;constructor(e){this.uri=e.uri,e.bucketOwner!==void 0&&(this.bucketOwner=e.bucketOwner)}},sf=class{type="imageBlock";format;source;constructor(e){this.format=e.format,this.source=this._convertSource(e.source)}_convertSource(e){if("bytes"in e)return{type:"imageSourceBytes",bytes:e.bytes};if("url"in e)return{type:"imageSourceUrl",url:e.url};if("s3Location"in e)return{type:"imageSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid image source")}},af=class{type="videoBlock";format;source;constructor(e){this.format=e.format,this.source=this._convertSource(e.source)}_convertSource(e){if("bytes"in e)return{type:"videoSourceBytes",bytes:e.bytes};if("s3Location"in e)return{type:"videoSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid video source")}},cf=class{type="documentBlock";name;format;source;citations;context;constructor(e){this.name=e.name,this.format=e.format,this.source=this._convertSource(e.source),e.citations!==void 0&&(this.citations=e.citations),e.context!==void 0&&(this.context=e.context)}_convertSource(e){if("bytes"in e)return{type:"documentSourceBytes",bytes:e.bytes};if("text"in e)return{type:"documentSourceText",text:e.text};if("content"in e)return{type:"documentSourceContentBlock",content:e.content.map(r=>new mt(r.text))};if("s3Location"in e)return{type:"documentSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid document source")}};var Sr=class t{type="message";role;content;constructor(e){this.role=e.role,this.content=e.content}static fromMessageData(e){let r=e.content.map(Iv);return new t({role:e.role,content:r})}},mt=class{type="textBlock";text;constructor(e){this.text=e}},dl=class{type="toolUseBlock";name;toolUseId;input;constructor(e){this.name=e.name,this.toolUseId=e.toolUseId,this.input=e.input}},Ht=class{type="toolResultBlock";toolUseId;status;content;error;constructor(e){this.toolUseId=e.toolUseId,this.status=e.status,this.content=e.content,e.error!==void 0&&(this.error=e.error)}},pl=class{type="reasoningBlock";text;signature;redactedContent;constructor(e){e.text!==void 0&&(this.text=e.text),e.signature!==void 0&&(this.signature=e.signature),e.redactedContent!==void 0&&(this.redactedContent=e.redactedContent)}},uf=class{type="cachePointBlock";cacheType;constructor(e){this.cacheType=e.cacheType}},Ha=class{type="jsonBlock";json;constructor(e){this.json=e.json}};function Ij(t){return typeof t=="string"?t:t.map(e=>{if("type"in e)return e;if("cachePoint"in e)return new uf(e.cachePoint);if("guardContent"in e)return new lf(e.guardContent);if("text"in e)return new mt(e.text);throw new Error("Unknown SystemContentBlockData type")})}var lf=class{type="guardContentBlock";text;image;constructor(e){if(!e.text&&!e.image)throw new Error("GuardContentBlock must have either text or image content");if(e.text&&e.image)throw new Error("GuardContentBlock cannot have both text and image content");e.text&&(this.text=e.text),e.image&&(this.image=e.image)}};function Iv(t){if("text"in t)return new mt(t.text);if("toolUse"in t)return new dl(t.toolUse);if("toolResult"in t)return new Ht({toolUseId:t.toolResult.toolUseId,status:t.toolResult.status,content:t.toolResult.content.map(e=>{if("text"in e)return new mt(e.text);if("json"in e)return new Ha(e);throw new Error("Unknown ToolResultContentData type")})});if("reasoning"in t)return new pl(t.reasoning);if("cachePoint"in t)return new uf(t.cachePoint);if("guardContent"in t)return new lf(t.guardContent);if("image"in t)return new sf(t.image);if("video"in t)return new af(t.video);if("document"in t)return new cf(t.document);throw new Error("Unknown ContentBlockData type")}var ds=class extends Error{constructor(e){super(e),this.name="ContextWindowOverflowError"}},df=class extends Error{partialMessage;constructor(e,r){super(e),this.name="MaxTokensError",this.partialMessage=r}},ps=class extends Error{constructor(e){super(e),this.name="JsonValidationError"}},pf=class extends Error{constructor(e){super(e),this.name="ConcurrentInvocationError"}};function ai(t){return t instanceof Error?t:new Error(String(t))}var ff=class extends Error{constructor(e){super(`Item with id '${e}' not found`),this.name="ItemNotFoundError"}},mf=class extends Error{constructor(e){super(`An item with the ID '${e}' already exists.`),this.name="DuplicateItemError"}},Ft=class extends Error{constructor(e){super(e),this.name="ValidationError"}},hf=class{_items;constructor(e){this._items=new Map,e&&this.addAll(e)}get(e){return this._items.get(e)}find(e){for(let r of this._items.values())if(e(r))return r}keys(){return Array.from(this._items.keys())}values(){return Array.from(this._items.values())}pairs(){return Array.from(this._items.entries())}clear(){this._items.clear()}add(e){this.validate(e);let r=this.generateId(e);if(this._items.has(r))throw new mf(r);return this._items.set(r,e),r}addAll(e){return e.map(r=>this.add(r))}remove(e){let r=this._items.get(e);if(r===void 0)throw new ff(e);return this._items.delete(e),r}removeAll(e){return e.map(r=>this.remove(r))}findRemove(e){for(let[r,n]of this._items.entries())if(e(n))return this._items.delete(r),n}};if(import.meta.vitest){let{describe:t,it:e,expect:r,beforeEach:n,vi:o}=import.meta.vitest;class i extends hf{nextId=1;generateId(){return this.nextId++}validate(a){if(a.length===0)throw new Ft("Item cannot be an empty string.")}}t("Error Classes",()=>{e("ItemNotFoundError should have the correct name and message",()=>{let s=new ff(123);r(s.name).toBe("ItemNotFoundError"),r(s.message).toBe("Item with id '123' not found")}),e("DuplicateItemError should have the correct name and message",()=>{let s=new mf("abc");r(s.name).toBe("DuplicateItemError"),r(s.message).toBe("An item with the ID 'abc' already exists.")}),e("ValidationError should have the correct name and message",()=>{let s=new Ft("Invalid item");r(s.name).toBe("ValidationError"),r(s.message).toBe("Invalid item")})}),t("Registry",()=>{let s;n(()=>{s=new i}),e("should register an item and return a new ID",()=>{let a=s.add("test-item");r(a).toBe(1),r(s.get(1)).toBe("test-item")}),e("should throw DuplicateItemError when registering with an existing ID",()=>{let a=o.spyOn(s,"generateId").mockReturnValue(1);s.add("test-item"),r(()=>s.add("another-item")).toThrow(mf),a.mockRestore()}),e("should deregister an item and return it",()=>{let a=s.add("test-item"),c=s.remove(a);r(c).toBe("test-item"),r(s.get(a)).toBeUndefined()}),e("should throw ItemNotFoundError when deregistering a non-existent item",()=>{r(()=>s.remove(999)).toThrow(ff)}),e("should get an item by its ID",()=>{let a=s.add("test-item"),c=s.get(a);r(c).toBe("test-item")}),e("should return undefined when getting a non-existent item",()=>{let a=s.get(999);r(a).toBeUndefined()}),e("should find an item using a predicate",()=>{s.add("item-a"),s.add("item-b");let a=s.find(c=>c.includes("b"));r(a).toBe("item-b")}),e("should return undefined when no item matches the predicate",()=>{s.add("item-a");let a=s.find(c=>c.includes("c"));r(a).toBeUndefined()}),e("should return all keys",()=>{s.add("item-1"),s.add("item-2"),r(s.keys()).toEqual([1,2])}),e("should return all values",()=>{s.add("item-1"),s.add("item-2"),r(s.values()).toEqual(["item-1","item-2"])}),e("should return all key-value pairs",()=>{s.add("item-1"),s.add("item-2"),r(s.pairs()).toEqual([[1,"item-1"],[2,"item-2"]])}),e("should clear all items from the registry",()=>{s.add("item-1"),s.clear(),r(s.keys()).toEqual([]),r(s.values()).toEqual([])}),e("should register multiple items",()=>{let a=s.addAll(["item-a","item-b"]);r(a).toEqual([1,2]),r(s.values()).toEqual(["item-a","item-b"])}),e("should deregister multiple items",()=>{let a=s.addAll(["item-a","item-b","item-c"]),c=s.removeAll([a[0],a[2]]);r(c).toEqual(["item-a","item-c"]),r(s.values()).toEqual(["item-b"])}),e("should find and deregister an item",()=>{s.add("item-a"),s.add("item-b");let a=s.findRemove(c=>c.includes("a"));r(a).toBe("item-a"),r(s.values()).toEqual(["item-b"])}),e("should return undefined from findRemove if no item matches",()=>{let a=s.findRemove(c=>c.includes("c"));r(a).toBeUndefined()}),e("should call the validate method on register",()=>{let a=o.spyOn(s,"validate");s.add("a-valid-item"),r(a).toHaveBeenCalledWith("a-valid-item"),a.mockRestore()}),e("should throw a validation error for an invalid item",()=>{r(()=>s.add("")).toThrow(Ft)})})}var gf=class{type="toolStreamEvent";data;constructor(e){e.data!==void 0&&(this.data=e.data)}},fl=class{};function lS(t,e){let r=ai(t);return new Ht({toolUseId:e,status:"error",content:[new mt(`Error: ${r.message}`)],error:r})}var _f=class extends hf{generateId(e){return e}validate(e){if(typeof e.name!="string")throw new Ft("Tool name must be a string");if(e.name.length<1||e.name.length>64)throw new Ft("Tool name must be between 1 and 64 characters");if(!/^[a-zA-Z0-9_-]+$/.test(e.name))throw new Ft("Tool name must contain only alphanumeric characters, hyphens, and underscores");if(e.description!==void 0&&e.description!==null&&(typeof e.description!="string"||e.description.length<1))throw new Ft("Tool description must be a non-empty string");if(this.values().some(n=>n.name===e.name))throw new Ft(`Tool with name '${e.name}' already registered`)}getByName(e){return this.values().find(r=>r.name===e)}removeByName(e){this.findRemove(r=>r.name===e)}};if(import.meta.vitest){let{describe:t,it:e,expect:r,beforeEach:n}=import.meta.vitest,o=(i={})=>({name:"valid-tool",description:"A valid tool description.",toolSpec:{name:"valid-tool",description:"A valid tool description.",inputSchema:{type:"object",properties:{}}},stream:async function*(){return yield new gf({data:"mock data"}),new Ht({toolUseId:"",status:"success",content:[]})},...i});t("ToolRegistry",()=>{let i;n(()=>{i=new _f}),e("should register a valid tool successfully",()=>{let s=o();r(()=>i.add(s)).not.toThrow(),r(i.values()).toHaveLength(1),r(i.values()[0]?.name).toBe("valid-tool")}),e("should throw ValidationError for a duplicate tool name",()=>{let s=o({name:"duplicate-name"}),a=o({name:"duplicate-name"});i.add(s),r(()=>i.add(a)).toThrow(Ft),r(()=>i.add(a)).toThrow("Tool with name 'duplicate-name' already registered")}),e("should throw ValidationError for an invalid tool name pattern",()=>{let s=o({name:"invalid name!"});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must contain only alphanumeric characters, hyphens, and underscores")}),e("should throw ValidationError for a tool name that is too long",()=>{let s="a".repeat(65),a=o({name:s});r(()=>i.add(a)).toThrow(Ft),r(()=>i.add(a)).toThrow("Tool name must be between 1 and 64 characters")}),e("should throw ValidationError for a tool name that is too short",()=>{let s=o({name:""});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must be between 1 and 64 characters")}),e("should throw ValidationError for an invalid description",()=>{let s=o({description:123});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool description must be a non-empty string")}),e("should throw ValidationError for an empty string description",()=>{let s=o({description:""});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool description must be a non-empty string")}),e("should allow a tool with a null or undefined description",()=>{let s=o();s.description=void 0;let a=o();a.name="another-valid-tool",a.description=null,r(()=>i.add(s)).not.toThrow(),r(()=>i.add(a)).not.toThrow()}),e("should retrieve a tool by its name",()=>{let s=o({name:"find-me"});i.add(s);let a=i.getByName("find-me");r(a).toBe(s)}),e("should return undefined when getting a tool by a name that does not exist",()=>{let s=i.getByName("non-existent");r(s).toBeUndefined()}),e("should remove a tool by its name",()=>{let s=o({name:"remove-me"});i.add(s),r(i.getByName("remove-me")).toBeDefined(),i.removeByName("remove-me"),r(i.getByName("remove-me")).toBeUndefined()}),e("should not throw when removing a tool by a name that does not exist",()=>{r(()=>i.removeByName("non-existent")).not.toThrow()}),e("should generate a valid ToolIdentifier",()=>{let s=o(),a=i.generateId(s);r(a).toBe(s)}),e("should register a tool with a name at the maximum length",()=>{let s="a".repeat(64),a=o({name:s});r(()=>i.add(a)).not.toThrow()}),e("should throw ValidationError for a non-string tool name",()=>{let s=o({name:123});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must be a string")})})}function Sv(t){try{return JSON.parse(JSON.stringify(t))}catch(e){let r=e instanceof Error?e.message:String(e);throw new Error(`Unable to serialize tool result: ${r}`)}}function dS(t,e="value"){let r=[],n=(o,i)=>{let s=e;if(o!==""&&(/^\d+$/.test(o)?s=r.length>0?`${r[r.length-1]}[${o}]`:`${e}[${o}]`:s=r.length>0?`${r[r.length-1]}.${o}`:`${e}.${o}`),typeof i=="function")throw new ps(`${s} contains a function which cannot be serialized`);if(typeof i=="symbol")throw new ps(`${s} contains a symbol which cannot be serialized`);if(i===void 0)throw new ps(`${s} is undefined which cannot be serialized`);return i!==null&&typeof i=="object"&&r.push(s),i};try{let o=JSON.stringify(t,n);return JSON.parse(o)}catch(o){if(o instanceof ps)throw o;let i=o instanceof Error?o.message:String(o);throw new Error(`Unable to serialize value: ${i}`)}}var kv=class{_state;constructor(e){e!==void 0?this._state=dS(e,"initialState"):this._state={}}get(e){if(e==null)throw new Error("key is required");let r=this._state[e];if(r!==void 0)return Sv(r)}set(e,r){this._state[e]=dS(r,`value for key "${e}"`)}delete(e){delete this._state[e]}clear(){this._state={}}getAll(){return Sv(this._state)}keys(){return Object.keys(this._state)}};function Sj(){return typeof process<"u"&&process.stdout?.write?t=>process.stdout.write(t):t=>console.log(t)}var Tv=class{_appender;_inReasoningBlock=!1;_toolCount=0;_needReasoningIndent=!1;constructor(e){this._appender=e}write(e){this._appender(e)}processEvent(e){switch(e.type){case"modelContentBlockDeltaEvent":this.handleContentBlockDelta(e);break;case"modelContentBlockStartEvent":this.handleContentBlockStart(e);break;case"modelContentBlockStopEvent":this.handleContentBlockStop();break;case"toolResultBlock":this.handleToolResult(e);break;default:break}}handleContentBlockDelta(e){let{delta:r}=e;r.type==="textDelta"?r.text&&r.text.length>0&&this.write(r.text):r.type==="reasoningContentDelta"&&(this._inReasoningBlock||(this._inReasoningBlock=!0,this._needReasoningIndent=!0,this.write(` +\u{1F4AD} Reasoning: +`)),r.text&&r.text.length>0&&this.writeReasoningText(r.text))}writeReasoningText(e){let r="";for(let n=0;n{this.applyManagement(r.agent.messages)}),e.addCallback(ui,r=>{r.error instanceof ds&&(this.reduceContext(r.agent.messages,r.error),r.retryModelCall=!0)})}applyManagement(e){e.length<=this._windowSize||this.reduceContext(e)}reduceContext(e,r){let n=this.findLastMessageWithToolResults(e);if(r&&n!==void 0&&this._shouldTruncateResults&&this.truncateToolResults(e,n))return;let o=e.length<=this._windowSize?2:e.length-this._windowSize;for(;oc.type==="toolResultBlock")){o++;continue}if(i.content.some(c=>c.type==="toolUseBlock")){let c=e[o+1];if(!(c&&c.content.some(l=>l.type==="toolResultBlock"))){o++;continue}}break}if(o>=e.length)throw new ds("Unable to trim conversation context!");e.splice(0,o)}truncateToolResults(e,r){if(r>=e.length||r<0)return!1;let n=e[r];if(!n)return!1;let o="The tool result was too large!",i=!1;for(let a of n.content)if(a.type==="toolResultBlock"){let c=a,u=c.content[0],l=u&&u.type==="textBlock"?u.text:"";if(c.status==="error"&&l===o)return!1;i=!0;break}if(!i)return!1;let s=n.content.map(a=>{if(a.type==="toolResultBlock"){let c=a;return new Ht({toolUseId:c.toolUseId,status:"error",content:[new mt(o)]})}return a});return e[r]=new Sr({role:n.role,content:s}),!0}findLastMessageWithToolResults(e){for(let r=e.length-1;r>=0;r--)if(e[r].content.some(i=>i.type==="toolResultBlock"))return r}};var vl=class{_callbacks;_currentProvider;constructor(){this._callbacks=new Map,this._currentProvider=void 0}addCallback(e,r){let n={callback:r,source:this._currentProvider},o=this._callbacks.get(e)??[];return o.push(n),this._callbacks.set(e,o),()=>{let i=this._callbacks.get(e);if(!i)return;let s=i.indexOf(n);s!==-1&&i.splice(s,1)}}addHook(e){this._currentProvider=e;try{e.registerCallbacks(this)}finally{this._currentProvider=void 0}}addAllHooks(e){for(let r of e)this.addHook(r)}removeHook(e){for(let[r,n]of this._callbacks.entries()){let o=n.filter(i=>i.source!==e);o.length===0?this._callbacks.delete(r):o.length!==n.length&&this._callbacks.set(r,o)}}async invokeCallbacks(e){let r=this.getCallbacksFor(e);for(let n of r)await n(e);return e}getCallbacksFor(e){let n=(this._callbacks.get(e.constructor)??[]).map(o=>o.callback);return e._shouldReverseCallbacks()?[...n].reverse():n}};var E8=function(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e},A8=(function(t){return function(e){function r(s){e.error=e.hasError?new t(s,e.error,"An error was suppressed during disposal."):s,e.hasError=!0}var n,o=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&o===1)return o=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return o|=2,Promise.resolve(s).then(i,function(a){return r(a),i()})}else o|=1}catch(a){r(a)}if(o===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}})(typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n}),bf=class{messages;state;conversationManager;hooks;model;systemPrompt;_toolRegistry;_mcpClients;_initialized;_isInvoking=!1;_printer;constructor(e){this.messages=(e?.messages??[]).map(i=>i instanceof Sr?i:Sr.fromMessageData(i)),this.state=new kv(e?.state),this.conversationManager=e?.conversationManager??new vf({windowSize:40}),this.hooks=new vl,this.hooks.addHook(this.conversationManager),this.hooks.addAllHooks(e?.hooks??[]),typeof e?.model=="string"?this.model=new ms({modelId:e.model}):this.model=e?.model??new ms;let{tools:r,mcpClients:n}=kj(e?.tools??[]);this._toolRegistry=new _f(r),this._mcpClients=n,e?.systemPrompt!==void 0&&(this.systemPrompt=Ij(e.systemPrompt)),(e?.printer??!0)&&(this._printer=new Tv(Sj())),this._initialized=!1}async initialize(){this._initialized||(await Promise.all(this._mcpClients.map(async e=>{let r=await e.listTools();this._toolRegistry.addAll(r)})),this._initialized=!0)}acquireLock(){if(this._isInvoking)throw new pf("Agent is already processing an invocation. Wait for the current invoke() or stream() call to complete before invoking again.");return this._isInvoking=!0,{[Symbol.dispose]:()=>{this._isInvoking=!1}}}get tools(){return this._toolRegistry.values()}get toolRegistry(){return this._toolRegistry}async invoke(e){let r=this.stream(e),n=await r.next();for(;!n.done;)n=await r.next();return n.value}async*stream(e){let r={stack:[],error:void 0,hasError:!1};try{let n=E8(r,this.acquireLock(),!1);await this.initialize();let o=this._stream(e),i=await o.next();for(;!i.done;){let s=i.value;s instanceof ar&&!(s instanceof Wa)&&await this.hooks.invokeCallbacks(s),this._printer?.processEvent(s),yield s,i=await o.next()}return yield i.value,i.value}catch(n){r.error=n,r.hasError=!0}finally{A8(r)}}async*_stream(e){let r=e;yield new ml({agent:this});try{for(;;){let n=yield*this.invokeModel(r);if(r=void 0,n.stopReason!=="toolUse")return yield await this._appendMessage(n.message),new wf({stopReason:n.stopReason,lastMessage:n.message});let o=yield*this.executeTools(n.message,this._toolRegistry);yield await this._appendMessage(n.message),yield await this._appendMessage(o)}}finally{yield new fs({agent:this})}}_normalizeInput(e){if(e!==void 0){if(typeof e=="string")return[new Sr({role:"user",content:[new mt(e)]})];if(Array.isArray(e)&&e.length>0){let r=e[0];if("role"in r&&typeof r.role=="string")return r instanceof Sr?e:e.map(n=>Sr.fromMessageData(n));{let n;return"type"in r&&typeof r.type=="string"?n=e:n=e.map(Iv),[new Sr({role:"user",content:n})]}}}return[]}async*invokeModel(e){let r=this._normalizeInput(e);for(let i of r)yield await this._appendMessage(i);let o={toolSpecs:this._toolRegistry.values().map(i=>i.toolSpec)};this.systemPrompt!==void 0&&(o.systemPrompt=this.systemPrompt),yield new gl({agent:this});try{let{message:i,stopReason:s}=yield*this._streamFromModel(this.messages,o);return yield new ui({agent:this,stopData:{message:i,stopReason:s}}),{message:i,stopReason:s}}catch(i){let s=ai(i),a=new ui({agent:this,error:s});if(yield a,a.retryModelCall)return yield*this.invokeModel(e);throw i}}async*_streamFromModel(e,r){let n=this.model.streamAggregated(e,r),o=await n.next();for(;!o.done;){let i=o.value;yield new yf({agent:this,event:i}),yield i,o=await n.next()}return o.value}async*executeTools(e,r){yield new _l({agent:this,message:e});let n=e.content.filter(s=>s.type==="toolUseBlock");if(n.length===0)throw new Error("Model indicated toolUse but no tool use blocks found in message");let o=[];for(let s of n){let a=yield*this.executeTool(s,r);o.push(a),yield a}let i=new Sr({role:"user",content:o});return yield new yl({agent:this,message:i}),i}async*executeTool(e,r){let n=r.find(s=>s.name===e.name),o={name:e.name,toolUseId:e.toolUseId,input:e.input};if(yield new hl({agent:this,toolUse:o,tool:n}),!n){let s=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(`Tool '${e.name}' not found in registry`)]});return yield new ci({agent:this,toolUse:o,tool:n,result:s}),s}let i={toolUse:{name:e.name,toolUseId:e.toolUseId,input:e.input},agent:this};try{let a=yield*n.stream(i);if(!a){let c=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(`Tool '${e.name}' did not return a result`)]});return yield new ci({agent:this,toolUse:o,tool:n,result:c}),c}return yield new ci({agent:this,toolUse:o,tool:n,result:a}),a}catch(s){let a=ai(s),c=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(a.message)],error:a});return yield new ci({agent:this,toolUse:o,tool:n,result:c,error:a}),c}}async _appendMessage(e){this.messages.push(e);let r=new Wa({agent:this,message:e});return await this.hooks.invokeCallbacks(r),r}};function kj(t){let e=[],r=[];for(let n of t)if(Array.isArray(n)){let{tools:o,mcpClients:i}=kj(n);e.push(...o),r.push(...i)}else n instanceof xf?r.push(n):e.push(n);return{tools:e,mcpClients:r}}var wf=class{type="agentResult";stopReason;lastMessage;constructor(e){this.stopReason=e.stopReason,this.lastMessage=e.lastMessage}toString(){let e=[];for(let r of this.lastMessage.content)switch(r.type){case"textBlock":e.push(r.text);break;case"reasoningBlock":if(r.text){let n=r.text.replace(/\n/g,` + `);e.push(`\u{1F4AD} Reasoning: + ${n}`)}break;default:console.debug(`Skipping content block type: ${r.type}`);break}return e.join(` +`)}};import{BedrockRuntimeClient as C8,ConverseCommand as R8,ConverseStreamCommand as N8}from"@aws-sdk/client-bedrock-runtime";var Ev=class{type="modelMessageStartEvent";role;constructor(e){this.role=e.role}},Av=class{type="modelContentBlockStartEvent";start;constructor(e){e.start!==void 0&&(this.start=e.start)}},Ov=class{type="modelContentBlockDeltaEvent";contentBlockIndex;delta;constructor(e){this.delta=e.delta}},Pv=class{type="modelContentBlockStopEvent";constructor(e){}},Cv=class{type="modelMessageStopEvent";stopReason;additionalModelResponseFields;constructor(e){this.stopReason=e.stopReason,e.additionalModelResponseFields!==void 0&&(this.additionalModelResponseFields=e.additionalModelResponseFields)}},Rv=class{type="modelMetadataEvent";usage;metrics;trace;constructor(e){e.usage!==void 0&&(this.usage=e.usage),e.metrics!==void 0&&(this.metrics=e.metrics),e.trace!==void 0&&(this.trace=e.trace)}};var Nv=class{_convert_to_class_event(e){switch(e.type){case"modelMessageStartEvent":return new Ev(e);case"modelContentBlockStartEvent":return new Av(e);case"modelContentBlockDeltaEvent":return new Ov(e);case"modelContentBlockStopEvent":return new Pv(e);case"modelMessageStopEvent":return new Cv(e);case"modelMetadataEvent":return new Rv(e);default:throw new Error(`Unsupported event type: ${e}`)}}async*streamAggregated(e,r){let n=null,o=[],i="",s="",a="",c="",u={},l,d=null,f=null,p;for await(let h of this.stream(e,r)){let _=this._convert_to_class_event(h);switch(yield _,_.type){case"modelMessageStartEvent":n=_.role,o.length=0;break;case"modelContentBlockStartEvent":_.start?.type==="toolUseStart"&&(a=_.start.name,c=_.start.toolUseId),s="",i="",u={};break;case"modelContentBlockDeltaEvent":switch(_.delta.type){case"textDelta":i+=_.delta.text;break;case"toolUseInputDelta":s+=_.delta.input;break;case"reasoningContentDelta":_.delta.text&&(u.text=(u.text??"")+_.delta.text),_.delta.signature&&(u.signature=_.delta.signature),_.delta.redactedContent&&(u.redactedContent=_.delta.redactedContent);break}break;case"modelContentBlockStopEvent":{let v;try{c?(v=new dl({name:a,toolUseId:c,input:s?JSON.parse(s):{}}),c="",a=""):Object.keys(u).length>0?v=new pl({...u}):v=new mt(i),o.push(v),yield v}catch(b){b instanceof SyntaxError&&(console.error("Unable to parse JSON string."),l=b)}break}case"modelMessageStopEvent":n&&(d=new Sr({role:n,content:[...o]}),f=_.stopReason);break;case"modelMetadataEvent":p=_;break;default:break}}if(!d||!f)throw new Error("Stream ended without completing a message",{cause:l});if(f==="maxTokens"){let h=new df("Model reached maximum token limit. This is an unrecoverable state that requires intervention.",d);l!==void 0?l.cause=h:l=h}if(l!==void 0)throw l;let m={message:d,stopReason:f};return p!==void 0&&(m.metadata=p),m}};function ct(t,e){if(t==null)throw new Error(`Expected ${e} to be defined, but got ${t}`);return t}var P8={debug:()=>{},info:()=>{},warn:(...t)=>console.warn(...t),error:(...t)=>console.error(...t)},hs=P8;var z8="global.anthropic.claude-sonnet-4-5-20250929-v1:0",M8="us-west-2",j8=!1,D8=["anthropic.claude"],L8=["Input is too long for requested model","input length and `max_tokens` exceed context limit","too many total text bytes"],Tj={end_turn:"endTurn",tool_use:"toolUse",max_tokens:"maxTokens",stop_sequence:"stopSequence",content_filtered:"contentFiltered",guardrail_intervened:"guardrailIntervened"};function U8(t){return t.replace(/_([a-z])/g,(e,r)=>r.toUpperCase())}var ms=class extends Nv{_config;_client;constructor(e){super();let{region:r,clientConfig:n,...o}=e??{};this._config={modelId:z8,...o};let i=n?.customUserAgent?`${n.customUserAgent} strands-agents-ts-sdk`:"strands-agents-ts-sdk";this._client=new C8({...n??{},...r?{region:r}:{},customUserAgent:i}),F8(this._client.config)}updateConfig(e){this._config={...this._config,...e}}getConfig(){return this._config}async*stream(e,r){try{let n=this._formatRequest(e,r);if(this._config.stream!==!1){let o=new N8(n),i=await this._client.send(o);if(i.stream)for await(let s of i.stream){let a=this._mapStreamedBedrockEventToSDKEvent(s);for(let c of a)yield c}}else{let o=new R8(n),i=await this._client.send(o);for(let s of this._mapBedrockEventToSDKEvent(i))yield s}}catch(n){let o=ai(n);throw L8.some(i=>o.message.includes(i))?new ds(o.message):o}}_formatRequest(e,r){let n={modelId:this._config.modelId,messages:this._formatMessages(e)};if(r?.systemPrompt!==void 0)if(typeof r.systemPrompt=="string"){let i=[{text:r.systemPrompt}];this._config.cachePrompt&&i.push({cachePoint:{type:this._config.cachePrompt}}),n.system=i}else r.systemPrompt.length>0&&(this._config.cachePrompt&&hs.warn("cachePrompt config is ignored when systemPrompt is an array, use explicit cache points instead"),n.system=r.systemPrompt.map(i=>this._formatContentBlock(i)));if(r?.toolSpecs&&r.toolSpecs.length>0){let i=r.toolSpecs.map(a=>({toolSpec:{name:a.name,description:a.description,inputSchema:{json:a.inputSchema}}}));this._config.cacheTools&&i.push({cachePoint:{type:this._config.cacheTools}});let s={tools:i};r.toolChoice&&(s.toolChoice=r.toolChoice),n.toolConfig=s}let o={};return this._config.maxTokens!==void 0&&(o.maxTokens=this._config.maxTokens),this._config.temperature!==void 0&&(o.temperature=this._config.temperature),this._config.topP!==void 0&&(o.topP=this._config.topP),this._config.stopSequences!==void 0&&(o.stopSequences=this._config.stopSequences),Object.keys(o).length>0&&(n.inferenceConfig=o),this._config.additionalRequestFields&&(n.additionalModelRequestFields=this._config.additionalRequestFields),this._config.additionalResponseFieldPaths&&(n.additionalModelResponseFieldPaths=this._config.additionalResponseFieldPaths),this._config.additionalArgs&&Object.assign(n,this._config.additionalArgs),n}_formatMessages(e){return e.reduce((r,n)=>{let o=n.content.map(i=>this._formatContentBlock(i)).filter(i=>i!==void 0);return o.length>0&&r.push({role:n.role,content:o}),r},[])}_shouldIncludeToolResultStatus(){let e=this._config.includeToolResultStatus??"auto";if(e===!0)return!0;if(e===!1)return!1;let r=D8.some(n=>this._config.modelId?.includes(n));return hs.debug(`model_id=<${this._config.modelId}>, include_tool_result_status=<${r}> | auto-detected includeToolResultStatus`),r}_formatContentBlock(e){switch(e.type){case"textBlock":return{text:e.text};case"toolUseBlock":return{toolUse:{toolUseId:e.toolUseId,name:e.name,input:e.input}};case"toolResultBlock":{let r=e.content.map(n=>{switch(n.type){case"textBlock":return{text:n.text};case"jsonBlock":return{json:n.json}}});return{toolResult:{toolUseId:e.toolUseId,content:r,...this._shouldIncludeToolResultStatus()&&{status:e.status}}}}case"reasoningBlock":{if(e.text)return{reasoningContent:{reasoningText:{text:e.text,signature:e.signature}}};if(e.redactedContent)return{reasoningContent:{redactedContent:e.redactedContent}};throw Error("reasoning content format incorrect. Either 'text' or 'redactedContent' must be set.")}case"cachePointBlock":return{cachePoint:{type:e.cacheType}};case"imageBlock":return{image:{format:e.format,source:this._formatMediaSource(e.source)}};case"videoBlock":return{video:{format:e.format==="3gp"?"three_gp":e.format,source:this._formatMediaSource(e.source)}};case"documentBlock":return{document:{name:e.name,format:e.format,source:this._formatDocumentSource(e.source),...e.citations&&{citations:e.citations},...e.context&&{context:e.context}}};case"guardContentBlock":{if(e.text)return{guardContent:{text:{text:e.text.text,qualifiers:e.text.qualifiers}}};if(e.image)return{guardContent:{image:{format:e.image.format,source:{bytes:e.image.source.bytes}}}};throw new Error("guardContent must have either text or image")}}}_formatMediaSource(e){switch(e.type){case"imageSourceBytes":case"videoSourceBytes":return{bytes:e.bytes};case"imageSourceUrl":if(e.url.startsWith("s3://"))return{s3Location:{uri:e.url}};console.warn("Ignoring imageSourceUrl content block as its not supported by bedrock");return;case"imageSourceS3Location":case"videoSourceS3Location":return{s3Location:{uri:e.s3Location.uri,...e.s3Location.bucketOwner&&{bucketOwner:e.s3Location.bucketOwner}}};default:throw new Error("Invalid media source")}}_formatDocumentSource(e){switch(e.type){case"documentSourceBytes":return{bytes:e.bytes};case"documentSourceText":return{bytes:new TextEncoder().encode(e.text)};case"documentSourceContentBlock":return{content:e.content.map(r=>({text:r.text}))};case"documentSourceS3Location":return{s3Location:{uri:e.s3Location.uri,...e.s3Location.bucketOwner&&{bucketOwner:e.s3Location.bucketOwner}}};default:throw new Error("Invalid document source")}}_mapBedrockEventToSDKEvent(e){let r=[],n=ct(e.output,"event.output"),o=ct(n.message,"output.message"),i=ct(o.role,"message.role");r.push({type:"modelMessageStartEvent",role:i});let s={text:d=>{r.push({type:"modelContentBlockStartEvent"}),r.push({type:"modelContentBlockDeltaEvent",delta:{type:"textDelta",text:d}}),r.push({type:"modelContentBlockStopEvent"})},toolUse:d=>{r.push({type:"modelContentBlockStartEvent",start:{type:"toolUseStart",name:ct(d.name,"toolUse.name"),toolUseId:ct(d.toolUseId,"toolUse.toolUseId")}}),r.push({type:"modelContentBlockDeltaEvent",delta:{type:"toolUseInputDelta",input:JSON.stringify(ct(d.input,"toolUse.input"))}}),r.push({type:"modelContentBlockStopEvent"})},reasoningContent:d=>{if(!d)return;r.push({type:"modelContentBlockStartEvent"});let f={type:"reasoningContentDelta"};d.reasoningText?(f.text=ct(d.reasoningText.text,"reasoningText.text"),d.reasoningText.signature&&(f.signature=d.reasoningText.signature)):d.redactedContent&&(f.redactedContent=d.redactedContent),Object.keys(f).length>1&&r.push({type:"modelContentBlockDeltaEvent",delta:f}),r.push({type:"modelContentBlockStopEvent"})}};ct(o.content,"message.content").forEach(d=>{for(let f in d)if(f in s){let p=f;s[p](d[p])}else hs.warn(`block_key=<${f}> | skipping unsupported block key`)});let c=ct(e.stopReason,"event.stopReason");r.push({type:"modelMessageStopEvent",stopReason:this._transformStopReason(c,e)});let u=ct(e.usage,"output.usage"),l={type:"modelMetadataEvent",usage:{inputTokens:ct(u.inputTokens,"usage.inputTokens"),outputTokens:ct(u.outputTokens,"usage.outputTokens"),totalTokens:ct(u.totalTokens,"usage.totalTokens")}};return e.metrics&&(l.metrics={latencyMs:ct(e.metrics.latencyMs,"metrics.latencyMs")}),r.push(l),r}_mapStreamedBedrockEventToSDKEvent(e){let r=[],n=ct(Object.keys(e)[0],"eventType"),o=e[n];switch(n){case"messageStart":{let i=o;r.push({type:"modelMessageStartEvent",role:ct(i.role,"messageStart.role")});break}case"contentBlockStart":{let i=o,s={type:"modelContentBlockStartEvent"};if(i.start?.toolUse){let a=i.start.toolUse;s.start={type:"toolUseStart",name:ct(a.name,"toolUse.name"),toolUseId:ct(a.toolUseId,"toolUse.toolUseId")}}r.push(s);break}case"contentBlockDelta":{let s=ct(o.delta,"contentBlockDelta.delta"),a={text:c=>{r.push({type:"modelContentBlockDeltaEvent",delta:{type:"textDelta",text:c}})},toolUse:c=>{c?.input&&r.push({type:"modelContentBlockDeltaEvent",delta:{type:"toolUseInputDelta",input:c.input}})},reasoningContent:c=>{if(!c)return;let u={type:"reasoningContentDelta"};c.text&&(u.text=c.text),c.signature&&(u.signature=c.signature),c.redactedContent&&(u.redactedContent=c.redactedContent),Object.keys(u).length>1&&r.push({type:"modelContentBlockDeltaEvent",delta:u})}};for(let c in s)if(c in a){let u=c;a[u](s[u])}else hs.warn(`delta_key=<${c}> | skipping unsupported delta key`);break}case"contentBlockStop":{r.push({type:"modelContentBlockStopEvent"});break}case"messageStop":{let i=o,s=ct(i.stopReason,"messageStop.stopReason"),a={type:"modelMessageStopEvent",stopReason:this._transformStopReason(s,i)};i.additionalModelResponseFields&&(a.additionalModelResponseFields=i.additionalModelResponseFields),r.push(a);break}case"metadata":{let i=o,s={type:"modelMetadataEvent"};if(i.usage){let a=i.usage,c={inputTokens:ct(a.inputTokens,"usage.inputTokens"),outputTokens:ct(a.outputTokens,"usage.outputTokens"),totalTokens:ct(a.totalTokens,"usage.totalTokens")};a.cacheReadInputTokens!==void 0&&(c.cacheReadInputTokens=a.cacheReadInputTokens),a.cacheWriteInputTokens!==void 0&&(c.cacheWriteInputTokens=a.cacheWriteInputTokens),s.usage=c}i.metrics&&(s.metrics={latencyMs:ct(i.metrics.latencyMs,"metrics.latencyMs")}),i.trace&&(s.trace=i.trace),r.push(s);break}case"internalServerException":case"modelStreamErrorException":case"serviceUnavailableException":case"validationException":case"throttlingException":throw o;default:hs.warn(`event_type=<${n}> | unsupported bedrock event type`);break}return r}_transformStopReason(e,r){let n;if(e in Tj)n=Tj[e];else{let o=U8(e);hs.warn(`stop_reason=<${e}>, fallback=<${o}> | unknown stop reason, converting to camelCase`),n=o}return n==="endTurn"&&r&&"output"in r&&r.output?.message?.content?.some(o=>"toolUse"in o)&&(n="toolUse",hs.warn("stop_reason= | adjusting to tool_use due to tool use in content blocks")),n}};function F8(t){let e=t.region.bind(t);t.region=async()=>{try{return await e()}catch(n){if(ai(n).message==="Region is missing")return M8;throw n}};let r=t.useFipsEndpoint.bind(t);t.useFipsEndpoint=async()=>{try{return await r()}catch(n){if(ai(n).message==="Region is missing")return j8;throw n}}}function bl(t){return!!t._zod}function Jn(t,e){return bl(t)?ba(t,e):t.safeParse(e)}function zv(t){var e,r;if(!t)return;let n;if(bl(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function Oj(t){var e;if(bl(t)){let s=(e=t._zod)===null||e===void 0?void 0:e.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let o=t.value;if(o!==void 0)return o}var fS="2025-11-25";var Pj=[fS,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],To="io.modelcontextprotocol/related-task",jv="2.0",ko=MI(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Cj=tt([A(),We().int()]),Rj=A(),G8=un({ttl:tt([We(),Yp()]).optional(),pollInterval:We().optional()}),mS=un({taskId:A()}),K8=un({progressToken:Cj.optional(),[To]:mS.optional()}),Ur=un({task:G8.optional(),_meta:K8.optional()}),Wt=U({method:A(),params:Ur.optional()}),Ja=un({_meta:U({[To]:ie(mS)}).passthrough().optional()}),kn=U({method:A(),params:Ja.optional()}),cr=un({_meta:un({[To]:mS.optional()}).optional()}),Dv=tt([A(),We().int()]),Nj=U({jsonrpc:se(jv),id:Dv,...Wt.shape}).strict(),hS=t=>Nj.safeParse(t).success,zj=U({jsonrpc:se(jv),...kn.shape}).strict(),Mj=t=>zj.safeParse(t).success,jj=U({jsonrpc:se(jv),id:Dv,result:cr}).strict(),$f=t=>jj.safeParse(t).success,be;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(be||(be={}));var Dj=U({jsonrpc:se(jv),id:Dv,error:U({code:We().int(),message:A(),data:ie(ft())})}).strict(),Lj=t=>Dj.safeParse(t).success,BDe=tt([Nj,zj,jj,Dj]),Xa=cr.strict(),H8=Ja.extend({requestId:Dv,reason:A().optional()}),Lv=kn.extend({method:se("notifications/cancelled"),params:H8}),W8=U({src:A(),mimeType:A().optional(),sizes:Re(A()).optional()}),If=U({icons:Re(W8).optional()}),wl=U({name:A(),title:A().optional()}),Uj=wl.extend({...wl.shape,...If.shape,version:A(),websiteUrl:A().optional()}),J8=Qp(U({applyDefaults:Nt().optional()}),bt(A(),ft())),X8=sv(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Qp(U({form:J8.optional(),url:ko.optional()}),bt(A(),ft()).optional())),Y8=U({list:ie(U({}).passthrough()),cancel:ie(U({}).passthrough()),requests:ie(U({sampling:ie(U({createMessage:ie(U({}).passthrough())}).passthrough()),elicitation:ie(U({create:ie(U({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),Q8=U({list:ie(U({}).passthrough()),cancel:ie(U({}).passthrough()),requests:ie(U({tools:ie(U({call:ie(U({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),eJ=U({experimental:bt(A(),ko).optional(),sampling:U({context:ko.optional(),tools:ko.optional()}).optional(),elicitation:X8.optional(),roots:U({listChanged:Nt().optional()}).optional(),tasks:ie(Y8)}),tJ=Ur.extend({protocolVersion:A(),capabilities:eJ,clientInfo:Uj}),rJ=Wt.extend({method:se("initialize"),params:tJ});var nJ=U({experimental:bt(A(),ko).optional(),logging:ko.optional(),completions:ko.optional(),prompts:ie(U({listChanged:ie(Nt())})),resources:U({subscribe:Nt().optional(),listChanged:Nt().optional()}).optional(),tools:U({listChanged:Nt().optional()}).optional(),tasks:ie(Q8)}).passthrough(),gS=cr.extend({protocolVersion:A(),capabilities:nJ,serverInfo:Uj,instructions:A().optional()}),oJ=kn.extend({method:se("notifications/initialized")});var Uv=Wt.extend({method:se("ping")}),iJ=U({progress:We(),total:ie(We()),message:ie(A())}),sJ=U({...Ja.shape,...iJ.shape,progressToken:Cj}),Fv=kn.extend({method:se("notifications/progress"),params:sJ}),aJ=Ur.extend({cursor:Rj.optional()}),Sf=Wt.extend({params:aJ.optional()}),kf=cr.extend({nextCursor:ie(Rj)}),Tf=U({taskId:A(),status:zt(["working","input_required","completed","failed","cancelled"]),ttl:tt([We(),Yp()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:ie(We()),statusMessage:ie(A())}),Ya=cr.extend({task:Tf}),cJ=Ja.merge(Tf),Ef=kn.extend({method:se("notifications/tasks/status"),params:cJ}),Bv=Wt.extend({method:se("tasks/get"),params:Ur.extend({taskId:A()})}),Zv=cr.merge(Tf),qv=Wt.extend({method:se("tasks/result"),params:Ur.extend({taskId:A()})}),Vv=Sf.extend({method:se("tasks/list")}),Gv=kf.extend({tasks:Re(Tf)}),Fj=Wt.extend({method:se("tasks/cancel"),params:Ur.extend({taskId:A()})}),Bj=cr.merge(Tf),Zj=U({uri:A(),mimeType:ie(A()),_meta:bt(A(),ft()).optional()}),qj=Zj.extend({text:A()}),_S=A().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Vj=Zj.extend({blob:_S}),xl=U({audience:Re(zt(["user","assistant"])).optional(),priority:We().min(0).max(1).optional(),lastModified:il.datetime({offset:!0}).optional()}),Gj=U({...wl.shape,...If.shape,uri:A(),description:ie(A()),mimeType:ie(A()),annotations:xl.optional(),_meta:ie(un({}))}),uJ=U({...wl.shape,...If.shape,uriTemplate:A(),description:ie(A()),mimeType:ie(A()),annotations:xl.optional(),_meta:ie(un({}))}),lJ=Sf.extend({method:se("resources/list")}),yS=kf.extend({resources:Re(Gj)}),dJ=Sf.extend({method:se("resources/templates/list")}),vS=kf.extend({resourceTemplates:Re(uJ)}),bS=Ur.extend({uri:A()}),pJ=bS,fJ=Wt.extend({method:se("resources/read"),params:pJ}),wS=cr.extend({contents:Re(tt([qj,Vj]))}),mJ=kn.extend({method:se("notifications/resources/list_changed")}),hJ=bS,gJ=Wt.extend({method:se("resources/subscribe"),params:hJ}),_J=bS,yJ=Wt.extend({method:se("resources/unsubscribe"),params:_J}),vJ=Ja.extend({uri:A()}),bJ=kn.extend({method:se("notifications/resources/updated"),params:vJ}),wJ=U({name:A(),description:ie(A()),required:ie(Nt())}),xJ=U({...wl.shape,...If.shape,description:ie(A()),arguments:ie(Re(wJ)),_meta:ie(un({}))}),$J=Sf.extend({method:se("prompts/list")}),xS=kf.extend({prompts:Re(xJ)}),IJ=Ur.extend({name:A(),arguments:bt(A(),A()).optional()}),SJ=Wt.extend({method:se("prompts/get"),params:IJ}),$S=U({type:se("text"),text:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),IS=U({type:se("image"),data:_S,mimeType:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),SS=U({type:se("audio"),data:_S,mimeType:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),kJ=U({type:se("tool_use"),name:A(),id:A(),input:U({}).passthrough(),_meta:ie(U({}).passthrough())}).passthrough(),TJ=U({type:se("resource"),resource:tt([qj,Vj]),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),EJ=Gj.extend({type:se("resource_link")}),kS=tt([$S,IS,SS,EJ,TJ]),AJ=U({role:zt(["user","assistant"]),content:kS}),TS=cr.extend({description:ie(A()),messages:Re(AJ)}),OJ=kn.extend({method:se("notifications/prompts/list_changed")}),PJ=U({title:A().optional(),readOnlyHint:Nt().optional(),destructiveHint:Nt().optional(),idempotentHint:Nt().optional(),openWorldHint:Nt().optional()}),CJ=U({taskSupport:zt(["required","optional","forbidden"]).optional()}),Kj=U({...wl.shape,...If.shape,description:A().optional(),inputSchema:U({type:se("object"),properties:bt(A(),ko).optional(),required:Re(A()).optional()}).catchall(ft()),outputSchema:U({type:se("object"),properties:bt(A(),ko).optional(),required:Re(A()).optional()}).catchall(ft()).optional(),annotations:ie(PJ),execution:ie(CJ),_meta:bt(A(),ft()).optional()}),RJ=Sf.extend({method:se("tools/list")}),ES=kf.extend({tools:Re(Kj)}),$l=cr.extend({content:Re(kS).default([]),structuredContent:bt(A(),ft()).optional(),isError:ie(Nt())}),ZDe=$l.or(cr.extend({toolResult:ft()})),NJ=Ur.extend({name:A(),arguments:ie(bt(A(),ft()))}),zJ=Wt.extend({method:se("tools/call"),params:NJ}),MJ=kn.extend({method:se("notifications/tools/list_changed")}),Hj=zt(["debug","info","notice","warning","error","critical","alert","emergency"]),jJ=Ur.extend({level:Hj}),DJ=Wt.extend({method:se("logging/setLevel"),params:jJ}),LJ=Ja.extend({level:Hj,logger:A().optional(),data:ft()}),UJ=kn.extend({method:se("notifications/message"),params:LJ}),FJ=U({name:A().optional()}),BJ=U({hints:ie(Re(FJ)),costPriority:ie(We().min(0).max(1)),speedPriority:ie(We().min(0).max(1)),intelligencePriority:ie(We().min(0).max(1))}),ZJ=U({mode:ie(zt(["auto","required","none"]))}),qJ=U({type:se("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:Re(kS).default([]),structuredContent:U({}).passthrough().optional(),isError:ie(Nt()),_meta:ie(U({}).passthrough())}).passthrough(),VJ=ov("type",[$S,IS,SS]),Mv=ov("type",[$S,IS,SS,kJ,qJ]),GJ=U({role:zt(["user","assistant"]),content:tt([Mv,Re(Mv)]),_meta:ie(U({}).passthrough())}).passthrough(),KJ=Ur.extend({messages:Re(GJ),modelPreferences:BJ.optional(),systemPrompt:A().optional(),includeContext:zt(["none","thisServer","allServers"]).optional(),temperature:We().optional(),maxTokens:We().int(),stopSequences:Re(A()).optional(),metadata:ko.optional(),tools:ie(Re(Kj)),toolChoice:ie(ZJ)}),AS=Wt.extend({method:se("sampling/createMessage"),params:KJ}),OS=cr.extend({model:A(),stopReason:ie(zt(["endTurn","stopSequence","maxTokens"]).or(A())),role:zt(["user","assistant"]),content:VJ}),HJ=cr.extend({model:A(),stopReason:ie(zt(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:zt(["user","assistant"]),content:tt([Mv,Re(Mv)])}),WJ=U({type:se("boolean"),title:A().optional(),description:A().optional(),default:Nt().optional()}),JJ=U({type:se("string"),title:A().optional(),description:A().optional(),minLength:We().optional(),maxLength:We().optional(),format:zt(["email","uri","date","date-time"]).optional(),default:A().optional()}),XJ=U({type:zt(["number","integer"]),title:A().optional(),description:A().optional(),minimum:We().optional(),maximum:We().optional(),default:We().optional()}),YJ=U({type:se("string"),title:A().optional(),description:A().optional(),enum:Re(A()),default:A().optional()}),QJ=U({type:se("string"),title:A().optional(),description:A().optional(),oneOf:Re(U({const:A(),title:A()})),default:A().optional()}),e7=U({type:se("string"),title:A().optional(),description:A().optional(),enum:Re(A()),enumNames:Re(A()).optional(),default:A().optional()}),t7=tt([YJ,QJ]),r7=U({type:se("array"),title:A().optional(),description:A().optional(),minItems:We().optional(),maxItems:We().optional(),items:U({type:se("string"),enum:Re(A())}),default:Re(A()).optional()}),n7=U({type:se("array"),title:A().optional(),description:A().optional(),minItems:We().optional(),maxItems:We().optional(),items:U({anyOf:Re(U({const:A(),title:A()}))}),default:Re(A()).optional()}),o7=tt([r7,n7]),i7=tt([e7,t7,o7]),s7=tt([i7,WJ,JJ,XJ]),a7=Ur.extend({mode:se("form").optional(),message:A(),requestedSchema:U({type:se("object"),properties:bt(A(),s7),required:Re(A()).optional()})}),c7=Ur.extend({mode:se("url"),message:A(),elicitationId:A(),url:A().url()}),u7=tt([a7,c7]),PS=Wt.extend({method:se("elicitation/create"),params:u7}),l7=Ja.extend({elicitationId:A()}),d7=kn.extend({method:se("notifications/elicitation/complete"),params:l7}),CS=cr.extend({action:zt(["accept","decline","cancel"]),content:sv(t=>t===null?void 0:t,bt(A(),tt([A(),We(),Nt(),Re(A())])).optional())}),p7=U({type:se("ref/resource"),uri:A()});var f7=U({type:se("ref/prompt"),name:A()}),m7=Ur.extend({ref:tt([f7,p7]),argument:U({name:A(),value:A()}),context:U({arguments:bt(A(),A()).optional()}).optional()}),h7=Wt.extend({method:se("completion/complete"),params:m7});var RS=cr.extend({completion:un({values:Re(A()).max(100),total:ie(We().int()),hasMore:ie(Nt())})}),g7=U({uri:A().startsWith("file://"),name:A().optional(),_meta:bt(A(),ft()).optional()}),_7=Wt.extend({method:se("roots/list")}),y7=cr.extend({roots:Re(g7)}),v7=kn.extend({method:se("notifications/roots/list_changed")}),qDe=tt([Uv,rJ,h7,DJ,SJ,$J,lJ,dJ,fJ,gJ,yJ,zJ,RJ,Bv,qv,Vv]),VDe=tt([Lv,Fv,oJ,v7,Ef]),GDe=tt([Xa,OS,HJ,CS,y7,Zv,Gv,Ya]),KDe=tt([Uv,AS,PS,_7,Bv,qv,Vv]),HDe=tt([Lv,Fv,UJ,bJ,mJ,MJ,OJ,Ef,d7]),WDe=tt([Xa,gS,RS,TS,xS,yS,vS,wS,$l,ES,Zv,Gv,Ya]),de=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===be.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new pS(o.elicitations,r)}return new t(e,r,n)}},pS=class extends de{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(be.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}};function gs(t){return t==="completed"||t==="failed"||t==="cancelled"}var b7=Symbol("Let zodToJsonSchema decide on which parser to use");var ALe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function NS(t){let e=zv(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Oj(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function zS(t,e){let r=Jn(t,e);if(!r.success)throw r.error;return r.data}var k7=6e4,Kv=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Lv,r=>{this._oncancel(r)}),this.setNotificationHandler(Fv,r=>{this._onprogress(r)}),this.setRequestHandler(Uv,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Bv,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new de(be.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(qv,async(r,n)=>{let o=async()=>{var i;let s=r.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(c.type==="response"||c.type==="error"){let u=c.message,l=u.id,d=this._requestResolvers.get(l);if(d)if(this._requestResolvers.delete(l),c.type==="response")d(u);else{let f=u,p=new de(f.error.code,f.error.message,f.error.data);d(p)}else{let f=c.type==="response"?"Response":"Error";this._onerror(new Error(`${f} handler missing for request ${l}`))}continue}await((i=this._transport)===null||i===void 0?void 0:i.send(c.message,{relatedRequestId:n.requestId}))}}let a=await this._taskStore.getTask(s,n.sessionId);if(!a)throw new de(be.InvalidParams,`Task not found: ${s}`);if(!gs(a.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(gs(a.status)){let c=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...c,_meta:{...c._meta,[To]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(Vv,async(r,n)=>{var o;try{let{tasks:i,nextCursor:s}=await this._taskStore.listTasks((o=r.params)===null||o===void 0?void 0:o.cursor,n.sessionId);return{tasks:i,nextCursor:s,_meta:{}}}catch(i){throw new de(be.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Fj,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new de(be.InvalidParams,`Task not found: ${r.params.taskId}`);if(gs(o.status))throw new de(be.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new de(be.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof de?o:new de(be.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){let r=this._requestHandlerAbortControllers.get(e.params.requestId);r?.abort(e.params.reason)}_setupTimeout(e,r,n,o,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),de.fromError(be.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,o;this._transport=e;let i=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};let s=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{s?.(c),this._onerror(c)};let a=(o=this._transport)===null||o===void 0?void 0:o.onmessage;this._transport.onmessage=(c,u)=>{a?.(c,u),$f(c)||Lj(c)?this._onresponse(c):hS(c)?this._onrequest(c,u):Mj(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let n=de.fromError(be.ConnectionClosed,"Connection closed");this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);for(let o of r.values())o(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){var n,o,i,s,a,c;let u=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,l=this._transport,d=(s=(i=(o=e.params)===null||o===void 0?void 0:o._meta)===null||i===void 0?void 0:i[To])===null||s===void 0?void 0:s.taskId;if(u===void 0){let _={jsonrpc:"2.0",id:e.id,error:{code:be.MethodNotFound,message:"Method not found"}};d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:_,timestamp:Date.now()},l?.sessionId).catch(v=>this._onerror(new Error(`Failed to enqueue error response: ${v}`))):l?.send(_).catch(v=>this._onerror(new Error(`Failed to send an error response: ${v}`)));return}let f=new AbortController;this._requestHandlerAbortControllers.set(e.id,f);let p=(a=e.params)===null||a===void 0?void 0:a.task,m=this._taskStore?this.requestTaskStore(e,l?.sessionId):void 0,h={signal:f.signal,sessionId:l?.sessionId,_meta:(c=e.params)===null||c===void 0?void 0:c._meta,sendNotification:async _=>{let v={relatedRequestId:e.id};d&&(v.relatedTask={taskId:d}),await this.notification(_,v)},sendRequest:async(_,v,b)=>{var x,k;let T={...b,relatedRequestId:e.id};d&&!T.relatedTask&&(T.relatedTask={taskId:d});let F=(k=(x=T.relatedTask)===null||x===void 0?void 0:x.taskId)!==null&&k!==void 0?k:d;return F&&m&&await m.updateTaskStatus(F,"input_required"),await this.request(_,v,T)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:d,taskStore:m,taskRequestedTtl:p?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{p&&this.assertTaskHandlerCapability(e.method)}).then(()=>u(e,h)).then(async _=>{if(f.signal.aborted)return;let v={result:_,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:v,timestamp:Date.now()},l?.sessionId):await l?.send(v)},async _=>{var v;if(f.signal.aborted)return;let b={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(_.code)?_.code:be.InternalError,message:(v=_.message)!==null&&v!==void 0?v:"Internal error",..._.data!==void 0&&{data:_.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:b,timestamp:Date.now()},l?.sessionId):await l?.send(b)}).catch(_=>this._onerror(new Error(`Failed to send response: ${_}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),$f(e))n(e);else{let s=new de(e.error.code,e.error.message,e.error.data);n(s)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if($f(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(i=!0,this._taskProgressTokens.set(a.taskId,r))}}if(i||this._progressHandlers.delete(r),$f(e))o(e);else{let s=de.fromError(e.error.code,e.error.message,e.error.data);o(s)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}async*requestStream(e,r,n){var o,i,s,a;let{task:c}=n??{};if(!c){try{yield{type:"result",result:await this.request(e,r,n)}}catch(l){yield{type:"error",error:l instanceof de?l:new de(be.InternalError,String(l))}}return}let u;try{let l=await this.request(e,Ya,n);if(l.task)u=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new de(be.InternalError,"Task creation did not return a task");for(;;){let d=await this.getTask({taskId:u},n);if(yield{type:"taskStatus",task:d},gs(d.status)){d.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)}:d.status==="failed"?yield{type:"error",error:new de(be.InternalError,`Task ${u} failed`)}:d.status==="cancelled"&&(yield{type:"error",error:new de(be.InternalError,`Task ${u} was cancelled`)});return}if(d.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)};return}let f=(s=(o=d.pollInterval)!==null&&o!==void 0?o:(i=this._options)===null||i===void 0?void 0:i.defaultTaskPollInterval)!==null&&s!==void 0?s:1e3;await new Promise(p=>setTimeout(p,f)),(a=n?.signal)===null||a===void 0||a.throwIfAborted()}}catch(l){yield{type:"error",error:l instanceof de?l:new de(be.InternalError,String(l))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{var d,f,p,m,h,_,v;let b=Z=>{l(Z)};if(!this._transport){b(new Error("Not connected"));return}if(((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(Z){b(Z);return}(f=n?.signal)===null||f===void 0||f.throwIfAborted();let x=this._requestMessageId++,k={...e,jsonrpc:"2.0",id:x};n?.onprogress&&(this._progressHandlers.set(x,n.onprogress),k.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:x}}),a&&(k.params={...k.params,task:a}),c&&(k.params={...k.params,_meta:{...((m=k.params)===null||m===void 0?void 0:m._meta)||{},[To]:c}});let T=Z=>{var oe;this._responseHandlers.delete(x),this._progressHandlers.delete(x),this._cleanupTimeout(x),(oe=this._transport)===null||oe===void 0||oe.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:x,reason:String(Z)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(wt=>this._onerror(new Error(`Failed to send cancellation: ${wt}`)));let Q=Z instanceof de?Z:new de(be.RequestTimeout,String(Z));l(Q)};this._responseHandlers.set(x,Z=>{var oe;if(!(!((oe=n?.signal)===null||oe===void 0)&&oe.aborted)){if(Z instanceof Error)return l(Z);try{let Q=Jn(r,Z.result);Q.success?u(Q.data):l(Q.error)}catch(Q){l(Q)}}}),(h=n?.signal)===null||h===void 0||h.addEventListener("abort",()=>{var Z;T((Z=n?.signal)===null||Z===void 0?void 0:Z.reason)});let F=(_=n?.timeout)!==null&&_!==void 0?_:k7,J=()=>T(de.fromError(be.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(x,F,n?.maxTotalTimeout,J,(v=n?.resetTimeoutOnProgress)!==null&&v!==void 0?v:!1);let w=c?.taskId;if(w){let Z=oe=>{let Q=this._responseHandlers.get(x);Q?Q(oe):this._onerror(new Error(`Response handler missing for side-channeled request ${x}`))};this._requestResolvers.set(x,Z),this._enqueueTaskMessage(w,{type:"request",message:k,timestamp:Date.now()}).catch(oe=>{this._cleanupTimeout(x),l(oe)})}else this._transport.send(k,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(Z=>{this._cleanupTimeout(x),l(Z)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Zv,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Gv,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Bj,r)}async notification(e,r){var n,o,i,s,a;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let c=(n=r?.relatedTask)===null||n===void 0?void 0:n.taskId;if(c){let f={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...((o=e.params)===null||o===void 0?void 0:o._meta)||{},[To]:r.relatedTask}}};await this._enqueueTaskMessage(c,{type:"notification",message:f,timestamp:Date.now()});return}if(((s=(i=this._options)===null||i===void 0?void 0:i.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var f,p;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let m={...e,jsonrpc:"2.0"};r?.relatedTask&&(m={...m,params:{...m.params,_meta:{...((f=m.params)===null||f===void 0?void 0:f._meta)||{},[To]:r.relatedTask}}}),(p=this._transport)===null||p===void 0||p.send(m,r).catch(h=>this._onerror(h))});return}let d={...e,jsonrpc:"2.0"};r?.relatedTask&&(d={...d,params:{...d.params,_meta:{...((a=d.params)===null||a===void 0?void 0:a._meta)||{},[To]:r.relatedTask}}}),await this._transport.send(d,r)}setRequestHandler(e,r){let n=NS(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let s=zS(e,o);return Promise.resolve(r(s,i))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=NS(e);this._notificationHandlers.set(n,o=>{let i=zS(e,o);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){var o;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=(o=this._options)===null||o===void 0?void 0:o.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,i)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&hS(o.message)){let i=o.message.id,s=this._requestResolvers.get(i);s?(s(new de(be.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){var n,o,i;let s=(o=(n=this._options)===null||n===void 0?void 0:n.defaultTaskPollInterval)!==null&&o!==void 0?o:1e3;try{let a=await((i=this._taskStore)===null||i===void 0?void 0:i.getTask(e));a?.pollInterval&&(s=a.pollInterval)}catch{}return new Promise((a,c)=>{if(r.aborted){c(new de(be.InvalidRequest,"Request cancelled"));return}let u=setTimeout(a,s);r.addEventListener("abort",()=>{clearTimeout(u),c(new de(be.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new de(be.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await n.storeTaskResult(o,i,s,r);let a=await n.getTask(o,r);if(a){let c=Ef.parse({method:"notifications/tasks/status",params:a});await this.notification(c),gs(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,s)=>{let a=await n.getTask(o,r);if(!a)throw new de(be.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(gs(a.status))throw new de(be.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,s,r);let c=await n.getTask(o,r);if(c){let u=Ef.parse({method:"notifications/tasks/status",params:c});await this.notification(u),gs(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Wj(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Jj(t,e){let r={...t};for(let n in e){let o=n,i=e[o];if(i===void 0)continue;let s=r[o];Wj(s)&&Wj(i)?r[o]={...s,...i}:r[o]=i}return r}var MU=mn(bT(),1),jU=mn(zU(),1);function gre(){let t=new MU.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,jU.default)(t),t}var Ob=class{constructor(e){this._ajv=e??gre()}getValidator(e){var r;let n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return o=>n(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Pb=class{constructor(e){this._client=e}async*callToolStream(e,r=$l,n){var o;let i=this._client,s={...n,task:(o=n?.task)!==null&&o!==void 0?o:i.isToolTask(e.name)?{}:void 0},a=i.requestStream({method:"tools/call",params:e},r,s),c=i.getToolOutputValidator(e.name);for await(let u of a){if(u.type==="result"&&c){let l=u.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new de(be.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{let d=c(l.structuredContent);if(!d.valid){yield{type:"error",error:new de(be.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof de){yield{type:"error",error:d};return}yield{type:"error",error:new de(be.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield u}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function DU(t,e,r){var n;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!(!((n=t.tools)===null||n===void 0)&&n.call))throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function LU(t,e,r){var n,o;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!(!((n=t.sampling)===null||n===void 0)&&n.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!(!((o=t.elicitation)===null||o===void 0)&&o.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function Cb(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let o of Object.keys(n)){let i=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[o]=i.default),r[o]!==void 0&&Cb(i,r[o])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)Cb(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)Cb(r,e)}}function _re(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var Rb=class extends Kv{constructor(e,r){var n,o;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._jsonSchemaValidator=(o=r?.jsonSchemaValidator)!==null&&o!==void 0?o:new Ob}get experimental(){return this._experimental||(this._experimental={tasks:new Pb(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Jj(this._capabilities,e)}setRequestHandler(e,r){var n,o,i;let s=zv(e),a=s?.method;if(!a)throw new Error("Schema is missing a method literal");let c;if(bl(a)){let l=a,d=(n=l._zod)===null||n===void 0?void 0:n.def;c=(o=d?.value)!==null&&o!==void 0?o:l.value}else{let l=a,d=l._def;c=(i=d?.value)!==null&&i!==void 0?i:l.value}if(typeof c!="string")throw new Error("Schema method literal must be a string");let u=c;if(u==="elicitation/create"){let l=async(d,f)=>{var p,m,h;let _=Jn(PS,d);if(!_.success){let Z=_.error instanceof Error?_.error.message:String(_.error);throw new de(be.InvalidParams,`Invalid elicitation request: ${Z}`)}let{params:v}=_.data,b=(p=v.mode)!==null&&p!==void 0?p:"form",{supportsFormMode:x,supportsUrlMode:k}=_re(this._capabilities.elicitation);if(b==="form"&&!x)throw new de(be.InvalidParams,"Client does not support form-mode elicitation requests");if(b==="url"&&!k)throw new de(be.InvalidParams,"Client does not support URL-mode elicitation requests");let T=await Promise.resolve(r(d,f));if(v.task){let Z=Jn(Ya,T);if(!Z.success){let oe=Z.error instanceof Error?Z.error.message:String(Z.error);throw new de(be.InvalidParams,`Invalid task creation result: ${oe}`)}return Z.data}let F=Jn(CS,T);if(!F.success){let Z=F.error instanceof Error?F.error.message:String(F.error);throw new de(be.InvalidParams,`Invalid elicitation result: ${Z}`)}let J=F.data,w=b==="form"?v.requestedSchema:void 0;if(b==="form"&&J.action==="accept"&&J.content&&w&&!((h=(m=this._capabilities.elicitation)===null||m===void 0?void 0:m.form)===null||h===void 0)&&h.applyDefaults)try{Cb(w,J.content)}catch{}return J};return super.setRequestHandler(e,l)}if(u==="sampling/createMessage"){let l=async(d,f)=>{let p=Jn(AS,d);if(!p.success){let v=p.error instanceof Error?p.error.message:String(p.error);throw new de(be.InvalidParams,`Invalid sampling request: ${v}`)}let{params:m}=p.data,h=await Promise.resolve(r(d,f));if(m.task){let v=Jn(Ya,h);if(!v.success){let b=v.error instanceof Error?v.error.message:String(v.error);throw new de(be.InvalidParams,`Invalid task creation result: ${b}`)}return v.data}let _=Jn(OS,h);if(!_.success){let v=_.error instanceof Error?_.error.message:String(_.error);throw new de(be.InvalidParams,`Invalid sampling result: ${v}`)}return _.data};return super.setRequestHandler(e,l)}return super.setRequestHandler(e,r)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:fS,capabilities:this._capabilities,clientInfo:this._clientInfo}},gS,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!Pj.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,o,i,s;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){var r,n;DU((n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests,e,"Server")}assertTaskHandlerCapability(e){var r;this._capabilities&&LU((r=this._capabilities.tasks)===null||r===void 0?void 0:r.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Xa,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},RS,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Xa,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},TS,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},xS,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},yS,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},vS,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},wS,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Xa,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Xa,r)}async callTool(e,r=$l,n){if(this.isToolTaskRequired(e.name))throw new de(be.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},r,n),i=this.getToolOutputValidator(e.name);if(i){if(!o.structuredContent&&!o.isError)throw new de(be.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let s=i(o.structuredContent);if(!s.valid)throw new de(be.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof de?s:new de(be.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return o}isToolTask(e){var r,n,o,i;return!((i=(o=(n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests)===null||o===void 0?void 0:o.tools)===null||i===void 0)&&i.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){var r;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let n of e){if(n.outputSchema){let i=this._jsonSchemaValidator.getValidator(n.outputSchema);this._cachedToolOutputValidators.set(n.name,i)}let o=(r=n.execution)===null||r===void 0?void 0:r.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(n.name),o==="required"&&this._cachedRequiredTaskTools.add(n.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},ES,r);return this.cacheToolMetadata(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Nb=class extends fl{name;description;toolSpec;mcpClient;constructor(e){super(),this.name=e.name,this.description=e.description,this.toolSpec={name:e.name,description:e.description,inputSchema:e.inputSchema},this.mcpClient=e.client}async*stream(e){let{toolUseId:r,input:n}=e.toolUse;try{let o=await this.mcpClient.callTool(this,n);if(!this._isMcpToolResult(o))throw new Error("Invalid tool result from MCP Client: missing content array");let i=o.content.map(s=>this._isMcpTextContent(s)?new mt(s.text):new Ha({json:s}));return i.length===0&&i.push(new mt("Tool execution completed successfully with no output.")),new Ht({toolUseId:r,status:o.isError?"error":"success",content:i})}catch(o){return lS(o,r)}}_isMcpToolResult(e){return typeof e!="object"||e===null?!1:Array.isArray(e.content)}_isMcpTextContent(e){if(typeof e!="object"||e===null)return!1;let r=e;return r.type==="text"&&typeof r.text=="string"}};var xf=class{_clientName;_clientVersion;_transport;_connected;_client;constructor(e){this._clientName=e.applicationName||"strands-agents-ts-sdk",this._clientVersion=e.applicationVersion||"0.0.1",this._transport=e.transport,this._connected=!1,this._client=new Rb({name:this._clientName,version:this._clientVersion})}get client(){return this._client}async connect(e=!1){this._connected&&!e||(this._connected&&e&&(await this._client.close(),this._connected=!1),await this._client.connect(this._transport),this._connected=!0)}async disconnect(){await this._client.close(),await this._transport.close(),this._connected=!1}async listTools(){return await this.connect(),(await this._client.listTools()).tools.map(r=>new Nb({name:r.name,description:r.description??"",inputSchema:r.inputSchema,client:this}))}async callTool(e,r){if(await this.connect(),r==null)return await this.callTool(e,{});if(typeof r!="object"||Array.isArray(r))throw new Error(`MCP Protocol Error: Tool arguments must be a JSON Object (named parameters). Received: ${Array.isArray(r)?"Array":typeof r}`);return await this._client.callTool({name:e.name,arguments:r})}};var UU=({model:t})=>{let e=new ms({region:"us-east-1",modelId:t,maxTokens:4096,temperature:.7});return new bf({model:e})};var yre=async({message:t="\u3053\u3093\u306B\u3061\u306F\uFF01",model:e="us.amazon.nova-micro-v1:0"},r)=>{let n=UU({model:e});for await(let o of n.stream(t))o.type==="modelContentBlockDeltaEvent"&&o.delta.type==="textDelta"&&r.write(o.delta.text)},vre=awslambda.streamifyResponse(async(t,e)=>{wm.debug("event",{event:t});let{message:r,model:n}=t.body?JSON.parse(t.body):{message:"\u3042\u306A\u305F\u306F\u8AB0\uFF1F",model:"gpt"};await yre({message:r,model:n},e),e.end()}),EBe=vre;export{EBe as default,yre as handle,vre as handler}; +/*! Bundled license information: + +@aws-lambda-powertools/logger/lib/esm/logBuffer.js: + (* v8 ignore next -- @preserve *) + +@langchain/core/dist/utils/fast-json-patch/src/helpers.js: + (*! + * https://github.com/Starcounter-Jack/JSON-Patch + * (c) 2017-2022 Joachim Wester + * MIT licensed + *) + +@langchain/core/dist/utils/sax-js/sax.js: + (*! http://mths.be/fromcodepoint v0.1.0 by @mathias *) +*/ diff --git a/agents/agent-strands/cdk.out/asset.60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321/index.mjs b/agents/agent-strands/cdk.out/asset.60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321/index.mjs new file mode 100644 index 00000000..6de2943d --- /dev/null +++ b/agents/agent-strands/cdk.out/asset.60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321/index.mjs @@ -0,0 +1,238 @@ +import { createRequire } from 'module';const require = createRequire(import.meta.url); +var FU=Object.create;var zb=Object.defineProperty;var BU=Object.getOwnPropertyDescriptor;var ZU=Object.getOwnPropertyNames;var qU=Object.getPrototypeOf,VU=Object.prototype.hasOwnProperty;var P=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),gi=(t,e)=>{for(var r in e)zb(t,r,{get:e[r],enumerable:!0})},GU=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ZU(e))!VU.call(t,o)&&o!==r&&zb(t,o,{get:()=>e[o],enumerable:!(n=BU(e,o))||n.enumerable});return t};var mn=(t,e,r)=>(r=t!=null?FU(qU(t)):{},GU(e||!t||!t.__esModule?zb(r,"default",{value:t,enumerable:!0}):r,t));var Xb=P((Kl,lc)=>{var JU=200,GT="__lodash_hash_undefined__",XU=800,YU=16,KT=9007199254740991,HT="[object Arguments]",QU="[object Array]",e4="[object AsyncFunction]",t4="[object Boolean]",r4="[object Date]",n4="[object Error]",WT="[object Function]",o4="[object GeneratorFunction]",i4="[object Map]",s4="[object Number]",a4="[object Null]",JT="[object Object]",c4="[object Proxy]",u4="[object RegExp]",l4="[object Set]",d4="[object String]",p4="[object Undefined]",f4="[object WeakMap]",m4="[object ArrayBuffer]",h4="[object DataView]",g4="[object Float32Array]",_4="[object Float64Array]",y4="[object Int8Array]",v4="[object Int16Array]",b4="[object Int32Array]",w4="[object Uint8Array]",x4="[object Uint8ClampedArray]",$4="[object Uint16Array]",I4="[object Uint32Array]",S4=/[\\^$.*+?()[\]{}|]/g,k4=/^\[object .+?Constructor\]$/,T4=/^(?:0|[1-9]\d*)$/,st={};st[g4]=st[_4]=st[y4]=st[v4]=st[b4]=st[w4]=st[x4]=st[$4]=st[I4]=!0;st[HT]=st[QU]=st[m4]=st[t4]=st[h4]=st[r4]=st[n4]=st[WT]=st[i4]=st[s4]=st[JT]=st[u4]=st[l4]=st[d4]=st[f4]=!1;var XT=typeof global=="object"&&global&&global.Object===Object&&global,E4=typeof self=="object"&&self&&self.Object===Object&&self,Jl=XT||E4||Function("return this")(),YT=typeof Kl=="object"&&Kl&&!Kl.nodeType&&Kl,Hl=YT&&typeof lc=="object"&&lc&&!lc.nodeType&&lc,QT=Hl&&Hl.exports===YT,Fb=QT&&XT.process,jT=(function(){try{var t=Hl&&Hl.require&&Hl.require("util").types;return t||Fb&&Fb.binding&&Fb.binding("util")}catch{}})(),DT=jT&&jT.isTypedArray;function A4(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function O4(t,e){for(var r=-1,n=Array(t);++r-1}function Y4(t,e){var r=this.__data__,n=pm(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}jo.prototype.clear=H4;jo.prototype.delete=W4;jo.prototype.get=J4;jo.prototype.has=X4;jo.prototype.set=Y4;function dc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(i=t.length>3&&typeof i=="function"?(o--,i):void 0,s&&T2(r[0],r[1],s)&&(i=o<3?void 0:i,o=1),e=Object(e);++n-1&&t%1==0&&t0){if(++e>=XU)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function z2(t){if(t!=null){try{return dm.call(t)}catch{}try{return t+""}catch{}}return""}function hm(t,e){return t===e||t!==t&&e!==e}var Vb=VT((function(){return arguments})())?VT:function(t){return Xl(t)&&Mo.call(t,"callee")&&!D4.call(t,"callee")},Gb=Array.isArray;function Wb(t){return t!=null&&aE(t.length)&&!Jb(t)}function M2(t){return Xl(t)&&Wb(t)}var sE=U4||F2;function Jb(t){if(!Ps(t))return!1;var e=fm(t);return e==WT||e==o4||e==e4||e==c4}function aE(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=KT}function Ps(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Xl(t){return t!=null&&typeof t=="object"}function j2(t){if(!Xl(t)||fm(t)!=JT)return!1;var e=tE(t);if(e===null)return!0;var r=Mo.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&dm.call(r)==M4}var cE=DT?P4(DT):f2;function D2(t){return x2(t,uE(t))}function uE(t){return Wb(t)?u2(t,!0):m2(t)}var L2=$2(function(t,e,r){nE(t,e,r)});function U2(t){return function(){return t}}function lE(t){return t}function F2(){return!1}lc.exports=L2});var xA=P((_de,wA)=>{"use strict";wA.exports=function(t,e){if(typeof t!="string")throw new TypeError("Expected a string");return e=typeof e>"u"?"_":e,t.replace(/([a-z\d])([A-Z])/g,"$1"+e+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+e+"$2").toLowerCase()}});var AA=P((yde,Zw)=>{"use strict";var dB=/[\p{Lu}]/u,pB=/[\p{Ll}]/u,$A=/^[\p{Lu}](?![\p{Lu}])/gu,kA=/([\p{Alpha}\p{N}_]|$)/u,TA=/[_.\- ]+/,fB=new RegExp("^"+TA.source),IA=new RegExp(TA.source+kA.source,"gu"),SA=new RegExp("\\d+"+kA.source,"gu"),mB=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let s=0;s($A.lastIndex=0,t.replace($A,r=>e(r))),gB=(t,e)=>(IA.lastIndex=0,SA.lastIndex=0,t.replace(IA,(r,n)=>e(n)).replace(SA,r=>e(r))),EA=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(t)?t=t.map(i=>i.trim()).filter(i=>i.length).join("-"):t=t.trim(),t.length===0)return"";let r=e.locale===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(e.locale),n=e.locale===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(e.locale);return t.length===1?e.pascalCase?n(t):r(t):(t!==r(t)&&(t=mB(t,r,n)),t=t.replace(fB,""),e.preserveConsecutiveUppercase?t=hB(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),gB(t,n))};Zw.exports=EA;Zw.exports.default=EA});var cP=P((ime,Ix)=>{"use strict";var v6=Object.prototype.hasOwnProperty,hr="~";function Cd(){}Object.create&&(Cd.prototype=Object.create(null),new Cd().__proto__||(hr=!1));function b6(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function aP(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new b6(r,n||t,o),s=hr?hr+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],i]:t._events[s].push(i):(t._events[s]=i,t._eventsCount++),t}function wh(t,e){--t._eventsCount===0?t._events=new Cd:delete t._events[e]}function tr(){this._events=new Cd,this._eventsCount=0}tr.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)v6.call(r,n)&&e.push(hr?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};tr.prototype.listeners=function(e){var r=hr?hr+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,s=new Array(i);o{"use strict";uP.exports=(t,e)=>(e=e||(()=>{}),t.then(r=>new Promise(n=>{n(e())}).then(()=>r),r=>new Promise(n=>{n(e())}).then(()=>{throw r})))});var pP=P((ame,$h)=>{"use strict";var w6=lP(),xh=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},dP=(t,e,r)=>new Promise((n,o)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){n(t);return}let i=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(c){o(c)}return}let s=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,a=r instanceof Error?r:new xh(s);typeof t.cancel=="function"&&t.cancel(),o(a)},e);w6(t.then(n,o),()=>{clearTimeout(i)})});$h.exports=dP;$h.exports.default=dP;$h.exports.TimeoutError=xh});var fP=P(Sx=>{"use strict";Object.defineProperty(Sx,"__esModule",{value:!0});function x6(t,e,r){let n=0,o=t.length;for(;o>0;){let i=o/2|0,s=n+i;r(t[s],e)<=0?(n=++s,o-=i+1):o=i}return n}Sx.default=x6});var mP=P(Tx=>{"use strict";Object.defineProperty(Tx,"__esModule",{value:!0});var $6=fP(),kx=class{constructor(){this._queue=[]}enqueue(e,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let o=$6.default(this._queue,n,(i,s)=>s.priority-i.priority);this._queue.splice(o,0,n)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this._queue.length}};Tx.default=kx});var Sh=P(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:!0});var I6=cP(),hP=pP(),S6=mP(),Ih=()=>{},k6=new hP.TimeoutError,Ex=class extends I6{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Ih,this._resolveIdle=Ih,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:S6.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(i=(o=e.interval)===null||o===void 0?void 0:o.toString())!==null&&i!==void 0?i:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||e.interval===0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=e.throwOnTimeout===!0,this._isPaused=e.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),e&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,r={}){return new Promise((n,o)=>{let i=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&r.timeout===void 0?e():hP.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(k6)});n(await s)}catch(s){o(s)}this._next()};this._queue.enqueue(i,r),this._tryToStartAnother(),this.emit("add")})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(e=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}};Ax.default=Ex});var Nd=P((mme,gP)=>{"use strict";var E6="2.0.0",A6=Number.MAX_SAFE_INTEGER||9007199254740991,O6=16,P6=250,C6=["major","premajor","minor","preminor","patch","prepatch","prerelease"];gP.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:O6,MAX_SAFE_BUILD_LENGTH:P6,MAX_SAFE_INTEGER:A6,RELEASE_TYPES:C6,SEMVER_SPEC_VERSION:E6,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var zd=P((hme,_P)=>{"use strict";var R6=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};_P.exports=R6});var lu=P((fo,yP)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Cx,MAX_SAFE_BUILD_LENGTH:N6,MAX_LENGTH:z6}=Nd(),M6=zd();fo=yP.exports={};var j6=fo.re=[],D6=fo.safeRe=[],X=fo.src=[],L6=fo.safeSrc=[],Y=fo.t={},U6=0,Rx="[a-zA-Z0-9-]",F6=[["\\s",1],["\\d",z6],[Rx,N6]],B6=t=>{for(let[e,r]of F6)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Ie=(t,e,r)=>{let n=B6(e),o=U6++;M6(t,o,e),Y[t]=o,X[o]=e,L6[o]=n,j6[o]=new RegExp(e,r?"g":void 0),D6[o]=new RegExp(n,r?"g":void 0)};Ie("NUMERICIDENTIFIER","0|[1-9]\\d*");Ie("NUMERICIDENTIFIERLOOSE","\\d+");Ie("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Rx}*`);Ie("MAINVERSION",`(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})`);Ie("MAINVERSIONLOOSE",`(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})`);Ie("PRERELEASEIDENTIFIER",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIER]})`);Ie("PRERELEASEIDENTIFIERLOOSE",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIERLOOSE]})`);Ie("PRERELEASE",`(?:-(${X[Y.PRERELEASEIDENTIFIER]}(?:\\.${X[Y.PRERELEASEIDENTIFIER]})*))`);Ie("PRERELEASELOOSE",`(?:-?(${X[Y.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${X[Y.PRERELEASEIDENTIFIERLOOSE]})*))`);Ie("BUILDIDENTIFIER",`${Rx}+`);Ie("BUILD",`(?:\\+(${X[Y.BUILDIDENTIFIER]}(?:\\.${X[Y.BUILDIDENTIFIER]})*))`);Ie("FULLPLAIN",`v?${X[Y.MAINVERSION]}${X[Y.PRERELEASE]}?${X[Y.BUILD]}?`);Ie("FULL",`^${X[Y.FULLPLAIN]}$`);Ie("LOOSEPLAIN",`[v=\\s]*${X[Y.MAINVERSIONLOOSE]}${X[Y.PRERELEASELOOSE]}?${X[Y.BUILD]}?`);Ie("LOOSE",`^${X[Y.LOOSEPLAIN]}$`);Ie("GTLT","((?:<|>)?=?)");Ie("XRANGEIDENTIFIERLOOSE",`${X[Y.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Ie("XRANGEIDENTIFIER",`${X[Y.NUMERICIDENTIFIER]}|x|X|\\*`);Ie("XRANGEPLAIN",`[v=\\s]*(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:${X[Y.PRERELEASE]})?${X[Y.BUILD]}?)?)?`);Ie("XRANGEPLAINLOOSE",`[v=\\s]*(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:${X[Y.PRERELEASELOOSE]})?${X[Y.BUILD]}?)?)?`);Ie("XRANGE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAIN]}$`);Ie("XRANGELOOSE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAINLOOSE]}$`);Ie("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Cx}})(?:\\.(\\d{1,${Cx}}))?(?:\\.(\\d{1,${Cx}}))?`);Ie("COERCE",`${X[Y.COERCEPLAIN]}(?:$|[^\\d])`);Ie("COERCEFULL",X[Y.COERCEPLAIN]+`(?:${X[Y.PRERELEASE]})?(?:${X[Y.BUILD]})?(?:$|[^\\d])`);Ie("COERCERTL",X[Y.COERCE],!0);Ie("COERCERTLFULL",X[Y.COERCEFULL],!0);Ie("LONETILDE","(?:~>?)");Ie("TILDETRIM",`(\\s*)${X[Y.LONETILDE]}\\s+`,!0);fo.tildeTrimReplace="$1~";Ie("TILDE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAIN]}$`);Ie("TILDELOOSE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAINLOOSE]}$`);Ie("LONECARET","(?:\\^)");Ie("CARETTRIM",`(\\s*)${X[Y.LONECARET]}\\s+`,!0);fo.caretTrimReplace="$1^";Ie("CARET",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAIN]}$`);Ie("CARETLOOSE",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAINLOOSE]}$`);Ie("COMPARATORLOOSE",`^${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]})$|^$`);Ie("COMPARATOR",`^${X[Y.GTLT]}\\s*(${X[Y.FULLPLAIN]})$|^$`);Ie("COMPARATORTRIM",`(\\s*)${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]}|${X[Y.XRANGEPLAIN]})`,!0);fo.comparatorTrimReplace="$1$2$3";Ie("HYPHENRANGE",`^\\s*(${X[Y.XRANGEPLAIN]})\\s+-\\s+(${X[Y.XRANGEPLAIN]})\\s*$`);Ie("HYPHENRANGELOOSE",`^\\s*(${X[Y.XRANGEPLAINLOOSE]})\\s+-\\s+(${X[Y.XRANGEPLAINLOOSE]})\\s*$`);Ie("STAR","(<|>)?=?\\s*\\*");Ie("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Ie("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Th=P((gme,vP)=>{"use strict";var Z6=Object.freeze({loose:!0}),q6=Object.freeze({}),V6=t=>t?typeof t!="object"?Z6:t:q6;vP.exports=V6});var Nx=P((_me,xP)=>{"use strict";var bP=/^[0-9]+$/,wP=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:twP(e,t);xP.exports={compareIdentifiers:wP,rcompareIdentifiers:G6}});var rr=P((yme,IP)=>{"use strict";var Eh=zd(),{MAX_LENGTH:$P,MAX_SAFE_INTEGER:Ah}=Nd(),{safeRe:Oh,t:Ph}=lu(),K6=Th(),{compareIdentifiers:zx}=Nx(),Mx=class t{constructor(e,r){if(r=K6(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>$P)throw new TypeError(`version is longer than ${$P} characters`);Eh("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Oh[Ph.LOOSE]:Oh[Ph.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Ah||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ah||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ah||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let i=+o;if(i>=0&&ie.major?1:this.minore.minor?1:this.patche.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(Eh("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return zx(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(Eh("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return zx(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?Oh[Ph.PRERELEASELOOSE]:Oh[Ph.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let i=[r,o];n===!1&&(i=[r]),zx(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};IP.exports=Mx});var pa=P((vme,kP)=>{"use strict";var SP=rr(),H6=(t,e,r=!1)=>{if(t instanceof SP)return t;try{return new SP(t,e)}catch(n){if(!r)return null;throw n}};kP.exports=H6});var EP=P((bme,TP)=>{"use strict";var W6=pa(),J6=(t,e)=>{let r=W6(t,e);return r?r.version:null};TP.exports=J6});var OP=P((wme,AP)=>{"use strict";var X6=pa(),Y6=(t,e)=>{let r=X6(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};AP.exports=Y6});var RP=P((xme,CP)=>{"use strict";var PP=rr(),Q6=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new PP(t instanceof PP?t.version:t,r).inc(e,n,o).version}catch{return null}};CP.exports=Q6});var MP=P(($me,zP)=>{"use strict";var NP=pa(),eZ=(t,e)=>{let r=NP(t,null,!0),n=NP(e,null,!0),o=r.compare(n);if(o===0)return null;let i=o>0,s=i?r:n,a=i?n:r,c=!!s.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0)return a.minor&&!a.patch?"minor":"patch"}let l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};zP.exports=eZ});var DP=P((Ime,jP)=>{"use strict";var tZ=rr(),rZ=(t,e)=>new tZ(t,e).major;jP.exports=rZ});var UP=P((Sme,LP)=>{"use strict";var nZ=rr(),oZ=(t,e)=>new nZ(t,e).minor;LP.exports=oZ});var BP=P((kme,FP)=>{"use strict";var iZ=rr(),sZ=(t,e)=>new iZ(t,e).patch;FP.exports=sZ});var qP=P((Tme,ZP)=>{"use strict";var aZ=pa(),cZ=(t,e)=>{let r=aZ(t,e);return r&&r.prerelease.length?r.prerelease:null};ZP.exports=cZ});var gn=P((Eme,GP)=>{"use strict";var VP=rr(),uZ=(t,e,r)=>new VP(t,r).compare(new VP(e,r));GP.exports=uZ});var HP=P((Ame,KP)=>{"use strict";var lZ=gn(),dZ=(t,e,r)=>lZ(e,t,r);KP.exports=dZ});var JP=P((Ome,WP)=>{"use strict";var pZ=gn(),fZ=(t,e)=>pZ(t,e,!0);WP.exports=fZ});var Ch=P((Pme,YP)=>{"use strict";var XP=rr(),mZ=(t,e,r)=>{let n=new XP(t,r),o=new XP(e,r);return n.compare(o)||n.compareBuild(o)};YP.exports=mZ});var eC=P((Cme,QP)=>{"use strict";var hZ=Ch(),gZ=(t,e)=>t.sort((r,n)=>hZ(r,n,e));QP.exports=gZ});var rC=P((Rme,tC)=>{"use strict";var _Z=Ch(),yZ=(t,e)=>t.sort((r,n)=>_Z(n,r,e));tC.exports=yZ});var Md=P((Nme,nC)=>{"use strict";var vZ=gn(),bZ=(t,e,r)=>vZ(t,e,r)>0;nC.exports=bZ});var Rh=P((zme,oC)=>{"use strict";var wZ=gn(),xZ=(t,e,r)=>wZ(t,e,r)<0;oC.exports=xZ});var jx=P((Mme,iC)=>{"use strict";var $Z=gn(),IZ=(t,e,r)=>$Z(t,e,r)===0;iC.exports=IZ});var Dx=P((jme,sC)=>{"use strict";var SZ=gn(),kZ=(t,e,r)=>SZ(t,e,r)!==0;sC.exports=kZ});var Nh=P((Dme,aC)=>{"use strict";var TZ=gn(),EZ=(t,e,r)=>TZ(t,e,r)>=0;aC.exports=EZ});var zh=P((Lme,cC)=>{"use strict";var AZ=gn(),OZ=(t,e,r)=>AZ(t,e,r)<=0;cC.exports=OZ});var Lx=P((Ume,uC)=>{"use strict";var PZ=jx(),CZ=Dx(),RZ=Md(),NZ=Nh(),zZ=Rh(),MZ=zh(),jZ=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return PZ(t,r,n);case"!=":return CZ(t,r,n);case">":return RZ(t,r,n);case">=":return NZ(t,r,n);case"<":return zZ(t,r,n);case"<=":return MZ(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};uC.exports=jZ});var dC=P((Fme,lC)=>{"use strict";var DZ=rr(),LZ=pa(),{safeRe:Mh,t:jh}=lu(),UZ=(t,e)=>{if(t instanceof DZ)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Mh[jh.COERCEFULL]:Mh[jh.COERCE]);else{let c=e.includePrerelease?Mh[jh.COERCERTLFULL]:Mh[jh.COERCERTL],u;for(;(u=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",i=r[4]||"0",s=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return LZ(`${n}.${o}.${i}${s}${a}`,e)};lC.exports=UZ});var fC=P((Bme,pC)=>{"use strict";var Ux=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};pC.exports=Ux});var _n=P((Zme,_C)=>{"use strict";var FZ=/\s+/g,Fx=class t{constructor(e,r){if(r=ZZ(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Bx)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(FZ," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(o=>!hC(o[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&JZ(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&HZ)|(this.options.loose&&WZ))+":"+e,o=mC.get(n);if(o)return o;let i=this.options.loose,s=i?gr[nr.HYPHENRANGELOOSE]:gr[nr.HYPHENRANGE];e=e.replace(s,s9(this.options.includePrerelease)),at("hyphen replace",e),e=e.replace(gr[nr.COMPARATORTRIM],VZ),at("comparator trim",e),e=e.replace(gr[nr.TILDETRIM],GZ),at("tilde trim",e),e=e.replace(gr[nr.CARETTRIM],KZ),at("caret trim",e);let a=e.split(" ").map(d=>XZ(d,this.options)).join(" ").split(/\s+/).map(d=>i9(d,this.options));i&&(a=a.filter(d=>(at("loose invalid filter",d,this.options),!!d.match(gr[nr.COMPARATORLOOSE])))),at("range list",a);let c=new Map,u=a.map(d=>new Bx(d,this.options));for(let d of u){if(hC(d))return[d];c.set(d.value,d)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return mC.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>gC(n,r)&&e.set.some(o=>gC(o,r)&&n.every(i=>o.every(s=>i.intersects(s,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new qZ(e,this.options)}catch{return!1}for(let r=0;rt.value==="<0.0.0-0",JZ=t=>t.value==="",gC=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(i=>o.intersects(i,e)),o=n.pop();return r},XZ=(t,e)=>(t=t.replace(gr[nr.BUILD],""),at("comp",t,e),t=e9(t,e),at("caret",t),t=YZ(t,e),at("tildes",t),t=r9(t,e),at("xrange",t),t=o9(t,e),at("stars",t),t),_r=t=>!t||t.toLowerCase()==="x"||t==="*",YZ=(t,e)=>t.trim().split(/\s+/).map(r=>QZ(r,e)).join(" "),QZ=(t,e)=>{let r=e.loose?gr[nr.TILDELOOSE]:gr[nr.TILDE];return t.replace(r,(n,o,i,s,a)=>{at("tilde",t,n,o,i,s,a);let c;return _r(o)?c="":_r(i)?c=`>=${o}.0.0 <${+o+1}.0.0-0`:_r(s)?c=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:a?(at("replaceTilde pr",a),c=`>=${o}.${i}.${s}-${a} <${o}.${+i+1}.0-0`):c=`>=${o}.${i}.${s} <${o}.${+i+1}.0-0`,at("tilde return",c),c})},e9=(t,e)=>t.trim().split(/\s+/).map(r=>t9(r,e)).join(" "),t9=(t,e)=>{at("caret",t,e);let r=e.loose?gr[nr.CARETLOOSE]:gr[nr.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,s,a,c)=>{at("caret",t,o,i,s,a,c);let u;return _r(i)?u="":_r(s)?u=`>=${i}.0.0${n} <${+i+1}.0.0-0`:_r(a)?i==="0"?u=`>=${i}.${s}.0${n} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.0${n} <${+i+1}.0.0-0`:c?(at("replaceCaret pr",c),i==="0"?s==="0"?u=`>=${i}.${s}.${a}-${c} <${i}.${s}.${+a+1}-0`:u=`>=${i}.${s}.${a}-${c} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.${a}-${c} <${+i+1}.0.0-0`):(at("no pr"),i==="0"?s==="0"?u=`>=${i}.${s}.${a}${n} <${i}.${s}.${+a+1}-0`:u=`>=${i}.${s}.${a}${n} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.${a} <${+i+1}.0.0-0`),at("caret return",u),u})},r9=(t,e)=>(at("replaceXRanges",t,e),t.split(/\s+/).map(r=>n9(r,e)).join(" ")),n9=(t,e)=>{t=t.trim();let r=e.loose?gr[nr.XRANGELOOSE]:gr[nr.XRANGE];return t.replace(r,(n,o,i,s,a,c)=>{at("xRange",t,n,o,i,s,a,c);let u=_r(i),l=u||_r(s),d=l||_r(a),f=d;return o==="="&&f&&(o=""),c=e.includePrerelease?"-0":"",u?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&f?(l&&(s=0),a=0,o===">"?(o=">=",l?(i=+i+1,s=0,a=0):(s=+s+1,a=0)):o==="<="&&(o="<",l?i=+i+1:s=+s+1),o==="<"&&(c="-0"),n=`${o+i}.${s}.${a}${c}`):l?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${s}.0${c} <${i}.${+s+1}.0-0`),at("xRange return",n),n})},o9=(t,e)=>(at("replaceStars",t,e),t.trim().replace(gr[nr.STAR],"")),i9=(t,e)=>(at("replaceGTE0",t,e),t.trim().replace(gr[e.includePrerelease?nr.GTE0PRE:nr.GTE0],"")),s9=t=>(e,r,n,o,i,s,a,c,u,l,d,f)=>(_r(n)?r="":_r(o)?r=`>=${n}.0.0${t?"-0":""}`:_r(i)?r=`>=${n}.${o}.0${t?"-0":""}`:s?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,_r(u)?c="":_r(l)?c=`<${+u+1}.0.0-0`:_r(d)?c=`<${u}.${+l+1}.0-0`:f?c=`<=${u}.${l}.${d}-${f}`:t?c=`<${u}.${l}.${+d+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),a9=(t,e,r)=>{for(let n=0;n0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var jd=P((qme,$C)=>{"use strict";var Dd=Symbol("SemVer ANY"),Vx=class t{static get ANY(){return Dd}constructor(e,r){if(r=yC(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),qx("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Dd?this.value="":this.value=this.operator+this.semver.version,qx("comp",this)}parse(e){let r=this.options.loose?vC[bC.COMPARATORLOOSE]:vC[bC.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new wC(n[2],this.options.loose):this.semver=Dd}toString(){return this.value}test(e){if(qx("Comparator.test",e,this.options.loose),this.semver===Dd||e===Dd)return!0;if(typeof e=="string")try{e=new wC(e,this.options)}catch{return!1}return Zx(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new xC(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new xC(this.value,r).test(e.semver):(r=yC(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Zx(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Zx(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};$C.exports=Vx;var yC=Th(),{safeRe:vC,t:bC}=lu(),Zx=Lx(),qx=zd(),wC=rr(),xC=_n()});var Ld=P((Vme,IC)=>{"use strict";var c9=_n(),u9=(t,e,r)=>{try{e=new c9(e,r)}catch{return!1}return e.test(t)};IC.exports=u9});var kC=P((Gme,SC)=>{"use strict";var l9=_n(),d9=(t,e)=>new l9(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));SC.exports=d9});var EC=P((Kme,TC)=>{"use strict";var p9=rr(),f9=_n(),m9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new f9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===-1)&&(n=s,o=new p9(n,r))}),n};TC.exports=m9});var OC=P((Hme,AC)=>{"use strict";var h9=rr(),g9=_n(),_9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new g9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===1)&&(n=s,o=new h9(n,r))}),n};AC.exports=_9});var RC=P((Wme,CC)=>{"use strict";var Gx=rr(),y9=_n(),PC=Md(),v9=(t,e)=>{t=new y9(t,e);let r=new Gx("0.0.0");if(t.test(r)||(r=new Gx("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n{let a=new Gx(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||PC(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),i&&(!r||PC(r,i))&&(r=i)}return r&&t.test(r)?r:null};CC.exports=v9});var zC=P((Jme,NC)=>{"use strict";var b9=_n(),w9=(t,e)=>{try{return new b9(t,e).range||"*"}catch{return null}};NC.exports=w9});var Dh=P((Xme,LC)=>{"use strict";var x9=rr(),DC=jd(),{ANY:$9}=DC,I9=_n(),S9=Ld(),MC=Md(),jC=Rh(),k9=zh(),T9=Nh(),E9=(t,e,r,n)=>{t=new x9(t,n),e=new I9(e,n);let o,i,s,a,c;switch(r){case">":o=MC,i=k9,s=jC,a=">",c=">=";break;case"<":o=jC,i=T9,s=MC,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(S9(t,e,n))return!1;for(let u=0;u{p.semver===$9&&(p=new DC(">=0.0.0")),d=d||p,f=f||p,o(p.semver,d.semver,n)?d=p:s(p.semver,f.semver,n)&&(f=p)}),d.operator===a||d.operator===c||(!f.operator||f.operator===a)&&i(t,f.semver))return!1;if(f.operator===c&&s(t,f.semver))return!1}return!0};LC.exports=E9});var FC=P((Yme,UC)=>{"use strict";var A9=Dh(),O9=(t,e,r)=>A9(t,e,">",r);UC.exports=O9});var ZC=P((Qme,BC)=>{"use strict";var P9=Dh(),C9=(t,e,r)=>P9(t,e,"<",r);BC.exports=C9});var GC=P((ehe,VC)=>{"use strict";var qC=_n(),R9=(t,e,r)=>(t=new qC(t,r),e=new qC(e,r),t.intersects(e,r));VC.exports=R9});var HC=P((the,KC)=>{"use strict";var N9=Ld(),z9=gn();KC.exports=(t,e,r)=>{let n=[],o=null,i=null,s=t.sort((l,d)=>z9(l,d,r));for(let l of s)N9(l,e,r)?(i=l,o||(o=l)):(i&&n.push([o,i]),i=null,o=null);o&&n.push([o,null]);let a=[];for(let[l,d]of n)l===d?a.push(l):!d&&l===s[0]?a.push("*"):d?l===s[0]?a.push(`<=${d}`):a.push(`${l} - ${d}`):a.push(`>=${l}`);let c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length{"use strict";var WC=_n(),Hx=jd(),{ANY:Kx}=Hx,Ud=Ld(),Wx=gn(),M9=(t,e,r={})=>{if(t===e)return!0;t=new WC(t,r),e=new WC(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let s=D9(o,i,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},j9=[new Hx(">=0.0.0-0")],JC=[new Hx(">=0.0.0")],D9=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Kx){if(e.length===1&&e[0].semver===Kx)return!0;r.includePrerelease?t=j9:t=JC}if(e.length===1&&e[0].semver===Kx){if(r.includePrerelease)return!0;e=JC}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=XC(o,p,r):p.operator==="<"||p.operator==="<="?i=YC(i,p,r):n.add(p.semver);if(n.size>1)return null;let s;if(o&&i){if(s=Wx(o.semver,i.semver,r),s>0)return null;if(s===0&&(o.operator!==">="||i.operator!=="<="))return null}for(let p of n){if(o&&!Ud(p,String(o),r)||i&&!Ud(p,String(i),r))return null;for(let m of e)if(!Ud(p,String(m),r))return!1;return!0}let a,c,u,l,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of e){if(l=l||p.operator===">"||p.operator===">=",u=u||p.operator==="<"||p.operator==="<=",o){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator===">"||p.operator===">="){if(a=XC(o,p,r),a===p&&a!==o)return!1}else if(o.operator===">="&&!Ud(o.semver,String(p),r))return!1}if(i){if(d&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===d.major&&p.semver.minor===d.minor&&p.semver.patch===d.patch&&(d=!1),p.operator==="<"||p.operator==="<="){if(c=YC(i,p,r),c===p&&c!==i)return!1}else if(i.operator==="<="&&!Ud(i.semver,String(p),r))return!1}if(!p.operator&&(i||o)&&s!==0)return!1}return!(o&&u&&!i&&s!==0||i&&l&&!o&&s!==0||f||d)},XC=(t,e,r)=>{if(!t)return e;let n=Wx(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},YC=(t,e,r)=>{if(!t)return e;let n=Wx(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};QC.exports=M9});var oR=P((nhe,nR)=>{"use strict";var Jx=lu(),tR=Nd(),L9=rr(),rR=Nx(),U9=pa(),F9=EP(),B9=OP(),Z9=RP(),q9=MP(),V9=DP(),G9=UP(),K9=BP(),H9=qP(),W9=gn(),J9=HP(),X9=JP(),Y9=Ch(),Q9=eC(),eq=rC(),tq=Md(),rq=Rh(),nq=jx(),oq=Dx(),iq=Nh(),sq=zh(),aq=Lx(),cq=dC(),uq=jd(),lq=_n(),dq=Ld(),pq=kC(),fq=EC(),mq=OC(),hq=RC(),gq=zC(),_q=Dh(),yq=FC(),vq=ZC(),bq=GC(),wq=HC(),xq=eR();nR.exports={parse:U9,valid:F9,clean:B9,inc:Z9,diff:q9,major:V9,minor:G9,patch:K9,prerelease:H9,compare:W9,rcompare:J9,compareLoose:X9,compareBuild:Y9,sort:Q9,rsort:eq,gt:tq,lt:rq,eq:nq,neq:oq,gte:iq,lte:sq,cmp:aq,coerce:cq,Comparator:uq,Range:lq,satisfies:dq,toComparators:pq,maxSatisfying:fq,minSatisfying:mq,minVersion:hq,validRange:gq,outside:_q,gtr:yq,ltr:vq,intersects:bq,simplifyRange:wq,subset:xq,SemVer:L9,re:Jx.re,src:Jx.src,tokens:Jx.t,SEMVER_SPEC_VERSION:tR.SEMVER_SPEC_VERSION,RELEASE_TYPES:tR.RELEASE_TYPES,compareIdentifiers:rR.compareIdentifiers,rcompareIdentifiers:rR.rcompareIdentifiers}});var IR=P((Ghe,$R)=>{"use strict";var wR=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,xR=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function qq(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",e.color.ansi256=wR(),e.color.ansi16m=xR(),e.bgColor.ansi256=wR(10),e.bgColor.ansi16m=xR(10),Object.defineProperties(e,{rgbToAnsi256:{value:(r,n,o)=>r===n&&n===o?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:o}=n.groups;o.length===3&&(o=o.split("").map(s=>s+s).join(""));let i=Number.parseInt(o,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:r=>e.rgbToAnsi256(...e.hexToRgb(r)),enumerable:!1}}),e}Object.defineProperty($R,"exports",{enumerable:!0,get:qq})});var KM=P(dv=>{"use strict";dv.byteLength=AW;dv.toByteArray=PW;dv.fromByteArray=NW;var So=[],Sn=[],EW=typeof Uint8Array<"u"?Uint8Array:Array,BI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Va=0,VM=BI.length;Va0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function AW(t){var e=GM(t),r=e[0],n=e[1];return(r+n)*3/4-n}function OW(t,e,r){return(e+r)*3/4-r}function PW(t){var e,r=GM(t),n=r[0],o=r[1],i=new EW(OW(t,n,o)),s=0,a=o>0?n-4:n,c;for(c=0;c>16&255,i[s++]=e>>8&255,i[s++]=e&255;return o===2&&(e=Sn[t.charCodeAt(c)]<<2|Sn[t.charCodeAt(c+1)]>>4,i[s++]=e&255),o===1&&(e=Sn[t.charCodeAt(c)]<<10|Sn[t.charCodeAt(c+1)]<<4|Sn[t.charCodeAt(c+2)]>>2,i[s++]=e>>8&255,i[s++]=e&255),i}function CW(t){return So[t>>18&63]+So[t>>12&63]+So[t>>6&63]+So[t&63]}function RW(t,e,r){for(var n,o=[],i=e;ia?a:s+i));return n===1?(e=t[r-1],o.push(So[e>>2]+So[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(So[e>>10]+So[e>>4&63]+So[e<<2&63]+"=")),o.join("")}});var Cf=P(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.regexpCode=Fe.getEsmExportName=Fe.getProperty=Fe.safeStringify=Fe.stringify=Fe.strConcat=Fe.addCodeArg=Fe.str=Fe._=Fe.nil=Fe._Code=Fe.Name=Fe.IDENTIFIER=Fe._CodeOrName=void 0;var Of=class{};Fe._CodeOrName=Of;Fe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Qa=class extends Of{constructor(e){if(super(),!Fe.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Fe.Name=Qa;var Tn=class extends Of{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Qa&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Fe._Code=Tn;Fe.nil=new Tn("");function Xj(t,...e){let r=[t[0]],n=0;for(;n{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.ValueScope=Br.ValueScopeName=Br.Scope=Br.varKinds=Br.UsedValueState=void 0;var Fr=Cf(),DS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Hv;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Hv||(Br.UsedValueState=Hv={}));Br.varKinds={const:new Fr.Name("const"),let:new Fr.Name("let"),var:new Fr.Name("var")};var Wv=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Fr.Name?e:this.name(e)}name(e){return new Fr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Br.Scope=Wv;var Jv=class extends Fr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Fr._)`.${new Fr.Name(r)}[${n}]`}};Br.ValueScopeName=Jv;var z7=(0,Fr._)`\n`,LS=class extends Wv{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?z7:Fr.nil}}get(){return this._scope}name(e){return new Jv(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:i}=o,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[i];if(a){let l=a.get(s);if(l)return l}else a=this._values[i]=new Map;a.set(s,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Fr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let i=Fr.nil;for(let s in e){let a=e[s];if(!a)continue;let c=n[s]=n[s]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Hv.Started);let l=r(u);if(l){let d=this.opts.es5?Br.varKinds.var:Br.varKinds.const;i=(0,Fr._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Fr._)`${i}${l}${this.opts._n}`;else throw new DS(u);c.set(u,Hv.Completed)})}return i}};Br.ValueScope=LS});var Oe=P(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.or=Ce.and=Ce.not=Ce.CodeGen=Ce.operators=Ce.varKinds=Ce.ValueScopeName=Ce.ValueScope=Ce.Scope=Ce.Name=Ce.regexpCode=Ce.stringify=Ce.getProperty=Ce.nil=Ce.strConcat=Ce.str=Ce._=void 0;var Le=Cf(),Xn=US(),_s=Cf();Object.defineProperty(Ce,"_",{enumerable:!0,get:function(){return _s._}});Object.defineProperty(Ce,"str",{enumerable:!0,get:function(){return _s.str}});Object.defineProperty(Ce,"strConcat",{enumerable:!0,get:function(){return _s.strConcat}});Object.defineProperty(Ce,"nil",{enumerable:!0,get:function(){return _s.nil}});Object.defineProperty(Ce,"getProperty",{enumerable:!0,get:function(){return _s.getProperty}});Object.defineProperty(Ce,"stringify",{enumerable:!0,get:function(){return _s.stringify}});Object.defineProperty(Ce,"regexpCode",{enumerable:!0,get:function(){return _s.regexpCode}});Object.defineProperty(Ce,"Name",{enumerable:!0,get:function(){return _s.Name}});var eb=US();Object.defineProperty(Ce,"Scope",{enumerable:!0,get:function(){return eb.Scope}});Object.defineProperty(Ce,"ValueScope",{enumerable:!0,get:function(){return eb.ValueScope}});Object.defineProperty(Ce,"ValueScopeName",{enumerable:!0,get:function(){return eb.ValueScopeName}});Object.defineProperty(Ce,"varKinds",{enumerable:!0,get:function(){return eb.varKinds}});Ce.operators={GT:new Le._Code(">"),GTE:new Le._Code(">="),LT:new Le._Code("<"),LTE:new Le._Code("<="),EQ:new Le._Code("==="),NEQ:new Le._Code("!=="),NOT:new Le._Code("!"),OR:new Le._Code("||"),AND:new Le._Code("&&"),ADD:new Le._Code("+")};var di=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},FS=class extends di{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Xn.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Sl(this.rhs,e,r)),this}get names(){return this.rhs instanceof Le._CodeOrName?this.rhs.names:{}}},Xv=class extends di{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Le.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Sl(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Le.Name?{}:{...this.lhs.names};return Qv(e,this.rhs)}},BS=class extends Xv{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},ZS=class extends di{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qS=class extends di{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},VS=class extends di{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},GS=class extends di{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Sl(this.code,e,r),this}get names(){return this.code instanceof Le._CodeOrName?this.code.names:{}}},Rf=class extends di{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(e,r)||(M7(e,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rc(e,r.names),{})}},pi=class extends Rf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},KS=class extends Rf{},Il=class extends pi{};Il.kind="else";var ec=class t extends pi{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Il(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Qj(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Sl(this.condition,e,r),this}get names(){let e=super.names;return Qv(e,this.condition),this.else&&rc(e,this.else.names),e}};ec.kind="if";var tc=class extends pi{};tc.kind="for";var HS=class extends tc{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Sl(this.iteration,e,r),this}get names(){return rc(super.names,this.iteration.names)}},WS=class extends tc{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?Xn.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=Qv(super.names,this.from);return Qv(e,this.to)}},Yv=class extends tc{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Sl(this.iterable,e,r),this}get names(){return rc(super.names,this.iterable.names)}},Nf=class extends pi{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Nf.kind="func";var zf=class extends Rf{render(e){return"return "+super.render(e)}};zf.kind="return";var JS=class extends pi{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rc(e,this.catch.names),this.finally&&rc(e,this.finally.names),e}},Mf=class extends pi{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Mf.kind="catch";var jf=class extends pi{render(e){return"finally"+super.render(e)}};jf.kind="finally";var XS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?` +`:""},this._extScope=e,this._scope=new Xn.Scope({parent:e}),this._nodes=[new KS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new FS(e,i,n)),i}const(e,r,n){return this._def(Xn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Xn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Xn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Xv(e,r,n))}add(e,r){return this._leafNode(new BS(e,Ce.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Le.nil&&this._leafNode(new GS(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Le.addCodeArg)(r,o));return r.push("}"),new Le._Code(r)}if(e,r,n){if(this._blockNode(new ec(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ec(e))}else(){return this._elseNode(new Il)}endIf(){return this._endBlockNode(ec,Il)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new HS(e),r)}forRange(e,r,n,o,i=this.opts.es5?Xn.varKinds.var:Xn.varKinds.let){let s=this._scope.toName(e);return this._for(new WS(i,s,r,n),()=>o(s))}forOf(e,r,n,o=Xn.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let s=r instanceof Le.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Le._)`${s}.length`,a=>{this.var(i,(0,Le._)`${s}[${a}]`),n(i)})}return this._for(new Yv("of",o,i,r),()=>n(i))}forIn(e,r,n,o=this.opts.es5?Xn.varKinds.var:Xn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Le._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new Yv("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(tc)}label(e){return this._leafNode(new ZS(e))}break(e){return this._leafNode(new qS(e))}return(e){let r=new zf;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(zf)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new JS;if(this._blockNode(o),this.code(e),r){let i=this.name("e");this._currNode=o.catch=new Mf(i),r(i)}return n&&(this._currNode=o.finally=new jf,this.code(n)),this._endBlockNode(Mf,jf)}throw(e){return this._leafNode(new VS(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Le.nil,n,o){return this._blockNode(new Nf(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Nf)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof ec))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ce.CodeGen=XS;function rc(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Qv(t,e){return e instanceof Le._CodeOrName?rc(t,e.names):t}function Sl(t,e,r){if(t instanceof Le.Name)return n(t);if(!o(t))return t;return new Le._Code(t._items.reduce((i,s)=>(s instanceof Le.Name&&(s=n(s)),s instanceof Le._Code?i.push(...s._items):i.push(s),i),[]));function n(i){let s=r[i.str];return s===void 0||e[i.str]!==1?i:(delete e[i.str],s)}function o(i){return i instanceof Le._Code&&i._items.some(s=>s instanceof Le.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function M7(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Qj(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Le._)`!${YS(t)}`}Ce.not=Qj;var j7=eD(Ce.operators.AND);function D7(...t){return t.reduce(j7)}Ce.and=D7;var L7=eD(Ce.operators.OR);function U7(...t){return t.reduce(L7)}Ce.or=U7;function eD(t){return(e,r)=>e===Le.nil?r:r===Le.nil?e:(0,Le._)`${YS(e)} ${t} ${YS(r)}`}function YS(t){return t instanceof Le.Name?t:(0,Le._)`(${t})`}});var Be=P(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.checkStrictMode=Ne.getErrorPath=Ne.Type=Ne.useFunc=Ne.setEvaluated=Ne.evaluatedPropsToName=Ne.mergeEvaluated=Ne.eachItem=Ne.unescapeJsonPointer=Ne.escapeJsonPointer=Ne.escapeFragment=Ne.unescapeFragment=Ne.schemaRefOrVal=Ne.schemaHasRulesButRef=Ne.schemaHasRules=Ne.checkUnknownRules=Ne.alwaysValidSchema=Ne.toHash=void 0;var rt=Oe(),F7=Cf();function B7(t){let e={};for(let r of t)e[r]=!0;return e}Ne.toHash=B7;function Z7(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(nD(t,e),!oD(e,t.self.RULES.all))}Ne.alwaysValidSchema=Z7;function nD(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let i in e)o[i]||aD(t,`unknown keyword: "${i}"`)}Ne.checkUnknownRules=nD;function oD(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Ne.schemaHasRules=oD;function q7(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Ne.schemaHasRulesButRef=q7;function V7({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,rt._)`${r}`}return(0,rt._)`${t}${e}${(0,rt.getProperty)(n)}`}Ne.schemaRefOrVal=V7;function G7(t){return iD(decodeURIComponent(t))}Ne.unescapeFragment=G7;function K7(t){return encodeURIComponent(ek(t))}Ne.escapeFragment=K7;function ek(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Ne.escapeJsonPointer=ek;function iD(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Ne.unescapeJsonPointer=iD;function H7(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Ne.eachItem=H7;function tD({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,i,s,a)=>{let c=s===void 0?i:s instanceof rt.Name?(i instanceof rt.Name?t(o,i,s):e(o,i,s),s):i instanceof rt.Name?(e(o,s,i),i):r(i,s);return a===rt.Name&&!(c instanceof rt.Name)?n(o,c):c}}Ne.mergeEvaluated={props:tD({mergeNames:(t,e,r)=>t.if((0,rt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,rt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,rt._)`${r} || {}`).code((0,rt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,rt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,rt._)`${r} || {}`),tk(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:sD}),items:tD({mergeNames:(t,e,r)=>t.if((0,rt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,rt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,rt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,rt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function sD(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,rt._)`{}`);return e!==void 0&&tk(t,r,e),r}Ne.evaluatedPropsToName=sD;function tk(t,e,r){Object.keys(r).forEach(n=>t.assign((0,rt._)`${e}${(0,rt.getProperty)(n)}`,!0))}Ne.setEvaluated=tk;var rD={};function W7(t,e){return t.scopeValue("func",{ref:e,code:rD[e.code]||(rD[e.code]=new F7._Code(e.code))})}Ne.useFunc=W7;var QS;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(QS||(Ne.Type=QS={}));function J7(t,e,r){if(t instanceof rt.Name){let n=e===QS.Num;return r?n?(0,rt._)`"[" + ${t} + "]"`:(0,rt._)`"['" + ${t} + "']"`:n?(0,rt._)`"/" + ${t}`:(0,rt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,rt.getProperty)(t).toString():"/"+ek(t)}Ne.getErrorPath=J7;function aD(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Ne.checkStrictMode=aD});var fi=P(rk=>{"use strict";Object.defineProperty(rk,"__esModule",{value:!0});var ur=Oe(),X7={data:new ur.Name("data"),valCxt:new ur.Name("valCxt"),instancePath:new ur.Name("instancePath"),parentData:new ur.Name("parentData"),parentDataProperty:new ur.Name("parentDataProperty"),rootData:new ur.Name("rootData"),dynamicAnchors:new ur.Name("dynamicAnchors"),vErrors:new ur.Name("vErrors"),errors:new ur.Name("errors"),this:new ur.Name("this"),self:new ur.Name("self"),scope:new ur.Name("scope"),json:new ur.Name("json"),jsonPos:new ur.Name("jsonPos"),jsonLen:new ur.Name("jsonLen"),jsonPart:new ur.Name("jsonPart")};rk.default=X7});var Df=P(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.extendErrors=lr.resetErrorsCount=lr.reportExtraError=lr.reportError=lr.keyword$DataError=lr.keywordError=void 0;var Ue=Oe(),tb=Be(),kr=fi();lr.keywordError={message:({keyword:t})=>(0,Ue.str)`must pass "${t}" keyword validation`};lr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ue.str)`"${t}" keyword must be ${e} ($data)`:(0,Ue.str)`"${t}" keyword is invalid ($data)`};function Y7(t,e=lr.keywordError,r,n){let{it:o}=t,{gen:i,compositeRule:s,allErrors:a}=o,c=lD(t,e,r);n??(s||a)?cD(i,c):uD(o,(0,Ue._)`[${c}]`)}lr.reportError=Y7;function Q7(t,e=lr.keywordError,r){let{it:n}=t,{gen:o,compositeRule:i,allErrors:s}=n,a=lD(t,e,r);cD(o,a),i||s||uD(n,kr.default.vErrors)}lr.reportExtraError=Q7;function eX(t,e){t.assign(kr.default.errors,e),t.if((0,Ue._)`${kr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ue._)`${kr.default.vErrors}.length`,e),()=>t.assign(kr.default.vErrors,null)))}lr.resetErrorsCount=eX;function tX({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",o,kr.default.errors,a=>{t.const(s,(0,Ue._)`${kr.default.vErrors}[${a}]`),t.if((0,Ue._)`${s}.instancePath === undefined`,()=>t.assign((0,Ue._)`${s}.instancePath`,(0,Ue.strConcat)(kr.default.instancePath,i.errorPath))),t.assign((0,Ue._)`${s}.schemaPath`,(0,Ue.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,Ue._)`${s}.schema`,r),t.assign((0,Ue._)`${s}.data`,n))})}lr.extendErrors=tX;function cD(t,e){let r=t.const("err",e);t.if((0,Ue._)`${kr.default.vErrors} === null`,()=>t.assign(kr.default.vErrors,(0,Ue._)`[${r}]`),(0,Ue._)`${kr.default.vErrors}.push(${r})`),t.code((0,Ue._)`${kr.default.errors}++`)}function uD(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,Ue._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ue._)`${n}.errors`,e),r.return(!1))}var nc={keyword:new Ue.Name("keyword"),schemaPath:new Ue.Name("schemaPath"),params:new Ue.Name("params"),propertyName:new Ue.Name("propertyName"),message:new Ue.Name("message"),schema:new Ue.Name("schema"),parentSchema:new Ue.Name("parentSchema")};function lD(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Ue._)`{}`:rX(t,e,r)}function rX(t,e,r={}){let{gen:n,it:o}=t,i=[nX(o,r),oX(t,r)];return iX(t,e,i),n.object(...i)}function nX({errorPath:t},{instancePath:e}){let r=e?(0,Ue.str)`${t}${(0,tb.getErrorPath)(e,tb.Type.Str)}`:t;return[kr.default.instancePath,(0,Ue.strConcat)(kr.default.instancePath,r)]}function oX({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,Ue.str)`${e}/${t}`;return r&&(o=(0,Ue.str)`${o}${(0,tb.getErrorPath)(r,tb.Type.Str)}`),[nc.schemaPath,o]}function iX(t,{params:e,message:r},n){let{keyword:o,data:i,schemaValue:s,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([nc.keyword,o],[nc.params,typeof e=="function"?e(t):e||(0,Ue._)`{}`]),c.messages&&n.push([nc.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([nc.schema,s],[nc.parentSchema,(0,Ue._)`${l}${d}`],[kr.default.data,i]),u&&n.push([nc.propertyName,u])}});var pD=P(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.boolOrEmptySchema=kl.topBoolOrEmptySchema=void 0;var sX=Df(),aX=Oe(),cX=fi(),uX={message:"boolean schema is false"};function lX(t){let{gen:e,schema:r,validateName:n}=t;r===!1?dD(t,!1):typeof r=="object"&&r.$async===!0?e.return(cX.default.data):(e.assign((0,aX._)`${n}.errors`,null),e.return(!0))}kl.topBoolOrEmptySchema=lX;function dX(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),dD(t)):r.var(e,!0)}kl.boolOrEmptySchema=dX;function dD(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,sX.reportError)(o,uX,void 0,e)}});var nk=P(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.getRules=Tl.isJSONType=void 0;var pX=["string","number","integer","boolean","null","object","array"],fX=new Set(pX);function mX(t){return typeof t=="string"&&fX.has(t)}Tl.isJSONType=mX;function hX(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Tl.getRules=hX});var ok=P(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.shouldUseRule=ys.shouldUseGroup=ys.schemaHasRulesForType=void 0;function gX({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&fD(t,n)}ys.schemaHasRulesForType=gX;function fD(t,e){return e.rules.some(r=>mD(t,r))}ys.shouldUseGroup=fD;function mD(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ys.shouldUseRule=mD});var Lf=P(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.reportTypeError=dr.checkDataTypes=dr.checkDataType=dr.coerceAndCheckDataType=dr.getJSONTypes=dr.getSchemaTypes=dr.DataType=void 0;var _X=nk(),yX=ok(),vX=Df(),Te=Oe(),hD=Be(),El;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(El||(dr.DataType=El={}));function bX(t){let e=gD(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}dr.getSchemaTypes=bX;function gD(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(_X.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}dr.getJSONTypes=gD;function wX(t,e){let{gen:r,data:n,opts:o}=t,i=xX(e,o.coerceTypes),s=e.length>0&&!(i.length===0&&e.length===1&&(0,yX.schemaHasRulesForType)(t,e[0]));if(s){let a=sk(e,n,o.strictNumbers,El.Wrong);r.if(a,()=>{i.length?$X(t,e,i):ak(t)})}return s}dr.coerceAndCheckDataType=wX;var _D=new Set(["string","number","integer","boolean","null"]);function xX(t,e){return e?t.filter(r=>_D.has(r)||e==="array"&&r==="array"):[]}function $X(t,e,r){let{gen:n,data:o,opts:i}=t,s=n.let("dataType",(0,Te._)`typeof ${o}`),a=n.let("coerced",(0,Te._)`undefined`);i.coerceTypes==="array"&&n.if((0,Te._)`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,Te._)`${o}[0]`).assign(s,(0,Te._)`typeof ${o}`).if(sk(e,o,i.strictNumbers),()=>n.assign(a,o))),n.if((0,Te._)`${a} !== undefined`);for(let u of r)(_D.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),ak(t),n.endIf(),n.if((0,Te._)`${a} !== undefined`,()=>{n.assign(o,a),IX(t,a)});function c(u){switch(u){case"string":n.elseIf((0,Te._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,Te._)`"" + ${o}`).elseIf((0,Te._)`${o} === null`).assign(a,(0,Te._)`""`);return;case"number":n.elseIf((0,Te._)`${s} == "boolean" || ${o} === null + || (${s} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,Te._)`+${o}`);return;case"integer":n.elseIf((0,Te._)`${s} === "boolean" || ${o} === null + || (${s} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,Te._)`+${o}`);return;case"boolean":n.elseIf((0,Te._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,Te._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,Te._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,Te._)`${s} === "string" || ${s} === "number" + || ${s} === "boolean" || ${o} === null`).assign(a,(0,Te._)`[${o}]`)}}}function IX({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Te._)`${e} !== undefined`,()=>t.assign((0,Te._)`${e}[${r}]`,n))}function ik(t,e,r,n=El.Correct){let o=n===El.Correct?Te.operators.EQ:Te.operators.NEQ,i;switch(t){case"null":return(0,Te._)`${e} ${o} null`;case"array":i=(0,Te._)`Array.isArray(${e})`;break;case"object":i=(0,Te._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=s((0,Te._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=s();break;default:return(0,Te._)`typeof ${e} ${o} ${t}`}return n===El.Correct?i:(0,Te.not)(i);function s(a=Te.nil){return(0,Te.and)((0,Te._)`typeof ${e} == "number"`,a,r?(0,Te._)`isFinite(${e})`:Te.nil)}}dr.checkDataType=ik;function sk(t,e,r,n){if(t.length===1)return ik(t[0],e,r,n);let o,i=(0,hD.toHash)(t);if(i.array&&i.object){let s=(0,Te._)`typeof ${e} != "object"`;o=i.null?s:(0,Te._)`!${e} || ${s}`,delete i.null,delete i.array,delete i.object}else o=Te.nil;i.number&&delete i.integer;for(let s in i)o=(0,Te.and)(o,ik(s,e,r,n));return o}dr.checkDataTypes=sk;var SX={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Te._)`{type: ${t}}`:(0,Te._)`{type: ${e}}`};function ak(t){let e=kX(t);(0,vX.reportError)(e,SX)}dr.reportTypeError=ak;function kX(t){let{gen:e,data:r,schema:n}=t,o=(0,hD.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var vD=P(rb=>{"use strict";Object.defineProperty(rb,"__esModule",{value:!0});rb.assignDefaults=void 0;var Al=Oe(),TX=Be();function EX(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)yD(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,i)=>yD(t,i,o.default))}rb.assignDefaults=EX;function yD(t,e,r){let{gen:n,compositeRule:o,data:i,opts:s}=t;if(r===void 0)return;let a=(0,Al._)`${i}${(0,Al.getProperty)(e)}`;if(o){(0,TX.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Al._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,Al._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Al._)`${a} = ${(0,Al.stringify)(r)}`)}});var En=P(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.validateUnion=Xe.validateArray=Xe.usePattern=Xe.callValidateCode=Xe.schemaProperties=Xe.allSchemaProperties=Xe.noPropertyInData=Xe.propertyInData=Xe.isOwnProperty=Xe.hasPropFunc=Xe.reportMissingProp=Xe.checkMissingProp=Xe.checkReportMissingProp=void 0;var ut=Oe(),ck=Be(),vs=fi(),AX=Be();function OX(t,e){let{gen:r,data:n,it:o}=t;r.if(lk(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,ut._)`${e}`},!0),t.error()})}Xe.checkReportMissingProp=OX;function PX({gen:t,data:e,it:{opts:r}},n,o){return(0,ut.or)(...n.map(i=>(0,ut.and)(lk(t,e,i,r.ownProperties),(0,ut._)`${o} = ${i}`)))}Xe.checkMissingProp=PX;function CX(t,e){t.setParams({missingProperty:e},!0),t.error()}Xe.reportMissingProp=CX;function bD(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ut._)`Object.prototype.hasOwnProperty`})}Xe.hasPropFunc=bD;function uk(t,e,r){return(0,ut._)`${bD(t)}.call(${e}, ${r})`}Xe.isOwnProperty=uk;function RX(t,e,r,n){let o=(0,ut._)`${e}${(0,ut.getProperty)(r)} !== undefined`;return n?(0,ut._)`${o} && ${uk(t,e,r)}`:o}Xe.propertyInData=RX;function lk(t,e,r,n){let o=(0,ut._)`${e}${(0,ut.getProperty)(r)} === undefined`;return n?(0,ut.or)(o,(0,ut.not)(uk(t,e,r))):o}Xe.noPropertyInData=lk;function wD(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Xe.allSchemaProperties=wD;function NX(t,e){return wD(e).filter(r=>!(0,ck.alwaysValidSchema)(t,e[r]))}Xe.schemaProperties=NX;function zX({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:s},a,c,u){let l=u?(0,ut._)`${t}, ${e}, ${n}${o}`:e,d=[[vs.default.instancePath,(0,ut.strConcat)(vs.default.instancePath,i)],[vs.default.parentData,s.parentData],[vs.default.parentDataProperty,s.parentDataProperty],[vs.default.rootData,vs.default.rootData]];s.opts.dynamicRef&&d.push([vs.default.dynamicAnchors,vs.default.dynamicAnchors]);let f=(0,ut._)`${l}, ${r.object(...d)}`;return c!==ut.nil?(0,ut._)`${a}.call(${c}, ${f})`:(0,ut._)`${a}(${f})`}Xe.callValidateCode=zX;var MX=(0,ut._)`new RegExp`;function jX({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,i=o(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ut._)`${o.code==="new RegExp"?MX:(0,AX.useFunc)(t,o)}(${r}, ${n})`})}Xe.usePattern=jX;function DX(t){let{gen:e,data:r,keyword:n,it:o}=t,i=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(i,!0),s(()=>e.break()),i;function s(a){let c=e.const("len",(0,ut._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:ck.Type.Num},i),e.if((0,ut.not)(i),a)})}}Xe.validateArray=DX;function LX(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,ck.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(s,(0,ut._)`${s} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,ut.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}Xe.validateUnion=LX});var ID=P(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.validateKeywordUsage=Eo.validSchemaType=Eo.funcKeywordCode=Eo.macroKeywordCode=void 0;var Tr=Oe(),oc=fi(),UX=En(),FX=Df();function BX(t,e){let{gen:r,keyword:n,schema:o,parentSchema:i,it:s}=t,a=e.macro.call(s.self,o,i,s),c=$D(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:Tr.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Eo.macroKeywordCode=BX;function ZX(t,e){var r;let{gen:n,keyword:o,schema:i,parentSchema:s,$data:a,it:c}=t;VX(c,e);let u=!a&&e.compile?e.compile.call(c.self,i,s,c):e.validate,l=$D(n,o,u),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&xD(t),_(()=>t.error());else{let v=e.async?p():m();e.modifying&&xD(t),_(()=>qX(t,v))}}function p(){let v=n.let("ruleErrs",null);return n.try(()=>h((0,Tr._)`await `),b=>n.assign(d,!1).if((0,Tr._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,Tr._)`${b}.errors`),()=>n.throw(b))),v}function m(){let v=(0,Tr._)`${l}.errors`;return n.assign(v,null),h(Tr.nil),v}function h(v=e.async?(0,Tr._)`await `:Tr.nil){let b=c.opts.passContext?oc.default.this:oc.default.self,x=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Tr._)`${v}${(0,UX.callValidateCode)(t,l,b,x)}`,e.modifying)}function _(v){var b;n.if((0,Tr.not)((b=e.valid)!==null&&b!==void 0?b:d),v)}}Eo.funcKeywordCode=ZX;function xD(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Tr._)`${n.parentData}[${n.parentDataProperty}]`))}function qX(t,e){let{gen:r}=t;r.if((0,Tr._)`Array.isArray(${e})`,()=>{r.assign(oc.default.vErrors,(0,Tr._)`${oc.default.vErrors} === null ? ${e} : ${oc.default.vErrors}.concat(${e})`).assign(oc.default.errors,(0,Tr._)`${oc.default.vErrors}.length`),(0,FX.extendErrors)(t)},()=>t.error())}function VX({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function $D(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Tr.stringify)(r)})}function GX(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Eo.validSchemaType=GX;function KX({schema:t,opts:e,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let s=o.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Eo.validateKeywordUsage=KX});var kD=P(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.extendSubschemaMode=bs.extendSubschemaData=bs.getSubschema=void 0;var Ao=Oe(),SD=Be();function HX(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ao._)`${t.schemaPath}${(0,Ao.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ao._)`${t.schemaPath}${(0,Ao.getProperty)(e)}${(0,Ao.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,SD.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:s,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}bs.getSubschema=HX;function WX(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:s}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,f=a.let("data",(0,Ao._)`${e.data}${(0,Ao.getProperty)(r)}`,!0);c(f),t.errorPath=(0,Ao.str)`${u}${(0,SD.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ao._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Ao.Name?o:a.let("data",o,!0);c(u),s!==void 0&&(t.propertyName=s)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}bs.extendSubschemaData=WX;function JX(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}bs.extendSubschemaMode=JX});var dk=P((Z2e,TD)=>{"use strict";TD.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var s=i[o];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var AD=P((q2e,ED)=>{"use strict";var ws=ED.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};nb(e,n,o,t,"",t)};ws.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ws.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ws.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ws.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function nb(t,e,r,n,o,i,s,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,i,s,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ws.arrayKeywords)for(var f=0;f{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.getSchemaRefs=Zr.resolveUrl=Zr.normalizeId=Zr._getFullPath=Zr.getFullPath=Zr.inlineRef=void 0;var YX=Be(),QX=dk(),eY=AD(),tY=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function rY(t,e=!0){return typeof t=="boolean"?!0:e===!0?!pk(t):e?OD(t)<=e:!1}Zr.inlineRef=rY;var nY=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function pk(t){for(let e in t){if(nY.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(pk)||typeof r=="object"&&pk(r))return!0}return!1}function OD(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!tY.has(r)&&(typeof t[r]=="object"&&(0,YX.eachItem)(t[r],n=>e+=OD(n)),e===1/0))return 1/0}return e}function PD(t,e="",r){r!==!1&&(e=Ol(e));let n=t.parse(e);return CD(t,n)}Zr.getFullPath=PD;function CD(t,e){return t.serialize(e).split("#")[0]+"#"}Zr._getFullPath=CD;var oY=/#\/?$/;function Ol(t){return t?t.replace(oY,""):""}Zr.normalizeId=Ol;function iY(t,e,r){return r=Ol(r),t.resolve(e,r)}Zr.resolveUrl=iY;var sY=/^[a-z_][-a-z0-9._]*$/i;function aY(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Ol(t[r]||e),i={"":o},s=PD(n,o,!1),a={},c=new Set;return eY(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=s+f,_=i[m];typeof d[r]=="string"&&(_=v.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),i[f]=_;function v(x){let k=this.opts.uriResolver.resolve;if(x=Ol(_?k(_,x):x),c.has(x))throw l(x);c.add(x);let T=this.refs[x];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?u(d,T.schema,x):x!==Ol(h)&&(x[0]==="#"?(u(d,a[x],x),a[x]=d):this.refs[x]=h),x}function b(x){if(typeof x=="string"){if(!sY.test(x))throw new Error(`invalid anchor "${x}"`);v.call(this,`#${x}`)}}}),a;function u(d,f,p){if(f!==void 0&&!QX(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Zr.getSchemaRefs=aY});var Zf=P(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.getData=xs.KeywordCxt=xs.validateFunctionCode=void 0;var jD=pD(),RD=Lf(),mk=ok(),ob=Lf(),cY=vD(),Bf=ID(),fk=kD(),ae=Oe(),we=fi(),uY=Uf(),mi=Be(),Ff=Df();function lY(t){if(UD(t)&&(FD(t),LD(t))){fY(t);return}DD(t,()=>(0,jD.topBoolOrEmptySchema)(t))}xs.validateFunctionCode=lY;function DD({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,ae._)`${we.default.data}, ${we.default.valCxt}`,n.$async,()=>{t.code((0,ae._)`"use strict"; ${ND(r,o)}`),pY(t,o),t.code(i)}):t.func(e,(0,ae._)`${we.default.data}, ${dY(o)}`,n.$async,()=>t.code(ND(r,o)).code(i))}function dY(t){return(0,ae._)`{${we.default.instancePath}="", ${we.default.parentData}, ${we.default.parentDataProperty}, ${we.default.rootData}=${we.default.data}${t.dynamicRef?(0,ae._)`, ${we.default.dynamicAnchors}={}`:ae.nil}}={}`}function pY(t,e){t.if(we.default.valCxt,()=>{t.var(we.default.instancePath,(0,ae._)`${we.default.valCxt}.${we.default.instancePath}`),t.var(we.default.parentData,(0,ae._)`${we.default.valCxt}.${we.default.parentData}`),t.var(we.default.parentDataProperty,(0,ae._)`${we.default.valCxt}.${we.default.parentDataProperty}`),t.var(we.default.rootData,(0,ae._)`${we.default.valCxt}.${we.default.rootData}`),e.dynamicRef&&t.var(we.default.dynamicAnchors,(0,ae._)`${we.default.valCxt}.${we.default.dynamicAnchors}`)},()=>{t.var(we.default.instancePath,(0,ae._)`""`),t.var(we.default.parentData,(0,ae._)`undefined`),t.var(we.default.parentDataProperty,(0,ae._)`undefined`),t.var(we.default.rootData,we.default.data),e.dynamicRef&&t.var(we.default.dynamicAnchors,(0,ae._)`{}`)})}function fY(t){let{schema:e,opts:r,gen:n}=t;DD(t,()=>{r.$comment&&e.$comment&&ZD(t),yY(t),n.let(we.default.vErrors,null),n.let(we.default.errors,0),r.unevaluated&&mY(t),BD(t),wY(t)})}function mY(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,ae._)`${r}.evaluated`),e.if((0,ae._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ae._)`${t.evaluated}.props`,(0,ae._)`undefined`)),e.if((0,ae._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ae._)`${t.evaluated}.items`,(0,ae._)`undefined`))}function ND(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,ae._)`/*# sourceURL=${r} */`:ae.nil}function hY(t,e){if(UD(t)&&(FD(t),LD(t))){gY(t,e);return}(0,jD.boolOrEmptySchema)(t,e)}function LD({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function UD(t){return typeof t.schema!="boolean"}function gY(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&ZD(t),vY(t),bY(t);let i=n.const("_errs",we.default.errors);BD(t,i),n.var(e,(0,ae._)`${i} === ${we.default.errors}`)}function FD(t){(0,mi.checkUnknownRules)(t),_Y(t)}function BD(t,e){if(t.opts.jtd)return zD(t,[],!1,e);let r=(0,RD.getSchemaTypes)(t.schema),n=(0,RD.coerceAndCheckDataType)(t,r);zD(t,r,!n,e)}function _Y(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,mi.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function yY(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,mi.checkStrictMode)(t,"default is ignored in the schema root")}function vY(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,uY.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function bY(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function ZD({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,ae._)`${we.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let s=(0,ae.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,ae._)`${we.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function wY(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=t;r.$async?e.if((0,ae._)`${we.default.errors} === 0`,()=>e.return(we.default.data),()=>e.throw((0,ae._)`new ${o}(${we.default.vErrors})`)):(e.assign((0,ae._)`${n}.errors`,we.default.vErrors),i.unevaluated&&xY(t),e.return((0,ae._)`${we.default.errors} === 0`))}function xY({gen:t,evaluated:e,props:r,items:n}){r instanceof ae.Name&&t.assign((0,ae._)`${e}.props`,r),n instanceof ae.Name&&t.assign((0,ae._)`${e}.items`,n)}function zD(t,e,r,n){let{gen:o,schema:i,data:s,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,mi.schemaHasRulesButRef)(i,l))){o.block(()=>VD(t,"$ref",l.all.$ref.definition));return}c.jtd||$Y(t,e),o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,mk.shouldUseGroup)(i,f)&&(f.type?(o.if((0,ob.checkDataType)(f.type,s,c.strictNumbers)),MD(t,f),e.length===1&&e[0]===f.type&&r&&(o.else(),(0,ob.reportTypeError)(t)),o.endIf()):MD(t,f),a||o.if((0,ae._)`${we.default.errors} === ${n||0}`))}}function MD(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,cY.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,mk.shouldUseRule)(n,i)&&VD(t,i.keyword,i.definition,e.type)})}function $Y(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(IY(t,e),t.opts.allowUnionTypes||SY(t,e),kY(t,t.dataTypes))}function IY(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{qD(t.dataTypes,r)||hk(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),EY(t,e)}}function SY(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&hk(t,"use allowUnionTypes to allow union type keyword")}function kY(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,mk.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(s=>TY(e,s))&&hk(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function TY(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function qD(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function EY(t,e){let r=[];for(let n of t.dataTypes)qD(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function hk(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,mi.checkStrictMode)(t,e,t.opts.strictTypes)}var ib=class{constructor(e,r,n){if((0,Bf.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,mi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",GD(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Bf.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",we.default.errors))}result(e,r,n){this.failResult((0,ae.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,ae.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,ae._)`${r} !== undefined && (${(0,ae.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Ff.reportExtraError:Ff.reportError)(this,this.def.error,r)}$dataError(){(0,Ff.reportError)(this,this.def.$dataError||Ff.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ff.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=ae.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=ae.nil,r=ae.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:s}=this;n.if((0,ae.or)((0,ae._)`${o} === undefined`,r)),e!==ae.nil&&n.assign(e,!0),(i.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==ae.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,ae.or)(s(),a());function s(){if(n.length){if(!(r instanceof ae.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,ae._)`${(0,ob.checkDataTypes)(c,r,i.opts.strictNumbers,ob.DataType.Wrong)}`}return ae.nil}function a(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,ae._)`!${c}(${r})`}return ae.nil}}subschema(e,r){let n=(0,fk.getSubschema)(this.it,e);(0,fk.extendSubschemaData)(n,this.it,e),(0,fk.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return hY(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=mi.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=mi.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,ae.Name)),!0}};xs.KeywordCxt=ib;function VD(t,e,r,n){let o=new ib(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Bf.funcKeywordCode)(o,r):"macro"in r?(0,Bf.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Bf.funcKeywordCode)(o,r)}var AY=/^\/(?:[^~]|~0|~1)*$/,OY=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function GD(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return we.default.rootData;if(t[0]==="/"){if(!AY.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=we.default.rootData}else{let u=OY.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!o)return i}let s=i,a=o.split("/");for(let u of a)u&&(i=(0,ae._)`${i}${(0,ae.getProperty)((0,mi.unescapeJsonPointer)(u))}`,s=(0,ae._)`${s} && ${i}`);return s;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}xs.getData=GD});var sb=P(_k=>{"use strict";Object.defineProperty(_k,"__esModule",{value:!0});var gk=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};_k.default=gk});var qf=P(bk=>{"use strict";Object.defineProperty(bk,"__esModule",{value:!0});var yk=Uf(),vk=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,yk.resolveUrl)(e,r,n),this.missingSchema=(0,yk.normalizeId)((0,yk.getFullPath)(e,this.missingRef))}};bk.default=vk});var cb=P(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.resolveSchema=An.getCompilingSchema=An.resolveRef=An.compileSchema=An.SchemaEnv=void 0;var Yn=Oe(),PY=sb(),ic=fi(),Qn=Uf(),KD=Be(),CY=Zf(),Pl=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Qn.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};An.SchemaEnv=Pl;function xk(t){let e=HD.call(this,t);if(e)return e;let r=(0,Qn.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,s=new Yn.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),a;t.$async&&(a=s.scopeValue("Error",{ref:PY.default,code:(0,Yn._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");t.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:ic.default.data,parentData:ic.default.parentData,parentDataProperty:ic.default.parentDataProperty,dataNames:[ic.default.data],dataPathArr:[Yn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Yn.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Yn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Yn._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,CY.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let d=s.toString();l=`${s.scopeRefs(ic.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let p=new Function(`${ic.default.self}`,`${ic.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=u;p.evaluated={props:m instanceof Yn.Name?void 0:m,items:h instanceof Yn.Name?void 0:h,dynamicProps:m instanceof Yn.Name,dynamicItems:h instanceof Yn.Name},p.source&&(p.source.evaluated=(0,Yn.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}An.compileSchema=xk;function RY(t,e,r){var n;r=(0,Qn.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let i=MY.call(this,t,r);if(i===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(i=new Pl({schema:s,schemaId:a,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=NY.call(this,i)}An.resolveRef=RY;function NY(t){return(0,Qn.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:xk.call(this,t)}function HD(t){for(let e of this._compilations)if(zY(e,t))return e}An.getCompilingSchema=HD;function zY(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function MY(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||ab.call(this,t,e)}function ab(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Qn._getFullPath)(this.opts.uriResolver,r),o=(0,Qn.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return wk.call(this,r,t);let i=(0,Qn.normalizeId)(n),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){let a=ab.call(this,t,s);return typeof a?.schema!="object"?void 0:wk.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||xk.call(this,s),i===(0,Qn.normalizeId)(e)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,Qn.resolveUrl)(this.opts.uriResolver,o,u)),new Pl({schema:a,schemaId:c,root:t,baseId:o})}return wk.call(this,r,s)}}An.resolveSchema=ab;var jY=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function wk(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,KD.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!jY.has(a)&&u&&(e=(0,Qn.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,KD.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Qn.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=ab.call(this,n,a)}let{schemaId:s}=this.opts;if(i=i||new Pl({schema:r,schemaId:s,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var WD=P((J2e,DY)=>{DY.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Ik=P((X2e,QD)=>{"use strict";var LY=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),XD=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function $k(t){let e="",r=0,n=0;for(n=0;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var UY=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function JD(t){return t.length=0,!0}function FY(t,e,r){if(t.length){let n=$k(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function BY(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,s=!1,a=FY;for(let c=0;c7){r.error=!0;break}c>0&&t[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=JD}else{o.push(u);continue}}return o.length&&(a===JD?r.zone=o.join(""):s?n.push(o.join("")):n.push($k(o))),r.address=n.join(""),r}function YD(t){if(ZY(t,":")<2)return{host:t,isIPV6:!1};let e=BY(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function ZY(t,e){let r=0;for(let n=0;n{"use strict";var{isUUID:KY}=Ik(),HY=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,WY=["http","https","ws","wss","urn","urn:uuid"];function JY(t){return WY.indexOf(t)!==-1}function Sk(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function eL(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function tL(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function XY(t){return t.secure=Sk(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function YY(t){if((t.port===(Sk(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function QY(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(HY);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,i=kk(o);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function eQ(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,i=kk(o);i&&(t=i.serialize(t,e));let s=t,a=t.nss;return s.path=`${n||e.nid}:${a}`,e.skipEscape=!0,s}function tQ(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!KY(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function rQ(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var rL={scheme:"http",domainHost:!0,parse:eL,serialize:tL},nQ={scheme:"https",domainHost:rL.domainHost,parse:eL,serialize:tL},ub={scheme:"ws",domainHost:!0,parse:XY,serialize:YY},oQ={scheme:"wss",domainHost:ub.domainHost,parse:ub.parse,serialize:ub.serialize},iQ={scheme:"urn",parse:QY,serialize:eQ,skipNormalize:!0},sQ={scheme:"urn:uuid",parse:tQ,serialize:rQ,skipNormalize:!0},lb={http:rL,https:nQ,ws:ub,wss:oQ,urn:iQ,"urn:uuid":sQ};Object.setPrototypeOf(lb,null);function kk(t){return t&&(lb[t]||lb[t.toLowerCase()])||void 0}nL.exports={wsIsSecure:Sk,SCHEMES:lb,isValidSchemeName:JY,getSchemeHandler:kk}});var aL=P((Q2e,pb)=>{"use strict";var{normalizeIPv6:aQ,removeDotSegments:Vf,recomposeAuthority:cQ,normalizeComponentEncoding:db,isIPv4:uQ,nonSimpleDomain:lQ}=Ik(),{SCHEMES:dQ,getSchemeHandler:iL}=oL();function pQ(t,e){return typeof t=="string"?t=Oo(hi(t,e),e):typeof t=="object"&&(t=hi(Oo(t,e),e)),t}function fQ(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=sL(hi(t,n),hi(e,n),n,!0);return n.skipEscape=!0,Oo(o,n)}function sL(t,e,r,n){let o={};return n||(t=hi(Oo(t,r),r),e=hi(Oo(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Vf(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Vf(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=Vf(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=Vf(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function mQ(t,e,r){return typeof t=="string"?(t=unescape(t),t=Oo(db(hi(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Oo(db(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Oo(db(hi(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Oo(db(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Oo(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],i=iL(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let s=cQ(r);if(s!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(s),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(a=Vf(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var hQ=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function hi(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(hQ);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(uQ(n.host)===!1){let c=aQ(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let s=iL(r.scheme||n.scheme);if(!r.unicodeSupport&&(!s||!s.unicodeSupport)&&n.host&&(r.domainHost||s&&s.domainHost)&&o===!1&&lQ(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!s||s&&!s.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),s&&s.parse&&s.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Tk={SCHEMES:dQ,normalize:pQ,resolve:fQ,resolveComponent:sL,equal:mQ,serialize:Oo,parse:hi};pb.exports=Tk;pb.exports.default=Tk;pb.exports.fastUri=Tk});var uL=P(Ek=>{"use strict";Object.defineProperty(Ek,"__esModule",{value:!0});var cL=aL();cL.code='require("ajv/dist/runtime/uri").default';Ek.default=cL});var _L=P(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.CodeGen=Xt.Name=Xt.nil=Xt.stringify=Xt.str=Xt._=Xt.KeywordCxt=void 0;var gQ=Zf();Object.defineProperty(Xt,"KeywordCxt",{enumerable:!0,get:function(){return gQ.KeywordCxt}});var Cl=Oe();Object.defineProperty(Xt,"_",{enumerable:!0,get:function(){return Cl._}});Object.defineProperty(Xt,"str",{enumerable:!0,get:function(){return Cl.str}});Object.defineProperty(Xt,"stringify",{enumerable:!0,get:function(){return Cl.stringify}});Object.defineProperty(Xt,"nil",{enumerable:!0,get:function(){return Cl.nil}});Object.defineProperty(Xt,"Name",{enumerable:!0,get:function(){return Cl.Name}});Object.defineProperty(Xt,"CodeGen",{enumerable:!0,get:function(){return Cl.CodeGen}});var _Q=sb(),mL=qf(),yQ=nk(),Gf=cb(),vQ=Oe(),Kf=Uf(),fb=Lf(),Ok=Be(),lL=WD(),bQ=uL(),hL=(t,e)=>new RegExp(t,e);hL.code="new RegExp";var wQ=["removeAdditional","useDefaults","coerceTypes"],xQ=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),$Q={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},IQ={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},dL=200;function SQ(t){var e,r,n,o,i,s,a,c,u,l,d,f,p,m,h,_,v,b,x,k,T,F,J,w,Z;let oe=t.strict,Q=(e=t.code)===null||e===void 0?void 0:e.optimize,wt=Q===!0||Q===void 0?1:Q||0,dn=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:hL,pn=(o=t.uriResolver)!==null&&o!==void 0?o:bQ.default;return{strictSchema:(s=(i=t.strictSchema)!==null&&i!==void 0?i:oe)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:oe)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:oe)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:oe)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:oe)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:wt,regExp:dn}:{optimize:wt,regExp:dn},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:dL,loopEnum:(_=t.loopEnum)!==null&&_!==void 0?_:dL,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(x=t.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(k=t.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(F=t.validateSchema)!==null&&F!==void 0?F:!0,validateFormats:(J=t.validateFormats)!==null&&J!==void 0?J:!0,unicodeRegExp:(w=t.unicodeRegExp)!==null&&w!==void 0?w:!0,int32range:(Z=t.int32range)!==null&&Z!==void 0?Z:!0,uriResolver:pn}}var Hf=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...SQ(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new vQ.ValueScope({scope:{},prefixes:xQ,es5:r,lines:n}),this.logger=PQ(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,yQ.getRules)(),pL.call(this,$Q,e,"NOT SUPPORTED"),pL.call(this,IQ,e,"DEPRECATED","warn"),this._metaOpts=AQ.call(this),e.formats&&TQ.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&EQ.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),kQ.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=lL;n==="id"&&(o={...lL},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await i.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||s.call(this,f)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof mL.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,o);return this}let i;if(typeof e=="object"){let{schemaId:s}=this.opts;if(i=e[s],i!==void 0&&typeof i!="string")throw new Error(`schema ${s} must be string`)}return r=(0,Kf.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(e){let r;for(;typeof(r=fL.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Gf.SchemaEnv({schema:{},schemaId:n});if(r=Gf.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=fL.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Kf.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(RQ.call(this,n,r),!r)return(0,Ok.eachItem)(n,i=>Ak.call(this,i)),this;zQ.call(this,r);let o={...r,type:(0,fb.getJSONTypes)(r.type),schemaType:(0,fb.getJSONTypes)(r.schemaType)};return(0,Ok.eachItem)(n,o.type.length===0?i=>Ak.call(this,i,o):i=>o.type.forEach(s=>Ak.call(this,i,o,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let i=o.split("/").slice(1),s=e;for(let a of i)s=s[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=s[a];u&&l&&(s[a]=gL(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Kf.normalizeId)(s||n);let u=Kf.getSchemaRefs.call(this,e,n);return c=new Gf.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Gf.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Gf.compileSchema.call(this,e)}finally{this.opts=r}}};Hf.ValidationError=_Q.default;Hf.MissingRefError=mL.default;Xt.default=Hf;function pL(t,e,r,n="error"){for(let o in t){let i=o;i in e&&this.logger[n](`${r}: option ${o}. ${t[i]}`)}}function fL(t){return t=(0,Kf.normalizeId)(t),this.schemas[t]||this.refs[t]}function kQ(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function TQ(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function EQ(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function AQ(){let t={...this.opts};for(let e of wQ)delete t[e];return t}var OQ={log(){},warn(){},error(){}};function PQ(t){if(t===!1)return OQ;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var CQ=/^[a-z_$][a-z0-9_$:-]*$/i;function RQ(t,e){let{RULES:r}=this;if((0,Ok.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!CQ.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Ak(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=o?i.post:i.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,fb.getJSONTypes)(e.type),schemaType:(0,fb.getJSONTypes)(e.schemaType)}};e.before?NQ.call(this,s,a,e.before):s.rules.push(a),i.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function NQ(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function zQ(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=gL(e)),t.validateSchema=this.compile(e,!0))}var MQ={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function gL(t){return{anyOf:[t,MQ]}}});var yL=P(Pk=>{"use strict";Object.defineProperty(Pk,"__esModule",{value:!0});var jQ={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Pk.default=jQ});var xL=P(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.callRef=sc.getValidate=void 0;var DQ=qf(),vL=En(),qr=Oe(),Rl=fi(),bL=cb(),mb=Be(),LQ={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:i,validateName:s,opts:a,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=bL.resolveRef.call(c,u,o,r);if(l===void 0)throw new DQ.default(n.opts.uriResolver,o,r);if(l instanceof bL.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return hb(t,s,i,i.$async);let m=e.scopeValue("root",{ref:u});return hb(t,(0,qr._)`${m}.validate`,u,u.$async)}function f(m){let h=wL(t,m);hb(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,qr.stringify)(m)}:{ref:m}),_=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:qr.nil,topSchemaRef:h,errSchemaPath:r},_);t.mergeEvaluated(v),t.ok(_)}}};function wL(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,qr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}sc.getValidate=wL;function hb(t,e,r,n){let{gen:o,it:i}=t,{allErrors:s,schemaEnv:a,opts:c}=i,u=c.passContext?Rl.default.this:qr.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{o.code((0,qr._)`await ${(0,vL.callValidateCode)(t,e,u)}`),p(e),s||o.assign(m,!0)},h=>{o.if((0,qr._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),f(h),s||o.assign(m,!1)}),t.ok(m)}function d(){t.result((0,vL.callValidateCode)(t,e,u),()=>p(e),()=>f(e))}function f(m){let h=(0,qr._)`${m}.errors`;o.assign(Rl.default.vErrors,(0,qr._)`${Rl.default.vErrors} === null ? ${h} : ${Rl.default.vErrors}.concat(${h})`),o.assign(Rl.default.errors,(0,qr._)`${Rl.default.vErrors}.length`)}function p(m){var h;if(!i.opts.unevaluated)return;let _=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(i.props=mb.mergeEvaluated.props(o,_.props,i.props));else{let v=o.var("props",(0,qr._)`${m}.evaluated.props`);i.props=mb.mergeEvaluated.props(o,v,i.props,qr.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=mb.mergeEvaluated.items(o,_.items,i.items));else{let v=o.var("items",(0,qr._)`${m}.evaluated.items`);i.items=mb.mergeEvaluated.items(o,v,i.items,qr.Name)}}}sc.callRef=hb;sc.default=LQ});var $L=P(Ck=>{"use strict";Object.defineProperty(Ck,"__esModule",{value:!0});var UQ=yL(),FQ=xL(),BQ=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",UQ.default,FQ.default];Ck.default=BQ});var IL=P(Rk=>{"use strict";Object.defineProperty(Rk,"__esModule",{value:!0});var gb=Oe(),$s=gb.operators,_b={maximum:{okStr:"<=",ok:$s.LTE,fail:$s.GT},minimum:{okStr:">=",ok:$s.GTE,fail:$s.LT},exclusiveMaximum:{okStr:"<",ok:$s.LT,fail:$s.GTE},exclusiveMinimum:{okStr:">",ok:$s.GT,fail:$s.LTE}},ZQ={message:({keyword:t,schemaCode:e})=>(0,gb.str)`must be ${_b[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,gb._)`{comparison: ${_b[t].okStr}, limit: ${e}}`},qQ={keyword:Object.keys(_b),type:"number",schemaType:"number",$data:!0,error:ZQ,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,gb._)`${r} ${_b[e].fail} ${n} || isNaN(${r})`)}};Rk.default=qQ});var SL=P(Nk=>{"use strict";Object.defineProperty(Nk,"__esModule",{value:!0});var Wf=Oe(),VQ={message:({schemaCode:t})=>(0,Wf.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Wf._)`{multipleOf: ${t}}`},GQ={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:VQ,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,i=o.opts.multipleOfPrecision,s=e.let("res"),a=i?(0,Wf._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:(0,Wf._)`${s} !== parseInt(${s})`;t.fail$data((0,Wf._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};Nk.default=GQ});var TL=P(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});function kL(t){let e=t.length,r=0,n=0,o;for(;n=55296&&o<=56319&&n{"use strict";Object.defineProperty(Mk,"__esModule",{value:!0});var ac=Oe(),KQ=Be(),HQ=TL(),WQ={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,ac.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,ac._)`{limit: ${t}}`},JQ={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:WQ,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,i=e==="maxLength"?ac.operators.GT:ac.operators.LT,s=o.opts.unicode===!1?(0,ac._)`${r}.length`:(0,ac._)`${(0,KQ.useFunc)(t.gen,HQ.default)}(${r})`;t.fail$data((0,ac._)`${s} ${i} ${n}`)}};Mk.default=JQ});var AL=P(jk=>{"use strict";Object.defineProperty(jk,"__esModule",{value:!0});var XQ=En(),yb=Oe(),YQ={message:({schemaCode:t})=>(0,yb.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,yb._)`{pattern: ${t}}`},QQ={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:YQ,code(t){let{data:e,$data:r,schema:n,schemaCode:o,it:i}=t,s=i.opts.unicodeRegExp?"u":"",a=r?(0,yb._)`(new RegExp(${o}, ${s}))`:(0,XQ.usePattern)(t,n);t.fail$data((0,yb._)`!${a}.test(${e})`)}};jk.default=QQ});var OL=P(Dk=>{"use strict";Object.defineProperty(Dk,"__esModule",{value:!0});var Jf=Oe(),eee={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Jf.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Jf._)`{limit: ${t}}`},tee={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:eee,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Jf.operators.GT:Jf.operators.LT;t.fail$data((0,Jf._)`Object.keys(${r}).length ${o} ${n}`)}};Dk.default=tee});var PL=P(Lk=>{"use strict";Object.defineProperty(Lk,"__esModule",{value:!0});var Xf=En(),Yf=Oe(),ree=Be(),nee={message:({params:{missingProperty:t}})=>(0,Yf.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Yf._)`{missingProperty: ${t}}`},oee={keyword:"required",type:"object",schemaType:"array",$data:!0,error:nee,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:i,it:s}=t,{opts:a}=s;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?u():l(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let _=s.schemaEnv.baseId+s.errSchemaPath,v=`required property "${h}" is not defined at "${_}" (strictRequired)`;(0,ree.checkStrictMode)(s,v,s.opts.strictRequired)}}function u(){if(c||i)t.block$data(Yf.nil,d);else for(let p of r)(0,Xf.checkReportMissingProp)(t,p)}function l(){let p=e.let("missing");if(c||i){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,Xf.checkMissingProp)(t,r,p)),(0,Xf.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Xf.noPropertyInData)(e,o,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,Xf.propertyInData)(e,o,p,a.ownProperties)),e.if((0,Yf.not)(m),()=>{t.error(),e.break()})},Yf.nil)}}};Lk.default=oee});var CL=P(Uk=>{"use strict";Object.defineProperty(Uk,"__esModule",{value:!0});var Qf=Oe(),iee={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Qf.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Qf._)`{limit: ${t}}`},see={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:iee,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Qf.operators.GT:Qf.operators.LT;t.fail$data((0,Qf._)`${r}.length ${o} ${n}`)}};Uk.default=see});var vb=P(Fk=>{"use strict";Object.defineProperty(Fk,"__esModule",{value:!0});var RL=dk();RL.code='require("ajv/dist/runtime/equal").default';Fk.default=RL});var NL=P(Zk=>{"use strict";Object.defineProperty(Zk,"__esModule",{value:!0});var Bk=Lf(),Yt=Oe(),aee=Be(),cee=vb(),uee={message:({params:{i:t,j:e}})=>(0,Yt.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Yt._)`{i: ${t}, j: ${e}}`},lee={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:uee,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:i,schemaCode:s,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=i.items?(0,Bk.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Yt._)`${s} === false`),t.ok(c);function l(){let m=e.let("i",(0,Yt._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,Yt._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,h){let _=e.name("item"),v=(0,Bk.checkDataTypes)(u,_,a.opts.strictNumbers,Bk.DataType.Wrong),b=e.const("indices",(0,Yt._)`{}`);e.for((0,Yt._)`;${m}--;`,()=>{e.let(_,(0,Yt._)`${r}[${m}]`),e.if(v,(0,Yt._)`continue`),u.length>1&&e.if((0,Yt._)`typeof ${_} == "string"`,(0,Yt._)`${_} += "_"`),e.if((0,Yt._)`typeof ${b}[${_}] == "number"`,()=>{e.assign(h,(0,Yt._)`${b}[${_}]`),t.error(),e.assign(c,!1).break()}).code((0,Yt._)`${b}[${_}] = ${m}`)})}function p(m,h){let _=(0,aee.useFunc)(e,cee.default),v=e.name("outer");e.label(v).for((0,Yt._)`;${m}--;`,()=>e.for((0,Yt._)`${h} = ${m}; ${h}--;`,()=>e.if((0,Yt._)`${_}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Zk.default=lee});var zL=P(Vk=>{"use strict";Object.defineProperty(Vk,"__esModule",{value:!0});var qk=Oe(),dee=Be(),pee=vb(),fee={message:"must be equal to constant",params:({schemaCode:t})=>(0,qk._)`{allowedValue: ${t}}`},mee={keyword:"const",$data:!0,error:fee,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,qk._)`!${(0,dee.useFunc)(e,pee.default)}(${r}, ${o})`):t.fail((0,qk._)`${i} !== ${r}`)}};Vk.default=mee});var ML=P(Gk=>{"use strict";Object.defineProperty(Gk,"__esModule",{value:!0});var em=Oe(),hee=Be(),gee=vb(),_ee={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,em._)`{allowedValues: ${t}}`},yee={keyword:"enum",schemaType:"array",$data:!0,error:_ee,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:s}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=s.opts.loopEnum,c,u=()=>c??(c=(0,hee.useFunc)(e,gee.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let p=e.const("vSchema",i);l=(0,em.or)(...o.map((m,h)=>f(p,h)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,p=>e.if((0,em._)`${u()}(${r}, ${p})`,()=>e.assign(l,!0).break()))}function f(p,m){let h=o[m];return typeof h=="object"&&h!==null?(0,em._)`${u()}(${r}, ${p}[${m}])`:(0,em._)`${r} === ${h}`}}};Gk.default=yee});var jL=P(Kk=>{"use strict";Object.defineProperty(Kk,"__esModule",{value:!0});var vee=IL(),bee=SL(),wee=EL(),xee=AL(),$ee=OL(),Iee=PL(),See=CL(),kee=NL(),Tee=zL(),Eee=ML(),Aee=[vee.default,bee.default,wee.default,xee.default,$ee.default,Iee.default,See.default,kee.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Tee.default,Eee.default];Kk.default=Aee});var Wk=P(tm=>{"use strict";Object.defineProperty(tm,"__esModule",{value:!0});tm.validateAdditionalItems=void 0;var cc=Oe(),Hk=Be(),Oee={message:({params:{len:t}})=>(0,cc.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,cc._)`{limit: ${t}}`},Pee={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Oee,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Hk.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}DL(t,n)}};function DL(t,e){let{gen:r,schema:n,data:o,keyword:i,it:s}=t;s.items=!0;let a=r.const("len",(0,cc._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,cc._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Hk.alwaysValidSchema)(s,n)){let u=r.var("valid",(0,cc._)`${a} <= ${e.length}`);r.if((0,cc.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:Hk.Type.Num},u),s.allErrors||r.if((0,cc.not)(u),()=>r.break())})}}tm.validateAdditionalItems=DL;tm.default=Pee});var Jk=P(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});rm.validateTuple=void 0;var LL=Oe(),bb=Be(),Cee=En(),Ree={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return UL(t,"additionalItems",e);r.items=!0,!(0,bb.alwaysValidSchema)(r,e)&&t.ok((0,Cee.validateArray)(t))}};function UL(t,e,r=t.schema){let{gen:n,parentSchema:o,data:i,keyword:s,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=bb.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,LL._)`${i}.length`);r.forEach((d,f)=>{(0,bb.alwaysValidSchema)(a,d)||(n.if((0,LL._)`${u} > ${f}`,()=>t.subschema({keyword:s,schemaProp:f,dataProp:f},c)),t.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let _=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,bb.checkStrictMode)(a,_,f.strictTuples)}}}rm.validateTuple=UL;rm.default=Ree});var FL=P(Xk=>{"use strict";Object.defineProperty(Xk,"__esModule",{value:!0});var Nee=Jk(),zee={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Nee.validateTuple)(t,"items")};Xk.default=zee});var ZL=P(Yk=>{"use strict";Object.defineProperty(Yk,"__esModule",{value:!0});var BL=Oe(),Mee=Be(),jee=En(),Dee=Wk(),Lee={message:({params:{len:t}})=>(0,BL.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,BL._)`{limit: ${t}}`},Uee={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Lee,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,Mee.alwaysValidSchema)(n,e)&&(o?(0,Dee.validateAdditionalItems)(t,o):t.ok((0,jee.validateArray)(t)))}};Yk.default=Uee});var qL=P(Qk=>{"use strict";Object.defineProperty(Qk,"__esModule",{value:!0});var On=Oe(),wb=Be(),Fee={message:({params:{min:t,max:e}})=>e===void 0?(0,On.str)`must contain at least ${t} valid item(s)`:(0,On.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,On._)`{minContains: ${t}}`:(0,On._)`{minContains: ${t}, maxContains: ${e}}`},Bee={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Fee,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t,s,a,{minContains:c,maxContains:u}=n;i.opts.next?(s=c===void 0?1:c,a=u):s=1;let l=e.const("len",(0,On._)`${o}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,wb.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,wb.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,wb.alwaysValidSchema)(i,r)){let h=(0,On._)`${l} >= ${s}`;a!==void 0&&(h=(0,On._)`${h} && ${l} <= ${a}`),t.pass(h);return}i.items=!0;let d=e.name("valid");a===void 0&&s===1?p(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,On._)`${o}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),_=e.let("count",0);p(h,()=>e.if(h,()=>m(_)))}function p(h,_){e.forRange("i",0,l,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:wb.Type.Num,compositeRule:!0},h),_()})}function m(h){e.code((0,On._)`${h}++`),a===void 0?e.if((0,On._)`${h} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,On._)`${h} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,On._)`${h} >= ${s}`,()=>e.assign(d,!0)))}}};Qk.default=Bee});var KL=P(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.validateSchemaDeps=Po.validatePropertyDeps=Po.error=void 0;var eT=Oe(),Zee=Be(),nm=En();Po.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,eT.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,eT._)`{property: ${t}, + missingProperty: ${n}, + depsCount: ${e}, + deps: ${r}}`};var qee={keyword:"dependencies",type:"object",schemaType:"object",error:Po.error,code(t){let[e,r]=Vee(t);VL(t,e),GL(t,r)}};function Vee({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function VL(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let c=(0,nm.propertyInData)(r,n,s,o.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,nm.checkReportMissingProp)(t,u)}):(r.if((0,eT._)`${c} && (${(0,nm.checkMissingProp)(t,a,i)})`),(0,nm.reportMissingProp)(t,i),r.else())}}Po.validatePropertyDeps=VL;function GL(t,e=t.schema){let{gen:r,data:n,keyword:o,it:i}=t,s=r.name("valid");for(let a in e)(0,Zee.alwaysValidSchema)(i,e[a])||(r.if((0,nm.propertyInData)(r,n,a,i.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},s);t.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),t.ok(s))}Po.validateSchemaDeps=GL;Po.default=qee});var WL=P(tT=>{"use strict";Object.defineProperty(tT,"__esModule",{value:!0});var HL=Oe(),Gee=Be(),Kee={message:"property name must be valid",params:({params:t})=>(0,HL._)`{propertyName: ${t.propertyName}}`},Hee={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Kee,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,Gee.alwaysValidSchema)(o,r))return;let i=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),e.if((0,HL.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};tT.default=Hee});var nT=P(rT=>{"use strict";Object.defineProperty(rT,"__esModule",{value:!0});var xb=En(),eo=Oe(),Wee=fi(),$b=Be(),Jee={message:"must NOT have additional properties",params:({params:t})=>(0,eo._)`{additionalProperty: ${t.additionalProperty}}`},Xee={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Jee,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,$b.alwaysValidSchema)(s,r))return;let u=(0,xb.allSchemaProperties)(n.properties),l=(0,xb.allSchemaProperties)(n.patternProperties);d(),t.ok((0,eo._)`${i} === ${Wee.default.errors}`);function d(){e.forIn("key",o,_=>{!u.length&&!l.length?m(_):e.if(f(_),()=>m(_))})}function f(_){let v;if(u.length>8){let b=(0,$b.schemaRefOrVal)(s,n.properties,"properties");v=(0,xb.isOwnProperty)(e,b,_)}else u.length?v=(0,eo.or)(...u.map(b=>(0,eo._)`${_} === ${b}`)):v=eo.nil;return l.length&&(v=(0,eo.or)(v,...l.map(b=>(0,eo._)`${(0,xb.usePattern)(t,b)}.test(${_})`))),(0,eo.not)(v)}function p(_){e.code((0,eo._)`delete ${o}[${_}]`)}function m(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(_);return}if(r===!1){t.setParams({additionalProperty:_}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,$b.alwaysValidSchema)(s,r)){let v=e.name("valid");c.removeAdditional==="failing"?(h(_,v,!1),e.if((0,eo.not)(v),()=>{t.reset(),p(_)})):(h(_,v),a||e.if((0,eo.not)(v),()=>e.break()))}}function h(_,v,b){let x={keyword:"additionalProperties",dataProp:_,dataPropType:$b.Type.Str};b===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,v)}}};rT.default=Xee});var YL=P(iT=>{"use strict";Object.defineProperty(iT,"__esModule",{value:!0});var Yee=Zf(),JL=En(),oT=Be(),XL=nT(),Qee={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&XL.default.code(new Yee.KeywordCxt(i,XL.default,"additionalProperties"));let s=(0,JL.allSchemaProperties)(r);for(let d of s)i.definedProperties.add(d);i.opts.unevaluated&&s.length&&i.props!==!0&&(i.props=oT.mergeEvaluated.props(e,(0,oT.toHash)(s),i.props));let a=s.filter(d=>!(0,oT.alwaysValidSchema)(i,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,JL.propertyInData)(e,o,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};iT.default=Qee});var rU=P(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0});var QL=En(),Ib=Oe(),eU=Be(),tU=Be(),ete={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:i}=t,{opts:s}=i,a=(0,QL.allSchemaProperties)(r),c=a.filter(h=>(0,eU.alwaysValidSchema)(i,r[h]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&o.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof Ib.Name)&&(i.props=(0,tU.evaluatedPropsToName)(e,i.props));let{props:d}=i;f();function f(){for(let h of a)u&&p(h),i.allErrors?m(h):(e.var(l,!0),m(h),e.if(l))}function p(h){for(let _ in u)new RegExp(h).test(_)&&(0,eU.checkStrictMode)(i,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,_=>{e.if((0,Ib._)`${(0,QL.usePattern)(t,h)}.test(${_})`,()=>{let v=c.includes(h);v||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:tU.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,Ib._)`${d}[${_}]`,!0):!v&&!i.allErrors&&e.if((0,Ib.not)(l),()=>e.break())})})}}};sT.default=ete});var nU=P(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});var tte=Be(),rte={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,tte.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};aT.default=rte});var oU=P(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});var nte=En(),ote={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:nte.validateUnion,error:{message:"must match a schema in anyOf"}};cT.default=ote});var iU=P(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});var Sb=Oe(),ite=Be(),ste={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Sb._)`{passingSchemas: ${t.passing}}`},ate={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:ste,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,s=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(s,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let f;(0,ite.alwaysValidSchema)(o,l)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Sb._)`${c} && ${s}`).assign(s,!1).assign(a,(0,Sb._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(s,!0),e.assign(a,d),f&&t.mergeEvaluated(f,Sb.Name)})})}}};uT.default=ate});var sU=P(lT=>{"use strict";Object.defineProperty(lT,"__esModule",{value:!0});var cte=Be(),ute={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((i,s)=>{if((0,cte.alwaysValidSchema)(n,i))return;let a=t.subschema({keyword:"allOf",schemaProp:s},o);t.ok(o),t.mergeEvaluated(a)})}};lT.default=ute});var uU=P(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0});var kb=Oe(),cU=Be(),lte={message:({params:t})=>(0,kb.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,kb._)`{failingKeyword: ${t.ifClause}}`},dte={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:lte,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,cU.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=aU(n,"then"),i=aU(n,"else");if(!o&&!i)return;let s=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else o?e.if(a,u("then")):e.if((0,kb.not)(a),u("else"));t.pass(s,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let f=t.subschema({keyword:l},a);e.assign(s,a),t.mergeValidEvaluated(f,s),d?e.assign(d,(0,kb._)`${l}`):t.setParams({ifClause:l})}}}};function aU(t,e){let r=t.schema[e];return r!==void 0&&!(0,cU.alwaysValidSchema)(t,r)}dT.default=dte});var lU=P(pT=>{"use strict";Object.defineProperty(pT,"__esModule",{value:!0});var pte=Be(),fte={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,pte.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};pT.default=fte});var dU=P(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});var mte=Wk(),hte=FL(),gte=Jk(),_te=ZL(),yte=qL(),vte=KL(),bte=WL(),wte=nT(),xte=YL(),$te=rU(),Ite=nU(),Ste=oU(),kte=iU(),Tte=sU(),Ete=uU(),Ate=lU();function Ote(t=!1){let e=[Ite.default,Ste.default,kte.default,Tte.default,Ete.default,Ate.default,bte.default,wte.default,vte.default,xte.default,$te.default];return t?e.push(hte.default,_te.default):e.push(mte.default,gte.default),e.push(yte.default),e}fT.default=Ote});var pU=P(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});var kt=Oe(),Pte={message:({schemaCode:t})=>(0,kt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,kt._)`{format: ${t}}`},Cte={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Pte,code(t,e){let{gen:r,data:n,$data:o,schema:i,schemaCode:s,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,kt._)`${m}[${s}]`),_=r.let("fType"),v=r.let("format");r.if((0,kt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(_,(0,kt._)`${h}.type || "string"`).assign(v,(0,kt._)`${h}.validate`),()=>r.assign(_,(0,kt._)`"string"`).assign(v,h)),t.fail$data((0,kt.or)(b(),x()));function b(){return c.strictSchema===!1?kt.nil:(0,kt._)`${s} && !${v}`}function x(){let k=l.$async?(0,kt._)`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,kt._)`${v}(${n})`,T=(0,kt._)`(typeof ${v} == "function" ? ${k} : ${v}.test(${n}))`;return(0,kt._)`${v} && ${v} !== true && ${_} === ${e} && !${T}`}}function p(){let m=d.formats[i];if(!m){b();return}if(m===!0)return;let[h,_,v]=x(m);h===e&&t.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function x(T){let F=T instanceof RegExp?(0,kt.regexpCode)(T):c.code.formats?(0,kt._)`${c.code.formats}${(0,kt.getProperty)(i)}`:void 0,J=r.scopeValue("formats",{key:i,ref:T,code:F});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,kt._)`${J}.validate`]:["string",T,J]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,kt._)`await ${v}(${n})`}return typeof _=="function"?(0,kt._)`${v}(${n})`:(0,kt._)`${v}.test(${n})`}}}};mT.default=Cte});var fU=P(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});var Rte=pU(),Nte=[Rte.default];hT.default=Nte});var mU=P(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.contentVocabulary=Nl.metadataVocabulary=void 0;Nl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Nl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var gU=P(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});var zte=$L(),Mte=jL(),jte=dU(),Dte=fU(),hU=mU(),Lte=[zte.default,Mte.default,(0,jte.default)(),Dte.default,hU.metadataVocabulary,hU.contentVocabulary];gT.default=Lte});var yU=P(Tb=>{"use strict";Object.defineProperty(Tb,"__esModule",{value:!0});Tb.DiscrError=void 0;var _U;(function(t){t.Tag="tag",t.Mapping="mapping"})(_U||(Tb.DiscrError=_U={}))});var bU=P(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});var zl=Oe(),_T=yU(),vU=cb(),Ute=qf(),Fte=Be(),Bte={message:({params:{discrError:t,tagName:e}})=>t===_T.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,zl._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},Zte={keyword:"discriminator",type:"object",schemaType:"object",error:Bte,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:i}=t,{oneOf:s}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,zl._)`${r}${(0,zl.getProperty)(a)}`);e.if((0,zl._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:_T.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,zl._)`${u} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:_T.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(h,zl.Name),m}function f(){var p;let m={},h=v(o),_=!0;for(let k=0;k{qte.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var bT=P((lt,vT)=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.MissingRefError=lt.ValidationError=lt.CodeGen=lt.Name=lt.nil=lt.stringify=lt.str=lt._=lt.KeywordCxt=lt.Ajv=void 0;var Vte=_L(),Gte=gU(),Kte=bU(),xU=wU(),Hte=["/properties"],Eb="http://json-schema.org/draft-07/schema",Ml=class extends Vte.default{_addVocabularies(){super._addVocabularies(),Gte.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Kte.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(xU,Hte):xU;this.addMetaSchema(e,Eb,!1),this.refs["http://json-schema.org/schema"]=Eb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Eb)?Eb:void 0)}};lt.Ajv=Ml;vT.exports=lt=Ml;vT.exports.Ajv=Ml;Object.defineProperty(lt,"__esModule",{value:!0});lt.default=Ml;var Wte=Zf();Object.defineProperty(lt,"KeywordCxt",{enumerable:!0,get:function(){return Wte.KeywordCxt}});var jl=Oe();Object.defineProperty(lt,"_",{enumerable:!0,get:function(){return jl._}});Object.defineProperty(lt,"str",{enumerable:!0,get:function(){return jl.str}});Object.defineProperty(lt,"stringify",{enumerable:!0,get:function(){return jl.stringify}});Object.defineProperty(lt,"nil",{enumerable:!0,get:function(){return jl.nil}});Object.defineProperty(lt,"Name",{enumerable:!0,get:function(){return jl.Name}});Object.defineProperty(lt,"CodeGen",{enumerable:!0,get:function(){return jl.CodeGen}});var Jte=sb();Object.defineProperty(lt,"ValidationError",{enumerable:!0,get:function(){return Jte.default}});var Xte=qf();Object.defineProperty(lt,"MissingRefError",{enumerable:!0,get:function(){return Xte.default}})});var OU=P(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.formatNames=Ro.fastFormats=Ro.fullFormats=void 0;function Co(t,e){return{validate:t,compare:e}}Ro.fullFormats={date:Co(kU,IT),time:Co(xT(!0),ST),"date-time":Co($U(!0),EU),"iso-time":Co(xT(),TU),"iso-date-time":Co($U(),AU),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:nre,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:lre,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:ore,int32:{type:"number",validate:are},int64:{type:"number",validate:cre},float:{type:"number",validate:SU},double:{type:"number",validate:SU},password:!0,binary:!0};Ro.fastFormats={...Ro.fullFormats,date:Co(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,IT),time:Co(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ST),"date-time":Co(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,EU),"iso-time":Co(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,TU),"iso-date-time":Co(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,AU),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Ro.formatNames=Object.keys(Ro.fullFormats);function Yte(t){return t%4===0&&(t%100!==0||t%400===0)}var Qte=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,ere=[0,31,28,31,30,31,30,31,31,30,31,30,31];function kU(t){let e=Qte.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&Yte(r)?29:ere[n])}function IT(t,e){if(t&&e)return t>e?1:t23||l>59||t&&!a)return!1;if(o<=23&&i<=59&&s<60)return!0;let d=i-l*c,f=o-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&s<61}}function ST(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function TU(t,e){if(!(t&&e))return;let r=wT.exec(t),n=wT.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t=ire}function cre(t){return Number.isInteger(t)}function SU(){return!0}var ure=/[^\\]\\Z/;function lre(t){if(ure.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var PU=P(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.formatLimitDefinition=void 0;var dre=bT(),to=Oe(),Is=to.operators,Ab={formatMaximum:{okStr:"<=",ok:Is.LTE,fail:Is.GT},formatMinimum:{okStr:">=",ok:Is.GTE,fail:Is.LT},formatExclusiveMaximum:{okStr:"<",ok:Is.LT,fail:Is.GTE},formatExclusiveMinimum:{okStr:">",ok:Is.GT,fail:Is.LTE}},pre={message:({keyword:t,schemaCode:e})=>(0,to.str)`should be ${Ab[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,to._)`{comparison: ${Ab[t].okStr}, limit: ${e}}`};Dl.formatLimitDefinition={keyword:Object.keys(Ab),type:"string",schemaType:"string",$data:!0,error:pre,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:i}=t,{opts:s,self:a}=i;if(!s.validateFormats)return;let c=new dre.KeywordCxt(i,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),p=e.const("fmt",(0,to._)`${f}[${c.schemaCode}]`);t.fail$data((0,to.or)((0,to._)`typeof ${p} != "object"`,(0,to._)`${p} instanceof RegExp`,(0,to._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${f}" does not define "compare" function`);let m=e.scopeValue("formats",{key:f,ref:p,code:s.code.formats?(0,to._)`${s.code.formats}${(0,to.getProperty)(f)}`:void 0});t.fail$data(d(m))}function d(f){return(0,to._)`${f}.compare(${r}, ${n}) ${Ab[o].fail} 0`}},dependencies:["format"]};var fre=t=>(t.addKeyword(Dl.formatLimitDefinition),t);Dl.default=fre});var zU=P((om,NU)=>{"use strict";Object.defineProperty(om,"__esModule",{value:!0});var Ll=OU(),mre=PU(),kT=Oe(),CU=new kT.Name("fullFormats"),hre=new kT.Name("fastFormats"),TT=(t,e={keywords:!0})=>{if(Array.isArray(e))return RU(t,e,Ll.fullFormats,CU),t;let[r,n]=e.mode==="fast"?[Ll.fastFormats,hre]:[Ll.fullFormats,CU],o=e.formats||Ll.formatNames;return RU(t,o,r,n),e.keywords&&(0,mre.default)(t),t};TT.get=(t,e="full")=>{let n=(e==="fast"?Ll.fastFormats:Ll.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function RU(t,e,r,n){var o,i;(o=(i=t.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,kT._)`require("ajv-formats/dist/formats").${n}`);for(let s of e)t.addFormat(s,r[s])}NU.exports=om=TT;Object.defineProperty(om,"__esModule",{value:!0});om.default=TT});var Mb={PRETTY:4,COMPACT:0};var Ke={TRACE:6,DEBUG:8,INFO:12,WARN:16,ERROR:20,CRITICAL:24,SILENT:28},OT=["level","message","sampling_rate","service","timestamp"],PT="Uncaught error detected, flushing log buffer before exit";var ql={REQUEST_ID:Symbol.for("_AWS_LAMBDA_REQUEST_ID"),X_RAY_TRACE_ID:Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),TENANT_ID:Symbol.for("_AWS_LAMBDA_TENANT_ID")},jb=["true","1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??"");jb||(globalThis.awslambda=globalThis.awslambda||{});var sm=class{static PROTECTED_KEYS=ql;isProtectedKey(e){return Object.values(ql).includes(e)}getRequestId(){return this.get(ql.REQUEST_ID)??"-"}getXRayTraceId(){return this.get(ql.X_RAY_TRACE_ID)}getTenantId(){return this.get(ql.TENANT_ID)}},Db=class extends sm{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==void 0}get(e){return this.currentContext?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);this.currentContext=this.currentContext||{},this.currentContext[e]=r}run(e,r){this.currentContext=e;try{return r()}finally{this.currentContext=void 0}}},Lb=class t extends sm{als;static async create(){let e=new t,r=await import("node:async_hooks");return e.als=new r.AsyncLocalStorage,e}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==void 0}get(e){return this.als.getStore()?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);let n=this.als.getStore();if(!n)throw new Error("No context available");n[e]=r}run(e,r){return this.als.run(e,r)}},CT;(function(t){let e=null;async function r(){return e||(e=(async()=>{let o="AWS_LAMBDA_MAX_CONCURRENCY"in process.env?await Lb.create():new Db;return!jb&&globalThis.awslambda?.InvokeStore?globalThis.awslambda.InvokeStore:(!jb&&globalThis.awslambda&&(globalThis.awslambda.InvokeStore=o),o)})()),e}t.getInstanceAsync=r,t._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE==="1"?{reset:()=>{e=null,globalThis.awslambda?.InvokeStore&&delete globalThis.awslambda.InvokeStore,globalThis.awslambda={}}}:void 0})(CT||(CT={}));var RT="AWS_LAMBDA_MAX_CONCURRENCY",NT="POWERTOOLS_DEV";var zT="_X_AMZN_TRACE_ID";var Vr=({key:t,defaultValue:e,errorMessage:r})=>{let n=process.env[t];if(n===void 0){if(e!==void 0)return e;throw r?new Error(r):new Error(`Environment variable ${t} is required`)}return n.trim()},MT=({key:t,defaultValue:e,errorMessage:r})=>{let n=Vr({key:t,defaultValue:String(e),errorMessage:r}),o=Number(n);if(Number.isNaN(o))throw new TypeError(`Environment variable ${t} must be a number`);return o},KU=new Set(["1","y","yes","t","true","on"]),HU=new Set(["0","n","no","f","false","off"]),Ub=({key:t,defaultValue:e,errorMessage:r,extendedParsing:n})=>{let i=Vr({key:t,defaultValue:String(e),errorMessage:r}).toLowerCase();if(n){if(KU.has(i))return!0;if(HU.has(i))return!1}if(i!=="true"&&i!=="false")throw new Error(`Environment variable ${t} must be a boolean`);return i==="true"},Vl=()=>{try{return Ub({key:NT,extendedParsing:!0})}catch{return!1}};var WU=()=>{let t=globalThis.awslambda?.InvokeStore?.getXRayTraceId()??Vr({key:zT,defaultValue:""});if(t==="")return;if(!t.includes("="))return{Root:t};let e={};for(let r of t.split(";")){let[n,o]=r.split("=");e[n]=o}return e};var am=()=>Vr({key:RT,defaultValue:""})!=="",Gl=()=>WU()?.Root;var Es=class{formatError(e){let{name:r,message:n,stack:o,cause:i,...s}=e,a={name:r,location:this.getCodeLocation(e.stack),message:n,stack:Vl()&&typeof o=="string"?o?.split(` +`):o,cause:i instanceof Error?this.formatError(i):i};for(let c in e)typeof c=="string"&&!["name","message","stack","cause"].includes(c)&&(a[c]=s[c]);return a}formatTimestamp(e){let n=Vr({key:"TZ",defaultValue:""});return n&&!n.includes("UTC")?this.#r(e,n):e.toISOString()}getCodeLocation(e){if(!e)return"";let r=e.split(` +`),n=/\(([^()]*?):(\d+?):(\d+?)\)\\?$/;for(let o of r){let i=n.exec(o);if(Array.isArray(i))return`${i[1]}:${Number(i[2])}`}return""}#e=e=>{let r="2-digit",n=Intl.supportedValuesOf("timeZone").includes(e)?e:"UTC";return new Intl.DateTimeFormat("en",{hourCycle:"h23",year:"numeric",month:r,day:r,hour:r,minute:r,second:r,timeZone:n})};#r(e,r){let{year:n,month:o,day:i,hour:s,minute:a,second:c}=this.#e(r).formatToParts(e).reduce((_,v)=>(_[v.type]=v.value,_),{}),u=`${n}-${o}-${i}T${s}:${a}:${c}`,l=-e.getTimezoneOffset(),d=l>=0?"+":"-",f=Math.abs(Math.floor(l/60)).toString().padStart(2,"0"),p=Math.abs(l%60).toString().padStart(2,"0"),m=e.getMilliseconds().toString().padStart(3,"0"),h=`${d}${f}:${p}`;return`${u}.${m}${h}`}};var dE=mn(Xb(),1),_i=class{attributes={};constructor(e){this.setAttributes(e.attributes)}addAttributes(e){return(0,dE.default)(this.attributes,e),this}getAttributes(){return this.attributes}prepareForPrint(){this.attributes=this.removeEmptyKeys(this.getAttributes())}removeEmptyKeys(e){let r={};for(let n in e)e[n]!==void 0&&e[n]!==""&&e[n]!==null&&(r[n]=e[n]);return r}setAttributes(e){this.attributes=e}};import{Console as B2}from"node:console";import{randomInt as Z2}from"node:crypto";var Yl="2.29.0";var Rre=process.env.AWS_EXECUTION_ENV||"NA";var gm="powertools-for-aws",pE=`${gm}.tracer`,fE=`${gm}.metrics`,mE=`${gm}.logger`,hE=`${gm}.idempotency`;var Yb=t=>typeof t=="string";var gE=t=>Object.is(t,null),Qb=t=>gE(t)||Object.is(t,void 0);var Ql=class{#e;coldStart=!0;defaultServiceName="service_undefined";constructor(){this.#e=this.getInitializationType(),this.#e!=="on-demand"&&(this.coldStart=!1)}getInitializationType(){let e=process.env.AWS_LAMBDA_INITIALIZATION_TYPE?.trim();return e==="on-demand"?"on-demand":e==="provisioned-concurrency"?"provisioned-concurrency":"unknown"}getColdStart(){return this.#e!=="on-demand"?!1:this.coldStart?(this.coldStart=!1,!0):!1}isValidServiceName(e){return typeof e=="string"&&e.trim().length>0}};var _E=process.env.AWS_EXECUTION_ENV||"NA";process.env.AWS_SDK_UA_APP_ID?process.env.AWS_SDK_UA_APP_ID=`${process.env.AWS_SDK_UA_APP_ID}/PT/NO-OP/${Yl}/PTEnv/${_E}`:process.env.AWS_SDK_UA_APP_ID=`PT/NO-OP/${Yl}/PTEnv/${_E}`;var bm=mn(Xb(),1);var _m=class extends Es{#e;constructor(e){super(),this.#e=e?.logRecordOrder}formatAttributes(e,r){let n={level:e.logLevel,message:e.message,timestamp:this.formatTimestamp(e.timestamp),service:e.serviceName,cold_start:e.lambdaContext?.coldStart,function_arn:e.lambdaContext?.invokedFunctionArn,function_memory_size:e.lambdaContext?.memoryLimitInMB,function_name:e.lambdaContext?.functionName,function_request_id:e.lambdaContext?.awsRequestId,sampling_rate:e.sampleRateValue,xray_trace_id:e.xRayTraceId};if(this.#e===void 0)return new _i({attributes:n}).addAttributes(r);let o={};for(let s of this.#e)s in n&&!(s in o)?o[s]=n[s]:s in r&&!(s in o)&&(o[s]=r[s]);for(let s in n)s in o||(o[s]=n[s]);for(let s in r)s in o||(o[s]=r[s]);return new _i({attributes:o})}};var ym=class{#e=Symbol("powertools.logger.temporaryAttributes");#r=Symbol("powertools.logger.keys");#i={};#c=new Map;#n={};#o(){if(!am())return this.#i;if(globalThis.awslambda?.InvokeStore===void 0)throw new Error("InvokeStore is not available");let e=globalThis.awslambda.InvokeStore,r=e.get(this.#e);return r==null&&(r={},e.set(this.#e,r)),r}#t(){if(!am())return this.#c;if(globalThis.awslambda?.InvokeStore===void 0)throw new Error("InvokeStore is not available");let e=globalThis.awslambda.InvokeStore,r=e.get(this.#r);return r==null&&(r=new Map,e.set(this.#r,r)),r}appendTemporaryKeys(e){let r=this.#o(),n=this.#t();for(let[o,i]of Object.entries(e))r[o]=i,n.set(o,"temp")}removeTemporaryKeys(e){let r=this.#o(),n=this.#t();for(let o of e)r[o]=void 0,this.#n[o]?n.set(o,"persistent"):n.delete(o)}getTemporaryAttributes(){return{...this.#o()}}clearTemporaryAttributes(){let e=this.#o(),r=this.#t();for(let n of Object.keys(e))this.#n[n]?r.set(n,"persistent"):r.delete(n);if(!am()){this.#i={};return}globalThis.awslambda.InvokeStore?.set(this.#e,{})}setPersistentAttributes(e){let r=this.#t();this.#n={...e};for(let n of Object.keys(e))r.set(n,"persistent")}getPersistentAttributes(){return{...this.#n}}getAllAttributes(){let e={},r=this.#o(),n=this.#t();for(let[o,i]of Object.entries(this.#n))i!==void 0&&(e[o]=i);for(let[o,i]of n.entries())i==="temp"&&r[o]!==void 0&&(e[o]=r[o]);return e}removePersistentKeys(e){let r=this.#t(),n=this.#o();for(let o of e)this.#n[o]=void 0,n[o]?r.set(o,"temp"):r.delete(o)}};var ew=class{value;logLevel;byteSize;constructor(e,r){if(!Yb(e))throw new Error("Value should be a string");this.value=e,this.logLevel=r,this.byteSize=Buffer.byteLength(e)}},tw=class extends Set{currentBytesSize=0;hasEvictedLog=!1;add(e){return this.currentBytesSize+=e.byteSize,super.add(e),this}delete(e){let r=super.delete(e);return r&&(this.currentBytesSize-=e.byteSize),r}clear(){super.clear(),this.currentBytesSize=0}shift(){let e=this.values().next().value;return e&&this.delete(e),e}},vm=class extends Map{#e;#r;constructor({maxBytesSize:e,onBufferOverflow:r}){super(),this.#e=e,this.#r=r}setItem(e,r,n){let o=new ew(r,n);if(o.byteSize>this.#e)throw new Error("Item too big");let i=this.get(e)||new tw;return i.currentBytesSize!==0&&i.currentBytesSize+o.byteSize>=this.#e&&(this.#i(i,o),this.#r&&this.#r()),i.add(o),super.set(e,i),this}#i(e,r){for(;e.size!==0&&e.currentBytesSize+r.byteSize>=this.#e;)e.shift(),e.hasEvictedLog=!0}};var ed=class t extends Ql{console;customConfigService;logEvent=!1;logFormatter;logIndentation=Mb.COMPACT;logLevel=Ke.INFO;#e;powertoolsLogData={sampleRateValue:0};#r=new ym;#i=[];#c=!1;#n=Ke.INFO;#o;#t={enabled:!1,flushOnErrorLog:!0,maxBytes:20480,bufferAtVerbosity:Ke.DEBUG};#s;#u;#a={sampleRateValue:0,refreshedTimes:0};#p=new Map;get level(){return this.logLevel}constructor(e={}){super();let{customConfigService:r,...n}=e;this.customConfigService=r||void 0,this.setOptions(n),this.#c=!0;for(let[o,i]of this.#i)this.printLog(o,this.createAndPopulateLogItem(...i));this.#i=[]}addContext(e){this.addToPowertoolsLogData({lambdaContext:{invokedFunctionArn:e.invokedFunctionArn,coldStart:this.getColdStart(),awsRequestId:e.awsRequestId,memoryLimitInMB:e.memoryLimitInMB,functionName:e.functionName,functionVersion:e.functionVersion}})}addPersistentLogAttributes(e){this.appendPersistentKeys(e)}appendKeys(e){this.#m(e,"temp")}appendPersistentKeys(e){this.#m(e,"persistent")}createChild(e={}){let r="persistentLogAttributes"in e&&!("persistentKeys"in e)?"persistentLogAttributes":"persistentKeys",n=this.createLogger((0,bm.default)({},{logLevel:this.getLevelName(),serviceName:this.powertoolsLogData.serviceName,sampleRateValue:this.#a.sampleRateValue,logFormatter:this.getLogFormatter(),customConfigService:this.getCustomConfigService(),environment:this.powertoolsLogData.environment,[r]:this.#r.getPersistentAttributes(),jsonReplacerFn:this.#o,correlationIdSearchFn:this.#u,...this.#t.enabled&&{logBufferOptions:{maxBytes:this.#t.maxBytes,bufferAtVerbosity:this.getLogLevelNameFromNumber(this.#t.bufferAtVerbosity),flushOnErrorLog:this.#t.flushOnErrorLog}}},e));this.powertoolsLogData.lambdaContext&&n.addContext(this.powertoolsLogData.lambdaContext);let o=this.#r.getTemporaryAttributes();return Object.keys(o).length>0&&n.appendKeys(o),n}critical(e,...r){this.processLogItem(Ke.CRITICAL,e,r)}debug(e,...r){this.processLogItem(Ke.DEBUG,e,r)}error(e,...r){this.#t.enabled&&this.#t.flushOnErrorLog&&this.flushBuffer(),this.processLogItem(Ke.ERROR,e,r)}getLevelName(){return this.getLogLevelNameFromNumber(this.logLevel)}getLogEvent(){return this.logEvent}getPersistentLogAttributes(){return this.#r.getPersistentAttributes()}info(e,...r){this.processLogItem(Ke.INFO,e,r)}injectLambdaContext(e){return(r,n,o)=>{let i=o.value,s=this;o.value=async function(...a){s.refreshSampleRateCalculation(),s.addContext(a[1]),s.logEventIfEnabled(a[0],e?.logEvent),e?.correlationIdPath&&s.setCorrelationId(a[0],e?.correlationIdPath);try{return await i.apply(this,a)}catch(c){throw e?.flushBufferOnUncaughtError&&(s.flushBuffer(),s.error({message:PT,error:c})),c}finally{(e?.clearState||e?.resetKeys)&&s.resetKeys(),s.clearBuffer()}}}}static injectLambdaContextAfterOrOnError(e,r,n){n&&(n.clearState||n?.resetKeys)&&e.resetKeys()}static injectLambdaContextBefore(e,r,n,o){e.addContext(n),e.logEventIfEnabled(r,o?.logEvent)}logEventIfEnabled(e,r){this.shouldLogEvent(r)&&this.info("Lambda invocation event",{event:e})}refreshSampleRateCalculation(){if(this.#a.refreshedTimes===0){this.#a.refreshedTimes++;return}this.#h()&&this.logLevel>Ke.TRACE?(this.setLogLevel("DEBUG"),this.debug("Setting log level to DEBUG due to sampling rate")):this.setLogLevel(this.getLogLevelNameFromNumber(this.#n))}removeKeys(e){this.#r.removeTemporaryKeys(e)}removePersistentKeys(e){this.#r.removePersistentKeys(e)}removePersistentLogAttributes(e){this.removePersistentKeys(e)}resetKeys(){this.#r.clearTemporaryAttributes()}setLogLevel(e){if(!this.awsLogLevelShortCircuit(e))if(this.isValidLogLevel(e))this.logLevel=Ke[e];else throw new Error(`Invalid log level: ${e}`)}setPersistentLogAttributes(e){let r=this.#f(e);this.#r.setPersistentAttributes(r)}get persistentLogAttributes(){return this.#r.getPersistentAttributes()}shouldLogEvent(e){return typeof e=="boolean"?e:this.getLogEvent()}trace(e,...r){this.processLogItem(Ke.TRACE,e,r)}warn(e,...r){this.processLogItem(Ke.WARN,e,r)}#l(e){this.#p.has(e)||(this.#p.set(e,!0),this.warn(e))}createLogger(e){return new t(e)}getJsonReplacer(){let e=new WeakSet;return(r,n)=>{let o=n;if(this.#o&&(o=this.#o?.(r,o)),o instanceof Error&&(o=this.getLogFormatter().formatError(o)),typeof o=="bigint")return o.toString();if(typeof o=="object"&&o!==null){if(e.has(o))return;e.add(o)}return o}}addToPowertoolsLogData(e){(0,bm.default)(this.powertoolsLogData,e)}#f(e){let r={};for(let[n,o]of Object.entries(e))this.#d(n)||(r[n]=o);return r}#m(e,r){let n=this.#f(e);if(r==="temp")this.#r.appendTemporaryKeys(n);else{let o=this.#r.getPersistentAttributes();this.#r.setPersistentAttributes((0,bm.default)(o,n))}}awsLogLevelShortCircuit(e){return this.#e!==void 0?(this.logLevel=Ke[this.#e],this.isValidLogLevel(e)&&this.logLevel>Ke[e]&&this.#l(`Current log level (${e}) does not match AWS Lambda Advanced Logging Controls minimum log level (${this.#e}). This can lead to data loss, consider adjusting them.`),!0):!1}createAndPopulateLogItem(e,r,n){let o={logLevel:this.getLogLevelNameFromNumber(e),timestamp:new Date,xRayTraceId:Gl(),...this.getPowertoolsLogData(),message:""},i=this.#r.getAllAttributes();return this.#g(r,o,i),this.#_(n,i),this.getLogFormatter().formatAttributes(o,i)}#g(e,r,n){if(typeof e=="string"){r.message=e;return}let{message:o,...i}=e;r.message=o;for(let[s,a]of Object.entries(i))this.#d(s)||(n[s]=a)}#_(e,r){for(let n of e)Qb(n)||(n instanceof Error?r.error=n:typeof n=="string"?r.extra=n:this.#y(n,r))}#y(e,r){for(let[n,o]of Object.entries(e))this.#d(n)||(r[n]=o)}#h(){return this.#a.sampleRateValue&&Z2(0,100)/100<=this.#a.sampleRateValue}#d(e){return OT.includes(e)?(this.warn(`The key "${e}" is a reserved key and will be dropped.`),!0):!1}getCustomConfigService(){return this.customConfigService}getLogFormatter(){return this.logFormatter}getLogLevelNameFromNumber(e){let r;for(let[n,o]of Object.entries(Ke))if(o===e){r=n;break}return r}getPowertoolsLogData(){return this.powertoolsLogData}isValidLogLevel(e){return typeof e=="string"&&e in Ke}isValidSampleRate(e){return typeof e=="number"&&0<=e&&e<=1}printLog(e,r){r.prepareForPrint();let n=e===Ke.CRITICAL?"error":this.getLogLevelNameFromNumber(e).toLowerCase();this.console[n](JSON.stringify(r.getAttributes(),this.getJsonReplacer(),this.logIndentation))}processLogItem(e,r,n){let o=Gl();if(o!==void 0&&this.shouldBufferLog(o,e)){try{this.bufferLogItem(o,this.createAndPopulateLogItem(e,r,n),e)}catch(i){this.printLog(Ke.WARN,this.createAndPopulateLogItem(Ke.WARN,`Unable to buffer log: ${i.message}`,[i])),this.printLog(e,this.createAndPopulateLogItem(e,r,n))}return}e>=this.logLevel&&(this.#c?this.printLog(e,this.createAndPopulateLogItem(e,r,n)):this.#i.push([e,[e,r,n]]))}setConsole(){Vl()?this.console=console:this.console=new B2({stdout:process.stdout,stderr:process.stderr}),this.console.trace=(e,...r)=>{this.console.log(e,...r)}}setInitialLogLevel(e){let r=e?.toUpperCase();if(this.awsLogLevelShortCircuit(r)){this.#n=this.logLevel;return}if(this.isValidLogLevel(r)){this.logLevel=Ke[r],this.#n=this.logLevel;return}let n=this.getCustomConfigService()?.getLogLevel()?.toUpperCase();if(this.isValidLogLevel(n)){this.logLevel=Ke[n],this.#n=this.logLevel;return}let o=Vr({key:"POWERTOOLS_LOG_LEVEL",defaultValue:""}),i=Vr({key:"LOG_LEVEL",defaultValue:""}),s=o!==""?o:i;this.isValidLogLevel(s)&&(this.logLevel=Ke[s],this.#n=this.logLevel)}setInitialSampleRate(e){let r=e,n=this.getCustomConfigService()?.getSampleRateValue(),o=MT({key:"POWERTOOLS_LOGGER_SAMPLE_RATE",defaultValue:0});for(let i of[r,n,o])if(this.isValidSampleRate(i)){this.#a.sampleRateValue=i,this.powertoolsLogData.sampleRateValue=i,this.#h()&&this.logLevel>Ke.TRACE&&(this.setLogLevel("DEBUG"),this.debug("Setting log level to DEBUG due to sampling rate"));break}}setLogEvent(){this.logEvent=Ub({key:"POWERTOOLS_LOGGER_LOG_EVENT",defaultValue:!1})}setLogFormatter(e,r){this.logFormatter=e??new _m({logRecordOrder:r})}setLogIndentation(){Vl()&&(this.logIndentation=Mb.PRETTY)}setOptions(e){let{logLevel:r,serviceName:n,sampleRateValue:o,logFormatter:i,persistentKeys:s,persistentLogAttributes:a,environment:c,jsonReplacerFn:u,logRecordOrder:l,logBufferOptions:d,correlationIdSearchFn:f}=e;a&&Object.keys(a).length>0&&s&&Object.keys(s).length>0&&this.warn("Both persistentLogAttributes and persistentKeys options were provided. Using persistentKeys as persistentLogAttributes is deprecated and will be removed in future releases"),this.setPowertoolsLogData(n,c,s||a);let p=Vr({key:"AWS_LAMBDA_LOG_LEVEL",defaultValue:""}),m=p==="FATAL"?"CRITICAL":p;return this.isValidLogLevel(m)&&(this.#e=m),this.setLogEvent(),this.setInitialLogLevel(r),this.setInitialSampleRate(o),this.setLogFormatter(i,l),this.setConsole(),this.setLogIndentation(),this.#o=u,this.#v(d),this.#u=f,this}setPowertoolsLogData(e,r,n){this.addToPowertoolsLogData({awsRegion:Vr({key:"AWS_REGION",defaultValue:""}),environment:r||this.getCustomConfigService()?.getCurrentEnvironment()||Vr({key:"ENVIRONMENT",defaultValue:""}),serviceName:e||this.getCustomConfigService()?.getServiceName()||Vr({key:"POWERTOOLS_SERVICE_NAME",defaultValue:""})||this.defaultServiceName}),n&&this.appendPersistentKeys(n)}#v(e){if(e===void 0||(this.#t.enabled=e?.enabled!==!1,this.#t.enabled===!1))return;e?.maxBytes!==void 0&&(this.#t.maxBytes=e.maxBytes),this.#s=new vm({maxBytesSize:this.#t.maxBytes}),e?.flushOnErrorLog===!1&&(this.#t.flushOnErrorLog=!1);let r=e?.bufferAtVerbosity?.toUpperCase();this.isValidLogLevel(r)&&(this.#t.bufferAtVerbosity=Ke[r]),this.#e!==void 0&&Ke[this.#e]>this.#t.bufferAtVerbosity&&this.#l("Advanced Loggging Controls (ALC) Log Level is less verbose than Log Buffering Log Level. Buffered logs will be filtered by ALC")}bufferLogItem(e,r,n){r.prepareForPrint(),this.#s?.has(e)===!1&&this.#s?.clear(),this.#s?.setItem(e,JSON.stringify(r.getAttributes(),this.getJsonReplacer(),this.logIndentation),n)}flushBuffer(){let e=Gl();if(e===void 0)return;let r=this.#s?.get(e);if(r!==void 0){for(let n of r){let o=this.getLogLevelNameFromNumber(n.logLevel).toLowerCase();this.console[o](n.value)}r.hasEvictedLog&&this.printLog(Ke.WARN,this.createAndPopulateLogItem(Ke.WARN,"Some logs are not displayed because they were evicted from the buffer. Increase buffer size to store more logs in the buffer",[])),this.#e!==void 0&&Ke[this.#e]>this.#t.bufferAtVerbosity&&this.#l("Advanced Loggging Controls (ALC) Log Level is less verbose than Log Buffering Log Level. Some logs might be missing."),this.#s?.delete(e)}}clearBuffer(){let e=Gl();e!==void 0&&this.#s?.delete(e)}shouldBufferLog(e,r){return this.#t.enabled&&e!==void 0&&r<=this.#t.bufferAtVerbosity}setCorrelationId(e,r){if(typeof r=="string"){if(!this.#u){this.#l("correlationIdPath is set but no search function was provided. The correlation ID will not be added to the log attributes.");return}let n=this.#u(r,e);n&&this.appendKeys({correlation_id:n});return}this.appendKeys({correlation_id:e})}getCorrelationId(){return this.#r.getTemporaryAttributes().correlation_id}};var rw=class extends Es{formatAttributes(e,r){let n={logLevel:e.logLevel,timestamp:this.formatTimestamp(e.timestamp),message:e.message},o=new _i({attributes:n});return o.addAttributes(r),o}},wm=new ed({logFormatter:new rw});function ce(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function S(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var nw=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return nw=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function td(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var rd=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var V=class extends Error{},Pt=class t extends V{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("x-request-id"),this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new yi({message:n,cause:rd(r)});let i=r?.error;return e===400?new fc(e,i,n,o):e===401?new mc(e,i,n,o):e===403?new hc(e,i,n,o):e===404?new gc(e,i,n,o):e===409?new _c(e,i,n,o):e===422?new yc(e,i,n,o):e===429?new vc(e,i,n,o):e>=500?new bc(e,i,n,o):new t(e,i,n,o)}},xt=class extends Pt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},yi=class extends Pt{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Do=class extends yi{constructor({message:e}={}){super({message:e??"Request timed out."})}},fc=class extends Pt{},mc=class extends Pt{},hc=class extends Pt{},gc=class extends Pt{},_c=class extends Pt{},yc=class extends Pt{},vc=class extends Pt{},bc=class extends Pt{},wc=class extends V{constructor(){super("Could not parse response content as the length limit was reached")}},xc=class extends V{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},ro=class extends Error{constructor(e){super(e)}};var V2=/^[a-z][a-z0-9+.-]*:/i,yE=t=>V2.test(t),Qt=t=>(Qt=Array.isArray,Qt(t)),ow=Qt;function iw(t){return typeof t!="object"?{}:t??{}}function vE(t){if(!t)return!0;for(let e in t)return!1;return!0}function bE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function nd(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var wE=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new V(`${t} must be an integer`);if(e<0)throw new V(`${t} must be a positive integer`);return e};var xE=t=>{try{return JSON.parse(t)}catch{return}};var no=t=>new Promise(e=>setTimeout(e,t));var vi="6.10.0";var kE=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function G2(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var K2=()=>{let t=G2();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":IE(Deno.build.os),"X-Stainless-Arch":$E(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":IE(globalThis.process.platform??"unknown"),"X-Stainless-Arch":$E(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=H2();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function H2(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,s=n[3]||0;return{browser:e,version:`${o}.${i}.${s}`}}}return null}var $E=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",IE=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),SE,TE=()=>SE??(SE=K2());function EE(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function sw(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function xm(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return sw({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function aw(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function AE(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var OE=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var $m="RFC3986",cw=t=>String(t),Im={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:cw},uw="RFC1738";var Sm=(t,e)=>(Sm=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Sm(t,e)),oo=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var lw=1024,PE=(t,e,r,n,o)=>{if(t.length===0)return t;let i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a=lw?i.slice(a,a+lw):i,u=[];for(let l=0;l=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===uw&&(d===40||d===41)){u[u.length]=c.charAt(l);continue}if(d<128){u[u.length]=oo[d];continue}if(d<2048){u[u.length]=oo[192|d>>6]+oo[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=oo[224|d>>12]+oo[128|d>>6&63]+oo[128|d&63];continue}l+=1,d=65536+((d&1023)<<10|c.charCodeAt(l)&1023),u[u.length]=oo[240|d>>18]+oo[128|d>>12&63]+oo[128|d>>6&63]+oo[128|d&63]}s+=u.join("")}return s};function CE(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function dw(t,e){if(Qt(t)){let r=[];for(let n=0;n"u"&&(k=0)}if(typeof u=="function"?b=u(e,b):b instanceof Date?b=f?.(b):r==="comma"&&Qt(b)&&(b=dw(b,function(oe){return oe instanceof Date?f?.(oe):oe})),b===null){if(i)return c&&!h?c(e,Ct.encoder,_,"key",p):e;b=""}if(X2(b)||CE(b)){if(c){let oe=h?e:c(e,Ct.encoder,_,"key",p);return[m?.(oe)+"="+m?.(c(b,Ct.encoder,_,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let F=[];if(typeof b>"u")return F;let J;if(r==="comma"&&Qt(b))h&&c&&(b=dw(b,c)),J=[{value:b.length>0?b.join(",")||null:void 0}];else if(Qt(u))J=u;else{let oe=Object.keys(b);J=l?oe.sort(l):oe}let w=a?String(e).replace(/\./g,"%2E"):String(e),Z=n&&Qt(b)&&b.length===1?w+"[]":w;if(o&&Qt(b)&&b.length===0)return Z+"[]";for(let oe=0;oe"u"?t.encodeDotInKeys?!0:Ct.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Ct.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Ct.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Ct.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Ct.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Ct.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Ct.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Ct.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Ct.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Ct.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Ct.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Ct.strictNullHandling}}function fw(t,e={}){let r=t,n=Y2(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Qt(n.filter)&&(i=n.filter,o=i);let s=[];if(typeof r!="object"||r===null)return"";let a=NE[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);let u=new WeakMap;for(let f=0;f0?d+l:""}function LE(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}var jE;function $c(t){let e;return(jE??(e=new globalThis.TextEncoder,jE=e.encode.bind(e)))(t)}var DE;function mw(t){let e;return(DE??(e=new globalThis.TextDecoder,DE=e.decode.bind(e)))(t)}var Gr,Kr,Cs=class{constructor(){Gr.set(this,void 0),Kr.set(this,void 0),ce(this,Gr,new Uint8Array,"f"),ce(this,Kr,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?$c(e):e;ce(this,Gr,LE([S(this,Gr,"f"),r]),"f");let n=[],o;for(;(o=eF(S(this,Gr,"f"),S(this,Kr,"f")))!=null;){if(o.carriage&&S(this,Kr,"f")==null){ce(this,Kr,o.index,"f");continue}if(S(this,Kr,"f")!=null&&(o.index!==S(this,Kr,"f")+1||o.carriage)){n.push(mw(S(this,Gr,"f").subarray(0,S(this,Kr,"f")-1))),ce(this,Gr,S(this,Gr,"f").subarray(S(this,Kr,"f")),"f"),ce(this,Kr,null,"f");continue}let i=S(this,Kr,"f")!==null?o.preceding-1:o.preceding,s=mw(S(this,Gr,"f").subarray(0,i));n.push(s),ce(this,Gr,S(this,Gr,"f").subarray(o.index),"f"),ce(this,Kr,null,"f")}return n}flush(){return S(this,Gr,"f").length?this.decode(` +`):[]}};Gr=new WeakMap,Kr=new WeakMap;Cs.NEWLINE_CHARS=new Set([` +`,"\r"]);Cs.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function eF(t,e){for(let o=e??0;o{if(t){if(bE(Tm,t))return t;$t(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Tm))}`)}};function od(){}function km(t,e,r){return!e||Tm[t]>Tm[r]?od:e[t].bind(e)}var tF={error:od,warn:od,info:od,debug:od},FE=new WeakMap;function $t(t){let e=t.logger,r=t.logLevel??"off";if(!e)return tF;let n=FE.get(e);if(n&&n[0]===r)return n[1];let o={error:km("error",e,r),warn:km("warn",e,r),info:km("info",e,r),debug:km("debug",e,r)};return FE.set(e,[r,o]),o}var Lo=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var id,io=class t{constructor(e,r,n){this.iterator=e,id.set(this,void 0),this.controller=r,ce(this,id,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?$t(n):console;async function*s(){if(o)throw new V("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let c of rF(e,r))if(!a){if(c.data.startsWith("[DONE]")){a=!0;continue}if(c.event===null||!c.event.startsWith("thread.")){let u;try{u=JSON.parse(c.data)}catch(l){throw i.error("Could not parse message into JSON:",c.data),i.error("From chunk:",c.raw),l}if(u&&u.error)throw new Pt(void 0,u.error,void 0,e.headers);yield u}else{let u;try{u=JSON.parse(c.data)}catch(l){throw console.error("Could not parse message into JSON:",c.data),console.error("From chunk:",c.raw),l}if(c.event=="error")throw new Pt(void 0,u.error,u.message,void 0);yield{event:c.event,data:u}}}a=!0}catch(c){if(td(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*i(){let a=new Cs,c=aw(e);for await(let u of c)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*s(){if(o)throw new V("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let c of i())a||c&&(yield JSON.parse(c));a=!0}catch(c){if(td(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}[(id=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let s=n.next();e.push(s),r.push(s)}return i.shift()}});return[new t(()=>o(e),this.controller,S(this,id,"f")),new t(()=>o(r),this.controller,S(this,id,"f"))]}toReadableStream(){let e=this,r;return sw({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:i}=await r.next();if(i)return n.close();let s=$c(JSON.stringify(o)+` +`);n.enqueue(s)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};async function*rF(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new V("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new V("Attempted to iterate over a response with no body");let r=new gw,n=new Cs,o=aw(t.body);for await(let i of nF(o))for(let s of n.decode(i)){let a=r.decode(s);a&&(yield a)}for(let i of n.flush()){let s=r.decode(i);s&&(yield s)}}async function*nF(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?$c(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=UE(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var gw=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(` +`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=oF(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function oF(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function Em(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,s=await(async()=>{if(e.options.stream)return $t(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):io.fromSSEResponse(r,e.controller,t);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let c=r.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){let d=await r.json();return _w(d,r)}return await r.text()})();return $t(t).debug(`[${n}] response parsed`,Lo({retryOfRequestLogID:o,url:r.url,status:r.status,body:s,durationMs:Date.now()-i})),s}function _w(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var sd,Rs=class t extends Promise{constructor(e,r,n=Em){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,sd.set(this,void 0),ce(this,sd,e,"f")}_thenUnwrap(e){return new t(S(this,sd,"f"),this.responsePromise,async(r,n)=>_w(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(S(this,sd,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};sd=new WeakMap;var Am,ad=class{constructor(e,r,n,o){Am.set(this,void 0),ce(this,Am,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new V("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await S(this,Am,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Am=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},cd=class extends Rs{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await Em(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},so=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},ke=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),r=e[e.length-1]?.id;return r?{...this.options,query:{...iw(this.options.query),after:r}}:null}},Uo=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1,this.last_id=n.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.last_id;return e?{...this.options,query:{...iw(this.options.query),after:e}}:null}};var bw=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Ic(t,e,r){return bw(),new File(t,e??"unknown_file",r)}function ud(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}var Om=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",ww=async(t,e)=>yw(t.body)?{...t,body:await ZE(t.body,e)}:t,Hr=async(t,e)=>({...t,body:await ZE(t.body,e)}),BE=new WeakMap;function sF(t){let e=typeof t=="function"?t:t.fetch,r=BE.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new o(i).text()}catch{return!0}})();return BE.set(e,n),n}var ZE=async(t,e)=>{if(!await sF(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>vw(r,n,o))),r},qE=t=>t instanceof Blob&&"name"in t,aF=t=>typeof t=="object"&&t!==null&&(t instanceof Response||Om(t)||qE(t)),yw=t=>{if(aF(t))return!0;if(Array.isArray(t))return t.some(yw);if(t&&typeof t=="object"){for(let e in t)if(yw(t[e]))return!0}return!1},vw=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response)t.append(e,Ic([await r.blob()],ud(r)));else if(Om(r))t.append(e,Ic([await new Response(xm(r)).blob()],ud(r)));else if(qE(r))t.append(e,r,ud(r));else if(Array.isArray(r))await Promise.all(r.map(n=>vw(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>vw(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var VE=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",cF=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&VE(t),uF=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";async function ld(t,e,r){if(bw(),t=await t,cF(t))return t instanceof File?t:Ic([await t.arrayBuffer()],t.name);if(uF(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),Ic(await xw(o),e,r)}let n=await xw(t);if(e||(e=ud(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return Ic(n,e,r)}async function xw(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(VE(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(Om(t))for await(let r of t)e.push(...await xw(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${lF(t)}`)}return e}function lF(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var C=class{constructor(e){this._client=e}};function KE(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var GE=Object.freeze(Object.create(null)),pF=(t=KE)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],s=r.reduce((l,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=n[f],m=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??GE)??GE)?.toString)&&(m=p+"",i.push({start:l.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),l+d+(f===n.length?"":m)},""),a=s.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,u;for(;(u=c.exec(a))!==null;)i.push({start:u.index,length:u[0].length,error:`Value "${u[0]}" can't be safely passed as a path parameter`});if(i.sort((l,d)=>l.start-d.start),i.length>0){let l=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-l),h="^".repeat(p.length);return l=p.start+p.length,f+m+h},"");throw new V(`Path parameters result in path with invalid segments: +${i.map(f=>f.error).join(` +`)} +${s} +${d}`)}return s},O=pF(KE);var Ns=class extends C{list(e,r={},n){return this._client.getAPIList(O`/chat/completions/${e}/messages`,ke,{query:r,...n})}};function dd(t){return t!==void 0&&"function"in t&&t.function!==void 0}function pd(t){return t?.$brand==="auto-parseable-response-format"}function zs(t){return t?.$brand==="auto-parseable-tool"}function HE(t,e){return!e||!$w(e)?{...t,choices:t.choices.map(r=>(JE(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:fd(t,e)}function fd(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new wc;if(n.finish_reason==="content_filter")throw new xc;return JE(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>gF(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?hF(e,n.message.content):null}}});return{...t,choices:r}}function hF(t,e){return t.response_format?.type!=="json_schema"?null:t.response_format?.type==="json_schema"?"$parseRaw"in t.response_format?t.response_format.$parseRaw(e):JSON.parse(e):null}function gF(t,e){let r=t.tools?.find(n=>dd(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:zs(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function WE(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>dd(n)&&n.function?.name===e.function.name);return dd(r)&&(zs(r)||r?.function.strict||!1)}function $w(t){return pd(t.response_format)?!0:t.tools?.some(e=>zs(e)||e.type==="function"&&e.function.strict===!0)??!1}function JE(t){for(let e of t||[])if(e.type!=="function")throw new V(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function XE(t){for(let e of t??[]){if(e.type!=="function")throw new V(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new V(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Sc=t=>t?.role==="assistant",Iw=t=>t?.role==="tool";var Sw,Pm,Cm,md,hd,Rm,gd,Fo,_d,Nm,zm,kc,YE,bi=class{constructor(){Sw.add(this),this.controller=new AbortController,Pm.set(this,void 0),Cm.set(this,()=>{}),md.set(this,()=>{}),hd.set(this,void 0),Rm.set(this,()=>{}),gd.set(this,()=>{}),Fo.set(this,{}),_d.set(this,!1),Nm.set(this,!1),zm.set(this,!1),kc.set(this,!1),ce(this,Pm,new Promise((e,r)=>{ce(this,Cm,e,"f"),ce(this,md,r,"f")}),"f"),ce(this,hd,new Promise((e,r)=>{ce(this,Rm,e,"f"),ce(this,gd,r,"f")}),"f"),S(this,Pm,"f").catch(()=>{}),S(this,hd,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},S(this,Sw,"m",YE).bind(this))},0)}_connected(){this.ended||(S(this,Cm,"f").call(this),this._emit("connect"))}get ended(){return S(this,_d,"f")}get errored(){return S(this,Nm,"f")}get aborted(){return S(this,zm,"f")}abort(){this.controller.abort()}on(e,r){return(S(this,Fo,"f")[e]||(S(this,Fo,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=S(this,Fo,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(S(this,Fo,"f")[e]||(S(this,Fo,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ce(this,kc,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ce(this,kc,!0,"f"),await S(this,hd,"f")}_emit(e,...r){if(S(this,_d,"f"))return;e==="end"&&(ce(this,_d,!0,"f"),S(this,Rm,"f").call(this));let n=S(this,Fo,"f")[e];if(n&&(S(this,Fo,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!S(this,kc,"f")&&!n?.length&&Promise.reject(o),S(this,md,"f").call(this,o),S(this,gd,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!S(this,kc,"f")&&!n?.length&&Promise.reject(o),S(this,md,"f").call(this,o),S(this,gd,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Pm=new WeakMap,Cm=new WeakMap,md=new WeakMap,hd=new WeakMap,Rm=new WeakMap,gd=new WeakMap,Fo=new WeakMap,_d=new WeakMap,Nm=new WeakMap,zm=new WeakMap,kc=new WeakMap,Sw=new WeakSet,YE=function(e){if(ce(this,Nm,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new xt),e instanceof xt)return ce(this,zm,!0,"f"),this._emit("abort",e);if(e instanceof V)return this._emit("error",e);if(e instanceof Error){let r=new V(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new V(String(e)))};function QE(t){return typeof t.parse=="function"}var pr,kw,Mm,Tw,Ew,Aw,eA,tA,_F=10,Tc=class extends bi{constructor(){super(...arguments),pr.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let r=e.choices[0]?.message;return r&&this._addMessage(r),e}_addMessage(e,r=!0){if("content"in e||(e.content=null),this.messages.push(e),r){if(this._emit("message",e),Iw(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(Sc(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionToolCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new V("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),S(this,pr,"m",kw).call(this)}async finalMessage(){return await this.done(),S(this,pr,"m",Mm).call(this)}async finalFunctionToolCall(){return await this.done(),S(this,pr,"m",Tw).call(this)}async finalFunctionToolCallResult(){return await this.done(),S(this,pr,"m",Ew).call(this)}async totalUsage(){return await this.done(),S(this,pr,"m",Aw).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=S(this,pr,"m",Mm).call(this);r&&this._emit("finalMessage",r);let n=S(this,pr,"m",kw).call(this);n&&this._emit("finalContent",n);let o=S(this,pr,"m",Tw).call(this);o&&this._emit("finalFunctionToolCall",o);let i=S(this,pr,"m",Ew).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(s=>s.usage)&&this._emit("totalUsage",S(this,pr,"m",Aw).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,pr,"m",eA).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(fd(i,r))}async _runChatCompletion(e,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,r,n)}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:s,...a}=r,c=typeof i!="string"&&i.type==="function"&&i?.function?.name,{maxChatCompletions:u=_F}=n||{},l=r.tools.map(p=>{if(zs(p)){if(!p.$callback)throw new V("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of l)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?l.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;pJSON.stringify(Z)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:v,content:w});continue}let T;try{T=QE(k)?await k.parse(x):x}catch(w){let Z=w instanceof Error?w.message:String(w);this._addMessage({role:o,tool_call_id:v,content:Z});continue}let F=await k.function(T,this),J=S(this,pr,"m",tA).call(this,F);if(this._addMessage({role:o,tool_call_id:v,content:J}),c)return}}}};pr=new WeakSet,kw=function(){return S(this,pr,"m",Mm).call(this).content??null},Mm=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(Sc(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new V("stream ended without producing a ChatCompletionMessage with role=assistant")},Tw=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Sc(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},Ew=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Iw(r)&&r.content!=null&&typeof r.content=="string"&&this.messages.some(n=>n.role==="assistant"&&n.tool_calls?.some(o=>o.type==="function"&&o.id===r.tool_call_id)))return r.content}},Aw=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:r}of this._chatCompletions)r&&(e.completion_tokens+=r.completion_tokens,e.prompt_tokens+=r.prompt_tokens,e.total_tokens+=r.total_tokens);return e},eA=function(e){if(e.n!=null&&e.n>1)throw new V("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},tA=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};var yd=class t extends Tc{static runTools(e,r,n){let o=new t,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}_addMessage(e,r=!0){super._addMessage(e,r),Sc(e)&&e.content&&this._emit("content",e.content)}};var Mt={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511},Ow=class extends Error{},Pw=class extends Error{};function yF(t,e=Mt.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return vF(t.trim(),e)}var vF=(t,e)=>{let r=t.length,n=0,o=f=>{throw new Ow(`${f} at position ${n}`)},i=f=>{throw new Pw(`${f} at position ${n}`)},s=()=>(d(),n>=r&&o("Unexpected end of input"),t[n]==='"'?a():t[n]==="{"?c():t[n]==="["?u():t.substring(n,n+4)==="null"||Mt.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Mt.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Mt.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Mt.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Mt.MINUS_INFINITY&e&&1{let f=n,p=!1;for(n++;n{n++,d();let f={};try{for(;t[n]!=="}";){if(d(),n>=r&&Mt.OBJ&e)return f;let p=a();d(),n++;try{let m=s();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(Mt.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Mt.OBJ&e)return f;o("Expected '}' at end of object")}return n++,f},u=()=>{n++;let f=[];try{for(;t[n]!=="]";)f.push(s()),d(),t[n]===","&&n++}catch{if(Mt.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},l=()=>{if(n===0){t==="-"&&Mt.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Mt.NUM&e)try{return t[t.length-1]==="."?JSON.parse(t.substring(0,t.lastIndexOf("."))):JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch{}i(String(p))}}let f=n;for(t[n]==="-"&&n++;t[n]&&!",]}".includes(t[n]);)n++;n==r&&!(Mt.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Mt.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;nyF(t,Mt.ALL^Mt.NUM);var Rt,Bo,Ec,wi,Rw,jm,Nw,zw,Mw,Dm,jw,rA,Ms=class t extends Tc{constructor(e){super(),Rt.add(this),Bo.set(this,void 0),Ec.set(this,void 0),wi.set(this,void 0),ce(this,Bo,e,"f"),ce(this,Ec,[],"f")}get currentChatCompletionSnapshot(){return S(this,wi,"f")}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createChatCompletion(e,r,n){let o=new t(r);return o._run(()=>o._runChatCompletion(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(e,r,n){super._createChatCompletion;let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,Rt,"m",Rw).call(this);let i=await e.chat.completions.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let s of i)S(this,Rt,"m",Nw).call(this,s);if(i.controller.signal?.aborted)throw new xt;return this._addChatCompletion(S(this,Rt,"m",Dm).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),S(this,Rt,"m",Rw).call(this),this._connected();let o=io.fromReadableStream(e,this.controller),i;for await(let s of o)i&&i!==s.id&&this._addChatCompletion(S(this,Rt,"m",Dm).call(this)),S(this,Rt,"m",Nw).call(this,s),i=s.id;if(o.controller.signal?.aborted)throw new xt;return this._addChatCompletion(S(this,Rt,"m",Dm).call(this))}[(Bo=new WeakMap,Ec=new WeakMap,wi=new WeakMap,Rt=new WeakSet,Rw=function(){this.ended||ce(this,wi,void 0,"f")},jm=function(r){let n=S(this,Ec,"f")[r.index];return n||(n={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},S(this,Ec,"f")[r.index]=n,n)},Nw=function(r){if(this.ended)return;let n=S(this,Rt,"m",rA).call(this,r);this._emit("chunk",r,n);for(let o of r.choices){let i=n.choices[o.index];o.delta.content!=null&&i.message?.role==="assistant"&&i.message?.content&&(this._emit("content",o.delta.content,i.message.content),this._emit("content.delta",{delta:o.delta.content,snapshot:i.message.content,parsed:i.message.parsed})),o.delta.refusal!=null&&i.message?.role==="assistant"&&i.message?.refusal&&this._emit("refusal.delta",{delta:o.delta.refusal,snapshot:i.message.refusal}),o.logprobs?.content!=null&&i.message?.role==="assistant"&&this._emit("logprobs.content.delta",{content:o.logprobs?.content,snapshot:i.logprobs?.content??[]}),o.logprobs?.refusal!=null&&i.message?.role==="assistant"&&this._emit("logprobs.refusal.delta",{refusal:o.logprobs?.refusal,snapshot:i.logprobs?.refusal??[]});let s=S(this,Rt,"m",jm).call(this,i);i.finish_reason&&(S(this,Rt,"m",Mw).call(this,i),s.current_tool_call_index!=null&&S(this,Rt,"m",zw).call(this,i,s.current_tool_call_index));for(let a of o.delta.tool_calls??[])s.current_tool_call_index!==a.index&&(S(this,Rt,"m",Mw).call(this,i),s.current_tool_call_index!=null&&S(this,Rt,"m",zw).call(this,i,s.current_tool_call_index)),s.current_tool_call_index=a.index;for(let a of o.delta.tool_calls??[]){let c=i.message.tool_calls?.[a.index];c?.type&&(c?.type==="function"?this._emit("tool_calls.function.arguments.delta",{name:c.function?.name,index:a.index,arguments:c.function.arguments,parsed_arguments:c.function.parsed_arguments,arguments_delta:a.function?.arguments??""}):(c?.type,void 0))}}},zw=function(r,n){if(S(this,Rt,"m",jm).call(this,r).done_tool_calls.has(n))return;let i=r.message.tool_calls?.[n];if(!i)throw new Error("no tool call snapshot");if(!i.type)throw new Error("tool call snapshot missing `type`");if(i.type==="function"){let s=S(this,Bo,"f")?.tools?.find(a=>dd(a)&&a.function.name===i.function.name);this._emit("tool_calls.function.arguments.done",{name:i.function.name,index:n,arguments:i.function.arguments,parsed_arguments:zs(s)?s.$parseRaw(i.function.arguments):s?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Mw=function(r){let n=S(this,Rt,"m",jm).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=S(this,Rt,"m",jw).call(this);this._emit("content.done",{content:r.message.content,parsed:o?o.$parseRaw(r.message.content):null})}r.message.refusal&&!n.refusal_done&&(n.refusal_done=!0,this._emit("refusal.done",{refusal:r.message.refusal})),r.logprobs?.content&&!n.logprobs_content_done&&(n.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:r.logprobs.content})),r.logprobs?.refusal&&!n.logprobs_refusal_done&&(n.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:r.logprobs.refusal}))},Dm=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");let r=S(this,wi,"f");if(!r)throw new V("request ended without sending any chunks");return ce(this,wi,void 0,"f"),ce(this,Ec,[],"f"),bF(r,S(this,Bo,"f"))},jw=function(){let r=S(this,Bo,"f")?.response_format;return pd(r)?r:null},rA=function(r){var n,o,i,s;let a=S(this,wi,"f"),{choices:c,...u}=r;a?Object.assign(a,u):a=ce(this,wi,{...u,choices:[]},"f");for(let{delta:l,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=a.choices[f];if(h||(h=a.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:F,refusal:J,...w}=p;Object.assign(h.logprobs,w),F&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...F)),J&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...J))}if(d&&(h.finish_reason=d,S(this,Bo,"f")&&$w(S(this,Bo,"f")))){if(d==="length")throw new wc;if(d==="content_filter")throw new xc}if(Object.assign(h,m),!l)continue;let{content:_,refusal:v,function_call:b,role:x,tool_calls:k,...T}=l;if(Object.assign(h.message,T),v&&(h.message.refusal=(h.message.refusal||"")+v),x&&(h.message.role=x),b&&(h.message.function_call?(b.name&&(h.message.function_call.name=b.name),b.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=b.arguments)):h.message.function_call=b),_&&(h.message.content=(h.message.content||"")+_,!h.message.refusal&&S(this,Rt,"m",jw).call(this)&&(h.message.parsed=Cw(h.message.content))),k){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:F,id:J,type:w,function:Z,...oe}of k){let Q=(s=h.message.tool_calls)[F]??(s[F]={});Object.assign(Q,oe),J&&(Q.id=J),w&&(Q.type=w),Z&&(Q.function??(Q.function={name:Z.name??"",arguments:""})),Z?.name&&(Q.function.name=Z.name),Z?.arguments&&(Q.function.arguments+=Z.arguments,WE(S(this,Bo,"f"),Q)&&(Q.function.parsed_arguments=Cw(Q.function.arguments)))}}}return a},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("chunk",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new io(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function bF(t,e){let{id:r,choices:n,created:o,model:i,system_fingerprint:s,...a}=t,c={...a,id:r,choices:n.map(({message:u,finish_reason:l,index:d,logprobs:f,...p})=>{if(!l)throw new V(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:_,...v}=u,b=u.role;if(!b)throw new V(`missing role for choice ${d}`);if(h){let{arguments:x,name:k}=h;if(x==null)throw new V(`missing function_call.arguments for choice ${d}`);if(!k)throw new V(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:x,name:k},role:b,refusal:u.refusal??null},finish_reason:l,index:d,logprobs:f}}return _?{...p,index:d,finish_reason:l,logprobs:f,message:{...v,role:b,content:m,refusal:u.refusal??null,tool_calls:_.map((x,k)=>{let{function:T,type:F,id:J,...w}=x,{arguments:Z,name:oe,...Q}=T||{};if(J==null)throw new V(`missing choices[${d}].tool_calls[${k}].id +${Lm(t)}`);if(F==null)throw new V(`missing choices[${d}].tool_calls[${k}].type +${Lm(t)}`);if(oe==null)throw new V(`missing choices[${d}].tool_calls[${k}].function.name +${Lm(t)}`);if(Z==null)throw new V(`missing choices[${d}].tool_calls[${k}].function.arguments +${Lm(t)}`);return{...w,id:J,type:F,function:{...Q,name:oe,arguments:Z}}})}}:{...p,message:{...v,content:m,role:b,refusal:u.refusal??null},finish_reason:l,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...s?{system_fingerprint:s}:{}};return HE(c,e)}function Lm(t){return JSON.stringify(t)}var vd=class t extends Ms{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runTools(e,r,n){let o=new t(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}};var Zo=class extends C{constructor(){super(...arguments),this.messages=new Ns(this._client)}create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1})}retrieve(e,r){return this._client.get(O`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(O`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/chat/completions/${e}`,r)}parse(e,r){return XE(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>fd(n,e))}runTools(e,r){return e.stream?vd.runTools(this._client,e,r):yd.runTools(this._client,e,r)}stream(e,r){return Ms.createChatCompletion(this._client,e,r)}};Zo.Messages=Ns;var xi=class extends C{constructor(){super(...arguments),this.completions=new Zo(this._client)}};xi.Completions=Zo;var nA=Symbol("brand.privateNullableHeaders");function*xF(t){if(!t)return;if(nA in t){let{values:n,nulls:o}=t;yield*n.entries();for(let i of o)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():ow(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=ow(n[1])?n[1]:[n[1]],s=!1;for(let a of i)a!==void 0&&(e&&!s&&(s=!0,yield[o,null]),yield[o,a])}}var L=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,s]of xF(n)){let a=i.toLowerCase();o.has(a)||(e.delete(i),o.add(a)),s===null?(e.delete(i),r.add(a)):(e.append(i,s),r.delete(a))}}return{[nA]:!0,values:e,nulls:r}};var Ac=class extends C{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:L([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}};var Oc=class extends C{create(e,r){return this._client.post("/audio/transcriptions",Hr({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}};var Pc=class extends C{create(e,r){return this._client.post("/audio/translations",Hr({body:e,...r,__metadata:{model:e.model}},this._client))}};var ao=class extends C{constructor(){super(...arguments),this.transcriptions=new Oc(this._client),this.translations=new Pc(this._client),this.speech=new Ac(this._client)}};ao.Transcriptions=Oc;ao.Translations=Pc;ao.Speech=Ac;var js=class extends C{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(O`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",ke,{query:e,...r})}cancel(e,r){return this._client.post(O`/batches/${e}/cancel`,r)}};var Cc=class extends C{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/assistants/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/assistants/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",ke,{query:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(O`/assistants/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var Rc=class extends C{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var Nc=class extends C{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var $i=class extends C{constructor(){super(...arguments),this.sessions=new Rc(this._client),this.transcriptionSessions=new Nc(this._client)}};$i.Sessions=Rc;$i.TranscriptionSessions=Nc;var zc=class extends C{create(e,r){return this._client.post("/chatkit/sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}cancel(e,r){return this._client.post(O`/chatkit/sessions/${e}/cancel`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}};var Mc=class extends C{retrieve(e,r){return this._client.get(O`/chatkit/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}list(e={},r){return this._client.getAPIList("/chatkit/threads",Uo,{query:e,...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}delete(e,r){return this._client.delete(O`/chatkit/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}listItems(e,r={},n){return this._client.getAPIList(O`/chatkit/threads/${e}/items`,Uo,{query:r,...n,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers])})}};var Ii=class extends C{constructor(){super(...arguments),this.sessions=new zc(this._client),this.threads=new Mc(this._client)}};Ii.Sessions=zc;Ii.Threads=Mc;var jc=class extends C{create(e,r,n){return this._client.post(O`/threads/${e}/messages`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(O`/threads/${o}/messages/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/messages/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/threads/${e}/messages`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(O`/threads/${o}/messages/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var Dc=class extends C{retrieve(e,r,n){let{thread_id:o,run_id:i,...s}=r;return this._client.get(O`/threads/${o}/runs/${i}/steps/${e}`,{query:s,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r,n){let{thread_id:o,...i}=r;return this._client.getAPIList(O`/threads/${o}/runs/${e}/steps`,ke,{query:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var oA=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()};var Zt,Ls,Dw,co,Um,Nn,Us,Lc,Ds,Zm,Wr,Fm,Bm,xd,bd,wd,iA,sA,aA,cA,uA,lA,dA,qo=class extends bi{constructor(){super(...arguments),Zt.add(this),Dw.set(this,[]),co.set(this,{}),Um.set(this,{}),Nn.set(this,void 0),Us.set(this,void 0),Lc.set(this,void 0),Ds.set(this,void 0),Zm.set(this,void 0),Wr.set(this,void 0),Fm.set(this,void 0),Bm.set(this,void 0),xd.set(this,void 0)}[(Dw=new WeakMap,co=new WeakMap,Um=new WeakMap,Nn=new WeakMap,Us=new WeakMap,Lc=new WeakMap,Ds=new WeakMap,Zm=new WeakMap,Wr=new WeakMap,Fm=new WeakMap,Bm=new WeakMap,xd=new WeakMap,Zt=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new Ls;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=io.fromReadableStream(e,this.controller);for await(let i of o)S(this,Zt,"m",bd).call(this,i);if(o.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}toReadableStream(){return new io(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new Ls;return i._run(()=>i._runToolAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...n,stream:!0},a=await e.submitToolOutputs(r,s,{...o,signal:this.controller.signal});this._connected();for await(let c of a)S(this,Zt,"m",bd).call(this,c);if(a.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}static createThreadAssistantStream(e,r,n){let o=new Ls;return o._run(()=>o._threadAssistantStream(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,r,n,o){let i=new Ls;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return S(this,Fm,"f")}currentRun(){return S(this,Bm,"f")}currentMessageSnapshot(){return S(this,Nn,"f")}currentRunStepSnapshot(){return S(this,xd,"f")}async finalRunSteps(){return await this.done(),Object.values(S(this,co,"f"))}async finalMessages(){return await this.done(),Object.values(S(this,Um,"f"))}async finalRun(){if(await this.done(),!S(this,Us,"f"))throw Error("Final run was not received.");return S(this,Us,"f")}async _createThreadAssistantStream(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));let i={...r,stream:!0},s=await e.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let a of s)S(this,Zt,"m",bd).call(this,a);if(s.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}async _createAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...n,stream:!0},a=await e.create(r,s,{...o,signal:this.controller.signal});this._connected();for await(let c of a)S(this,Zt,"m",bd).call(this,c);if(a.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}static accumulateDelta(e,r){for(let[n,o]of Object.entries(r)){if(!e.hasOwnProperty(n)){e[n]=o;continue}let i=e[n];if(i==null){e[n]=o;continue}if(n==="index"||n==="type"){e[n]=o;continue}if(typeof i=="string"&&typeof o=="string")i+=o;else if(typeof i=="number"&&typeof o=="number")i+=o;else if(nd(i)&&nd(o))i=this.accumulateDelta(i,o);else if(Array.isArray(i)&&Array.isArray(o)){if(i.every(s=>typeof s=="string"||typeof s=="number")){i.push(...o);continue}for(let s of o){if(!nd(s))throw new Error(`Expected array delta entry to be an object but got: ${s}`);let a=s.index;if(a==null)throw console.error(s),new Error("Expected array delta entry to have an `index` property");if(typeof a!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${a}`);let c=i[a];c==null?i.push(s):i[a]=this.accumulateDelta(c,s)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${o}, accValue: ${i}`);e[n]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,r,n){return await this._createThreadAssistantStream(r,e,n)}async _runAssistantStream(e,r,n,o){return await this._createAssistantStream(r,e,n,o)}async _runToolAssistantStream(e,r,n,o){return await this._createToolAssistantStream(r,e,n,o)}};Ls=qo,bd=function(e){if(!this.ended)switch(ce(this,Fm,e,"f"),S(this,Zt,"m",aA).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":S(this,Zt,"m",dA).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":S(this,Zt,"m",sA).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":S(this,Zt,"m",iA).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},wd=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");if(!S(this,Us,"f"))throw Error("Final run has not been received");return S(this,Us,"f")},iA=function(e){let[r,n]=S(this,Zt,"m",uA).call(this,e,S(this,Nn,"f"));ce(this,Nn,r,"f"),S(this,Um,"f")[r.id]=r;for(let o of n){let i=r.content[o.index];i?.type=="text"&&this._emit("textCreated",i.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,r),e.data.delta.content)for(let o of e.data.delta.content){if(o.type=="text"&&o.text){let i=o.text,s=r.content[o.index];if(s&&s.type=="text")this._emit("textDelta",i,s.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(o.index!=S(this,Lc,"f")){if(S(this,Ds,"f"))switch(S(this,Ds,"f").type){case"text":this._emit("textDone",S(this,Ds,"f").text,S(this,Nn,"f"));break;case"image_file":this._emit("imageFileDone",S(this,Ds,"f").image_file,S(this,Nn,"f"));break}ce(this,Lc,o.index,"f")}ce(this,Ds,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(S(this,Lc,"f")!==void 0){let o=e.data.content[S(this,Lc,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,S(this,Nn,"f"));break;case"text":this._emit("textDone",o.text,S(this,Nn,"f"));break}}S(this,Nn,"f")&&this._emit("messageDone",e.data),ce(this,Nn,void 0,"f")}},sA=function(e){let r=S(this,Zt,"m",cA).call(this,e);switch(ce(this,xd,r,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let n=e.data.delta;if(n.step_details&&n.step_details.type=="tool_calls"&&n.step_details.tool_calls&&r.step_details.type=="tool_calls")for(let i of n.step_details.tool_calls)i.index==S(this,Zm,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(S(this,Wr,"f")&&this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Zm,i.index,"f"),ce(this,Wr,r.step_details.tool_calls[i.index],"f"),S(this,Wr,"f")&&this._emit("toolCallCreated",S(this,Wr,"f")));this._emit("runStepDelta",e.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":ce(this,xd,void 0,"f"),e.data.step_details.type=="tool_calls"&&S(this,Wr,"f")&&(this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Wr,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},aA=function(e){S(this,Dw,"f").push(e),this._emit("event",e)},cA=function(e){switch(e.event){case"thread.run.step.created":return S(this,co,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=S(this,co,"f")[e.data.id];if(!r)throw Error("Received a RunStepDelta before creation of a snapshot");let n=e.data;if(n.delta){let o=Ls.accumulateDelta(r,n.delta);S(this,co,"f")[e.data.id]=o}return S(this,co,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":S(this,co,"f")[e.data.id]=e.data;break}if(S(this,co,"f")[e.data.id])return S(this,co,"f")[e.data.id];throw new Error("No snapshot available")},uA=function(e,r){let n=[];switch(e.event){case"thread.message.created":return[e.data,n];case"thread.message.delta":if(!r)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let o=e.data;if(o.delta.content)for(let i of o.delta.content)if(i.index in r.content){let s=r.content[i.index];r.content[i.index]=S(this,Zt,"m",lA).call(this,i,s)}else r.content[i.index]=i,n.push(i);return[r,n];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(r)return[r,n];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},lA=function(e,r){return Ls.accumulateDelta(r,e)},dA=function(e){switch(ce(this,Bm,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":ce(this,Us,e.data,"f"),S(this,Wr,"f")&&(this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Wr,void 0,"f"));break;case"thread.run.cancelling":break}};var Fs=class extends C{constructor(){super(...arguments),this.steps=new Dc(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(O`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(O`/threads/${o}/runs/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/runs/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/threads/${e}/runs`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(O`/threads/${o}/runs/${e}/cancel`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(o.id,{thread_id:e},n)}createAndStream(e,r,n){return qo.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(e,r,{...n,headers:{...n?.headers,...o}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return qo.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}async submitToolOutputsAndPoll(e,r,n){let o=await this.submitToolOutputs(e,r,n);return await this.poll(o.id,r,n)}submitToolOutputsStream(e,r,n){return qo.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};Fs.Steps=Dc;var ki=class extends C{constructor(){super(...arguments),this.runs=new Fs(this._client),this.messages=new jc(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/threads/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete(O`/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:e.stream??!1})}async createAndRunPoll(e,r){let n=await this.createAndRun(e,r);return await this.runs.poll(n.id,{thread_id:n.thread_id},r)}createAndRunStream(e,r){return qo.createThreadAssistantStream(e,this._client.beta.threads,r)}};ki.Runs=Fs;ki.Messages=jc;var zn=class extends C{constructor(){super(...arguments),this.realtime=new $i(this._client),this.chatkit=new Ii(this._client),this.assistants=new Cc(this._client),this.threads=new ki(this._client)}};zn.Realtime=$i;zn.ChatKit=Ii;zn.Assistants=Cc;zn.Threads=ki;var Bs=class extends C{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}};var Uc=class extends C{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(O`/containers/${o}/files/${e}/content`,{...n,headers:L([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}};var Zs=class extends C{constructor(){super(...arguments),this.content=new Uc(this._client)}create(e,r,n){return this._client.post(O`/containers/${e}/files`,Hr({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(O`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList(O`/containers/${e}/files`,ke,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(O`/containers/${o}/files/${e}`,{...n,headers:L([{Accept:"*/*"},n?.headers])})}};Zs.Content=Uc;var Ti=class extends C{constructor(){super(...arguments),this.files=new Zs(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get(O`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/containers/${e}`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}};Ti.Files=Zs;var Fc=class extends C{create(e,r,n){let{include:o,...i}=r;return this._client.post(O`/conversations/${e}/items`,{query:{include:o},body:i,...n})}retrieve(e,r,n){let{conversation_id:o,...i}=r;return this._client.get(O`/conversations/${o}/items/${e}`,{query:i,...n})}list(e,r={},n){return this._client.getAPIList(O`/conversations/${e}/items`,Uo,{query:r,...n})}delete(e,r,n){let{conversation_id:o}=r;return this._client.delete(O`/conversations/${o}/items/${e}`,n)}};var Ei=class extends C{constructor(){super(...arguments),this.items=new Fc(this._client)}create(e={},r){return this._client.post("/conversations",{body:e,...r})}retrieve(e,r){return this._client.get(O`/conversations/${e}`,r)}update(e,r,n){return this._client.post(O`/conversations/${e}`,{body:r,...n})}delete(e,r){return this._client.delete(O`/conversations/${e}`,r)}};Ei.Items=Fc;var qs=class extends C{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&$t(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:($t(this._client).debug("embeddings/decoding base64 embeddings from base64"),i._thenUnwrap(s=>(s&&s.data&&s.data.forEach(a=>{let c=a.embedding;a.embedding=oA(c)}),s)))}};var Bc=class extends C{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get(O`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList(O`/evals/${o}/runs/${e}/output_items`,ke,{query:i,...n})}};var Vs=class extends C{constructor(){super(...arguments),this.outputItems=new Bc(this._client)}create(e,r,n){return this._client.post(O`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(O`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList(O`/evals/${e}/runs`,ke,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(O`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(O`/evals/${o}/runs/${e}`,n)}};Vs.OutputItems=Bc;var Ai=class extends C{constructor(){super(...arguments),this.runs=new Vs(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(O`/evals/${e}`,r)}update(e,r,n){return this._client.post(O`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/evals/${e}`,r)}};Ai.Runs=Vs;var Gs=class extends C{create(e,r){return this._client.post("/files",Hr({body:e,...r},this._client))}retrieve(e,r){return this._client.get(O`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/files/${e}`,r)}content(e,r){return this._client.get(O`/files/${e}/content`,{...r,headers:L([{Accept:"application/binary"},r?.headers]),__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:n=1800*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),s=await this.retrieve(e);for(;!s.status||!o.has(s.status);)if(await no(r),s=await this.retrieve(e),Date.now()-i>n)throw new Do({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return s}};var Zc=class extends C{};var qc=class extends C{run(e,r){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...r})}validate(e,r){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...r})}};var Ks=class extends C{constructor(){super(...arguments),this.graders=new qc(this._client)}};Ks.Graders=qc;var Vc=class extends C{create(e,r,n){return this._client.getAPIList(O`/fine_tuning/checkpoints/${e}/permissions`,so,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get(O`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(O`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}};var Hs=class extends C{constructor(){super(...arguments),this.permissions=new Vc(this._client)}};Hs.Permissions=Vc;var Gc=class extends C{list(e,r={},n){return this._client.getAPIList(O`/fine_tuning/jobs/${e}/checkpoints`,ke,{query:r,...n})}};var Ws=class extends C{constructor(){super(...arguments),this.checkpoints=new Gc(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(O`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",ke,{query:e,...r})}cancel(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList(O`/fine_tuning/jobs/${e}/events`,ke,{query:r,...n})}pause(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/resume`,r)}};Ws.Checkpoints=Gc;var Mn=class extends C{constructor(){super(...arguments),this.methods=new Zc(this._client),this.jobs=new Ws(this._client),this.checkpoints=new Hs(this._client),this.alpha=new Ks(this._client)}};Mn.Methods=Zc;Mn.Jobs=Ws;Mn.Checkpoints=Hs;Mn.Alpha=Ks;var Kc=class extends C{};var Oi=class extends C{constructor(){super(...arguments),this.graderModels=new Kc(this._client)}};Oi.GraderModels=Kc;var Js=class extends C{createVariation(e,r){return this._client.post("/images/variations",Hr({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",Hr({body:e,...r,stream:e.stream??!1},this._client))}generate(e,r){return this._client.post("/images/generations",{body:e,...r,stream:e.stream??!1})}};var Xs=class extends C{retrieve(e,r){return this._client.get(O`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",so,e)}delete(e,r){return this._client.delete(O`/models/${e}`,r)}};var Ys=class extends C{create(e,r){return this._client.post("/moderations",{body:e,...r})}};var Hc=class extends C{accept(e,r,n){return this._client.post(O`/realtime/calls/${e}/accept`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}hangup(e,r){return this._client.post(O`/realtime/calls/${e}/hangup`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}refer(e,r,n){return this._client.post(O`/realtime/calls/${e}/refer`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}reject(e,r={},n){return this._client.post(O`/realtime/calls/${e}/reject`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}};var Wc=class extends C{create(e,r){return this._client.post("/realtime/client_secrets",{body:e,...r})}};var Vo=class extends C{constructor(){super(...arguments),this.clientSecrets=new Wc(this._client),this.calls=new Hc(this._client)}};Vo.ClientSecrets=Wc;Vo.Calls=Hc;function pA(t,e){return!e||!QF(e)?{...t,output_parsed:null,output:t.output.map(r=>r.type==="function_call"?{...r,parsed_arguments:null}:r.type==="message"?{...r,content:r.content.map(n=>({...n,parsed:null}))}:r)}:Lw(t,e)}function Lw(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:rB(e,o)};if(o.type==="message"){let i=o.content.map(s=>s.type==="output_text"?{...s,parsed:YF(e,s.text)}:s);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||qm(n),Object.defineProperty(n,"output_parsed",{enumerable:!0,get(){for(let o of n.output)if(o.type==="message"){for(let i of o.content)if(i.type==="output_text"&&i.parsed!==null)return i.parsed}return null}}),n}function YF(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function QF(t){return!!pd(t.text?.format)}function eB(t){return t?.$brand==="auto-parseable-tool"}function tB(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function rB(t,e){let r=tB(t.tools??[],e.name);return{...e,...e,parsed_arguments:eB(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function qm(t){let e=[];for(let r of t.output)if(r.type==="message")for(let n of r.content)n.type==="output_text"&&e.push(n.text);t.output_text=e.join("")}var Jc,Vm,Pi,Gm,fA,mA,hA,gA,Km=class t extends bi{constructor(e){super(),Jc.add(this),Vm.set(this,void 0),Pi.set(this,void 0),Gm.set(this,void 0),ce(this,Vm,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createOrRetrieveResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createOrRetrieveResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,Jc,"m",fA).call(this);let i,s=null;"response_id"in r?(i=await e.responses.retrieve(r.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),s=r.starting_after??null):i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(let a of i)S(this,Jc,"m",mA).call(this,a,s);if(i.controller.signal?.aborted)throw new xt;return S(this,Jc,"m",hA).call(this)}[(Vm=new WeakMap,Pi=new WeakMap,Gm=new WeakMap,Jc=new WeakSet,fA=function(){this.ended||ce(this,Pi,void 0,"f")},mA=function(r,n){if(this.ended)return;let o=(s,a)=>{(n==null||a.sequence_number>n)&&this._emit(s,a)},i=S(this,Jc,"m",gA).call(this,r);switch(o("event",r),r.type){case"response.output_text.delta":{let s=i.output[r.output_index];if(!s)throw new V(`missing output at index ${r.output_index}`);if(s.type==="message"){let a=s.content[r.content_index];if(!a)throw new V(`missing content at index ${r.content_index}`);if(a.type!=="output_text")throw new V(`expected content to be 'output_text', got ${a.type}`);o("response.output_text.delta",{...r,snapshot:a.text})}break}case"response.function_call_arguments.delta":{let s=i.output[r.output_index];if(!s)throw new V(`missing output at index ${r.output_index}`);s.type==="function_call"&&o("response.function_call_arguments.delta",{...r,snapshot:s.arguments});break}default:o(r.type,r);break}},hA=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");let r=S(this,Pi,"f");if(!r)throw new V("request ended without sending any events");ce(this,Pi,void 0,"f");let n=nB(r,S(this,Vm,"f"));return ce(this,Gm,n,"f"),n},gA=function(r){let n=S(this,Pi,"f");if(!n){if(r.type!=="response.created")throw new V(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=ce(this,Pi,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);let i=o.type,s=r.part;i==="message"&&s.type!=="reasoning_text"?o.content.push(s):i==="reasoning"&&s.type==="reasoning_text"&&(o.content||(o.content=[]),o.content.push(s));break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new V(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new V(`expected content to be 'output_text', got ${i.type}`);i.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.reasoning_text.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);if(o.type==="reasoning"){let i=o.content?.[r.content_index];if(!i)throw new V(`missing content at index ${r.content_index}`);if(i.type!=="reasoning_text")throw new V(`expected content to be 'reasoning_text', got ${i.type}`);i.text+=r.delta}break}case"response.completed":{ce(this,Pi,r.response,"f");break}}return n},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=S(this,Gm,"f");if(!e)throw new V("stream ended without producing a ChatCompletion");return e}};function nB(t,e){return pA(t,e)}var Xc=class extends C{list(e,r={},n){return this._client.getAPIList(O`/responses/${e}/input_items`,ke,{query:r,...n})}};var Yc=class extends C{count(e={},r){return this._client.post("/responses/input_tokens",{body:e,...r})}};var Go=class extends C{constructor(){super(...arguments),this.inputItems=new Xc(this._client),this.inputTokens=new Yc(this._client)}create(e,r){return this._client.post("/responses",{body:e,...r,stream:e.stream??!1})._thenUnwrap(n=>("object"in n&&n.object==="response"&&qm(n),n))}retrieve(e,r={},n){return this._client.get(O`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&qm(o),o))}delete(e,r){return this._client.delete(O`/responses/${e}`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>Lw(n,e))}stream(e,r){return Km.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(O`/responses/${e}/cancel`,r)}compact(e={},r){return this._client.post("/responses/compact",{body:e,...r})}};Go.InputItems=Xc;Go.InputTokens=Yc;var Qc=class extends C{create(e,r,n){return this._client.post(O`/uploads/${e}/parts`,Hr({body:r,...n},this._client))}};var Ci=class extends C{constructor(){super(...arguments),this.parts=new Qc(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(O`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(O`/uploads/${e}/complete`,{body:r,...n})}};Ci.Parts=Qc;var _A=async t=>{let e=await Promise.allSettled(t),r=e.filter(o=>o.status==="rejected");if(r.length){for(let o of r)console.error(o.reason);throw new Error(`${r.length} promise(s) failed - see the above errors`)}let n=[];for(let o of e)o.status==="fulfilled"&&n.push(o.value);return n};var eu=class extends C{create(e,r,n){return this._client.post(O`/vector_stores/${e}/file_batches`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(O`/vector_stores/${o}/file_batches/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{vector_store_id:o}=r;return this._client.post(O`/vector_stores/${o}/file_batches/${e}/cancel`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r);return await this.poll(e,o.id,n)}listFiles(e,r,n){let{vector_store_id:o,...i}=r;return this._client.getAPIList(O`/vector_stores/${o}/file_batches/${e}/files`,ke,{query:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse();switch(i.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,s=Math.min(i,r.length),a=this._client,c=r.values(),u=[...n];async function l(f){for(let p of f){let m=await a.files.create({file:p,purpose:"assistants"},o);u.push(m.id)}}let d=Array(s).fill(c).map(l);return await _A(d),await this.createAndPoll(e,{file_ids:u})}};var tu=class extends C{create(e,r,n){return this._client.post(O`/vector_stores/${e}/files`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(O`/vector_stores/${o}/files/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{vector_store_id:o,...i}=r;return this._client.post(O`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/vector_stores/${e}/files`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{vector_store_id:o}=r;return this._client.delete(O`/vector_stores/${o}/files/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse(),s=i.data;switch(s.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=i.response.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"failed":case"completed":return s}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}content(e,r,n){let{vector_store_id:o}=r;return this._client.getAPIList(O`/vector_stores/${o}/files/${e}/content`,so,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var Ko=class extends C{constructor(){super(...arguments),this.files=new tu(this._client),this.fileBatches=new eu(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/vector_stores/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/vector_stores/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",ke,{query:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(O`/vector_stores/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList(O`/vector_stores/${e}/search`,so,{body:r,method:"post",...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};Ko.Files=tu;Ko.FileBatches=eu;var Qs=class extends C{create(e,r){return this._client.post("/videos",ww({body:e,...r},this._client))}retrieve(e,r){return this._client.get(O`/videos/${e}`,r)}list(e={},r){return this._client.getAPIList("/videos",Uo,{query:e,...r})}delete(e,r){return this._client.delete(O`/videos/${e}`,r)}downloadContent(e,r={},n){return this._client.get(O`/videos/${e}/content`,{query:r,...n,headers:L([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}remix(e,r,n){return this._client.post(O`/videos/${e}/remix`,ww({body:r,...n},this._client))}};var ru,yA,Hm,ea=class extends C{constructor(){super(...arguments),ru.add(this)}async unwrap(e,r,n=this._client.webhookSecret,o=300){return await this.verifySignature(e,r,n,o),JSON.parse(e)}async verifySignature(e,r,n=this._client.webhookSecret,o=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");S(this,ru,"m",yA).call(this,n);let i=L([r]).values,s=S(this,ru,"m",Hm).call(this,i,"webhook-signature"),a=S(this,ru,"m",Hm).call(this,i,"webhook-timestamp"),c=S(this,ru,"m",Hm).call(this,i,"webhook-id"),u=parseInt(a,10);if(isNaN(u))throw new ro("Invalid webhook timestamp format");let l=Math.floor(Date.now()/1e3);if(l-u>o)throw new ro("Webhook timestamp is too old");if(u>l+o)throw new ro("Webhook timestamp is too new");let d=s.split(" ").map(h=>h.startsWith("v1,")?h.substring(3):h),f=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),p=c?`${c}.${a}.${e}`:`${a}.${e}`,m=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let h of d)try{let _=Buffer.from(h,"base64");if(await crypto.subtle.verify("HMAC",m,_,new TextEncoder().encode(p)))return}catch{continue}throw new ro("The given webhook signature does not match the expected signature")}};ru=new WeakSet,yA=function(e){if(typeof e!="string"||e.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},Hm=function(e,r){if(!e)throw new Error("Headers are required");let n=e.get(r);if(n==null)throw new Error(`Missing required header: ${r}`);return n};var Uw,Fw,Wm,vA,fe=class{constructor({baseURL:e=Si("OPENAI_BASE_URL"),apiKey:r=Si("OPENAI_API_KEY"),organization:n=Si("OPENAI_ORG_ID")??null,project:o=Si("OPENAI_PROJECT_ID")??null,webhookSecret:i=Si("OPENAI_WEBHOOK_SECRET")??null,...s}={}){if(Uw.add(this),Wm.set(this,void 0),this.completions=new Bs(this),this.chat=new xi(this),this.embeddings=new qs(this),this.files=new Gs(this),this.images=new Js(this),this.audio=new ao(this),this.moderations=new Ys(this),this.models=new Xs(this),this.fineTuning=new Mn(this),this.graders=new Oi(this),this.vectorStores=new Ko(this),this.webhooks=new ea(this),this.beta=new zn(this),this.batches=new js(this),this.uploads=new Ci(this),this.responses=new Go(this),this.realtime=new Vo(this),this.conversations=new Ei(this),this.evals=new Ai(this),this.containers=new Ti(this),this.videos=new Qs(this),r===void 0)throw new V("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");let a={apiKey:r,organization:n,project:o,webhookSecret:i,...s,baseURL:e||"https://api.openai.com/v1"};if(!a.dangerouslyAllowBrowser&&kE())throw new V(`It looks like you're running in a browser-like environment. + +This is disabled by default, as it risks exposing your secret API credentials to attackers. +If you understand the risks and have appropriate mitigations in place, +you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g., + +new OpenAI({ apiKey, dangerouslyAllowBrowser: true }); + +https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety +`);this.baseURL=a.baseURL,this.timeout=a.timeout??Fw.DEFAULT_TIMEOUT,this.logger=a.logger??console;let c="warn";this.logLevel=c,this.logLevel=hw(a.logLevel,"ClientOptions.logLevel",this)??hw(Si("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??c,this.fetchOptions=a.fetchOptions,this.maxRetries=a.maxRetries??2,this.fetch=a.fetch??EE(),ce(this,Wm,OE,"f"),this._options=a,this.apiKey=typeof r=="string"?r:"Missing Key",this.organization=n,this.project=o,this.webhookSecret=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return L([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return fw(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${vi}`}defaultIdempotencyKey(){return`stainless-node-retry-${nw()}`}makeStatusError(e,r,n,o){return Pt.generate(e,r,n,o)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(n){throw n instanceof V?n:new V(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new V(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let o=!S(this,Uw,"m",vA).call(this)&&n||this.baseURL,i=yE(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery();return vE(s)||(r={...s,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}async prepareOptions(e){await this._callApiKey()}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(o=>({method:e,path:r,...o})))}request(e,r=null){return new Rs(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,i=o.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(o);let{req:s,url:a,timeout:c}=await this.buildRequest(o,{retryCount:i-r});await this.prepareRequest(s,{url:a,options:o});let u="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),l=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if($t(this).debug(`[${u}] sending request`,Lo({retryOfRequestLogID:n,method:o.method,url:a,options:o,headers:s.headers})),o.signal?.aborted)throw new xt;let f=new AbortController,p=await this.fetchWithTimeout(a,s,c,f).catch(rd),m=Date.now();if(p instanceof globalThis.Error){let v=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new xt;let b=td(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return $t(this).info(`[${u}] connection ${b?"timed out":"failed"} - ${v}`),$t(this).debug(`[${u}] connection ${b?"timed out":"failed"} (${v})`,Lo({retryOfRequestLogID:n,url:a,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??u);throw $t(this).info(`[${u}] connection ${b?"timed out":"failed"} - error; no more retries left`),$t(this).debug(`[${u}] connection ${b?"timed out":"failed"} (error; no more retries left)`,Lo({retryOfRequestLogID:n,url:a,durationMs:m-d,message:p.message})),b?new Do:new yi({cause:p})}let h=[...p.headers.entries()].filter(([v])=>v==="x-request-id").map(([v,b])=>", "+v+": "+JSON.stringify(b)).join(""),_=`[${u}${l}${h}] ${s.method} ${a} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let v=await this.shouldRetry(p);if(r&&v){let J=`retrying, ${r} attempts remaining`;return await AE(p.body),$t(this).info(`${_} - ${J}`),$t(this).debug(`[${u}] response error (${J})`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??u,p.headers)}let b=v?"error; no more retries left":"error; not retryable";$t(this).info(`${_} - ${b}`);let x=await p.text().catch(J=>rd(J).message),k=xE(x),T=k?void 0:x;throw $t(this).debug(`[${u}] response error (${b})`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:T,durationMs:Date.now()-d})),this.makeStatusError(p.status,k,T,p.headers)}return $t(this).info(_),$t(this).debug(`[${u}] response start`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),{response:p,options:o,controller:f,requestLogID:u,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new cd(this,n,e)}async fetchWithTimeout(e,r,n,o){let{signal:i,method:s,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let c=setTimeout(()=>o.abort(),n),u=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,l={signal:o.signal,...u?{duplex:"half"}:{},method:"GET",...a};s&&(l.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,l)}finally{clearTimeout(c)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,o){let i,s=o?.get("retry-after-ms");if(s){let c=parseFloat(s);Number.isNaN(c)||(i=c)}let a=o?.get("retry-after");if(a&&!i){let c=parseFloat(a);Number.isNaN(c)?i=Date.parse(a)-Date.now():i=c*1e3}if(!(i&&0<=i&&i<60*1e3)){let c=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,c)}return await no(i),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,s=Math.min(.5*Math.pow(2,i),8),a=1-Math.random()*.25;return s*a*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:s,defaultBaseURL:a}=n,c=this.buildURL(i,s,a);"timeout"in n&&wE("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:u,body:l}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:u,retryCount:r});return{req:{method:o,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:c,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let s=L([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...TE(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=L([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:xm(e)}:S(this,Wm,"f").call(this,{body:e,headers:n})}};Fw=fe,Wm=new WeakMap,Uw=new WeakSet,vA=function(){return this.baseURL!=="https://api.openai.com/v1"};fe.OpenAI=Fw;fe.DEFAULT_TIMEOUT=6e5;fe.OpenAIError=V;fe.APIError=Pt;fe.APIConnectionError=yi;fe.APIConnectionTimeoutError=Do;fe.APIUserAbortError=xt;fe.NotFoundError=gc;fe.ConflictError=_c;fe.RateLimitError=vc;fe.BadRequestError=fc;fe.AuthenticationError=mc;fe.InternalServerError=bc;fe.PermissionDeniedError=hc;fe.UnprocessableEntityError=yc;fe.InvalidWebhookSignatureError=ro;fe.toFile=ld;fe.Completions=Bs;fe.Chat=xi;fe.Embeddings=qs;fe.Files=Gs;fe.Images=Js;fe.Audio=ao;fe.Moderations=Ys;fe.Models=Xs;fe.FineTuning=Mn;fe.Graders=Oi;fe.VectorStores=Ko;fe.Webhooks=ea;fe.Beta=zn;fe.Batches=js;fe.Uploads=Ci;fe.Responses=Go;fe.Realtime=Vo;fe.Conversations=Ei;fe.Evals=Ai;fe.Containers=Ti;fe.Videos=Qs;var lB=Object.defineProperty,G=(t,e)=>{for(var r in e)lB(t,r,{get:e[r],enumerable:!0})};function Jr(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function nu(t){return Jr(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function ou(t){return Jr(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function bA(t){return Jr(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function Jm(t){return Jr(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function Xm(t){if(Jr(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function Ym(t){let e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);let r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);let o={};for(let i of t.split(";").slice(1)){let s=i.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);let a=s[0].trim(),c=s[1].trim();if(a==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);o[a]=c}return{type:r,subtype:n,parameters:o}}function ta({dataUrl:t,asTypedArray:e=!1}){let r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let o=e?Uint8Array.from(atob(r[2]),i=>i.charCodeAt(0)):r[2];return{mime_type:n,data:o}}}function $d(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}function Qm(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var OA=mn(xA(),1),_B=mn(AA(),1);function PA(t,e){return e?.[t]||(0,OA.default)(t)}function CA(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var yB={};G(yB,{Serializable:()=>uo,get_lc_unique_name:()=>eh});function RA(t){return Array.isArray(t)?[...t]:{...t}}function vB(t,e){let r=RA(t);for(let[n,o]of Object.entries(e)){let[i,...s]=n.split(".").reverse(),a=r;for(let c of s.reverse()){if(a[c]===void 0)break;a[c]=RA(a[c]),a=a[c]}a[i]!==void 0&&(a[i]={lc:1,type:"secret",id:[o]})}return r}function eh(t){let e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var uo=class NA{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eh(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof NA||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((o,i)=>(o[i]=i in this?this[i]:this.lc_kwargs[i],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(e,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));return Object.keys(r).forEach(o=>{let i=this,s=n,[a,...c]=o.split(".").reverse();for(let u of c.reverse()){if(!(u in i)||i[u]===void 0)return;(!(u in s)||s[u]===void 0)&&(typeof i[u]=="object"&&i[u]!=null?s[u]={}:Array.isArray(i[u])&&(s[u]=[])),i=i[u],s=s[u]}a in i&&i[a]!==void 0&&(s[a]=s[a]||i[a])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:CA(Object.keys(r).length?vB(n,r):n,PA,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function re(t,e){return me(t)&&t.type===e}function me(t){return typeof t=="object"&&t!==null}function Ar(t){return Array.isArray(t)}function K(t){return typeof t=="string"}function Xr(t){return typeof t=="number"}function th(t){return t instanceof Uint8Array}function qw(t){try{return JSON.parse(t)}catch{return}}var Ho=t=>t();function bB(t){if(t.type==="char_location"&&K(t.document_title)&&Xr(t.start_char_index)&&Xr(t.end_char_index)&&K(t.cited_text)){let{document_title:e,start_char_index:r,end_char_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"char",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="page_location"&&K(t.document_title)&&Xr(t.start_page_number)&&Xr(t.end_page_number)&&K(t.cited_text)){let{document_title:e,start_page_number:r,end_page_number:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"page",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="content_block_location"&&K(t.document_title)&&Xr(t.start_block_index)&&Xr(t.end_block_index)&&K(t.cited_text)){let{document_title:e,start_block_index:r,end_block_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"block",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="web_search_result_location"&&K(t.url)&&K(t.title)&&K(t.encrypted_index)&&K(t.cited_text)){let{url:e,title:r,encrypted_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"url",url:e,title:r,startIndex:Number(n),endIndex:Number(n),citedText:o}}if(t.type==="search_result_location"&&K(t.source)&&K(t.title)&&Xr(t.start_block_index)&&Xr(t.end_block_index)&&K(t.cited_text)){let{source:e,title:r,start_block_index:n,end_block_index:o,cited_text:i,...s}=t;return{...s,type:"citation",source:"search",url:e,title:r??void 0,startIndex:n,endIndex:o,citedText:i}}}function MA(t){if(re(t,"document")&&me(t.source)&&"type"in t.source){if(t.source.type==="base64"&&K(t.source.media_type)&&K(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&K(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&K(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&K(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(re(t,"image")&&me(t.source)&&"type"in t.source){if(t.source.type==="base64"&&K(t.source.media_type)&&K(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&K(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&K(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function jA(t){function*e(){for(let r of t){let n=MA(r);n?yield n:yield r}}return Array.from(e())}function zA(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"text")&&K(n.text)){let{text:o,citations:i,...s}=n;if(Ar(i)&&i.length){let a=i.reduce((c,u)=>{let l=bB(u);return l?[...c,l]:c},[]);yield{...s,type:"text",text:o,annotations:a};continue}else{yield{...s,type:"text",text:o};continue}}else if(re(n,"thinking")&&K(n.thinking)){let{thinking:o,signature:i,...s}=n;yield{...s,type:"reasoning",reasoning:o,signature:i};continue}else if(re(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(re(n,"tool_use")&&K(n.name)&&K(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(re(n,"input_json_delta")){if(wB(t)&&t.tool_call_chunks?.length){let o=t.tool_call_chunks[0];yield{type:"tool_call_chunk",id:o.id,name:o.name,args:o.args,index:o.index};continue}}else if(re(n,"server_tool_use")&&K(n.name)&&K(n.id)){let{name:o,id:i}=n;if(o==="web_search"){let s=Ho(()=>{if(typeof n.input=="string")return n.input;if(me(n.input)&&K(n.input.query))return n.input.query;if(K(n.partial_json)){let a=qw(n.partial_json);if(a?.query)return a.query}return""});yield{id:i,type:"server_tool_call",name:"web_search",args:{query:s}};continue}else if(n.name==="code_execution"){let s=Ho(()=>{if(typeof n.input=="string")return n.input;if(me(n.input)&&K(n.input.code))return n.input.code;if(K(n.partial_json)){let a=qw(n.partial_json);if(a?.code)return a.code}return""});yield{id:i,type:"server_tool_call",name:"code_execution",args:{code:s}};continue}}else if(re(n,"web_search_tool_result")&&K(n.tool_use_id)&&Ar(n.content)){let{content:o,tool_use_id:i}=n,s=o.reduce((a,c)=>re(c,"web_search_result")?[...a,c.url]:a,[]);yield{type:"server_tool_call_result",name:"web_search",toolCallId:i,status:"success",output:{urls:s}};continue}else if(re(n,"code_execution_tool_result")&&K(n.tool_use_id)&&me(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(re(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(re(n,"mcp_tool_result")&&K(n.tool_use_id)&&me(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(re(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(re(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(re(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let o=MA(n);if(o){yield o;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var DA={translateContent:zA,translateContentChunk:zA};function wB(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}function xB(t){return nu(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:ou(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:Jm(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function LA(t){return t.map(xB)}function UA(t){return!!(re(t,"image_url")&&me(t.image_url)||re(t,"input_audio")&&me(t.input_audio)||re(t,"file")&&me(t.file))}function FA(t){if(re(t,"image_url")&&me(t.image_url)&&K(t.image_url.url)){let e=ta({dataUrl:t.image_url.url});return e?{type:"image",mimeType:e.mime_type,data:e.data}:{type:"image",url:t.image_url.url}}else{if(re(t,"input_audio")&&me(t.input_audio)&&K(t.input_audio.data)&&K(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(re(t,"file")&&me(t.file)&&K(t.file.data)){let e=ta({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(K(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}function $B(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...rh(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function IB(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...rh(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function rh(t){let e=[];for(let r of t)UA(r)?e.push(FA(r)):e.push(r);return e}function SB(t){if(t.type==="url_citation"){let{url:e,title:r,start_index:n,end_index:o}=t;return{type:"citation",url:e,title:r,startIndex:n,endIndex:o}}if(t.type==="file_citation"){let{file_id:e,filename:r,index:n}=t;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:e}}return t}function BA(t){function*e(){me(t.additional_kwargs?.reasoning)&&Ar(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((o,i)=>me(i)&&K(i.text)?`${o}${i.text}`:o,"")});let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r)if(re(n,"text")){let{text:o,annotations:i,...s}=n;Array.isArray(i)?yield{...s,type:"text",text:String(o),annotations:i.map(SB)}:yield{...s,type:"text",text:String(o)}}for(let n of t.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(me(t.additional_kwargs)&&Ar(t.additional_kwargs.tool_outputs))for(let n of t.additional_kwargs.tool_outputs){if(re(n,"web_search_call")){yield{id:n.id,type:"server_tool_call",name:"web_search",args:{query:n.query}};continue}else if(re(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{query:n.query}};continue}else if(re(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(re(n,"code_interpreter_call")){if(K(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),Ar(n.outputs)){let o=Ho(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(let i of n.outputs)if(re(i,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:o??0,stderr:[0,void 0].includes(o)?void 0:String(i.logs),stdout:[0,void 0].includes(o)?String(i.logs):void 0}};continue}}continue}else if(re(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(re(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(re(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(re(n,"image_generation_call")){yield{type:"non_standard",value:n};continue}me(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function kB(t){function*e(){yield*BA(t);for(let r of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(e())}var ZA={translateContent:t=>typeof t.content=="string"?$B(t):BA(t),translateContentChunk:t=>typeof t.content=="string"?IB(t):kB(t)};function qA(t,e="pretty"){return e==="pretty"?TB(t):JSON.stringify(t)}function TB(t){let e=[],r=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),o="=".repeat(n),i=r.length%2===0?o:`${o}=`;if(e.push(`${o}${r}${i}`),t.type==="ai"){let s=t;if(s.tool_calls&&s.tool_calls.length>0){e.push("Tool Calls:");for(let a of s.tool_calls){e.push(` ${a.name} (${a.id})`),e.push(` Call ID: ${a.id}`),e.push(" Args:");for(let[c,u]of Object.entries(a.args))e.push(` ${c}: ${u}`)}}}if(t.type==="tool"){let s=t;s.name&&e.push(`Name: ${s.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(` +`)}var Vw=Symbol.for("langchain.message");function er(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.length===0?t:Array.isArray(e)&&e.some(r=>Jr(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?ra(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>Jr(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function nh(t,e){return t==="error"||e==="error"?"error":"success"}function EB(t,e){function r(n,o){if(typeof n!="object"||n===null||n===void 0)return n;if(o>=e)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(s=>r(s,o+1));let i={};for(let s of Object.keys(n))i[s]=r(n[s],o+1);return i}return JSON.stringify(r(t,0),null,2)}var qt=class extends uo{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[Vw]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(t){let e=typeof t=="string"||Array.isArray(t)?{content:t}:t;e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),this.name=e.name,e.content===void 0&&e.contentBlocks!==void 0?(this.content=e.contentBlocks,this.response_metadata={output_version:"v1",...e.response_metadata}):e.content!==void 0?(this.content=e.content??[],this.response_metadata=e.response_metadata):(this.content=[],this.response_metadata=e.response_metadata),this.additional_kwargs=e.additional_kwargs,this.id=e.id}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(t=>typeof t=="string"?t:t.type==="text"?t.text:"").join(""):""}get contentBlocks(){let t=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[LA,rh,jA].reduce((n,o)=>o(n),t)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(t){return typeof t=="object"&&t!==null&&Vw in t&&t[Vw]===!0&&Qm(t)}_updateId(t){this.id=t,this.lc_kwargs.id=t}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](t){if(t===null)return this;let e=EB(this._printableFields,Math.max(4,t));return`${this.constructor.lc_name()} ${e}`}toFormattedString(t="pretty"){return qA(this,t)}};function VA(t){return Array.isArray(t)&&t.every(e=>typeof e.index=="number")}function dt(t={},e={}){let r={...t};for(let[n,o]of Object.entries(e))if(r[n]==null)r[n]=o;else{if(o==null)continue;if(typeof r[n]!=typeof o||Array.isArray(r[n])!==Array.isArray(o))throw new Error(`field[${n}] already exists in the message chunk, but with a different type.`);if(typeof r[n]=="string"){if(n==="type")continue;["id","name","output_version","model_provider"].includes(n)?o&&(r[n]=o):r[n]+=o}else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=dt(r[n],o);else if(Array.isArray(r[n]))r[n]=ra(r[n],o);else{if(r[n]===o)continue;console.warn(`field[${n}] already exists in this message chunk and value has unsupported type.`)}}return r}function ra(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)return t||e;{let r=[...t];for(let n of e)if(typeof n=="object"&&n!==null&&"index"in n&&typeof n.index=="number"){let o=r.findIndex(i=>{let s=typeof i=="object",a="index"in i&&i.index===n.index,c="id"in i&&"id"in n&&i?.id===n?.id,u=!("id"in i)||!i?.id||!("id"in n)||!n?.id;return s&&a&&(c||u)});o!==-1&&typeof r[o]=="object"&&r[o]!==null?r[o]=dt(r[o],n):r.push(n)}else{if(typeof n=="object"&&n!==null&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function oh(t,e){if(!t&&!e)throw new Error("Cannot merge two undefined objects.");if(!t||!e)return t||e;if(typeof t!=typeof e)throw new Error(`Cannot merge objects of different types. +Left ${typeof t} +Right ${typeof e}`);if(typeof t=="string"&&typeof e=="string")return t+e;if(Array.isArray(t)&&Array.isArray(e))return ra(t,e);if(typeof t=="object"&&typeof e=="object")return dt(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types. +Left ${t} +Right ${e}`)}var fr=class GA extends qt{static isInstance(e){if(!super.isInstance(e))return!1;let r=Object.getPrototypeOf(e);for(;r!==null;){if(r===GA.prototype)return!0;r=Object.getPrototypeOf(r)}return!1}};function ih(t){return typeof t.role=="string"}function Yr(t){return typeof t?._getType=="function"}function iu(t){return fr.isInstance(t)}function sh(t,e){return dt(t??{},e??{})}function KA(t,e){let r={};return(t?.audio!==void 0||e?.audio!==void 0)&&(r.audio=(t?.audio??0)+(e?.audio??0)),(t?.image!==void 0||e?.image!==void 0)&&(r.image=(t?.image??0)+(e?.image??0)),(t?.video!==void 0||e?.video!==void 0)&&(r.video=(t?.video??0)+(e?.video??0)),(t?.document!==void 0||e?.document!==void 0)&&(r.document=(t?.document??0)+(e?.document??0)),(t?.text!==void 0||e?.text!==void 0)&&(r.text=(t?.text??0)+(e?.text??0)),r}function AB(t,e){let r={...KA(t,e)};return(t?.cache_read!==void 0||e?.cache_read!==void 0)&&(r.cache_read=(t?.cache_read??0)+(e?.cache_read??0)),(t?.cache_creation!==void 0||e?.cache_creation!==void 0)&&(r.cache_creation=(t?.cache_creation??0)+(e?.cache_creation??0)),r}function OB(t,e){let r={...KA(t,e)};return(t?.reasoning!==void 0||e?.reasoning!==void 0)&&(r.reasoning=(t?.reasoning??0)+(e?.reasoning??0)),r}function ah(t,e){return{input_tokens:(t?.input_tokens??0)+(e?.input_tokens??0),output_tokens:(t?.output_tokens??0)+(e?.output_tokens??0),total_tokens:(t?.total_tokens??0)+(e?.total_tokens??0),input_token_details:AB(t?.input_token_details,e?.input_token_details),output_token_details:OB(t?.output_token_details,e?.output_token_details)}}var PB={};G(PB,{ToolMessage:()=>Or,ToolMessageChunk:()=>na,defaultToolCallParser:()=>Sd,isDirectToolOutput:()=>Id,isToolMessage:()=>Gw,isToolMessageChunk:()=>Kw});function Id(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}var Or=class extends qt{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}lc_direct_tool_output=!0;type="tool";status;tool_call_id;metadata;artifact;constructor(t,e,r){let n=typeof t=="string"||Array.isArray(t)?{content:t,name:r,tool_call_id:e}:t;super(n),this.tool_call_id=n.tool_call_id,this.artifact=n.artifact,this.status=n.status,this.metadata=n.metadata}static isInstance(t){return super.isInstance(t)&&t.type==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},na=class extends fr{type="tool";tool_call_id;status;artifact;constructor(t){super(t),this.tool_call_id=t.tool_call_id,this.artifact=t.artifact,this.status=t.status}static lc_name(){return"ToolMessageChunk"}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),artifact:oh(this.artifact,t.artifact),tool_call_id:this.tool_call_id,id:this.id??t.id,status:nh(this.status,t.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}};function Sd(t){let e=[],r=[];for(let n of t)if(n.function){let o=n.function.name;try{let i=JSON.parse(n.function.arguments);e.push({name:o||"",args:i||{},id:n.id})}catch{r.push({name:o,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[e,r]}function Gw(t){return typeof t=="object"&&t!==null&&"getType"in t&&typeof t.getType=="function"&&t.getType()==="tool"}function Kw(t){return t._getType()==="tool"}var jn=class HA extends qt{static lc_name(){return"ChatMessage"}type="generic";role;static _chatMessageClass(){return HA}constructor(e,r){(typeof e=="string"||Array.isArray(e))&&(e={content:e,role:r}),super(e),this.role=e.role}static isInstance(e){return super.isInstance(e)&&e.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},Ri=class extends fr{static lc_name(){return"ChatMessageChunk"}type="generic";role;constructor(t,e){(typeof t=="string"||Array.isArray(t))&&(t={content:t,role:e}),super(t),this.role=t.role}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),role:this.role,id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}};function WA(t){return t._getType()==="generic"}function JA(t){return t._getType()==="generic"}var oa=class extends qt{static lc_name(){return"FunctionMessage"}type="function";name;constructor(t){super(t),this.name=t.name}},Ni=class extends fr{static lc_name(){return"FunctionMessageChunk"}type="function";concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),name:this.name??"",id:this.id??t.id})}};function XA(t){return t._getType()==="function"}function YA(t){return t._getType()==="function"}var mr=class extends qt{static lc_name(){return"HumanMessage"}type="human";constructor(t){super(t)}static isInstance(t){return super.isInstance(t)&&t.type==="human"}},zi=class extends fr{static lc_name(){return"HumanMessageChunk"}type="human";constructor(t){super(t)}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="human"}};function QA(t){return t.getType()==="human"}function eO(t){return t.getType()==="human"}var ia=class extends qt{type="remove";id;constructor(t){super({...t,content:[]}),this.id=t.id}get _printableFields(){return{...super._printableFields,id:this.id}}static isInstance(t){return super.isInstance(t)&&t.type==="remove"}};var hn=class ch extends qt{static lc_name(){return"SystemMessage"}type="system";constructor(e){super(e)}concat(e){if(typeof e=="string")return new ch({...this,content:er(this.content,e)});if(ch.isInstance(e))return new ch({...this,additional_kwargs:{...this.additional_kwargs,...e.additional_kwargs},response_metadata:{...this.response_metadata,...e.response_metadata},content:er(this.content,e.content)});throw new Error("Unexpected chunk type for system message")}static isInstance(e){return super.isInstance(e)&&e.type==="system"}},lo=class extends fr{static lc_name(){return"SystemMessageChunk"}type="system";constructor(t){super(t)}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="system"}};function tO(t){return t._getType()==="system"}function rO(t){return t._getType()==="system"}function uh(t,e){return t.lc_error_code=e,t.message=`${t.message} + +Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/ +`,t}function Mi(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function nO(t){return!!(t&&typeof t=="object"&&"toolCall"in t&&t.toolCall!=null&&typeof t.toolCall=="object"&&"id"in t.toolCall&&typeof t.toolCall.id=="string")}var su=class extends Error{output;constructor(t,e){super(t),this.output=e}};function kd(t,e=sa){t=t.trim();let r=t.indexOf("```");if(r===-1)return e(t);let n=t.substring(r+3);n.startsWith(`json +`)?n=n.substring(5):n.startsWith("json")?n=n.substring(4):n.startsWith(` +`)&&(n=n.substring(1));let o=n.indexOf("```"),i=n;return o!==-1&&(i=n.substring(0,o)),e(i.trim())}function CB(t){try{return JSON.parse(t)}catch{}let e=t.trim();if(e.length===0)throw new Error("Unexpected end of JSON input");let r=0;function n(){for(;r="0"&&e[r]<="9"))throw new Error(`Invalid number at position ${l}`);if(r="1"&&e[r]<="9")for(;r="0"&&e[r]<="9";)d+=e[r],r+=1;if(r="0"&&e[r]<="9";)d+=e[r],r+=1;if(r="0"&&e[r]<="9";)d+=e[r],r+=1;if(d==="-")return-0;let f=Number.parseFloat(d);if(Number.isNaN(f))throw r=l,new Error(`Invalid number '${d}' at position ${l}`);return f}function s(){if(n(),r>=e.length)throw new Error(`Unexpected end of input at position ${r}`);let l=e[r];if(l==="{")return c();if(l==="[")return a();if(l==='"')return o();if("null".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),null;if("true".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),!0;if("false".startsWith(e.substring(r,r+5)))return r+=Math.min(5,e.length-r),!1;if(l==="-"||l>="0"&&l<="9")return i();throw new Error(`Unexpected character '${l}' at position ${r}`)}function a(){if(e[r]!=="[")throw new Error(`Expected '[' at position ${r}, got '${e[r]}'`);let l=[];if(r+=1,n(),r>=e.length)return l;if(e[r]==="]")return r+=1,l;for(;r=e.length||(l.push(s()),n(),r>=e.length))return l;if(e[r]==="]")return r+=1,l;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or ']' at position ${r}, got '${e[r]}'`)}return l}function c(){if(e[r]!=="{")throw new Error(`Expected '{' at position ${r}, got '${e[r]}'`);let l={};if(r+=1,n(),r>=e.length)return l;if(e[r]==="}")return r+=1,l;for(;r=e.length)return l;let d=o();if(n(),r>=e.length)return l;if(e[r]!==":")throw new Error(`Expected ':' at position ${r}, got '${e[r]}'`);if(r+=1,n(),r>=e.length||(l[d]=s(),n(),r>=e.length))return l;if(e[r]==="}")return r+=1,l;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or '}' at position ${r}, got '${e[r]}'`)}return l}let u=s();if(n(),r"u"?null:CB(t)}catch{return null}}function Hw(t){switch(t){case"csv":return"text/csv";case"doc":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"html":return"text/html";case"md":return"text/markdown";case"pdf":return"application/pdf";case"txt":return"text/plain";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"gif":return"image/gif";case"jpeg":return"image/jpeg";case"jpg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"flv":return"video/flv";case"mkv":return"video/mkv";case"mov":return"video/mov";case"mp4":return"video/mp4";case"mpeg":return"video/mpeg";case"mpg":return"video/mpg";case"three_gp":return"video/three_gp";case"webm":return"video/webm";case"wmv":return"video/wmv";default:return"application/octet-stream"}}function RB(t){if(me(t.document)&&me(t.document.source)){let e=me(t.document)&&K(t.document.format)?t.document.format:"",r=Hw(e);if(me(t.document.source)){if(me(t.document.source.s3Location)&&K(t.document.source.s3Location.uri))return{type:"file",mimeType:r,fileId:t.document.source.s3Location.uri};if(th(t.document.source.bytes))return{type:"file",mimeType:r,data:t.document.source.bytes};if(K(t.document.source.text))return{type:"file",mimeType:r,data:Buffer.from(t.document.source.text).toString("base64")};if(Ar(t.document.source.content)){let n=t.document.source.content.reduce((o,i)=>me(i)&&K(i.text)?o+i.text:o,"");return{type:"file",mimeType:r,data:n}}}}return{type:"non_standard",value:t}}function NB(t){if(re(t,"image")&&me(t.image)){let e=me(t.image)&&K(t.image.format)?t.image.format:"",r=Hw(e);if(me(t.image.source)){if(me(t.image.source.s3Location)&&K(t.image.source.s3Location.uri))return{type:"image",mimeType:r,fileId:t.image.source.s3Location.uri};if(th(t.image.source.bytes))return{type:"image",mimeType:r,data:t.image.source.bytes}}}return{type:"non_standard",value:t}}function zB(t){if(re(t,"video")&&me(t.video)){let e=me(t.video)&&K(t.video.format)?t.video.format:"",r=Hw(e);if(me(t.video.source)){if(me(t.video.source.s3Location)&&K(t.video.source.s3Location.uri))return{type:"video",mimeType:r,fileId:t.video.source.s3Location.uri};if(th(t.video.source.bytes))return{type:"video",mimeType:r,data:t.video.source.bytes}}}return{type:"non_standard",value:t}}function oO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"cache_point")){yield{type:"non_standard",value:n};continue}else if(re(n,"citations_content")&&me(n.citationsContent)){let o=Ar(n.citationsContent.content)?n.citationsContent.content.reduce((s,a)=>me(a)&&K(a.text)?s+a.text:s,""):"",i=Ar(n.citationsContent.citations)?n.citationsContent.citations.reduce((s,a)=>{if(me(a)){let c=Ar(a.sourceContent)?a.sourceContent.reduce((l,d)=>me(d)&&K(d.text)?l+d.text:l,""):"",u=Ho(()=>{if(me(a.location)){let l=a.location.documentChar||a.location.documentPage||a.location.documentChunk;if(me(l))return{source:Xr(l.documentIndex)?l.documentIndex.toString():void 0,startIndex:Xr(l.start)?l.start:void 0,endIndex:Xr(l.end)?l.end:void 0}}return{}});s.push({type:"citation",citedText:c,...u})}return s},[]):[];yield{type:"text",text:o,annotations:i};continue}else if(re(n,"document")&&me(n.document)){yield RB(n);continue}else if(re(n,"guard_content")){yield{type:"non_standard",value:n};continue}else if(re(n,"image")&&me(n.image)){yield NB(n);continue}else if(re(n,"reasoning_content")&&K(n.reasoningText)){yield{type:"reasoning",reasoning:n.reasoningText};continue}else if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"tool_result")){yield{type:"non_standard",value:n};continue}else{if(re(n,"tool_call"))continue;if(re(n,"video")&&me(n.video)){yield zB(n);continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var iO={translateContent:oO,translateContentChunk:oO};function sO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"inlineData")&&me(n.inlineData)&&K(n.inlineData.mimeType)&&K(n.inlineData.data)){yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data};continue}else if(re(n,"functionCall")&&me(n.functionCall)&&K(n.functionCall.name)&&me(n.functionCall.args)){yield{type:"tool_call",id:t.id,name:n.functionCall.name,args:n.functionCall.args};continue}else if(re(n,"functionResponse")){yield{type:"non_standard",value:n};continue}else if(re(n,"fileData")&&me(n.fileData)&&K(n.fileData.mimeType)&&K(n.fileData.fileUri)){yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri};continue}else if(re(n,"executableCode")){yield{type:"non_standard",value:n};continue}else if(re(n,"codeExecutionResult")){yield{type:"non_standard",value:n};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var aO={translateContent:sO,translateContentChunk:sO};function cO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"reasoning")&&K(n.reasoning)){let o=Ho(()=>{let i=r.indexOf(n);if(Ar(t.additional_kwargs?.signatures)&&i>=0)return t.additional_kwargs.signatures.at(i)});K(o)?yield{type:"reasoning",reasoning:n.reasoning,signature:o}:yield{type:"reasoning",reasoning:n.reasoning};continue}else if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"image_url")){if(K(n.image_url))if(n.image_url.startsWith("data:")){let o=/^data:([^;]+);base64,(.+)$/,i=n.image_url.match(o);i?yield{type:"image",data:i[2],mimeType:i[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url};continue}else if(re(n,"media")&&K(n.mimeType)&&K(n.data)){yield{type:"file",mimeType:n.mimeType,data:n.data};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var uO={translateContent:cO,translateContentChunk:cO};globalThis.lc_block_translators_registry??=new Map([["anthropic",DA],["bedrock-converse",iO],["google-genai",aO],["google-vertexai",uO],["openai",ZA]]);function Ww(t){return globalThis.lc_block_translators_registry.get(t)}var jt=class extends qt{type="ai";tool_calls=[];invalid_tool_calls=[];usage_metadata;get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls"}}constructor(t){let e;if(typeof t=="string"||Array.isArray(t))e={content:t,tool_calls:[],invalid_tool_calls:[],additional_kwargs:{}};else{e=t;let r=e.additional_kwargs?.tool_calls,n=e.tool_calls;r!=null&&r.length>0&&(n===void 0||n.length===0)&&console.warn(["New LangChain packages are available that more efficiently handle",`tool calling. + +Please upgrade your packages to versions that set`,"message tool calls. e.g., `pnpm install @langchain/anthropic`,","pnpm install @langchain/openai`, etc."].join(" "));try{if(r!=null&&n===void 0){let[o,i]=Sd(r);e.tool_calls=o??[],e.invalid_tool_calls=i??[]}else e.tool_calls=e.tool_calls??[],e.invalid_tool_calls=e.invalid_tool_calls??[]}catch{e.tool_calls=[],e.invalid_tool_calls=[]}if(e.response_metadata!==void 0&&"output_version"in e.response_metadata&&e.response_metadata.output_version==="v1"&&(e.contentBlocks=e.content,e.content=void 0),e.contentBlocks!==void 0){e.contentBlocks.push(...e.tool_calls.map(i=>({type:"tool_call",id:i.id,name:i.name,args:i.args})));let o=e.contentBlocks.filter(i=>i.type==="tool_call").filter(i=>!e.tool_calls?.some(s=>s.id===i.id&&s.name===i.name));o.length>0&&(e.tool_calls=o.map(i=>({type:"tool_call",id:i.id,name:i.name,args:i.args})))}}super(e),typeof e!="string"&&(this.tool_calls=e.tool_calls??this.tool_calls,this.invalid_tool_calls=e.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=e.usage_metadata}static lc_name(){return"AIMessage"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let e=Ww(this.response_metadata.model_provider);if(e)return e.translateContent(this)}let t=super.contentBlocks;if(this.tool_calls){let e=this.tool_calls.filter(r=>!t.some(n=>n.id===r.id&&n.name===r.name));t.push(...e.map(r=>({...r,type:"tool_call",id:r.id,name:r.name,args:r.args})))}return t}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}static isInstance(t){return super.isInstance(t)&&t.type==="ai"}};function aa(t){return t._getType()==="ai"}function Td(t){return t._getType()==="ai"}var Dt=class extends fr{type="ai";tool_calls=[];invalid_tool_calls=[];tool_call_chunks=[];usage_metadata;constructor(t){let e;typeof t=="string"||Array.isArray(t)?e={content:t,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]}:t.tool_call_chunks===void 0||t.tool_call_chunks.length===0?e={...t,tool_calls:t.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:t.usage_metadata!==void 0?t.usage_metadata:void 0}:e={...t,...lh(t.tool_call_chunks??[]),usage_metadata:t.usage_metadata!==void 0?t.usage_metadata:void 0},super(e),this.tool_call_chunks=e.tool_call_chunks??this.tool_call_chunks,this.tool_calls=e.tool_calls??this.tool_calls,this.invalid_tool_calls=e.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=e.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks"}}static lc_name(){return"AIMessageChunk"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let e=Ww(this.response_metadata.model_provider);if(e)return e.translateContent(this)}let t=super.contentBlocks;if(this.tool_calls&&typeof this.content!="string"){let e=this.content.filter(r=>r.type==="tool_call").map(r=>r.id);for(let r of this.tool_calls)r.id&&!e.includes(r.id)&&t.push({...r,type:"tool_call",id:r.id,name:r.name,args:r.args})}return t}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(t){let e={content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:sh(this.response_metadata,t.response_metadata),tool_call_chunks:[],id:this.id??t.id};if(this.tool_call_chunks!==void 0||t.tool_call_chunks!==void 0){let n=ra(this.tool_call_chunks,t.tool_call_chunks);n!==void 0&&n.length>0&&(e.tool_call_chunks=n)}(this.usage_metadata!==void 0||t.usage_metadata!==void 0)&&(e.usage_metadata=ah(this.usage_metadata,t.usage_metadata));let r=this.constructor;return new r(e)}static isInstance(t){return super.isInstance(t)&&t.type==="ai"}};var Xw=t=>t();function MB(t){return Mi(t)?t:typeof t.id=="string"&&t.type==="function"&&typeof t.function=="object"&&t.function!==null&&"arguments"in t.function&&typeof t.function.arguments=="string"&&"name"in t.function&&typeof t.function.name=="string"?{id:t.id,args:JSON.parse(t.function.arguments),name:t.function.name,type:"tool_call"}:t}function jB(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function Jw(t){let e,r;if(jB(t)){let n=t.id.at(-1);n==="HumanMessage"||n==="HumanMessageChunk"?e="user":n==="AIMessage"||n==="AIMessageChunk"?e="assistant":n==="SystemMessage"||n==="SystemMessageChunk"?e="system":n==="FunctionMessage"||n==="FunctionMessageChunk"?e="function":n==="ToolMessage"||n==="ToolMessageChunk"?e="tool":e="unknown",r=t.kwargs}else{let{type:n,...o}=t;e=n,r=o}if(e==="human"||e==="user")return new mr(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new jt(r);let i=n.map(MB);return new jt({...o,tool_calls:i})}else{if(e==="system")return new hn(r);if(e==="developer")return new hn({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new Or({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});if(e==="remove"&&"id"in r&&typeof r.id=="string")return new ia({...r,id:r.id});throw uh(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported. + +Received: ${JSON.stringify(t,null,2)}`),"MESSAGE_COERCION_FAILURE")}}function ji(t){if(typeof t=="string")return new mr(t);if(Yr(t))return t;if(Array.isArray(t)){let[e,r]=t;return Jw({type:e,content:r})}else if(ih(t)){let{role:e,...r}=t;return Jw({...r,type:e})}else return Jw(t)}function au(t,e="Human",r="AI"){let n=[];for(let o of t){let i;if(o._getType()==="human")i=e;else if(o._getType()==="ai")i=r;else if(o._getType()==="system")i="System";else if(o._getType()==="tool")i="Tool";else if(o._getType()==="generic")i=o.role;else throw new Error(`Got unsupported message type: ${o._getType()}`);let s=o.name?`${o.name}, `:"",a=typeof o.content=="string"?o.content:JSON.stringify(o.content,null,2);n.push(`${i}: ${s}${a}`)}return n.join(` +`)}function DB(t){if(t.data!==void 0)return t;{let e=t;return{type:e.type,data:{content:e.text,role:e.role,name:void 0,tool_call_id:void 0}}}}function Ed(t){let e=DB(t);switch(e.type){case"human":return new mr(e.data);case"ai":return new jt(e.data);case"system":return new hn(e.data);case"function":if(e.data.name===void 0)throw new Error("Name must be defined for function messages");return new oa(e.data);case"tool":if(e.data.tool_call_id===void 0)throw new Error("Tool call ID must be defined for tool messages");return new Or(e.data);case"generic":if(e.data.role===void 0)throw new Error("Role must be defined for chat messages");return new jn(e.data);default:throw new Error(`Got unexpected type: ${e.type}`)}}function lO(t){return t.map(Ed)}function dO(t){return t.map(e=>e.toDict())}function ca(t){let e=t._getType();if(e==="human")return new zi({...t});if(e==="ai"){let r={...t};return"tool_calls"in r&&(r={...r,tool_call_chunks:r.tool_calls?.map(n=>({...n,type:"tool_call_chunk",index:void 0,args:JSON.stringify(n.args)}))}),new Dt({...r})}else{if(e==="system")return new lo({...t});if(e==="function")return new Ni({...t});if(jn.isInstance(t))return new Ri({...t});throw new Error("Unknown message type.")}}function lh(t){let e=t.reduce((o,i)=>{let s=o.findIndex(([a])=>"id"in i&&i.id&&"index"in i&&i.index!==void 0?i.id===a.id&&i.index===a.index:"id"in i&&i.id?i.id===a.id:"index"in i&&i.index!==void 0?i.index===a.index:!1);return s!==-1?o[s].push(i):o.push([i]),o},[]),r=[],n=[];for(let o of e){let i=null,s=o[0]?.name??"",a=o.map(l=>l.args||"").join("").trim(),c=a.length?a:"{}",u=o[0]?.id;try{if(i=sa(c),!u||i===null||typeof i!="object"||Array.isArray(i))throw new Error("Malformed tool call chunk args.");r.push({name:s,args:i,id:u,type:"tool_call"})}catch{n.push({name:s,args:c,id:u,error:"Malformed args.",type:"invalid_tool_call"})}}return{tool_call_chunks:t,tool_calls:r,invalid_tool_calls:n}}var pO=Symbol.for("ls:tracing_async_local_storage"),Di=Symbol.for("lc:context_variables"),fO=t=>{globalThis[pO]=t},Li=()=>globalThis[pO];var LB={};G(LB,{getEnv:()=>Qw,getEnvironmentVariable:()=>It,getRuntimeEnvironment:()=>ex,isBrowser:()=>mO,isDeno:()=>dh,isJsDom:()=>gO,isNode:()=>_O,isWebWorker:()=>hO});var mO=()=>typeof window<"u"&&typeof window.document<"u",hO=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",gO=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),dh=()=>typeof Deno<"u",_O=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!dh(),Qw=()=>{let t;return mO()?t="browser":_O()?t="node":hO()?t="webworker":gO()?t="jsdom":dh()?t="deno":t="other",t},Yw;function ex(){return Yw===void 0&&(Yw={library:"langchain-js",runtime:Qw()}),Yw}function It(t){try{return typeof process<"u"?process.env?.[t]:dh()?Deno?.env.get(t):void 0}catch{return}}var yO=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function UB(t){return typeof t=="string"&&yO.test(t)}var Ui=UB;function FB(t){if(!Ui(t))throw TypeError("Invalid UUID");let e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var vO=FB;var Vt=[];for(let t=0;t<256;++t)Vt.push((t+256).toString(16).slice(1));function cu(t,e=0){return(Vt[t[e+0]]+Vt[t[e+1]]+Vt[t[e+2]]+Vt[t[e+3]]+"-"+Vt[t[e+4]]+Vt[t[e+5]]+"-"+Vt[t[e+6]]+Vt[t[e+7]]+"-"+Vt[t[e+8]]+Vt[t[e+9]]+"-"+Vt[t[e+10]]+Vt[t[e+11]]+Vt[t[e+12]]+Vt[t[e+13]]+Vt[t[e+14]]+Vt[t[e+15]]).toLowerCase()}import BB from"node:crypto";var fh=new Uint8Array(256),ph=fh.length;function Ad(){return ph>fh.length-16&&(BB.randomFillSync(fh),ph=0),fh.slice(ph,ph+=16)}function ZB(t){t=unescape(encodeURIComponent(t));let e=[];for(let r=0;rDn&&t.msecs===void 0&&(Dn=s,a!==null&&(c=null,u=null)),a!==null&&(a>2147483647&&(a=2147483647),c=a>>>19&4095,u=a&524287),(c===null||u===null)&&(c=i[6]&127,c=c<<8|i[7],u=i[8]&63,u=u<<8|i[9],u=u<<5|i[10]>>>3),s+1e4>Dn&&a===null?++u>524287&&(u=0,++c>4095&&(c=0,Dn++)):Dn=s,xO=c,wO=u,o[n++]=Dn/1099511627776&255,o[n++]=Dn/4294967296&255,o[n++]=Dn/16777216&255,o[n++]=Dn/65536&255,o[n++]=Dn/256&255,o[n++]=Dn&255,o[n++]=c>>>4&15|112,o[n++]=c&255,o[n++]=u>>>13&63|128,o[n++]=u>>>5&255,o[n++]=u<<3&255|i[10]&7,o[n++]=i[11],o[n++]=i[12],o[n++]=i[13],o[n++]=i[14],o[n++]=i[15],e||cu(o)}var nx=XB;var YB={};G(YB,{BaseCallbackHandler:()=>la,callbackHandlerPrefersStreaming:()=>Od,isBaseCallbackHandler:()=>ox});var QB=class{};function Od(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var la=class extends QB{lc_serializable=!1;get lc_namespace(){return["langchain_core","callbacks",this.name]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eh(this.constructor)]}lc_kwargs;ignoreLLM=!1;ignoreChain=!1;ignoreAgent=!1;ignoreRetriever=!1;ignoreCustomEvent=!1;raiseError=!1;awaitHandlers=It("LANGCHAIN_CALLBACKS_BACKGROUND")==="false";constructor(t){super(),this.lc_kwargs=t||{},t&&(this.ignoreLLM=t.ignoreLLM??this.ignoreLLM,this.ignoreChain=t.ignoreChain??this.ignoreChain,this.ignoreAgent=t.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=t.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=t.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=t.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(t._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return uo.prototype.toJSON.call(this)}toJSONNotImplemented(){return uo.prototype.toJSONNotImplemented.call(this)}static fromMethods(t){class e extends la{name=Et();constructor(){super(),Object.assign(this,t)}}return new e}},ox=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"};var IO="gen_ai.operation.name",SO="gen_ai.system",ix="gen_ai.request.model",kO="gen_ai.response.model",sx="gen_ai.usage.input_tokens",ax="gen_ai.usage.output_tokens",cx="gen_ai.usage.total_tokens",TO="gen_ai.request.max_tokens",EO="gen_ai.request.temperature",AO="gen_ai.request.top_p",OO="gen_ai.request.frequency_penalty",PO="gen_ai.request.presence_penalty",CO="gen_ai.response.finish_reasons",RO="gen_ai.prompt",NO="gen_ai.completion",zO="gen_ai.request.extra_query",MO="gen_ai.request.extra_body",jO="gen_ai.serialized.name",DO="gen_ai.serialized.signature",LO="gen_ai.serialized.doc",UO="gen_ai.response.id",FO="gen_ai.response.service_tier",BO="gen_ai.response.system_fingerprint",ZO="gen_ai.usage.input_token_details",qO="gen_ai.usage.output_token_details",VO="langsmith.trace.session_id",GO="langsmith.trace.session_name",KO="langsmith.span.kind",HO="langsmith.trace.name",WO="langsmith.metadata",ux="langsmith.span.tags";var JO="langsmith.request.streaming",XO="langsmith.request.headers";var t6=(...t)=>fetch(...t),YO=Symbol.for("ls:fetch_implementation");var QO=()=>{let t=globalThis[YO];return t?typeof t=="function"&&"Headers"in t&&"Request"in t&&"Response"in t:!1},eP=t=>async(...e)=>{if(t||At("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[YO]??t6)(...e);return(t||At("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r};var Pd=()=>At("PROJECT")??Qr("LANGCHAIN_SESSION")??"default";var tP={};function uu(t){tP[t]||(console.warn(t),tP[t]=!0)}var r6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function $e(t,e){if(!r6.test(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}function mh(t){let e=typeof t=="string"?Date.parse(t):t;return nx({msecs:e,seq:0})}var hh="0.3.82";var po,n6=()=>typeof window<"u"&&typeof window.document<"u",o6=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",i6=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),rP=()=>typeof Deno<"u",s6=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!rP(),px=()=>po||(typeof Bun<"u"?po="bun":n6()?po="browser":s6()?po="node":o6()?po="webworker":i6()?po="jsdom":rP()?po="deno":po="other",po),lx;function gh(){if(lx===void 0){let t=px(),e=c6();lx={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:hh,...e}}return lx}function fx(){let t=a6(),e={},r=["LANGCHAIN_API_KEY","LANGCHAIN_ENDPOINT","LANGCHAIN_TRACING_V2","LANGCHAIN_PROJECT","LANGCHAIN_SESSION","LANGSMITH_API_KEY","LANGSMITH_ENDPOINT","LANGSMITH_TRACING_V2","LANGSMITH_PROJECT","LANGSMITH_SESSION"];for(let[n,o]of Object.entries(t))typeof o=="string"&&!r.includes(n)&&!n.toLowerCase().includes("key")&&!n.toLowerCase().includes("secret")&&!n.toLowerCase().includes("token")&&(n==="LANGCHAIN_REVISION_ID"?e.revision_id=o:e[n]=o);return e}function a6(){let t={};try{if(typeof process<"u"&&process.env)for(let[e,r]of Object.entries(process.env))(e.startsWith("LANGCHAIN_")||e.startsWith("LANGSMITH_"))&&r!=null&&((e.toLowerCase().includes("key")||e.toLowerCase().includes("secret")||e.toLowerCase().includes("token"))&&typeof r=="string"?t[e]=r.slice(0,2)+"*".repeat(r.length-4)+r.slice(-2):t[e]=r)}catch{}return t}function Qr(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function At(t){return Qr(`LANGSMITH_${t}`)||Qr(`LANGCHAIN_${t}`)}var dx;function c6(){if(dx!==void 0)return dx;let t=["VERCEL_GIT_COMMIT_SHA","NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA","COMMIT_REF","RENDER_GIT_COMMIT","CI_COMMIT_SHA","CIRCLE_SHA1","CF_PAGES_COMMIT_SHA","REACT_APP_GIT_SHA","SOURCE_VERSION","GITHUB_SHA","TRAVIS_COMMIT","GIT_COMMIT","BUILD_VCS_NUMBER","bamboo_planRepository_revision","Build.SourceVersion","BITBUCKET_COMMIT","DRONE_COMMIT_SHA","SEMAPHORE_GIT_SHA","BUILDKITE_COMMIT"],e={};for(let r of t){let n=Qr(r);n!==void 0&&(e[r]=n)}return dx=e,e}function _h(){return Qr("OTEL_ENABLED")==="true"||At("OTEL_ENABLED")==="true"}var gx=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&_h()&&(console.warn('You have enabled OTEL export via the `OTEL_ENABLED` or `LANGSMITH_OTEL_ENABLED` environment variable, but have not initialized the required OTEL instances. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0);let n;if(r.length===1&&typeof r[0]=="function"?n=r[0]:r.length===2&&typeof r[1]=="function"?n=r[1]:r.length===3&&typeof r[2]=="function"&&(n=r[2]),typeof n=="function")return n()}},_x=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new gx})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},yx=class{active(){return{}}with(e,r){return r()}},mx=Symbol.for("ls:otel_trace"),hx=Symbol.for("ls:otel_context"),nP=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),u6=new _x,l6=new yx,vx=class{getTraceInstance(){return globalThis[mx]??u6}getContextInstance(){return globalThis[hx]??l6}initializeGlobalInstances(e){globalThis[mx]===void 0&&(globalThis[mx]=e.trace),globalThis[hx]===void 0&&(globalThis[hx]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[nP]=e}getDefaultOTLPTracerComponents(){return globalThis[nP]??void 0}},bx=new vx;function yh(){return bx.getTraceInstance()}function oP(){return bx.getContextInstance()}function iP(){return bx.getDefaultOTLPTracerComponents()}var d6={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};function p6(t){return d6[t]||t}var vh=class{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(e,r){for(let n of e)try{if(!n.run)continue;if(n.operation==="post"){let o=this.createSpanForRun(n,n.run,r.get(n.id));o&&!n.run.end_time&&this.spans.set(n.id,o)}else this.updateSpanForRun(n,n.run)}catch(o){console.error(`Error processing operation ${n.id}:`,o)}}createSpanForRun(e,r,n){let o=n&&yh().getSpan(n);if(o)try{return this.finishSpanSetup(o,r,e)}catch(i){console.error(`Failed to create span for run ${e.id}:`,i);return}}finishSpanSetup(e,r,n){return this.setSpanAttributes(e,r,n),r.error?(e.setStatus({code:2}),e.recordException(new Error(r.error))):e.setStatus({code:1}),r.end_time&&e.end(new Date(r.end_time)),e}updateSpanForRun(e,r){try{let n=this.spans.get(e.id);if(!n){console.debug(`No span found for run ${e.id} during update`);return}this.setSpanAttributes(n,r,e),r.error?(n.setStatus({code:2}),n.recordException(new Error(r.error))):n.setStatus({code:1});let o=r.end_time;o&&(n.end(new Date(o)),this.spans.delete(e.id))}catch(n){console.error(`Failed to update span for run ${e.id}:`,n)}}extractModelName(e){if(e.extra?.metadata){let r=e.extra.metadata;if(r.ls_model_name)return r.ls_model_name;if(r.invocation_params){let n=r.invocation_params;if(n.model)return n.model;if(n.model_name)return n.model_name}}}setSpanAttributes(e,r,n){if("run_type"in r&&r.run_type){e.setAttribute(KO,r.run_type);let a=p6(r.run_type||"chain");e.setAttribute(IO,a)}"name"in r&&r.name&&e.setAttribute(HO,r.name),"session_id"in r&&r.session_id&&e.setAttribute(VO,r.session_id),"session_name"in r&&r.session_name&&e.setAttribute(GO,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute(ix,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute(sx,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(ax,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(cx,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[a,c]of Object.entries(i))c!=null&&e.setAttribute(`${WO}.${a}`,String(c));let s=r.tags;if(s&&Array.isArray(s)?e.setAttribute(ux,s.join(", ")):s&&e.setAttribute(ux,String(s)),"serialized"in r&&typeof r.serialized=="object"){let a=r.serialized;a.name&&e.setAttribute(jO,String(a.name)),a.signature&&e.setAttribute(DO,String(a.signature)),a.doc&&e.setAttribute(LO,String(a.doc))}this.setIOAttributes(e,n)}setGenAiSystem(e,r){let n="langchain",o=this.extractModelName(r);if(o){let i=o.toLowerCase();i.includes("anthropic")||i.startsWith("claude")?n="anthropic":i.includes("bedrock")?n="aws.bedrock":i.includes("azure")&&i.includes("openai")?n="az.ai.openai":i.includes("azure")&&i.includes("inference")?n="az.ai.inference":i.includes("cohere")?n="cohere":i.includes("deepseek")?n="deepseek":i.includes("gemini")?n="gemini":i.includes("groq")?n="groq":i.includes("watson")||i.includes("ibm")?n="ibm.watsonx.ai":i.includes("mistral")?n="mistral_ai":i.includes("gpt")||i.includes("openai")?n="openai":i.includes("perplexity")||i.includes("sonar")?n="perplexity":i.includes("vertex")?n="vertex_ai":(i.includes("xai")||i.includes("grok"))&&(n="xai")}e.setAttribute(SO,n)}setInvocationParameters(e,r){if(!r.extra?.metadata?.invocation_params)return;let n=r.extra.metadata.invocation_params;n.max_tokens!==void 0&&e.setAttribute(TO,n.max_tokens),n.temperature!==void 0&&e.setAttribute(EO,n.temperature),n.top_p!==void 0&&e.setAttribute(AO,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(OO,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute(PO,n.presence_penalty)}setIOAttributes(e,r){if(r.run.inputs)try{let n=r.run.inputs;typeof n=="object"&&n!==null&&(n.model&&Array.isArray(n.messages)&&e.setAttribute(ix,n.model),n.stream!==void 0&&e.setAttribute(JO,n.stream),n.extra_headers&&e.setAttribute(XO,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute(zO,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(MO,JSON.stringify(n.extra_body))),e.setAttribute(RO,JSON.stringify(n))}catch(n){console.debug(`Failed to process inputs for run ${r.id}`,n)}if(r.run.outputs)try{let n=r.run.outputs,o=this.getUnifiedRunTokens(n);if(o&&(e.setAttribute(sx,o[0]),e.setAttribute(ax,o[1]),e.setAttribute(cx,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(kO,String(n.model)),n.id&&e.setAttribute(UO,n.id),n.choices&&Array.isArray(n.choices)){let i=n.choices.map(s=>s.finish_reason).filter(s=>s).map(String);i.length>0&&e.setAttribute(CO,i.join(", "))}if(n.service_tier&&e.setAttribute(FO,n.service_tier),n.system_fingerprint&&e.setAttribute(BO,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let i=n.usage_metadata;i.input_token_details&&e.setAttribute(ZO,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(qO,JSON.stringify(i.output_token_details))}}e.setAttribute(NO,JSON.stringify(n))}catch(n){console.debug(`Failed to process outputs for run ${r.id}`,n)}}getUnifiedRunTokens(e){if(!e)return null;let r=this.extractUnifiedRunTokens(e.usage_metadata);if(r)return r;let n=Object.keys(e);for(let s of n){let a=e[s];if(!(!a||typeof a!="object")&&(r=this.extractUnifiedRunTokens(a.usage_metadata),r||a.lc===1&&a.kwargs&&typeof a.kwargs=="object"&&(r=this.extractUnifiedRunTokens(a.kwargs.usage_metadata),r)))return r}let o=e.generations||[];if(!Array.isArray(o))return null;let i=Array.isArray(o[0])?o.flat():o;for(let s of i)if(typeof s=="object"&&s.message&&typeof s.message=="object"&&s.message.kwargs&&typeof s.message.kwargs=="object"&&(r=this.extractUnifiedRunTokens(s.message.kwargs.usage_metadata),r))return r;return null}extractUnifiedRunTokens(e){return!e||typeof e!="object"||typeof e.input_tokens!="number"||typeof e.output_tokens!="number"?null:[e.input_tokens,e.output_tokens]}};var f6=Object.prototype.toString,m6=t=>f6.call(t)==="[object Error]",h6=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function wx(t){if(!(t&&m6(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:h6.has(r)}function g6(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function bh(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(_),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},_=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&_.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function $x(t,e={}){if(e={...e},g6(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,bh("factor",e.factor,{min:0,allowInfinity:!1}),bh("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),bh("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),bh("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await y6({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var kh=mn(Sh(),1),T6=[408,425,429,500,502,503,504],Rd=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxQueueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.maxQueueSizeBytes=e.maxQueueSizeBytes,"default"in kh.default?this.queue=new kh.default.default({concurrency:this.maxConcurrency}):this.queue=new kh.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){return this.callWithOptions({},e,...r)}callWithOptions(e,r,...n){let o=e.sizeBytes??0;if(this.maxQueueSizeBytes!==void 0&&o>0&&this.queueSizeBytes+o>this.maxQueueSizeBytes)return Promise.reject(new Error(`Queue size limit (${this.maxQueueSizeBytes} bytes) exceeded. Current queue size: ${this.queueSizeBytes} bytes, attempted addition: ${o} bytes.`));o>0&&(this.queueSizeBytes+=o);let i=this.onFailedResponseHook,s=this.queue.add(()=>$x(()=>r(...n).catch(a=>{throw a instanceof Error?a:new Error(a)}),{async onFailedAttempt({error:a}){if(a.message.startsWith("Cancel")||a.message.startsWith("TimeoutError")||a.name==="TimeoutError"||a.message.startsWith("AbortError")||a?.code==="ECONNABORTED")throw a;let c=a?.response;if(i&&await i(c))return;let u=c?.status??a?.status;if(u&&!T6.includes(+u))throw a},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0});return o>0&&(s=s.finally(()=>{this.queueSizeBytes-=o})),e.signal?Promise.race([s,new Promise((a,c)=>{e.signal?.addEventListener("abort",()=>{c(new Error("AbortError"))})})]):s}};function Ox(t){return typeof t?._getType=="function"}function Px(t){let e={type:t._getType(),data:{content:t.content}};return t?.additional_kwargs&&Object.keys(t.additional_kwargs).length>0&&(e.data.additional_kwargs={...t.additional_kwargs}),e}var $q=mn(oR(),1);function Wo(t){if(!t||t.split("/").length>2||t.startsWith("/")||t.endsWith("/")||t.split(":").length>2)throw new Error(`Invalid identifier format: ${t}`);let[e,r]=t.split(":"),n=r||"latest";if(e.includes("/")){let[o,i]=e.split("/",2);if(!o||!i)throw new Error(`Invalid identifier format: ${t}`);return[o,i,n]}else{if(!e)throw new Error(`Invalid identifier format: ${t}`);return["-",e,n]}}var Xx=class extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}};async function ue(t,e,r){let n;if(t.ok){r&&(n=await t.text());return}if(t.status===403)try{(await t.json())?.error==="org_scoped_key_requires_workspace"&&(n="This API key is org-scoped and requires workspace specification. Please provide 'workspaceId' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.")}catch{let a=new Error(`${t.status} ${t.statusText}`);throw a.status=t?.status,a}if(n===void 0)try{n=await t.text()}catch{n=""}let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Message: ${n}`;if(t.status===409)throw new Xx(o);let i=new Error(o);throw i.status=t.status,i}var iR="ERR_CONFLICTING_ENDPOINTS",Lh=class extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:iR}),this.name="ConflictingEndpointsError"}};function sR(t){return typeof t=="object"&&t!==null&&t.code===iR}var aR="[...]",Iq={result:"[Circular]"},Fh=[],du=[],Sq=new TextEncoder;function kq(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Uh(t){return Sq.encode(t)}function cR(t){if(t&&typeof t=="object"&&t!==null){if(t instanceof Map)return Object.fromEntries(t);if(t instanceof Set)return Array.from(t);if(t instanceof Date)return t.toISOString();if(t instanceof RegExp)return t.toString();if(t instanceof Error)return{name:t.name,message:t.message}}else if(typeof t=="bigint")return t.toString();return t}function Tq(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return cR(r)}}function Pr(t,e,r,n,o){try{let i=JSON.stringify(t,Tq(r),n);return Uh(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?` +Context: ${e}`:""}`),Uh("[Unserializable]");At("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?` +Context: ${e}`:""}`),typeof o>"u"&&(o=kq()),Qx(t,"",0,[],void 0,0,o);let s;try{du.length===0?s=JSON.stringify(t,r,n):s=JSON.stringify(t,Eq(r),n)}catch{return Uh("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Fh.length!==0;){let a=Fh.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return Uh(s)}}function Yx(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),Fh.push([n,r,e,o])):du.push([e,r,t]):(n[r]=t,Fh.push([n,r,e]))}function Qx(t,e,r,n,o,i,s){i+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;as.depthLimit){Yx(aR,t,e,o);return}if(typeof s.edgesLimit<"u"&&r+1>s.edgesLimit){Yx(aR,t,e,o);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n{let e=t?.toString()??At("TRACING_SAMPLING_RATE");if(e===void 0)return;let r=parseFloat(e);if(r<0||r>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${r}`);return r},Oq=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};async function Pq(t){let e=[];for await(let r of t)e.push(r);return e}function Bh(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}var Cq=async t=>{if(t?.status===429){let e=parseInt(t.headers.get("retry-after")??"10",10)*1e3;if(e>0)return await new Promise(r=>setTimeout(r,e)),!0}return!1};function lR(t){return typeof t=="number"?Number(t.toFixed(4)):t}var Rq=24*1024*1024,fR=1024*1024*1024,Nq=1e4,zq=100,dR="https://api.smith.langchain.com",e0=class{constructor(e){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSizeBytes=e??fR}peek(){return this.items[0]}push(e){let r,n=new Promise(i=>{r=i}),o=Pr(e.item,`Serializing run with id: ${e.item.id}`).length;return this.sizeBytes+o>this.maxSizeBytes&&this.items.length>0?(console.warn(`AutoBatchQueue size limit (${this.maxSizeBytes} bytes) exceeded. Dropping run with id: ${e.item.id}. Current queue size: ${this.sizeBytes} bytes, attempted addition: ${o} bytes.`),r(),n):(this.items.push({action:e.action,payload:e.item,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n)}pop({upToSizeBytes:e,upToSize:r}){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let n=[],o=0;for(;o+(this.peek()?.size??0)0&&n.length0){let i=this.items.shift();n.push(i),o+=i.size,this.sizeBytes-=i.size}return[n.map(i=>({action:i.action,item:i.payload,otelContext:i.otelContext,apiKey:i.apiKey,apiUrl:i.apiUrl,size:i.size})),()=>n.forEach(i=>i.itemPromiseResolve())]}},da=class t{get _fetch(){return this.fetchImplementation||eP(this.debug)}constructor(e={}){Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"webUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"workspaceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchIngestCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout_ms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tenantId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filteredPostUuids",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchAggregationDelayMs",{enumerable:!0,configurable:!0,writable:!0,value:250}),Object.defineProperty(this,"batchSizeBytesLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSizeLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"blockOnRootRunFinalization",{enumerable:!0,configurable:!0,writable:!0,value:Qr("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"langSmithToOTELTranslator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchImplementation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cachedLSEnvVarsForMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Qr("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=Aq(e.tracingSamplingRate),this.apiUrl=Bh(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=Bh(e.apiKey??r.apiKey),this.webUrl=Bh(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=Bh(e.workspaceId??At("WORKSPACE_ID")),this.timeout_ms=e.timeout_ms??9e4,this.caller=new Rd({...e.callerOptions??{},maxRetries:4,debug:e.debug??this.debug}),this.traceBatchConcurrency=e.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.debug=e.debug??this.debug,this.fetchImplementation=e.fetchImplementation;let n=e.maxIngestMemoryBytes??fR;this.batchIngestCaller=new Rd({maxRetries:4,maxConcurrency:this.traceBatchConcurrency,maxQueueSizeBytes:n,...e.callerOptions??{},onFailedResponseHook:Cq,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.autoBatchQueue=new e0(n),this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.batchSizeLimit=e.batchSizeLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode,_h()&&(this.langSmithToOTELTranslator=new vh),this.cachedLSEnvVarsForMetadata=fx()}static getDefaultClientConfig(){let e=At("API_KEY"),r=At("ENDPOINT")??dR,n=At("HIDE_INPUTS")==="true",o=At("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:Oq(this.apiUrl)?(this.webUrl="http://localhost:3000",this.webUrl):this.apiUrl.endsWith("/api/v1")?(this.webUrl=this.apiUrl.replace("/api/v1",""),this.webUrl):this.apiUrl.includes("/api")&&!this.apiUrl.split(".",1)[0].endsWith("api")?(this.webUrl=this.apiUrl.replace("/api",""),this.webUrl):this.apiUrl.split(".",1)[0].includes("dev")?(this.webUrl="https://dev.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("eu")?(this.webUrl="https://eu.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("beta")?(this.webUrl="https://beta.smith.langchain.com",this.webUrl):(this.webUrl="https://smith.langchain.com",this.webUrl)}get headers(){let e={"User-Agent":`langsmith-js/${hh}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),this.workspaceId&&(e["x-tenant-id"]=this.workspaceId),e}_getPlatformEndpointPath(e){return this.apiUrl.slice(-3)!=="/v1"&&this.apiUrl.slice(-4)!=="/v1/"?`/v1/platform/${e}`:`/platform/${e}`}async processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}async processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}async prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`;return await this.caller.call(async()=>{let s=await this._fetch(o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,`fetch ${e}`),s})}async _get(e,r){return(await this._getResponse(e,r)).json()}async*_getPaginated(e,r=new URLSearchParams,n){let o=Number(r.get("offset"))||0,i=Number(r.get("limit"))||100;for(;;){r.set("offset",String(o)),r.set("limit",String(i));let s=`${this.apiUrl}${e}?${r}`,a=await this.caller.call(async()=>{let u=await this._fetch(s,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(u,`fetch ${e}`),u}),c=n?n(await a.json()):await a.json();if(c.length===0||(yield c,c.length{let l=await this._fetch(`${this.apiUrl}${e}`,{method:n,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(l,`fetch ${e}`),l})).json();if(!c||!c[o])break;yield c[o];let u=c.cursors;if(!u||!u.next)break;i.cursor=u.next}}_shouldSample(){return this.tracingSampleRate===void 0?!0:Math.random()0;){let[o,i]=this.autoBatchQueue.pop({upToSizeBytes:e,upToSize:r});if(!o.length){i();break}let s=o.reduce((u,l)=>{let d=l.apiUrl??this.apiUrl,f=l.apiKey??this.apiKey,m=l.apiKey===this.apiKey&&l.apiUrl===this.apiUrl?"default":`${d}|${f}`;return u[m]||(u[m]=[]),u[m].push(l),u},{}),a=[];for(let[u,l]of Object.entries(s)){let d=this._processBatch(l,{apiUrl:u==="default"?void 0:u.split("|")[0],apiKey:u==="default"?void 0:u.split("|")[1]});a.push(d)}let c=Promise.all(a).finally(i);n.push(c)}return Promise.all(n)}async _processBatch(e,r){if(!e.length)return;let n=e.reduce((o,i)=>o+(i.size??0),0);try{if(this.langSmithToOTELTranslator!==void 0)this._sendBatchToOTELTranslator(e);else{let o={runCreates:e.filter(s=>s.action==="create").map(s=>s.item),runUpdates:e.filter(s=>s.action==="update").map(s=>s.item)},i=await this._ensureServerInfo();if(i?.batch_ingest_config?.use_multipart_endpoint){let s=i?.instance_flags?.gzip_body_enabled;await this.multipartIngestRuns(o,{...r,useGzip:s,sizeBytes:n})}else await this.batchIngestRuns(o,{...r,sizeBytes:n})}}catch(o){console.error("Error exporting batch:",o)}}_sendBatchToOTELTranslator(e){if(this.langSmithToOTELTranslator!==void 0){let r=new Map,n=[];for(let o of e)o.item.id&&o.otelContext&&(r.set(o.item.id,o.otelContext),o.action==="create"?n.push({operation:"post",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}):n.push({operation:"patch",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}));this.langSmithToOTELTranslator.exportBatch(n,r)}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.item=uR(e.item,this.cachedLSEnvVarsForMetadata);let r=this.autoBatchQueue.push(e);if(this.manualFlushMode)return r;let n=await this._getBatchSizeLimitBytes(),o=await this._getBatchSizeLimit();return(this.autoBatchQueue.sizeBytes>n||this.autoBatchQueue.items.length>o)&&this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o}),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o})},this.autoBatchAggregationDelayMs)),r}async _getServerInfo(){let r=await(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(Nq),...this.fetchOptions});return await ue(n,"get server info"),n})).json();return this.debug&&console.log(` +=== LangSmith Server Configuration === +`+JSON.stringify(r,null,2)+` +`),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch(e){console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${e.status??"Unspecified status code"} ${e.message}`)}return this._serverInfo??{}})()),this._getServerInfoPromise.then(e=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),e))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let e=await this._getBatchSizeLimitBytes(),r=await this._getBatchSizeLimit();await this.drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:r})}_cloneCurrentOTELContext(){let e=yh(),r=oP();if(this.langSmithToOTELTranslator!==void 0){let n=e.getActiveSpan();if(n)return e.setSpan(r.active(),n)}}async createRun(e,r){if(!this._filterForSampling([e]).length)return;let n={...this.headers,"Content-Type":"application/json"},o=e.project_name;delete e.project_name;let i=await this.prepareRunCreateOrUpdateInputs({session_name:o,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&i.trace_id!==void 0&&i.dotted_order!==void 0){let c=this._cloneCurrentOTELContext();this.processRunOperation({action:"create",item:i,otelContext:c,apiKey:r?.apiKey,apiUrl:r?.apiUrl}).catch(console.error);return}let s=uR(i,this.cachedLSEnvVarsForMetadata);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),r?.workspaceId!==void 0&&(n["x-tenant-id"]=r.workspaceId);let a=Pr(s,`Creating run with id: ${s.id}`);await this.caller.call(async()=>{let c=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"create run",!0),c})}async batchIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o=await Promise.all(e?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]),i=await Promise.all(r?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]);if(o.length>0&&i.length>0){let c=o.reduce((l,d)=>(d.id&&(l[d.id]=d),l),{}),u=[];for(let l of i)l.id!==void 0&&c[l.id]?c[l.id]={...c[l.id],...l}:u.push(l);o=Object.values(c),i=u}let s={post:o,patch:i};if(!s.post.length&&!s.patch.length)return;let a={post:[],patch:[]};for(let c of["post","patch"]){let u=c,l=s[u].reverse(),d=l.pop();for(;d!==void 0;)a[u].push(d),d=l.pop()}if(a.post.length>0||a.patch.length>0){let c=a.post.map(u=>u.id).concat(a.patch.map(u=>u.id)).join(",");await this._postBatchIngestRuns(Pr(a,`Ingesting runs with ids: ${c}`),n)}}async _postBatchIngestRuns(e,r){let n={...this.headers,"Content-Type":"application/json",Accept:"application/json"};r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),await this.batchIngestCaller.callWithOptions({sizeBytes:r?.sizeBytes},async()=>{let o=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:e});return await ue(o,"batch create run",!0),o})}async multipartIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o={},i=[];for(let d of e??[]){let f=await this.prepareRunCreateOrUpdateInputs(d);f.id!==void 0&&f.attachments!==void 0&&(o[f.id]=f.attachments),delete f.attachments,i.push(f)}let s=[];for(let d of r??[])s.push(await this.prepareRunCreateOrUpdateInputs(d));if(i.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(s.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(i.length>0&&s.length>0){let d=i.reduce((p,m)=>(m.id&&(p[m.id]=m),p),{}),f=[];for(let p of s)p.id!==void 0&&d[p.id]?d[p.id]={...d[p.id],...p}:f.push(p);i=Object.values(d),s=f}if(i.length===0&&s.length===0)return;let u=[],l=[];for(let[d,f]of[["post",i],["patch",s]])for(let p of f){let{inputs:m,outputs:h,events:_,extra:v,error:b,serialized:x,attachments:k,...T}=p,F={inputs:m,outputs:h,events:_,extra:v,error:b,serialized:x},J=Pr(T,`Serializing for multipart ingestion of run with id: ${T.id}`);l.push({name:`${d}.${T.id}`,payload:new Blob([J],{type:`application/json; length=${J.length}`})});for(let[w,Z]of Object.entries(F)){if(Z===void 0)continue;let oe=Pr(Z,`Serializing ${w} for multipart ingestion of run with id: ${T.id}`);l.push({name:`${d}.${T.id}.${w}`,payload:new Blob([oe],{type:`application/json; length=${oe.length}`})})}if(T.id!==void 0){let w=o[T.id];if(w){delete o[T.id];for(let[Z,oe]of Object.entries(w)){let Q,wt;if(Array.isArray(oe)?[Q,wt]=oe:(Q=oe.mimeType,wt=oe.data),Z.includes(".")){console.warn(`Skipping attachment '${Z}' for run ${T.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}l.push({name:`attachment.${T.id}.${Z}`,payload:new Blob([wt],{type:`${Q}; length=${wt.byteLength}`})})}}}u.push(`trace=${T.trace_id},id=${T.id}`)}await this._sendMultipartRequest(l,u.join("; "),n)}async _createNodeFetchBody(e,r){let n=[];for(let s of e)n.push(new Blob([`--${r}\r +`])),n.push(new Blob([`Content-Disposition: form-data; name="${s.name}"\r +`,`Content-Type: ${s.payload.type}\r +\r +`])),n.push(s.payload),n.push(new Blob([`\r +`]));return n.push(new Blob([`--${r}--\r +`])),await new Blob(n).arrayBuffer()}async _createMultipartStream(e,r){let n=new TextEncoder;return new ReadableStream({async start(i){let s=async a=>{typeof a=="string"?i.enqueue(n.encode(a)):i.enqueue(a)};for(let a of e){await s(`--${r}\r +`),await s(`Content-Disposition: form-data; name="${a.name}"\r +`),await s(`Content-Type: ${a.payload.type}\r +\r +`);let u=a.payload.stream().getReader();try{let l;for(;!(l=await u.read()).done;)i.enqueue(l.value)}finally{u.releaseLock()}await s(`\r +`)}await s(`--${r}--\r +`),i.close()}})}async _sendMultipartRequest(e,r,n){let o="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),i=QO(),s=()=>this._createNodeFetchBody(e,o),a=()=>this._createMultipartStream(e,o),c=async u=>this.batchIngestCaller.callWithOptions({sizeBytes:n?.sizeBytes},async()=>{let l=await u(),d={...this.headers,"Content-Type":`multipart/form-data; boundary=${o}`};n?.apiKey!==void 0&&(d["x-api-key"]=n.apiKey);let f=l;n?.useGzip&&typeof l=="object"&&"pipeThrough"in l&&(f=l.pipeThrough(new CompressionStream("gzip")),d["Content-Encoding"]="gzip");let p=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:d,body:f,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(p,"Failed to send multipart request",!0),p});try{let u,l=!1;!i&&!this.multipartStreamingDisabled&&px()!=="bun"?(l=!0,u=await c(a)):u=await c(s),(!this.multipartStreamingDisabled||l)&&u.status===422&&(n?.apiUrl??this.apiUrl)!==dR&&(console.warn(`Streaming multipart upload to ${n?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${r}".`),this.multipartStreamingDisabled=!0,u=await c(s))}catch(u){console.warn(`${u.message.trim()} + +Context: ${r}`)}}async updateRun(e,r,n){$e(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let o={...r,id:e};if(!this._filterForSampling([o],!0).length)return;if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){let a=this._cloneCurrentOTELContext();if(r.end_time!==void 0&&o.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}else this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}let i={...this.headers,"Content-Type":"application/json"};n?.apiKey!==void 0&&(i["x-api-key"]=n.apiKey),n?.workspaceId!==void 0&&(i["x-tenant-id"]=n.workspaceId);let s=Pr(r,`Serializing payload to update run with id: ${e}`);await this.caller.call(async()=>{let a=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(a,"update run",!0),a})}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){$e(e);let n=await this._get(`/runs/${e}`);return r&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:r,projectOpts:n}){if(r!==void 0){let o;r.session_id?o=r.session_id:n?.projectName?o=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?o=n?.projectId:o=(await this.readProject({projectName:At("PROJECT")||"default"})).id;let i=await this._getTenantId();return`${this.getHostUrl()}/o/${i}/projects/p/${o}/r/${r.id}?poll=true`}else if(e!==void 0){let o=await this.readRun(e);if(!o.app_path)throw new Error(`Run ${e} has no app_path`);return`${this.getHostUrl()}${o.app_path}`}else throw new Error("Must provide either runId or run")}async _loadChildRuns(e){let r=await Pq(this.listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),n={},o={};r.sort((i,s)=>(i?.dotted_order??"").localeCompare(s?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.dotted_order?.startsWith(e.dotted_order??"")&&i.id!==e.id&&(i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i)}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:s,startTime:a,executionOrder:c,isRoot:u,runType:l,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:_,limit:v,select:b,order:x}=e,k=[];if(r&&(k=Array.isArray(r)?r:[r]),n){let w=Array.isArray(n)?n:[n],Z=await Promise.all(w.map(oe=>this.readProject({projectName:oe}).then(Q=>Q.id)));k.push(...Z)}let T=["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],F={session:k.length?k:null,run_type:l,reference_example:s,query:p,filter:m,trace_filter:h,tree_filter:_,execution_order:c,parent_run:o,start_time:a?a.toISOString():null,error:d,id:f,limit:v,trace:i,select:b||T,is_root:u,order:x};F.select.includes("child_run_ids")&&uu("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let J=0;for await(let w of this._getCursorPaginatedList("/runs/query",F))if(v){if(J>=v)break;if(w.length+J>v){yield*w.slice(0,v-J);break}J+=w.length,yield*w}else yield*w}async*listGroupRuns(e){let{projectId:r,projectName:n,groupBy:o,filter:i,startTime:s,endTime:a,limit:c,offset:u}=e,d={session_id:r||(await this.readProject({projectName:n})).id,group_by:o,filter:i,start_time:s?s.toISOString():null,end_time:a?a.toISOString():null,limit:Number(c)||100},f=Number(u)||0,p="/runs/group",m=`${this.apiUrl}${p}`;for(;;){let h={...d,offset:f},_=Object.fromEntries(Object.entries(h).filter(([F,J])=>J!==void 0)),v=JSON.stringify(_),x=await(await this.caller.call(async()=>{let F=await this._fetch(m,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:v});return await ue(F,`Failed to fetch ${p}`),F})).json(),{groups:k,total:T}=x;if(k.length===0)break;for(let F of k)yield F;if(f+=k.length,f>=T)break}}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:s,referenceExampleIds:a,startTime:c,endTime:u,error:l,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:_}){let v=s||[];i&&(v=[...s||[],...await Promise.all(i.map(J=>this.readProject({projectName:J}).then(w=>w.id)))]);let x=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:v,reference_example:a,start_time:c,end_time:u,error:l,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:_}).filter(([J,w])=>w!==void 0)),k=JSON.stringify(x);return await(await this.caller.call(async()=>{let J=await this._fetch(`${this.apiUrl}/runs/stats`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:k});return await ue(J,"get run stats"),J})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||Et()};$e(e);let o=JSON.stringify(n),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ue(a,"share run"),a})).json();if(s===null||!("share_token"in s))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${s.share_token}/r`}async unshareRun(e){$e(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"unshare run",!0),r})}async readRunSharedLink(e){$e(e);let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"read run shared link"),o})).json();if(!(n===null||!("share_token"in n)))return`${this.getHostUrl()}/public/${n.share_token}/r`}async listSharedRuns(e,{runIds:r}={}){let n=new URLSearchParams({share_token:e});if(r!==void 0)for(let s of r)n.append("id",s);return $e(e),await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"list shared runs"),s})).json()}async readDatasetSharedSchema(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id),$e(e);let o=await(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,"read dataset shared schema"),i})).json();return o.url=`${this.getHostUrl()}/public/${o.share_token}/d`,o}async shareDataset(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id);let n={dataset_id:e};$e(e);let o=JSON.stringify(n),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ue(a,"share dataset"),a})).json();return s.url=`${this.getHostUrl()}/public/${s.share_token}/d`,s}async unshareDataset(e){$e(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"unshare dataset",!0),r})}async readSharedDataset(e){return $e(e),await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"read shared dataset"),o})).json()}async listSharedExamples(e,r){let n={};r?.exampleIds&&(n.id=r.exampleIds);let o=new URLSearchParams;Object.entries(n).forEach(([a,c])=>{Array.isArray(c)?c.forEach(u=>o.append(a,u)):o.append(a,c)});let i=await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/public/${e}/examples?${o.toString()}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(a,"list shared examples"),a}),s=await i.json();if(!i.ok)throw"detail"in s?new Error(`Failed to list shared examples. +Status: ${i.status} +Message: ${Array.isArray(s.detail)?s.detail.join(` +`):"Unspecified error"}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return s.map(a=>({...a,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:r=null,metadata:n=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:s=null}){let a=o?"?upsert=true":"",c=`${this.apiUrl}/sessions${a}`,u=i||{};n&&(u.metadata=n);let l={name:e,extra:u,description:r};s!==null&&(l.reference_dataset_id=s);let d=JSON.stringify(l);return await(await this.caller.call(async()=>{let m=await this._fetch(c,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:d});return await ue(m,"create project"),m})).json()}async updateProject(e,{name:r=null,description:n=null,metadata:o=null,projectExtra:i=null,endTime:s=null}){let a=`${this.apiUrl}/sessions/${e}`,c=i;o&&(c={...c||{},metadata:o});let u=JSON.stringify({name:r,extra:c,description:n,end_time:s?new Date(s).toISOString():null});return await(await this.caller.call(async()=>{let f=await this._fetch(a,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"update project"),f})).json()}async hasProject({projectId:e,projectName:r}){let n="/sessions",o=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)$e(e),n+=`/${e}`;else if(r!==void 0)o.append("name",r);else throw new Error("Must provide projectName or projectId");let i=await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${n}?${o}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"has project"),s});try{let s=await i.json();return i.ok?Array.isArray(s)?s.length>0:!0:!1}catch{return!1}}async readProject({projectId:e,projectName:r,includeStats:n}){let o="/sessions",i=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)$e(e),o+=`/${e}`;else if(r!==void 0)i.append("name",r);else throw new Error("Must provide projectName or projectId");n!==void 0&&i.append("include_stats",n.toString());let s=await this._get(o,i),a;if(Array.isArray(s)){if(s.length===0)throw new Error(`Project[id=${e}, name=${r}] not found`);a=s[0]}else a=s;return a}async getProjectUrl({projectId:e,projectName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either projectName or projectId");let n=await this.readProject({projectId:e,projectName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/projects/p/${n.id}`}async getDatasetUrl({datasetId:e,datasetName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");let n=await this.readDataset({datasetId:e,datasetName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/datasets/${n.id}`}async _getTenantId(){if(this._tenantId!==null)return this._tenantId;let e=new URLSearchParams({limit:"1"});for await(let r of this._getPaginated("/sessions",e))return this._tenantId=r[0].tenant_id,r[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:e,name:r,nameContains:n,referenceDatasetId:o,referenceDatasetName:i,includeStats:s,datasetVersion:a,referenceFree:c,metadata:u}={}){let l=new URLSearchParams;if(e!==void 0)for(let d of e)l.append("id",d);if(r!==void 0&&l.append("name",r),n!==void 0&&l.append("name_contains",n),o!==void 0)l.append("reference_dataset",o);else if(i!==void 0){let d=await this.readDataset({datasetName:i});l.append("reference_dataset",d.id)}s!==void 0&&l.append("include_stats",s.toString()),a!==void 0&&l.append("dataset_version",a),c!==void 0&&l.append("reference_free",c.toString()),u!==void 0&&l.append("metadata",JSON.stringify(u));for await(let d of this._getPaginated("/sessions",l))yield*d}async deleteProject({projectId:e,projectName:r}){let n;if(e===void 0&&r===void 0)throw new Error("Must provide projectName or projectId");if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");e===void 0?n=(await this.readProject({projectName:r})).id:n=e,$e(n),await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,`delete session ${n} (${r})`,!0),o})}async uploadCsv({csvFile:e,fileName:r,inputKeys:n,outputKeys:o,description:i,dataType:s,name:a}){let c=`${this.apiUrl}/datasets/upload`,u=new FormData;return u.append("file",e,r),n.forEach(f=>{u.append("input_keys",f)}),o.forEach(f=>{u.append("output_keys",f)}),i&&u.append("description",i),s&&u.append("data_type",s),a&&u.append("name",a),await(await this.caller.call(async()=>{let f=await this._fetch(c,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"upload CSV"),f})).json()}async createDataset(e,{description:r,dataType:n,inputsSchema:o,outputsSchema:i,metadata:s}={}){let a={name:e,description:r,extra:s?{metadata:s}:void 0};n&&(a.data_type=n),o&&(a.inputs_schema_definition=o),i&&(a.outputs_schema_definition=i);let c=JSON.stringify(a);return await(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(d,"create dataset"),d})).json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e&&r)throw new Error("Must provide either datasetName or datasetId, not both");if(e)$e(e),n+=`/${e}`;else if(r)o.append("name",r);else throw new Error("Must provide datasetName or datasetId");let i=await this._get(n,o),s;if(Array.isArray(i)){if(i.length===0)throw new Error(`Dataset[id=${e}, name=${r}] not found`);s=i[0]}else s=i;return s}async hasDataset({datasetId:e,datasetName:r}){try{return await this.readDataset({datasetId:e,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:r,fromVersion:n,toVersion:o}){let i=e;if(i===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:r})).id);let s=new URLSearchParams({from_version:typeof n=="string"?n:n.toISOString(),to_version:typeof o=="string"?o:o.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,s)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:r}){let n="/datasets";if(e===void 0)if(r!==void 0)e=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide either datasetName or datasetId");return(await(await this._getResponse(`${n}/${e}/openai_ft`)).text()).trim().split(` +`).map(a=>JSON.parse(a))}async*listDatasets({limit:e=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:s}={}){let a="/datasets",c=new URLSearchParams({limit:e.toString(),offset:r.toString()});if(n!==void 0)for(let u of n)c.append("id",u);o!==void 0&&c.append("name",o),i!==void 0&&c.append("name_contains",i),s!==void 0&&c.append("metadata",JSON.stringify(s));for await(let u of this._getPaginated(a,c))yield*u}async updateDataset(e){let{datasetId:r,datasetName:n,...o}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;$e(i);let s=JSON.stringify(o);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${i}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"update dataset"),c})).json()}async updateDatasetTag(e){let{datasetId:r,datasetName:n,asOf:o,tag:i}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let s=r??(await this.readDataset({datasetName:n})).id;$e(s);let a=JSON.stringify({as_of:typeof o=="string"?o:o.toISOString(),tag:i});await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${s}/tags`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"update dataset tags",!0),c})}async deleteDataset({datasetId:e,datasetName:r}){let n="/datasets",o=e;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(r!==void 0&&(o=(await this.readDataset({datasetName:r})).id),o!==void 0)$e(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");await this.caller.call(async()=>{let i=await this._fetch(this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,`delete ${n}`,!0),i})}async indexDataset({datasetId:e,datasetName:r,tag:n}){let o=e;if(!o&&!r)throw new Error("Must provide either datasetName or datasetId");if(o&&r)throw new Error("Must provide either datasetName or datasetId, not both");o||(o=(await this.readDataset({datasetName:r})).id),$e(o);let s=JSON.stringify({tag:n});await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${o}/index`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"index dataset"),c})).json()}async similarExamples(e,r,n,{filter:o}={}){let i={limit:n,inputs:e};o!==void 0&&(i.filter=o),$e(r);let s=JSON.stringify(i);return(await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${r}/search`,{headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,method:"POST",body:s});return await ue(u,"fetch similar examples"),u})).json()).examples}async createExample(e,r,n){if(pR(e)&&(r!==void 0||n!==void 0))throw new Error("Cannot provide outputs or options when using ExampleCreate object");let o=r?n?.datasetId:e.dataset_id,i=r?n?.datasetName:e.dataset_name;if(o===void 0&&i===void 0)throw new Error("Must provide either datasetName or datasetId");if(o!==void 0&&i!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");o===void 0&&(o=(await this.readDataset({datasetName:i})).id);let s=(r?n?.createdAt:e.created_at)||new Date,a;pR(e)?a=e:a={inputs:e,outputs:r,created_at:s?.toISOString(),id:n?.exampleId,metadata:n?.metadata,split:n?.split,source_run_id:n?.sourceRunId,use_source_run_io:n?.useSourceRunIO,use_source_run_attachments:n?.useSourceRunAttachments,attachments:n?.attachments};let c=await this._uploadExamplesMultipart(o,[a]);return await this.readExample(c.example_ids?.[0]??Et())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let b=e,x=b[0].dataset_id,k=b[0].dataset_name;if(x===void 0&&k===void 0)throw new Error("Must provide either datasetName or datasetId");if(x!==void 0&&k!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");x===void 0&&(x=(await this.readDataset({datasetName:k})).id);let T=await this._uploadExamplesMultipart(x,b);return await Promise.all(T.example_ids.map(J=>this.readExample(J)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:s,useSourceRunIOs:a,useSourceRunAttachments:c,attachments:u,exampleIds:l,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((b,x)=>({dataset_id:p,inputs:b,outputs:n?.[x],metadata:o?.[x],split:i?.[x],id:l?.[x],attachments:u?.[x],source_run_id:s?.[x],use_source_run_io:a?.[x],use_source_run_attachments:c?.[x]})),_=await this._uploadExamplesMultipart(p,h);return await Promise.all(_.example_ids.map(b=>this.readExample(b)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(s=>Ox(s)?Px(s):s),i=Ox(r)?Px(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){$e(e);let r=`/examples/${e}`,n=await this._get(r),{attachment_urls:o,...i}=n,s=i;return o&&(s.attachments=Object.entries(o).reduce((a,[c,u])=>(a[c.slice(11)]={presigned_url:u.presigned_url,mime_type:u.mime_type},a),{})),s}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:s,metadata:a,limit:c,offset:u,filter:l,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=o?typeof o=="string"?o:o?.toISOString():void 0;m&&p.append("as_of",m);let h=s??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let v of n)p.append("id",v);if(i!==void 0)for(let v of i)p.append("splits",v);if(a!==void 0){let v=JSON.stringify(a);p.append("metadata",v)}c!==void 0&&p.append("limit",c.toString()),u!==void 0&&p.append("offset",u.toString()),l!==void 0&&p.append("filter",l),d===!0&&["attachment_urls","outputs","metadata"].forEach(v=>p.append("select",v));let _=0;for await(let v of this._getPaginated("/examples",p)){for(let b of v){let{attachment_urls:x,...k}=b,T=k;x&&(T.attachments=Object.entries(x).reduce((F,[J,w])=>(F[J.slice(11)]={presigned_url:w.presigned_url,mime_type:w.mime_type||void 0},F),{})),yield T,_++}if(c!==void 0&&_>=c)break}}async deleteExample(e){$e(e);let r=`/examples/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,`delete ${r}`,!0),n})}async updateExample(e,r){let n;r?n=e:n=e.id,$e(n);let o;r?o={id:n,...r}:o=e;let i;return o.dataset_id!==void 0?i=o.dataset_id:i=(await this.readExample(n)).dataset_id,this._updateExamplesMultipart(i,[o])}async updateExamples(e){let r;return e[0].dataset_id===void 0?r=(await this.readExample(e[0].id)).dataset_id:r=e[0].dataset_id,this._updateExamplesMultipart(r,e)}async readDatasetVersion({datasetId:e,datasetName:r,asOf:n,tag:o}){let i;if(e?i=e:i=(await this.readDataset({datasetName:r})).id,$e(i),n&&o||!n&&!o)throw new Error("Exactly one of asOf and tag must be specified.");let s=new URLSearchParams;return n!==void 0&&s.append("as_of",typeof n=="string"?n:n.toISOString()),o!==void 0&&s.append("tag",o),await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${i}/version?${s.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(c,"read dataset version"),c})).json()}async listDatasetSplits({datasetId:e,datasetName:r,asOf:n}){let o;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?o=(await this.readDataset({datasetName:r})).id:o=e,$e(o);let i=new URLSearchParams,s=n?typeof n=="string"?n:n?.toISOString():void 0;return s&&i.append("as_of",s),await this._get(`/datasets/${o}/splits`,i)}async updateDatasetSplits({datasetId:e,datasetName:r,splitName:n,exampleIds:o,remove:i=!1}){let s;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?s=(await this.readDataset({datasetName:r})).id:s=e,$e(s);let a={split_name:n,examples:o.map(u=>($e(u),u)),remove:i},c=JSON.stringify(a);await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${s}/splits`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(u,"update dataset splits",!0),u})}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){uu("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let s;if(typeof e=="string")s=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)s=e;else throw new Error(`Invalid run type: ${typeof e}`);s.reference_example_id!==null&&s.reference_example_id!==void 0&&(i=await this.readExample(s.reference_example_id));let a=await r.evaluateRun(s,i),[c,u]=await this._logEvaluationFeedback(a,s,n);return u[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:s,sourceInfo:a,feedbackSourceType:c="api",sourceRunId:u,feedbackId:l,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:c??"api",metadata:a??{}};u!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:u}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&$e(m.metadata.__run.run_id);let h={id:l??Et(),run_id:e,key:r,score:lR(n),value:o,correction:i,comment:s,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},_=JSON.stringify(h),v=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{let b=await this._fetch(v,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:_});return await ue(b,"create feedback",!0),b}),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let s={};r!=null&&(s.score=lR(r)),n!=null&&(s.value=n),o!=null&&(s.correction=o),i!=null&&(s.comment=i),$e(e);let a=JSON.stringify(s);await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"update feedback",!0),c})}async readFeedback(e){$e(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){$e(e);let r=`/feedback/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,`delete ${r}`,!0),n})}async*listFeedback({runIds:e,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(e)for(let i of e)$e(i),o.append("run",i);if(r)for(let i of r)o.append("key",i);if(n)for(let i of n)o.append("source",i);for await(let i of this._getPaginated("/feedback",o))yield*i}async createPresignedFeedbackToken(e,r,{expiration:n,feedbackConfig:o}={}){let i={run_id:e,feedback_key:r,feedback_config:o};n?typeof n=="string"?i.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(i.expires_in=n):i.expires_in={hours:3};let s=JSON.stringify(i);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"create presigned feedback token"),c})).json()}async createComparativeExperiment({name:e,experimentIds:r,referenceDatasetId:n,createdAt:o,description:i,metadata:s,id:a}){if(r.length===0)throw new Error("At least one experiment is required");if(n||(n=(await this.readProject({projectId:r[0]})).reference_dataset_id),!n==null)throw new Error("A reference dataset is required");let c={id:a,name:e,experiment_ids:r,reference_dataset_id:n,description:i,created_at:(o??new Date)?.toISOString(),extra:{}};s&&(c.extra.metadata=s);let u=JSON.stringify(c);return(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(d,"create comparative experiment"),d})).json()}async*listPresignedFeedbackTokens(e){$e(e);let r=new URLSearchParams({run_id:e});for await(let n of this._getPaginated("/feedback/tokens",r))yield*n}_selectEvalResults(e){let r;return"results"in e?r=e.results:Array.isArray(e)?r=e:r=[e],r}async _logEvaluationFeedback(e,r,n){let o=this._selectEvalResults(e),i=[];for(let s of o){let a=n||{};s.evaluatorInfo&&(a={...s.evaluatorInfo,...a});let c=null;s.targetRunId?c=s.targetRunId:r&&(c=r.id),i.push(await this.createFeedback(c,s.key,{score:s.score,value:s.value,comment:s.comment,correction:s.correction,sourceInfo:a,sourceRunId:s.sourceRunId,feedbackConfig:s.feedbackConfig,feedbackSourceType:"model"}))}return[o,i]}async logEvaluationFeedback(e,r,n){let[o]=await this._logEvaluationFeedback(e,r,n);return o}async*listAnnotationQueues(e={}){let{queueIds:r,name:n,nameContains:o,limit:i}=e,s=new URLSearchParams;r&&r.forEach((c,u)=>{$e(c,`queueIds[${u}]`),s.append("ids",c)}),n&&s.append("name",n),o&&s.append("name_contains",o),s.append("limit",(i!==void 0?Math.min(i,100):100).toString());let a=0;for await(let c of this._getPaginated("/annotation-queues",s))if(yield*c,a++,i!==void 0&&a>=i)break}async createAnnotationQueue(e){let{name:r,description:n,queueId:o,rubricInstructions:i}=e,s={name:r,description:n,id:o||Et(),rubric_instructions:i},a=JSON.stringify(Object.fromEntries(Object.entries(s).filter(([u,l])=>l!==void 0)));return(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(u,"create annotation queue"),u})).json()}async readAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"read annotation queue"),n})).json()}async updateAnnotationQueue(e,r){let{name:n,description:o,rubricInstructions:i}=r,s=JSON.stringify({name:n,description:o,rubric_instructions:i});await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(a,"update annotation queue",!0),a})}async deleteAnnotationQueue(e){await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"delete annotation queue",!0),r})}async addRunsToAnnotationQueue(e,r){let n=JSON.stringify(r.map((o,i)=>$e(o,`runIds[${i}]`).toString()));await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(o,"add runs to annotation queue",!0),o})}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${$e(e,"queueId")}/run`;return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,"get run from annotation queue"),i})).json()}async deleteRunFromAnnotationQueue(e,r){await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/runs/${$e(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"delete run from annotation queue",!0),n})}async getSizeFromAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"get size from annotation queue"),n})).json()}async _currentTenantIsOwner(e){let r=await this._getSettings();return e=="-"||r.tenant_handle===e}async _ownerConflictError(e,r){let n=await this._getSettings();return new Error(`Cannot ${e} for another tenant. + + Current tenant: ${n.tenant_handle} + + Requested tenant: ${r}`)}async _getLatestCommitHash(e){let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/commits/${e}/?limit=1&offset=0`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"get latest commit hash"),o})).json();if(n.commits.length!==0)return n.commits[0].commit_hash}async _likeOrUnlikePrompt(e,r){let[n,o,i]=Wo(e),s=JSON.stringify({like:r});return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/likes/${n}/${o}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,`${r?"like":"unlike"} prompt`),c})).json()}async _getPromptUrl(e){let[r,n,o]=Wo(e);if(await this._currentTenantIsOwner(r)){let i=await this._getSettings();return o!=="latest"?`${this.getHostUrl()}/prompts/${n}/${o.substring(0,8)}?organizationId=${i.id}`:`${this.getHostUrl()}/prompts/${n}?organizationId=${i.id}`}else return o!=="latest"?`${this.getHostUrl()}/hub/${r}/${n}/${o.substring(0,8)}`:`${this.getHostUrl()}/hub/${r}/${n}`}async promptExists(e){return!!await this.getPrompt(e)}async likePrompt(e){return this._likeOrUnlikePrompt(e,!0)}async unlikePrompt(e){return this._likeOrUnlikePrompt(e,!1)}async*listCommits(e){for await(let r of this._getPaginated(`/commits/${e}/`,new URLSearchParams,n=>n.commits))yield*r}async*listPrompts(e){let r=new URLSearchParams;r.append("sort_field",e?.sortField??"updated_at"),r.append("sort_direction","desc"),r.append("is_archived",(!!e?.isArchived).toString()),e?.isPublic!==void 0&&r.append("is_public",e.isPublic.toString()),e?.query&&r.append("query",e.query);for await(let n of this._getPaginated("/repos",r,o=>o.repos))yield*n}async getPrompt(e){let[r,n,o]=Wo(e),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return a?.status===404?null:(await ue(a,"get prompt"),a)}))?.json();return s?.repo?s.repo:null}async createPrompt(e,r){let n=await this._getSettings();if(r?.isPublic&&!n.tenant_handle)throw new Error(`Cannot create a public prompt without first + + creating a LangChain Hub handle. + You can add a handle by creating a public prompt at: + + https://smith.langchain.com/prompts`);let[o,i,s]=Wo(e);if(!await this._currentTenantIsOwner(o))throw await this._ownerConflictError("create a prompt",o);let a={repo_handle:i,...r?.description&&{description:r.description},...r?.readme&&{readme:r.readme},...r?.tags&&{tags:r.tags},is_public:!!r?.isPublic},c=JSON.stringify(a),u=await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(d,"create prompt"),d}),{repo:l}=await u.json();return l}async createCommit(e,r,n){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[o,i,s]=Wo(e),a=n?.parentCommitHash==="latest"||!n?.parentCommitHash?await this._getLatestCommitHash(`${o}/${i}`):n?.parentCommitHash,c={manifest:JSON.parse(JSON.stringify(r)),parent_commit:a},u=JSON.stringify(c),d=await(await this.caller.call(async()=>{let f=await this._fetch(`${this.apiUrl}/commits/${o}/${i}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"create commit"),f})).json();return this._getPromptUrl(`${o}/${i}${d.commit_hash?`:${d.commit_hash}`:""}`)}async updateExamplesMultipart(e,r=[]){return this._updateExamplesMultipart(e,r)}async _updateExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let s of r){let a=s.id,c={...s.metadata&&{metadata:s.metadata},...s.split&&{split:s.split}},u=Pr(c,`Serializing body for example with id: ${a}`),l=new Blob([u],{type:"application/json"});if(n.append(a,l),s.inputs){let d=Pr(s.inputs,`Serializing inputs for example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.inputs`,f)}if(s.outputs){let d=Pr(s.outputs,`Serializing outputs whle updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.outputs`,f)}if(s.attachments)for(let[d,f]of Object.entries(s.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${a}.attachment.${d}`,h)}if(s.attachments_operations){let d=Pr(s.attachments_operations,`Serializing attachments while updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.attachments_operations`,f)}}let o=e??r[0]?.dataset_id;return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${o}/examples`)}`,{method:"PATCH",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(s,"update examples"),s})).json()}async uploadExamplesMultipart(e,r=[]){return this._uploadExamplesMultipart(e,r)}async _uploadExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let i of r){let s=(i.id??Et()).toString(),a={created_at:i.created_at,...i.metadata&&{metadata:i.metadata},...i.split&&{split:i.split},...i.source_run_id&&{source_run_id:i.source_run_id},...i.use_source_run_io&&{use_source_run_io:i.use_source_run_io},...i.use_source_run_attachments&&{use_source_run_attachments:i.use_source_run_attachments}},c=Pr(a,`Serializing body for uploaded example with id: ${s}`),u=new Blob([c],{type:"application/json"});if(n.append(s,u),i.inputs){let l=Pr(i.inputs,`Serializing inputs for uploaded example with id: ${s}`),d=new Blob([l],{type:"application/json"});n.append(`${s}.inputs`,d)}if(i.outputs){let l=Pr(i.outputs,`Serializing outputs for uploaded example with id: ${s}`),d=new Blob([l],{type:"application/json"});n.append(`${s}.outputs`,d)}if(i.attachments)for(let[l,d]of Object.entries(i.attachments)){let f,p;Array.isArray(d)?[f,p]=d:(f=d.mimeType,p=d.data);let m=new Blob([p],{type:`${f}; length=${p.byteLength}`});n.append(`${s}.attachment.${l}`,m)}}return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(i,"upload examples"),i})).json()}async updatePrompt(e,r){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[n,o]=Wo(e);if(!await this._currentTenantIsOwner(n))throw await this._ownerConflictError("update a prompt",n);let i={};if(r?.description!==void 0&&(i.description=r.description),r?.readme!==void 0&&(i.readme=r.readme),r?.tags!==void 0&&(i.tags=r.tags),r?.isPublic!==void 0&&(i.is_public=r.isPublic),r?.isArchived!==void 0&&(i.is_archived=r.isArchived),Object.keys(i).length===0)throw new Error("No valid update options provided");let s=JSON.stringify(i);return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/repos/${n}/${o}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"update prompt"),c})).json()}async deletePrompt(e){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[r,n,o]=Wo(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"delete prompt"),s})).json()}async pullPromptCommit(e,r){let[n,o,i]=Wo(e),a=await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/commits/${n}/${o}/${i}${r?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(c,"pull prompt commit"),c})).json();return{owner:n,repo:o,commit_hash:a.commit_hash,manifest:a.manifest,examples:a.examples}}async _pullPrompt(e,r){let n=await this.pullPromptCommit(e,{includeModel:r?.includeModel});return JSON.stringify(n.manifest)}async pushPrompt(e,r){return await this.promptExists(e)?r&&Object.keys(r).some(o=>o!=="object")&&await this.updatePrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}):await this.createPrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}),r?.object?await this.createCommit(e,r?.object,{parentCommitHash:r?.parentCommitHash}):await this._getPromptUrl(e)}async clonePublicDataset(e,r={}){let{sourceApiUrl:n=this.apiUrl,datasetName:o}=r,[i,s]=this.parseTokenOrUrl(e,n),a=new t({apiUrl:i,apiKey:"placeholder"}),c=await a.readSharedDataset(s),u=o||c.name;try{if(await this.hasDataset({datasetId:u})){console.log(`Dataset ${u} already exists in your tenant. Skipping.`);return}}catch{}let l=await a.listSharedExamples(s),d=await this.createDataset(u,{description:c.description,dataType:c.data_type||"kv",inputsSchema:c.inputs_schema_definition??void 0,outputsSchema:c.outputs_schema_definition??void 0});try{await this.createExamples({inputs:l.map(f=>f.inputs),outputs:l.flatMap(f=>f.outputs?[f.outputs]:[]),datasetId:d.id})}catch(f){throw console.error(`An error occurred while creating dataset ${u}. You should delete it manually.`),f}}parseTokenOrUrl(e,r,n=2,o="dataset"){try{return $e(e),[r,e]}catch{}try{let s=new URL(e).pathname.split("/").filter(a=>a!=="");if(s.length>=n){let a=s[s.length-n];return[r,a]}else throw new Error(`Invalid public ${o} URL: ${e}`)}catch{throw new Error(`Invalid public ${o} URL or token: ${e}`)}}async awaitPendingTraceBatches(){if(this.manualFlushMode)return console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve();await Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()]),this.langSmithToOTELTranslator!==void 0&&await iP()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}};function pR(t){return"dataset_id"in t||"dataset_name"in t}var mR=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>At(r)==="true");var mo=Symbol.for("lc:context_variables"),Zh=Symbol.for("langsmith:replica_trace_roots");function t0(t,e){if(mo in t)return t[mo][e]}function hR(t,e,r){let n=mo in t?t[mo]:{};n[e]=r,t[mo]=n}var Fd=36,Bd="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function gR(t){let r=Object.keys(t).sort().map(n=>`${n}:${t[n]??""}`).join("|");return ua(r,Bd)}function Mq(t){return t.replace(/[-:.]/g,"")}function yR(t,e=1){let r=e.toFixed(0).slice(0,3).padStart(3,"0");return`${new Date(t).toISOString().slice(0,-1)}${r}Z`}function r0(t,e,r=1){let n=yR(t,r);return{dottedOrder:Mq(n)+e,microsecondPrecisionDatestring:n}}var qh=class t{constructor(e,r,n,o){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n,this.replicas=o}static fromHeader(e){let r=e.split(","),n={},o=[],i,s;for(let a of r){let[c,u]=a.split("="),l=decodeURIComponent(u);c==="langsmith-metadata"?n=JSON.parse(l):c==="langsmith-tags"?o=l.split(","):c==="langsmith-project"?i=l:c==="langsmith-replicas"&&(s=JSON.parse(l))}return new t(n,o,i,s)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}},Ln=class t{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"distributedParentId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),vR(e)){Object.assign(this,{...e});return}let r=t.getDefaultConfig(),{metadata:n,...o}=e,i=o.client??t.getSharedClient(),s={...n,...o?.extra?.metadata};if(o.extra={...o.extra,metadata:s},"id"in o&&o.id==null&&delete o.id,Object.assign(this,{...r,...o,client:i}),this.execution_order??=1,this.child_execution_order??=1,this.dotted_order||(this._serialized_start_time=yR(this.start_time,this.execution_order)),this.id||(this.id=mh(this._serialized_start_time??this.start_time)),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.replicas=Uq(this.replicas),!this.dotted_order){let{dottedOrder:a}=r0(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+a:this.dotted_order=a}}set metadata(e){this.extra={...this.extra,metadata:{...this.extra?.metadata,...e}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){let e=Date.now();return{run_type:"chain",project_name:Pd(),child_runs:[],api_url:Qr("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Qr("LANGCHAIN_API_KEY"),caller_options:{},start_time:e,serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new da),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=this.replicas?.map(l=>{let{reroot:d,...f}=l;return f}),o=e.replicas??n,i=new t({...e,parent_run:this,project_name:this.project_name,replicas:o,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});mo in this&&(i[mo]=this[mo]);let s=Symbol.for("lc:child_config"),a=e.extra?.[s]??this.extra[s];if(Dq(a)){let l={...a},d=jq(l.callbacks)?l.callbacks.copy?.():void 0;d&&(Object.assign(d,{_parentRunId:i.id}),d.handlers?.find(bR)?.updateFromRunTree?.(i),l.callbacks=d),i.extra[s]=l}let c=new Set,u=this;for(;u!=null&&!c.has(u.id);)c.add(u.id),u.child_execution_order=Math.max(u.child_execution_order,r),u=u.parent_run;return this.child_runs.push(i),i}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o?.runtime?.library===void 0&&(o.runtime||(o.runtime={}),r))for(let[a,c]of Object.entries(r))o.runtime[a]||(o.runtime[a]=c);let i,s;return n?(s=e.parent_run?.id??e.parent_run_id,i=[]):(i=e.child_runs.map(a=>this._convertToCreate(a,r,n)),s=void 0),{id:e.id,name:e.name,start_time:e._serialized_start_time??e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:o,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:i,parent_run_id:s,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments,events:e.events}}_sliceParentId(e,r){if(r.dotted_order){let n=r.dotted_order.split("."),o=null;for(let i=0;i0?r.trace_id=i[0].slice(-Fd):r.trace_id=r.id}}r.parent_run_id===e&&(r.parent_run_id=void 0)}_setReplicaTraceRoot(e,r){let n=t0(this,Zh)??{};n[e]=r,hR(this,Zh,n);for(let o of this.child_runs)o._setReplicaTraceRoot(e,r)}_remapForProject(e){let{projectName:r,runtimeEnv:n,excludeChildRuns:o=!0,reroot:i=!1,distributedParentId:s,apiUrl:a,apiKey:c,workspaceId:u}=e,l=this._convertToCreate(this,n,o);if(r===this.project_name)return{...l,session_name:r};if(i){if(s)this._sliceParentId(s,l);else if(l.parent_run_id=void 0,l.dotted_order){let b=l.dotted_order.split(".");b.length>0&&(l.dotted_order=b[b.length-1],l.trace_id=l.id)}let v=gR({projectName:r,apiUrl:a,apiKey:c,workspaceId:u});this._setReplicaTraceRoot(v,l.id)}let d;if(!i){let v=t0(this,Zh)??{},b=gR({projectName:r,apiUrl:a,apiKey:c,workspaceId:u});if(d=v[b],d&&(l.trace_id=d,l.dotted_order)){let x=l.dotted_order.split("."),k=null;for(let T=0;T{let k=x.slice(-Fd),T=ua(`${k}:${r}`,Bd);return x.slice(0,-Fd)+T}).join(".")),{...l,id:p,trace_id:m,parent_run_id:h,dotted_order:_,session_name:r}}async postRun(e=!0){try{let r=gh();if(this.replicas&&this.replicas.length>0)for(let{projectName:n,apiKey:o,apiUrl:i,workspaceId:s,reroot:a}of this.replicas){let c=this._remapForProject({projectName:n??this.project_name,runtimeEnv:r,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:i,apiKey:o,workspaceId:s});await this.client.createRun(c,{apiKey:o,apiUrl:i,workspaceId:s})}else{let n=this._convertToCreate(this,r,e);await this.client.createRun(n)}if(!e){uu("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let n of this.child_runs)await n.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(e){if(this.replicas&&this.replicas.length>0)for(let{projectName:r,apiKey:n,apiUrl:o,workspaceId:i,updates:s,reroot:a}of this.replicas){let c=this._remapForProject({projectName:r??this.project_name,runtimeEnv:void 0,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:o,apiKey:n,workspaceId:i}),u={id:c.id,name:c.name,run_type:c.run_type,start_time:c.start_time,outputs:c.outputs,error:c.error,parent_run_id:c.parent_run_id,session_name:c.session_name,reference_example_id:c.reference_example_id,end_time:c.end_time,dotted_order:c.dotted_order,trace_id:c.trace_id,events:c.events,tags:c.tags,extra:c.extra,attachments:this.attachments,...s};e?.excludeInputs||(u.inputs=c.inputs),await this.client.updateRun(c.id,u,{apiKey:n,apiUrl:o,workspaceId:i})}else try{let r={name:this.name,run_type:this.run_type,start_time:this._serialized_start_time??this.start_time,end_time:this.end_time,error:this.error,outputs:this.outputs,parent_run_id:this.parent_run?.id??this.parent_run_id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};e?.excludeInputs||(r.inputs=this.inputs),await this.client.updateRun(this.id,r)}catch(r){console.error(`Error in patchRun for run ${this.id}`,r)}}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(e){this.events||(this.events=[]),typeof e=="string"?this.events.push({name:"event",time:new Date().toISOString(),message:e}):this.events.push({...e,time:e.time??new Date().toISOString()})}static fromRunnableConfig(e,r){let n=e?.callbacks,o,i,s,a=mR();if(n){let u=n?.getParentRunId?.()??"",l=n?.handlers?.find(d=>d?.name=="langchain_tracer");o=l?.getRun?.(u),i=l?.projectName,s=l?.client,a=a||!!l}return o?new t({name:o.name,id:o.id,trace_id:o.trace_id,dotted_order:o.dotted_order,client:s,tracingEnabled:a,project_name:i,tags:[...new Set((o?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...o?.extra?.metadata,...e?.metadata}}}).createChild(r):new t({...r,client:s,tracingEnabled:a,project_name:i})}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,r){let n="get"in e&&typeof e.get=="function"?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,o=n["langsmith-trace"];if(!o||typeof o!="string")return;let i=o.trim(),s=i.split(".").map(l=>{let[d,f]=l.split("Z");return{strTime:d,time:Date.parse(d+"Z"),uuid:f}}),a=s[0].uuid,c={...r,name:r?.name??"parent",run_type:r?.run_type??"chain",start_time:r?.start_time??Date.now(),id:s.at(-1)?.uuid,trace_id:a,dotted_order:i};if(n.baggage&&typeof n.baggage=="string"){let l=qh.fromHeader(n.baggage);c.metadata=l.metadata,c.tags=l.tags,c.project_name=l.project_name,c.replicas=l.replicas}let u=new t(c);return u.distributedParentId=u.id,u}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new qh(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(Ln,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null});function vR(t){return t!=null&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function bR(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function _R(t){return Array.isArray(t)&&t.some(e=>bR(e))}function jq(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function Dq(t){return t!=null&&typeof t.callbacks=="object"&&(_R(t.callbacks?.handlers)||_R(t.callbacks))}function Lq(){let t=Qr("LANGSMITH_RUNS_ENDPOINTS");if(!t)return[];try{let e=JSON.parse(t);if(Array.isArray(e)){let r=[];for(let n of e){if(typeof n!="object"||n===null){console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got ${typeof n}`);continue}if(typeof n.api_url!="string"){console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_url}`);continue}if(typeof n.api_key!="string"){console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_key}`);continue}r.push({apiUrl:n.api_url.replace(/\/$/,""),apiKey:n.api_key})}return r}else if(typeof e=="object"&&e!==null){Fq(e);let r=[];for(let[n,o]of Object.entries(e)){let i=n.replace(/\/$/,"");if(typeof o=="string")r.push({apiUrl:i,apiKey:o});else{console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${n}: expected string, got ${typeof o}`);continue}}return r}else return console.warn(`Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey, got ${typeof e}`),[]}catch(e){if(sR(e))throw e;return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey"),[]}}function Uq(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):Lq()}function Fq(t){if(Object.keys(t).length>0&&At("ENDPOINT"))throw new Lh}var Bq={};G(Bq,{BaseTracer:()=>Un,isBaseTracer:()=>fa});var Zq=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};function o0(t,e){if(t)return new Ln({...t,start_time:t._serialized_start_time??t.start_time,parent_run:o0(e),child_runs:t.child_runs.map(r=>o0(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:ex()},tracingEnabled:!1})}function n0(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function fa(t){return typeof t._addRunToRunMap=="function"}var Un=class extends la{runMap=new Map;runTreeMap=new Map;usesRunTreeMap=!1;constructor(t){super(...arguments)}copy(){return this}getRunById(t){if(t!==void 0)return this.usesRunTreeMap?Zq(this.runTreeMap.get(t)):this.runMap.get(t)}stringifyError(t){return t instanceof Error?t.message+(t?.stack?` + +${t.stack}`:""):typeof t=="string"?t:`${t}`}_addChildRun(t,e){t.child_runs.push(e)}_addRunToRunMap(t){let{dottedOrder:e,microsecondPrecisionDatestring:r}=r0(new Date(t.start_time).getTime(),t.id,t.execution_order),n={...t},o=this.getRunById(n.parent_run_id);if(n.parent_run_id!==void 0?o&&(this._addChildRun(o,n),o.child_execution_order=Math.max(o.child_execution_order,n.child_execution_order),n.trace_id=o.trace_id,o.dotted_order!==void 0&&(n.dotted_order=[o.dotted_order,e].join("."),n._serialized_start_time=r)):(n.trace_id=n.id,n.dotted_order=e,n._serialized_start_time=r),this.usesRunTreeMap){let i=o0(n,o);i!==void 0&&this.runTreeMap.set(n.id,i)}else this.runMap.set(n.id,n);return n}async _endTrace(t){let e=t.parent_run_id!==void 0&&this.getRunById(t.parent_run_id);e?e.child_execution_order=Math.max(e.child_execution_order,t.child_execution_order):await this.persistRun(t),await this.onRunUpdate?.(t),this.usesRunTreeMap?this.runTreeMap.delete(t.id):this.runMap.delete(t.id)}_getExecutionOrder(t){let e=t!==void 0&&this.getRunById(t);return e?e.child_execution_order+1:1}_createRunForLLMStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l=s?{...o,metadata:s}:o,d={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{prompts:e},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:l??{},tags:i||[]};return this._addRunToRunMap(d)}async handleLLMStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForLLMStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}_createRunForChatModelStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l=s?{...o,metadata:s}:o,d={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{messages:e},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:l??{},tags:i||[]};return this._addRunToRunMap(d)}async handleChatModelStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForChatModelStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}async handleLLMEnd(t,e,r,n,o){let i=this.getRunById(e);if(!i||i?.run_type!=="llm")throw new Error("No LLM run to end.");return i.end_time=Date.now(),i.outputs=t,i.events.push({name:"end",time:new Date(i.end_time).toISOString()}),i.extra={...i.extra,...o},await this.onLLMEnd?.(i),await this._endTrace(i),i}async handleLLMError(t,e,r,n,o){let i=this.getRunById(e);if(!i||i?.run_type!=="llm")throw new Error("No LLM run to end.");return i.end_time=Date.now(),i.error=this.stringifyError(t),i.events.push({name:"error",time:new Date(i.end_time).toISOString()}),i.extra={...i.extra,...o},await this.onLLMError?.(i),await this._endTrace(i),i}_createRunForChainStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:e,execution_order:c,child_execution_order:c,run_type:s??"chain",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(l)}async handleChainStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForChainStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onChainStart?.(c),c}async handleChainEnd(t,e,r,n,o){let i=this.getRunById(e);if(!i)throw new Error("No chain run to end.");return i.end_time=Date.now(),i.outputs=n0(t,"output"),i.events.push({name:"end",time:new Date(i.end_time).toISOString()}),o?.inputs!==void 0&&(i.inputs=n0(o.inputs,"input")),await this.onChainEnd?.(i),await this._endTrace(i),i}async handleChainError(t,e,r,n,o){let i=this.getRunById(e);if(!i)throw new Error("No chain run to end.");return i.end_time=Date.now(),i.error=this.stringifyError(t),i.events.push({name:"error",time:new Date(i.end_time).toISOString()}),o?.inputs!==void 0&&(i.inputs=n0(o.inputs,"input")),await this.onChainError?.(i),await this._endTrace(i),i}_createRunForToolStart(t,e,r,n,o,i,s){let a=this._getExecutionOrder(n),c=Date.now(),u={id:r,name:s??t.id[t.id.length-1],parent_run_id:n,start_time:c,serialized:t,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{input:e},execution_order:a,child_execution_order:a,run_type:"tool",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(u)}async handleToolStart(t,e,r,n,o,i,s){let a=this.getRunById(r)??this._createRunForToolStart(t,e,r,n,o,i,s);return await this.onRunCreate?.(a),await this.onToolStart?.(a),a}async handleToolEnd(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.outputs={output:t},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onToolEnd?.(r),await this._endTrace(r),r}async handleToolError(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.error=this.stringifyError(t),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onToolError?.(r),await this._endTrace(r),r}async handleAgentAction(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="chain")return;let n=r;n.actions=n.actions||[],n.actions.push(t),n.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentAction?.(r)}async handleAgentEnd(t,e){let r=this.getRunById(e);!r||r?.run_type!=="chain"||(r.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentEnd?.(r))}_createRunForRetrieverStart(t,e,r,n,o,i,s){let a=this._getExecutionOrder(n),c=Date.now(),u={id:r,name:s??t.id[t.id.length-1],parent_run_id:n,start_time:c,serialized:t,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{query:e},execution_order:a,child_execution_order:a,run_type:"retriever",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(u)}async handleRetrieverStart(t,e,r,n,o,i,s){let a=this.getRunById(r)??this._createRunForRetrieverStart(t,e,r,n,o,i,s);return await this.onRunCreate?.(a),await this.onRetrieverStart?.(a),a}async handleRetrieverEnd(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.outputs={documents:t},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onRetrieverEnd?.(r),await this._endTrace(r),r}async handleRetrieverError(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.error=this.stringifyError(t),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onRetrieverError?.(r),await this._endTrace(r),r}async handleText(t,e){let r=this.getRunById(e);!r||r?.run_type!=="chain"||(r.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:t}}),await this.onText?.(r))}async handleLLMNewToken(t,e,r,n,o,i){let s=this.getRunById(r);if(!s||s?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return s.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:t,idx:e,chunk:i?.chunk}}),await this.onLLMNewToken?.(s,t,{chunk:i?.chunk}),s}};var i0=mn(IR(),1),Vq={};G(Vq,{ConsoleCallbackHandler:()=>Vh});function yr(t,e){return`${t.open}${e}${t.close}`}function yn(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function SR(t){return typeof t=="string"?t.trim():t==null?t:yn(t,t.toString())}function Fi(t){if(!t.end_time)return"";let e=t.end_time-t.start_time;return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}var{color:Cr}=i0.default,Vh=class extends Un{name="console_callback_handler";persistRun(t){return Promise.resolve()}getParents(t){let e=[],r=t;for(;r.parent_run_id;){let n=this.runMap.get(r.parent_run_id);if(n)e.push(n),r=n;else break}return e}getBreadcrumbs(t){let r=[...this.getParents(t).reverse(),t].map((n,o,i)=>{let s=`${n.execution_order}:${n.run_type}:${n.name}`;return o===i.length-1?yr(i0.default.bold,s):s}).join(" > ");return yr(Cr.grey,r)}onChainStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[chain/start]")} [${e}] Entering Chain run with input: ${yn(t.inputs,"[inputs]")}`)}onChainEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[chain/end]")} [${e}] [${Fi(t)}] Exiting Chain run with output: ${yn(t.outputs,"[outputs]")}`)}onChainError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[chain/error]")} [${e}] [${Fi(t)}] Chain run errored with error: ${yn(t.error,"[error]")}`)}onLLMStart(t){let e=this.getBreadcrumbs(t),r="prompts"in t.inputs?{prompts:t.inputs.prompts.map(n=>n.trim())}:t.inputs;console.log(`${yr(Cr.green,"[llm/start]")} [${e}] Entering LLM run with input: ${yn(r,"[inputs]")}`)}onLLMEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[llm/end]")} [${e}] [${Fi(t)}] Exiting LLM run with output: ${yn(t.outputs,"[response]")}`)}onLLMError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[llm/error]")} [${e}] [${Fi(t)}] LLM run errored with error: ${yn(t.error,"[error]")}`)}onToolStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[tool/start]")} [${e}] Entering Tool run with input: "${SR(t.inputs.input)}"`)}onToolEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[tool/end]")} [${e}] [${Fi(t)}] Exiting Tool run with output: "${SR(t.outputs?.output)}"`)}onToolError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[tool/error]")} [${e}] [${Fi(t)}] Tool run errored with error: ${yn(t.error,"[error]")}`)}onRetrieverStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[retriever/start]")} [${e}] Entering Retriever run with input: ${yn(t.inputs,"[inputs]")}`)}onRetrieverEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[retriever/end]")} [${e}] [${Fi(t)}] Exiting Retriever run with output: ${yn(t.outputs,"[outputs]")}`)}onRetrieverError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[retriever/error]")} [${e}] [${Fi(t)}] Retriever run errored with error: ${yn(t.error,"[error]")}`)}onAgentAction(t){let e=t,r=this.getBreadcrumbs(t);console.log(`${yr(Cr.blue,"[agent/action]")} [${r}] Agent selected action: ${yn(e.actions[e.actions.length-1],"[action]")}`)}};var s0,Gh=()=>{if(s0===void 0){let t=It("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};s0=new da(t)}return s0};var c0=class{getStore(){}run(e,r){return r()}},a0=Symbol.for("ls:tracing_async_local_storage"),Gq=new c0,u0=class{getInstance(){return globalThis[a0]??Gq}initializeGlobalInstance(e){globalThis[a0]===void 0&&(globalThis[a0]=e)}},Kq=new u0;function kR(t=!1){let e=Kq.getInstance().getStore();if(!t&&e===void 0)throw new Error(`Could not get the current run tree. + +Please make sure you are calling this method within a traceable function and that tracing is enabled.`);return e}var rge=Symbol.for("langsmith:traceable:root");function Kh(t){return typeof t=="function"&&"langsmith:traceable"in t}var Hq={};G(Hq,{LangChainTracer:()=>Zd});var Zd=class TR extends Un{name="langchain_tracer";projectName;exampleId;client;replicas;usesRunTreeMap=!0;constructor(e={}){super(e);let{exampleId:r,projectName:n,client:o,replicas:i}=e;this.projectName=n??Pd(),this.replicas=i,this.exampleId=r,this.client=o??Gh();let s=TR.getTraceableRunTree();s&&this.updateFromRunTree(s)}async persistRun(e){}async onRunCreate(e){await this.getRunTreeWithTracingConfig(e.id)?.postRun()}async onRunUpdate(e){await this.getRunTreeWithTracingConfig(e.id)?.patchRun()}getRun(e){return this.runTreeMap.get(e)}updateFromRunTree(e){this.runTreeMap.set(e.id,e);let r=e,n=new Set;for(;r.parent_run&&!(n.has(r.id)||(n.add(r.id),!r.parent_run));)r=r.parent_run;n.clear();let o=[r];for(;o.length>0;){let i=o.shift();!i||n.has(i.id)||(n.add(i.id),this.runTreeMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.replicas=e.replicas??this.replicas,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}getRunTreeWithTracingConfig(e){let r=this.runTreeMap.get(e);if(r)return new Ln({...r,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return kR(!0)}catch{return}}};var Hh=mn(Sh(),1),ma;function Wq(){let t="default"in Hh.default?Hh.default.default:Hh.default;return new t({autoStart:!0,concurrency:1})}function Jq(){return typeof ma>"u"&&(ma=Wq()),ma}async function gt(t,e){if(e===!0){let r=Li();r!==void 0?await r.run(void 0,async()=>t()):await t()}else ma=Jq(),ma.add(async()=>{let r=Li();r!==void 0?await r.run(void 0,async()=>t()):await t()})}async function ER(){let t=Gh();await Promise.allSettled([typeof ma<"u"?ma.onIdle():Promise.resolve(),t.awaitPendingTraceBatches()])}var Xq={};G(Xq,{awaitAllCallbacks:()=>ER,consumeCallback:()=>gt});var AR=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>It(r)==="true");function l0(t){let e=Li();return e===void 0?void 0:e.getStore()?.[Di]?.[t]}var Yq=Symbol("lc:configure_hooks"),OR=()=>l0(Yq)||[];var Qq={};G(Qq,{BaseCallbackManager:()=>PR,BaseRunManager:()=>Vd,CallbackManager:()=>St,CallbackManagerForChainRun:()=>RR,CallbackManagerForLLMRun:()=>d0,CallbackManagerForRetrieverRun:()=>CR,CallbackManagerForToolRun:()=>NR,ensureHandler:()=>pu,parseCallbackConfigArg:()=>ha});function ha(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}var PR=class{setHandler(t){return this.setHandlers([t])}},Vd=class{constructor(t,e,r,n,o,i,s,a){this.runId=t,this.handlers=e,this.inheritableHandlers=r,this.tags=n,this.inheritableTags=o,this.metadata=i,this.inheritableMetadata=s,this._parentRunId=a}get parentRunId(){return this._parentRunId}async handleText(t){await Promise.all(this.handlers.map(e=>gt(async()=>{try{await e.handleText?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleText: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleCustomEvent(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{try{await i.handleCustomEvent?.(t,e,this.runId,this.tags,this.metadata)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleCustomEvent: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},CR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleRetrieverEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetriever`),e.raiseError)throw r}},e.awaitHandlers)))}async handleRetrieverError(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetrieverError: ${r}`),e.raiseError)throw t}},e.awaitHandlers)))}},d0=class extends Vd{async handleLLMNewToken(t,e,r,n,o,i){await Promise.all(this.handlers.map(s=>gt(async()=>{if(!s.ignoreLLM)try{await s.handleLLMNewToken?.(t,e??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,i)}catch(a){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleLLMNewToken: ${a}`),s.raiseError)throw a}},s.awaitHandlers)))}async handleLLMError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreLLM)try{await i.handleLLMError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleLLMEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreLLM)try{await i.handleLLMEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},RR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleChainError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreChain)try{await i.handleChainError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleChainEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreChain)try{await i.handleChainEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleAgentAction(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleAgentAction?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentAction: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleAgentEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleAgentEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},NR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleToolError(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleToolError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolError: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleToolEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleToolEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},St=class qd extends PR{handlers=[];inheritableHandlers=[];tags=[];inheritableTags=[];metadata={};inheritableMetadata={};name="callback_manager";_parentRunId;constructor(e,r){super(),this.handlers=r?.handlers??this.handlers,this.inheritableHandlers=r?.inheritableHandlers??this.inheritableHandlers,this.tags=r?.tags??this.tags,this.inheritableTags=r?.inheritableTags??this.inheritableTags,this.metadata=r?.metadata??this.metadata,this.inheritableMetadata=r?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=e}getParentRunId(){return this._parentRunId}async handleLLMStart(e,r,n=void 0,o=void 0,i=void 0,s=void 0,a=void 0,c=void 0){return Promise.all(r.map(async(u,l)=>{let d=l===0&&n?n:Et();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return fa(f)&&f._createRunForLLMStart(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c),gt(async()=>{try{await f.handleLLMStart?.(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c)}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new d0(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(e,r,n=void 0,o=void 0,i=void 0,s=void 0,a=void 0,c=void 0){return Promise.all(r.map(async(u,l)=>{let d=l===0&&n?n:Et();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return fa(f)&&f._createRunForChatModelStart(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c),gt(async()=>{try{if(f.handleChatModelStart)await f.handleChatModelStart?.(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c);else if(f.handleLLMStart){let p=au(u);await f.handleLLMStart?.(e,[p],d,this._parentRunId,i,this.tags,this.metadata,c)}}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new d0(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreChain)return fa(c)&&c._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,a),gt(async()=>{try{await c.handleChainStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,o,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleChainStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new RR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreAgent)return fa(c)&&c._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,a),gt(async()=>{try{await c.handleToolStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleToolStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new NR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreRetriever)return fa(c)&&c._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,a),gt(async()=>{try{await c.handleRetrieverStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleRetrieverStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new CR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(e,r,n,o,i){await Promise.all(this.handlers.map(s=>gt(async()=>{if(!s.ignoreCustomEvent)try{await s.handleCustomEvent?.(e,r,n,this.tags,this.metadata)}catch(a){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleCustomEvent: ${a}`),s.raiseError)throw a}},s.awaitHandlers)))}addHandler(e,r=!0){this.handlers.push(e),r&&this.inheritableHandlers.push(e)}removeHandler(e){this.handlers=this.handlers.filter(r=>r!==e),this.inheritableHandlers=this.inheritableHandlers.filter(r=>r!==e)}setHandlers(e,r=!0){this.handlers=[],this.inheritableHandlers=[];for(let n of e)this.addHandler(n,r)}addTags(e,r=!0){this.removeTags(e),this.tags.push(...e),r&&this.inheritableTags.push(...e)}removeTags(e){this.tags=this.tags.filter(r=>!e.includes(r)),this.inheritableTags=this.inheritableTags.filter(r=>!e.includes(r))}addMetadata(e,r=!0){this.metadata={...this.metadata,...e},r&&(this.inheritableMetadata={...this.inheritableMetadata,...e})}removeMetadata(e){for(let r of Object.keys(e))delete this.metadata[r],delete this.inheritableMetadata[r]}copy(e=[],r=!0){let n=new qd(this._parentRunId);for(let o of this.handlers){let i=this.inheritableHandlers.includes(o);n.addHandler(o,i)}for(let o of this.tags){let i=this.inheritableTags.includes(o);n.addTags([o],i)}for(let o of Object.keys(this.metadata)){let i=Object.keys(this.inheritableMetadata).includes(o);n.addMetadata({[o]:this.metadata[o]},i)}for(let o of e)n.handlers.filter(i=>i.name==="console_callback_handler").some(i=>i.name===o.name)||n.addHandler(o,r);return n}static fromHandlers(e){class r extends la{name=Et();constructor(){super(),Object.assign(this,e)}}let n=new this;return n.addHandler(new r),n}static configure(e,r,n,o,i,s,a){return this._configureSync(e,r,n,o,i,s,a)}static _configureSync(e,r,n,o,i,s,a){let c;(e||r)&&(Array.isArray(e)||!e?(c=new qd,c.setHandlers(e?.map(pu)??[],!0)):c=e,c=c.copy(Array.isArray(r)?r.map(pu):r?.handlers,!1));let u=It("LANGCHAIN_VERBOSE")==="true"||a?.verbose,l=Zd.getTraceableRunTree()?.tracingEnabled||AR(),d=l||(It("LANGCHAIN_TRACING")??!1);if(u||d){if(c||(c=new qd),u&&!c.handlers.some(f=>f.name===Vh.prototype.name)){let f=new Vh;c.addHandler(f,!0)}if(d&&!c.handlers.some(f=>f.name==="langchain_tracer")&&l){let f=new Zd;c.addHandler(f,!0)}if(l){let f=Zd.getTraceableRunTree();f&&c._parentRunId===void 0&&(c._parentRunId=f.id,c.handlers.find(m=>m.name==="langchain_tracer")?.updateFromRunTree(f))}}for(let{contextVar:f,inheritable:p=!0,handlerClass:m,envVar:h}of OR()){let _=h&&It(h)==="true"&&m,v,b=f!==void 0?l0(f):void 0;b&&ox(b)?v=b:_&&(v=new m({})),v!==void 0&&(c||(c=new qd),c.handlers.some(x=>x.name===v.name)||c.addHandler(v,p))}return(n||o)&&c&&(c.addTags(n??[]),c.addTags(o??[],!1)),(i||s)&&c&&(c.addMetadata(i??{}),c.addMetadata(s??{},!1)),c}};function pu(t){return"name"in t?t:la.fromMethods(t)}var p0=class{getStore(){}run(t,e){return e()}enterWith(t){}},eV=new p0,zR=Symbol.for("lc:child_config"),tV=class{getInstance(){return Li()??eV}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[zR]}runWithConfig(t,e,r){let n=St._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata),o=this.getInstance(),i=o.getStore(),s=n?.getParentRunId(),a=n?.handlers?.find(u=>u?.name==="langchain_tracer"),c;return a&&s?c=a.getRunTreeWithTracingConfig(s):r||(c=new Ln({name:"",tracingEnabled:!1})),c&&(c.extra={...c.extra,[zR]:t}),i!==void 0&&i[Di]!==void 0&&(c===void 0&&(c={}),c[Di]=i[Di]),o.run(c,e)}initializeGlobalInstance(t){Li()===void 0&&fO(t)}},Lt=new tV;var rV={};G(rV,{AsyncLocalStorageProviderSingleton:()=>Lt,MockAsyncLocalStorage:()=>p0,_CONTEXT_VARIABLES_KEY:()=>Di});var Wh=25;async function or(t){return St._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function ga(...t){let e={};for(let r of t.filter(n=>!!n))for(let n of Object.keys(r))if(n==="metadata")e[n]={...e[n],...r[n]};else if(n==="tags"){let o=e[n]??[];e[n]=[...new Set(o.concat(r[n]??[]))]}else if(n==="configurable")e[n]={...e[n],...r[n]};else if(n==="timeout")e.timeout===void 0?e.timeout=r.timeout:r.timeout!==void 0&&(e.timeout=Math.min(e.timeout,r.timeout));else if(n==="signal")e.signal===void 0?e.signal=r.signal:r.signal!==void 0&&("any"in AbortSignal?e.signal=AbortSignal.any([e.signal,r.signal]):e.signal=r.signal);else if(n==="callbacks"){let o=e.callbacks,i=r.callbacks;if(Array.isArray(i))if(!o)e.callbacks=i;else if(Array.isArray(o))e.callbacks=o.concat(i);else{let s=o.copy();for(let a of i)s.addHandler(pu(a),!0);e.callbacks=s}else if(i)if(!o)e.callbacks=i;else if(Array.isArray(o)){let s=i.copy();for(let a of o)s.addHandler(pu(a),!0);e.callbacks=s}else e.callbacks=new St(i._parentRunId,{handlers:o.handlers.concat(i.handlers),inheritableHandlers:o.inheritableHandlers.concat(i.inheritableHandlers),tags:Array.from(new Set(o.tags.concat(i.tags))),inheritableTags:Array.from(new Set(o.inheritableTags.concat(i.inheritableTags))),metadata:{...o.metadata,...i.metadata}})}else{let o=n;e[o]=r[o]??e[o]}return e}var nV=new Set(["string","number","boolean"]);function Pe(t){let e=Lt.getRunnableConfig(),r={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(e){let{runId:n,runName:o,...i}=e;r=Object.entries(i).reduce((s,[a,c])=>(c!==void 0&&(s[a]=c),s),r)}if(t&&(r=Object.entries(t).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),r)),r?.configurable)for(let n of Object.keys(r.configurable))nV.has(typeof r.configurable[n])&&!r.metadata?.[n]&&(r.metadata||(r.metadata={}),r.metadata[n]=r.configurable[n]);if(r.timeout!==void 0){if(r.timeout<=0)throw new Error("Timeout must be a positive number");let n=AbortSignal.timeout(r.timeout);r.signal!==void 0?"any"in AbortSignal&&(r.signal=AbortSignal.any([r.signal,n])):r.signal=n,delete r.timeout}return r}function Ve(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:s}={}){let a=Pe(t);return e!==void 0&&(delete a.runName,a.callbacks=e),n!==void 0&&(a.recursionLimit=n),r!==void 0&&(a.maxConcurrency=r),o!==void 0&&(a.runName=o),i!==void 0&&(a.configurable={...a.configurable,...i}),s!==void 0&&delete a.runId,a}function vr(t){if(t)return{configurable:t.configurable,recursionLimit:t.recursionLimit,callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,maxConcurrency:t.maxConcurrency,timeout:t.timeout,signal:t.signal,store:t.store}}async function vn(t,e){if(e===void 0)return t;let r;return Promise.race([t.catch(n=>{if(!e?.aborted)throw n}),new Promise((n,o)=>{r=()=>{o(Bi(e))},e.addEventListener("abort",r),e.aborted&&o(Bi(e))})]).finally(()=>e.removeEventListener("abort",r))}function Bi(t){return t?.reason instanceof Error?t.reason:typeof t?.reason=="string"?new Error(t.reason):new Error("Aborted")}var oV={};G(oV,{AsyncGeneratorWithSetup:()=>Zi,IterableReadableStream:()=>br,atee:()=>Jh,concat:()=>en,pipeGeneratorWithSetup:()=>m0});var br=class f0 extends ReadableStream{reader;ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let e=await this.reader.read();return e.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}throw e}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(e){let r=e.getReader();return new f0({start(n){return o();function o(){return r.read().then(({done:i,value:s})=>{if(i){n.close();return}return n.enqueue(s),o()})}},cancel(){r.releaseLock()}})}static fromAsyncGenerator(e){return new f0({async pull(r){let{value:n,done:o}=await e.next();o&&r.close(),r.enqueue(n)},async cancel(r){await e.return(r)}})}};function Jh(t,e=2){let r=Array.from({length:e},()=>[]);return r.map(async function*(o){for(;;)if(o.length===0){let i=await t.next();for(let s of r)s.push(i)}else{if(o[0].done)return;yield o.shift().value}})}function en(t,e){if(Array.isArray(t)&&Array.isArray(e))return t.concat(e);if(typeof t=="string"&&typeof e=="string")return t+e;if(typeof t=="number"&&typeof e=="number")return t+e;if("concat"in t&&typeof t.concat=="function")return t.concat(e);if(typeof t=="object"&&typeof e=="object"){let r={...t};for(let[n,o]of Object.entries(e))n in r&&!Array.isArray(r[n])?r[n]=en(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}var Zi=class{generator;setup;config;signal;firstResult;firstResultUsed=!1;constructor(t){this.generator=t.generator,this.config=t.config,this.signal=t.signal??this.config?.signal,this.setup=new Promise((e,r)=>{Lt.runWithConfig(vr(t.config),async()=>{this.firstResult=t.generator.next(),t.startSetup?this.firstResult.then(t.startSetup).then(e,r):this.firstResult.then(n=>e(void 0),r)},!0)})}async next(...t){return this.signal?.throwIfAborted(),this.firstResultUsed?Lt.runWithConfig(vr(this.config),this.signal?async()=>vn(this.generator.next(...t),this.signal):async()=>this.generator.next(...t),!0):(this.firstResultUsed=!0,this.firstResult)}async return(t){return this.generator.return(t)}async throw(t){return this.generator.throw(t)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}};async function m0(t,e,r,n,...o){let i=new Zi({generator:e,startSetup:r,signal:n}),s=await i.setup;return{output:t(i,s,...o),setup:s}}var iV=Object.prototype.hasOwnProperty;function Yh(t,e){return iV.call(t,e)}function Qh(t){if(Array.isArray(t)){let r=new Array(t.length);for(let n=0;n=48&&n<=57){e++;continue}return!1}return!0}function Jo(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function tg(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function Xh(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r_t,_areEquals:()=>Gd,applyOperation:()=>_a,applyPatch:()=>qi,applyReducer:()=>cV,deepClone:()=>sV,getValueByPointer:()=>ng,validate:()=>jR,validator:()=>og});var _t=rg,sV=wr,fu={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){let n=ng(r,this.path);n&&(n=wr(n));let o=_a(r,{op:"remove",path:this.from}).removed;return _a(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=ng(r,this.from);return _a(r,{op:"add",path:this.path,value:wr(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:Gd(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},aV={add:function(t,e,r){return eg(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:fu.move,copy:fu.copy,test:fu.test,_get:fu._get};function ng(t,e){if(e=="")return t;var r={op:"_get",path:e};return _a(t,r),r.value}function _a(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):og(e,0)),e.path===""){let s={newDocument:t};if(e.op==="add")return s.newDocument=e.value,s;if(e.op==="replace")return s.newDocument=e.value,s.removed=t,s;if(e.op==="move"||e.op==="copy")return s.newDocument=ng(t,e.from),e.op==="move"&&(s.removed=t),s;if(e.op==="test"){if(s.test=Gd(t,e.value),s.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return s.newDocument=t,s}else{if(e.op==="remove")return s.removed=t,s.newDocument=null,s;if(e.op==="_get")return e.value=t,s;if(r)throw new _t("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return s}}else{n||(t=wr(t));let a=(e.path||"").split("/"),c=t,u=1,l=a.length,d,f,p;for(typeof r=="function"?p=r:p=og;;){if(f=a[u],f&&f.indexOf("~")!=-1&&(f=tg(f)),o&&(f=="__proto__"||f=="prototype"&&u>0&&a[u-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&d===void 0&&(c[f]===void 0?d=a.slice(0,u).join("/"):u==l-1&&(d=e.path),d!==void 0&&p(e,0,t,d)),u++,Array.isArray(c)){if(f==="-")f=c.length;else{if(r&&!eg(f))throw new _t("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,e,t);eg(f)&&(f=~~f)}if(u>=l){if(r&&e.op==="add"&&f>c.length)throw new _t("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let m=aV[e.op].call(e,c,f,t);if(m.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(u>=l){let m=fu[e.op].call(e,c,f,t);if(m.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(c=c[f],r&&u0)throw new _t('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new _t("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new _t("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&Xh(t.value))throw new _t("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var o=t.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new _t("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==n)throw new _t("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var s={op:"_get",path:t.from,value:void 0},a=jR([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new _t("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new _t("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function jR(t,e,r){try{if(!Array.isArray(t))throw new _t("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)qi(wr(e),wr(t),r||!0);else{r=r||og;for(var n=0;n=0;u--){var l=s[u],d=t[l];if(Yh(e,l)&&!(e[l]===void 0&&d!==void 0&&Array.isArray(e)===!1)){var f=e[l];typeof d=="object"&&d!=null&&typeof f=="object"&&f!=null&&Array.isArray(d)===Array.isArray(f)?DR(d,f,r,n+"/"+Jo(l),o):d!==f&&(a=!0,o&&r.push({op:"test",path:n+"/"+Jo(l),value:wr(d)}),r.push({op:"replace",path:n+"/"+Jo(l),value:wr(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+Jo(l),value:wr(d)}),r.push({op:"remove",path:n+"/"+Jo(l)}),c=!0):(o&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),a=!0)}if(!(!c&&i.length==s.length))for(var u=0;usg,RunLog:()=>ig,RunLogPatch:()=>ho,isLogStreamHandler:()=>_0});var ho=class{ops;constructor(t){this.ops=t.ops??[]}concat(t){let e=this.ops.concat(t.ops),r=qi({},e);return new ig({ops:e,state:r[r.length-1].newDocument})}},ig=class g0 extends ho{state;constructor(e){super(e),this.state=e.state}concat(e){let r=this.ops.concat(e.ops),n=qi(this.state,e.ops);return new g0({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=qi({},e.ops);return new g0({ops:e.ops,state:r[r.length-1].newDocument})}},_0=t=>t.name==="log_stream_tracer";async function LR(t,e){if(e==="original")throw new Error("Do not assign inputs with original schema drop the key for now. When inputs are added to streamLog they should be added with standardized schema for streaming events.");let{inputs:r}=t;if(["retriever","llm","prompt"].includes(t.run_type))return r;if(!(Object.keys(r).length===1&&r?.input===""))return r.input}async function UR(t,e){let{outputs:r}=t;return e==="original"||["retriever","llm","prompt"].includes(t.run_type)?r:r!==void 0&&Object.keys(r).length===1&&r?.output!==void 0?r.output:r}function lV(t){return t!==void 0&&t.message!==void 0}var sg=class extends Un{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;_schemaFormat="original";rootId;keyMapByRunId={};counterMapByRunName={};transformStream;writer;receiveStream;name="log_stream_tracer";lc_prefer_streaming=!0;constructor(t){super({_awaitHandler:!0,...t}),this.autoClose=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this._schemaFormat=t?._schemaFormat??this._schemaFormat,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=br.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){if(t.id===this.rootId)return!1;let e=t.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(t.run_type)),this.includeTags!==void 0&&(r=r||e.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(t.run_type)),this.excludeTags!==void 0&&(r=r&&e.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(t,e){for await(let r of e){if(t!==this.rootId){let n=this.keyMapByRunId[t];n&&await this.writer.write(new ho({ops:[{op:"add",path:`/logs/${n}/streamed_output/-`,value:r}]}))}yield r}}async onRunCreate(t){if(this.rootId===void 0&&(this.rootId=t.id,await this.writer.write(new ho({ops:[{op:"replace",path:"",value:{id:t.id,name:t.name,type:t.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(t))return;this.counterMapByRunName[t.name]===void 0&&(this.counterMapByRunName[t.name]=0),this.counterMapByRunName[t.name]+=1;let e=this.counterMapByRunName[t.name];this.keyMapByRunId[t.id]=e===1?t.name:`${t.name}:${e}`;let r={id:t.id,name:t.name,type:t.run_type,tags:t.tags??[],metadata:t.extra?.metadata??{},start_time:new Date(t.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};this._schemaFormat==="streaming_events"&&(r.inputs=await LR(t,this._schemaFormat)),await this.writer.write(new ho({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[t.id]}`,value:r}]}))}async onRunUpdate(t){try{let e=this.keyMapByRunId[t.id];if(e===void 0)return;let r=[];this._schemaFormat==="streaming_events"&&r.push({op:"replace",path:`/logs/${e}/inputs`,value:await LR(t,this._schemaFormat)}),r.push({op:"add",path:`/logs/${e}/final_output`,value:await UR(t,this._schemaFormat)}),t.end_time!==void 0&&r.push({op:"add",path:`/logs/${e}/end_time`,value:new Date(t.end_time).toISOString()});let n=new ho({ops:r});await this.writer.write(n)}finally{if(t.id===this.rootId){let e=new ho({ops:[{op:"replace",path:"/final_output",value:await UR(t,this._schemaFormat)}]});await this.writer.write(e),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(t,e,r){let n=this.keyMapByRunId[t.id];if(n===void 0)return;let o=t.inputs.messages!==void 0,i;o?lV(r?.chunk)?i=r?.chunk:i=new Dt({id:`run-${t.id}`,content:e}):i=e;let s=new ho({ops:[{op:"add",path:`/logs/${n}/streamed_output_str/-`,value:e},{op:"add",path:`/logs/${n}/streamed_output/-`,value:i}]});await this.writer.write(s)}};var dV={};G(dV,{ChatGenerationChunk:()=>Vi,GenerationChunk:()=>go,RUN_KEY:()=>ya});var ya="__run",go=class FR{text;generationInfo;constructor(e){this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new FR({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},Vi=class BR extends go{message;constructor(e){super(e),this.message=e.message}concat(e){return new BR({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo},message:this.message.concat(e.message)})}};function ag({name:t,serialized:e}){return t!==void 0?t:e?.name!==void 0?e.name:e?.id!==void 0&&Array.isArray(e?.id)?e.id[e.id.length-1]:"Unnamed"}var ZR=t=>t.name==="event_stream_tracer",qR=class extends Un{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;runInfoMap=new Map;tappedPromises=new Map;transformStream;writer;receiveStream;name="event_stream_tracer";lc_prefer_streaming=!0;constructor(t){super({_awaitHandler:!0,...t}),this.autoClose=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=br.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){let e=t.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(t.runType)),this.includeTags!==void 0&&(r=r||e.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(t.runType)),this.excludeTags!==void 0&&(r=r&&e.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(t,e){let r=await e.next();if(r.done)return;let n=this.runInfoMap.get(t);if(n===void 0){yield r.value;return}function o(s,a){return s==="llm"&&typeof a=="string"?new go({text:a}):a}let i=this.tappedPromises.get(t);if(i===void 0){let s;i=new Promise(a=>{s=a}),this.tappedPromises.set(t,i);try{let a={event:`on_${n.runType}_stream`,run_id:t,name:n.name,tags:n.tags,metadata:n.metadata,data:{}};await this.send({...a,data:{chunk:o(n.runType,r.value)}},n),yield r.value;for await(let c of e)n.runType!=="tool"&&n.runType!=="retriever"&&await this.send({...a,data:{chunk:o(n.runType,c)}},n),yield c}finally{s?.()}}else{yield r.value;for await(let s of e)yield s}}async send(t,e){this._includeRun(e)&&await this.writer.write(t)}async sendEndEvent(t,e){let r=this.tappedPromises.get(t.run_id);r!==void 0?r.then(()=>{this.send(t,e)}):await this.send(t,e)}async onLLMStart(t){let e=ag(t),r=t.inputs.messages!==void 0?"chat_model":"llm",n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:r,inputs:t.inputs};this.runInfoMap.set(t.id,n);let o=`on_${r}_start`;await this.send({event:o,data:{input:t.inputs},name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onLLMNewToken(t,e,r){let n=this.runInfoMap.get(t.id),o,i;if(n===void 0)throw new Error(`onLLMNewToken: Run ID ${t.id} not found in run map.`);if(this.runInfoMap.size!==1){if(n.runType==="chat_model")i="on_chat_model_stream",r?.chunk===void 0?o=new Dt({content:e,id:`run-${t.id}`}):o=r.chunk.message;else if(n.runType==="llm")i="on_llm_stream",r?.chunk===void 0?o=new go({text:e}):o=r.chunk;else throw new Error(`Unexpected run type ${n.runType}`);await this.send({event:i,data:{chunk:o},run_id:t.id,name:n.name,tags:n.tags,metadata:n.metadata},n)}}async onLLMEnd(t){let e=this.runInfoMap.get(t.id);this.runInfoMap.delete(t.id);let r;if(e===void 0)throw new Error(`onLLMEnd: Run ID ${t.id} not found in run map.`);let n=t.outputs?.generations,o;if(e.runType==="chat_model"){for(let i of n??[]){if(o!==void 0)break;o=i[0]?.message}r="on_chat_model_end"}else if(e.runType==="llm")o={generations:n?.map(i=>i.map(s=>({text:s.text,generationInfo:s.generationInfo}))),llmOutput:t.outputs?.llmOutput??{}},r="on_llm_end";else throw new Error(`onLLMEnd: Unexpected run type: ${e.runType}`);await this.sendEndEvent({event:r,data:{output:o,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async onChainStart(t){let e=ag(t),r=t.run_type??"chain",n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:t.run_type},o={};t.inputs.input===""&&Object.keys(t.inputs).length===1?(o={},n.inputs={}):t.inputs.input!==void 0?(o.input=t.inputs.input,n.inputs=t.inputs.input):(o.input=t.inputs,n.inputs=t.inputs),this.runInfoMap.set(t.id,n),await this.send({event:`on_${r}_start`,data:o,name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onChainEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onChainEnd: Run ID ${t.id} not found in run map.`);let r=`on_${t.run_type}_end`,n=t.inputs??e.inputs??{},i={output:t.outputs?.output??t.outputs,input:n};n.input&&Object.keys(n).length===1&&(i.input=n.input,e.inputs=n.input),await this.sendEndEvent({event:r,data:i,run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata??{}},e)}async onToolStart(t){let e=ag(t),r={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:"tool",inputs:t.inputs??{}};this.runInfoMap.set(t.id,r),await this.send({event:"on_tool_start",data:{input:t.inputs??{}},name:e,run_id:t.id,tags:t.tags??[],metadata:t.extra?.metadata??{}},r)}async onToolEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onToolEnd: Run ID ${t.id} not found in run map.`);if(e.inputs===void 0)throw new Error(`onToolEnd: Run ID ${t.id} is a tool call, and is expected to have traced inputs.`);let r=t.outputs?.output===void 0?t.outputs:t.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:r,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async onRetrieverStart(t){let e=ag(t),n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:"retriever",inputs:{query:t.inputs.query}};this.runInfoMap.set(t.id,n),await this.send({event:"on_retriever_start",data:{input:{query:t.inputs.query}},name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onRetrieverEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onRetrieverEnd: Run ID ${t.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:t.outputs?.documents??t.outputs,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async handleCustomEvent(t,e,r){let n=this.runInfoMap.get(r);if(n===void 0)throw new Error(`handleCustomEvent: Run ID ${r} not found in run map.`);await this.send({event:"on_custom_event",run_id:r,name:t,tags:n.tags,metadata:n.metadata,data:e},n)}async finish(){let t=[...this.tappedPromises.values()];Promise.all(t).finally(()=>{this.writer.close()})}};var pV=Object.prototype.toString,fV=t=>pV.call(t)==="[object Error]",mV=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function VR(t){if(!(t&&fV(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:mV.has(r)}function hV(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function cg(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(_),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},_=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&_.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function Kd(t,e={}){if(e={...e},hV(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,cg("factor",e.factor,{min:0,allowInfinity:!1}),cg("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),cg("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),cg("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await yV({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var ug=mn(Sh(),1),vV={};G(vV,{AsyncCaller:()=>Xo});var bV=[400,401,402,403,404,405,406,407,409],wV=t=>{if(t.message.startsWith("Cancel")||t.message.startsWith("AbortError")||t.name==="AbortError"||t?.code==="ECONNABORTED")throw t;let e=t?.response?.status??t?.status;if(e&&bV.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},Xo=class{maxConcurrency;maxRetries;onFailedAttempt;queue;constructor(t){this.maxConcurrency=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??6,this.onFailedAttempt=t.onFailedAttempt??wV;let e="default"in ug.default?ug.default.default:ug.default;this.queue=new e({concurrency:this.maxConcurrency})}async call(t,...e){return this.queue.add(()=>Kd(()=>t(...e).catch(r=>{throw r instanceof Error?r:new Error(r)}),{onFailedAttempt:({error:r})=>this.onFailedAttempt?.(r),retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(t,e,...r){if(t.signal){let n;return Promise.race([this.call(e,...r),new Promise((o,i)=>{n=()=>{i(Bi(t.signal))},t.signal?.addEventListener("abort",n)})]).finally(()=>{t.signal&&n&&t.signal.removeEventListener("abort",n)})}return this.call(e,...r)}fetch(...t){return this.call(()=>fetch(...t).then(e=>e.ok?e:Promise.reject(e)))}};var y0=class extends Un{name="RootListenersTracer";rootId;config;argOnStart;argOnEnd;argOnError;constructor({config:t,onStart:e,onEnd:r,onError:n}){super({_awaitHandler:!0}),this.config=t,this.argOnStart=e,this.argOnEnd=r,this.argOnError=n}persistRun(t){return Promise.resolve()}async onRunCreate(t){this.rootId||(this.rootId=t.id,this.argOnStart&&await this.argOnStart(t,this.config))}async onRunUpdate(t){t.id===this.rootId&&(t.error?this.argOnError&&await this.argOnError(t,this.config):this.argOnEnd&&await this.argOnEnd(t,this.config))}};function Hd(t){return t?t.lc_runnable:!1}var KR=class{includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;constructor(t){this.includeNames=t.includeNames,this.includeTypes=t.includeTypes,this.includeTags=t.includeTags,this.excludeNames=t.excludeNames,this.excludeTypes=t.excludeTypes,this.excludeTags=t.excludeTags}includeEvent(t,e){let r=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,n=t.tags??[];return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(e)),this.includeTags!==void 0&&(r=r||n.some(o=>this.includeTags?.includes(o))),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(e)),this.excludeTags!==void 0&&(r=r&&n.every(o=>!this.excludeTags?.includes(o))),r}},HR=t=>btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");var nn={};gi(nn,{$ZodAny:()=>a_,$ZodArray:()=>l_,$ZodAsyncError:()=>Fn,$ZodBase64:()=>Xg,$ZodBase64URL:()=>Yg,$ZodBigInt:()=>cp,$ZodBigIntFormat:()=>n_,$ZodBoolean:()=>ku,$ZodCIDRv4:()=>Wg,$ZodCIDRv6:()=>Jg,$ZodCUID:()=>jg,$ZodCUID2:()=>Dg,$ZodCatch:()=>S_,$ZodCheck:()=>Je,$ZodCheckBigIntFormat:()=>s$,$ZodCheckEndsWith:()=>y$,$ZodCheckGreaterThan:()=>Sg,$ZodCheckIncludes:()=>g$,$ZodCheckLengthEquals:()=>p$,$ZodCheckLessThan:()=>Ig,$ZodCheckLowerCase:()=>m$,$ZodCheckMaxLength:()=>l$,$ZodCheckMaxSize:()=>a$,$ZodCheckMimeType:()=>b$,$ZodCheckMinLength:()=>d$,$ZodCheckMinSize:()=>c$,$ZodCheckMultipleOf:()=>o$,$ZodCheckNumberFormat:()=>i$,$ZodCheckOverwrite:()=>w$,$ZodCheckProperty:()=>v$,$ZodCheckRegex:()=>f$,$ZodCheckSizeEquals:()=>u$,$ZodCheckStartsWith:()=>_$,$ZodCheckStringFormat:()=>Su,$ZodCheckUpperCase:()=>h$,$ZodCodec:()=>Au,$ZodCustom:()=>R_,$ZodCustomStringFormat:()=>t_,$ZodDate:()=>u_,$ZodDefault:()=>w_,$ZodDiscriminatedUnion:()=>d_,$ZodE164:()=>Qg,$ZodEmail:()=>Rg,$ZodEmoji:()=>zg,$ZodEncodeError:()=>Gi,$ZodEnum:()=>g_,$ZodError:()=>np,$ZodFile:()=>y_,$ZodFunction:()=>O_,$ZodGUID:()=>Pg,$ZodIPv4:()=>Gg,$ZodIPv6:()=>Kg,$ZodISODate:()=>Zg,$ZodISODateTime:()=>Bg,$ZodISODuration:()=>Vg,$ZodISOTime:()=>qg,$ZodIntersection:()=>p_,$ZodJWT:()=>e_,$ZodKSUID:()=>Fg,$ZodLazy:()=>C_,$ZodLiteral:()=>__,$ZodMAC:()=>Hg,$ZodMap:()=>m_,$ZodNaN:()=>k_,$ZodNanoID:()=>Mg,$ZodNever:()=>Eu,$ZodNonOptional:()=>$_,$ZodNull:()=>s_,$ZodNullable:()=>b_,$ZodNumber:()=>ap,$ZodNumberFormat:()=>r_,$ZodObject:()=>S$,$ZodObjectJIT:()=>k$,$ZodOptional:()=>xa,$ZodPipe:()=>T_,$ZodPrefault:()=>x_,$ZodPromise:()=>P_,$ZodReadonly:()=>E_,$ZodRealError:()=>Rr,$ZodRecord:()=>f_,$ZodRegistry:()=>Pu,$ZodSet:()=>h_,$ZodString:()=>Yi,$ZodStringFormat:()=>He,$ZodSuccess:()=>I_,$ZodSymbol:()=>o_,$ZodTemplateLiteral:()=>A_,$ZodTransform:()=>v_,$ZodTuple:()=>lp,$ZodType:()=>ye,$ZodULID:()=>Lg,$ZodURL:()=>Ng,$ZodUUID:()=>Cg,$ZodUndefined:()=>i_,$ZodUnion:()=>up,$ZodUnknown:()=>Tu,$ZodVoid:()=>c_,$ZodXID:()=>Ug,$brand:()=>Jd,$constructor:()=>$,$input:()=>D_,$output:()=>j_,Doc:()=>sp,JSONSchema:()=>$z,JSONSchemaGenerator:()=>zp,NEVER:()=>lg,TimePrecision:()=>B_,_any:()=>uy,_array:()=>T$,_base64:()=>Op,_base64url:()=>Pp,_bigint:()=>ry,_boolean:()=>ey,_catch:()=>j5,_check:()=>xz,_cidrv4:()=>Ep,_cidrv6:()=>Ap,_coercedBigint:()=>ny,_coercedBoolean:()=>ty,_coercedDate:()=>py,_coercedNumber:()=>H_,_coercedString:()=>U_,_cuid:()=>wp,_cuid2:()=>xp,_custom:()=>by,_date:()=>dy,_decode:()=>gg,_decodeAsync:()=>yg,_default:()=>N5,_discriminatedUnion:()=>x5,_e164:()=>Cp,_email:()=>mp,_emoji:()=>vp,_encode:()=>hg,_encodeAsync:()=>_g,_endsWith:()=>Bu,_enum:()=>E5,_file:()=>vy,_float32:()=>J_,_float64:()=>X_,_gt:()=>yo,_gte:()=>ir,_guid:()=>Cu,_includes:()=>Uu,_int:()=>W_,_int32:()=>Y_,_int64:()=>oy,_intersection:()=>$5,_ipv4:()=>kp,_ipv6:()=>Tp,_isoDate:()=>q_,_isoDateTime:()=>Z_,_isoDuration:()=>G_,_isoTime:()=>V_,_jwt:()=>Rp,_ksuid:()=>Sp,_lazy:()=>F5,_length:()=>Sa,_literal:()=>O5,_lowercase:()=>Du,_lt:()=>_o,_lte:()=>zr,_mac:()=>F_,_map:()=>k5,_max:()=>zr,_maxLength:()=>Ia,_maxSize:()=>$a,_mime:()=>Zu,_min:()=>ir,_minLength:()=>Qo,_minSize:()=>es,_multipleOf:()=>Qi,_nan:()=>fy,_nanoid:()=>bp,_nativeEnum:()=>A5,_negative:()=>hy,_never:()=>zu,_nonnegative:()=>_y,_nonoptional:()=>z5,_nonpositive:()=>gy,_normalize:()=>qu,_null:()=>cy,_nullable:()=>R5,_number:()=>K_,_optional:()=>C5,_overwrite:()=>Zn,_parse:()=>bu,_parseAsync:()=>wu,_pipe:()=>D5,_positive:()=>my,_promise:()=>B5,_property:()=>yy,_readonly:()=>L5,_record:()=>S5,_refine:()=>wy,_regex:()=>ju,_safeDecode:()=>bg,_safeDecodeAsync:()=>xg,_safeEncode:()=>vg,_safeEncodeAsync:()=>wg,_safeParse:()=>xu,_safeParseAsync:()=>$u,_set:()=>T5,_size:()=>Mu,_slugify:()=>Np,_startsWith:()=>Fu,_string:()=>L_,_stringFormat:()=>ka,_stringbool:()=>Sy,_success:()=>M5,_superRefine:()=>xy,_symbol:()=>sy,_templateLiteral:()=>U5,_toLowerCase:()=>Gu,_toUpperCase:()=>Ku,_transform:()=>P5,_trim:()=>Vu,_tuple:()=>I5,_uint32:()=>Q_,_uint64:()=>iy,_ulid:()=>$p,_undefined:()=>ay,_union:()=>w5,_unknown:()=>Nu,_uppercase:()=>Lu,_url:()=>Ru,_uuid:()=>hp,_uuidv4:()=>gp,_uuidv6:()=>_p,_uuidv7:()=>yp,_void:()=>ly,_xid:()=>Ip,clone:()=>Qe,config:()=>yt,decode:()=>tN,decodeAsync:()=>nN,describe:()=>$y,encode:()=>eN,encodeAsync:()=>rN,flattenError:()=>yu,formatError:()=>vu,globalConfig:()=>Wd,globalRegistry:()=>Ge,isValidBase64:()=>I$,isValidBase64URL:()=>IN,isValidJWT:()=>SN,locales:()=>Ou,meta:()=>Iy,parse:()=>Bn,parseAsync:()=>Yo,prettifyError:()=>mg,regexes:()=>Nr,registry:()=>fp,safeDecode:()=>iN,safeDecodeAsync:()=>aN,safeEncode:()=>oN,safeEncodeAsync:()=>sN,safeParse:()=>ba,safeParseAsync:()=>Iu,toDotPath:()=>QR,toJSONSchema:()=>vo,treeifyError:()=>fg,util:()=>M,version:()=>x$});var lg=Object.freeze({status:"aborted"});function $(t,e,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let u=s.prototype,l=Object.keys(u);for(let d=0;dr?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var Jd=Symbol("zod_brand"),Fn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Gi=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Wd={};function yt(t){return t&&Object.assign(Wd,t),Wd}var M={};gi(M,{BIGINT_FORMAT_RANGES:()=>E0,Class:()=>b0,NUMBER_FORMAT_RANGES:()=>T0,aborted:()=>Xi,allowsEval:()=>$0,assert:()=>kV,assertEqual:()=>xV,assertIs:()=>IV,assertNever:()=>SV,assertNotEqual:()=>$V,assignProp:()=>Hi,base64ToUint8Array:()=>JR,base64urlToUint8Array:()=>ZV,cached:()=>gu,captureStackTrace:()=>pg,cleanEnum:()=>BV,cleanRegex:()=>Qd,clone:()=>Qe,cloneDef:()=>EV,createTransparentProxy:()=>NV,defineLazy:()=>Me,esc:()=>dg,escapeRegex:()=>bn,extend:()=>jV,finalizeIssue:()=>rn,floatSafeRemainder:()=>w0,getElementAtPath:()=>AV,getEnumValues:()=>Yd,getLengthableOrigin:()=>rp,getParsedType:()=>RV,getSizableOrigin:()=>tp,hexToUint8Array:()=>VV,isObject:()=>va,isPlainObject:()=>Ji,issue:()=>_u,joinValues:()=>E,jsonStringifyReplacer:()=>hu,merge:()=>LV,mergeDefs:()=>Wi,normalizeParams:()=>D,nullish:()=>Ki,numKeys:()=>CV,objectClone:()=>TV,omit:()=>MV,optionalKeys:()=>k0,partial:()=>UV,pick:()=>zV,prefixIssues:()=>tn,primitiveTypes:()=>S0,promiseAllObject:()=>OV,propertyKeyTypes:()=>ep,randomString:()=>PV,required:()=>FV,safeExtend:()=>DV,shallowClone:()=>I0,slugify:()=>x0,stringifyPrimitive:()=>j,uint8ArrayToBase64:()=>XR,uint8ArrayToBase64url:()=>qV,uint8ArrayToHex:()=>GV,unwrapMessage:()=>Xd});function xV(t){return t}function $V(t){return t}function IV(t){}function SV(t){throw new Error}function kV(t){}function Yd(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function E(t,e="|"){return t.map(r=>j(r)).join(e)}function hu(t,e){return typeof e=="bigint"?e.toString():e}function gu(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ki(t){return t==null}function Qd(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function w0(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,s=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return s%a/10**i}var WR=Symbol("evaluating");function Me(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==WR)return n===void 0&&(n=WR,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function TV(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Hi(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Wi(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function EV(t){return Wi(t._zod.def)}function AV(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function OV(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i{};function va(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var $0=gu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Ji(t){if(va(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(va(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function I0(t){return Ji(t)?{...t}:Array.isArray(t)?[...t]:t}function CV(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var RV=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},ep=new Set(["string","number","symbol"]),S0=new Set(["string","number","bigint","boolean","symbol","undefined"]);function bn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qe(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function D(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function NV(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function j(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function k0(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var T0={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},E0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zV(t,e){let r=t._zod.def,n=Wi(t._zod.def,{get shape(){let o={};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&(o[i]=r.shape[i])}return Hi(this,"shape",o),o},checks:[]});return Qe(t,n)}function MV(t,e){let r=t._zod.def,n=Wi(t._zod.def,{get shape(){let o={...t._zod.def.shape};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&delete o[i]}return Hi(this,"shape",o),o},checks:[]});return Qe(t,n)}function jV(t,e){if(!Ji(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let o=Wi(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return Hi(this,"shape",i),i},checks:[]});return Qe(t,o)}function DV(t,e){if(!Ji(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return Hi(this,"shape",n),n},checks:t._zod.def.checks};return Qe(t,r)}function LV(t,e){let r=Wi(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return Hi(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Qe(t,r)}function UV(t,e,r){let n=Wi(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=t?new t({type:"optional",innerType:o[s]}):o[s])}else for(let s in o)i[s]=t?new t({type:"optional",innerType:o[s]}):o[s];return Hi(this,"shape",i),i},checks:[]});return Qe(e,n)}function FV(t,e,r){let n=Wi(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new t({type:"nonoptional",innerType:o[s]}))}else for(let s in o)i[s]=new t({type:"nonoptional",innerType:o[s]});return Hi(this,"shape",i),i},checks:[]});return Qe(e,n)}function Xi(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Xd(t){return typeof t=="string"?t:t?.message}function rn(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=Xd(t.inst?._zod.def?.error?.(t))??Xd(e?.error?.(t))??Xd(r.customError?.(t))??Xd(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function tp(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function rp(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function _u(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function BV(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function JR(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;ne.toString(16).padStart(2,"0")).join("")}var b0=class{constructor(...e){}};var YR=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,hu,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},np=$("$ZodError",YR),Rr=$("$ZodError",YR,{Parent:Error});function yu(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function vu(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>n({issues:s}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let s=r,a=0;for(;ar.message){let r={errors:[]},n=(o,i=[])=>{var s,a;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>n({issues:u},c.path));else if(c.code==="invalid_key")n({issues:c.issues},c.path);else if(c.code==="invalid_element")n({issues:c.issues},c.path);else{let u=[...i,...c.path];if(u.length===0){r.errors.push(e(c));continue}let l=r,d=0;for(;dtypeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function mg(t){let e=[],r=[...t.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${QR(n.path)}`);return e.join(` +`)}var bu=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Fn;if(s.issues.length){let a=new(o?.Err??t)(s.issues.map(c=>rn(c,i,yt())));throw pg(a,o?.callee),a}return s.value},Bn=bu(Rr),wu=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(o?.Err??t)(s.issues.map(c=>rn(c,i,yt())));throw pg(a,o?.callee),a}return s.value},Yo=wu(Rr),xu=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Fn;return i.issues.length?{success:!1,error:new(t??np)(i.issues.map(s=>rn(s,o,yt())))}:{success:!0,data:i.value}},ba=xu(Rr),$u=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(s=>rn(s,o,yt())))}:{success:!0,data:i.value}},Iu=$u(Rr),hg=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return bu(t)(e,r,o)},eN=hg(Rr),gg=t=>(e,r,n)=>bu(t)(e,r,n),tN=gg(Rr),_g=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wu(t)(e,r,o)},rN=_g(Rr),yg=t=>async(e,r,n)=>wu(t)(e,r,n),nN=yg(Rr),vg=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return xu(t)(e,r,o)},oN=vg(Rr),bg=t=>(e,r,n)=>xu(t)(e,r,n),iN=bg(Rr),wg=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return $u(t)(e,r,o)},sN=wg(Rr),xg=t=>async(e,r,n)=>$u(t)(e,r,n),aN=xg(Rr);var Nr={};gi(Nr,{base64:()=>q0,base64url:()=>$g,bigint:()=>J0,boolean:()=>Q0,browserEmail:()=>t3,cidrv4:()=>B0,cidrv6:()=>Z0,cuid:()=>A0,cuid2:()=>O0,date:()=>G0,datetime:()=>H0,domain:()=>o3,duration:()=>z0,e164:()=>V0,email:()=>j0,emoji:()=>D0,extendedDuration:()=>HV,guid:()=>M0,hex:()=>i3,hostname:()=>n3,html5Email:()=>YV,idnEmail:()=>e3,integer:()=>X0,ipv4:()=>L0,ipv6:()=>U0,ksuid:()=>R0,lowercase:()=>r$,mac:()=>F0,md5_base64:()=>a3,md5_base64url:()=>c3,md5_hex:()=>s3,nanoid:()=>N0,null:()=>e$,number:()=>Y0,rfc5322Email:()=>QV,sha1_base64:()=>l3,sha1_base64url:()=>d3,sha1_hex:()=>u3,sha256_base64:()=>f3,sha256_base64url:()=>m3,sha256_hex:()=>p3,sha384_base64:()=>g3,sha384_base64url:()=>_3,sha384_hex:()=>h3,sha512_base64:()=>v3,sha512_base64url:()=>b3,sha512_hex:()=>y3,string:()=>W0,time:()=>K0,ulid:()=>P0,undefined:()=>t$,unicodeEmail:()=>cN,uppercase:()=>n$,uuid:()=>wa,uuid4:()=>WV,uuid6:()=>JV,uuid7:()=>XV,xid:()=>C0});var A0=/^[cC][^\s-]{8,}$/,O0=/^[0-9a-z]+$/,P0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,C0=/^[0-9a-vA-V]{20}$/,R0=/^[A-Za-z0-9]{27}$/,N0=/^[a-zA-Z0-9_-]{21}$/,z0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,HV=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,M0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,wa=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,WV=wa(4),JV=wa(6),XV=wa(7),j0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,YV=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,QV=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,cN=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,e3=cN,t3=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,r3="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function D0(){return new RegExp(r3,"u")}var L0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,U0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,F0=t=>{let e=bn(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},B0=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Z0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,q0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$g=/^[A-Za-z0-9_-]*$/,n3=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,o3=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,V0=/^\+(?:[0-9]){6,14}[0-9]$/,uN="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",G0=new RegExp(`^${uN}$`);function lN(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function K0(t){return new RegExp(`^${lN(t)}$`)}function H0(t){let e=lN({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${uN}T(?:${n})$`)}var W0=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},J0=/^-?\d+n?$/,X0=/^-?\d+$/,Y0=/^-?\d+(?:\.\d+)?/,Q0=/^(?:true|false)$/i,e$=/^null$/i;var t$=/^undefined$/i;var r$=/^[^A-Z]*$/,n$=/^[^a-z]*$/,i3=/^[0-9a-fA-F]*$/;function op(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function ip(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var s3=/^[0-9a-fA-F]{32}$/,a3=op(22,"=="),c3=ip(22),u3=/^[0-9a-fA-F]{40}$/,l3=op(27,"="),d3=ip(27),p3=/^[0-9a-fA-F]{64}$/,f3=op(43,"="),m3=ip(43),h3=/^[0-9a-fA-F]{96}$/,g3=op(64,""),_3=ip(64),y3=/^[0-9a-fA-F]{128}$/,v3=op(86,"=="),b3=ip(86);var Je=$("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),pN={number:"number",bigint:"bigint",object:"date"},Ig=$("$ZodCheckLessThan",(t,e)=>{Je.init(t,e);let r=pN[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?n.value<=e.value:n.value{Je.init(t,e);let r=pN[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),o$=$("$ZodCheckMultipleOf",(t,e)=>{Je.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):w0(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),i$=$("$ZodCheckNumberFormat",(t,e)=>{Je.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=T0[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=o,a.maximum=i,r&&(a.pattern=X0)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}ai&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:t})}}),s$=$("$ZodCheckBigIntFormat",(t,e)=>{Je.init(t,e);let[r,n]=E0[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;in&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inst:t})}}),a$=$("$ZodCheckMaxSize",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=n.value;o.size<=e.maximum||n.issues.push({origin:tp(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),c$=$("$ZodCheckMinSize",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:tp(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),u$=$("$ZodCheckSizeEquals",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let s=i>e.size;n.issues.push({origin:tp(o),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),l$=$("$ZodCheckMaxLength",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=n.value;if(o.length<=e.maximum)return;let s=rp(o);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),d$=$("$ZodCheckMinLength",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let s=rp(o);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),p$=$("$ZodCheckLengthEquals",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let s=rp(o),a=i>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Su=$("$ZodCheckStringFormat",(t,e)=>{var r,n;Je.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),f$=$("$ZodCheckRegex",(t,e)=>{Su.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),m$=$("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=r$),Su.init(t,e)}),h$=$("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=n$),Su.init(t,e)}),g$=$("$ZodCheckIncludes",(t,e)=>{Je.init(t,e);let r=bn(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),_$=$("$ZodCheckStartsWith",(t,e)=>{Je.init(t,e);let r=new RegExp(`^${bn(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),y$=$("$ZodCheckEndsWith",(t,e)=>{Je.init(t,e);let r=new RegExp(`.*${bn(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function dN(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues))}var v$=$("$ZodCheckProperty",(t,e)=>{Je.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>dN(o,r,e.property));dN(n,r,e.property)}}),b$=$("$ZodCheckMimeType",(t,e)=>{Je.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),w$=$("$ZodCheckOverwrite",(t,e)=>{Je.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var sp=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(` +`).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,o.join(` +`))}};var x$={major:4,minor:1,patch:13};var ye=$("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=x$;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(s,a,c)=>{let u=Xi(s),l;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(u)continue;let f=s.issues.length,p=d._zod.check(s);if(p instanceof Promise&&c?.async===!1)throw new Fn;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,s.issues.length!==f&&(u||(u=Xi(s,f)))});else{if(s.issues.length===f)continue;u||(u=Xi(s,f))}}return l?l.then(()=>s):s},i=(s,a,c)=>{if(Xi(s))return s.aborted=!0,s;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new Fn;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let u=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,s,a)):i(u,s,a)}let c=t._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Fn;return c.then(u=>o(u,n,a))}return o(c,n,a)}}t["~standard"]={validate:o=>{try{let i=ba(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Iu(t,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),Yi=$("$ZodString",(t,e)=>{ye.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??W0(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),He=$("$ZodStringFormat",(t,e)=>{Su.init(t,e),Yi.init(t,e)}),Pg=$("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=M0),He.init(t,e)}),Cg=$("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=wa(n))}else e.pattern??(e.pattern=wa());He.init(t,e)}),Rg=$("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=j0),He.init(t,e)}),Ng=$("$ZodURL",(t,e)=>{He.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),zg=$("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=D0()),He.init(t,e)}),Mg=$("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=N0),He.init(t,e)}),jg=$("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=A0),He.init(t,e)}),Dg=$("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=O0),He.init(t,e)}),Lg=$("$ZodULID",(t,e)=>{e.pattern??(e.pattern=P0),He.init(t,e)}),Ug=$("$ZodXID",(t,e)=>{e.pattern??(e.pattern=C0),He.init(t,e)}),Fg=$("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=R0),He.init(t,e)}),Bg=$("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=H0(e)),He.init(t,e)}),Zg=$("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=G0),He.init(t,e)}),qg=$("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=K0(e)),He.init(t,e)}),Vg=$("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=z0),He.init(t,e)}),Gg=$("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=L0),He.init(t,e),t._zod.bag.format="ipv4"}),Kg=$("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=U0),He.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Hg=$("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=F0(e.delimiter)),He.init(t,e),t._zod.bag.format="mac"}),Wg=$("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=B0),He.init(t,e)}),Jg=$("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Z0),He.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function I$(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Xg=$("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=q0),He.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{I$(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function IN(t){if(!$g.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return I$(r)}var Yg=$("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=$g),He.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{IN(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Qg=$("$ZodE164",(t,e)=>{e.pattern??(e.pattern=V0),He.init(t,e)});function SN(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var e_=$("$ZodJWT",(t,e)=>{He.init(t,e),t._zod.check=r=>{SN(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),t_=$("$ZodCustomStringFormat",(t,e)=>{He.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),ap=$("$ZodNumber",(t,e)=>{ye.init(t,e),t._zod.pattern=t._zod.bag.pattern??Y0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),r_=$("$ZodNumberFormat",(t,e)=>{i$.init(t,e),ap.init(t,e)}),ku=$("$ZodBoolean",(t,e)=>{ye.init(t,e),t._zod.pattern=Q0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),cp=$("$ZodBigInt",(t,e)=>{ye.init(t,e),t._zod.pattern=J0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),n_=$("$ZodBigIntFormat",(t,e)=>{s$.init(t,e),cp.init(t,e)}),o_=$("$ZodSymbol",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),i_=$("$ZodUndefined",(t,e)=>{ye.init(t,e),t._zod.pattern=t$,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),s_=$("$ZodNull",(t,e)=>{ye.init(t,e),t._zod.pattern=e$,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),a_=$("$ZodAny",(t,e)=>{ye.init(t,e),t._zod.parse=r=>r}),Tu=$("$ZodUnknown",(t,e)=>{ye.init(t,e),t._zod.parse=r=>r}),Eu=$("$ZodNever",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),c_=$("$ZodVoid",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),u_=$("$ZodDate",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});function mN(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues)),e.value[r]=t.value}var l_=$("$ZodArray",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let s=0;smN(u,r,s))):mN(c,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function Og(t,e,r,n){t.issues.length&&e.issues.push(...tn(r,t.issues)),t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function kN(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=k0(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function TN(t,e,r,n,o,i){let s=[],a=o.keySet,c=o.catchall._zod,u=c.def.type;for(let l in e){if(a.has(l))continue;if(u==="never"){s.push(l);continue}let d=c.run({value:e[l],issues:[]},n);d instanceof Promise?t.push(d.then(f=>Og(f,r,l,e))):Og(d,r,l,e)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var S$=$("$ZodObject",(t,e)=>{if(ye.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=gu(()=>kN(e));Me(t._zod,"propValues",()=>{let a=e.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=va,i=e.catchall,s;t._zod.parse=(a,c)=>{s??(s=n.value);let u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),a;a.value={};let l=[],d=s.shape;for(let f of s.keys){let m=d[f]._zod.run({value:u[f],issues:[]},c);m instanceof Promise?l.push(m.then(h=>Og(h,a,f,u))):Og(m,a,f,u)}return i?TN(l,u,a,c,n.value,t):l.length?Promise.all(l).then(()=>a):a}}),k$=$("$ZodObjectJIT",(t,e)=>{S$.init(t,e);let r=t._zod.parse,n=gu(()=>kN(e)),o=f=>{let p=new sp(["shape","payload","ctx"]),m=n.value,h=x=>{let k=dg(x);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};p.write("const input = payload.value;");let _=Object.create(null),v=0;for(let x of m.keys)_[x]=`key_${v++}`;p.write("const newResult = {};");for(let x of m.keys){let k=_[x],T=dg(x);p.write(`const ${k} = ${h(x)};`),p.write(` + if (${k}.issues.length) { + payload.issues = payload.issues.concat(${k}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${T}, ...iss.path] : [${T}] + }))); + } + + + if (${k}.value === undefined) { + if (${T} in input) { + newResult[${T}] = undefined; + } + } else { + newResult[${T}] = ${k}.value; + } + + `)}p.write("payload.value = newResult;"),p.write("return payload;");let b=p.compile();return(x,k)=>b(f,x,k)},i,s=va,a=!Wd.jitless,u=a&&$0.value,l=e.catchall,d;t._zod.parse=(f,p)=>{d??(d=n.value);let m=f.value;return s(m)?a&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(e.shape)),f=i(f,p),l?TN([],m,f,p,d,t):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function hN(t,e,r,n){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let o=t.filter(i=>!Xi(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(s=>rn(s,n,yt())))}),e)}var up=$("$ZodUnion",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Me(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Me(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),Me(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Qd(i.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1,a=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}return s?Promise.all(a).then(c=>hN(c,o,t,i)):hN(a,o,t,i)}}),d_=$("$ZodDiscriminatedUnion",(t,e)=>{up.init(t,e);let r=t._zod.parse;Me(t._zod,"propValues",()=>{let o={};for(let i of e.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=gu(()=>{let o=e.options,i=new Map;for(let s of o){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});t._zod.parse=(o,i)=>{let s=o.value;if(!va(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),o;let a=n.value.get(s?.[e.discriminator]);return a?a._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:s,path:[e.discriminator],inst:t}),o)}}),p_=$("$ZodIntersection",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),s=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>gN(r,c,u)):gN(r,i,s)}});function $$(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Ji(t)&&Ji(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let s=$$(t[i],e[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n{ye.init(t,e);let r=e.items;t._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let s=[],a=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=a===-1?0:r.length-a;if(!e.rest){let l=i.length>r.length,d=i.length=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?s.push(d.then(f=>kg(f,n,u))):kg(d,n,u)}if(e.rest){let l=i.slice(r.length);for(let d of l){u++;let f=e.rest._zod.run({value:d,issues:[]},o);f instanceof Promise?s.push(f.then(p=>kg(p,n,u))):kg(f,n,u)}}return s.length?Promise.all(s).then(()=>n):n}});function kg(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues)),e.value[r]=t.value}var f_=$("$ZodRecord",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Ji(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...tn(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...tn(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let c=e.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(l=>rn(l,n,yt())),input:a,path:[a],inst:t}),r.value[c.value]=c.value;continue}let u=e.valueType._zod.run({value:o[a],issues:[]},n);u instanceof Promise?i.push(u.then(l=>{l.issues.length&&r.issues.push(...tn(a,l.issues)),r.value[c.value]=l.value})):(u.issues.length&&r.issues.push(...tn(a,u.issues)),r.value[c.value]=u.value)}}return i.length?Promise.all(i).then(()=>r):r}}),m_=$("$ZodMap",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[s,a]of o){let c=e.keyType._zod.run({value:s,issues:[]},n),u=e.valueType._zod.run({value:a,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{_N(l,d,r,s,o,t,n)})):_N(c,u,r,s,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});function _N(t,e,r,n,o,i,s){t.issues.length&&(ep.has(typeof n)?r.issues.push(...tn(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(a=>rn(a,s,yt()))})),e.issues.length&&(ep.has(typeof n)?r.issues.push(...tn(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(a=>rn(a,s,yt()))})),r.value.set(t.value,e.value)}var h_=$("$ZodSet",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of o){let a=e.valueType._zod.run({value:s,issues:[]},n);a instanceof Promise?i.push(a.then(c=>yN(c,r))):yN(a,r)}return i.length?Promise.all(i).then(()=>r):r}});function yN(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var g_=$("$ZodEnum",(t,e)=>{ye.init(t,e);let r=Yd(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>ep.has(typeof o)).map(o=>typeof o=="string"?bn(o):o.toString()).join("|")})$`),t._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:t}),o}}),__=$("$ZodLiteral",(t,e)=>{if(ye.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?bn(n):n?bn(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),y_=$("$ZodFile",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),v_=$("$ZodTransform",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new Fn;return r.value=o,r}});function vN(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var xa=$("$ZodOptional",(t,e)=>{ye.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Me(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Me(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qd(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>vN(i,r.value)):vN(o,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),b_=$("$ZodNullable",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.innerType._zod.optin),Me(t._zod,"optout",()=>e.innerType._zod.optout),Me(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qd(r.source)}|null)$`):void 0}),Me(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),w_=$("$ZodDefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>bN(i,e)):bN(o,e)}});function bN(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var x_=$("$ZodPrefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),$_=$("$ZodNonOptional",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>wN(i,t)):wN(o,t)}});function wN(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var I_=$("$ZodSuccess",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi("ZodSuccess");let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),S_=$("$ZodCatch",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.innerType._zod.optin),Me(t._zod,"optout",()=>e.innerType._zod.optout),Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(s=>rn(s,n,yt()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>rn(i,n,yt()))},input:r.value}),r.issues=[]),r)}}),k_=$("$ZodNaN",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),T_=$("$ZodPipe",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>e.in._zod.values),Me(t._zod,"optin",()=>e.in._zod.optin),Me(t._zod,"optout",()=>e.out._zod.optout),Me(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Tg(s,e.in,n)):Tg(i,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Tg(i,e.out,n)):Tg(o,e.out,n)}});function Tg(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var Au=$("$ZodCodec",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>e.in._zod.values),Me(t._zod,"optin",()=>e.in._zod.optin),Me(t._zod,"optout",()=>e.out._zod.optout),Me(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(s=>Eg(s,e,n)):Eg(i,e,n)}else{let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Eg(s,e,n)):Eg(i,e,n)}}});function Eg(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(i=>Ag(t,i,e.out,r)):Ag(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(i=>Ag(t,i,e.in,r)):Ag(t,o,e.in,r)}}function Ag(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}var E_=$("$ZodReadonly",(t,e)=>{ye.init(t,e),Me(t._zod,"propValues",()=>e.innerType._zod.propValues),Me(t._zod,"values",()=>e.innerType._zod.values),Me(t._zod,"optin",()=>e.innerType?._zod?.optin),Me(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(xN):xN(o)}});function xN(t){return t.value=Object.freeze(t.value),t}var A_=$("$ZodTemplateLiteral",(t,e)=>{ye.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,s=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,s))}else if(n===null||S0.has(typeof n))r.push(bn(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"template_literal",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),O_=$("$ZodFunction",(t,e)=>(ye.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=t._def.input?Bn(t._def.input,n):n,i=Reflect.apply(r,this,o);return t._def.output?Bn(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=t._def.input?await Yo(t._def.input,n):n,i=await Reflect.apply(r,this,o);return t._def.output?await Yo(t._def.output,i):i}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new lp({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),P_=$("$ZodPromise",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),C_=$("$ZodLazy",(t,e)=>{ye.init(t,e),Me(t._zod,"innerType",()=>e.getter()),Me(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),Me(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),Me(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),Me(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),R_=$("$ZodCustom",(t,e)=>{Je.init(t,e),ye.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>$N(i,r,n,t));$N(o,r,n,t)}});function $N(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(_u(o))}}var Ou={};gi(Ou,{ar:()=>EN,az:()=>AN,be:()=>PN,bg:()=>CN,ca:()=>RN,cs:()=>NN,da:()=>zN,de:()=>MN,en:()=>N_,eo:()=>jN,es:()=>DN,fa:()=>LN,fi:()=>UN,fr:()=>FN,frCA:()=>BN,he:()=>ZN,hu:()=>qN,id:()=>VN,is:()=>GN,it:()=>KN,ja:()=>HN,ka:()=>WN,kh:()=>JN,km:()=>z_,ko:()=>XN,lt:()=>QN,mk:()=>ez,ms:()=>tz,nl:()=>rz,no:()=>nz,ota:()=>oz,pl:()=>sz,ps:()=>iz,pt:()=>az,ru:()=>uz,sl:()=>lz,sv:()=>dz,ta:()=>pz,th:()=>fz,tr:()=>mz,ua:()=>hz,uk:()=>M_,ur:()=>gz,vi:()=>_z,yo:()=>bz,zhCN:()=>yz,zhTW:()=>vz});var x3=()=>{let t={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return o=>{switch(o.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${j(o.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${o.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${n[i.format]??o.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${o.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${o.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${o.keys.length>1?"\u0629":""}: ${E(o.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function EN(){return{localeError:x3()}}var $3=()=>{let t={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o.expected}, daxil olan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${j(o.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${n[i.format]??o.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${o.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${o.keys.length>1?"lar":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${o.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function AN(){return{localeError:$3()}}function ON(t,e,r,n){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?n:i===1?e:i>=2&&i<=4?r:n}var I3=()=>{let t={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0456\u045E";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${j(o.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),c=ON(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${o.maximum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),c=ON(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${o.minimum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${o.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${o.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function PN(){return{localeError:I3()}}var S3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(t))return"\u043C\u0430\u0441\u0438\u0432";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},k3=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function e(n){return t[n]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"};return n=>{switch(n.code){case"invalid_type":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${S3(n.input)}`;case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${j(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.maximum.toString()} ${i.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.minimum.toString()} ${i.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;if(o.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${o.prefix}"`;if(o.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${o.suffix}"`;if(o.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${o.includes}"`;if(o.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${o.pattern}`;let i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return o.format==="emoji"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="datetime"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="date"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),o.format==="time"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="duration"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${i} ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${E(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function CN(){return{localeError:k3()}}var T3=()=>{let t={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${o.expected}, s'ha rebut ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Valor inv\xE0lid: s'esperava ${j(o.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${E(o.values," o ")}`;case"too_big":{let i=o.inclusive?"com a m\xE0xim":"menys de",s=e(o.origin);return s?`Massa gran: s'esperava que ${o.origin??"el valor"} contingu\xE9s ${i} ${o.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${o.origin??"el valor"} fos ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"com a m\xEDnim":"m\xE9s de",s=e(o.origin);return s?`Massa petit: s'esperava que ${o.origin} contingu\xE9s ${i} ${o.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${o.origin} fos ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${n[i.format]??o.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${o.divisor}`;case"unrecognized_keys":return`Clau${o.keys.length>1?"s":""} no reconeguda${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${o.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${o.origin}`;default:return"Entrada inv\xE0lida"}}};function RN(){return{localeError:T3()}}var E3=()=>{let t={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(o))return"pole";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return o=>{switch(o.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o.expected}, obdr\u017Eeno ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${j(o.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${n[i.format]??o.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${o.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${E(o.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${o.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${o.origin}`;default:return"Neplatn\xFD vstup"}}};function NN(){return{localeError:E3()}}var A3=()=>{let t={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},e={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};function r(s){return t[s]??null}function n(s){return e[s]??s}let o=s=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"tal";case"object":return Array.isArray(s)?"liste":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype&&s.constructor?s.constructor.name:"objekt"}return a},i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return s=>{switch(s.code){case"invalid_type":return`Ugyldigt input: forventede ${n(s.expected)}, fik ${n(o(s.input))}`;case"invalid_value":return s.values.length===1?`Ugyldig v\xE6rdi: forventede ${j(s.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${E(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=r(s.origin),u=n(s.origin);return c?`For stor: forventede ${u??"value"} ${c.verb} ${a} ${s.maximum.toString()} ${c.unit??"elementer"}`:`For stor: forventede ${u??"value"} havde ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=r(s.origin),u=n(s.origin);return c?`For lille: forventede ${u} ${c.verb} ${a} ${s.minimum.toString()} ${c.unit}`:`For lille: forventede ${u} havde ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Ugyldig streng: skal starte med "${a.prefix}"`:a.format==="ends_with"?`Ugyldig streng: skal ende med "${a.suffix}"`:a.format==="includes"?`Ugyldig streng: skal indeholde "${a.includes}"`:a.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${a.pattern}`:`Ugyldig ${i[a.format]??s.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${s.divisor}`;case"unrecognized_keys":return`${s.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${E(s.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${s.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${s.origin}`;default:return"Ugyldigt input"}}};function zN(){return{localeError:A3()}}var O3=()=>{let t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"Zahl";case"object":{if(Array.isArray(o))return"Array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return o=>{switch(o.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${o.expected}, erhalten ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ung\xFCltige Eingabe: erwartet ${j(o.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ist`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ist`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${o.divisor} sein`;case"unrecognized_keys":return`${o.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${o.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${o.origin}`;default:return"Ung\xFCltige Eingabe"}}};function MN(){return{localeError:O3()}}var P3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},C3=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${P3(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${j(n.values[0])}`:`Invalid option: expected one of ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function N_(){return{localeError:C3()}}var R3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"nombro";case"object":{if(Array.isArray(t))return"tabelo";if(t===null)return"senvalora";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},N3=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(n){return t[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return n=>{switch(n.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${n.expected}, ricevi\u011Dis ${R3(n.input)}`;case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${j(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()} ${i.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${o}${n.minimum.toString()} ${i.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${r[o.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function jN(){return{localeError:N3()}}var z3=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},e={string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};function r(s){return t[s]??null}function n(s){return e[s]??s}let o=s=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"number";case"object":return Array.isArray(s)?"array":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype?s.constructor.name:"object"}return a},i={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return s=>{switch(s.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${n(s.expected)}, recibido ${n(o(s.input))}`;case"invalid_value":return s.values.length===1?`Entrada inv\xE1lida: se esperaba ${j(s.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${E(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=r(s.origin),u=n(s.origin);return c?`Demasiado grande: se esperaba que ${u??"valor"} tuviera ${a}${s.maximum.toString()} ${c.unit??"elementos"}`:`Demasiado grande: se esperaba que ${u??"valor"} fuera ${a}${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=r(s.origin),u=n(s.origin);return c?`Demasiado peque\xF1o: se esperaba que ${u} tuviera ${a}${s.minimum.toString()} ${c.unit}`:`Demasiado peque\xF1o: se esperaba que ${u} fuera ${a}${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${a.prefix}"`:a.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${a.suffix}"`:a.format==="includes"?`Cadena inv\xE1lida: debe incluir "${a.includes}"`:a.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${a.pattern}`:`Inv\xE1lido ${i[a.format]??s.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${s.divisor}`;case"unrecognized_keys":return`Llave${s.keys.length>1?"s":""} desconocida${s.keys.length>1?"s":""}: ${E(s.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${n(s.origin)}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${n(s.origin)}`;default:return"Entrada inv\xE1lida"}}};function DN(){return{localeError:z3()}}var M3=()=>{let t={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0622\u0631\u0627\u06CC\u0647";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return o=>{switch(o.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${r(o.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":return o.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${j(o.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${E(o.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${n[i.format]??o.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${o.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${o.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${E(o.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${o.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${o.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function LN(){return{localeError:M3()}}var j3=()=>{let t={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return o=>{switch(o.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${o.expected}, oli ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${j(o.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${i}${o.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${i}${o.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${n[i.format]??o.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${o.divisor} monikerta`;case"unrecognized_keys":return`${o.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${E(o.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function UN(){return{localeError:j3()}}var D3=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombre";case"object":{if(Array.isArray(o))return"tableau";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : ${o.expected} attendu, ${r(o.input)} re\xE7u`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : ${j(o.values[0])} attendu`:`Option invalide : une valeur parmi ${E(o.values,"|")} attendue`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Trop grand : ${o.origin??"valeur"} doit ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o.origin??"valeur"} doit \xEAtre ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Trop petit : ${o.origin} doit ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Trop petit : ${o.origin} doit \xEAtre ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${E(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function FN(){return{localeError:D3()}}var L3=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${o.expected}, re\xE7u ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : attendu ${j(o.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u2264":"<",s=e(o.origin);return s?`Trop grand : attendu que ${o.origin??"la valeur"} ait ${i}${o.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${o.origin??"la valeur"} soit ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u2265":">",s=e(o.origin);return s?`Trop petit : attendu que ${o.origin} ait ${i}${o.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${o.origin} soit ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${E(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function BN(){return{localeError:L3()}}var U3=()=>{let t={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},e={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=u=>u?t[u]:void 0,n=u=>{let l=r(u);return l?l.label:u??t.unknown.label},o=u=>`\u05D4${n(u)}`,i=u=>(r(u)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",s=u=>u?e[u]??null:null,a=u=>{let l=typeof u;switch(l){case"number":return Number.isNaN(u)?"NaN":"number";case"object":return Array.isArray(u)?"array":u===null?"null":Object.getPrototypeOf(u)!==Object.prototype&&u.constructor?u.constructor.name:"object";default:return l}},c={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}};return u=>{switch(u.code){case"invalid_type":{let l=u.expected,d=n(l),f=a(u.input),p=t[f]?.label??f;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`}case"invalid_value":{if(u.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${j(u.values[0])}`;let l=u.values.map(p=>j(p));if(u.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l[0]} \u05D0\u05D5 ${l[1]}`;let d=l[l.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let l=s(u.origin),d=o(u.origin??"value");if(u.origin==="string")return`${l?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${u.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=u.inclusive?`${u.maximum} ${l?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${l?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?"<=":"<",p=i(u.origin??"value");return l?.unit?`${l.longLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()} ${l.unit}`:`${l?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()}`}case"too_small":{let l=s(u.origin),d=o(u.origin??"value");if(u.origin==="string")return`${l?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${u.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let _=(u.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${_}`}let h=u.inclusive?`${u.minimum} ${l?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${l?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?">=":">",p=i(u.origin??"value");return l?.unit?`${l.shortLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()} ${l.unit}`:`${l?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()}`}case"invalid_format":{let l=u;if(l.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${l.prefix}"`;if(l.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${l.suffix}"`;if(l.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${l.includes}"`;if(l.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${l.pattern}`;let d=c[l.format],f=d?.label??l.format,m=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${f} \u05DC\u05D0 ${m}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${u.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${u.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${u.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${E(u.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${o(u.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function ZN(){return{localeError:U3()}}var F3=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(o))return"t\xF6mb";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return o=>{switch(o.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o.expected}, a kapott \xE9rt\xE9k ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${j(o.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`T\xFAl nagy: ${o.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${o.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${o.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} m\xE9rete t\xFAl kicsi ${i}${o.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} t\xFAl kicsi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${n[i.format]??o.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${o.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${o.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${o.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function qN(){return{localeError:F3()}}var B3=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak valid: diharapkan ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak valid: diharapkan ${j(o.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: diharapkan ${o.origin??"value"} memiliki ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${o.origin??"value"} menjadi ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: diharapkan ${o.origin} memiliki ${i}${o.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${o.origin} menjadi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${n[i.format]??o.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${o.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${o.origin}`;default:return"Input tidak valid"}}};function VN(){return{localeError:B3()}}var Z3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"n\xFAmer";case"object":{if(Array.isArray(t))return"fylki";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},q3=()=>{let t={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function e(n){return t[n]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"};return n=>{switch(n.code){case"invalid_type":return`Rangt gildi: \xDE\xFA sl\xF3st inn ${Z3(n.input)} \xFEar sem \xE1 a\xF0 vera ${n.expected}`;case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${j(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${o}${n.maximum.toString()} ${i.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${o}${n.minimum.toString()} ${i.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${o.prefix}"`:o.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${o.suffix}"`:o.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${o.includes}"`:o.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${o.pattern}`:`Rangt ${r[o.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${E(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}};function GN(){return{localeError:q3()}}var V3=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numero";case"object":{if(Array.isArray(o))return"vettore";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input non valido: atteso ${o.expected}, ricevuto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input non valido: atteso ${j(o.values[0])}`:`Opzione non valida: atteso uno tra ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Troppo grande: ${o.origin??"valore"} deve avere ${i}${o.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${o.origin??"valore"} deve essere ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Troppo piccolo: ${o.origin} deve avere ${i}${o.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${o.origin} deve essere ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${o.divisor}`;case"unrecognized_keys":return`Chiav${o.keys.length>1?"i":"e"} non riconosciut${o.keys.length>1?"e":"a"}: ${E(o.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${o.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${o.origin}`;default:return"Input non valido"}}};function KN(){return{localeError:V3()}}var G3=()=>{let t={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(o))return"\u914D\u5217";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${o.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${r(o.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":return o.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${j(o.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${E(o.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=o.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=e(o.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${s.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=o.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=e(o.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${s.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${o.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${o.keys.length>1?"\u7FA4":""}: ${E(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function HN(){return{localeError:G3()}}var K3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8";case"object":{if(Array.isArray(t))return"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return{string:"\u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0"}[e]??e},H3=()=>{let t={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function e(n){return t[n]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",json_string:"JSON \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"};return n=>{switch(n.code){case"invalid_type":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${K3(n.input)}`;case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${j(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${E(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${i.verb} ${o}${n.maximum.toString()} ${i.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${i.verb} ${o}${n.minimum.toString()} ${i.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.prefix}"-\u10D8\u10D7`:o.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.suffix}"-\u10D8\u10D7`:o.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${o.includes}"-\u10E1`:o.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${o.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${E(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function WN(){return{localeError:H3()}}var W3=()=>{let t={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(o))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(o===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return o=>{switch(o.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${j(o.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${o.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${E(o.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function z_(){return{localeError:W3()}}function JN(){return z_()}var J3=()=>{let t={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return o=>{switch(o.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${r(o.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":return o.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${j(o.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${E(o.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=o.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),c=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()}${c} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()} ${i}${s}`}case"too_small":{let i=o.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),c=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()}${c} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${n[i.format]??o.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${o.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${E(o.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${o.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${o.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function XN(){return{localeError:J3()}}var X3=t=>pp(typeof t,t),pp=(t,e=void 0)=>{switch(t){case"number":return Number.isNaN(e)?"NaN":"skai\u010Dius";case"bigint":return"sveikasis skai\u010Dius";case"string":return"eilut\u0117";case"boolean":return"login\u0117 reik\u0161m\u0117";case"undefined":case"void":return"neapibr\u0117\u017Eta reik\u0161m\u0117";case"function":return"funkcija";case"symbol":return"simbolis";case"object":return e===void 0?"ne\u017Einomas objektas":e===null?"nulin\u0117 reik\u0161m\u0117":Array.isArray(e)?"masyvas":Object.getPrototypeOf(e)!==Object.prototype&&e.constructor?e.constructor.name:"objektas";case"null":return"nulin\u0117 reik\u0161m\u0117"}return t},dp=t=>t.charAt(0).toUpperCase()+t.slice(1);function YN(t){let e=Math.abs(t),r=e%10,n=e%100;return n>=11&&n<=19||r===0?"many":r===1?"one":"few"}var Y3=()=>{let t={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function e(n,o,i,s){let a=t[n]??null;return a===null?a:{unit:a.unit[o],verb:a.verb[s][i?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"};return n=>{switch(n.code){case"invalid_type":return`Gautas tipas ${X3(n.input)}, o tik\u0117tasi - ${pp(n.expected)}`;case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${j(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${E(n.values,"|")} pasirinkim\u0173`;case"too_big":{let o=pp(n.origin),i=e(n.origin,YN(Number(n.maximum)),n.inclusive??!1,"smaller");if(i?.verb)return`${dp(o??n.origin??"reik\u0161m\u0117")} ${i.verb} ${n.maximum.toString()} ${i.unit??"element\u0173"}`;let s=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${dp(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.maximum.toString()} ${i?.unit}`}case"too_small":{let o=pp(n.origin),i=e(n.origin,YN(Number(n.minimum)),n.inclusive??!1,"bigger");if(i?.verb)return`${dp(o??n.origin??"reik\u0161m\u0117")} ${i.verb} ${n.minimum.toString()} ${i.unit??"element\u0173"}`;let s=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${dp(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.minimum.toString()} ${i?.unit}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${o.prefix}"`:o.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${o.includes}"`:o.format==="regex"?`Eilut\u0117 privalo atitikti ${o.pattern}`:`Neteisingas ${r[o.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${E(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let o=pp(n.origin);return`${dp(o??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function QN(){return{localeError:Y3()}}var Q3=()=>{let t={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(o))return"\u043D\u0438\u0437\u0430";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return o=>{switch(o.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${j(o.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${o.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${o.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function ez(){return{localeError:Q3()}}var e5=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombor";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak sah: dijangka ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak sah: dijangka ${j(o.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: dijangka ${o.origin??"nilai"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${o.origin??"nilai"} adalah ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: dijangka ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${o.origin} adalah ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${n[i.format]??o.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${E(o.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${o.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${o.origin}`;default:return"Input tidak sah"}}};function tz(){return{localeError:e5()}}var t5=()=>{let t={string:{unit:"tekens",verb:"te hebben"},file:{unit:"bytes",verb:"te hebben"},array:{unit:"elementen",verb:"te hebben"},set:{unit:"elementen",verb:"te hebben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"getal";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return o=>{switch(o.code){case"invalid_type":return`Ongeldige invoer: verwacht ${o.expected}, ontving ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ongeldige invoer: verwacht ${j(o.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Te groot: verwacht dat ${o.origin??"waarde"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"elementen"}`:`Te groot: verwacht dat ${o.origin??"waarde"} ${i}${o.maximum.toString()} is`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Te klein: verwacht dat ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Te klein: verwacht dat ${o.origin} ${i}${o.minimum.toString()} is`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${o.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${o.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${o.origin}`;default:return"Ongeldige invoer"}}};function rz(){return{localeError:t5()}}var r5=()=>{let t={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"tall";case"object":{if(Array.isArray(o))return"liste";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Ugyldig input: forventet ${o.expected}, fikk ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ugyldig verdi: forventet ${j(o.values[0])}`:`Ugyldig valg: forventet en av ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${n[i.format]??o.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${o.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${o.origin}`;default:return"Ugyldig input"}}};function nz(){return{localeError:r5()}}var n5=()=>{let t={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numara";case"object":{if(Array.isArray(o))return"saf";if(o===null)return"gayb";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return o=>{switch(o.code){case"invalid_type":return`F\xE2sit giren: umulan ${o.expected}, al\u0131nan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`F\xE2sit giren: umulan ${j(o.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=o;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${n[i.format]??o.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${o.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${o.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function oz(){return{localeError:n5()}}var o5=()=>{let t={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0627\u0631\u06D0";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return o=>{switch(o.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${r(o.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":return o.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${j(o.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${E(o.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0648\u064A`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${n[i.format]??o.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${o.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${o.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${o.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${o.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function iz(){return{localeError:o5()}}var i5=()=>{let t={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"liczba";case"object":{if(Array.isArray(o))return"tablica";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return o=>{switch(o.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o.expected}, otrzymano ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${j(o.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${n[i.format]??o.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${o.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${o.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${o.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function sz(){return{localeError:i5()}}var s5=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(o))return"array";if(o===null)return"nulo";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${o.expected}, recebido ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: esperado ${j(o.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Muito grande: esperado que ${o.origin??"valor"} tivesse ${i}${o.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${o.origin??"valor"} fosse ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Muito pequeno: esperado que ${o.origin} tivesse ${i}${o.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${o.origin} fosse ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`:i.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inv\xE1lido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`:`${n[i.format]??o.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${o.divisor}`;case"unrecognized_keys":return`Chave${o.keys.length>1?"s":""} desconhecida${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${o.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${o.origin}`;default:return"Campo inv\xE1lido"}}};function az(){return{localeError:s5()}}function cz(t,e,r,n){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?n:i===1?e:i>=2&&i<=4?r:n}var a5=()=>{let t={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${j(o.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),c=cz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.maximum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),c=cz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.minimum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${o.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0438":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${o.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function uz(){return{localeError:a5()}}var c5=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(o))return"tabela";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return o=>{switch(o.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${o.expected}, prejeto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${j(o.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} imelo ${i}${o.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${o.origin} imelo ${i}${o.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${n[i.format]??o.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${o.divisor}`;case"unrecognized_keys":return`Neprepoznan${o.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${E(o.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${o.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${o.origin}`;default:return"Neveljaven vnos"}}};function lz(){return{localeError:c5()}}var u5=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"antal";case"object":{if(Array.isArray(o))return"lista";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return o=>{switch(o.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${o.expected}, fick ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${j(o.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${n[i.format]??o.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${o.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${o.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function dz(){return{localeError:u5()}}var l5=()=>{let t={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(o))return"\u0B85\u0BA3\u0BBF";if(o===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${j(o.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${E(o.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${o.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${o.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function pz(){return{localeError:l5()}}var d5=()=>{let t={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(o))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(o===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return o=>{switch(o.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${j(o.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=e(o.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=e(o.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${o.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${E(o.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function fz(){return{localeError:d5()}}var p5=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},f5=()=>{let t={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(n){return t[n]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return n=>{switch(n.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${n.expected}, al\u0131nan ${p5(n.input)}`;case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${j(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()} ${i.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()} ${i.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[o.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function mz(){return{localeError:f5()}}var m5=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${j(o.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} \u0431\u0443\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0456":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${o.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function M_(){return{localeError:m5()}}function hz(){return M_()}var h5=()=>{let t={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(o))return"\u0622\u0631\u06D2";if(o===null)return"\u0646\u0644";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return o=>{switch(o.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${r(o.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":return o.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${j(o.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${E(o.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${o.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u06D2 ${i}${o.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u0627 ${i}${o.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${o.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${o.keys.length>1?"\u0632":""}: ${E(o.keys,"\u060C ")}`;case"invalid_key":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function gz(){return{localeError:h5()}}var g5=()=>{let t={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(o))return"m\u1EA3ng";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return o=>{switch(o.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${j(o.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${n[i.format]??o.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${o.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${E(o.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function _z(){return{localeError:g5()}}var _5=()=>{let t={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(o))return"\u6570\u7EC4";if(o===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${j(o.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${n[i.format]??o.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${o.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${o.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function yz(){return{localeError:_5()}}var y5=()=>{let t={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o.expected}\uFF0C\u4F46\u6536\u5230 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${j(o.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${o.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${o.keys.length>1?"\u5011":""}\uFF1A${E(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function vz(){return{localeError:y5()}}var v5=()=>{let t={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\u1ECD\u0301mb\xE0";case"object":{if(Array.isArray(o))return"akop\u1ECD";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"};return o=>{switch(o.code){case"invalid_type":return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${o.expected}, \xE0m\u1ECD\u0300 a r\xED ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${j(o.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin??"iye"} ${s.verb} ${i}${o.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${o.maximum}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin} ${s.verb} ${i}${o.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${o.minimum}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`:i.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`:i.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`:i.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`:`A\u1E63\xEC\u1E63e: ${n[i.format]??o.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${o.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${E(o.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function bz(){return{localeError:v5()}}var wz,j_=Symbol("ZodOutput"),D_=Symbol("ZodInput"),Pu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function fp(){return new Pu}(wz=globalThis).__zod_globalRegistry??(wz.__zod_globalRegistry=fp());var Ge=globalThis.__zod_globalRegistry;function L_(t,e){return new t({type:"string",...D(e)})}function U_(t,e){return new t({type:"string",coerce:!0,...D(e)})}function mp(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...D(e)})}function Cu(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...D(e)})}function hp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...D(e)})}function gp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(e)})}function _p(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(e)})}function yp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(e)})}function Ru(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...D(e)})}function vp(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...D(e)})}function bp(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(e)})}function wp(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...D(e)})}function xp(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(e)})}function $p(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...D(e)})}function Ip(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...D(e)})}function Sp(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(e)})}function kp(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(e)})}function Tp(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(e)})}function F_(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...D(e)})}function Ep(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(e)})}function Ap(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(e)})}function Op(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...D(e)})}function Pp(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...D(e)})}function Cp(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...D(e)})}function Rp(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...D(e)})}var B_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Z_(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(e)})}function q_(t,e){return new t({type:"string",format:"date",check:"string_format",...D(e)})}function V_(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...D(e)})}function G_(t,e){return new t({type:"string",format:"duration",check:"string_format",...D(e)})}function K_(t,e){return new t({type:"number",checks:[],...D(e)})}function H_(t,e){return new t({type:"number",coerce:!0,checks:[],...D(e)})}function W_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...D(e)})}function J_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...D(e)})}function X_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...D(e)})}function Y_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...D(e)})}function Q_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...D(e)})}function ey(t,e){return new t({type:"boolean",...D(e)})}function ty(t,e){return new t({type:"boolean",coerce:!0,...D(e)})}function ry(t,e){return new t({type:"bigint",...D(e)})}function ny(t,e){return new t({type:"bigint",coerce:!0,...D(e)})}function oy(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...D(e)})}function iy(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...D(e)})}function sy(t,e){return new t({type:"symbol",...D(e)})}function ay(t,e){return new t({type:"undefined",...D(e)})}function cy(t,e){return new t({type:"null",...D(e)})}function uy(t){return new t({type:"any"})}function Nu(t){return new t({type:"unknown"})}function zu(t,e){return new t({type:"never",...D(e)})}function ly(t,e){return new t({type:"void",...D(e)})}function dy(t,e){return new t({type:"date",...D(e)})}function py(t,e){return new t({type:"date",coerce:!0,...D(e)})}function fy(t,e){return new t({type:"nan",...D(e)})}function _o(t,e){return new Ig({check:"less_than",...D(e),value:t,inclusive:!1})}function zr(t,e){return new Ig({check:"less_than",...D(e),value:t,inclusive:!0})}function yo(t,e){return new Sg({check:"greater_than",...D(e),value:t,inclusive:!1})}function ir(t,e){return new Sg({check:"greater_than",...D(e),value:t,inclusive:!0})}function my(t){return yo(0,t)}function hy(t){return _o(0,t)}function gy(t){return zr(0,t)}function _y(t){return ir(0,t)}function Qi(t,e){return new o$({check:"multiple_of",...D(e),value:t})}function $a(t,e){return new a$({check:"max_size",...D(e),maximum:t})}function es(t,e){return new c$({check:"min_size",...D(e),minimum:t})}function Mu(t,e){return new u$({check:"size_equals",...D(e),size:t})}function Ia(t,e){return new l$({check:"max_length",...D(e),maximum:t})}function Qo(t,e){return new d$({check:"min_length",...D(e),minimum:t})}function Sa(t,e){return new p$({check:"length_equals",...D(e),length:t})}function ju(t,e){return new f$({check:"string_format",format:"regex",...D(e),pattern:t})}function Du(t){return new m$({check:"string_format",format:"lowercase",...D(t)})}function Lu(t){return new h$({check:"string_format",format:"uppercase",...D(t)})}function Uu(t,e){return new g$({check:"string_format",format:"includes",...D(e),includes:t})}function Fu(t,e){return new _$({check:"string_format",format:"starts_with",...D(e),prefix:t})}function Bu(t,e){return new y$({check:"string_format",format:"ends_with",...D(e),suffix:t})}function yy(t,e,r){return new v$({check:"property",property:t,schema:e,...D(r)})}function Zu(t,e){return new b$({check:"mime_type",mime:t,...D(e)})}function Zn(t){return new w$({check:"overwrite",tx:t})}function qu(t){return Zn(e=>e.normalize(t))}function Vu(){return Zn(t=>t.trim())}function Gu(){return Zn(t=>t.toLowerCase())}function Ku(){return Zn(t=>t.toUpperCase())}function Np(){return Zn(t=>x0(t))}function T$(t,e,r){return new t({type:"array",element:e,...D(r)})}function w5(t,e,r){return new t({type:"union",options:e,...D(r)})}function x5(t,e,r,n){return new t({type:"union",options:r,discriminator:e,...D(n)})}function $5(t,e,r){return new t({type:"intersection",left:e,right:r})}function I5(t,e,r,n){let o=r instanceof ye,i=o?n:r,s=o?r:null;return new t({type:"tuple",items:e,rest:s,...D(i)})}function S5(t,e,r,n){return new t({type:"record",keyType:e,valueType:r,...D(n)})}function k5(t,e,r,n){return new t({type:"map",keyType:e,valueType:r,...D(n)})}function T5(t,e,r){return new t({type:"set",valueType:e,...D(r)})}function E5(t,e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new t({type:"enum",entries:n,...D(r)})}function A5(t,e,r){return new t({type:"enum",entries:e,...D(r)})}function O5(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...D(r)})}function vy(t,e){return new t({type:"file",...D(e)})}function P5(t,e){return new t({type:"transform",transform:e})}function C5(t,e){return new t({type:"optional",innerType:e})}function R5(t,e){return new t({type:"nullable",innerType:e})}function N5(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():I0(r)}})}function z5(t,e,r){return new t({type:"nonoptional",innerType:e,...D(r)})}function M5(t,e){return new t({type:"success",innerType:e})}function j5(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function D5(t,e,r){return new t({type:"pipe",in:e,out:r})}function L5(t,e){return new t({type:"readonly",innerType:e})}function U5(t,e,r){return new t({type:"template_literal",parts:e,...D(r)})}function F5(t,e){return new t({type:"lazy",getter:e})}function B5(t,e){return new t({type:"promise",innerType:e})}function by(t,e,r){let n=D(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function wy(t,e,r){return new t({type:"custom",check:"custom",fn:e,...D(r)})}function xy(t){let e=xz(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(_u(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(_u(o))}},t(r.value,r)));return e}function xz(t,e){let r=new Je({check:"custom",...D(e)});return r._zod.check=t,r}function $y(t){let e=new Je({check:"describe"});return e._zod.onattach=[r=>{let n=Ge.get(r)??{};Ge.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function Iy(t){let e=new Je({check:"meta"});return e._zod.onattach=[r=>{let n=Ge.get(r)??{};Ge.add(r,{...n,...t})}],e._zod.check=()=>{},e}function Sy(t,e){let r=D(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(n),s=new Set(o),a=t.Codec??Au,c=t.Boolean??ku,u=t.String??Yi,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new a({type:"pipe",in:l,out:d,transform:((p,m)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:s.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((p,m)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return f}function ka(t,e,r,n={}){let o=D(n),i={...D(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:a=>r.test(a),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}var zp=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Ge,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},f=e._zod.parent;if(f)a.ref=f,this.process(f,d),this.seen.get(f).isParent=!0;else{let p=a.schema;switch(o.type){case"string":{let m=p;m.type="string";let{minimum:h,maximum:_,format:v,patterns:b,contentEncoding:x}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof _=="number"&&(m.maxLength=_),v&&(m.format=i[v]??v,m.format===""&&delete m.format),x&&(m.contentEncoding=x),b&&b.size>0){let k=[...b];k.length===1?m.pattern=k[0].source:k.length>1&&(a.schema.allOf=[...k.map(T=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:T.source}))])}break}case"number":{let m=p,{minimum:h,maximum:_,format:v,multipleOf:b,exclusiveMaximum:x,exclusiveMinimum:k}=e._zod.bag;typeof v=="string"&&v.includes("int")?m.type="integer":m.type="number",typeof k=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.minimum=k,m.exclusiveMinimum=!0):m.exclusiveMinimum=k),typeof h=="number"&&(m.minimum=h,typeof k=="number"&&this.target!=="draft-4"&&(k>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof x=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.maximum=x,m.exclusiveMaximum=!0):m.exclusiveMaximum=x),typeof _=="number"&&(m.maximum=_,typeof x=="number"&&this.target!=="draft-4"&&(x<=_?delete m.maximum:delete m.exclusiveMaximum)),typeof b=="number"&&(m.multipleOf=b);break}case"boolean":{let m=p;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{this.target==="openapi-3.0"?(p.type="string",p.nullable=!0,p.enum=[null]):p.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{p.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let m=p,{minimum:h,maximum:_}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof _=="number"&&(m.maxItems=_),m.type="array",m.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let m=p;m.type="object",m.properties={};let h=o.shape;for(let b in h)m.properties[b]=this.process(h[b],{...d,path:[...d.path,"properties",b]});let _=new Set(Object.keys(h)),v=new Set([..._].filter(b=>{let x=o.shape[b]._zod;return this.io==="input"?x.optin===void 0:x.optout===void 0}));v.size>0&&(m.required=Array.from(v)),o.catchall?._zod.def.type==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{let m=p,h=o.discriminator!==void 0,_=o.options.map((v,b)=>this.process(v,{...d,path:[...d.path,h?"oneOf":"anyOf",b]}));h?m.oneOf=_:m.anyOf=_;break}case"intersection":{let m=p,h=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),_=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),v=x=>"allOf"in x&&Object.keys(x).length===1,b=[...v(h)?h.allOf:[h],...v(_)?_.allOf:[_]];m.allOf=b;break}case"tuple":{let m=p;m.type="array";let h=this.target==="draft-2020-12"?"prefixItems":"items",_=this.target==="draft-2020-12"||this.target==="openapi-3.0"?"items":"additionalItems",v=o.items.map((T,F)=>this.process(T,{...d,path:[...d.path,h,F]})),b=o.rest?this.process(o.rest,{...d,path:[...d.path,_,...this.target==="openapi-3.0"?[o.items.length]:[]]}):null;this.target==="draft-2020-12"?(m.prefixItems=v,b&&(m.items=b)):this.target==="openapi-3.0"?(m.items={anyOf:v},b&&m.items.anyOf.push(b),m.minItems=v.length,b||(m.maxItems=v.length)):(m.items=v,b&&(m.additionalItems=b));let{minimum:x,maximum:k}=e._zod.bag;typeof x=="number"&&(m.minItems=x),typeof k=="number"&&(m.maxItems=k);break}case"record":{let m=p;m.type="object",(this.target==="draft-7"||this.target==="draft-2020-12")&&(m.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]})),m.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=p,h=Yd(o.entries);h.every(_=>typeof _=="number")&&(m.type="number"),h.every(_=>typeof _=="string")&&(m.type="string"),m.enum=h;break}case"literal":{let m=p,h=[];for(let _ of o.values)if(_===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof _=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(_))}else h.push(_);if(h.length!==0)if(h.length===1){let _=h[0];m.type=_===null?"null":typeof _,this.target==="draft-4"||this.target==="openapi-3.0"?m.enum=[_]:m.const=_}else h.every(_=>typeof _=="number")&&(m.type="number"),h.every(_=>typeof _=="string")&&(m.type="string"),h.every(_=>typeof _=="boolean")&&(m.type="string"),h.every(_=>_===null)&&(m.type="null"),m.enum=h;break}case"file":{let m=p,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:_,maximum:v,mime:b}=e._zod.bag;_!==void 0&&(h.minLength=_),v!==void 0&&(h.maxLength=v),b?b.length===1?(h.contentMediaType=b[0],Object.assign(m,h)):m.anyOf=b.map(x=>({...h,contentMediaType:x})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,d);this.target==="openapi-3.0"?(a.ref=o.innerType,p.nullable=!0):p.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"success":{let m=p;m.type="boolean";break}case"default":{this.process(o.innerType,d),a.ref=o.innerType,p.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),a.ref=o.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),a.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}p.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=p,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,d),a.ref=m;break}case"readonly":{this.process(o.innerType,d),a.ref=o.innerType,p.readOnly=!0;break}case"promise":{this.process(o.innerType,d),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,d),a.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&xr(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let h=n.external.registry.get(l[0])?.id,_=n.external.uri??(b=>b);if(h)return{ref:_(h)};let v=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=v,{defId:v,ref:`${_("__shared")}#/${d}/${v}`}}if(l[1]===o)return{ref:"#"};let p=`#/${d}/`,m=l[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:p+m}},s=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:f,defId:p}=i(l);d.def={...d.schema},p&&(d.defId=p);let m=d.schema;for(let h in m)delete m[h];m.$ref=f};if(n.cycles==="throw")for(let l of this.seen.entries()){let d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/ + +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(e===l[0]){s(l);continue}if(n.external){let p=n.external.registry.get(l[0])?.id;if(e!==l[0]&&p){s(l);continue}}if(this.metadataRegistry.get(l[0])?.id){s(l);continue}if(d.cycle){s(l);continue}if(d.count>1&&n.reused==="ref"){s(l);continue}}let a=(l,d)=>{let f=this.seen.get(l),p=f.def??f.schema,m={...p};if(f.ref===null)return;let h=f.ref;if(f.ref=null,h){a(h,d);let _=this.seen.get(h).schema;_.$ref&&(d.target==="draft-7"||d.target==="draft-4"||d.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(_)):(Object.assign(p,_),Object.assign(p,m))}f.isParent||this.override({zodSchema:l,jsonSchema:p,path:f.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?c.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,o.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let d=l[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function vo(t,e){if(t instanceof Pu){let n=new zp(e),o={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let i={},s={registry:t,uri:e?.uri,defs:o};for(let a of t._idmap.entries()){let[c,u]=a;i[c]=n.emit(u,{...e,external:s})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}let r=new zp(e);return r.process(t),r.emit(t,e)}function xr(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return xr(n.element,r);if(n.type==="set")return xr(n.valueType,r);if(n.type==="lazy")return xr(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return xr(n.innerType,r);if(n.type==="intersection")return xr(n.left,r)||xr(n.right,r);if(n.type==="record"||n.type==="map")return xr(n.keyType,r)||xr(n.valueType,r);if(n.type==="pipe")return xr(n.in,r)||xr(n.out,r);if(n.type==="object"){for(let o in n.shape)if(xr(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(xr(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(xr(o,r))return!0;return!!(n.rest&&xr(n.rest,r))}return!1}var $z={};function nt(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_zod"in e))return!1;let r=e._zod;return typeof r=="object"&&r!==null&&"def"in r}function vt(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_def"in e)||"_zod"in e)return!1;let r=e._def;return typeof r=="object"&&r!=null&&"typeName"in r}function Iz(t){return nt(t)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),vt(t)}function on(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(nt(t)||vt(t))}function E$(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodLiteral"}function A$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="literal":!1}function Sz(t){return!!(E$(t)||A$(t))}async function Ey(t,e){if(nt(t))try{return{success:!0,data:await Yo(t,e)}}catch(r){return{success:!1,error:r}}if(vt(t))return await t.safeParseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function ts(t,e){if(nt(t))return await Yo(t,e);if(vt(t))return await t.parseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function kz(t,e){if(nt(t))try{return{success:!0,data:Bn(t,e)}}catch(r){return{success:!1,error:r}}if(vt(t))return t.safeParse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Tz(t,e){if(nt(t))return Bn(t,e);if(vt(t))return t.parse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function rs(t){if(nt(t))return Ge.get(t)?.description;if(vt(t)||"description"in t&&typeof t.description=="string")return t.description}function Ez(t){if(!on(t))return!1;if(vt(t)){let e=t._def;if(e.typeName==="ZodObject"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.typeName==="ZodRecord")return!0}if(nt(t)){let e=t._zod.def;if(e.type==="object"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.type==="record")return!0}return typeof t=="object"&&t!==null&&!("shape"in t)}function Wu(t){return on(t)?vt(t)?t._def.typeName==="ZodString":nt(t)?t._zod.def.type==="string":!1:!1}function Ay(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodObject"}function wn(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="object":!1}function Mp(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="array":!1}function O$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="optional":!1}function P$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="nullable":!1}function Az(t){return!!(Ay(t)||wn(t))}function ky(t){if(vt(t))return t.shape;if(nt(t))return t._zod.def.shape;throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Oz(t,e){if(vt(t))return t.extend(e);if(nt(t))return M.extend(t,e);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Pz(t){if(vt(t))return t.partial();if(nt(t))return M.partial(xa,t,void 0);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Hu(t,e=!1){if(vt(t))return t.strict();if(wn(t)){let r=t._zod.def.shape;if(e)for(let[i,s]of Object.entries(t._zod.def.shape)){if(wn(s)){let c=Hu(s,e);r[i]=c}else if(Mp(s)){let c=s._zod.def.element;wn(c)&&(c=Hu(c,e)),r[i]=Qe(s,{...s._zod.def,element:c})}else r[i]=s;let a=Ge.get(s);a&&Ge.add(r[i],a)}let n=Qe(t,{...t._zod.def,shape:r,catchall:zu(Eu)}),o=Ge.get(t);return o&&Ge.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Ty(t,e=!1){if(Ay(t))return t.passthrough();if(wn(t)){let r=t._zod.def.shape;if(e)for(let[i,s]of Object.entries(t._zod.def.shape)){if(wn(s)){let c=Ty(s,e);r[i]=c}else if(Mp(s)){let c=s._zod.def.element;wn(c)&&(c=Ty(c,e)),r[i]=Qe(s,{...s._zod.def,element:c})}else r[i]=s;let a=Ge.get(s);a&&Ge.add(r[i],a)}let n=Qe(t,{...t._zod.def,shape:r,catchall:Nu(Tu)}),o=Ge.get(t);return o&&Ge.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Cz(t){if(vt(t))try{let e=t.parse(void 0);return()=>e}catch{return}if(nt(t))try{let e=Bn(t,void 0);return()=>e}catch{return}}function Z5(t){return vt(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function q5(t){return nt(t)&&t._zod.def.type==="pipe"}function Ta(t,e,r){let n=r.get(t);if(n!==void 0)return n;if(vt(t))return Z5(t)?Ta(t._def.schema,e,r):t;if(nt(t)){let o=t;if(q5(t)&&(o=Ta(t._zod.def.in,e,r)),e){if(wn(o)){let s=o._zod.def.shape;for(let[a,c]of Object.entries(o._zod.def.shape))s[a]=Ta(c,e,r);o=Qe(o,{...o._zod.def,shape:s})}else if(Mp(o)){let s=Ta(o._zod.def.element,e,r);o=Qe(o,{...o._zod.def,element:s})}else if(O$(o)){let s=Ta(o._zod.def.innerType,e,r);o=Qe(o,{...o._zod.def,innerType:s})}else if(P$(o)){let s=Ta(o._zod.def.innerType,e,r);o=Qe(o,{...o._zod.def,innerType:s})}}let i=Ge.get(t);return i&&Ge.add(o,i),r.set(t,o),o}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Oy(t,e=!1){return Ta(t,e,new WeakMap)}function Rz(t,e){if(vt(t)){let r=ky(t),n={};for(let[o,i]of Object.entries(r))e(o,i)?n[o]=i.optional():n[o]=i;return t.extend(n)}if(nt(t)){let r=ky(t),n={...t._zod.def.shape};for(let[s,a]of Object.entries(r))e(s,a)&&(n[s]=new xa({type:"optional",innerType:a}));let o=Qe(t,{...t._zod.def,shape:n}),i=Ge.get(t);return i&&Ge.add(o,i),o}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Py(t){return t instanceof Error&&(t.constructor.name==="ZodError"||t.constructor.name==="$ZodError")}function C$(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}var V5=["*","_","`"];function G5(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n}; +`;return e}function Nz(t,e,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:s=!0,curveStyle:a="linear",wrapLabelNWords:c=9}=r??{},u=s?`%%{init: {'flowchart': {'curve': '${a}'}}}%% +graph TD; +`:`graph TD; +`;if(s){let p="default",m={[p]:"{0}({1})"};n!==void 0&&(m[n]="{0}([{1}]):::first"),o!==void 0&&(m[o]="{0}([{1}]):::last");for(let[h,_]of Object.entries(t)){let v=_.name.split(":").pop()??"",x=V5.some(T=>v.startsWith(T)&&v.endsWith(T))?`

${v}

`:v;Object.keys(_.metadata??{}).length&&(x+=`
${Object.entries(_.metadata??{}).map(([T,F])=>`${T} = ${F}`).join(` +`)}`);let k=(m[h]??m[p]).replace("{0}",C$(h)).replace("{1}",x);u+=` ${k} +`}}let l={};for(let p of e){let m=p.source.split(":"),h=p.target.split(":"),_=m.filter((v,b)=>v===h[b]).join(":");l[_]||(l[_]=[]),l[_].push(p)}let d=new Set;function f(p,m){let h=p.length===1&&p[0].source===p[0].target;if(m&&!h){let _=m.split(":").pop();if(d.has(_))throw new Error(`Found duplicate subgraph '${_}' -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);d.add(_),u+=` subgraph ${_} +`}for(let _ of p){let{source:v,target:b,data:x,conditional:k}=_,T="";if(x!==void 0){let F=x,J=F.split(" ");J.length>c&&(F=Array.from({length:Math.ceil(J.length/c)},(w,Z)=>J.slice(Z*c,(Z+1)*c).join(" ")).join(" 
 ")),T=k?` -.  ${F}  .-> `:` --  ${F}  --> `}else T=k?" -.-> ":" --> ";u+=` ${C$(v)}${T}${C$(b)}; +`}for(let _ in l)_.startsWith(`${m}:`)&&_!==m&&f(l[_],_);m&&!h&&(u+=` end +`)}f(l[""]??[],"");for(let p in l)!p.includes(":")&&p!==""&&f(l[p],p);return s&&(u+=G5(i??{})),u}async function zz(t,e){let r=e?.backgroundColor??"white",n=e?.imageType??"png",o=HR(t);r!==void 0&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(r)||(r=`!${r}`));let i=`https://mermaid.ink/img/${o}?bgColor=${r}&type=${n}`,s=await fetch(i);if(!s.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${s.status}`,`Status text: ${s.statusText}`].join(` +`));return await s.blob()}var jz=Symbol("Let zodToJsonSchema decide on which parser to use"),Mz={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Dz=t=>typeof t=="string"?{...Mz,name:t}:{...Mz,...t};var Lz=t=>{let e=Dz(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};var Cy=(t,e)=>{let r=0;for(;ryG,DIRTY:()=>Ea,EMPTY_PATH:()=>J5,INVALID:()=>pe,NEVER:()=>tK,OK:()=>sr,ParseStatus:()=>Gt,Schema:()=>Ee,ZodAny:()=>is,ZodArray:()=>ni,ZodBigInt:()=>Oa,ZodBoolean:()=>Pa,ZodBranded:()=>Dp,ZodCatch:()=>Ba,ZodDate:()=>Ca,ZodDefault:()=>Fa,ZodDiscriminatedUnion:()=>zy,ZodEffects:()=>In,ZodEnum:()=>La,ZodError:()=>Mr,ZodFirstPartyTypeKind:()=>N,ZodFunction:()=>jy,ZodIntersection:()=>Ma,ZodIssueCode:()=>z,ZodLazy:()=>ja,ZodLiteral:()=>Da,ZodMap:()=>tl,ZodNaN:()=>nl,ZodNativeEnum:()=>Ua,ZodNever:()=>qn,ZodNull:()=>Na,ZodNullable:()=>xo,ZodNumber:()=>Aa,ZodObject:()=>jr,ZodOptional:()=>xn,ZodParsedType:()=>W,ZodPipeline:()=>Lp,ZodPromise:()=>ss,ZodReadonly:()=>Za,ZodRecord:()=>My,ZodSchema:()=>Ee,ZodSet:()=>rl,ZodString:()=>os,ZodSymbol:()=>Qu,ZodTransformer:()=>In,ZodTuple:()=>wo,ZodType:()=>Ee,ZodUndefined:()=>Ra,ZodUnion:()=>za,ZodUnknown:()=>ri,ZodVoid:()=>el,addIssueToContext:()=>B,any:()=>TG,array:()=>PG,bigint:()=>xG,boolean:()=>Jz,coerce:()=>eK,custom:()=>Kz,date:()=>$G,datetimeRegex:()=>Vz,defaultErrorMap:()=>ei,discriminatedUnion:()=>NG,effect:()=>GG,enum:()=>ZG,function:()=>UG,getErrorMap:()=>Ju,getParsedType:()=>bo,instanceof:()=>bG,intersection:()=>zG,isAborted:()=>Ry,isAsync:()=>Xu,isDirty:()=>Ny,isValid:()=>ns,late:()=>vG,lazy:()=>FG,literal:()=>BG,makeIssue:()=>jp,map:()=>DG,nan:()=>wG,nativeEnum:()=>qG,never:()=>AG,null:()=>kG,nullable:()=>HG,number:()=>Wz,object:()=>Xz,objectUtil:()=>N$,oboolean:()=>QG,onumber:()=>YG,optional:()=>KG,ostring:()=>XG,pipeline:()=>JG,preprocess:()=>WG,promise:()=>VG,quotelessJson:()=>K5,record:()=>jG,set:()=>LG,setErrorMap:()=>W5,strictObject:()=>CG,string:()=>Hz,symbol:()=>IG,transformer:()=>GG,tuple:()=>MG,undefined:()=>SG,union:()=>RG,unknown:()=>EG,util:()=>je,void:()=>OG});var je;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(je||(je={}));var N$;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(N$||(N$={}));var W=je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bo=t=>{switch(typeof t){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(t)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(t)?W.array:t===null?W.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?W.promise:typeof Map<"u"&&t instanceof Map?W.map:typeof Set<"u"&&t instanceof Set?W.set:typeof Date<"u"&&t instanceof Date?W.date:W.object;default:return W.unknown}};var z=je.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),K5=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Mr=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;cr.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Mr.create=t=>new Mr(t);var H5=(t,e)=>{let r;switch(t.code){case z.invalid_type:t.received===W.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,je.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${je.joinValues(t.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${je.joinValues(t.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${je.joinValues(t.options)}, received '${t.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:je.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case z.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case z.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=e.defaultError,je.assertNever(t)}return{message:r}},ei=H5;var Uz=ei;function W5(t){Uz=t}function Ju(){return Uz}var jp=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}},J5=[];function B(t,e){let r=Ju(),n=jp({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ei?void 0:ei].filter(o=>!!o)});t.common.issues.push(n)}var Gt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return pe;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return pe;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}},pe=Object.freeze({status:"aborted"}),Ea=t=>({status:"dirty",value:t}),sr=t=>({status:"valid",value:t}),Ry=t=>t.status==="aborted",Ny=t=>t.status==="dirty",ns=t=>t.status==="valid",Xu=t=>typeof Promise<"u"&&t instanceof Promise;var ne;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ne||(ne={}));var $n=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Fz=(t,e)=>{if(ns(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Mr(t.common.issues);return this._error=r,this._error}}};function Se(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var Ee=class{get description(){return this._def.description}_getType(e){return bo(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Gt,ctx:{common:e.parent.common,data:e.data,parsedType:bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Xu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Fz(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return ns(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>ns(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Xu(o)?o:Promise.resolve(o));return Fz(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:z.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new In({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return xn.create(this,this._def)}nullable(){return xo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ni.create(this)}promise(){return ss.create(this,this._def)}or(e){return za.create([this,e],this._def)}and(e){return Ma.create(this,e,this._def)}transform(e){return new In({...Se(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Fa({...Se(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new Dp({typeName:N.ZodBranded,type:this,...Se(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Ba({...Se(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Lp.create(this,e)}readonly(){return Za.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},X5=/^c[^\s-]{8,}$/i,Y5=/^[0-9a-z]+$/,Q5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,eG=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tG=/^[a-z0-9_-]{21}$/i,rG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,nG=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",z$,sG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,aG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,cG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,uG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zz="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",pG=new RegExp(`^${Zz}$`);function qz(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function fG(t){return new RegExp(`^${qz(t)}$`)}function Vz(t){let e=`${Zz}T${qz(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function mG(t,e){return!!((e==="v4"||!e)&&sG.test(t)||(e==="v6"||!e)&&cG.test(t))}function hG(t,e){if(!rG.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function gG(t,e){return!!((e==="v4"||!e)&&aG.test(t)||(e==="v6"||!e)&&uG.test(t))}var os=class t extends Ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.string,received:i.parsedType}),pe}let n=new Gt,o;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(o=this._getOrReturnCtx(e,o),B(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.lengthe.test(o),{validation:r,code:z.invalid_string,...ne.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ne.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ne.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ne.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ne.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ne.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ne.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ne.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ne.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ne.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ne.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ne.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ne.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ne.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ne.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ne.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ne.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ne.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ne.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ne.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ne.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ne.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ne.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ne.errToObj(r)})}nonempty(e){return this.min(1,ne.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew os({checks:[],typeName:N.ZodString,coerce:t?.coerce??!1,...Se(t)});function _G(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var Aa=class t extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==W.number){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.number,received:i.parsedType}),pe}let n,o=new Gt;for(let i of this._def.checks)i.kind==="int"?je.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?_G(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_finite,message:i.message}),o.dirty()):je.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ne.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ne.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ne.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ne.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ne.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ne.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ne.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ne.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ne.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ne.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&je.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew Aa({checks:[],typeName:N.ZodNumber,coerce:t?.coerce||!1,...Se(t)});var Oa=class t extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==W.bigint)return this._getInvalidInput(e);let n,o=new Gt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):je.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return B(r,{code:z.invalid_type,expected:W.bigint,received:r.parsedType}),pe}gte(e,r){return this.setLimit("min",e,!0,ne.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ne.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ne.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ne.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ne.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ne.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Oa({checks:[],typeName:N.ZodBigInt,coerce:t?.coerce??!1,...Se(t)});var Pa=class extends Ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.boolean,received:n.parsedType}),pe}return sr(e.data)}};Pa.create=t=>new Pa({typeName:N.ZodBoolean,coerce:t?.coerce||!1,...Se(t)});var Ca=class t extends Ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.date,received:i.parsedType}),pe}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_date}),pe}let n=new Gt,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(o=this._getOrReturnCtx(e,o),B(o,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):je.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ne.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ne.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ca({checks:[],coerce:t?.coerce||!1,typeName:N.ZodDate,...Se(t)});var Qu=class extends Ee{_parse(e){if(this._getType(e)!==W.symbol){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.symbol,received:n.parsedType}),pe}return sr(e.data)}};Qu.create=t=>new Qu({typeName:N.ZodSymbol,...Se(t)});var Ra=class extends Ee{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.undefined,received:n.parsedType}),pe}return sr(e.data)}};Ra.create=t=>new Ra({typeName:N.ZodUndefined,...Se(t)});var Na=class extends Ee{_parse(e){if(this._getType(e)!==W.null){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.null,received:n.parsedType}),pe}return sr(e.data)}};Na.create=t=>new Na({typeName:N.ZodNull,...Se(t)});var is=class extends Ee{constructor(){super(...arguments),this._any=!0}_parse(e){return sr(e.data)}};is.create=t=>new is({typeName:N.ZodAny,...Se(t)});var ri=class extends Ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return sr(e.data)}};ri.create=t=>new ri({typeName:N.ZodUnknown,...Se(t)});var qn=class extends Ee{_parse(e){let r=this._getOrReturnCtx(e);return B(r,{code:z.invalid_type,expected:W.never,received:r.parsedType}),pe}};qn.create=t=>new qn({typeName:N.ZodNever,...Se(t)});var el=class extends Ee{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.void,received:n.parsedType}),pe}return sr(e.data)}};el.create=t=>new el({typeName:N.ZodVoid,...Se(t)});var ni=class t extends Ee{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==W.array)return B(r,{code:z.invalid_type,expected:W.array,received:r.parsedType}),pe;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.lengtho.maxLength.value&&(B(r,{code:z.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new $n(r,s,r.path,a)))).then(s=>Gt.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new $n(r,s,r.path,a)));return Gt.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:ne.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:ne.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:ne.toString(r)}})}nonempty(e){return this.min(1,e)}};ni.create=(t,e)=>new ni({type:t,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...Se(e)});function Yu(t){if(t instanceof jr){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=xn.create(Yu(n))}return new jr({...t._def,shape:()=>e})}else return t instanceof ni?new ni({...t._def,type:Yu(t.element)}):t instanceof xn?xn.create(Yu(t.unwrap())):t instanceof xo?xo.create(Yu(t.unwrap())):t instanceof wo?wo.create(t.items.map(e=>Yu(e))):t}var jr=class t extends Ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=je.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==W.object){let u=this._getOrReturnCtx(e);return B(u,{code:z.invalid_type,expected:W.object,received:u.parsedType}),pe}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof qn&&this._def.unknownKeys==="strip"))for(let u in o.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new $n(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof qn){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(B(o,{code:z.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new $n(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Gt.mergeObjectSync(n,u)):Gt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return ne.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ne.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of je.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of je.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Yu(this)}partial(e){let r={};for(let n of je.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of je.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof xn;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Gz(je.objectKeys(this.shape))}};jr.create=(t,e)=>new jr({shape:()=>t,unknownKeys:"strip",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});jr.strictCreate=(t,e)=>new jr({shape:()=>t,unknownKeys:"strict",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});jr.lazycreate=(t,e)=>new jr({shape:t,unknownKeys:"strip",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});var za=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new Mr(a.ctx.common.issues));return B(r,{code:z.invalid_union,unionErrors:s}),pe}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new Mr(c));return B(r,{code:z.invalid_union,unionErrors:a}),pe}}get options(){return this._def.options}};za.create=(t,e)=>new za({options:t,typeName:N.ZodUnion,...Se(e)});var ti=t=>t instanceof ja?ti(t.schema):t instanceof In?ti(t.innerType()):t instanceof Da?[t.value]:t instanceof La?t.options:t instanceof Ua?je.objectValues(t.enum):t instanceof Fa?ti(t._def.innerType):t instanceof Ra?[void 0]:t instanceof Na?[null]:t instanceof xn?[void 0,...ti(t.unwrap())]:t instanceof xo?[null,...ti(t.unwrap())]:t instanceof Dp||t instanceof Za?ti(t.unwrap()):t instanceof Ba?ti(t._def.innerType):[],zy=class t extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.object)return B(r,{code:z.invalid_type,expected:W.object,received:r.parsedType}),pe;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(B(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=ti(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Se(n)})}};function M$(t,e){let r=bo(t),n=bo(e);if(t===e)return{valid:!0,data:t};if(r===W.object&&n===W.object){let o=je.objectKeys(e),i=je.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let c=M$(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===W.array&&n===W.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i{if(Ry(i)||Ry(s))return pe;let a=M$(i.value,s.value);return a.valid?((Ny(i)||Ny(s))&&r.dirty(),{status:r.value,value:a.data}):(B(n,{code:z.invalid_intersection_types}),pe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ma.create=(t,e,r)=>new Ma({left:t,right:e,typeName:N.ZodIntersection,...Se(r)});var wo=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.array)return B(n,{code:z.invalid_type,expected:W.array,received:n.parsedType}),pe;if(n.data.lengththis._def.items.length&&(B(n,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new $n(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>Gt.mergeArray(r,s)):Gt.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};wo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wo({items:t,typeName:N.ZodTuple,rest:null,...Se(e)})};var My=class t extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.object)return B(n,{code:z.invalid_type,expected:W.object,received:n.parsedType}),pe;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new $n(n,a,n.path,a)),value:s._parse(new $n(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Gt.mergeObjectAsync(r,o):Gt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ee?new t({keyType:e,valueType:r,typeName:N.ZodRecord,...Se(n)}):new t({keyType:os.create(),valueType:e,typeName:N.ZodRecord,...Se(r)})}},tl=class extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.map)return B(n,{code:z.invalid_type,expected:W.map,received:n.parsedType}),pe;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new $n(n,a,n.path,[u,"key"])),value:i._parse(new $n(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return pe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return pe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};tl.create=(t,e,r)=>new tl({valueType:e,keyType:t,typeName:N.ZodMap,...Se(r)});var rl=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.set)return B(n,{code:z.invalid_type,expected:W.set,received:n.parsedType}),pe;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&(B(n,{code:z.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return pe;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>i._parse(new $n(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:ne.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:ne.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};rl.create=(t,e)=>new rl({valueType:t,minSize:null,maxSize:null,typeName:N.ZodSet,...Se(e)});var jy=class t extends Ee{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.function)return B(r,{code:z.invalid_type,expected:W.function,received:r.parsedType}),pe;function n(a,c){return jp({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ju(),ei].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function o(a,c){return jp({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ju(),ei].filter(u=>!!u),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof ss){let a=this;return sr(async function(...c){let u=new Mr([]),l=await a._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(o(d,p)),u})})}else{let a=this;return sr(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new Mr([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new Mr([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:wo.create(e).rest(ri.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||wo.create([]).rest(ri.create()),returns:r||ri.create(),typeName:N.ZodFunction,...Se(n)})}},ja=class extends Ee{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ja.create=(t,e)=>new ja({getter:t,typeName:N.ZodLazy,...Se(e)});var Da=class extends Ee{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return B(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}};Da.create=(t,e)=>new Da({value:t,typeName:N.ZodLiteral,...Se(e)});function Gz(t,e){return new La({values:t,typeName:N.ZodEnum,...Se(e)})}var La=class t extends Ee{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{expected:je.joinValues(n),received:r.parsedType,code:z.invalid_type}),pe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{received:r.data,code:z.invalid_enum_value,options:n}),pe}return sr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};La.create=Gz;var Ua=class extends Ee{_parse(e){let r=je.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==W.string&&n.parsedType!==W.number){let o=je.objectValues(r);return B(n,{expected:je.joinValues(o),received:n.parsedType,code:z.invalid_type}),pe}if(this._cache||(this._cache=new Set(je.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=je.objectValues(r);return B(n,{received:n.data,code:z.invalid_enum_value,options:o}),pe}return sr(e.data)}get enum(){return this._def.values}};Ua.create=(t,e)=>new Ua({values:t,typeName:N.ZodNativeEnum,...Se(e)});var ss=class extends Ee{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.promise&&r.common.async===!1)return B(r,{code:z.invalid_type,expected:W.promise,received:r.parsedType}),pe;let n=r.parsedType===W.promise?r.data:Promise.resolve(r.data);return sr(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ss.create=(t,e)=>new ss({type:t,typeName:N.ZodPromise,...Se(e)});var In=class extends Ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{B(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return pe;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?pe:c.status==="dirty"?Ea(c.value):r.value==="dirty"?Ea(c.value):c});{if(r.value==="aborted")return pe;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?pe:a.status==="dirty"?Ea(a.value):r.value==="dirty"?Ea(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?pe:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?pe:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ns(s))return pe;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>ns(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):pe);je.assertNever(o)}};In.create=(t,e,r)=>new In({schema:t,typeName:N.ZodEffects,effect:e,...Se(r)});In.createWithPreprocess=(t,e,r)=>new In({schema:e,effect:{type:"preprocess",transform:t},typeName:N.ZodEffects,...Se(r)});var xn=class extends Ee{_parse(e){return this._getType(e)===W.undefined?sr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xn.create=(t,e)=>new xn({innerType:t,typeName:N.ZodOptional,...Se(e)});var xo=class extends Ee{_parse(e){return this._getType(e)===W.null?sr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xo.create=(t,e)=>new xo({innerType:t,typeName:N.ZodNullable,...Se(e)});var Fa=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===W.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Fa.create=(t,e)=>new Fa({innerType:t,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Se(e)});var Ba=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Xu(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Se(e)});var nl=class extends Ee{_parse(e){if(this._getType(e)!==W.nan){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.nan,received:n.parsedType}),pe}return{status:"valid",value:e.data}}};nl.create=t=>new nl({typeName:N.ZodNaN,...Se(t)});var yG=Symbol("zod_brand"),Dp=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Lp=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?pe:i.status==="dirty"?(r.dirty(),Ea(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?pe:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:N.ZodPipeline})}},Za=class extends Ee{_parse(e){let r=this._def.innerType._parse(e),n=o=>(ns(o)&&(o.value=Object.freeze(o.value)),o);return Xu(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Za.create=(t,e)=>new Za({innerType:t,typeName:N.ZodReadonly,...Se(e)});function Bz(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Kz(t,e={},r){return t?is.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=Bz(e,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!i){let s=Bz(e,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):is.create()}var vG={object:jr.lazycreate},N;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(N||(N={}));var bG=(t,e={message:`Input not instance of ${t.name}`})=>Kz(r=>r instanceof t,e),Hz=os.create,Wz=Aa.create,wG=nl.create,xG=Oa.create,Jz=Pa.create,$G=Ca.create,IG=Qu.create,SG=Ra.create,kG=Na.create,TG=is.create,EG=ri.create,AG=qn.create,OG=el.create,PG=ni.create,Xz=jr.create,CG=jr.strictCreate,RG=za.create,NG=zy.create,zG=Ma.create,MG=wo.create,jG=My.create,DG=tl.create,LG=rl.create,UG=jy.create,FG=ja.create,BG=Da.create,ZG=La.create,qG=Ua.create,VG=ss.create,GG=In.create,KG=xn.create,HG=xo.create,WG=In.createWithPreprocess,JG=Lp.create,XG=()=>Hz().optional(),YG=()=>Wz().optional(),QG=()=>Jz().optional(),eK={string:(t=>os.create({...t,coerce:!0})),number:(t=>Aa.create({...t,coerce:!0})),boolean:(t=>Pa.create({...t,coerce:!0})),bigint:(t=>Oa.create({...t,coerce:!0})),date:(t=>Ca.create({...t,coerce:!0}))};var tK=pe;function Yz(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==N.ZodAny&&(r.items=he(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&De(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&De(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(De(r,"minItems",t.exactLength.value,t.exactLength.message,e),De(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Qz(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?De(r,"minimum",n.value,n.message,e):De(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),De(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?De(r,"maximum",n.value,n.message,e):De(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),De(r,"maximum",n.value,n.message,e));break;case"multipleOf":De(r,"multipleOf",n.value,n.message,e);break}return r}function e1(){return{type:"boolean"}}function Dy(t,e){return he(t.type._def,e)}var t1=(t,e)=>he(t.innerType._def,e);function j$(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map(o=>j$(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return nK(t,e)}}var nK=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":De(r,"minimum",n.value,n.message,e);break;case"max":De(r,"maximum",n.value,n.message,e);break}return r};function r1(t,e){return{...he(t.innerType._def,e),default:t.defaultValue()}}function n1(t,e){return e.effectStrategy==="input"?he(t.schema._def,e):pt(e)}function o1(t){return{type:"string",enum:Array.from(t.values)}}var oK=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function i1(t,e){let r=[he(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),he(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(oK(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...c}=i;s=c}else n=void 0;o.push(s)}}),o.length?{allOf:o,...n}:void 0}function s1(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var D$,Vn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(D$===void 0&&(D$=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),D$),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Ly(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":De(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":De(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Gn(r,"email",n.message,e);break;case"format:idn-email":Gn(r,"idn-email",n.message,e);break;case"pattern:zod":Ir(r,Vn.email,n.message,e);break}break;case"url":Gn(r,"uri",n.message,e);break;case"uuid":Gn(r,"uuid",n.message,e);break;case"regex":Ir(r,n.regex,n.message,e);break;case"cuid":Ir(r,Vn.cuid,n.message,e);break;case"cuid2":Ir(r,Vn.cuid2,n.message,e);break;case"startsWith":Ir(r,RegExp(`^${L$(n.value,e)}`),n.message,e);break;case"endsWith":Ir(r,RegExp(`${L$(n.value,e)}$`),n.message,e);break;case"datetime":Gn(r,"date-time",n.message,e);break;case"date":Gn(r,"date",n.message,e);break;case"time":Gn(r,"time",n.message,e);break;case"duration":Gn(r,"duration",n.message,e);break;case"length":De(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),De(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":Ir(r,RegExp(L$(n.value,e)),n.message,e);break;case"ip":n.version!=="v6"&&Gn(r,"ipv4",n.message,e),n.version!=="v4"&&Gn(r,"ipv6",n.message,e);break;case"base64url":Ir(r,Vn.base64url,n.message,e);break;case"jwt":Ir(r,Vn.jwt,n.message,e);break;case"cidr":n.version!=="v6"&&Ir(r,Vn.ipv4Cidr,n.message,e),n.version!=="v4"&&Ir(r,Vn.ipv6Cidr,n.message,e);break;case"emoji":Ir(r,Vn.emoji(),n.message,e);break;case"ulid":Ir(r,Vn.ulid,n.message,e);break;case"base64":switch(e.base64Strategy){case"format:binary":Gn(r,"binary",n.message,e);break;case"contentEncoding:base64":De(r,"contentEncoding","base64",n.message,e);break;case"pattern:zod":Ir(r,Vn.base64,n.message,e);break}break;case"nanoid":Ir(r,Vn.nanoid,n.message,e);break;case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function L$(t,e){return e.patternStrategy==="escape"?sK(t):t}var iK=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function sK(t){let e="";for(let r=0;ro.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):De(t,"format",e,r,n)}function Ir(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:a1(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):De(t,"pattern",a1(e,n),r,n)}function a1(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",i=!1,s=!1,a=!1;for(let c=0;c({...n,[o]:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??pt(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===N.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=Ly(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===N.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===N.ZodBranded&&t.keyType._def.type._def.typeName===N.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=Dy(t.keyType._def,e);return{...r,propertyNames:o}}}return r}function c1(t,e){if(e.mapStrategy==="record")return Uy(t,e);let r=he(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||pt(e),n=he(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||pt(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function u1(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function l1(t){return t.target==="openAi"?void 0:{not:pt({...t,currentPath:[...t.currentPath,"not"]})}}function d1(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Up={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function f1(t,e){if(e.target==="openApi3")return p1(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Up&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let s=Up[i._def.typeName];return s&&!o.includes(s)?[...o,s]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,i)=>{let s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];case"bigint":return[...o,"integer"];case"object":return i._def.value===null?[...o,"null"]:o;case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((i,s,a)=>a.indexOf(i)===s);return{type:o.length>1?o:o[0],enum:r.reduce((i,s)=>i.includes(s._def.value)?i:[...i,s._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return p1(t,e)}var p1=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>he(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function m1(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Up[t.innerType._def.typeName],nullable:!0}:{type:[Up[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=he(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function h1(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",R$(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?De(r,"minimum",n.value,n.message,e):De(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),De(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?De(r,"maximum",n.value,n.message,e):De(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),De(r,"maximum",n.value,n.message,e));break;case"multipleOf":De(r,"multipleOf",n.value,n.message,e);break}return r}function g1(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},o=[],i=t.shape();for(let a in i){let c=i[a];if(c===void 0||c._def===void 0)continue;let u=cK(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=he(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||o.push(a))}o.length&&(n.required=o);let s=aK(t,e);return s!==void 0&&(n.additionalProperties=s),n}function aK(t,e){if(t.catchall._def.typeName!=="ZodNever")return he(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function cK(t){try{return t.isOptional()}catch{return!0}}var _1=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return he(t.innerType._def,e);let r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:pt(e)},r]}:pt(e)};var y1=(t,e)=>{if(e.pipeStrategy==="input")return he(t.in._def,e);if(e.pipeStrategy==="output")return he(t.out._def,e);let r=he(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=he(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function v1(t,e){return he(t.type._def,e)}function b1(t,e){let n={type:"array",uniqueItems:!0,items:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&De(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&De(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function w1(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>he(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:he(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>he(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function x1(t){return{not:pt(t)}}function $1(t){return pt(t)}var I1=(t,e)=>he(t.innerType._def,e);var S1=(t,e,r)=>{switch(e){case N.ZodString:return Ly(t,r);case N.ZodNumber:return h1(t,r);case N.ZodObject:return g1(t,r);case N.ZodBigInt:return Qz(t,r);case N.ZodBoolean:return e1();case N.ZodDate:return j$(t,r);case N.ZodUndefined:return x1(r);case N.ZodNull:return d1(r);case N.ZodArray:return Yz(t,r);case N.ZodUnion:case N.ZodDiscriminatedUnion:return f1(t,r);case N.ZodIntersection:return i1(t,r);case N.ZodTuple:return w1(t,r);case N.ZodRecord:return Uy(t,r);case N.ZodLiteral:return s1(t,r);case N.ZodEnum:return o1(t);case N.ZodNativeEnum:return u1(t);case N.ZodNullable:return m1(t,r);case N.ZodOptional:return _1(t,r);case N.ZodMap:return c1(t,r);case N.ZodSet:return b1(t,r);case N.ZodLazy:return()=>t.getter()._def;case N.ZodPromise:return v1(t,r);case N.ZodNaN:case N.ZodNever:return l1(r);case N.ZodEffects:return n1(t,r);case N.ZodAny:return pt(r);case N.ZodUnknown:return $1(r);case N.ZodDefault:return r1(t,r);case N.ZodBranded:return Dy(t,r);case N.ZodReadonly:return I1(t,r);case N.ZodCatch:return t1(t,r);case N.ZodPipeline:return y1(t,r);case N.ZodFunction:case N.ZodVoid:case N.ZodSymbol:return;default:return(n=>{})(e)}};function he(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==jz)return a}if(n&&!r){let a=uK(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=S1(t,t.typeName,e),s=typeof i=="function"?he(i(),e):i;if(s&&lK(t,e,s),e.postProcess){let a=e.postProcess(s,t,e);return o.jsonSchema=s,a}return o.jsonSchema=s,s}var uK=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Cy(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),pt(e)):e.$refStrategy==="seen"?pt(e):void 0}},lK=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var k1=(t,e)=>{let r=Lz(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:he(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??pt(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=he(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??pt(r),s=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;s!==void 0&&(i.title=s),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=o===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function $o(t,e){let r=typeof t;if(r!==typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let n=t.length;if(n!==e.length)return!1;for(let o=0;o1?e[s.href]=t:(s.hash="",n===""?r=s:Kn(t,e,r))}}else if(t!==!0&&t!==!1)return e;let o=r.href+(n?"#"+n:"");if(e[o]!==void 0)throw new Error(`Duplicate schema URI "${o}".`);if(e[o]=t,t===!0||t===!1)return e;if(t.__absolute_uri__===void 0&&Object.defineProperty(t,"__absolute_uri__",{enumerable:!1,value:o}),t.$ref&&t.__absolute_ref__===void 0){let i=new URL(t.$ref,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_ref__",{enumerable:!1,value:i.href})}if(t.$recursiveRef&&t.__absolute_recursive_ref__===void 0){let i=new URL(t.$recursiveRef,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(t.$anchor){let i=new URL("#"+t.$anchor,r.href);e[i.href]=t}for(let i in t){if(mK[i])continue;let s=`${n}/${sn(i)}`,a=t[i];if(Array.isArray(a)){if(pK[i]){let c=a.length;for(let u=0;u%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,xK=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,$K=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,IK=/^(?:\/(?:[^~/]|~0|~1)*)*$/,SK=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,kK=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,TK=t=>{if(t[0]==='"')return!1;let[e,r,...n]=t.split("@");return!e||!r||n.length!==0||e.length>64||r.length>253||e[0]==="."||e.endsWith(".")||e.includes("..")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(e)?!1:r.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},EK=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,AK=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,OK=t=>t.length>1&&t.length<80&&(/^P\d+([.,]\d+)?W$/.test(t)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(t)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(t));function Io(t){return t.test.bind(t)}var U$={date:T1,time:E1.bind(void 0,!1),"date-time":RK,duration:OK,uri:MK,"uri-reference":Io(bK),"uri-template":Io(wK),url:Io(xK),email:TK,hostname:Io(vK),ipv4:Io(EK),ipv6:Io(AK),regex:DK,uuid:Io($K),"json-pointer":Io(IK),"json-pointer-uri-fragment":Io(SK),"relative-json-pointer":Io(kK)};function PK(t){return t%4===0&&(t%100!==0||t%400===0)}function T1(t){let e=t.match(gK);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&PK(r)?29:_K[n])}function E1(t,e){let r=e.match(yK);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3],s=!!r[5];return(n<=23&&o<=59&&i<=59||n==23&&o==59&&i==60)&&(!t||s)}var CK=/t|\s/i;function RK(t){let e=t.split(CK);return e.length==2&&T1(e[0])&&E1(!0,e[1])}var NK=/\/|:/,zK=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function MK(t){return NK.test(t)&&zK.test(t)}var jK=/[^\\]\\Z/;function DK(t){if(jK.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var A1;(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(A1||(A1={}));function O1(t){let e=0,r=t.length,n=0,o;for(;n=55296&&o<=56319&&n$o(t,ge))||H.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`}):_.some(ge=>t===ge)||H.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`})),b!==void 0){let ge=`${a}/not`;ot(t,b,r,n,o,i,s,ge).valid&&H.push({instanceLocation:s,keyword:"not",keywordLocation:ge,error:'Instance matched "not" schema.'})}let Ts=[];if(x!==void 0){let ge=`${a}/anyOf`,le=H.length,xe=!1;for(let ee=0;ee{let ve=Object.create(c),_e=ot(t,ee,r,n,o,p===!0?i:null,s,`${ge}/${q}`,ve);return H.push(..._e.errors),_e.valid&&Ts.push(ve),_e.valid}).length;xe===1?H.length=le:H.splice(le,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:ge,error:`Instance does not match exactly one subschema (${xe} matches).`})}if((l==="object"||l==="array")&&Object.assign(c,...Ts),F!==void 0){let ge=`${a}/if`;if(ot(t,F,r,n,o,i,s,ge,c).valid){if(J!==void 0){let xe=ot(t,J,r,n,o,i,s,`${a}/then`,c);xe.valid||H.push({instanceLocation:s,keyword:"if",keywordLocation:ge,error:'Instance does not match "then" schema.'},...xe.errors)}}else if(w!==void 0){let xe=ot(t,w,r,n,o,i,s,`${a}/else`,c);xe.valid||H.push({instanceLocation:s,keyword:"if",keywordLocation:ge,error:'Instance does not match "else" schema.'},...xe.errors)}}if(l==="object"){if(v!==void 0)for(let ee of v)ee in t||H.push({instanceLocation:s,keyword:"required",keywordLocation:`${a}/required`,error:`Instance does not have required property "${ee}".`});let ge=Object.keys(t);if(pn!==void 0&&ge.lengthNo&&H.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${No} properties.`}),qe!==void 0){let ee=`${a}/propertyNames`;for(let q in t){let ve=`${s}/${sn(q)}`,_e=ot(q,qe,r,n,o,i,ve,ee);_e.valid||H.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:ee,error:`Property name "${q}" does not match schema.`},..._e.errors)}}if(Ul!==void 0){let ee=`${a}/dependantRequired`;for(let q in Ul)if(q in t){let ve=Ul[q];for(let _e of ve)_e in t||H.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:ee,error:`Instance has "${q}" but does not have "${_e}".`})}}if(Ss!==void 0)for(let ee in Ss){let q=`${a}/dependentSchemas`;if(ee in t){let ve=ot(t,Ss[ee],r,n,o,i,s,`${q}/${sn(ee)}`,c);ve.valid||H.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:q,error:`Instance has "${ee}" but does not match dependant schema.`},...ve.errors)}}if(ks!==void 0){let ee=`${a}/dependencies`;for(let q in ks)if(q in t){let ve=ks[q];if(Array.isArray(ve))for(let _e of ve)_e in t||H.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ee,error:`Instance has "${q}" but does not have "${_e}".`});else{let _e=ot(t,ve,r,n,o,i,s,`${ee}/${sn(q)}`);_e.valid||H.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ee,error:`Instance has "${q}" but does not match dependant schema.`},..._e.errors)}}}let le=Object.create(null),xe=!1;if(oe!==void 0){let ee=`${a}/properties`;for(let q in oe){if(!(q in t))continue;let ve=`${s}/${sn(q)}`,_e=ot(t[q],oe[q],r,n,o,i,ve,`${ee}/${sn(q)}`);if(_e.valid)c[q]=le[q]=!0;else if(xe=o,H.push({instanceLocation:s,keyword:"properties",keywordLocation:ee,error:`Property "${q}" does not match schema.`},..._e.errors),xe)break}}if(!xe&&Q!==void 0){let ee=`${a}/patternProperties`;for(let q in Q){let ve=new RegExp(q,"u"),_e=Q[q];for(let Er in t){if(!ve.test(Er))continue;let ET=`${s}/${sn(Er)}`,AT=ot(t[Er],_e,r,n,o,i,ET,`${ee}/${sn(q)}`);AT.valid?c[Er]=le[Er]=!0:(xe=o,H.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:ee,error:`Property "${Er}" matches pattern "${q}" but does not match associated schema.`},...AT.errors))}}}if(!xe&&wt!==void 0){let ee=`${a}/additionalProperties`;for(let q in t){if(le[q])continue;let ve=`${s}/${sn(q)}`,_e=ot(t[q],wt,r,n,o,i,ve,ee);_e.valid?c[q]=!0:(xe=o,H.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:ee,error:`Property "${q}" does not match additional properties schema.`},..._e.errors))}}else if(!xe&&dn!==void 0){let ee=`${a}/unevaluatedProperties`;for(let q in t)if(!c[q]){let ve=`${s}/${sn(q)}`,_e=ot(t[q],dn,r,n,o,i,ve,ee);_e.valid?c[q]=!0:H.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:ee,error:`Property "${q}" does not match unevaluated properties schema.`},..._e.errors)}}}else if(l==="array"){R!==void 0&&t.length>R&&H.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${t.length} > ${R}).`}),g!==void 0&&t.length=(Cn||0)&&(H.length=q),Cn===void 0&&y===void 0&&ve===0?H.splice(q,0,{instanceLocation:s,keyword:"contains",keywordLocation:ee,error:"Array does not contain item matching schema."}):Cn!==void 0&&vey&&H.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${y} items matching schema. ${ve} items were found.`})}if(!xe&&Bl!==void 0){let ee=`${a}/unevaluatedItems`;for(le;le=Ye||t>Ye)&&H.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${Tt?"or equal to ":""} ${Ye}.`})):(ze!==void 0&&tYe&&H.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${Ye}.`}),it!==void 0&&t<=it&&H.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${a}/exclusiveMinimum`,error:`${t} is less than ${it}.`}),Tt!==void 0&&t>=Tt&&H.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${a}/exclusiveMaximum`,error:`${t} is greater than or equal to ${Tt}.`})),Bt!==void 0){let ge=t%Bt;Math.abs(0-ge)>=11920929e-14&&Math.abs(Bt-ge)>=11920929e-14&&H.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${a}/multipleOf`,error:`${t} is not a multiple of ${Bt}.`})}}else if(l==="string"){let ge=Rn===void 0&&ht===void 0?0:O1(t);Rn!==void 0&&geht&&H.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${a}/maxLength`,error:`String is too long (${ge} > ${ht}).`}),fn!==void 0&&!new RegExp(fn,"u").test(t)&&H.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${a}/pattern`,error:"String does not match pattern."}),Z!==void 0&&U$[Z]&&!U$[Z](t)&&H.push({instanceLocation:s,keyword:"format",keywordLocation:`${a}/format`,error:`String does not match format "${Z}".`})}return{valid:H.length===0,errors:H}}var Fy=class{schema;draft;shortCircuit;lookup;constructor(e,r="2019-09",n=!0){this.schema=e,this.draft=r,this.shortCircuit=n,this.lookup=Kn(e)}validate(e){return ot(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,r){r&&(e={...e,$id:r}),Kn(e,this.lookup)}};var LK={};G(LK,{Validator:()=>Fy,deepCompareStrict:()=>$o,toJsonSchema:()=>an,validatesOnlyStrings:()=>ol});function an(t){if(nt(t)){let e=Oy(t,!0);if(wn(e)){let r=Hu(e,!0);return vo(r)}else return vo(t)}return vt(t)?k1(t):t}function ol(t){if(!t||typeof t!="object"||Object.keys(t).length===0||Array.isArray(t))return!1;if("type"in t)return typeof t.type=="string"?t.type==="string":Array.isArray(t.type)?t.type.every(e=>e==="string"):!1;if("enum"in t)return Array.isArray(t.enum)&&t.enum.length>0&&t.enum.every(e=>typeof e=="string");if("const"in t)return typeof t.const=="string";if("allOf"in t&&Array.isArray(t.allOf))return t.allOf.some(e=>ol(e));if("anyOf"in t&&Array.isArray(t.anyOf)||"oneOf"in t&&Array.isArray(t.oneOf)){let e="anyOf"in t?t.anyOf:t.oneOf;return e.length>0&&e.every(r=>ol(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=Kn(t);return r[e]?ol(r[e]):!1}return!1}var UK={};G(UK,{Graph:()=>By});function FK(t,e){if(t!==void 0&&!Ui(t))return t;if(Hd(e))try{let r=e.getName();return r=r.startsWith("Runnable")?r.slice(8):r,r}catch{return e.getName()}else return e.name??"UnknownSchema"}function BK(t){return Hd(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...an(t.data.schema),title:t.data.name}}}var By=class R1{nodes={};edges=[];constructor(e){this.nodes=e?.nodes??this.nodes,this.edges=e?.edges??this.edges}toJSON(){let e={};return Object.values(this.nodes).forEach((r,n)=>{e[r.id]=Ui(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...BK(r)})),edges:this.edges.map(r=>{let n={source:e[r.source],target:e[r.target]};return typeof r.data<"u"&&(n.data=r.data),typeof r.conditional<"u"&&(n.conditional=r.conditional),n})}}addNode(e,r,n){if(r!==void 0&&this.nodes[r]!==void 0)throw new Error(`Node with id ${r} already exists`);let o=r??Et(),i={id:o,data:e,name:FK(r,e),metadata:n};return this.nodes[o]=i,i}removeNode(e){delete this.nodes[e.id],this.edges=this.edges.filter(r=>r.source!==e.id&&r.target!==e.id)}addEdge(e,r,n,o){if(this.nodes[e.id]===void 0)throw new Error(`Source node ${e.id} not in graph`);if(this.nodes[r.id]===void 0)throw new Error(`Target node ${r.id} not in graph`);let i={source:e.id,target:r.id,data:n,conditional:o};return this.edges.push(i),i}firstNode(){return P1(this)}lastNode(){return C1(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(u=>u.id).every(Ui)&&(n="");let i=u=>n?`${n}:${u}`:u;Object.entries(e.nodes).forEach(([u,l])=>{this.nodes[i(u)]={...l,id:i(u)}});let s=e.edges.map(u=>({...u,source:i(u.source),target:i(u.target)}));this.edges=[...this.edges,...s];let a=e.firstNode(),c=e.lastNode();return[a?{id:i(a.id),data:a.data}:void 0,c?{id:i(c.id),data:c.data}:void 0]}trimFirstNode(){let e=this.firstNode();e&&P1(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&C1(this,[e.id])&&this.removeNode(e)}reid(){let e=Object.fromEntries(Object.values(this.nodes).map(o=>[o.id,o.name])),r=new Map;Object.values(e).forEach(o=>{r.set(o,(r.get(o)||0)+1)});let n=o=>{let i=e[o];return Ui(o)&&r.get(i)===1?i:o};return new R1({nodes:Object.fromEntries(Object.entries(this.nodes).map(([o,i])=>[n(o),{...i,id:n(o)}])),edges:this.edges.map(o=>({...o,source:n(o.source),target:n(o.target)}))})}drawMermaid(e){let{withStyles:r,curveStyle:n,nodeColors:o={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=e??{},s=this.reid(),a=s.firstNode(),c=s.lastNode();return Nz(s.nodes,s.edges,{firstNode:a?.id,lastNode:c?.id,withStyles:r,curveStyle:n,nodeColors:o,wrapLabelNWords:i})}async drawMermaidPng(e){let r=this.drawMermaid(e);return zz(r,{backgroundColor:e?.backgroundColor})}};function P1(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.source)).map(o=>o.target)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function C1(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.target)).map(o=>o.source)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function N1(t){let e=new TextEncoder,r=new ReadableStream({async start(n){for await(let o of t)n.enqueue(e.encode(`event: data +data: ${JSON.stringify(o)} + +`));n.enqueue(e.encode(`event: end + +`)),n.close()}});return br.fromReadableStream(r)}function F$(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}var z1=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function";function Zy(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*B$(t,e){for(;;){let{value:r,done:n}=Lt.runWithConfig(vr(t),e.next.bind(e),!0);if(n)break;yield r}}async function*qy(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Lt.runWithConfig(vr(t),r.next.bind(e),!0);if(o)break;yield n}}function Ot(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}var Ze=class extends uo{lc_runnable=!0;name;getName(t){let e=this.name??this.constructor.lc_name()??this.constructor.name;return t?`${e}${t}`:e}withRetry(t){return new Gy({bound:this,kwargs:{},config:{},maxAttemptNumber:t?.stopAfterAttempt,...t})}withConfig(t){return new as({bound:this,config:t,kwargs:{}})}withFallbacks(t){let e=Array.isArray(t)?t:t.fallbacks;return new Z$({runnable:this,fallbacks:e})}_getOptionsList(t,e=0){if(Array.isArray(t)&&t.length!==e)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${t.length} options for ${e} inputs`);if(Array.isArray(t))return t.map(Pe);if(e>1&&!Array.isArray(t)&&t.runId){console.warn("Provided runId will be used only for the first element of the batch.");let r=Object.fromEntries(Object.entries(t).filter(([n])=>n!=="runId"));return Array.from({length:e},(n,o)=>Pe(o===0?t:r))}return Array.from({length:e},()=>Pe(t))}async batch(t,e,r){let n=this._getOptionsList(e??{},t.length),o=n[0]?.maxConcurrency??r?.maxConcurrency,i=new Xo({maxConcurrency:o,onFailedAttempt:a=>{throw a}}),s=t.map((a,c)=>i.call(async()=>{try{return await this.invoke(a,n[c])}catch(u){if(r?.returnExceptions)return u;throw u}}));return Promise.all(s)}async*_streamIterator(t,e){yield this.invoke(t,e)}async stream(t,e){let r=Pe(e),n=new Zi({generator:this._streamIterator(t,r),config:r});return await n.setup,br.fromAsyncGenerator(n)}_separateRunnableConfigFromCallOptions(t){let e;t===void 0?e=Pe(t):e=Pe({callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,runName:t.runName,configurable:t.configurable,recursionLimit:t.recursionLimit,maxConcurrency:t.maxConcurrency,runId:t.runId,timeout:t.timeout,signal:t.signal});let r={...t};return delete r.callbacks,delete r.tags,delete r.metadata,delete r.runName,delete r.configurable,delete r.recursionLimit,delete r.maxConcurrency,delete r.runId,delete r.timeout,delete r.signal,[e,r]}async _callWithConfig(t,e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),Ot(e,"input"),n.runId,n?.runType,void 0,void 0,n?.runName??this.getName());delete n.runId;let s;try{let a=t.call(this,e,n,i);s=await vn(a,r?.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(Ot(s,"output")),s}async _batchWithConfig(t,e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(or)),s=await Promise.all(i.map(async(c,u)=>{let l=await c?.handleChainStart(this.toJSON(),Ot(e[u],"input"),o[u].runId,o[u].runType,void 0,void 0,o[u].runName??this.getName());return delete o[u].runId,l})),a;try{let c=t.call(this,e,o,s,n);a=await vn(c,o?.[0]?.signal)}catch(c){throw await Promise.all(s.map(u=>u?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(Ot(a,"output")))),a}_concatOutputChunks(t,e){return en(t,e)}async*_transformStreamWithConfig(t,e,r){let n,o=!0,i,s=!0,a=Pe(r),c=await or(a),u=this;async function*l(){for await(let f of t){if(o)if(n===void 0)n=f;else try{n=u._concatOutputChunks(n,f)}catch{n=void 0,o=!1}yield f}}let d;try{let f=await m0(e.bind(this),l(),async()=>c?.handleChainStart(this.toJSON(),{input:""},a.runId,a.runType,void 0,void 0,a.runName??this.getName()),r?.signal,a);delete a.runId,d=f.setup;let p=d?.handlers.find(ZR),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(_0);h!==void 0&&d!==void 0&&(m=h.tapOutputIterable(d.runId,m));for await(let _ of m)if(yield _,s)if(i===void 0)i=_;else try{i=this._concatOutputChunks(i,_)}catch{i=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:Ot(n,"input")}),f}await d?.handleChainEnd(i??{},void 0,void 0,void 0,{inputs:Ot(n,"input")})}getGraph(t){let e=new By,r=e.addNode({name:`${this.getName()}Input`,schema:$r.any()}),n=e.addNode(this),o=e.addNode({name:`${this.getName()}Output`,schema:$r.any()});return e.addEdge(r,n),e.addEdge(n,o),e}pipe(t){return new cs({first:this,last:cn(t)})}pick(t){return this.pipe(new q$(t))}assign(t){return this.pipe(new Bp(new us({steps:t})))}async*transform(t,e){let r;for await(let n of t)r===void 0?r=n:r=this._concatOutputChunks(r,n);yield*this._streamIterator(r,Pe(e))}async*streamLog(t,e,r){let n=new sg({...r,autoClose:!1,_schemaFormat:"original"}),o=Pe(e);yield*this._streamLog(t,n,o)}async*_streamLog(t,e,r){let{callbacks:n}=r;if(n===void 0)r.callbacks=[e];else if(Array.isArray(n))r.callbacks=n.concat([e]);else{let a=n.copy();a.addHandler(e,!0),r.callbacks=a}let o=this.stream(t,r);async function i(){try{let a=await o;for await(let c of a){let u=new ho({ops:[{op:"add",path:"/streamed_output/-",value:c}]});await e.writer.write(u)}}finally{await e.writer.close()}}let s=i();try{for await(let a of e)yield a}finally{await s}}streamEvents(t,e,r){let n;if(e.version==="v1")n=this._streamEventsV1(t,e,r);else if(e.version==="v2")n=this._streamEventsV2(t,e,r);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return e.encoding==="text/event-stream"?N1(n):br.fromAsyncGenerator(n)}async*_streamEventsV2(t,e,r){let n=new qR({...r,autoClose:!1}),o=Pe(e),i=o.runId??Et();o.runId=i;let s=o.callbacks;if(s===void 0)o.callbacks=[n];else if(Array.isArray(s))o.callbacks=s.concat(n);else{let p=s.copy();p.addHandler(n,!0),o.callbacks=p}let a=new AbortController,c=this;async function u(){let p,m=null;try{e?.signal?"any"in AbortSignal?p=AbortSignal.any([a.signal,e.signal]):(p=e.signal,m=()=>{a.abort()},e.signal.addEventListener("abort",m,{once:!0})):p=a.signal;let h=await c.stream(t,{...o,signal:p}),_=n.tapOutputIterable(i,h);for await(let v of _)if(a.signal.aborted)break}finally{await n.finish(),p&&m&&p.removeEventListener("abort",m)}}let l=u(),d=!1,f;try{for await(let p of n){if(!d){p.data.input=t,d=!0,f=p.run_id,yield p;continue}p.run_id===f&&p.event.endsWith("_end")&&p.data?.input&&delete p.data.input,yield p}}finally{a.abort(),await l}}async*_streamEventsV1(t,e,r){let n,o=!1,i=Pe(e),s=i.tags??[],a=i.metadata??{},c=i.runName??this.getName(),u=new sg({...r,autoClose:!1,_schemaFormat:"streaming_events"}),l=new KR({...r}),d=this._streamLog(t,u,i);for await(let p of d){if(n?n=n.concat(p):n=ig.fromRunLogPatch(p),n.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!o){o=!0;let v={...n.state},b={run_id:v.id,event:`on_${v.type}_start`,name:c,tags:s,metadata:a,data:{input:t}};l.includeEvent(b,v.type)&&(yield b)}let m=p.ops.filter(v=>v.path.startsWith("/logs/")).map(v=>v.path.split("/")[2]),h=[...new Set(m)];for(let v of h){let b,x={},k=n.state.logs[v];if(k.end_time===void 0?k.streamed_output.length>0?b="stream":b="start":b="end",b==="start")k.inputs!==void 0&&(x.input=k.inputs);else if(b==="end")k.inputs!==void 0&&(x.input=k.inputs),x.output=k.final_output;else if(b==="stream"){let T=k.streamed_output.length;if(T!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${T} instead. Encountered in: "${k.name}"`);x={chunk:k.streamed_output[0]},k.streamed_output=[]}yield{event:`on_${k.type}_${b}`,name:k.name,run_id:k.id,tags:k.tags,metadata:k.metadata,data:x}}let{state:_}=n;if(_.streamed_output.length>0){let v=_.streamed_output.length;if(v!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${v} instead. Encountered in: "${_.name}"`);let b={chunk:_.streamed_output[0]};_.streamed_output=[];let x={event:`on_${_.type}_stream`,run_id:_.id,tags:s,metadata:a,name:c,data:b};l.includeEvent(x,_.type)&&(yield x)}}let f=n?.state;if(f!==void 0){let p={event:`on_${f.type}_end`,name:c,run_id:f.id,tags:s,metadata:a,data:{output:f.final_output}};l.includeEvent(p,f.type)&&(yield p)}}static isRunnable(t){return Hd(t)}withListeners({onStart:t,onEnd:e,onError:r}){return new as({bound:this,config:{},configFactories:[n=>({callbacks:[new y0({config:n,onStart:t,onEnd:e,onError:r})]})]})}asTool(t){return VK(this,t)}},as=class M1 extends Ze{static lc_name(){return"RunnableBinding"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;bound;config;kwargs;configFactories;constructor(e){super(e),this.bound=e.bound,this.kwargs=e.kwargs,this.config=e.config,this.configFactories=e.configFactories}getName(e){return this.bound.getName(e)}async _mergeConfig(...e){let r=ga(this.config,...e);return ga(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new Gy({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:e?.stopAfterAttempt,...e})}async invoke(e,r){return this.bound.invoke(e,await this._mergeConfig(r,this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(Pe(i),this.kwargs))):await this._mergeConfig(Pe(r),this.kwargs);return this.bound.batch(e,o,n)}_concatOutputChunks(e,r){return this.bound._concatOutputChunks(e,r)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(Pe(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(Pe(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(Pe(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(Pe(r),o.kwargs),version:r.version},n)};return br.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&Ze.isRunnable(e.bound)}withListeners({onStart:e,onEnd:r,onError:n}){return new M1({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[o=>({callbacks:[new y0({config:o,onStart:e,onEnd:r,onError:n})]})]})}},j1=class D1 extends Ze{static lc_name(){return"RunnableEach"}lc_serializable=!0;lc_namespace=["langchain_core","runnables"];bound;constructor(e){super(e),this.bound=e.bound}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _invoke(e,r,n){return this.bound.batch(e,Ve(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new D1({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},Gy=class extends as{static lc_name(){return"RunnableRetry"}lc_namespace=["langchain_core","runnables"];maxAttemptNumber=3;onFailedAttempt=()=>{};constructor(t){super(t),this.maxAttemptNumber=t.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=t.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(t,e,r){let n=t>1?`retry:attempt:${t}`:void 0;return Ve(e,{callbacks:r?.getChild(n)})}async _invoke(t,e,r){return Kd(n=>super.invoke(t,this._patchConfigForRetry(n,e,r)),{onFailedAttempt:({error:n})=>this.onFailedAttempt(n,t),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(t,e){return this._callWithConfig(this._invoke.bind(this),t,e)}async _batch(t,e,r,n){let o={};try{await Kd(async i=>{let s=t.map((d,f)=>f).filter(d=>o[d.toString()]===void 0||o[d.toString()]instanceof Error),a=s.map(d=>t[d]),c=s.map(d=>this._patchConfigForRetry(i,e?.[d],r?.[d])),u=await super.batch(a,c,{...n,returnExceptions:!0}),l;for(let d=0;dthis.onFailedAttempt(i,i.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(i){if(n?.returnExceptions!==!0)throw i}return Object.keys(o).sort((i,s)=>parseInt(i,10)-parseInt(s,10)).map(i=>o[parseInt(i,10)])}async batch(t,e,r){return this._batchWithConfig(this._batch.bind(this),t,e,r)}},cs=class Fp extends Ze{static lc_name(){return"RunnableSequence"}first;middle=[];last;omitSequenceTags=!1;lc_serializable=!0;lc_namespace=["langchain_core","runnables"];constructor(e){super(e),this.first=e.first,this.middle=e.middle??this.middle,this.last=e.last,this.name=e.name,this.omitSequenceTags=e.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),Ot(e,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let s=e,a;try{let c=[this.first,...this.middle];for(let u=0;u{let l=await c?.handleChainStart(this.toJSON(),Ot(e[u],"input"),o[u].runId,void 0,void 0,void 0,o[u].runName);return delete o[u].runId,l})),a=e;try{for(let c=0;c{let p=d?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`);return Ve(o[f],{callbacks:p})}),n);a=await vn(l,o[0]?.signal)}}catch(c){throw await Promise.all(s.map(u=>u?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(Ot(a,"output")))),a}_concatOutputChunks(e,r){return this.last._concatOutputChunks(e,r)}async*_streamIterator(e,r){let n=await or(r),{runId:o,...i}=r??{},s=await n?.handleChainStart(this.toJSON(),Ot(e,"input"),o,void 0,void 0,void 0,i?.runName),a=[this.first,...this.middle,this.last],c=!0,u;async function*l(){yield e}try{let d=a[0].transform(l(),Ve(i,{callbacks:s?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let f=1;f{let s=o.getGraph(e);i!==0&&s.trimFirstNode(),i!==this.steps.length-1&&s.trimLastNode(),r.extend(s);let a=s.firstNode();if(!a)throw new Error(`Runnable ${o} has no first node`);n&&r.addEdge(n,a),n=s.lastNode()}),r}pipe(e){return Fp.isRunnableSequence(e)?new Fp({first:this.first,middle:this.middle.concat([this.last,e.first,...e.middle]),last:e.last,name:this.name??e.name}):new Fp({first:this.first,middle:[...this.middle,this.last],last:cn(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&Ze.isRunnable(e)}static from([e,...r],n){let o={};return typeof n=="string"?o.name=n:n!==void 0&&(o=n),new Fp({...o,first:cn(e),middle:r.slice(0,-1).map(cn),last:cn(r[r.length-1])})}},us=class L1 extends Ze{static lc_name(){return"RunnableMap"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;steps;getStepsKeys(){return Object.keys(this.steps)}constructor(e){super(e),this.steps={};for(let[r,n]of Object.entries(e.steps))this.steps[r]=cn(n)}static from(e){return new L1({steps:e})}async invoke(e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),{input:e},n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let s={};try{let a=Object.entries(this.steps).map(async([c,u])=>{s[c]=await u.invoke(e,Ve(n,{callbacks:i?.getChild(`map:key:${c}`)}))});await vn(Promise.all(a),r?.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(s),s}async*_transform(e,r,n){let o={...this.steps},i=Jh(e,Object.keys(o).length),s=new Map(Object.entries(o).map(([a,c],u)=>{let l=c.transform(i[u],Ve(n,{callbacks:r?.getChild(`map:key:${a}`)}));return[a,l.next().then(d=>({key:a,gen:l,result:d}))]}));for(;s.size;){let a=Promise.race(s.values()),{key:c,result:u,gen:l}=await vn(a,n?.signal);s.delete(c),u.done||(yield{[c]:u.value},s.set(c,l.next().then(d=>({key:c,gen:l,result:d}))))}}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Pe(r),i=new Zi({generator:this.transform(n(),o),config:o});return await i.setup,br.fromAsyncGenerator(i)}},ZK=class U1 extends Ze{lc_serializable=!1;lc_namespace=["langchain_core","runnables"];func;constructor(e){if(super(e),!Kh(e.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=e.func}async invoke(e,r){let[n]=this._getOptionsList(r??{},1),o=await or(n),i=this.func(Ve(n,{callbacks:o}),e);return vn(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(Zy(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(z1(o)){for(;;){n?.signal?.throwIfAborted();let i=o.next();if(i.done)break;yield i.value}return}yield o}static from(e){return new U1({func:e})}};function qK(t){if(Kh(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}var Dr=class F1 extends Ze{static lc_name(){return"RunnableLambda"}lc_namespace=["langchain_core","runnables"];func;constructor(e){if(Kh(e.func))return ZK.from(e.func);super(e),qK(e.func),this.func=e.func}static from(e){return new F1({func:e})}async _invoke(e,r,n){return new Promise((o,i)=>{let s=Ve(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??Wh)-1});Lt.runWithConfig(vr(s),async()=>{try{let a=await this.func(e,{...s});if(a&&Ze.isRunnable(a)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");a=await a.invoke(e,{...s,recursionLimit:(s.recursionLimit??Wh)-1})}else if(Zy(a)){let c;for await(let u of qy(s,a))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}a=c}else if(F$(a)){let c;for(let u of B$(s,a))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}a=c}o(a)}catch(a){i(a)}})})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async*_transform(e,r,n){let o;for await(let a of e)if(o===void 0)o=a;else try{o=this._concatOutputChunks(o,a)}catch{o=a}let i=Ve(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??Wh)-1}),s=await new Promise((a,c)=>{Lt.runWithConfig(vr(i),async()=>{try{let u=await this.func(o,{...i,config:i});a(u)}catch(u){c(u)}})});if(s&&Ze.isRunnable(s)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");let a=await s.stream(o,i);for await(let c of a)yield c}else if(Zy(s))for await(let a of qy(i,s))n?.signal?.throwIfAborted(),yield a;else if(F$(s))for(let a of B$(i,s))n?.signal?.throwIfAborted(),yield a;else yield s}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Pe(r),i=new Zi({generator:this.transform(n(),o),config:o});return await i.setup,br.fromAsyncGenerator(i)}},B1=class extends us{},Z$=class extends Ze{static lc_name(){return"RunnableWithFallbacks"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnable;fallbacks;constructor(t){super(t),this.runnable=t.runnable,this.fallbacks=t.fallbacks}*runnables(){yield this.runnable;for(let t of this.fallbacks)yield t}async invoke(t,e){let r=Pe(e),n=await or(r),{runId:o,...i}=r,s=await n?.handleChainStart(this.toJSON(),Ot(t,"input"),o,void 0,void 0,void 0,i?.runName),a=Ve(i,{callbacks:s?.getChild()});return await Lt.runWithConfig(a,async()=>{let u;for(let l of this.runnables()){r?.signal?.throwIfAborted();try{let d=await l.invoke(t,a);return await s?.handleChainEnd(Ot(d,"output")),d}catch(d){u===void 0&&(u=d)}}throw u===void 0?new Error("No error stored at end of fallback."):(await s?.handleChainError(u),u)})}async*_streamIterator(t,e){let r=Pe(e),n=await or(r),{runId:o,...i}=r,s=await n?.handleChainStart(this.toJSON(),Ot(t,"input"),o,void 0,void 0,void 0,i?.runName),a,c;for(let l of this.runnables()){r?.signal?.throwIfAborted();let d=Ve(i,{callbacks:s?.getChild()});try{let f=await l.stream(t,d);c=qy(d,f);break}catch(f){a===void 0&&(a=f)}}if(c===void 0){let l=a??new Error("No error stored at end of fallback.");throw await s?.handleChainError(l),l}let u;try{for await(let l of c){yield l;try{u=u===void 0?u:this._concatOutputChunks(u,l)}catch{u=void 0}}}catch(l){throw await s?.handleChainError(l),l}await s?.handleChainEnd(Ot(u,"output"))}async batch(t,e,r){if(r?.returnExceptions)throw new Error("Not implemented.");let n=this._getOptionsList(e??{},t.length),o=await Promise.all(n.map(a=>or(a))),i=await Promise.all(o.map(async(a,c)=>{let u=await a?.handleChainStart(this.toJSON(),Ot(t[c],"input"),n[c].runId,void 0,void 0,void 0,n[c].runName);return delete n[c].runId,u})),s;for(let a of this.runnables()){n[0].signal?.throwIfAborted();try{let c=await a.batch(t,i.map((u,l)=>Ve(n[l],{callbacks:u?.getChild()})),r);return await Promise.all(i.map((u,l)=>u?.handleChainEnd(Ot(c[l],"output")))),c}catch(c){s===void 0&&(s=c)}}throw s?(await Promise.all(i.map(a=>a?.handleChainError(s))),s):new Error("No error stored at end of fallbacks.")}};function cn(t){if(typeof t=="function")return new Dr({func:t});if(Ze.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=cn(n);return new us({steps:e})}else throw new Error(`Expected a Runnable, function or object. +Instead got an unsupported type.`)}var Bp=class extends Ze{static lc_name(){return"RunnableAssign"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;mapper;constructor(t){t instanceof us&&(t={mapper:t}),super(t),this.mapper=t.mapper}async invoke(t,e){let r=await this.mapper.invoke(t,e);return{...t,...r}}async*_transform(t,e,r){let n=this.mapper.getStepsKeys(),[o,i]=Jh(t),s=this.mapper.transform(i,Ve(r,{callbacks:e?.getChild()})),a=s.next();for await(let c of o){if(typeof c!="object"||Array.isArray(c))throw new Error(`RunnableAssign can only be used with objects as input, got ${typeof c}`);let u=Object.fromEntries(Object.entries(c).filter(([l])=>!n.includes(l)));Object.keys(u).length>0&&(yield u)}yield(await a).value;for await(let c of s)yield c}transform(t,e){return this._transformStreamWithConfig(t,this._transform.bind(this),e)}async stream(t,e){async function*r(){yield t}let n=Pe(e),o=new Zi({generator:this.transform(r(),n),config:n});return await o.setup,br.fromAsyncGenerator(o)}},q$=class extends Ze{static lc_name(){return"RunnablePick"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;keys;constructor(t){(typeof t=="string"||Array.isArray(t))&&(t={keys:t}),super(t),this.keys=t.keys}async _pick(t){if(typeof this.keys=="string")return t[this.keys];{let e=this.keys.map(r=>[r,t[r]]).filter(r=>r[1]!==void 0);return e.length===0?void 0:Object.fromEntries(e)}}async invoke(t,e){return this._callWithConfig(this._pick.bind(this),t,e)}async*_transform(t){for await(let e of t){let r=await this._pick(e);r!==void 0&&(yield r)}}transform(t,e){return this._transformStreamWithConfig(t,this._transform.bind(this),e)}async stream(t,e){async function*r(){yield t}let n=Pe(e),o=new Zi({generator:this.transform(r(),n),config:n});return await o.setup,br.fromAsyncGenerator(o)}},Vy=class extends as{name;description;schema;constructor(t){let e=cs.from([Dr.from(async r=>{let n;if(Mi(r))try{n=await ts(this.schema,r.args)}catch{throw new su("Received tool input did not match expected schema",JSON.stringify(r.args))}else n=r;return n}).withConfig({runName:`${t.name}:parse_input`}),t.bound]).withConfig({runName:t.name});super({bound:e,config:t.config??{}}),this.name=t.name,this.description=t.description,this.schema=t.schema}static lc_name(){return"RunnableToolLike"}};function VK(t,e){let r=e.name??t.getName(),n=e.description??rs(e.schema);return Wu(e.schema)?new Vy({name:r,description:n,schema:$r.object({input:$r.string()}).transform(o=>o.input),bound:t}):new Vy({name:r,description:n,schema:e.schema,bound:t})}var Ky=(t,e)=>{let r=[...new Set(e?.map(o=>{if(typeof o=="string")return o;let i=new o({});if(!("getType"in i)||typeof i.getType!="function")throw new Error("Invalid type provided.");return i.getType()}))],n=t.getType();return r.some(o=>o===n)};function K1(t,e){return Array.isArray(t)?Z1(t,e):Dr.from(r=>Z1(r,t))}function Z1(t,e={}){let{includeNames:r,excludeNames:n,includeTypes:o,excludeTypes:i,includeIds:s,excludeIds:a}=e,c=[];for(let u of t)if(!(n&&u.name&&n.includes(u.name))){{if(i&&Ky(u,i))continue;if(a&&u.id&&a.includes(u.id))continue}o||s||r?(r&&u.name&&r.some(l=>l===u.name)||o&&Ky(u,o)||s&&u.id&&s.some(l=>l===u.id))&&c.push(u):c.push(u)}return c}function H1(t){return Array.isArray(t)?q1(t):Dr.from(q1)}function q1(t){if(!t.length)return[];let e=[];for(let r of t){let n=r,o=e.pop();if(!o)e.push(n);else if(n.getType()==="tool"||n.getType()!==o.getType())e.push(o,n);else{let i=ca(o),s=ca(n),a=i.concat(s);typeof i.content=="string"&&typeof s.content=="string"&&(a.content=`${i.content} +${s.content}`),e.push(KK(a))}}return e}function W1(t,e){if(Array.isArray(t)){let r=t;if(!e)throw new Error("Options parameter is required when providing messages.");return V1(r,e)}else{let r=t;return Dr.from(n=>V1(n,r)).withConfig({runName:"trim_messages"})}}async function V1(t,e){let{maxTokens:r,tokenCounter:n,strategy:o="last",allowPartial:i=!1,endOn:s,startOn:a,includeSystem:c=!1,textSplitter:u}=e;if(a&&o==="first")throw new Error("`startOn` should only be specified if `strategy` is 'last'.");if(c&&o==="first")throw new Error("`includeSystem` should only be specified if `strategy` is 'last'.");let l;"getNumTokens"in n?l=async f=>(await Promise.all(f.map(m=>n.getNumTokens(m.content)))).reduce((m,h)=>m+h,0):l=async f=>n(f);let d=G$;if(u&&("splitText"in u?d=u.splitText:d=async f=>u(f)),o==="first")return J1(t,{maxTokens:r,tokenCounter:l,textSplitter:d,partialStrategy:i?"first":void 0,endOn:s});if(o==="last")return GK(t,{maxTokens:r,tokenCounter:l,textSplitter:d,allowPartial:i,includeSystem:c,startOn:a,endOn:s});throw new Error(`Unrecognized strategy: '${o}'. Must be one of 'first' or 'last'.`)}async function J1(t,e){let{maxTokens:r,tokenCounter:n,textSplitter:o,partialStrategy:i,endOn:s}=e,a=[...t],c=0;for(let u=0;u0?a.slice(0,-u):a;if(await n(l)<=r){c=a.length-u;break}}if(cb!=="type"&&!b.startsWith("lc_"))),_=V$(l.getType(),{...h,content:m}),v=[...a.slice(0,c),_];if(await n(v)<=r)a=v,c+=1,u=!0;else break}u&&i==="last"&&(l.content=[...f].reverse())}if(!u){let l=a[c],d;if(Array.isArray(l.content)&&l.content.some(f=>typeof f=="string"||f.type==="text")?d=l.content.find(p=>p.type==="text"&&p.text)?.text:typeof l.content=="string"&&(d=l.content),d){let f=await o(d),p=f.length;i==="last"&&f.reverse();for(let m=0;m0&&!Ky(a[c-1],u);)c-=1}return a.slice(0,c)}async function GK(t,e){let{allowPartial:r=!1,includeSystem:n=!1,endOn:o,startOn:i,...s}=e,a=t.map(l=>{let d=Object.fromEntries(Object.entries(l).filter(([f])=>f!=="type"&&!f.startsWith("lc_")));return V$(l.getType(),d,iu(l))});if(o){let l=Array.isArray(o)?o:[o];for(;a.length>0&&!Ky(a[a.length-1],l);)a=a.slice(0,-1)}let c=n&&a[0]?.getType()==="system",u=c?a.slice(0,1).concat(a.slice(1).reverse()):a.reverse();return u=await J1(u,{...s,partialStrategy:r?"last":void 0,endOn:i}),c?[u[0],...u.slice(1).reverse()]:u.reverse()}var G1={human:{message:mr,messageChunk:zi},ai:{message:jt,messageChunk:Dt},system:{message:hn,messageChunk:lo},developer:{message:hn,messageChunk:lo},tool:{message:Or,messageChunk:na},function:{message:oa,messageChunk:Ni},generic:{message:jn,messageChunk:Ri},remove:{message:ia,messageChunk:ia}};function V$(t,e,r){let n,o;switch(t){case"human":r?n=new zi(e):o=new mr(e);break;case"ai":if(r){let i={...e};"tool_calls"in i&&(i={...i,tool_call_chunks:i.tool_calls?.map(s=>({...s,type:"tool_call_chunk",index:void 0,args:JSON.stringify(s.args)}))}),n=new Dt(i)}else o=new jt(e);break;case"system":r?n=new lo(e):o=new hn(e);break;case"developer":r?n=new lo({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}}):o=new hn({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in e)r?n=new na(e):o=new Or(e);else throw new Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(r)n=new Ni(e);else{if(!e.name)throw new Error("FunctionMessage must have a 'name' field");o=new oa(e)}break;case"generic":if("role"in e)r?n=new Ri(e):o=new jn(e);else throw new Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw new Error(`Unrecognized message type ${t}`)}if(r&&n)return n;if(o)return o;throw new Error(`Unrecognized message type ${t}`)}function KK(t){let e=t.getType(),r,n=Object.fromEntries(Object.entries(t).filter(([o])=>!["type","tool_call_chunks"].includes(o)&&!o.startsWith("lc_")));if(e in G1&&(r=V$(e,n)),!r)throw new Error(`Unrecognized message chunk class ${e}. Supported classes are ${Object.keys(G1)}`);return r}function G$(t){let e=t.split(` +`);return Promise.resolve([...e.slice(0,-1).map(r=>`${r} +`),e[e.length-1]])}var X1=["tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result"];var Y1=["image","video","audio","text-plain","file"];var Q1=["text","reasoning",...X1,...Y1];var HK={};G(HK,{AIMessage:()=>jt,AIMessageChunk:()=>Dt,BaseMessage:()=>qt,BaseMessageChunk:()=>fr,ChatMessage:()=>jn,ChatMessageChunk:()=>Ri,FunctionMessage:()=>oa,FunctionMessageChunk:()=>Ni,HumanMessage:()=>mr,HumanMessageChunk:()=>zi,KNOWN_BLOCK_TYPES:()=>Q1,RemoveMessage:()=>ia,SystemMessage:()=>hn,SystemMessageChunk:()=>lo,ToolMessage:()=>Or,ToolMessageChunk:()=>na,_isMessageFieldWithRole:()=>ih,_mergeDicts:()=>dt,_mergeLists:()=>ra,_mergeObj:()=>oh,_mergeStatus:()=>nh,coerceMessageLikeToMessage:()=>ji,collapseToolCallChunks:()=>lh,convertToChunk:()=>ca,convertToOpenAIImageBlock:()=>Xm,convertToProviderContentBlock:()=>$d,defaultTextSplitter:()=>G$,defaultToolCallParser:()=>Sd,filterMessages:()=>K1,getBufferString:()=>au,iife:()=>Xw,isAIMessage:()=>aa,isAIMessageChunk:()=>Td,isBase64ContentBlock:()=>ou,isBaseMessage:()=>Yr,isBaseMessageChunk:()=>iu,isChatMessage:()=>WA,isChatMessageChunk:()=>JA,isDataContentBlock:()=>Jr,isDirectToolOutput:()=>Id,isFunctionMessage:()=>XA,isFunctionMessageChunk:()=>YA,isHumanMessage:()=>QA,isHumanMessageChunk:()=>eO,isIDContentBlock:()=>Jm,isMessage:()=>Qm,isOpenAIToolCallArray:()=>VA,isPlainTextContentBlock:()=>bA,isSystemMessage:()=>tO,isSystemMessageChunk:()=>rO,isToolMessage:()=>Gw,isToolMessageChunk:()=>Kw,isURLContentBlock:()=>nu,mapChatMessagesToStoredMessages:()=>dO,mapStoredMessageToChatMessage:()=>Ed,mapStoredMessagesToChatMessages:()=>lO,mergeContent:()=>er,mergeMessageRuns:()=>H1,mergeResponseMetadata:()=>sh,mergeUsageMetadata:()=>ah,parseBase64DataUrl:()=>ta,parseMimeType:()=>Ym,trimMessages:()=>W1});function Zp(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function qp(t){return t!==void 0&&Ze.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function Vp(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(on(t.schema)||t.schema!=null&&typeof t.schema=="object"&&"type"in t.schema&&typeof t.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(t.schema.type))}function qa(t){return Vp(t)||qp(t)||Zp(t)}var JK={};G(JK,{convertToOpenAIFunction:()=>eM,convertToOpenAITool:()=>tM,isLangChainTool:()=>qa,isRunnableToolLike:()=>qp,isStructuredTool:()=>Zp,isStructuredToolParams:()=>Vp});function eM(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:an(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function tM(t,e){let r=typeof e=="number"?void 0:e,n;return qa(t)?n={type:"function",function:eM(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var XK={};G(XK,{extendInteropZodObject:()=>Oz,getInteropZodDefaultGetter:()=>Cz,getInteropZodObjectShape:()=>ky,getSchemaDescription:()=>rs,interopParse:()=>Tz,interopParseAsync:()=>ts,interopSafeParse:()=>kz,interopSafeParseAsync:()=>Ey,interopZodObjectMakeFieldsOptional:()=>Rz,interopZodObjectPartial:()=>Pz,interopZodObjectPassthrough:()=>Ty,interopZodObjectStrict:()=>Hu,interopZodTransformInputSchema:()=>Oy,isInteropZodError:()=>Py,isInteropZodLiteral:()=>Sz,isInteropZodObject:()=>Az,isInteropZodSchema:()=>on,isShapelessZodSchema:()=>Ez,isSimpleStringZodSchema:()=>Wu,isZodArrayV4:()=>Mp,isZodLiteralV3:()=>E$,isZodLiteralV4:()=>A$,isZodNullableV4:()=>P$,isZodObjectV3:()=>Ay,isZodObjectV4:()=>wn,isZodOptionalV4:()=>O$,isZodSchema:()=>Iz,isZodSchemaV3:()=>vt,isZodSchemaV4:()=>nt});var av={};gi(av,{$brand:()=>Jd,$input:()=>D_,$output:()=>j_,NEVER:()=>lg,TimePrecision:()=>B_,ZodAny:()=>cM,ZodArray:()=>pM,ZodBase64:()=>$I,ZodBase64URL:()=>II,ZodBigInt:()=>Xp,ZodBigIntFormat:()=>TI,ZodBoolean:()=>Jp,ZodCIDRv4:()=>wI,ZodCIDRv6:()=>xI,ZodCUID:()=>mI,ZodCUID2:()=>hI,ZodCatch:()=>AM,ZodCodec:()=>zI,ZodCustom:()=>iv,ZodCustomStringFormat:()=>Hp,ZodDate:()=>rv,ZodDefault:()=>$M,ZodDiscriminatedUnion:()=>fM,ZodE164:()=>SI,ZodEmail:()=>dI,ZodEmoji:()=>pI,ZodEnum:()=>Gp,ZodError:()=>QK,ZodFile:()=>bM,ZodFirstPartyTypeKind:()=>jI,ZodFunction:()=>DM,ZodGUID:()=>Yy,ZodIPv4:()=>vI,ZodIPv6:()=>bI,ZodISODate:()=>Wy,ZodISODateTime:()=>Hy,ZodISODuration:()=>Xy,ZodISOTime:()=>Jy,ZodIntersection:()=>mM,ZodIssueCode:()=>aW,ZodJWT:()=>kI,ZodKSUID:()=>yI,ZodLazy:()=>zM,ZodLiteral:()=>vM,ZodMAC:()=>oM,ZodMap:()=>_M,ZodNaN:()=>PM,ZodNanoID:()=>fI,ZodNever:()=>lM,ZodNonOptional:()=>RI,ZodNull:()=>aM,ZodNullable:()=>xM,ZodNumber:()=>Wp,ZodNumberFormat:()=>sl,ZodObject:()=>nv,ZodOptional:()=>CI,ZodPipe:()=>NI,ZodPrefault:()=>SM,ZodPromise:()=>jM,ZodReadonly:()=>CM,ZodRealError:()=>Lr,ZodRecord:()=>OI,ZodSet:()=>yM,ZodString:()=>Kp,ZodStringFormat:()=>et,ZodSuccess:()=>EM,ZodSymbol:()=>iM,ZodTemplateLiteral:()=>NM,ZodTransform:()=>wM,ZodTuple:()=>hM,ZodType:()=>Ae,ZodULID:()=>gI,ZodURL:()=>tv,ZodUUID:()=>oi,ZodUndefined:()=>sM,ZodUnion:()=>AI,ZodUnknown:()=>uM,ZodVoid:()=>dM,ZodXID:()=>_I,_ZodString:()=>lI,_default:()=>IM,_function:()=>eW,any:()=>DH,array:()=>Re,base64:()=>wH,base64url:()=>xH,bigint:()=>RH,boolean:()=>Nt,catch:()=>OM,check:()=>tW,cidrv4:()=>vH,cidrv6:()=>bH,clone:()=>Qe,codec:()=>XH,coerce:()=>DI,config:()=>yt,core:()=>nn,cuid:()=>dH,cuid2:()=>pH,custom:()=>MI,date:()=>UH,decode:()=>rI,decodeAsync:()=>oI,describe:()=>rW,discriminatedUnion:()=>ov,e164:()=>$H,email:()=>tH,emoji:()=>uH,encode:()=>tI,encodeAsync:()=>nI,endsWith:()=>Bu,enum:()=>zt,file:()=>KH,flattenError:()=>yu,float32:()=>AH,float64:()=>OH,formatError:()=>vu,function:()=>eW,getErrorMap:()=>uW,globalRegistry:()=>Ge,gt:()=>yo,gte:()=>ir,guid:()=>rH,hash:()=>EH,hex:()=>TH,hostname:()=>kH,httpUrl:()=>cH,includes:()=>Uu,instanceof:()=>oW,int:()=>uI,int32:()=>PH,int64:()=>NH,intersection:()=>Qp,ipv4:()=>gH,ipv6:()=>yH,iso:()=>il,json:()=>sW,jwt:()=>IH,keyof:()=>FH,ksuid:()=>hH,lazy:()=>MM,length:()=>Sa,literal:()=>se,locales:()=>Ou,looseObject:()=>un,lowercase:()=>Du,lt:()=>_o,lte:()=>zr,mac:()=>_H,map:()=>qH,maxLength:()=>Ia,maxSize:()=>$a,meta:()=>nW,mime:()=>Zu,minLength:()=>Qo,minSize:()=>es,multipleOf:()=>Qi,nan:()=>JH,nanoid:()=>lH,nativeEnum:()=>GH,negative:()=>hy,never:()=>EI,nonnegative:()=>_y,nonoptional:()=>TM,nonpositive:()=>gy,normalize:()=>qu,null:()=>Yp,nullable:()=>Qy,nullish:()=>HH,number:()=>We,object:()=>U,optional:()=>ie,overwrite:()=>Zn,parse:()=>X$,parseAsync:()=>Y$,partialRecord:()=>ZH,pipe:()=>ev,positive:()=>my,prefault:()=>kM,preprocess:()=>sv,prettifyError:()=>mg,promise:()=>QH,property:()=>yy,readonly:()=>RM,record:()=>bt,refine:()=>LM,regex:()=>ju,regexes:()=>Nr,registry:()=>fp,safeDecode:()=>sI,safeDecodeAsync:()=>cI,safeEncode:()=>iI,safeEncodeAsync:()=>aI,safeParse:()=>Q$,safeParseAsync:()=>eI,set:()=>VH,setErrorMap:()=>cW,size:()=>Mu,slugify:()=>Np,startsWith:()=>Fu,strictObject:()=>BH,string:()=>A,stringFormat:()=>SH,stringbool:()=>iW,success:()=>WH,superRefine:()=>UM,symbol:()=>MH,templateLiteral:()=>YH,toJSONSchema:()=>vo,toLowerCase:()=>Gu,toUpperCase:()=>Ku,transform:()=>PI,treeifyError:()=>fg,trim:()=>Vu,tuple:()=>gM,uint32:()=>CH,uint64:()=>zH,ulid:()=>fH,undefined:()=>jH,union:()=>tt,unknown:()=>ft,uppercase:()=>Lu,url:()=>aH,util:()=>M,uuid:()=>nH,uuidv4:()=>oH,uuidv6:()=>iH,uuidv7:()=>sH,void:()=>LH,xid:()=>mH});var il={};gi(il,{ZodISODate:()=>Wy,ZodISODateTime:()=>Hy,ZodISODuration:()=>Xy,ZodISOTime:()=>Jy,date:()=>H$,datetime:()=>K$,duration:()=>J$,time:()=>W$});var Hy=$("ZodISODateTime",(t,e)=>{Bg.init(t,e),et.init(t,e)});function K$(t){return Z_(Hy,t)}var Wy=$("ZodISODate",(t,e)=>{Zg.init(t,e),et.init(t,e)});function H$(t){return q_(Wy,t)}var Jy=$("ZodISOTime",(t,e)=>{qg.init(t,e),et.init(t,e)});function W$(t){return V_(Jy,t)}var Xy=$("ZodISODuration",(t,e)=>{Vg.init(t,e),et.init(t,e)});function J$(t){return G_(Xy,t)}var nM=(t,e)=>{np.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>vu(t,r)},flatten:{value:r=>yu(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,hu,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,hu,2)}},isEmpty:{get(){return t.issues.length===0}}})},QK=$("ZodError",nM),Lr=$("ZodError",nM,{Parent:Error});var X$=bu(Lr),Y$=wu(Lr),Q$=xu(Lr),eI=$u(Lr),tI=hg(Lr),rI=gg(Lr),nI=_g(Lr),oI=yg(Lr),iI=vg(Lr),sI=bg(Lr),aI=wg(Lr),cI=xg(Lr);var Ae=$("ZodType",(t,e)=>(ye.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(M.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>Qe(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>X$(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Q$(t,r,n),t.parseAsync=async(r,n)=>Y$(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>eI(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>tI(t,r,n),t.decode=(r,n)=>rI(t,r,n),t.encodeAsync=async(r,n)=>nI(t,r,n),t.decodeAsync=async(r,n)=>oI(t,r,n),t.safeEncode=(r,n)=>iI(t,r,n),t.safeDecode=(r,n)=>sI(t,r,n),t.safeEncodeAsync=async(r,n)=>aI(t,r,n),t.safeDecodeAsync=async(r,n)=>cI(t,r,n),t.refine=(r,n)=>t.check(LM(r,n)),t.superRefine=r=>t.check(UM(r)),t.overwrite=r=>t.check(Zn(r)),t.optional=()=>ie(t),t.nullable=()=>Qy(t),t.nullish=()=>ie(Qy(t)),t.nonoptional=r=>TM(t,r),t.array=()=>Re(t),t.or=r=>tt([t,r]),t.and=r=>Qp(t,r),t.transform=r=>ev(t,PI(r)),t.default=r=>IM(t,r),t.prefault=r=>kM(t,r),t.catch=r=>OM(t,r),t.pipe=r=>ev(t,r),t.readonly=()=>RM(t),t.describe=r=>{let n=t.clone();return Ge.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ge.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ge.get(t);let n=t.clone();return Ge.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),lI=$("_ZodString",(t,e)=>{Yi.init(t,e),Ae.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(ju(...n)),t.includes=(...n)=>t.check(Uu(...n)),t.startsWith=(...n)=>t.check(Fu(...n)),t.endsWith=(...n)=>t.check(Bu(...n)),t.min=(...n)=>t.check(Qo(...n)),t.max=(...n)=>t.check(Ia(...n)),t.length=(...n)=>t.check(Sa(...n)),t.nonempty=(...n)=>t.check(Qo(1,...n)),t.lowercase=n=>t.check(Du(n)),t.uppercase=n=>t.check(Lu(n)),t.trim=()=>t.check(Vu()),t.normalize=(...n)=>t.check(qu(...n)),t.toLowerCase=()=>t.check(Gu()),t.toUpperCase=()=>t.check(Ku()),t.slugify=()=>t.check(Np())}),Kp=$("ZodString",(t,e)=>{Yi.init(t,e),lI.init(t,e),t.email=r=>t.check(mp(dI,r)),t.url=r=>t.check(Ru(tv,r)),t.jwt=r=>t.check(Rp(kI,r)),t.emoji=r=>t.check(vp(pI,r)),t.guid=r=>t.check(Cu(Yy,r)),t.uuid=r=>t.check(hp(oi,r)),t.uuidv4=r=>t.check(gp(oi,r)),t.uuidv6=r=>t.check(_p(oi,r)),t.uuidv7=r=>t.check(yp(oi,r)),t.nanoid=r=>t.check(bp(fI,r)),t.guid=r=>t.check(Cu(Yy,r)),t.cuid=r=>t.check(wp(mI,r)),t.cuid2=r=>t.check(xp(hI,r)),t.ulid=r=>t.check($p(gI,r)),t.base64=r=>t.check(Op($I,r)),t.base64url=r=>t.check(Pp(II,r)),t.xid=r=>t.check(Ip(_I,r)),t.ksuid=r=>t.check(Sp(yI,r)),t.ipv4=r=>t.check(kp(vI,r)),t.ipv6=r=>t.check(Tp(bI,r)),t.cidrv4=r=>t.check(Ep(wI,r)),t.cidrv6=r=>t.check(Ap(xI,r)),t.e164=r=>t.check(Cp(SI,r)),t.datetime=r=>t.check(K$(r)),t.date=r=>t.check(H$(r)),t.time=r=>t.check(W$(r)),t.duration=r=>t.check(J$(r))});function A(t){return L_(Kp,t)}var et=$("ZodStringFormat",(t,e)=>{He.init(t,e),lI.init(t,e)}),dI=$("ZodEmail",(t,e)=>{Rg.init(t,e),et.init(t,e)});function tH(t){return mp(dI,t)}var Yy=$("ZodGUID",(t,e)=>{Pg.init(t,e),et.init(t,e)});function rH(t){return Cu(Yy,t)}var oi=$("ZodUUID",(t,e)=>{Cg.init(t,e),et.init(t,e)});function nH(t){return hp(oi,t)}function oH(t){return gp(oi,t)}function iH(t){return _p(oi,t)}function sH(t){return yp(oi,t)}var tv=$("ZodURL",(t,e)=>{Ng.init(t,e),et.init(t,e)});function aH(t){return Ru(tv,t)}function cH(t){return Ru(tv,{protocol:/^https?$/,hostname:Nr.domain,...M.normalizeParams(t)})}var pI=$("ZodEmoji",(t,e)=>{zg.init(t,e),et.init(t,e)});function uH(t){return vp(pI,t)}var fI=$("ZodNanoID",(t,e)=>{Mg.init(t,e),et.init(t,e)});function lH(t){return bp(fI,t)}var mI=$("ZodCUID",(t,e)=>{jg.init(t,e),et.init(t,e)});function dH(t){return wp(mI,t)}var hI=$("ZodCUID2",(t,e)=>{Dg.init(t,e),et.init(t,e)});function pH(t){return xp(hI,t)}var gI=$("ZodULID",(t,e)=>{Lg.init(t,e),et.init(t,e)});function fH(t){return $p(gI,t)}var _I=$("ZodXID",(t,e)=>{Ug.init(t,e),et.init(t,e)});function mH(t){return Ip(_I,t)}var yI=$("ZodKSUID",(t,e)=>{Fg.init(t,e),et.init(t,e)});function hH(t){return Sp(yI,t)}var vI=$("ZodIPv4",(t,e)=>{Gg.init(t,e),et.init(t,e)});function gH(t){return kp(vI,t)}var oM=$("ZodMAC",(t,e)=>{Hg.init(t,e),et.init(t,e)});function _H(t){return F_(oM,t)}var bI=$("ZodIPv6",(t,e)=>{Kg.init(t,e),et.init(t,e)});function yH(t){return Tp(bI,t)}var wI=$("ZodCIDRv4",(t,e)=>{Wg.init(t,e),et.init(t,e)});function vH(t){return Ep(wI,t)}var xI=$("ZodCIDRv6",(t,e)=>{Jg.init(t,e),et.init(t,e)});function bH(t){return Ap(xI,t)}var $I=$("ZodBase64",(t,e)=>{Xg.init(t,e),et.init(t,e)});function wH(t){return Op($I,t)}var II=$("ZodBase64URL",(t,e)=>{Yg.init(t,e),et.init(t,e)});function xH(t){return Pp(II,t)}var SI=$("ZodE164",(t,e)=>{Qg.init(t,e),et.init(t,e)});function $H(t){return Cp(SI,t)}var kI=$("ZodJWT",(t,e)=>{e_.init(t,e),et.init(t,e)});function IH(t){return Rp(kI,t)}var Hp=$("ZodCustomStringFormat",(t,e)=>{t_.init(t,e),et.init(t,e)});function SH(t,e,r={}){return ka(Hp,t,e,r)}function kH(t){return ka(Hp,"hostname",Nr.hostname,t)}function TH(t){return ka(Hp,"hex",Nr.hex,t)}function EH(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=Nr[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return ka(Hp,n,o,e)}var Wp=$("ZodNumber",(t,e)=>{ap.init(t,e),Ae.init(t,e),t.gt=(n,o)=>t.check(yo(n,o)),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.lt=(n,o)=>t.check(_o(n,o)),t.lte=(n,o)=>t.check(zr(n,o)),t.max=(n,o)=>t.check(zr(n,o)),t.int=n=>t.check(uI(n)),t.safe=n=>t.check(uI(n)),t.positive=n=>t.check(yo(0,n)),t.nonnegative=n=>t.check(ir(0,n)),t.negative=n=>t.check(_o(0,n)),t.nonpositive=n=>t.check(zr(0,n)),t.multipleOf=(n,o)=>t.check(Qi(n,o)),t.step=(n,o)=>t.check(Qi(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function We(t){return K_(Wp,t)}var sl=$("ZodNumberFormat",(t,e)=>{r_.init(t,e),Wp.init(t,e)});function uI(t){return W_(sl,t)}function AH(t){return J_(sl,t)}function OH(t){return X_(sl,t)}function PH(t){return Y_(sl,t)}function CH(t){return Q_(sl,t)}var Jp=$("ZodBoolean",(t,e)=>{ku.init(t,e),Ae.init(t,e)});function Nt(t){return ey(Jp,t)}var Xp=$("ZodBigInt",(t,e)=>{cp.init(t,e),Ae.init(t,e),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.gt=(n,o)=>t.check(yo(n,o)),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.lt=(n,o)=>t.check(_o(n,o)),t.lte=(n,o)=>t.check(zr(n,o)),t.max=(n,o)=>t.check(zr(n,o)),t.positive=n=>t.check(yo(BigInt(0),n)),t.negative=n=>t.check(_o(BigInt(0),n)),t.nonpositive=n=>t.check(zr(BigInt(0),n)),t.nonnegative=n=>t.check(ir(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(Qi(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function RH(t){return ry(Xp,t)}var TI=$("ZodBigIntFormat",(t,e)=>{n_.init(t,e),Xp.init(t,e)});function NH(t){return oy(TI,t)}function zH(t){return iy(TI,t)}var iM=$("ZodSymbol",(t,e)=>{o_.init(t,e),Ae.init(t,e)});function MH(t){return sy(iM,t)}var sM=$("ZodUndefined",(t,e)=>{i_.init(t,e),Ae.init(t,e)});function jH(t){return ay(sM,t)}var aM=$("ZodNull",(t,e)=>{s_.init(t,e),Ae.init(t,e)});function Yp(t){return cy(aM,t)}var cM=$("ZodAny",(t,e)=>{a_.init(t,e),Ae.init(t,e)});function DH(){return uy(cM)}var uM=$("ZodUnknown",(t,e)=>{Tu.init(t,e),Ae.init(t,e)});function ft(){return Nu(uM)}var lM=$("ZodNever",(t,e)=>{Eu.init(t,e),Ae.init(t,e)});function EI(t){return zu(lM,t)}var dM=$("ZodVoid",(t,e)=>{c_.init(t,e),Ae.init(t,e)});function LH(t){return ly(dM,t)}var rv=$("ZodDate",(t,e)=>{u_.init(t,e),Ae.init(t,e),t.min=(n,o)=>t.check(ir(n,o)),t.max=(n,o)=>t.check(zr(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function UH(t){return dy(rv,t)}var pM=$("ZodArray",(t,e)=>{l_.init(t,e),Ae.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Qo(r,n)),t.nonempty=r=>t.check(Qo(1,r)),t.max=(r,n)=>t.check(Ia(r,n)),t.length=(r,n)=>t.check(Sa(r,n)),t.unwrap=()=>t.element});function Re(t,e){return T$(pM,t,e)}function FH(t){let e=t._zod.def.shape;return zt(Object.keys(e))}var nv=$("ZodObject",(t,e)=>{k$.init(t,e),Ae.init(t,e),M.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>zt(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ft()}),t.loose=()=>t.clone({...t._zod.def,catchall:ft()}),t.strict=()=>t.clone({...t._zod.def,catchall:EI()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>M.extend(t,r),t.safeExtend=r=>M.safeExtend(t,r),t.merge=r=>M.merge(t,r),t.pick=r=>M.pick(t,r),t.omit=r=>M.omit(t,r),t.partial=(...r)=>M.partial(CI,t,r[0]),t.required=(...r)=>M.required(RI,t,r[0])});function U(t,e){let r={type:"object",shape:t??{},...M.normalizeParams(e)};return new nv(r)}function BH(t,e){return new nv({type:"object",shape:t,catchall:EI(),...M.normalizeParams(e)})}function un(t,e){return new nv({type:"object",shape:t,catchall:ft(),...M.normalizeParams(e)})}var AI=$("ZodUnion",(t,e)=>{up.init(t,e),Ae.init(t,e),t.options=e.options});function tt(t,e){return new AI({type:"union",options:t,...M.normalizeParams(e)})}var fM=$("ZodDiscriminatedUnion",(t,e)=>{AI.init(t,e),d_.init(t,e)});function ov(t,e,r){return new fM({type:"union",options:e,discriminator:t,...M.normalizeParams(r)})}var mM=$("ZodIntersection",(t,e)=>{p_.init(t,e),Ae.init(t,e)});function Qp(t,e){return new mM({type:"intersection",left:t,right:e})}var hM=$("ZodTuple",(t,e)=>{lp.init(t,e),Ae.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});function gM(t,e,r){let n=e instanceof ye,o=n?r:e,i=n?e:null;return new hM({type:"tuple",items:t,rest:i,...M.normalizeParams(o)})}var OI=$("ZodRecord",(t,e)=>{f_.init(t,e),Ae.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function bt(t,e,r){return new OI({type:"record",keyType:t,valueType:e,...M.normalizeParams(r)})}function ZH(t,e,r){let n=Qe(t);return n._zod.values=void 0,new OI({type:"record",keyType:n,valueType:e,...M.normalizeParams(r)})}var _M=$("ZodMap",(t,e)=>{m_.init(t,e),Ae.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function qH(t,e,r){return new _M({type:"map",keyType:t,valueType:e,...M.normalizeParams(r)})}var yM=$("ZodSet",(t,e)=>{h_.init(t,e),Ae.init(t,e),t.min=(...r)=>t.check(es(...r)),t.nonempty=r=>t.check(es(1,r)),t.max=(...r)=>t.check($a(...r)),t.size=(...r)=>t.check(Mu(...r))});function VH(t,e){return new yM({type:"set",valueType:t,...M.normalizeParams(e)})}var Gp=$("ZodEnum",(t,e)=>{g_.init(t,e),Ae.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Gp({...e,checks:[],...M.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Gp({...e,checks:[],...M.normalizeParams(o),entries:i})}});function zt(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Gp({type:"enum",entries:r,...M.normalizeParams(e)})}function GH(t,e){return new Gp({type:"enum",entries:t,...M.normalizeParams(e)})}var vM=$("ZodLiteral",(t,e)=>{__.init(t,e),Ae.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function se(t,e){return new vM({type:"literal",values:Array.isArray(t)?t:[t],...M.normalizeParams(e)})}var bM=$("ZodFile",(t,e)=>{y_.init(t,e),Ae.init(t,e),t.min=(r,n)=>t.check(es(r,n)),t.max=(r,n)=>t.check($a(r,n)),t.mime=(r,n)=>t.check(Zu(Array.isArray(r)?r:[r],n))});function KH(t){return vy(bM,t)}var wM=$("ZodTransform",(t,e)=>{v_.init(t,e),Ae.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(M.issue(i,r.value,e));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(M.issue(s))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function PI(t){return new wM({type:"transform",transform:t})}var CI=$("ZodOptional",(t,e)=>{xa.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function ie(t){return new CI({type:"optional",innerType:t})}var xM=$("ZodNullable",(t,e)=>{b_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Qy(t){return new xM({type:"nullable",innerType:t})}function HH(t){return ie(Qy(t))}var $M=$("ZodDefault",(t,e)=>{w_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function IM(t,e){return new $M({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var SM=$("ZodPrefault",(t,e)=>{x_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function kM(t,e){return new SM({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var RI=$("ZodNonOptional",(t,e)=>{$_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function TM(t,e){return new RI({type:"nonoptional",innerType:t,...M.normalizeParams(e)})}var EM=$("ZodSuccess",(t,e)=>{I_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function WH(t){return new EM({type:"success",innerType:t})}var AM=$("ZodCatch",(t,e)=>{S_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function OM(t,e){return new AM({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var PM=$("ZodNaN",(t,e)=>{k_.init(t,e),Ae.init(t,e)});function JH(t){return fy(PM,t)}var NI=$("ZodPipe",(t,e)=>{T_.init(t,e),Ae.init(t,e),t.in=e.in,t.out=e.out});function ev(t,e){return new NI({type:"pipe",in:t,out:e})}var zI=$("ZodCodec",(t,e)=>{NI.init(t,e),Au.init(t,e)});function XH(t,e,r){return new zI({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var CM=$("ZodReadonly",(t,e)=>{E_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function RM(t){return new CM({type:"readonly",innerType:t})}var NM=$("ZodTemplateLiteral",(t,e)=>{A_.init(t,e),Ae.init(t,e)});function YH(t,e){return new NM({type:"template_literal",parts:t,...M.normalizeParams(e)})}var zM=$("ZodLazy",(t,e)=>{C_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.getter()});function MM(t){return new zM({type:"lazy",getter:t})}var jM=$("ZodPromise",(t,e)=>{P_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function QH(t){return new jM({type:"promise",innerType:t})}var DM=$("ZodFunction",(t,e)=>{O_.init(t,e),Ae.init(t,e)});function eW(t){return new DM({type:"function",input:Array.isArray(t?.input)?gM(t?.input):t?.input??Re(ft()),output:t?.output??ft()})}var iv=$("ZodCustom",(t,e)=>{R_.init(t,e),Ae.init(t,e)});function tW(t){let e=new Je({check:"custom"});return e._zod.check=t,e}function MI(t,e){return by(iv,t??(()=>!0),e)}function LM(t,e={}){return wy(iv,t,e)}function UM(t){return xy(t)}var rW=$y,nW=Iy;function oW(t,e={error:`Input not instance of ${t.name}`}){let r=new iv({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...M.normalizeParams(e)});return r._zod.bag.Class=t,r}var iW=(...t)=>Sy({Codec:zI,Boolean:Jp,String:Kp},...t);function sW(t){let e=MM(()=>tt([A(t),We(),Nt(),Yp(),Re(e),bt(A(),e)]));return e}function sv(t,e){return ev(PI(t),e)}var aW={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function cW(t){yt({customError:t})}function uW(){return yt().customError}var jI;jI||(jI={});var DI={};gi(DI,{bigint:()=>fW,boolean:()=>pW,date:()=>mW,number:()=>dW,string:()=>lW});function lW(t){return U_(Kp,t)}function dW(t){return H_(Wp,t)}function pW(t){return ty(Jp,t)}function fW(t){return ny(Xp,t)}function mW(t){return py(rv,t)}yt(N_());var hW=Symbol("Let zodToJsonSchema decide on which parser to use");var bW={};G(bW,{BasePromptValue:()=>cv,ChatPromptValue:()=>UI,ImagePromptValue:()=>wW,StringPromptValue:()=>LI});var cv=class extends uo{},LI=class extends cv{static lc_name(){return"StringPromptValue"}lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;value;constructor(t){super({value:t}),this.value=t}toString(){return this.value}toChatMessages(){return[new mr(this.value)]}},UI=class extends cv{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ChatPromptValue"}messages;constructor(t){Array.isArray(t)&&(t={messages:t}),super(t),this.messages=t.messages}toString(){return au(this.messages)}toChatMessages(){return this.messages}},wW=class extends cv{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ImagePromptValue"}imageUrl;value;constructor(t){"imageUrl"in t||(t={imageUrl:t}),super(t),this.imageUrl=t.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new mr({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}};var te="0123456789abcdef".split(""),xW=[-2147483648,8388608,32768,128],Hn=[24,16,8,0],uv=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Ut=[];function Wn(t,e){e?(Ut[0]=Ut[16]=Ut[1]=Ut[2]=Ut[3]=Ut[4]=Ut[5]=Ut[6]=Ut[7]=Ut[8]=Ut[9]=Ut[10]=Ut[11]=Ut[12]=Ut[13]=Ut[14]=Ut[15]=0,this.blocks=Ut):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}Wn.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if(r!=="string"){if(r==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);e=!0}for(var n,o=0,i,s=t.length,a=this.blocks;o>>2]|=t[o]<>>2]|=n<>>2]|=(192|n>>>6)<>>2]|=(128|n&63)<=57344?(a[i>>>2]|=(224|n>>>12)<>>2]|=(128|n>>>6&63)<>>2]|=(128|n&63)<>>2]|=(240|n>>>18)<>>2]|=(128|n>>>12&63)<>>2]|=(128|n>>>6&63)<>>2]|=(128|n&63)<=64?(this.block=a[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};Wn.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=xW[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}};Wn.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=this.blocks,u,l,d,f,p,m,h,_,v,b,x;for(u=16;u<64;++u)p=c[u-15],l=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=c[u-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,c[u]=c[u-16]+l+c[u-7]+d<<0;for(x=e&r,u=0;u<64;u+=4)this.first?(this.is224?(_=300032,p=c[0]-1413257819,a=p-150054599<<0,n=p+24177077<<0):(_=704751109,p=c[0]-210244248,a=p-1521486534<<0,n=p+143694565<<0),this.first=!1):(l=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),_=t&e,f=_^t&r^x,h=o&i^~o&s,p=a+d+h+uv[u]+c[u],m=l+f,a=n+p<<0,n=p+m<<0),l=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),v=n&t,f=v^n&e^_,h=s&a^~s&o,p=i+d+h+uv[u+1]+c[u+1],m=l+f,s=r+p<<0,r=p+m<<0,l=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=r&n,f=b^r&t^v,h=i&s^~i&a,p=o+d+h+uv[u+2]+c[u+2],m=l+f,i=e+p<<0,e=p+m<<0,l=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),x=e&r,f=x^e&n^b,h=i&s^~i&a,p=o+d+h+uv[u+3]+c[u+3],m=l+f,o=t+p<<0,t=p+m<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0,this.h5=this.h5+i<<0,this.h6=this.h6+s<<0,this.h7=this.h7+a<<0};Wn.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=te[t>>>28&15]+te[t>>>24&15]+te[t>>>20&15]+te[t>>>16&15]+te[t>>>12&15]+te[t>>>8&15]+te[t>>>4&15]+te[t&15]+te[e>>>28&15]+te[e>>>24&15]+te[e>>>20&15]+te[e>>>16&15]+te[e>>>12&15]+te[e>>>8&15]+te[e>>>4&15]+te[e&15]+te[r>>>28&15]+te[r>>>24&15]+te[r>>>20&15]+te[r>>>16&15]+te[r>>>12&15]+te[r>>>8&15]+te[r>>>4&15]+te[r&15]+te[n>>>28&15]+te[n>>>24&15]+te[n>>>20&15]+te[n>>>16&15]+te[n>>>12&15]+te[n>>>8&15]+te[n>>>4&15]+te[n&15]+te[o>>>28&15]+te[o>>>24&15]+te[o>>>20&15]+te[o>>>16&15]+te[o>>>12&15]+te[o>>>8&15]+te[o>>>4&15]+te[o&15]+te[i>>>28&15]+te[i>>>24&15]+te[i>>>20&15]+te[i>>>16&15]+te[i>>>12&15]+te[i>>>8&15]+te[i>>>4&15]+te[i&15]+te[s>>>28&15]+te[s>>>24&15]+te[s>>>20&15]+te[s>>>16&15]+te[s>>>12&15]+te[s>>>8&15]+te[s>>>4&15]+te[s&15];return this.is224||(c+=te[a>>>28&15]+te[a>>>24&15]+te[a>>>20&15]+te[a>>>16&15]+te[a>>>12&15]+te[a>>>8&15]+te[a>>>4&15]+te[a&15]),c};Wn.prototype.toString=Wn.prototype.hex;Wn.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=[t>>>24&255,t>>>16&255,t>>>8&255,t&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255];return this.is224||c.push(a>>>24&255,a>>>16&255,a>>>8&255,a&255),c};Wn.prototype.array=Wn.prototype.digest;Wn.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};var lv=(...t)=>new Wn(!1,!0).update(t.join("")).hex();var $W={};G($W,{sha256:()=>lv});var IW={};G(IW,{BaseCache:()=>ZM,InMemoryCache:()=>FI,defaultHashKeyEncoder:()=>BM,deserializeStoredGeneration:()=>SW,serializeGeneration:()=>kW});var BM=(...t)=>lv(t.join("_"));function SW(t){return t.message!==void 0?{text:t.text,message:Ed(t.message)}:{text:t.text}}function kW(t){let e={text:t.text};return t.message!==void 0&&(e.message=t.message.toDict()),e}var ZM=class{keyEncoder=BM;makeDefaultKeyEncoder(t){this.keyEncoder=t}},TW=new Map,FI=class qM extends ZM{cache;constructor(e){super(),this.cache=e??new Map}lookup(e,r){return Promise.resolve(this.cache.get(this.keyEncoder(e,r))??null)}async update(e,r,n){this.cache.set(this.keyEncoder(e,r),n)}static global(){return new qM(TW)}};var HM=mn(KM(),1),zW=Object.defineProperty,MW=(t,e,r)=>e in t?zW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jW=(t,e,r)=>(MW(t,typeof e!="symbol"?e+"":e,r),r);function DW(t,e){let r=Array.from({length:t.length},(n,o)=>({start:o,end:o+1}));for(;r.length>1;){let n=null;for(let o=0;oe.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function UW(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}var ZI=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(t,e){this.patStr=t.pat_str;let r=t.bpe_ranks.split(` +`).filter(Boolean).reduce((n,o)=>{let[i,s,...a]=o.split(" "),c=Number.parseInt(s,10);return a.forEach((u,l)=>n[u]=c+l),n},{});for(let[n,o]of Object.entries(r)){let i=HM.default.toByteArray(n);this.rankMap.set(i.join(","),o),this.textMap.set(o,i)}this.specialTokens={...t.special_tokens,...e},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((n,[o,i])=>(n[i]=this.textEncoder.encode(o),n),{})}encode(t,e=[],r="all"){let n=new RegExp(this.patStr,"ug"),o=ZI.specialTokenRegex(Object.keys(this.specialTokens)),i=[],s=new Set(e==="all"?Object.keys(this.specialTokens):e),a=new Set(r==="all"?Object.keys(this.specialTokens).filter(u=>!s.has(u)):r);if(a.size>0){let u=ZI.specialTokenRegex([...a]),l=t.match(u);if(l!=null)throw new Error(`The text contains a special token that is not allowed: ${l[0]}`)}let c=0;for(;;){let u=null,l=c;for(;o.lastIndex=l,u=o.exec(t),!(u==null||s.has(u[0]));)l=u.index+1;let d=u?.index??t.length;for(let p of t.substring(c,d).matchAll(n)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){i.push(h);continue}i.push(...LW(m,this.rankMap))}if(u==null)break;let f=this.specialTokens[u[0]];i.push(f),c=u.index+u[0].length}return i}decode(t){let e=[],r=0;for(let i=0;inew RegExp(t.map(e=>UW(e)).join("|"),"g"));function qI(t){switch(t){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw new Error("Unknown model")}}var FW={};G(FW,{encodingForModel:()=>mv,getEncoding:()=>WM});var fv={},BW=new Xo({});async function WM(t){return t in fv||(fv[t]=BW.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new pv(e)).catch(e=>{throw delete fv[t],e})),await fv[t]}async function mv(t){return WM(qI(t))}var ZW={};G(ZW,{BaseLangChain:()=>_v,BaseLanguageModel:()=>tf,calculateMaxTokens:()=>XM,getEmbeddingContextSize:()=>qW,getModelContextSize:()=>JM,getModelNameForTiktoken:()=>hv,isOpenAITool:()=>gv});var hv=t=>t.startsWith("gpt-5")?"gpt-5":t.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":t.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":t.startsWith("gpt-4-32k")?"gpt-4-32k":t.startsWith("gpt-4-")?"gpt-4":t.startsWith("gpt-4o")?"gpt-4o":t,qW=t=>{switch(t){case"text-embedding-ada-002":return 8191;default:return 2046}},JM=t=>{switch(hv(t)){case"gpt-5":case"gpt-5-turbo":case"gpt-5-turbo-preview":return 4e5;case"gpt-4o":case"gpt-4o-mini":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":return 128e3;case"gpt-4-turbo":case"gpt-4-turbo-preview":case"gpt-4-turbo-2024-04-09":case"gpt-4-0125-preview":case"gpt-4-1106-preview":return 128e3;case"gpt-4-32k":case"gpt-4-32k-0314":case"gpt-4-32k-0613":return 32768;case"gpt-4":case"gpt-4-0314":case"gpt-4-0613":return 8192;case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-16k-0613":return 16384;case"gpt-3.5-turbo":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-1106":case"gpt-3.5-turbo-0125":return 4096;case"text-davinci-003":case"text-davinci-002":return 4097;case"text-davinci-001":return 2049;case"text-curie-001":case"text-babbage-001":case"text-ada-001":return 2048;case"code-davinci-002":case"code-davinci-001":return 8e3;case"code-cushman-001":return 2048;case"claude-3-5-sonnet-20241022":case"claude-3-5-sonnet-20240620":case"claude-3-opus-20240229":case"claude-3-sonnet-20240229":case"claude-3-haiku-20240307":case"claude-2.1":return 2e5;case"claude-2.0":case"claude-instant-1.2":return 1e5;case"gemini-1.5-pro":case"gemini-1.5-pro-latest":case"gemini-1.5-flash":case"gemini-1.5-flash-latest":return 1e6;case"gemini-pro":case"gemini-pro-vision":return 32768;default:return 4097}};function gv(t){return typeof t!="object"||!t?!1:!!("type"in t&&t.type==="function"&&"function"in t&&typeof t.function=="object"&&t.function&&"name"in t.function&&"parameters"in t.function)}var XM=async({prompt:t,modelName:e})=>{let r;try{r=(await mv(hv(e))).encode(t).length}catch{console.warn("Failed to calculate number of tokens, falling back to approximate count"),r=Math.ceil(t.length/4)}return JM(e)-r},VW=()=>!1,_v=class extends Ze{verbose;callbacks;tags;metadata;get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(t){super(t),this.verbose=t.verbose??VW(),this.callbacks=t.callbacks,this.tags=t.tags??[],this.metadata=t.metadata??{}}},tf=class extends _v{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}caller;cache;constructor({callbacks:t,callbackManager:e,...r}){let{cache:n,...o}=r;super({callbacks:t??e,...o}),typeof n=="object"?this.cache=n:n?this.cache=FI.global():this.cache=void 0,this.caller=new Xo(r??{})}_encoding;async getNumTokens(t){let e;typeof t=="string"?e=t:e=t.map(n=>typeof n=="string"?n:n.type==="text"&&"text"in n?n.text:"").join("");let r=Math.ceil(e.length/4);if(!this._encoding)try{this._encoding=await mv("modelName"in this?hv(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(e).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(t){return typeof t=="string"?new LI(t):Array.isArray(t)?new UI(t.map(ji)):t}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:t,...e}){let r={...this._identifyingParams(),...e,_type:this._llmType(),_model:this._modelType()};return Object.entries(r).filter(([i,s])=>s!==void 0).map(([i,s])=>`${i}:${JSON.stringify(s)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(t){throw new Error("Use .toJSON() instead")}get profile(){return{}}};var ii=class extends Ze{static lc_name(){return"RunnablePassthrough"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;func;constructor(t){super(t),t&&(this.func=t.func)}async invoke(t,e){let r=Pe(e);return this.func&&await this.func(t,r),this._callWithConfig(n=>Promise.resolve(n),t,r)}async*transform(t,e){let r=Pe(e),n,o=!0;for await(let i of this._transformStreamWithConfig(t,s=>s,r))if(yield i,o)if(n===void 0)n=i;else try{n=en(n,i)}catch{n=void 0,o=!1}this.func&&n!==void 0&&await this.func(n,r)}static assign(t){return new Bp(new us({steps:t}))}};var YM=t=>t();function yv(t){let e=t.constructor;return new e({...t,content:t.contentBlocks,response_metadata:{...t.response_metadata,output_version:"v1"}})}var GW={};G(GW,{BaseChatModel:()=>vv,SimpleChatModel:()=>KW});function VI(t){let e=[];for(let r of t){let n=r;if(Array.isArray(r.content))for(let o=0;o{let r=e.outputVersion??It("LC_OUTPUT_VERSION");return r&&["v0","v1"].includes(r)?r:"v0"})}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async invoke(e,r){let n=Ga._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].message}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}async*_streamIterator(e,r){if(this._streamResponseChunks===Ga.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(e,r);else{let o=Ga._convertInputToPromptValue(e).toChatMessages(),[i,s]=this._separateRunnableConfigFromCallOptionsCompat(r),a={...i.metadata,...this.getLsParams(s)},c=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,a,this.metadata,{verbose:this.verbose}),u={options:s,invocation_params:this?.invocationParams(s),batch_size:1},l=s.outputVersion??this.outputVersion,d=await c?.handleChatModelStart(this.toJSON(),[VI(o)],i.runId,void 0,u,void 0,void 0,i.runName),f,p;try{for await(let m of this._streamResponseChunks(o,s,d?.[0])){if(m.message.id==null){let h=d?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}m.message.response_metadata={...m.generationInfo,...m.message.response_metadata},l==="v1"?yield yv(m.message):yield m.message,f?f=f.concat(m):f=m,Td(m.message)&&m.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:m.message.usage_metadata.input_tokens,completionTokens:m.message.usage_metadata.output_tokens,totalTokens:m.message.usage_metadata.total_tokens}})}}catch(m){throw await Promise.all((d??[]).map(h=>h?.handleLLMError(m))),m}await Promise.all((d??[]).map(m=>m?.handleLLMEnd({generations:[[f]],llmOutput:p})))}}getLsParams(e){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:r}}async _generateUncached(e,r,n,o){let i=e.map(f=>f.map(ji)),s;if(o!==void 0&&o.length===i.length)s=o;else{let f={...n.metadata,...this.getLsParams(r)},p=await St.configure(n.callbacks,this.callbacks,n.tags,this.tags,f,this.metadata,{verbose:this.verbose}),m={options:r,invocation_params:this?.invocationParams(r),batch_size:1};s=await p?.handleChatModelStart(this.toJSON(),i.map(VI),n.runId,void 0,m,void 0,void 0,n.runName)}let a=r.outputVersion??this.outputVersion,c=[],u=[];if(!!s?.[0].handlers.find(Od)&&!this.disableStreaming&&i.length===1&&this._streamResponseChunks!==Ga.prototype._streamResponseChunks)try{let f=await this._streamResponseChunks(i[0],r,s?.[0]),p,m;for await(let h of f){if(h.message.id==null){let _=s?.at(0)?.runId;_!=null&&h.message._updateId(`run-${_}`)}p===void 0?p=h:p=en(p,h),Td(h.message)&&h.message.usage_metadata!==void 0&&(m={tokenUsage:{promptTokens:h.message.usage_metadata.input_tokens,completionTokens:h.message.usage_metadata.output_tokens,totalTokens:h.message.usage_metadata.total_tokens}})}if(p===void 0)throw new Error("Received empty response from chat model call.");c.push([p]),await s?.[0].handleLLMEnd({generations:c,llmOutput:m})}catch(f){throw await s?.[0].handleLLMError(f),f}else{let f=await Promise.allSettled(i.map(async(p,m)=>{let h=await this._generate(p,{...r,promptIndex:m},s?.[m]);if(a==="v1")for(let _ of h.generations)_.message=yv(_.message);return h}));await Promise.all(f.map(async(p,m)=>{if(p.status==="fulfilled"){let h=p.value;for(let _ of h.generations){if(_.message.id==null){let v=s?.at(0)?.runId;v!=null&&_.message._updateId(`run-${v}`)}_.message.response_metadata={..._.generationInfo,..._.message.response_metadata}}return h.generations.length===1&&(h.generations[0].message.response_metadata={...h.llmOutput,...h.generations[0].message.response_metadata}),c[m]=h.generations,u[m]=h.llmOutput,s?.[m]?.handleLLMEnd({generations:[h.generations],llmOutput:h.llmOutput})}else return await s?.[m]?.handleLLMError(p.reason),Promise.reject(p.reason)}))}let d={generations:c,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(d,ya,{value:s?{runIds:s?.map(f=>f.runId)}:void 0,configurable:!0}),d}async _generateCached({messages:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i}){let s=e.map(v=>v.map(ji)),a={...i.metadata,...this.getLsParams(o)},c=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,a,this.metadata,{verbose:this.verbose}),u={options:o,invocation_params:this?.invocationParams(o),batch_size:1},l=await c?.handleChatModelStart(this.toJSON(),s.map(VI),i.runId,void 0,u,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(s.map(async(v,b)=>{let x=Ga._convertInputToPromptValue(v).toString(),k=await r.lookup(x,n);return k==null&&d.push(b),k}))).map((v,b)=>({result:v,runManager:l?.[b]})).filter(({result:v})=>v.status==="fulfilled"&&v.value!=null||v.status==="rejected"),m=o.outputVersion??this.outputVersion,h=[];await Promise.all(p.map(async({result:v,runManager:b},x)=>{if(v.status==="fulfilled"){let k=v.value;return h[x]=k.map(T=>("message"in T&&Yr(T.message)&&aa(T.message)&&(T.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},m==="v1"&&(T.message=yv(T.message))),T.generationInfo={...T.generationInfo,tokenUsage:{}},T)),k.length&&await b?.handleLLMNewToken(k[0].text),b?.handleLLMEnd({generations:[k]},void 0,void 0,void 0,{cached:!0})}else return await b?.handleLLMError(v.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(v.reason)}));let _={generations:h,missingPromptIndices:d,startedRunManagers:l};return Object.defineProperty(_,ya,{value:l?{runIds:l?.map(v=>v.runId)}:void 0,configurable:!0}),_}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(m=>m.map(ji)),[s,a]=this._separateRunnableConfigFromCallOptionsCompat(o);if(s.callbacks=s.callbacks??n,!this.cache)return this._generateUncached(i,a,s);let{cache:c}=this,u=this._getSerializedCacheKeyParametersForCall(a),{generations:l,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:i,cache:c,llmStringKey:u,parsedOptions:a,handledOptions:s}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>i[h]),a,s,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,_)=>{let v=d[_];l[v]=h;let b=Ga._convertInputToPromptValue(i[v]).toString();return c.update(b,u,h)})),p=m.llmOutput??{}}return{generations:l,llmOutput:p}}invocationParams(e){return{}}_modelType(){return"base_chat_model"}async generatePrompt(e,r,n){let o=e.map(i=>i.toChatMessages());return this.generate(o,r,n)}withStructuredOutput(e,r){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(r?.strict)throw new Error('"strict" mode is not supported for this model by default.');let n=e,o=r?.name,i=rs(n)??"A function available to call.",s=r?.method,a=r?.includeRaw;if(s==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let c=o??"extract",u;on(n)?u=[{type:"function",function:{name:c,description:i,parameters:an(n)}}]:("name"in n&&(c=n.name),u=[{type:"function",function:{name:c,description:i,parameters:n}}]);let l=this.bindTools(u),d=Dr.from(h=>{if(!Dt.isInstance(h))throw new Error("Input is not an AIMessageChunk.");if(!h.tool_calls||h.tool_calls.length===0)throw new Error("No tool calls found in the response.");let _=h.tool_calls.find(v=>v.name===c);if(!_)throw new Error(`No tool call found with name ${c}.`);return _.args});if(!a)return l.pipe(d).withConfig({runName:"StructuredOutput"});let f=ii.assign({parsed:(h,_)=>d.invoke(h.raw,_)}),p=ii.assign({parsed:()=>null}),m=f.withFallbacks({fallbacks:[p]});return cs.from([{raw:l},m]).withConfig({runName:"StructuredOutputRunnable"})}},KW=class extends vv{async _generate(t,e,r){let n=await this._call(t,e,r),o=new jt(n);if(typeof o.content!="string")throw new Error("Cannot generate with a simple chat model when output is not a string.");return{generations:[{text:o.content,message:o}]}}};var QM=class extends Ze{static lc_name(){return"RouterRunnable"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnables;constructor(t){super(t),this.runnables=t.runnables}async invoke(t,e){let{key:r,input:n}=t,o=this.runnables[r];if(o===void 0)throw new Error(`No runnable associated with key "${r}".`);return o.invoke(n,Pe(e))}async batch(t,e,r){let n=t.map(d=>d.key),o=t.map(d=>d.input);if(n.find(d=>this.runnables[d]===void 0)!==void 0)throw new Error("One or more keys do not have a corresponding runnable.");let s=n.map(d=>this.runnables[d]),a=this._getOptionsList(e??{},t.length),c=a[0]?.maxConcurrency??r?.maxConcurrency,u=c&&c>0?c:t.length,l=[];for(let d=0;ds[h].invoke(m,a[h])),p=await Promise.all(f);l.push(p)}return l.flat()}async stream(t,e){let{key:r,input:n}=t,o=this.runnables[r];if(o===void 0)throw new Error(`No runnable associated with key "${r}".`);return o.stream(n,e)}};var ej=class extends Ze{static lc_name(){return"RunnableBranch"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;default;branches;constructor(t){super(t),this.branches=t.branches,this.default=t.default}static from(t){if(t.length<1)throw new Error("RunnableBranch requires at least one branch");let r=t.slice(0,-1).map(([o,i])=>[cn(o),cn(i)]),n=cn(t[t.length-1]);return new this({branches:r,default:n})}async _invoke(t,e,r){let n;for(let o=0;othis._enterHistory(i,s??{})).withConfig({runName:"loadHistory"}),r=t.historyMessagesKey??t.inputMessagesKey;r&&(e=ii.assign({[r]:e}).withConfig({runName:"insertHistory"}));let n=e.pipe(t.runnable.withListeners({onEnd:(i,s)=>this._exitHistory(i,s??{})})).withConfig({runName:"RunnableWithMessageHistory"}),o=t.config??{};super({...t,config:o,bound:n}),this.runnable=t.runnable,this.getMessageHistory=t.getMessageHistory,this.inputMessagesKey=t.inputMessagesKey,this.outputMessagesKey=t.outputMessagesKey,this.historyMessagesKey=t.historyMessagesKey}_getInputMessages(t){let e;if(typeof t=="object"&&!Array.isArray(t)&&!Yr(t)){let r;this.inputMessagesKey?r=this.inputMessagesKey:Object.keys(t).length===1?r=Object.keys(t)[0]:r="input",Array.isArray(t[r])&&Array.isArray(t[r][0])?e=t[r][0]:e=t[r]}else e=t;if(typeof e=="string")return[new mr(e)];if(Array.isArray(e))return e;if(Yr(e))return[e];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. +Got ${JSON.stringify(e,null,2)}`)}_getOutputMessages(t){let e;if(!Array.isArray(t)&&!Yr(t)&&typeof t!="string"){let r;this.outputMessagesKey!==void 0?r=this.outputMessagesKey:Object.keys(t).length===1?r=Object.keys(t)[0]:r="output",t.generations!==void 0?e=t.generations[0][0].message:e=t[r]}else e=t;if(typeof e=="string")return[new jt(e)];if(Array.isArray(e))return e;if(Yr(e))return[e];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. Received: ${JSON.stringify(e,null,2)}`)}async _enterHistory(t,e){let n=await(e?.configurable?.messageHistory).getMessages();return this.historyMessagesKey===void 0?n.concat(this._getInputMessages(t)):n}async _exitHistory(t,e){let r=e.configurable?.messageHistory,n;Array.isArray(t.inputs)&&Array.isArray(t.inputs[0])?n=t.inputs[0]:n=t.inputs;let o=this._getInputMessages(n);if(this.historyMessagesKey===void 0){let a=await r.getMessages();o=o.slice(a.length)}let i=t.outputs;if(!i)throw new Error(`Output values from 'Run' undefined. Run: ${JSON.stringify(t,null,2)}`);let s=this._getOutputMessages(i);await r.addMessages([...o,...s])}async _mergeConfig(...t){let e=await super._mergeConfig(...t);if(!e.configurable||!e.configurable.sessionId){let n={[this.inputMessagesKey??"input"]:"foo"},o={configurable:{sessionId:"123"}};throw new Error(`sessionId is required. Pass it in as part of the config argument to .invoke() or .stream() +eg. chain.invoke(${JSON.stringify(n)}, ${JSON.stringify(o)})`)}let{sessionId:r}=e.configurable;return e.configurable.messageHistory=await this.getMessageHistory(r),e}};var HW={};G(HW,{RouterRunnable:()=>QM,Runnable:()=>Ze,RunnableAssign:()=>Bp,RunnableBinding:()=>as,RunnableBranch:()=>ej,RunnableEach:()=>j1,RunnableLambda:()=>Dr,RunnableMap:()=>us,RunnableParallel:()=>B1,RunnablePassthrough:()=>ii,RunnablePick:()=>q$,RunnableRetry:()=>Gy,RunnableSequence:()=>cs,RunnableToolLike:()=>Vy,RunnableWithFallbacks:()=>Z$,RunnableWithMessageHistory:()=>tj,_coerceToRunnable:()=>cn,ensureConfig:()=>Pe,getCallbackManagerForConfig:()=>or,mergeConfigs:()=>ga,patchConfig:()=>Ve,pickRunnableConfigKeys:()=>vr,raceWithSignal:()=>vn});var GI=class extends Ze{parseResultWithPrompt(t,e,r){return this.parseResult(t,r)}_baseMessageToString(t){return typeof t.content=="string"?t.content:this._baseMessageContentToString(t.content)}_baseMessageContentToString(t){return JSON.stringify(t)}async invoke(t,e){return typeof t=="string"?this._callWithConfig(async(r,n)=>this.parseResult([{text:r}],n?.callbacks),t,{...e,runType:"parser"}):this._callWithConfig(async(r,n)=>this.parseResult([{message:r,text:this._baseMessageToString(r)}],n?.callbacks),t,{...e,runType:"parser"})}},Ka=class extends GI{parseResult(t,e){return this.parse(t[0].text,e)}async parseWithPrompt(t,e,r){return this.parse(t,r)}_type(){throw new Error("_type not implemented")}},ln=class extends Error{llmOutput;observation;sendToLLM;constructor(t,e,r,n=!1){if(super(t),this.llmOutput=e,this.observation=r,this.sendToLLM=n,n&&(r===void 0||e===void 0))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");uh(this,"OUTPUT_PARSING_FAILURE")}};var si=class extends Ka{async*_transform(t){for await(let e of t)typeof e=="string"?yield this.parseResult([{text:e}]):yield this.parseResult([{message:e,text:this._baseMessageToString(e)}])}async*transform(t,e){yield*this._transformStreamWithConfig(t,this._transform.bind(this),{...e,runType:"parser"})}},ls=class extends si{diff=!1;constructor(t){super(t),this.diff=t?.diff??this.diff}async*_transform(t){let e,r;for await(let n of t){if(typeof n!="string"&&typeof n.content!="string")throw new Error("Cannot handle non-string output.");let o;if(iu(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");o=new Vi({message:n,text:n.content})}else if(Yr(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");o=new Vi({message:ca(n),text:n.content})}else o=new go({text:n});r===void 0?r=o:r=r.concat(o);let i=await this.parsePartialResult([r]);i!=null&&!$o(i,e)&&(this.diff?yield this._diff(e,i):yield i,e=i)}}getFormatInstructions(){return""}};var WW={};G(WW,{applyPatch:()=>qi,compare:()=>mu});var KI=class extends ls{static lc_name(){return"JsonOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_concatOutputChunks(t,e){return this.diff?super._concatOutputChunks(t,e):e}_diff(t,e){if(e)return t?mu(t,e):[{op:"replace",path:"",value:e}]}async parsePartialResult(t){return kd(t[0].text)}async parse(t){return kd(t,JSON.parse)}getFormatInstructions(){return""}};var rj=class extends si{static lc_name(){return"BytesOutputParser"}lc_namespace=["langchain_core","output_parsers","bytes"];lc_serializable=!0;textEncoder=new TextEncoder;parse(t){return Promise.resolve(this.textEncoder.encode(t))}getFormatInstructions(){return""}};var al=class extends si{re;async*_transform(t){let e="";for await(let r of t)if(typeof r=="string"?e+=r:e+=r.content,this.re){let n=[...e.matchAll(this.re)];if(n.length>1){let o=0;for(let i of n.slice(0,-1))yield[i[1]],o+=(i.index??0)+i[0].length;e=e.slice(o)}}else{let n=await this.parse(e);if(n.length>1){for(let o of n.slice(0,-1))yield[o];e=n[n.length-1]}}for(let r of await this.parse(e))yield[r]}},nj=class extends al{static lc_name(){return"CommaSeparatedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;async parse(t){try{return t.trim().split(",").map(e=>e.trim())}catch{throw new ln(`Could not parse output: ${t}`,t)}}getFormatInstructions(){return"Your response should be a list of comma separated values, eg: `foo, bar, baz`"}},oj=class extends al{lc_namespace=["langchain_core","output_parsers","list"];length;separator;constructor({length:t,separator:e}){super(...arguments),this.length=t,this.separator=e||","}async parse(t){try{let e=t.trim().split(this.separator).map(r=>r.trim());if(this.length!==void 0&&e.length!==this.length)throw new ln(`Incorrect number of items. Expected ${this.length}, got ${e.length}.`);return e}catch(e){throw Object.getPrototypeOf(e)===ln.prototype?e:new ln(`Could not parse output: ${t}`)}}getFormatInstructions(){return`Your response should be a list of ${this.length===void 0?"":`${this.length} `}items separated by "${this.separator}" (eg: \`foo${this.separator} bar${this.separator} baz\`)`}},ij=class extends al{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example: + +1. foo + +2. bar + +3. baz`}re=/\d+\.\s([^\n]+)/g;async parse(t){return[...t.matchAll(this.re)??[]].map(e=>e[1])}},sj=class extends al{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example: + +1. foo + +2. bar + +3. baz`}re=/^\s*[-*]\s([^\n]+)$/gm;async parse(t){return[...t.matchAll(this.re)??[]].map(e=>e[1])}};var aj=class extends si{static lc_name(){return"StrOutputParser"}lc_namespace=["langchain_core","output_parsers","string"];lc_serializable=!0;parse(t){return Promise.resolve(t)}getFormatInstructions(){return""}_textContentToString(t){return t.text}_imageUrlContentToString(t){throw new Error('Cannot coerce a multimodal "image_url" message part into a string.')}_messageContentToString(t){switch(t.type){case"text":case"text_delta":if("text"in t)return this._textContentToString(t);break;case"image_url":if("image_url"in t)return this._imageUrlContentToString(t);break;default:throw new Error(`Cannot coerce "${t.type}" message part into a string.`)}throw new Error(`Invalid content type: ${t.type}`)}_baseMessageContentToString(t){return t.reduce((e,r)=>e+this._messageContentToString(r),"")}};var bv=class extends Ka{static lc_name(){return"StructuredOutputParser"}lc_namespace=["langchain","output_parsers","structured"];toJSON(){return this.toJSONNotImplemented()}constructor(t){super(t),this.schema=t}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=$r.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,$r.string().describe(n)])));return new this(e)}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance. + +"JSON Schema" is a declarative language that allows you to annotate and validate JSON documents. + +For example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}} +would match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings. +Thus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted. + +Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas! + +Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock: +\`\`\`json +${JSON.stringify(an(this.schema))} +\`\`\` +`}async parse(t){try{let e=t.trim(),n=(e.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||e.match(/```json\s*([\s\S]*?)```/)?.[1]||e).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(o,i)=>`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await ts(this.schema,JSON.parse(n))}catch(e){throw new ln(`Failed to parse. Text: "${t}". Error: ${e}`,t)}}},HI=class extends bv{static lc_name(){return"JsonMarkdownStructuredOutputParser"}getFormatInstructions(t){let e=t?.interpolationDepth??1;if(e<1)throw new Error("f string interpolation depth must be at least 1");return`Return a markdown code snippet with a JSON object formatted to look like: +\`\`\`json +${this._schemaToInstruction(an(this.schema)).replaceAll("{","{".repeat(e)).replaceAll("}","}".repeat(e))} +\`\`\``}_schemaToInstruction(t,e=2){let r=t;if("type"in r){let n=!1,o;if(Array.isArray(r.type)){let a=r.type.findIndex(c=>c==="null");a!==-1&&(n=!0,r.type.splice(a,1)),o=r.type.join(" | ")}else o=r.type;if(r.type==="object"&&r.properties){let a=r.description?` // ${r.description}`:"";return`{ +${Object.entries(r.properties).map(([u,l])=>{let d=r.required?.includes(u)?"":" (optional)";return`${" ".repeat(e)}"${u}": ${this._schemaToInstruction(l,e+2)}${d}`}).join(` +`)} +${" ".repeat(e-2)}}${a}`}if(r.type==="array"&&r.items){let a=r.description?` // ${r.description}`:"";return`array[ +${" ".repeat(e)}${this._schemaToInstruction(r.items,e+2)} +${" ".repeat(e-2)}] ${a}`}let i=n?" (nullable)":"",s=r.description?` // ${r.description}`:"";return`${o}${s}${i}`}if("anyOf"in r)return r.anyOf.map(n=>this._schemaToInstruction(n,e)).join(` +${" ".repeat(e-2)}`);throw new Error("unsupported schema type")}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=$r.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,$r.string().describe(n)])));return new this(e)}},cj=class extends Ka{structuredInputParser;constructor({inputSchema:t}){super(...arguments),this.structuredInputParser=new HI(t)}async parse(t){let e;try{e=await this.structuredInputParser.parse(t)}catch(r){throw new ln(`Failed to parse. Text: "${t}". Error: ${r}`,t)}return this.outputProcessor(e)}getFormatInstructions(){return this.structuredInputParser.getFormatInstructions()}};var JW=function(){let t={};t.parser=function(y,g){return new r(y,g)},t.SAXParser=r,t.SAXStream=u,t.createStream=c,t.MAX_BUFFER_LENGTH=65536;let e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(y,g){if(!(this instanceof r))return new r(y,g);var R=this;o(R),R.q=R.c="",R.bufferCheckPosition=t.MAX_BUFFER_LENGTH,R.opt=g||{},R.opt.lowercase=R.opt.lowercase||R.opt.lowercasetags,R.looseCase=R.opt.lowercase?"toLowerCase":"toUpperCase",R.tags=[],R.closed=R.closedRoot=R.sawRoot=!1,R.tag=R.error=null,R.strict=!!y,R.noscript=!!(y||R.opt.noscript),R.state=w.BEGIN,R.strictEntities=R.opt.strictEntities,R.ENTITIES=R.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),R.attribList=[],R.opt.xmlns&&(R.ns=Object.create(m)),R.trackPosition=R.opt.position!==!1,R.trackPosition&&(R.position=R.line=R.column=0),oe(R,"onready")}Object.create||(Object.create=function(y){function g(){}g.prototype=y;var R=new g;return R}),Object.keys||(Object.keys=function(y){var g=[];for(var R in y)y.hasOwnProperty(R)&&g.push(R);return g});function n(y){for(var g=Math.max(t.MAX_BUFFER_LENGTH,10),R=0,I=0,ze=e.length;Ig)switch(e[I]){case"textNode":wt(y);break;case"cdata":Q(y,"oncdata",y.cdata),y.cdata="";break;case"script":Q(y,"onscript",y.script),y.script="";break;default:pn(y,"Max buffer length exceeded: "+e[I])}R=Math.max(R,Ye)}var it=t.MAX_BUFFER_LENGTH-R;y.bufferCheckPosition=it+y.position}function o(y){for(var g=0,R=e.length;g"||x(y)}function F(y,g){return y.test(g)}function J(y,g){return!F(y,g)}var w=0;t.STATE={BEGIN:w++,BEGIN_WHITESPACE:w++,TEXT:w++,TEXT_ENTITY:w++,OPEN_WAKA:w++,SGML_DECL:w++,SGML_DECL_QUOTED:w++,DOCTYPE:w++,DOCTYPE_QUOTED:w++,DOCTYPE_DTD:w++,DOCTYPE_DTD_QUOTED:w++,COMMENT_STARTING:w++,COMMENT:w++,COMMENT_ENDING:w++,COMMENT_ENDED:w++,CDATA:w++,CDATA_ENDING:w++,CDATA_ENDING_2:w++,PROC_INST:w++,PROC_INST_BODY:w++,PROC_INST_ENDING:w++,OPEN_TAG:w++,OPEN_TAG_SLASH:w++,ATTRIB:w++,ATTRIB_NAME:w++,ATTRIB_NAME_SAW_WHITE:w++,ATTRIB_VALUE:w++,ATTRIB_VALUE_QUOTED:w++,ATTRIB_VALUE_CLOSED:w++,ATTRIB_VALUE_UNQUOTED:w++,ATTRIB_VALUE_ENTITY_Q:w++,ATTRIB_VALUE_ENTITY_U:w++,CLOSE_TAG:w++,CLOSE_TAG_SAW_WHITE:w++,SCRIPT:w++,SCRIPT_ENDING:w++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(y){var g=t.ENTITIES[y],R=typeof g=="number"?String.fromCharCode(g):g;t.ENTITIES[y]=R});for(var Z in t.STATE)t.STATE[t.STATE[Z]]=Z;w=t.STATE;function oe(y,g,R){y[g]&&y[g](R)}function Q(y,g,R){y.textNode&&wt(y),oe(y,g,R)}function wt(y){y.textNode=dn(y.opt,y.textNode),y.textNode&&oe(y,"ontext",y.textNode),y.textNode=""}function dn(y,g){return y.trim&&(g=g.trim()),y.normalize&&(g=g.replace(/\s+/g," ")),g}function pn(y,g){return wt(y),y.trackPosition&&(g+=` +Line: `+y.line+` +Column: `+y.column+` +Char: `+y.c),g=new Error(g),y.error=g,oe(y,"onerror",g),y}function No(y){return y.sawRoot&&!y.closedRoot&&qe(y,"Unclosed root tag"),y.state!==w.BEGIN&&y.state!==w.BEGIN_WHITESPACE&&y.state!==w.TEXT&&pn(y,"Unexpected end"),wt(y),y.c="",y.closed=!0,oe(y,"onend"),r.call(y,y.strict,y.opt),y}function qe(y,g){if(typeof y!="object"||!(y instanceof r))throw new Error("bad call to strictFail");y.strict&&pn(y,g)}function Ul(y){y.strict||(y.tagName=y.tagName[y.looseCase]());var g=y.tags[y.tags.length-1]||y,R=y.tag={name:y.tagName,attributes:{}};y.opt.xmlns&&(R.ns=g.ns),y.attribList.length=0,Q(y,"onopentagstart",R)}function Ss(y,g){var R=y.indexOf(":"),I=R<0?["",y]:y.split(":"),ze=I[0],Ye=I[1];return g&&y==="xmlns"&&(ze="xmlns",Ye=""),{prefix:ze,local:Ye}}function ks(y){if(y.strict||(y.attribName=y.attribName[y.looseCase]()),y.attribList.indexOf(y.attribName)!==-1||y.tag.attributes.hasOwnProperty(y.attribName)){y.attribName=y.attribValue="";return}if(y.opt.xmlns){var g=Ss(y.attribName,!0),R=g.prefix,I=g.local;if(R==="xmlns")if(I==="xml"&&y.attribValue!==f)qe(y,"xml: prefix must be bound to "+f+` +Actual: `+y.attribValue);else if(I==="xmlns"&&y.attribValue!==p)qe(y,"xmlns: prefix must be bound to "+p+` +Actual: `+y.attribValue);else{var ze=y.tag,Ye=y.tags[y.tags.length-1]||y;ze.ns===Ye.ns&&(ze.ns=Object.create(Ye.ns)),ze.ns[I]=y.attribValue}y.attribList.push([y.attribName,y.attribValue])}else y.tag.attributes[y.attribName]=y.attribValue,Q(y,"onattribute",{name:y.attribName,value:y.attribValue});y.attribName=y.attribValue=""}function Pn(y,g){if(y.opt.xmlns){var R=y.tag,I=Ss(y.tagName);R.prefix=I.prefix,R.local=I.local,R.uri=R.ns[I.prefix]||"",R.prefix&&!R.uri&&(qe(y,"Unbound namespace prefix: "+JSON.stringify(y.tagName)),R.uri=I.prefix);var ze=y.tags[y.tags.length-1]||y;R.ns&&ze.ns!==R.ns&&Object.keys(R.ns).forEach(function(Ts){Q(y,"onopennamespace",{prefix:Ts,uri:R.ns[Ts]})});for(var Ye=0,it=y.attribList.length;Ye",y.tagName="",y.state=w.SCRIPT;return}Q(y,"onscript",y.script),y.script=""}var g=y.tags.length,R=y.tagName;y.strict||(R=R[y.looseCase]());for(var I=R;g--;){var ze=y.tags[g];if(ze.name!==I)qe(y,"Unexpected close tag");else break}if(g<0){qe(y,"Unmatched closing tag: "+y.tagName),y.textNode+="",y.state=w.TEXT;return}y.tagName=R;for(var Ye=y.tags.length;Ye-- >g;){var it=y.tag=y.tags.pop();y.tagName=y.tag.name,Q(y,"onclosetag",y.tagName);var Tt={};for(var Bt in it.ns)Tt[Bt]=it.ns[Bt];var Rn=y.tags[y.tags.length-1]||y;y.opt.xmlns&&it.ns!==Rn.ns&&Object.keys(it.ns).forEach(function(ht){var fn=it.ns[ht];Q(y,"onclosenamespace",{prefix:ht,uri:fn})})}g===0&&(y.closedRoot=!0),y.tagName=y.attribValue=y.attribName="",y.attribList.length=0,y.state=w.TEXT}function Fl(y){var g=y.entity,R=g.toLowerCase(),I,ze="";return y.ENTITIES[g]?y.ENTITIES[g]:y.ENTITIES[R]?y.ENTITIES[R]:(g=R,g.charAt(0)==="#"&&(g.charAt(1)==="x"?(g=g.slice(2),I=parseInt(g,16),ze=I.toString(16)):(g=g.slice(1),I=parseInt(g,10),ze=I.toString(10))),g=g.replace(/^0+/,""),isNaN(I)||ze.toLowerCase()!==g?(qe(y,"Invalid character entity"),"&"+y.entity+";"):String.fromCodePoint(I))}function Bl(y,g){g==="<"?(y.state=w.OPEN_WAKA,y.startTagPosition=y.position):x(g)||(qe(y,"Non-whitespace before first tag."),y.textNode=g,y.state=w.TEXT)}function Zl(y,g){var R="";return g"?(Q(g,"onsgmldeclaration",g.sgmlDecl),g.sgmlDecl="",g.state=w.TEXT):(k(I)&&(g.state=w.SGML_DECL_QUOTED),g.sgmlDecl+=I);continue;case w.SGML_DECL_QUOTED:I===g.q&&(g.state=w.SGML_DECL,g.q=""),g.sgmlDecl+=I;continue;case w.DOCTYPE:I===">"?(g.state=w.TEXT,Q(g,"ondoctype",g.doctype),g.doctype=!0):(g.doctype+=I,I==="["?g.state=w.DOCTYPE_DTD:k(I)&&(g.state=w.DOCTYPE_QUOTED,g.q=I));continue;case w.DOCTYPE_QUOTED:g.doctype+=I,I===g.q&&(g.q="",g.state=w.DOCTYPE);continue;case w.DOCTYPE_DTD:g.doctype+=I,I==="]"?g.state=w.DOCTYPE:k(I)&&(g.state=w.DOCTYPE_DTD_QUOTED,g.q=I);continue;case w.DOCTYPE_DTD_QUOTED:g.doctype+=I,I===g.q&&(g.state=w.DOCTYPE_DTD,g.q="");continue;case w.COMMENT:I==="-"?g.state=w.COMMENT_ENDING:g.comment+=I;continue;case w.COMMENT_ENDING:I==="-"?(g.state=w.COMMENT_ENDED,g.comment=dn(g.opt,g.comment),g.comment&&Q(g,"oncomment",g.comment),g.comment=""):(g.comment+="-"+I,g.state=w.COMMENT);continue;case w.COMMENT_ENDED:I!==">"?(qe(g,"Malformed comment"),g.comment+="--"+I,g.state=w.COMMENT):g.state=w.TEXT;continue;case w.CDATA:I==="]"?g.state=w.CDATA_ENDING:g.cdata+=I;continue;case w.CDATA_ENDING:I==="]"?g.state=w.CDATA_ENDING_2:(g.cdata+="]"+I,g.state=w.CDATA);continue;case w.CDATA_ENDING_2:I===">"?(g.cdata&&Q(g,"oncdata",g.cdata),Q(g,"onclosecdata"),g.cdata="",g.state=w.TEXT):I==="]"?g.cdata+="]":(g.cdata+="]]"+I,g.state=w.CDATA);continue;case w.PROC_INST:I==="?"?g.state=w.PROC_INST_ENDING:x(I)?g.state=w.PROC_INST_BODY:g.procInstName+=I;continue;case w.PROC_INST_BODY:if(!g.procInstBody&&x(I))continue;I==="?"?g.state=w.PROC_INST_ENDING:g.procInstBody+=I;continue;case w.PROC_INST_ENDING:I===">"?(Q(g,"onprocessinginstruction",{name:g.procInstName,body:g.procInstBody}),g.procInstName=g.procInstBody="",g.state=w.TEXT):(g.procInstBody+="?"+I,g.state=w.PROC_INST_BODY);continue;case w.OPEN_TAG:F(_,I)?g.tagName+=I:(Ul(g),I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:(x(I)||qe(g,"Invalid character in tag name"),g.state=w.ATTRIB));continue;case w.OPEN_TAG_SLASH:I===">"?(Pn(g,!0),zo(g)):(qe(g,"Forward-slash in opening tag not followed by >"),g.state=w.ATTRIB);continue;case w.ATTRIB:if(x(I))continue;I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:F(h,I)?(g.attribName=I,g.attribValue="",g.state=w.ATTRIB_NAME):qe(g,"Invalid attribute name");continue;case w.ATTRIB_NAME:I==="="?g.state=w.ATTRIB_VALUE:I===">"?(qe(g,"Attribute without value"),g.attribValue=g.attribName,ks(g),Pn(g)):x(I)?g.state=w.ATTRIB_NAME_SAW_WHITE:F(_,I)?g.attribName+=I:qe(g,"Invalid attribute name");continue;case w.ATTRIB_NAME_SAW_WHITE:if(I==="=")g.state=w.ATTRIB_VALUE;else{if(x(I))continue;qe(g,"Attribute without value"),g.tag.attributes[g.attribName]="",g.attribValue="",Q(g,"onattribute",{name:g.attribName,value:""}),g.attribName="",I===">"?Pn(g):F(h,I)?(g.attribName=I,g.state=w.ATTRIB_NAME):(qe(g,"Invalid attribute name"),g.state=w.ATTRIB)}continue;case w.ATTRIB_VALUE:if(x(I))continue;k(I)?(g.q=I,g.state=w.ATTRIB_VALUE_QUOTED):(qe(g,"Unquoted attribute value"),g.state=w.ATTRIB_VALUE_UNQUOTED,g.attribValue=I);continue;case w.ATTRIB_VALUE_QUOTED:if(I!==g.q){I==="&"?g.state=w.ATTRIB_VALUE_ENTITY_Q:g.attribValue+=I;continue}ks(g),g.q="",g.state=w.ATTRIB_VALUE_CLOSED;continue;case w.ATTRIB_VALUE_CLOSED:x(I)?g.state=w.ATTRIB:I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:F(h,I)?(qe(g,"No whitespace between attributes"),g.attribName=I,g.attribValue="",g.state=w.ATTRIB_NAME):qe(g,"Invalid attribute name");continue;case w.ATTRIB_VALUE_UNQUOTED:if(!T(I)){I==="&"?g.state=w.ATTRIB_VALUE_ENTITY_U:g.attribValue+=I;continue}ks(g),I===">"?Pn(g):g.state=w.ATTRIB;continue;case w.CLOSE_TAG:if(g.tagName)I===">"?zo(g):F(_,I)?g.tagName+=I:g.script?(g.script+=""?zo(g):qe(g,"Invalid characters in closing tag");continue;case w.TEXT_ENTITY:case w.ATTRIB_VALUE_ENTITY_Q:case w.ATTRIB_VALUE_ENTITY_U:var it,Tt;switch(g.state){case w.TEXT_ENTITY:it=w.TEXT,Tt="textNode";break;case w.ATTRIB_VALUE_ENTITY_Q:it=w.ATTRIB_VALUE_QUOTED,Tt="attribValue";break;case w.ATTRIB_VALUE_ENTITY_U:it=w.ATTRIB_VALUE_UNQUOTED,Tt="attribValue";break}if(I===";")if(g.opt.unparsedEntities){var Bt=Fl(g);g.entity="",g.state=it,g.write(Bt)}else g[Tt]+=Fl(g),g.entity="",g.state=it;else F(g.entity.length?b:v,I)?g.entity+=I:(qe(g,"Invalid character in entity name"),g[Tt]+="&"+g.entity+I,g.entity="",g.state=it);continue;default:throw new Error(g,"Unknown state: "+g.state)}return g.position>=g.bufferCheckPosition&&n(g),g}return String.fromCodePoint||(function(){var y=String.fromCharCode,g=Math.floor,R=function(){var I=16384,ze=[],Ye,it,Tt=-1,Bt=arguments.length;if(!Bt)return"";for(var Rn="";++Tt1114111||g(ht)!==ht)throw RangeError("Invalid code point: "+ht);ht<=65535?ze.push(ht):(ht-=65536,Ye=(ht>>10)+55296,it=ht%1024+56320,ze.push(Ye,it)),(Tt+1===Bt||ze.length>I)&&(Rn+=y.apply(null,ze),ze.length=0)}return Rn};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:R,configurable:!0,writable:!0}):String.fromCodePoint=R})(),t},uj=JW();var wv=`The output should be formatted as a XML file. +1. Output should conform to the tags below. +2. If tags are not given, make them on your own. +3. Remember to always open and close all the tags. + +As an example, for the tags ["foo", "bar", "baz"]: +1. String " + + + +" is a well-formatted instance of the schema. +2. String " + + " is a badly-formatted instance. +3. String " + + +" is a badly-formatted instance. + +Here are the output tags: +\`\`\` +{tags} +\`\`\``,lj=class extends ls{tags;constructor(t){super(t),this.tags=t?.tags}static lc_name(){return"XMLOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_diff(t,e){if(e)return t?mu(t,e):[{op:"replace",path:"",value:e}]}async parsePartialResult(t){return xv(t[0].text)}async parse(t){return xv(t)}getFormatInstructions(){return!!(this.tags&&this.tags.length>0)?wv.replace("{tags}",this.tags?.join(", ")??""):wv}},XW=t=>t.split(` +`).map(e=>e.replace(/^\s+/,"")).join(` +`).trim(),dj=t=>{if(Object.keys(t).length===0)return{};let e={};return t.children.length>0?(e[t.name]=t.children.map(dj),e):(e[t.name]=t.text??void 0,e)};function xv(t){let e=XW(t),r=uj.parser(!0),n={},o=[];r.onopentag=a=>{let c={name:a.name,attributes:a.attributes,children:[],text:"",isSelfClosing:a.isSelfClosing};o.length>0?o[o.length-1].children.push(c):n=c,a.isSelfClosing||o.push(c)},r.onclosetag=()=>{if(o.length>0){let a=o.pop();o.length===0&&a&&(n=a)}},r.ontext=a=>{if(o.length>0){let c=o[o.length-1];c.text+=a}},r.onattribute=a=>{if(o.length>0){let c=o[o.length-1];c.attributes[a.name]=a.value}};let i=/```(xml)?(.*)```/s.exec(e),s=i?i[2]:e;return r.write(s).close(),n&&n.name==="?xml"&&(n=n.children[0]),dj(n)}var YW={};G(YW,{AsymmetricStructuredOutputParser:()=>cj,BaseCumulativeTransformOutputParser:()=>ls,BaseLLMOutputParser:()=>GI,BaseOutputParser:()=>Ka,BaseTransformOutputParser:()=>si,BytesOutputParser:()=>rj,CommaSeparatedListOutputParser:()=>nj,CustomListOutputParser:()=>oj,JsonMarkdownStructuredOutputParser:()=>HI,JsonOutputParser:()=>KI,ListOutputParser:()=>al,MarkdownListOutputParser:()=>sj,NumberedListOutputParser:()=>ij,OutputParserException:()=>ln,StringOutputParser:()=>aj,StructuredOutputParser:()=>bv,XMLOutputParser:()=>lj,XML_FORMAT_INSTRUCTIONS:()=>wv,parseJsonMarkdown:()=>kd,parsePartialJson:()=>sa,parseXMLMarkdown:()=>xv});function rf(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=sa(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new ln([`Function "${t.function.name}" arguments:`,"",t.function.arguments,"","are not valid JSON.",`Error: ${o.message}`].join(` +`))}let n={name:t.function.name,args:r,type:"tool_call"};return e?.returnId&&(n.id=t.id),n}function WI(t){if(t.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:t.id,type:"function",function:{name:t.name,arguments:JSON.stringify(t.args)}}}function $v(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var JI=class extends ls{static lc_name(){return"JsonOutputToolsParser"}returnId=!1;lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;constructor(t){super(t),this.returnId=t?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(t){return await this.parsePartialResult(t,!1)}async parsePartialResult(t,e=!0){let r=t[0].message,n;if(aa(r)&&r.tool_calls?.length?n=r.tool_calls.map(i=>{let{id:s,...a}=i;return this.returnId?{id:s,...a}:a}):r.additional_kwargs.tool_calls!==void 0&&(n=JSON.parse(JSON.stringify(r.additional_kwargs.tool_calls)).map(s=>rf(s,{returnId:this.returnId,partial:e}))),!n)return[];let o=[];for(let i of n)if(i!==void 0){let s={type:i.name,args:i.args,id:i.id};o.push(s)}return o}},XI=class extends JI{static lc_name(){return"JsonOutputKeyToolsParser"}lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(t){super(t),this.keyName=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){if(this.zodSchema===void 0)return t;let e=await Ey(this.zodSchema,t);if(e.success)return e.data;throw new ln(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(e.error?.issues)}`,JSON.stringify(t,null,2))}async parsePartialResult(t){let r=(await super.parsePartialResult(t)).filter(o=>o.type===this.keyName),n=r;if(r.length)return this.returnId||(n=r.map(o=>o.args)),this.returnSingle?n[0]:n}async parseResult(t){let r=(await super.parsePartialResult(t,!1)).filter(i=>i.type===this.keyName),n=r;return r.length?(this.returnId||(n=r.map(i=>i.args)),this.returnSingle?this._validateResult(n[0]):await Promise.all(n.map(i=>this._validateResult(i)))):void 0}};var QW={};G(QW,{JsonOutputKeyToolsParser:()=>XI,JsonOutputToolsParser:()=>JI,convertLangChainToolCallToOpenAI:()=>WI,makeInvalidToolCall:()=>$v,parseToolCall:()=>rf});var p8={};G(p8,{BaseLLM:()=>tS,LLM:()=>f8});var tS=class of extends tf{lc_namespace=["langchain","llms",this._llmType()];async invoke(e,r){let n=of._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].text}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async*_streamIterator(e,r){if(this._streamResponseChunks===of.prototype._streamResponseChunks)yield this.invoke(e,r);else{let n=of._convertInputToPromptValue(e),[o,i]=this._separateRunnableConfigFromCallOptionsCompat(r),s=await St.configure(o.callbacks,this.callbacks,o.tags,this.tags,o.metadata,this.metadata,{verbose:this.verbose}),a={options:i,invocation_params:this?.invocationParams(i),batch_size:1},c=await s?.handleLLMStart(this.toJSON(),[n.toString()],o.runId,void 0,a,void 0,void 0,o.runName),u=new go({text:""});try{for await(let l of this._streamResponseChunks(n.toString(),i,c?.[0]))u?u=u.concat(l):u=l,typeof l.text=="string"&&(yield l.text)}catch(l){throw await Promise.all((c??[]).map(d=>d?.handleLLMError(l))),l}await Promise.all((c??[]).map(l=>l?.handleLLMEnd({generations:[[u]]})))}}async generatePrompt(e,r,n){let o=e.map(i=>i.toString());return this.generate(o,r,n)}invocationParams(e){return{}}_flattenLLMResult(e){let r=[];for(let n=0;nd?.handleLLMError(l))),l}let u=this._flattenLLMResult(a);await Promise.all((i??[]).map((l,d)=>l?.handleLLMEnd(u[d])))}let c=i?.map(u=>u.runId)||void 0;return Object.defineProperty(a,ya,{value:c?{runIds:c}:void 0,configurable:!0}),a}async _generateCached({prompts:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i,runId:s}){let a=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,i.metadata,this.metadata,{verbose:this.verbose}),c={options:o,invocation_params:this?.invocationParams(o),batch_size:e.length},u=await a?.handleLLMStart(this.toJSON(),e,s,void 0,c,void 0,void 0,i?.runName),l=[],f=(await Promise.allSettled(e.map(async(h,_)=>{let v=await r.lookup(h,n);return v==null&&l.push(_),v}))).map((h,_)=>({result:h,runManager:u?.[_]})).filter(({result:h})=>h.status==="fulfilled"&&h.value!=null||h.status==="rejected"),p=[];await Promise.all(f.map(async({result:h,runManager:_},v)=>{if(h.status==="fulfilled"){let b=h.value;return p[v]=b.map(x=>(x.generationInfo={...x.generationInfo,tokenUsage:{}},x)),b.length&&await _?.handleLLMNewToken(b[0].text),_?.handleLLMEnd({generations:[b]},void 0,void 0,void 0,{cached:!0})}else return await _?.handleLLMError(h.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(h.reason)}));let m={generations:p,missingPromptIndices:l,startedRunManagers:u};return Object.defineProperty(m,ya,{value:u?{runIds:u?.map(h=>h.runId)}:void 0,configurable:!0}),m}async generate(e,r,n){if(!Array.isArray(e))throw new Error("Argument 'prompts' is expected to be a string[]");let o;Array.isArray(r)?o={stop:r}:o=r;let[i,s]=this._separateRunnableConfigFromCallOptionsCompat(o);if(i.callbacks=i.callbacks??n,!this.cache)return this._generateUncached(e,s,i);let{cache:a}=this,c=this._getSerializedCacheKeyParametersForCall(s),{generations:u,missingPromptIndices:l,startedRunManagers:d}=await this._generateCached({prompts:e,cache:a,llmStringKey:c,parsedOptions:s,handledOptions:i,runId:i.runId}),f={};if(l.length>0){let p=await this._generateUncached(l.map(m=>e[m]),s,i,d!==void 0?l.map(m=>d?.[m]):void 0);await Promise.all(p.generations.map(async(m,h)=>{let _=l[h];return u[_]=m,a.update(e[_],c,m)})),f=p.llmOutput??{}}return{generations:u,llmOutput:f}}_identifyingParams(){return{}}_modelType(){return"base_llm"}},f8=class extends tS{async _generate(t,e,r){return{generations:await Promise.all(t.map((o,i)=>this._call(o,{...e,promptIndex:i},r).then(s=>[{text:s}])))}}};var m8={};G(m8,{chunkArray:()=>rS});var rS=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),s=r[i]||[];return r[i]=s.concat([n]),r},[]);var g8={};G(g8,{Embeddings:()=>nS});var nS=class{caller;constructor(t){this.caller=new Xo(t??{})}};var y8={};G(y8,{BaseToolkit:()=>v8,DynamicStructuredTool:()=>xj,DynamicTool:()=>sS,StructuredTool:()=>oS,Tool:()=>iS,ToolInputParsingException:()=>su,isLangChainTool:()=>qa,isRunnableToolLike:()=>qp,isStructuredTool:()=>Zp,isStructuredToolParams:()=>Vp,tool:()=>b8});var oS=class extends _v{extras;returnDirect=!1;verboseParsingErrors=!1;get lc_namespace(){return["langchain","tools"]}responseFormat="content";defaultConfig;constructor(t){super(t??{}),this.verboseParsingErrors=t?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=t?.responseFormat??this.responseFormat,this.defaultConfig=t?.defaultConfig??this.defaultConfig,this.metadata=t?.metadata??this.metadata,this.extras=t?.extras??this.extras}async invoke(t,e){let r,n=Pe(ga(this.defaultConfig,e));return Mi(t)?(r=t.args,n={...n,toolCall:t}):r=t,this.call(r,n)}async call(t,e,r){let n=Mi(t)?t.args:t,o;if(on(this.schema))try{o=await ts(this.schema,n)}catch(p){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m} +Details: ${p.message}`),Py(p)&&(m=`${m} + +${av.prettifyError(p)}`),new su(m,JSON.stringify(t))}else{let p=ot(n,this.schema);if(!p.valid){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m} +Details: ${p.errors.map(h=>`${h.keywordLocation}: ${h.error}`).join(` +`)}`),new su(m,JSON.stringify(t))}o=n}let i=ha(e),a=await St.configure(i.callbacks,this.callbacks,i.tags||r,this.tags,i.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof t=="string"?t:JSON.stringify(t),i.runId,void 0,void 0,void 0,i.runName);delete i.runId;let c;try{c=await this._call(o,a,i)}catch(p){throw await a?.handleToolError(p),p}let u,l;if(this.responseFormat==="content_and_artifact")if(Array.isArray(c)&&c.length===2)[u,l]=c;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple. +Result: ${JSON.stringify(c)}`);else u=c;let d;Mi(t)&&(d=t.id),!d&&nO(i)&&(d=i.toolCall.id);let f=w8({content:u,artifact:l,toolCallId:d,name:this.name,metadata:this.metadata});return await a?.handleToolEnd(f),f}},iS=class extends oS{schema=$r.object({input:$r.string().optional()}).transform(t=>t.input);constructor(t){super(t)}call(t,e){let r=typeof t=="string"||t==null?{input:t}:t;return super.call(r,e)}},sS=class extends iS{static lc_name(){return"DynamicTool"}name;description;func;constructor(t){super(t),this.name=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect}async call(t,e){let r=ha(e);return r.runName===void 0&&(r.runName=this.name),super.call(t,r)}async _call(t,e,r){return this.func(t,e,r)}},xj=class extends oS{static lc_name(){return"DynamicStructuredTool"}name;description;func;schema;constructor(t){super(t),this.name=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect,this.schema=t.schema}async call(t,e,r){let n=ha(e);return n.runName===void 0&&(n.runName=this.name),super.call(t,n,r)}_call(t,e,r){return this.func(t,e,r)}},v8=class{getTools(){return this.tools}};function b8(t,e){let r=Wu(e.schema),n=ol(e.schema);if(!e.schema||r||n)return new sS({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(s,a,c)=>new Promise((u,l)=>{let d=Ve(c,{callbacks:a?.getChild()});Lt.runWithConfig(vr(d),async()=>{try{u(t(s,d))}catch(f){l(f)}})})});let o=e.schema,i=e.description??e.schema.description??`${e.name} tool`;return new xj({...e,description:i,schema:o,func:async(s,a,c)=>new Promise((u,l)=>{let d,f=()=>{c?.signal&&d&&c.signal.removeEventListener("abort",d)};c?.signal&&(d=()=>{f(),l(Bi(c.signal))},c.signal.addEventListener("abort",d));let p=Ve(c,{callbacks:a?.getChild()});Lt.runWithConfig(vr(p),async()=>{try{let m=await t(s,p);if(c?.signal?.aborted){f();return}f(),u(m)}catch(m){f(),l(m)}})})})}function w8(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!Id(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new Or({status:"success",content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new Or({status:"success",content:x8(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function x8(t){try{return JSON.stringify(t,null,2)??""}catch{return`${t}`}}import{BedrockRuntimeClient as G1e,ConverseCommand as K1e,ConverseStreamCommand as H1e}from"@aws-sdk/client-bedrock-runtime";import{defaultProvider as Y1e}from"@aws-sdk/credential-provider-node";import{BedrockAgentRuntimeClient as lMe,RetrieveCommand as dMe}from"@aws-sdk/client-bedrock-agent-runtime";var I8={};G(I8,{BaseRetriever:()=>aS});var aS=class extends Ze{callbacks;tags;metadata;verbose;constructor(t){super(t),this.callbacks=t?.callbacks,this.tags=t?.tags??[],this.metadata=t?.metadata??{},this.verbose=t?.verbose??!1}_getRelevantDocuments(t,e){throw new Error("Not implemented!")}async invoke(t,e){let r=Pe(ha(e)),o=await(await St.configure(r.callbacks,this.callbacks,r.tags,this.tags,r.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),t,r.runId,void 0,void 0,void 0,r.runName);try{let i=await this._getRelevantDocuments(t,o);return await o?.handleRetrieverEnd(i),i}catch(i){throw await o?.handleRetrieverError(i),i}}};import{KendraClient as kMe,QueryCommand as TMe,RetrieveCommand as EMe}from"@aws-sdk/client-kendra";var cS=class{pageContent;metadata;id;constructor(t){this.pageContent=t.pageContent!==void 0?t.pageContent.toString():"",this.metadata=t.metadata??{},this.id=t.id}};var uS=class extends Ze{lc_namespace=["langchain_core","documents","transformers"];invoke(t,e){return this.transformDocuments(t)}},$j=class extends uS{async transformDocuments(t){let e=[];for(let r of t){let n=await this._transformDocument(r);e.push(n)}return e}};var S8={};G(S8,{BaseDocumentTransformer:()=>uS,Document:()=>cS,MappingDocumentTransformer:()=>$j});import{BedrockRuntimeClient as MMe,InvokeModelCommand as jMe}from"@aws-sdk/client-bedrock-runtime";var ll=class{uri;bucketOwner;constructor(e){this.uri=e.uri,e.bucketOwner!==void 0&&(this.bucketOwner=e.bucketOwner)}},sf=class{type="imageBlock";format;source;constructor(e){this.format=e.format,this.source=this._convertSource(e.source)}_convertSource(e){if("bytes"in e)return{type:"imageSourceBytes",bytes:e.bytes};if("url"in e)return{type:"imageSourceUrl",url:e.url};if("s3Location"in e)return{type:"imageSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid image source")}},af=class{type="videoBlock";format;source;constructor(e){this.format=e.format,this.source=this._convertSource(e.source)}_convertSource(e){if("bytes"in e)return{type:"videoSourceBytes",bytes:e.bytes};if("s3Location"in e)return{type:"videoSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid video source")}},cf=class{type="documentBlock";name;format;source;citations;context;constructor(e){this.name=e.name,this.format=e.format,this.source=this._convertSource(e.source),e.citations!==void 0&&(this.citations=e.citations),e.context!==void 0&&(this.context=e.context)}_convertSource(e){if("bytes"in e)return{type:"documentSourceBytes",bytes:e.bytes};if("text"in e)return{type:"documentSourceText",text:e.text};if("content"in e)return{type:"documentSourceContentBlock",content:e.content.map(r=>new mt(r.text))};if("s3Location"in e)return{type:"documentSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid document source")}};var Sr=class t{type="message";role;content;constructor(e){this.role=e.role,this.content=e.content}static fromMessageData(e){let r=e.content.map(Iv);return new t({role:e.role,content:r})}},mt=class{type="textBlock";text;constructor(e){this.text=e}},dl=class{type="toolUseBlock";name;toolUseId;input;constructor(e){this.name=e.name,this.toolUseId=e.toolUseId,this.input=e.input}},Ht=class{type="toolResultBlock";toolUseId;status;content;error;constructor(e){this.toolUseId=e.toolUseId,this.status=e.status,this.content=e.content,e.error!==void 0&&(this.error=e.error)}},pl=class{type="reasoningBlock";text;signature;redactedContent;constructor(e){e.text!==void 0&&(this.text=e.text),e.signature!==void 0&&(this.signature=e.signature),e.redactedContent!==void 0&&(this.redactedContent=e.redactedContent)}},uf=class{type="cachePointBlock";cacheType;constructor(e){this.cacheType=e.cacheType}},Ha=class{type="jsonBlock";json;constructor(e){this.json=e.json}};function Ij(t){return typeof t=="string"?t:t.map(e=>{if("type"in e)return e;if("cachePoint"in e)return new uf(e.cachePoint);if("guardContent"in e)return new lf(e.guardContent);if("text"in e)return new mt(e.text);throw new Error("Unknown SystemContentBlockData type")})}var lf=class{type="guardContentBlock";text;image;constructor(e){if(!e.text&&!e.image)throw new Error("GuardContentBlock must have either text or image content");if(e.text&&e.image)throw new Error("GuardContentBlock cannot have both text and image content");e.text&&(this.text=e.text),e.image&&(this.image=e.image)}};function Iv(t){if("text"in t)return new mt(t.text);if("toolUse"in t)return new dl(t.toolUse);if("toolResult"in t)return new Ht({toolUseId:t.toolResult.toolUseId,status:t.toolResult.status,content:t.toolResult.content.map(e=>{if("text"in e)return new mt(e.text);if("json"in e)return new Ha(e);throw new Error("Unknown ToolResultContentData type")})});if("reasoning"in t)return new pl(t.reasoning);if("cachePoint"in t)return new uf(t.cachePoint);if("guardContent"in t)return new lf(t.guardContent);if("image"in t)return new sf(t.image);if("video"in t)return new af(t.video);if("document"in t)return new cf(t.document);throw new Error("Unknown ContentBlockData type")}var ds=class extends Error{constructor(e){super(e),this.name="ContextWindowOverflowError"}},df=class extends Error{partialMessage;constructor(e,r){super(e),this.name="MaxTokensError",this.partialMessage=r}},ps=class extends Error{constructor(e){super(e),this.name="JsonValidationError"}},pf=class extends Error{constructor(e){super(e),this.name="ConcurrentInvocationError"}};function ai(t){return t instanceof Error?t:new Error(String(t))}var ff=class extends Error{constructor(e){super(`Item with id '${e}' not found`),this.name="ItemNotFoundError"}},mf=class extends Error{constructor(e){super(`An item with the ID '${e}' already exists.`),this.name="DuplicateItemError"}},Ft=class extends Error{constructor(e){super(e),this.name="ValidationError"}},hf=class{_items;constructor(e){this._items=new Map,e&&this.addAll(e)}get(e){return this._items.get(e)}find(e){for(let r of this._items.values())if(e(r))return r}keys(){return Array.from(this._items.keys())}values(){return Array.from(this._items.values())}pairs(){return Array.from(this._items.entries())}clear(){this._items.clear()}add(e){this.validate(e);let r=this.generateId(e);if(this._items.has(r))throw new mf(r);return this._items.set(r,e),r}addAll(e){return e.map(r=>this.add(r))}remove(e){let r=this._items.get(e);if(r===void 0)throw new ff(e);return this._items.delete(e),r}removeAll(e){return e.map(r=>this.remove(r))}findRemove(e){for(let[r,n]of this._items.entries())if(e(n))return this._items.delete(r),n}};if(import.meta.vitest){let{describe:t,it:e,expect:r,beforeEach:n,vi:o}=import.meta.vitest;class i extends hf{nextId=1;generateId(){return this.nextId++}validate(a){if(a.length===0)throw new Ft("Item cannot be an empty string.")}}t("Error Classes",()=>{e("ItemNotFoundError should have the correct name and message",()=>{let s=new ff(123);r(s.name).toBe("ItemNotFoundError"),r(s.message).toBe("Item with id '123' not found")}),e("DuplicateItemError should have the correct name and message",()=>{let s=new mf("abc");r(s.name).toBe("DuplicateItemError"),r(s.message).toBe("An item with the ID 'abc' already exists.")}),e("ValidationError should have the correct name and message",()=>{let s=new Ft("Invalid item");r(s.name).toBe("ValidationError"),r(s.message).toBe("Invalid item")})}),t("Registry",()=>{let s;n(()=>{s=new i}),e("should register an item and return a new ID",()=>{let a=s.add("test-item");r(a).toBe(1),r(s.get(1)).toBe("test-item")}),e("should throw DuplicateItemError when registering with an existing ID",()=>{let a=o.spyOn(s,"generateId").mockReturnValue(1);s.add("test-item"),r(()=>s.add("another-item")).toThrow(mf),a.mockRestore()}),e("should deregister an item and return it",()=>{let a=s.add("test-item"),c=s.remove(a);r(c).toBe("test-item"),r(s.get(a)).toBeUndefined()}),e("should throw ItemNotFoundError when deregistering a non-existent item",()=>{r(()=>s.remove(999)).toThrow(ff)}),e("should get an item by its ID",()=>{let a=s.add("test-item"),c=s.get(a);r(c).toBe("test-item")}),e("should return undefined when getting a non-existent item",()=>{let a=s.get(999);r(a).toBeUndefined()}),e("should find an item using a predicate",()=>{s.add("item-a"),s.add("item-b");let a=s.find(c=>c.includes("b"));r(a).toBe("item-b")}),e("should return undefined when no item matches the predicate",()=>{s.add("item-a");let a=s.find(c=>c.includes("c"));r(a).toBeUndefined()}),e("should return all keys",()=>{s.add("item-1"),s.add("item-2"),r(s.keys()).toEqual([1,2])}),e("should return all values",()=>{s.add("item-1"),s.add("item-2"),r(s.values()).toEqual(["item-1","item-2"])}),e("should return all key-value pairs",()=>{s.add("item-1"),s.add("item-2"),r(s.pairs()).toEqual([[1,"item-1"],[2,"item-2"]])}),e("should clear all items from the registry",()=>{s.add("item-1"),s.clear(),r(s.keys()).toEqual([]),r(s.values()).toEqual([])}),e("should register multiple items",()=>{let a=s.addAll(["item-a","item-b"]);r(a).toEqual([1,2]),r(s.values()).toEqual(["item-a","item-b"])}),e("should deregister multiple items",()=>{let a=s.addAll(["item-a","item-b","item-c"]),c=s.removeAll([a[0],a[2]]);r(c).toEqual(["item-a","item-c"]),r(s.values()).toEqual(["item-b"])}),e("should find and deregister an item",()=>{s.add("item-a"),s.add("item-b");let a=s.findRemove(c=>c.includes("a"));r(a).toBe("item-a"),r(s.values()).toEqual(["item-b"])}),e("should return undefined from findRemove if no item matches",()=>{let a=s.findRemove(c=>c.includes("c"));r(a).toBeUndefined()}),e("should call the validate method on register",()=>{let a=o.spyOn(s,"validate");s.add("a-valid-item"),r(a).toHaveBeenCalledWith("a-valid-item"),a.mockRestore()}),e("should throw a validation error for an invalid item",()=>{r(()=>s.add("")).toThrow(Ft)})})}var gf=class{type="toolStreamEvent";data;constructor(e){e.data!==void 0&&(this.data=e.data)}},fl=class{};function lS(t,e){let r=ai(t);return new Ht({toolUseId:e,status:"error",content:[new mt(`Error: ${r.message}`)],error:r})}var _f=class extends hf{generateId(e){return e}validate(e){if(typeof e.name!="string")throw new Ft("Tool name must be a string");if(e.name.length<1||e.name.length>64)throw new Ft("Tool name must be between 1 and 64 characters");if(!/^[a-zA-Z0-9_-]+$/.test(e.name))throw new Ft("Tool name must contain only alphanumeric characters, hyphens, and underscores");if(e.description!==void 0&&e.description!==null&&(typeof e.description!="string"||e.description.length<1))throw new Ft("Tool description must be a non-empty string");if(this.values().some(n=>n.name===e.name))throw new Ft(`Tool with name '${e.name}' already registered`)}getByName(e){return this.values().find(r=>r.name===e)}removeByName(e){this.findRemove(r=>r.name===e)}};if(import.meta.vitest){let{describe:t,it:e,expect:r,beforeEach:n}=import.meta.vitest,o=(i={})=>({name:"valid-tool",description:"A valid tool description.",toolSpec:{name:"valid-tool",description:"A valid tool description.",inputSchema:{type:"object",properties:{}}},stream:async function*(){return yield new gf({data:"mock data"}),new Ht({toolUseId:"",status:"success",content:[]})},...i});t("ToolRegistry",()=>{let i;n(()=>{i=new _f}),e("should register a valid tool successfully",()=>{let s=o();r(()=>i.add(s)).not.toThrow(),r(i.values()).toHaveLength(1),r(i.values()[0]?.name).toBe("valid-tool")}),e("should throw ValidationError for a duplicate tool name",()=>{let s=o({name:"duplicate-name"}),a=o({name:"duplicate-name"});i.add(s),r(()=>i.add(a)).toThrow(Ft),r(()=>i.add(a)).toThrow("Tool with name 'duplicate-name' already registered")}),e("should throw ValidationError for an invalid tool name pattern",()=>{let s=o({name:"invalid name!"});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must contain only alphanumeric characters, hyphens, and underscores")}),e("should throw ValidationError for a tool name that is too long",()=>{let s="a".repeat(65),a=o({name:s});r(()=>i.add(a)).toThrow(Ft),r(()=>i.add(a)).toThrow("Tool name must be between 1 and 64 characters")}),e("should throw ValidationError for a tool name that is too short",()=>{let s=o({name:""});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must be between 1 and 64 characters")}),e("should throw ValidationError for an invalid description",()=>{let s=o({description:123});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool description must be a non-empty string")}),e("should throw ValidationError for an empty string description",()=>{let s=o({description:""});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool description must be a non-empty string")}),e("should allow a tool with a null or undefined description",()=>{let s=o();s.description=void 0;let a=o();a.name="another-valid-tool",a.description=null,r(()=>i.add(s)).not.toThrow(),r(()=>i.add(a)).not.toThrow()}),e("should retrieve a tool by its name",()=>{let s=o({name:"find-me"});i.add(s);let a=i.getByName("find-me");r(a).toBe(s)}),e("should return undefined when getting a tool by a name that does not exist",()=>{let s=i.getByName("non-existent");r(s).toBeUndefined()}),e("should remove a tool by its name",()=>{let s=o({name:"remove-me"});i.add(s),r(i.getByName("remove-me")).toBeDefined(),i.removeByName("remove-me"),r(i.getByName("remove-me")).toBeUndefined()}),e("should not throw when removing a tool by a name that does not exist",()=>{r(()=>i.removeByName("non-existent")).not.toThrow()}),e("should generate a valid ToolIdentifier",()=>{let s=o(),a=i.generateId(s);r(a).toBe(s)}),e("should register a tool with a name at the maximum length",()=>{let s="a".repeat(64),a=o({name:s});r(()=>i.add(a)).not.toThrow()}),e("should throw ValidationError for a non-string tool name",()=>{let s=o({name:123});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must be a string")})})}function Sv(t){try{return JSON.parse(JSON.stringify(t))}catch(e){let r=e instanceof Error?e.message:String(e);throw new Error(`Unable to serialize tool result: ${r}`)}}function dS(t,e="value"){let r=[],n=(o,i)=>{let s=e;if(o!==""&&(/^\d+$/.test(o)?s=r.length>0?`${r[r.length-1]}[${o}]`:`${e}[${o}]`:s=r.length>0?`${r[r.length-1]}.${o}`:`${e}.${o}`),typeof i=="function")throw new ps(`${s} contains a function which cannot be serialized`);if(typeof i=="symbol")throw new ps(`${s} contains a symbol which cannot be serialized`);if(i===void 0)throw new ps(`${s} is undefined which cannot be serialized`);return i!==null&&typeof i=="object"&&r.push(s),i};try{let o=JSON.stringify(t,n);return JSON.parse(o)}catch(o){if(o instanceof ps)throw o;let i=o instanceof Error?o.message:String(o);throw new Error(`Unable to serialize value: ${i}`)}}var kv=class{_state;constructor(e){e!==void 0?this._state=dS(e,"initialState"):this._state={}}get(e){if(e==null)throw new Error("key is required");let r=this._state[e];if(r!==void 0)return Sv(r)}set(e,r){this._state[e]=dS(r,`value for key "${e}"`)}delete(e){delete this._state[e]}clear(){this._state={}}getAll(){return Sv(this._state)}keys(){return Object.keys(this._state)}};function Sj(){return typeof process<"u"&&process.stdout?.write?t=>process.stdout.write(t):t=>console.log(t)}var Tv=class{_appender;_inReasoningBlock=!1;_toolCount=0;_needReasoningIndent=!1;constructor(e){this._appender=e}write(e){this._appender(e)}processEvent(e){switch(e.type){case"modelContentBlockDeltaEvent":this.handleContentBlockDelta(e);break;case"modelContentBlockStartEvent":this.handleContentBlockStart(e);break;case"modelContentBlockStopEvent":this.handleContentBlockStop();break;case"toolResultBlock":this.handleToolResult(e);break;default:break}}handleContentBlockDelta(e){let{delta:r}=e;r.type==="textDelta"?r.text&&r.text.length>0&&this.write(r.text):r.type==="reasoningContentDelta"&&(this._inReasoningBlock||(this._inReasoningBlock=!0,this._needReasoningIndent=!0,this.write(` +\u{1F4AD} Reasoning: +`)),r.text&&r.text.length>0&&this.writeReasoningText(r.text))}writeReasoningText(e){let r="";for(let n=0;n{this.applyManagement(r.agent.messages)}),e.addCallback(ui,r=>{r.error instanceof ds&&(this.reduceContext(r.agent.messages,r.error),r.retryModelCall=!0)})}applyManagement(e){e.length<=this._windowSize||this.reduceContext(e)}reduceContext(e,r){let n=this.findLastMessageWithToolResults(e);if(r&&n!==void 0&&this._shouldTruncateResults&&this.truncateToolResults(e,n))return;let o=e.length<=this._windowSize?2:e.length-this._windowSize;for(;oc.type==="toolResultBlock")){o++;continue}if(i.content.some(c=>c.type==="toolUseBlock")){let c=e[o+1];if(!(c&&c.content.some(l=>l.type==="toolResultBlock"))){o++;continue}}break}if(o>=e.length)throw new ds("Unable to trim conversation context!");e.splice(0,o)}truncateToolResults(e,r){if(r>=e.length||r<0)return!1;let n=e[r];if(!n)return!1;let o="The tool result was too large!",i=!1;for(let a of n.content)if(a.type==="toolResultBlock"){let c=a,u=c.content[0],l=u&&u.type==="textBlock"?u.text:"";if(c.status==="error"&&l===o)return!1;i=!0;break}if(!i)return!1;let s=n.content.map(a=>{if(a.type==="toolResultBlock"){let c=a;return new Ht({toolUseId:c.toolUseId,status:"error",content:[new mt(o)]})}return a});return e[r]=new Sr({role:n.role,content:s}),!0}findLastMessageWithToolResults(e){for(let r=e.length-1;r>=0;r--)if(e[r].content.some(i=>i.type==="toolResultBlock"))return r}};var vl=class{_callbacks;_currentProvider;constructor(){this._callbacks=new Map,this._currentProvider=void 0}addCallback(e,r){let n={callback:r,source:this._currentProvider},o=this._callbacks.get(e)??[];return o.push(n),this._callbacks.set(e,o),()=>{let i=this._callbacks.get(e);if(!i)return;let s=i.indexOf(n);s!==-1&&i.splice(s,1)}}addHook(e){this._currentProvider=e;try{e.registerCallbacks(this)}finally{this._currentProvider=void 0}}addAllHooks(e){for(let r of e)this.addHook(r)}removeHook(e){for(let[r,n]of this._callbacks.entries()){let o=n.filter(i=>i.source!==e);o.length===0?this._callbacks.delete(r):o.length!==n.length&&this._callbacks.set(r,o)}}async invokeCallbacks(e){let r=this.getCallbacksFor(e);for(let n of r)await n(e);return e}getCallbacksFor(e){let n=(this._callbacks.get(e.constructor)??[]).map(o=>o.callback);return e._shouldReverseCallbacks()?[...n].reverse():n}};var E8=function(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e},A8=(function(t){return function(e){function r(s){e.error=e.hasError?new t(s,e.error,"An error was suppressed during disposal."):s,e.hasError=!0}var n,o=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&o===1)return o=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return o|=2,Promise.resolve(s).then(i,function(a){return r(a),i()})}else o|=1}catch(a){r(a)}if(o===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}})(typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n}),bf=class{messages;state;conversationManager;hooks;model;systemPrompt;_toolRegistry;_mcpClients;_initialized;_isInvoking=!1;_printer;constructor(e){this.messages=(e?.messages??[]).map(i=>i instanceof Sr?i:Sr.fromMessageData(i)),this.state=new kv(e?.state),this.conversationManager=e?.conversationManager??new vf({windowSize:40}),this.hooks=new vl,this.hooks.addHook(this.conversationManager),this.hooks.addAllHooks(e?.hooks??[]),typeof e?.model=="string"?this.model=new ms({modelId:e.model}):this.model=e?.model??new ms;let{tools:r,mcpClients:n}=kj(e?.tools??[]);this._toolRegistry=new _f(r),this._mcpClients=n,e?.systemPrompt!==void 0&&(this.systemPrompt=Ij(e.systemPrompt)),(e?.printer??!0)&&(this._printer=new Tv(Sj())),this._initialized=!1}async initialize(){this._initialized||(await Promise.all(this._mcpClients.map(async e=>{let r=await e.listTools();this._toolRegistry.addAll(r)})),this._initialized=!0)}acquireLock(){if(this._isInvoking)throw new pf("Agent is already processing an invocation. Wait for the current invoke() or stream() call to complete before invoking again.");return this._isInvoking=!0,{[Symbol.dispose]:()=>{this._isInvoking=!1}}}get tools(){return this._toolRegistry.values()}get toolRegistry(){return this._toolRegistry}async invoke(e){let r=this.stream(e),n=await r.next();for(;!n.done;)n=await r.next();return n.value}async*stream(e){let r={stack:[],error:void 0,hasError:!1};try{let n=E8(r,this.acquireLock(),!1);await this.initialize();let o=this._stream(e),i=await o.next();for(;!i.done;){let s=i.value;s instanceof ar&&!(s instanceof Wa)&&await this.hooks.invokeCallbacks(s),this._printer?.processEvent(s),yield s,i=await o.next()}return yield i.value,i.value}catch(n){r.error=n,r.hasError=!0}finally{A8(r)}}async*_stream(e){let r=e;yield new ml({agent:this});try{for(;;){let n=yield*this.invokeModel(r);if(r=void 0,n.stopReason!=="toolUse")return yield await this._appendMessage(n.message),new wf({stopReason:n.stopReason,lastMessage:n.message});let o=yield*this.executeTools(n.message,this._toolRegistry);yield await this._appendMessage(n.message),yield await this._appendMessage(o)}}finally{yield new fs({agent:this})}}_normalizeInput(e){if(e!==void 0){if(typeof e=="string")return[new Sr({role:"user",content:[new mt(e)]})];if(Array.isArray(e)&&e.length>0){let r=e[0];if("role"in r&&typeof r.role=="string")return r instanceof Sr?e:e.map(n=>Sr.fromMessageData(n));{let n;return"type"in r&&typeof r.type=="string"?n=e:n=e.map(Iv),[new Sr({role:"user",content:n})]}}}return[]}async*invokeModel(e){let r=this._normalizeInput(e);for(let i of r)yield await this._appendMessage(i);let o={toolSpecs:this._toolRegistry.values().map(i=>i.toolSpec)};this.systemPrompt!==void 0&&(o.systemPrompt=this.systemPrompt),yield new gl({agent:this});try{let{message:i,stopReason:s}=yield*this._streamFromModel(this.messages,o);return yield new ui({agent:this,stopData:{message:i,stopReason:s}}),{message:i,stopReason:s}}catch(i){let s=ai(i),a=new ui({agent:this,error:s});if(yield a,a.retryModelCall)return yield*this.invokeModel(e);throw i}}async*_streamFromModel(e,r){let n=this.model.streamAggregated(e,r),o=await n.next();for(;!o.done;){let i=o.value;yield new yf({agent:this,event:i}),yield i,o=await n.next()}return o.value}async*executeTools(e,r){yield new _l({agent:this,message:e});let n=e.content.filter(s=>s.type==="toolUseBlock");if(n.length===0)throw new Error("Model indicated toolUse but no tool use blocks found in message");let o=[];for(let s of n){let a=yield*this.executeTool(s,r);o.push(a),yield a}let i=new Sr({role:"user",content:o});return yield new yl({agent:this,message:i}),i}async*executeTool(e,r){let n=r.find(s=>s.name===e.name),o={name:e.name,toolUseId:e.toolUseId,input:e.input};if(yield new hl({agent:this,toolUse:o,tool:n}),!n){let s=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(`Tool '${e.name}' not found in registry`)]});return yield new ci({agent:this,toolUse:o,tool:n,result:s}),s}let i={toolUse:{name:e.name,toolUseId:e.toolUseId,input:e.input},agent:this};try{let a=yield*n.stream(i);if(!a){let c=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(`Tool '${e.name}' did not return a result`)]});return yield new ci({agent:this,toolUse:o,tool:n,result:c}),c}return yield new ci({agent:this,toolUse:o,tool:n,result:a}),a}catch(s){let a=ai(s),c=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(a.message)],error:a});return yield new ci({agent:this,toolUse:o,tool:n,result:c,error:a}),c}}async _appendMessage(e){this.messages.push(e);let r=new Wa({agent:this,message:e});return await this.hooks.invokeCallbacks(r),r}};function kj(t){let e=[],r=[];for(let n of t)if(Array.isArray(n)){let{tools:o,mcpClients:i}=kj(n);e.push(...o),r.push(...i)}else n instanceof xf?r.push(n):e.push(n);return{tools:e,mcpClients:r}}var wf=class{type="agentResult";stopReason;lastMessage;constructor(e){this.stopReason=e.stopReason,this.lastMessage=e.lastMessage}toString(){let e=[];for(let r of this.lastMessage.content)switch(r.type){case"textBlock":e.push(r.text);break;case"reasoningBlock":if(r.text){let n=r.text.replace(/\n/g,` + `);e.push(`\u{1F4AD} Reasoning: + ${n}`)}break;default:console.debug(`Skipping content block type: ${r.type}`);break}return e.join(` +`)}};import{BedrockRuntimeClient as C8,ConverseCommand as R8,ConverseStreamCommand as N8}from"@aws-sdk/client-bedrock-runtime";var Ev=class{type="modelMessageStartEvent";role;constructor(e){this.role=e.role}},Av=class{type="modelContentBlockStartEvent";start;constructor(e){e.start!==void 0&&(this.start=e.start)}},Ov=class{type="modelContentBlockDeltaEvent";contentBlockIndex;delta;constructor(e){this.delta=e.delta}},Pv=class{type="modelContentBlockStopEvent";constructor(e){}},Cv=class{type="modelMessageStopEvent";stopReason;additionalModelResponseFields;constructor(e){this.stopReason=e.stopReason,e.additionalModelResponseFields!==void 0&&(this.additionalModelResponseFields=e.additionalModelResponseFields)}},Rv=class{type="modelMetadataEvent";usage;metrics;trace;constructor(e){e.usage!==void 0&&(this.usage=e.usage),e.metrics!==void 0&&(this.metrics=e.metrics),e.trace!==void 0&&(this.trace=e.trace)}};var Nv=class{_convert_to_class_event(e){switch(e.type){case"modelMessageStartEvent":return new Ev(e);case"modelContentBlockStartEvent":return new Av(e);case"modelContentBlockDeltaEvent":return new Ov(e);case"modelContentBlockStopEvent":return new Pv(e);case"modelMessageStopEvent":return new Cv(e);case"modelMetadataEvent":return new Rv(e);default:throw new Error(`Unsupported event type: ${e}`)}}async*streamAggregated(e,r){let n=null,o=[],i="",s="",a="",c="",u={},l,d=null,f=null,p;for await(let h of this.stream(e,r)){let _=this._convert_to_class_event(h);switch(yield _,_.type){case"modelMessageStartEvent":n=_.role,o.length=0;break;case"modelContentBlockStartEvent":_.start?.type==="toolUseStart"&&(a=_.start.name,c=_.start.toolUseId),s="",i="",u={};break;case"modelContentBlockDeltaEvent":switch(_.delta.type){case"textDelta":i+=_.delta.text;break;case"toolUseInputDelta":s+=_.delta.input;break;case"reasoningContentDelta":_.delta.text&&(u.text=(u.text??"")+_.delta.text),_.delta.signature&&(u.signature=_.delta.signature),_.delta.redactedContent&&(u.redactedContent=_.delta.redactedContent);break}break;case"modelContentBlockStopEvent":{let v;try{c?(v=new dl({name:a,toolUseId:c,input:s?JSON.parse(s):{}}),c="",a=""):Object.keys(u).length>0?v=new pl({...u}):v=new mt(i),o.push(v),yield v}catch(b){b instanceof SyntaxError&&(console.error("Unable to parse JSON string."),l=b)}break}case"modelMessageStopEvent":n&&(d=new Sr({role:n,content:[...o]}),f=_.stopReason);break;case"modelMetadataEvent":p=_;break;default:break}}if(!d||!f)throw new Error("Stream ended without completing a message",{cause:l});if(f==="maxTokens"){let h=new df("Model reached maximum token limit. This is an unrecoverable state that requires intervention.",d);l!==void 0?l.cause=h:l=h}if(l!==void 0)throw l;let m={message:d,stopReason:f};return p!==void 0&&(m.metadata=p),m}};function ct(t,e){if(t==null)throw new Error(`Expected ${e} to be defined, but got ${t}`);return t}var P8={debug:()=>{},info:()=>{},warn:(...t)=>console.warn(...t),error:(...t)=>console.error(...t)},hs=P8;var z8="global.anthropic.claude-sonnet-4-5-20250929-v1:0",M8="us-west-2",j8=!1,D8=["anthropic.claude"],L8=["Input is too long for requested model","input length and `max_tokens` exceed context limit","too many total text bytes"],Tj={end_turn:"endTurn",tool_use:"toolUse",max_tokens:"maxTokens",stop_sequence:"stopSequence",content_filtered:"contentFiltered",guardrail_intervened:"guardrailIntervened"};function U8(t){return t.replace(/_([a-z])/g,(e,r)=>r.toUpperCase())}var ms=class extends Nv{_config;_client;constructor(e){super();let{region:r,clientConfig:n,...o}=e??{};this._config={modelId:z8,...o};let i=n?.customUserAgent?`${n.customUserAgent} strands-agents-ts-sdk`:"strands-agents-ts-sdk";this._client=new C8({...n??{},...r?{region:r}:{},customUserAgent:i}),F8(this._client.config)}updateConfig(e){this._config={...this._config,...e}}getConfig(){return this._config}async*stream(e,r){try{let n=this._formatRequest(e,r);if(this._config.stream!==!1){let o=new N8(n),i=await this._client.send(o);if(i.stream)for await(let s of i.stream){let a=this._mapStreamedBedrockEventToSDKEvent(s);for(let c of a)yield c}}else{let o=new R8(n),i=await this._client.send(o);for(let s of this._mapBedrockEventToSDKEvent(i))yield s}}catch(n){let o=ai(n);throw L8.some(i=>o.message.includes(i))?new ds(o.message):o}}_formatRequest(e,r){let n={modelId:this._config.modelId,messages:this._formatMessages(e)};if(r?.systemPrompt!==void 0)if(typeof r.systemPrompt=="string"){let i=[{text:r.systemPrompt}];this._config.cachePrompt&&i.push({cachePoint:{type:this._config.cachePrompt}}),n.system=i}else r.systemPrompt.length>0&&(this._config.cachePrompt&&hs.warn("cachePrompt config is ignored when systemPrompt is an array, use explicit cache points instead"),n.system=r.systemPrompt.map(i=>this._formatContentBlock(i)));if(r?.toolSpecs&&r.toolSpecs.length>0){let i=r.toolSpecs.map(a=>({toolSpec:{name:a.name,description:a.description,inputSchema:{json:a.inputSchema}}}));this._config.cacheTools&&i.push({cachePoint:{type:this._config.cacheTools}});let s={tools:i};r.toolChoice&&(s.toolChoice=r.toolChoice),n.toolConfig=s}let o={};return this._config.maxTokens!==void 0&&(o.maxTokens=this._config.maxTokens),this._config.temperature!==void 0&&(o.temperature=this._config.temperature),this._config.topP!==void 0&&(o.topP=this._config.topP),this._config.stopSequences!==void 0&&(o.stopSequences=this._config.stopSequences),Object.keys(o).length>0&&(n.inferenceConfig=o),this._config.additionalRequestFields&&(n.additionalModelRequestFields=this._config.additionalRequestFields),this._config.additionalResponseFieldPaths&&(n.additionalModelResponseFieldPaths=this._config.additionalResponseFieldPaths),this._config.additionalArgs&&Object.assign(n,this._config.additionalArgs),n}_formatMessages(e){return e.reduce((r,n)=>{let o=n.content.map(i=>this._formatContentBlock(i)).filter(i=>i!==void 0);return o.length>0&&r.push({role:n.role,content:o}),r},[])}_shouldIncludeToolResultStatus(){let e=this._config.includeToolResultStatus??"auto";if(e===!0)return!0;if(e===!1)return!1;let r=D8.some(n=>this._config.modelId?.includes(n));return hs.debug(`model_id=<${this._config.modelId}>, include_tool_result_status=<${r}> | auto-detected includeToolResultStatus`),r}_formatContentBlock(e){switch(e.type){case"textBlock":return{text:e.text};case"toolUseBlock":return{toolUse:{toolUseId:e.toolUseId,name:e.name,input:e.input}};case"toolResultBlock":{let r=e.content.map(n=>{switch(n.type){case"textBlock":return{text:n.text};case"jsonBlock":return{json:n.json}}});return{toolResult:{toolUseId:e.toolUseId,content:r,...this._shouldIncludeToolResultStatus()&&{status:e.status}}}}case"reasoningBlock":{if(e.text)return{reasoningContent:{reasoningText:{text:e.text,signature:e.signature}}};if(e.redactedContent)return{reasoningContent:{redactedContent:e.redactedContent}};throw Error("reasoning content format incorrect. Either 'text' or 'redactedContent' must be set.")}case"cachePointBlock":return{cachePoint:{type:e.cacheType}};case"imageBlock":return{image:{format:e.format,source:this._formatMediaSource(e.source)}};case"videoBlock":return{video:{format:e.format==="3gp"?"three_gp":e.format,source:this._formatMediaSource(e.source)}};case"documentBlock":return{document:{name:e.name,format:e.format,source:this._formatDocumentSource(e.source),...e.citations&&{citations:e.citations},...e.context&&{context:e.context}}};case"guardContentBlock":{if(e.text)return{guardContent:{text:{text:e.text.text,qualifiers:e.text.qualifiers}}};if(e.image)return{guardContent:{image:{format:e.image.format,source:{bytes:e.image.source.bytes}}}};throw new Error("guardContent must have either text or image")}}}_formatMediaSource(e){switch(e.type){case"imageSourceBytes":case"videoSourceBytes":return{bytes:e.bytes};case"imageSourceUrl":if(e.url.startsWith("s3://"))return{s3Location:{uri:e.url}};console.warn("Ignoring imageSourceUrl content block as its not supported by bedrock");return;case"imageSourceS3Location":case"videoSourceS3Location":return{s3Location:{uri:e.s3Location.uri,...e.s3Location.bucketOwner&&{bucketOwner:e.s3Location.bucketOwner}}};default:throw new Error("Invalid media source")}}_formatDocumentSource(e){switch(e.type){case"documentSourceBytes":return{bytes:e.bytes};case"documentSourceText":return{bytes:new TextEncoder().encode(e.text)};case"documentSourceContentBlock":return{content:e.content.map(r=>({text:r.text}))};case"documentSourceS3Location":return{s3Location:{uri:e.s3Location.uri,...e.s3Location.bucketOwner&&{bucketOwner:e.s3Location.bucketOwner}}};default:throw new Error("Invalid document source")}}_mapBedrockEventToSDKEvent(e){let r=[],n=ct(e.output,"event.output"),o=ct(n.message,"output.message"),i=ct(o.role,"message.role");r.push({type:"modelMessageStartEvent",role:i});let s={text:d=>{r.push({type:"modelContentBlockStartEvent"}),r.push({type:"modelContentBlockDeltaEvent",delta:{type:"textDelta",text:d}}),r.push({type:"modelContentBlockStopEvent"})},toolUse:d=>{r.push({type:"modelContentBlockStartEvent",start:{type:"toolUseStart",name:ct(d.name,"toolUse.name"),toolUseId:ct(d.toolUseId,"toolUse.toolUseId")}}),r.push({type:"modelContentBlockDeltaEvent",delta:{type:"toolUseInputDelta",input:JSON.stringify(ct(d.input,"toolUse.input"))}}),r.push({type:"modelContentBlockStopEvent"})},reasoningContent:d=>{if(!d)return;r.push({type:"modelContentBlockStartEvent"});let f={type:"reasoningContentDelta"};d.reasoningText?(f.text=ct(d.reasoningText.text,"reasoningText.text"),d.reasoningText.signature&&(f.signature=d.reasoningText.signature)):d.redactedContent&&(f.redactedContent=d.redactedContent),Object.keys(f).length>1&&r.push({type:"modelContentBlockDeltaEvent",delta:f}),r.push({type:"modelContentBlockStopEvent"})}};ct(o.content,"message.content").forEach(d=>{for(let f in d)if(f in s){let p=f;s[p](d[p])}else hs.warn(`block_key=<${f}> | skipping unsupported block key`)});let c=ct(e.stopReason,"event.stopReason");r.push({type:"modelMessageStopEvent",stopReason:this._transformStopReason(c,e)});let u=ct(e.usage,"output.usage"),l={type:"modelMetadataEvent",usage:{inputTokens:ct(u.inputTokens,"usage.inputTokens"),outputTokens:ct(u.outputTokens,"usage.outputTokens"),totalTokens:ct(u.totalTokens,"usage.totalTokens")}};return e.metrics&&(l.metrics={latencyMs:ct(e.metrics.latencyMs,"metrics.latencyMs")}),r.push(l),r}_mapStreamedBedrockEventToSDKEvent(e){let r=[],n=ct(Object.keys(e)[0],"eventType"),o=e[n];switch(n){case"messageStart":{let i=o;r.push({type:"modelMessageStartEvent",role:ct(i.role,"messageStart.role")});break}case"contentBlockStart":{let i=o,s={type:"modelContentBlockStartEvent"};if(i.start?.toolUse){let a=i.start.toolUse;s.start={type:"toolUseStart",name:ct(a.name,"toolUse.name"),toolUseId:ct(a.toolUseId,"toolUse.toolUseId")}}r.push(s);break}case"contentBlockDelta":{let s=ct(o.delta,"contentBlockDelta.delta"),a={text:c=>{r.push({type:"modelContentBlockDeltaEvent",delta:{type:"textDelta",text:c}})},toolUse:c=>{c?.input&&r.push({type:"modelContentBlockDeltaEvent",delta:{type:"toolUseInputDelta",input:c.input}})},reasoningContent:c=>{if(!c)return;let u={type:"reasoningContentDelta"};c.text&&(u.text=c.text),c.signature&&(u.signature=c.signature),c.redactedContent&&(u.redactedContent=c.redactedContent),Object.keys(u).length>1&&r.push({type:"modelContentBlockDeltaEvent",delta:u})}};for(let c in s)if(c in a){let u=c;a[u](s[u])}else hs.warn(`delta_key=<${c}> | skipping unsupported delta key`);break}case"contentBlockStop":{r.push({type:"modelContentBlockStopEvent"});break}case"messageStop":{let i=o,s=ct(i.stopReason,"messageStop.stopReason"),a={type:"modelMessageStopEvent",stopReason:this._transformStopReason(s,i)};i.additionalModelResponseFields&&(a.additionalModelResponseFields=i.additionalModelResponseFields),r.push(a);break}case"metadata":{let i=o,s={type:"modelMetadataEvent"};if(i.usage){let a=i.usage,c={inputTokens:ct(a.inputTokens,"usage.inputTokens"),outputTokens:ct(a.outputTokens,"usage.outputTokens"),totalTokens:ct(a.totalTokens,"usage.totalTokens")};a.cacheReadInputTokens!==void 0&&(c.cacheReadInputTokens=a.cacheReadInputTokens),a.cacheWriteInputTokens!==void 0&&(c.cacheWriteInputTokens=a.cacheWriteInputTokens),s.usage=c}i.metrics&&(s.metrics={latencyMs:ct(i.metrics.latencyMs,"metrics.latencyMs")}),i.trace&&(s.trace=i.trace),r.push(s);break}case"internalServerException":case"modelStreamErrorException":case"serviceUnavailableException":case"validationException":case"throttlingException":throw o;default:hs.warn(`event_type=<${n}> | unsupported bedrock event type`);break}return r}_transformStopReason(e,r){let n;if(e in Tj)n=Tj[e];else{let o=U8(e);hs.warn(`stop_reason=<${e}>, fallback=<${o}> | unknown stop reason, converting to camelCase`),n=o}return n==="endTurn"&&r&&"output"in r&&r.output?.message?.content?.some(o=>"toolUse"in o)&&(n="toolUse",hs.warn("stop_reason= | adjusting to tool_use due to tool use in content blocks")),n}};function F8(t){let e=t.region.bind(t);t.region=async()=>{try{return await e()}catch(n){if(ai(n).message==="Region is missing")return M8;throw n}};let r=t.useFipsEndpoint.bind(t);t.useFipsEndpoint=async()=>{try{return await r()}catch(n){if(ai(n).message==="Region is missing")return j8;throw n}}}function bl(t){return!!t._zod}function Jn(t,e){return bl(t)?ba(t,e):t.safeParse(e)}function zv(t){var e,r;if(!t)return;let n;if(bl(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function Oj(t){var e;if(bl(t)){let s=(e=t._zod)===null||e===void 0?void 0:e.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let o=t.value;if(o!==void 0)return o}var fS="2025-11-25";var Pj=[fS,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],To="io.modelcontextprotocol/related-task",jv="2.0",ko=MI(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Cj=tt([A(),We().int()]),Rj=A(),G8=un({ttl:tt([We(),Yp()]).optional(),pollInterval:We().optional()}),mS=un({taskId:A()}),K8=un({progressToken:Cj.optional(),[To]:mS.optional()}),Ur=un({task:G8.optional(),_meta:K8.optional()}),Wt=U({method:A(),params:Ur.optional()}),Ja=un({_meta:U({[To]:ie(mS)}).passthrough().optional()}),kn=U({method:A(),params:Ja.optional()}),cr=un({_meta:un({[To]:mS.optional()}).optional()}),Dv=tt([A(),We().int()]),Nj=U({jsonrpc:se(jv),id:Dv,...Wt.shape}).strict(),hS=t=>Nj.safeParse(t).success,zj=U({jsonrpc:se(jv),...kn.shape}).strict(),Mj=t=>zj.safeParse(t).success,jj=U({jsonrpc:se(jv),id:Dv,result:cr}).strict(),$f=t=>jj.safeParse(t).success,be;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(be||(be={}));var Dj=U({jsonrpc:se(jv),id:Dv,error:U({code:We().int(),message:A(),data:ie(ft())})}).strict(),Lj=t=>Dj.safeParse(t).success,BDe=tt([Nj,zj,jj,Dj]),Xa=cr.strict(),H8=Ja.extend({requestId:Dv,reason:A().optional()}),Lv=kn.extend({method:se("notifications/cancelled"),params:H8}),W8=U({src:A(),mimeType:A().optional(),sizes:Re(A()).optional()}),If=U({icons:Re(W8).optional()}),wl=U({name:A(),title:A().optional()}),Uj=wl.extend({...wl.shape,...If.shape,version:A(),websiteUrl:A().optional()}),J8=Qp(U({applyDefaults:Nt().optional()}),bt(A(),ft())),X8=sv(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Qp(U({form:J8.optional(),url:ko.optional()}),bt(A(),ft()).optional())),Y8=U({list:ie(U({}).passthrough()),cancel:ie(U({}).passthrough()),requests:ie(U({sampling:ie(U({createMessage:ie(U({}).passthrough())}).passthrough()),elicitation:ie(U({create:ie(U({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),Q8=U({list:ie(U({}).passthrough()),cancel:ie(U({}).passthrough()),requests:ie(U({tools:ie(U({call:ie(U({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),eJ=U({experimental:bt(A(),ko).optional(),sampling:U({context:ko.optional(),tools:ko.optional()}).optional(),elicitation:X8.optional(),roots:U({listChanged:Nt().optional()}).optional(),tasks:ie(Y8)}),tJ=Ur.extend({protocolVersion:A(),capabilities:eJ,clientInfo:Uj}),rJ=Wt.extend({method:se("initialize"),params:tJ});var nJ=U({experimental:bt(A(),ko).optional(),logging:ko.optional(),completions:ko.optional(),prompts:ie(U({listChanged:ie(Nt())})),resources:U({subscribe:Nt().optional(),listChanged:Nt().optional()}).optional(),tools:U({listChanged:Nt().optional()}).optional(),tasks:ie(Q8)}).passthrough(),gS=cr.extend({protocolVersion:A(),capabilities:nJ,serverInfo:Uj,instructions:A().optional()}),oJ=kn.extend({method:se("notifications/initialized")});var Uv=Wt.extend({method:se("ping")}),iJ=U({progress:We(),total:ie(We()),message:ie(A())}),sJ=U({...Ja.shape,...iJ.shape,progressToken:Cj}),Fv=kn.extend({method:se("notifications/progress"),params:sJ}),aJ=Ur.extend({cursor:Rj.optional()}),Sf=Wt.extend({params:aJ.optional()}),kf=cr.extend({nextCursor:ie(Rj)}),Tf=U({taskId:A(),status:zt(["working","input_required","completed","failed","cancelled"]),ttl:tt([We(),Yp()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:ie(We()),statusMessage:ie(A())}),Ya=cr.extend({task:Tf}),cJ=Ja.merge(Tf),Ef=kn.extend({method:se("notifications/tasks/status"),params:cJ}),Bv=Wt.extend({method:se("tasks/get"),params:Ur.extend({taskId:A()})}),Zv=cr.merge(Tf),qv=Wt.extend({method:se("tasks/result"),params:Ur.extend({taskId:A()})}),Vv=Sf.extend({method:se("tasks/list")}),Gv=kf.extend({tasks:Re(Tf)}),Fj=Wt.extend({method:se("tasks/cancel"),params:Ur.extend({taskId:A()})}),Bj=cr.merge(Tf),Zj=U({uri:A(),mimeType:ie(A()),_meta:bt(A(),ft()).optional()}),qj=Zj.extend({text:A()}),_S=A().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Vj=Zj.extend({blob:_S}),xl=U({audience:Re(zt(["user","assistant"])).optional(),priority:We().min(0).max(1).optional(),lastModified:il.datetime({offset:!0}).optional()}),Gj=U({...wl.shape,...If.shape,uri:A(),description:ie(A()),mimeType:ie(A()),annotations:xl.optional(),_meta:ie(un({}))}),uJ=U({...wl.shape,...If.shape,uriTemplate:A(),description:ie(A()),mimeType:ie(A()),annotations:xl.optional(),_meta:ie(un({}))}),lJ=Sf.extend({method:se("resources/list")}),yS=kf.extend({resources:Re(Gj)}),dJ=Sf.extend({method:se("resources/templates/list")}),vS=kf.extend({resourceTemplates:Re(uJ)}),bS=Ur.extend({uri:A()}),pJ=bS,fJ=Wt.extend({method:se("resources/read"),params:pJ}),wS=cr.extend({contents:Re(tt([qj,Vj]))}),mJ=kn.extend({method:se("notifications/resources/list_changed")}),hJ=bS,gJ=Wt.extend({method:se("resources/subscribe"),params:hJ}),_J=bS,yJ=Wt.extend({method:se("resources/unsubscribe"),params:_J}),vJ=Ja.extend({uri:A()}),bJ=kn.extend({method:se("notifications/resources/updated"),params:vJ}),wJ=U({name:A(),description:ie(A()),required:ie(Nt())}),xJ=U({...wl.shape,...If.shape,description:ie(A()),arguments:ie(Re(wJ)),_meta:ie(un({}))}),$J=Sf.extend({method:se("prompts/list")}),xS=kf.extend({prompts:Re(xJ)}),IJ=Ur.extend({name:A(),arguments:bt(A(),A()).optional()}),SJ=Wt.extend({method:se("prompts/get"),params:IJ}),$S=U({type:se("text"),text:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),IS=U({type:se("image"),data:_S,mimeType:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),SS=U({type:se("audio"),data:_S,mimeType:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),kJ=U({type:se("tool_use"),name:A(),id:A(),input:U({}).passthrough(),_meta:ie(U({}).passthrough())}).passthrough(),TJ=U({type:se("resource"),resource:tt([qj,Vj]),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),EJ=Gj.extend({type:se("resource_link")}),kS=tt([$S,IS,SS,EJ,TJ]),AJ=U({role:zt(["user","assistant"]),content:kS}),TS=cr.extend({description:ie(A()),messages:Re(AJ)}),OJ=kn.extend({method:se("notifications/prompts/list_changed")}),PJ=U({title:A().optional(),readOnlyHint:Nt().optional(),destructiveHint:Nt().optional(),idempotentHint:Nt().optional(),openWorldHint:Nt().optional()}),CJ=U({taskSupport:zt(["required","optional","forbidden"]).optional()}),Kj=U({...wl.shape,...If.shape,description:A().optional(),inputSchema:U({type:se("object"),properties:bt(A(),ko).optional(),required:Re(A()).optional()}).catchall(ft()),outputSchema:U({type:se("object"),properties:bt(A(),ko).optional(),required:Re(A()).optional()}).catchall(ft()).optional(),annotations:ie(PJ),execution:ie(CJ),_meta:bt(A(),ft()).optional()}),RJ=Sf.extend({method:se("tools/list")}),ES=kf.extend({tools:Re(Kj)}),$l=cr.extend({content:Re(kS).default([]),structuredContent:bt(A(),ft()).optional(),isError:ie(Nt())}),ZDe=$l.or(cr.extend({toolResult:ft()})),NJ=Ur.extend({name:A(),arguments:ie(bt(A(),ft()))}),zJ=Wt.extend({method:se("tools/call"),params:NJ}),MJ=kn.extend({method:se("notifications/tools/list_changed")}),Hj=zt(["debug","info","notice","warning","error","critical","alert","emergency"]),jJ=Ur.extend({level:Hj}),DJ=Wt.extend({method:se("logging/setLevel"),params:jJ}),LJ=Ja.extend({level:Hj,logger:A().optional(),data:ft()}),UJ=kn.extend({method:se("notifications/message"),params:LJ}),FJ=U({name:A().optional()}),BJ=U({hints:ie(Re(FJ)),costPriority:ie(We().min(0).max(1)),speedPriority:ie(We().min(0).max(1)),intelligencePriority:ie(We().min(0).max(1))}),ZJ=U({mode:ie(zt(["auto","required","none"]))}),qJ=U({type:se("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:Re(kS).default([]),structuredContent:U({}).passthrough().optional(),isError:ie(Nt()),_meta:ie(U({}).passthrough())}).passthrough(),VJ=ov("type",[$S,IS,SS]),Mv=ov("type",[$S,IS,SS,kJ,qJ]),GJ=U({role:zt(["user","assistant"]),content:tt([Mv,Re(Mv)]),_meta:ie(U({}).passthrough())}).passthrough(),KJ=Ur.extend({messages:Re(GJ),modelPreferences:BJ.optional(),systemPrompt:A().optional(),includeContext:zt(["none","thisServer","allServers"]).optional(),temperature:We().optional(),maxTokens:We().int(),stopSequences:Re(A()).optional(),metadata:ko.optional(),tools:ie(Re(Kj)),toolChoice:ie(ZJ)}),AS=Wt.extend({method:se("sampling/createMessage"),params:KJ}),OS=cr.extend({model:A(),stopReason:ie(zt(["endTurn","stopSequence","maxTokens"]).or(A())),role:zt(["user","assistant"]),content:VJ}),HJ=cr.extend({model:A(),stopReason:ie(zt(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:zt(["user","assistant"]),content:tt([Mv,Re(Mv)])}),WJ=U({type:se("boolean"),title:A().optional(),description:A().optional(),default:Nt().optional()}),JJ=U({type:se("string"),title:A().optional(),description:A().optional(),minLength:We().optional(),maxLength:We().optional(),format:zt(["email","uri","date","date-time"]).optional(),default:A().optional()}),XJ=U({type:zt(["number","integer"]),title:A().optional(),description:A().optional(),minimum:We().optional(),maximum:We().optional(),default:We().optional()}),YJ=U({type:se("string"),title:A().optional(),description:A().optional(),enum:Re(A()),default:A().optional()}),QJ=U({type:se("string"),title:A().optional(),description:A().optional(),oneOf:Re(U({const:A(),title:A()})),default:A().optional()}),e7=U({type:se("string"),title:A().optional(),description:A().optional(),enum:Re(A()),enumNames:Re(A()).optional(),default:A().optional()}),t7=tt([YJ,QJ]),r7=U({type:se("array"),title:A().optional(),description:A().optional(),minItems:We().optional(),maxItems:We().optional(),items:U({type:se("string"),enum:Re(A())}),default:Re(A()).optional()}),n7=U({type:se("array"),title:A().optional(),description:A().optional(),minItems:We().optional(),maxItems:We().optional(),items:U({anyOf:Re(U({const:A(),title:A()}))}),default:Re(A()).optional()}),o7=tt([r7,n7]),i7=tt([e7,t7,o7]),s7=tt([i7,WJ,JJ,XJ]),a7=Ur.extend({mode:se("form").optional(),message:A(),requestedSchema:U({type:se("object"),properties:bt(A(),s7),required:Re(A()).optional()})}),c7=Ur.extend({mode:se("url"),message:A(),elicitationId:A(),url:A().url()}),u7=tt([a7,c7]),PS=Wt.extend({method:se("elicitation/create"),params:u7}),l7=Ja.extend({elicitationId:A()}),d7=kn.extend({method:se("notifications/elicitation/complete"),params:l7}),CS=cr.extend({action:zt(["accept","decline","cancel"]),content:sv(t=>t===null?void 0:t,bt(A(),tt([A(),We(),Nt(),Re(A())])).optional())}),p7=U({type:se("ref/resource"),uri:A()});var f7=U({type:se("ref/prompt"),name:A()}),m7=Ur.extend({ref:tt([f7,p7]),argument:U({name:A(),value:A()}),context:U({arguments:bt(A(),A()).optional()}).optional()}),h7=Wt.extend({method:se("completion/complete"),params:m7});var RS=cr.extend({completion:un({values:Re(A()).max(100),total:ie(We().int()),hasMore:ie(Nt())})}),g7=U({uri:A().startsWith("file://"),name:A().optional(),_meta:bt(A(),ft()).optional()}),_7=Wt.extend({method:se("roots/list")}),y7=cr.extend({roots:Re(g7)}),v7=kn.extend({method:se("notifications/roots/list_changed")}),qDe=tt([Uv,rJ,h7,DJ,SJ,$J,lJ,dJ,fJ,gJ,yJ,zJ,RJ,Bv,qv,Vv]),VDe=tt([Lv,Fv,oJ,v7,Ef]),GDe=tt([Xa,OS,HJ,CS,y7,Zv,Gv,Ya]),KDe=tt([Uv,AS,PS,_7,Bv,qv,Vv]),HDe=tt([Lv,Fv,UJ,bJ,mJ,MJ,OJ,Ef,d7]),WDe=tt([Xa,gS,RS,TS,xS,yS,vS,wS,$l,ES,Zv,Gv,Ya]),de=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===be.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new pS(o.elicitations,r)}return new t(e,r,n)}},pS=class extends de{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(be.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}};function gs(t){return t==="completed"||t==="failed"||t==="cancelled"}var b7=Symbol("Let zodToJsonSchema decide on which parser to use");var ALe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function NS(t){let e=zv(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Oj(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function zS(t,e){let r=Jn(t,e);if(!r.success)throw r.error;return r.data}var k7=6e4,Kv=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Lv,r=>{this._oncancel(r)}),this.setNotificationHandler(Fv,r=>{this._onprogress(r)}),this.setRequestHandler(Uv,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Bv,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new de(be.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(qv,async(r,n)=>{let o=async()=>{var i;let s=r.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(c.type==="response"||c.type==="error"){let u=c.message,l=u.id,d=this._requestResolvers.get(l);if(d)if(this._requestResolvers.delete(l),c.type==="response")d(u);else{let f=u,p=new de(f.error.code,f.error.message,f.error.data);d(p)}else{let f=c.type==="response"?"Response":"Error";this._onerror(new Error(`${f} handler missing for request ${l}`))}continue}await((i=this._transport)===null||i===void 0?void 0:i.send(c.message,{relatedRequestId:n.requestId}))}}let a=await this._taskStore.getTask(s,n.sessionId);if(!a)throw new de(be.InvalidParams,`Task not found: ${s}`);if(!gs(a.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(gs(a.status)){let c=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...c,_meta:{...c._meta,[To]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(Vv,async(r,n)=>{var o;try{let{tasks:i,nextCursor:s}=await this._taskStore.listTasks((o=r.params)===null||o===void 0?void 0:o.cursor,n.sessionId);return{tasks:i,nextCursor:s,_meta:{}}}catch(i){throw new de(be.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Fj,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new de(be.InvalidParams,`Task not found: ${r.params.taskId}`);if(gs(o.status))throw new de(be.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new de(be.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof de?o:new de(be.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){let r=this._requestHandlerAbortControllers.get(e.params.requestId);r?.abort(e.params.reason)}_setupTimeout(e,r,n,o,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),de.fromError(be.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,o;this._transport=e;let i=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};let s=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{s?.(c),this._onerror(c)};let a=(o=this._transport)===null||o===void 0?void 0:o.onmessage;this._transport.onmessage=(c,u)=>{a?.(c,u),$f(c)||Lj(c)?this._onresponse(c):hS(c)?this._onrequest(c,u):Mj(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let n=de.fromError(be.ConnectionClosed,"Connection closed");this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);for(let o of r.values())o(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){var n,o,i,s,a,c;let u=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,l=this._transport,d=(s=(i=(o=e.params)===null||o===void 0?void 0:o._meta)===null||i===void 0?void 0:i[To])===null||s===void 0?void 0:s.taskId;if(u===void 0){let _={jsonrpc:"2.0",id:e.id,error:{code:be.MethodNotFound,message:"Method not found"}};d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:_,timestamp:Date.now()},l?.sessionId).catch(v=>this._onerror(new Error(`Failed to enqueue error response: ${v}`))):l?.send(_).catch(v=>this._onerror(new Error(`Failed to send an error response: ${v}`)));return}let f=new AbortController;this._requestHandlerAbortControllers.set(e.id,f);let p=(a=e.params)===null||a===void 0?void 0:a.task,m=this._taskStore?this.requestTaskStore(e,l?.sessionId):void 0,h={signal:f.signal,sessionId:l?.sessionId,_meta:(c=e.params)===null||c===void 0?void 0:c._meta,sendNotification:async _=>{let v={relatedRequestId:e.id};d&&(v.relatedTask={taskId:d}),await this.notification(_,v)},sendRequest:async(_,v,b)=>{var x,k;let T={...b,relatedRequestId:e.id};d&&!T.relatedTask&&(T.relatedTask={taskId:d});let F=(k=(x=T.relatedTask)===null||x===void 0?void 0:x.taskId)!==null&&k!==void 0?k:d;return F&&m&&await m.updateTaskStatus(F,"input_required"),await this.request(_,v,T)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:d,taskStore:m,taskRequestedTtl:p?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{p&&this.assertTaskHandlerCapability(e.method)}).then(()=>u(e,h)).then(async _=>{if(f.signal.aborted)return;let v={result:_,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:v,timestamp:Date.now()},l?.sessionId):await l?.send(v)},async _=>{var v;if(f.signal.aborted)return;let b={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(_.code)?_.code:be.InternalError,message:(v=_.message)!==null&&v!==void 0?v:"Internal error",..._.data!==void 0&&{data:_.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:b,timestamp:Date.now()},l?.sessionId):await l?.send(b)}).catch(_=>this._onerror(new Error(`Failed to send response: ${_}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),$f(e))n(e);else{let s=new de(e.error.code,e.error.message,e.error.data);n(s)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if($f(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(i=!0,this._taskProgressTokens.set(a.taskId,r))}}if(i||this._progressHandlers.delete(r),$f(e))o(e);else{let s=de.fromError(e.error.code,e.error.message,e.error.data);o(s)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}async*requestStream(e,r,n){var o,i,s,a;let{task:c}=n??{};if(!c){try{yield{type:"result",result:await this.request(e,r,n)}}catch(l){yield{type:"error",error:l instanceof de?l:new de(be.InternalError,String(l))}}return}let u;try{let l=await this.request(e,Ya,n);if(l.task)u=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new de(be.InternalError,"Task creation did not return a task");for(;;){let d=await this.getTask({taskId:u},n);if(yield{type:"taskStatus",task:d},gs(d.status)){d.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)}:d.status==="failed"?yield{type:"error",error:new de(be.InternalError,`Task ${u} failed`)}:d.status==="cancelled"&&(yield{type:"error",error:new de(be.InternalError,`Task ${u} was cancelled`)});return}if(d.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)};return}let f=(s=(o=d.pollInterval)!==null&&o!==void 0?o:(i=this._options)===null||i===void 0?void 0:i.defaultTaskPollInterval)!==null&&s!==void 0?s:1e3;await new Promise(p=>setTimeout(p,f)),(a=n?.signal)===null||a===void 0||a.throwIfAborted()}}catch(l){yield{type:"error",error:l instanceof de?l:new de(be.InternalError,String(l))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{var d,f,p,m,h,_,v;let b=Z=>{l(Z)};if(!this._transport){b(new Error("Not connected"));return}if(((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(Z){b(Z);return}(f=n?.signal)===null||f===void 0||f.throwIfAborted();let x=this._requestMessageId++,k={...e,jsonrpc:"2.0",id:x};n?.onprogress&&(this._progressHandlers.set(x,n.onprogress),k.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:x}}),a&&(k.params={...k.params,task:a}),c&&(k.params={...k.params,_meta:{...((m=k.params)===null||m===void 0?void 0:m._meta)||{},[To]:c}});let T=Z=>{var oe;this._responseHandlers.delete(x),this._progressHandlers.delete(x),this._cleanupTimeout(x),(oe=this._transport)===null||oe===void 0||oe.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:x,reason:String(Z)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(wt=>this._onerror(new Error(`Failed to send cancellation: ${wt}`)));let Q=Z instanceof de?Z:new de(be.RequestTimeout,String(Z));l(Q)};this._responseHandlers.set(x,Z=>{var oe;if(!(!((oe=n?.signal)===null||oe===void 0)&&oe.aborted)){if(Z instanceof Error)return l(Z);try{let Q=Jn(r,Z.result);Q.success?u(Q.data):l(Q.error)}catch(Q){l(Q)}}}),(h=n?.signal)===null||h===void 0||h.addEventListener("abort",()=>{var Z;T((Z=n?.signal)===null||Z===void 0?void 0:Z.reason)});let F=(_=n?.timeout)!==null&&_!==void 0?_:k7,J=()=>T(de.fromError(be.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(x,F,n?.maxTotalTimeout,J,(v=n?.resetTimeoutOnProgress)!==null&&v!==void 0?v:!1);let w=c?.taskId;if(w){let Z=oe=>{let Q=this._responseHandlers.get(x);Q?Q(oe):this._onerror(new Error(`Response handler missing for side-channeled request ${x}`))};this._requestResolvers.set(x,Z),this._enqueueTaskMessage(w,{type:"request",message:k,timestamp:Date.now()}).catch(oe=>{this._cleanupTimeout(x),l(oe)})}else this._transport.send(k,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(Z=>{this._cleanupTimeout(x),l(Z)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Zv,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Gv,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Bj,r)}async notification(e,r){var n,o,i,s,a;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let c=(n=r?.relatedTask)===null||n===void 0?void 0:n.taskId;if(c){let f={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...((o=e.params)===null||o===void 0?void 0:o._meta)||{},[To]:r.relatedTask}}};await this._enqueueTaskMessage(c,{type:"notification",message:f,timestamp:Date.now()});return}if(((s=(i=this._options)===null||i===void 0?void 0:i.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var f,p;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let m={...e,jsonrpc:"2.0"};r?.relatedTask&&(m={...m,params:{...m.params,_meta:{...((f=m.params)===null||f===void 0?void 0:f._meta)||{},[To]:r.relatedTask}}}),(p=this._transport)===null||p===void 0||p.send(m,r).catch(h=>this._onerror(h))});return}let d={...e,jsonrpc:"2.0"};r?.relatedTask&&(d={...d,params:{...d.params,_meta:{...((a=d.params)===null||a===void 0?void 0:a._meta)||{},[To]:r.relatedTask}}}),await this._transport.send(d,r)}setRequestHandler(e,r){let n=NS(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let s=zS(e,o);return Promise.resolve(r(s,i))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=NS(e);this._notificationHandlers.set(n,o=>{let i=zS(e,o);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){var o;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=(o=this._options)===null||o===void 0?void 0:o.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,i)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&hS(o.message)){let i=o.message.id,s=this._requestResolvers.get(i);s?(s(new de(be.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){var n,o,i;let s=(o=(n=this._options)===null||n===void 0?void 0:n.defaultTaskPollInterval)!==null&&o!==void 0?o:1e3;try{let a=await((i=this._taskStore)===null||i===void 0?void 0:i.getTask(e));a?.pollInterval&&(s=a.pollInterval)}catch{}return new Promise((a,c)=>{if(r.aborted){c(new de(be.InvalidRequest,"Request cancelled"));return}let u=setTimeout(a,s);r.addEventListener("abort",()=>{clearTimeout(u),c(new de(be.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new de(be.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await n.storeTaskResult(o,i,s,r);let a=await n.getTask(o,r);if(a){let c=Ef.parse({method:"notifications/tasks/status",params:a});await this.notification(c),gs(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,s)=>{let a=await n.getTask(o,r);if(!a)throw new de(be.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(gs(a.status))throw new de(be.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,s,r);let c=await n.getTask(o,r);if(c){let u=Ef.parse({method:"notifications/tasks/status",params:c});await this.notification(u),gs(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Wj(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Jj(t,e){let r={...t};for(let n in e){let o=n,i=e[o];if(i===void 0)continue;let s=r[o];Wj(s)&&Wj(i)?r[o]={...s,...i}:r[o]=i}return r}var MU=mn(bT(),1),jU=mn(zU(),1);function gre(){let t=new MU.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,jU.default)(t),t}var Ob=class{constructor(e){this._ajv=e??gre()}getValidator(e){var r;let n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return o=>n(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Pb=class{constructor(e){this._client=e}async*callToolStream(e,r=$l,n){var o;let i=this._client,s={...n,task:(o=n?.task)!==null&&o!==void 0?o:i.isToolTask(e.name)?{}:void 0},a=i.requestStream({method:"tools/call",params:e},r,s),c=i.getToolOutputValidator(e.name);for await(let u of a){if(u.type==="result"&&c){let l=u.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new de(be.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{let d=c(l.structuredContent);if(!d.valid){yield{type:"error",error:new de(be.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof de){yield{type:"error",error:d};return}yield{type:"error",error:new de(be.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield u}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function DU(t,e,r){var n;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!(!((n=t.tools)===null||n===void 0)&&n.call))throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function LU(t,e,r){var n,o;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!(!((n=t.sampling)===null||n===void 0)&&n.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!(!((o=t.elicitation)===null||o===void 0)&&o.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function Cb(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let o of Object.keys(n)){let i=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[o]=i.default),r[o]!==void 0&&Cb(i,r[o])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)Cb(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)Cb(r,e)}}function _re(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var Rb=class extends Kv{constructor(e,r){var n,o;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._jsonSchemaValidator=(o=r?.jsonSchemaValidator)!==null&&o!==void 0?o:new Ob}get experimental(){return this._experimental||(this._experimental={tasks:new Pb(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Jj(this._capabilities,e)}setRequestHandler(e,r){var n,o,i;let s=zv(e),a=s?.method;if(!a)throw new Error("Schema is missing a method literal");let c;if(bl(a)){let l=a,d=(n=l._zod)===null||n===void 0?void 0:n.def;c=(o=d?.value)!==null&&o!==void 0?o:l.value}else{let l=a,d=l._def;c=(i=d?.value)!==null&&i!==void 0?i:l.value}if(typeof c!="string")throw new Error("Schema method literal must be a string");let u=c;if(u==="elicitation/create"){let l=async(d,f)=>{var p,m,h;let _=Jn(PS,d);if(!_.success){let Z=_.error instanceof Error?_.error.message:String(_.error);throw new de(be.InvalidParams,`Invalid elicitation request: ${Z}`)}let{params:v}=_.data,b=(p=v.mode)!==null&&p!==void 0?p:"form",{supportsFormMode:x,supportsUrlMode:k}=_re(this._capabilities.elicitation);if(b==="form"&&!x)throw new de(be.InvalidParams,"Client does not support form-mode elicitation requests");if(b==="url"&&!k)throw new de(be.InvalidParams,"Client does not support URL-mode elicitation requests");let T=await Promise.resolve(r(d,f));if(v.task){let Z=Jn(Ya,T);if(!Z.success){let oe=Z.error instanceof Error?Z.error.message:String(Z.error);throw new de(be.InvalidParams,`Invalid task creation result: ${oe}`)}return Z.data}let F=Jn(CS,T);if(!F.success){let Z=F.error instanceof Error?F.error.message:String(F.error);throw new de(be.InvalidParams,`Invalid elicitation result: ${Z}`)}let J=F.data,w=b==="form"?v.requestedSchema:void 0;if(b==="form"&&J.action==="accept"&&J.content&&w&&!((h=(m=this._capabilities.elicitation)===null||m===void 0?void 0:m.form)===null||h===void 0)&&h.applyDefaults)try{Cb(w,J.content)}catch{}return J};return super.setRequestHandler(e,l)}if(u==="sampling/createMessage"){let l=async(d,f)=>{let p=Jn(AS,d);if(!p.success){let v=p.error instanceof Error?p.error.message:String(p.error);throw new de(be.InvalidParams,`Invalid sampling request: ${v}`)}let{params:m}=p.data,h=await Promise.resolve(r(d,f));if(m.task){let v=Jn(Ya,h);if(!v.success){let b=v.error instanceof Error?v.error.message:String(v.error);throw new de(be.InvalidParams,`Invalid task creation result: ${b}`)}return v.data}let _=Jn(OS,h);if(!_.success){let v=_.error instanceof Error?_.error.message:String(_.error);throw new de(be.InvalidParams,`Invalid sampling result: ${v}`)}return _.data};return super.setRequestHandler(e,l)}return super.setRequestHandler(e,r)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:fS,capabilities:this._capabilities,clientInfo:this._clientInfo}},gS,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!Pj.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,o,i,s;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){var r,n;DU((n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests,e,"Server")}assertTaskHandlerCapability(e){var r;this._capabilities&&LU((r=this._capabilities.tasks)===null||r===void 0?void 0:r.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Xa,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},RS,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Xa,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},TS,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},xS,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},yS,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},vS,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},wS,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Xa,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Xa,r)}async callTool(e,r=$l,n){if(this.isToolTaskRequired(e.name))throw new de(be.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},r,n),i=this.getToolOutputValidator(e.name);if(i){if(!o.structuredContent&&!o.isError)throw new de(be.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let s=i(o.structuredContent);if(!s.valid)throw new de(be.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof de?s:new de(be.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return o}isToolTask(e){var r,n,o,i;return!((i=(o=(n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests)===null||o===void 0?void 0:o.tools)===null||i===void 0)&&i.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){var r;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let n of e){if(n.outputSchema){let i=this._jsonSchemaValidator.getValidator(n.outputSchema);this._cachedToolOutputValidators.set(n.name,i)}let o=(r=n.execution)===null||r===void 0?void 0:r.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(n.name),o==="required"&&this._cachedRequiredTaskTools.add(n.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},ES,r);return this.cacheToolMetadata(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Nb=class extends fl{name;description;toolSpec;mcpClient;constructor(e){super(),this.name=e.name,this.description=e.description,this.toolSpec={name:e.name,description:e.description,inputSchema:e.inputSchema},this.mcpClient=e.client}async*stream(e){let{toolUseId:r,input:n}=e.toolUse;try{let o=await this.mcpClient.callTool(this,n);if(!this._isMcpToolResult(o))throw new Error("Invalid tool result from MCP Client: missing content array");let i=o.content.map(s=>this._isMcpTextContent(s)?new mt(s.text):new Ha({json:s}));return i.length===0&&i.push(new mt("Tool execution completed successfully with no output.")),new Ht({toolUseId:r,status:o.isError?"error":"success",content:i})}catch(o){return lS(o,r)}}_isMcpToolResult(e){return typeof e!="object"||e===null?!1:Array.isArray(e.content)}_isMcpTextContent(e){if(typeof e!="object"||e===null)return!1;let r=e;return r.type==="text"&&typeof r.text=="string"}};var xf=class{_clientName;_clientVersion;_transport;_connected;_client;constructor(e){this._clientName=e.applicationName||"strands-agents-ts-sdk",this._clientVersion=e.applicationVersion||"0.0.1",this._transport=e.transport,this._connected=!1,this._client=new Rb({name:this._clientName,version:this._clientVersion})}get client(){return this._client}async connect(e=!1){this._connected&&!e||(this._connected&&e&&(await this._client.close(),this._connected=!1),await this._client.connect(this._transport),this._connected=!0)}async disconnect(){await this._client.close(),await this._transport.close(),this._connected=!1}async listTools(){return await this.connect(),(await this._client.listTools()).tools.map(r=>new Nb({name:r.name,description:r.description??"",inputSchema:r.inputSchema,client:this}))}async callTool(e,r){if(await this.connect(),r==null)return await this.callTool(e,{});if(typeof r!="object"||Array.isArray(r))throw new Error(`MCP Protocol Error: Tool arguments must be a JSON Object (named parameters). Received: ${Array.isArray(r)?"Array":typeof r}`);return await this._client.callTool({name:e.name,arguments:r})}};var UU=({model:t})=>{let e=new ms({region:"us-east-1",modelId:t,maxTokens:4096,temperature:.7});return new bf({model:e})};var yre=async({message:t="\u3053\u3093\u306B\u3061\u306F\uFF01",model:e="us.amazon.nova-micro-v1:0"},r)=>{let n=UU({model:e});for await(let o of n.stream(t))o.type==="modelContentBlockDeltaEvent"&&o.delta.type==="textDelta"&&r.write(o.delta.text)},vre=awslambda.streamifyResponse(async(t,e)=>{wm.debug("event",{event:t});let{message:r,model:n}=t.body?JSON.parse(t.body):{};await yre({message:r,model:n},e),e.end()}),EBe=vre;export{EBe as default,yre as handle,vre as handler}; +/*! Bundled license information: + +@aws-lambda-powertools/logger/lib/esm/logBuffer.js: + (* v8 ignore next -- @preserve *) + +@langchain/core/dist/utils/fast-json-patch/src/helpers.js: + (*! + * https://github.com/Starcounter-Jack/JSON-Patch + * (c) 2017-2022 Joachim Wester + * MIT licensed + *) + +@langchain/core/dist/utils/sax-js/sax.js: + (*! http://mths.be/fromcodepoint v0.1.0 by @mathias *) +*/ diff --git a/agents/agent-strands/cdk.out/asset.716071e6193d8d65285fec67182520a245dc4d4cf966b8c5765ff14412b10546/index.mjs b/agents/agent-strands/cdk.out/asset.716071e6193d8d65285fec67182520a245dc4d4cf966b8c5765ff14412b10546/index.mjs new file mode 100644 index 00000000..bad06e4a --- /dev/null +++ b/agents/agent-strands/cdk.out/asset.716071e6193d8d65285fec67182520a245dc4d4cf966b8c5765ff14412b10546/index.mjs @@ -0,0 +1,238 @@ +import { createRequire } from 'module';const require = createRequire(import.meta.url); +var FU=Object.create;var zb=Object.defineProperty;var BU=Object.getOwnPropertyDescriptor;var ZU=Object.getOwnPropertyNames;var qU=Object.getPrototypeOf,VU=Object.prototype.hasOwnProperty;var P=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),gi=(t,e)=>{for(var r in e)zb(t,r,{get:e[r],enumerable:!0})},GU=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ZU(e))!VU.call(t,o)&&o!==r&&zb(t,o,{get:()=>e[o],enumerable:!(n=BU(e,o))||n.enumerable});return t};var mn=(t,e,r)=>(r=t!=null?FU(qU(t)):{},GU(e||!t||!t.__esModule?zb(r,"default",{value:t,enumerable:!0}):r,t));var Xb=P((Kl,lc)=>{var JU=200,GT="__lodash_hash_undefined__",XU=800,YU=16,KT=9007199254740991,HT="[object Arguments]",QU="[object Array]",e4="[object AsyncFunction]",t4="[object Boolean]",r4="[object Date]",n4="[object Error]",WT="[object Function]",o4="[object GeneratorFunction]",i4="[object Map]",s4="[object Number]",a4="[object Null]",JT="[object Object]",c4="[object Proxy]",u4="[object RegExp]",l4="[object Set]",d4="[object String]",p4="[object Undefined]",f4="[object WeakMap]",m4="[object ArrayBuffer]",h4="[object DataView]",g4="[object Float32Array]",_4="[object Float64Array]",y4="[object Int8Array]",v4="[object Int16Array]",b4="[object Int32Array]",w4="[object Uint8Array]",x4="[object Uint8ClampedArray]",$4="[object Uint16Array]",I4="[object Uint32Array]",S4=/[\\^$.*+?()[\]{}|]/g,k4=/^\[object .+?Constructor\]$/,T4=/^(?:0|[1-9]\d*)$/,st={};st[g4]=st[_4]=st[y4]=st[v4]=st[b4]=st[w4]=st[x4]=st[$4]=st[I4]=!0;st[HT]=st[QU]=st[m4]=st[t4]=st[h4]=st[r4]=st[n4]=st[WT]=st[i4]=st[s4]=st[JT]=st[u4]=st[l4]=st[d4]=st[f4]=!1;var XT=typeof global=="object"&&global&&global.Object===Object&&global,E4=typeof self=="object"&&self&&self.Object===Object&&self,Jl=XT||E4||Function("return this")(),YT=typeof Kl=="object"&&Kl&&!Kl.nodeType&&Kl,Hl=YT&&typeof lc=="object"&&lc&&!lc.nodeType&&lc,QT=Hl&&Hl.exports===YT,Fb=QT&&XT.process,jT=(function(){try{var t=Hl&&Hl.require&&Hl.require("util").types;return t||Fb&&Fb.binding&&Fb.binding("util")}catch{}})(),DT=jT&&jT.isTypedArray;function A4(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function O4(t,e){for(var r=-1,n=Array(t);++r-1}function Y4(t,e){var r=this.__data__,n=pm(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}jo.prototype.clear=H4;jo.prototype.delete=W4;jo.prototype.get=J4;jo.prototype.has=X4;jo.prototype.set=Y4;function dc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(i=t.length>3&&typeof i=="function"?(o--,i):void 0,s&&T2(r[0],r[1],s)&&(i=o<3?void 0:i,o=1),e=Object(e);++n-1&&t%1==0&&t0){if(++e>=XU)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function z2(t){if(t!=null){try{return dm.call(t)}catch{}try{return t+""}catch{}}return""}function hm(t,e){return t===e||t!==t&&e!==e}var Vb=VT((function(){return arguments})())?VT:function(t){return Xl(t)&&Mo.call(t,"callee")&&!D4.call(t,"callee")},Gb=Array.isArray;function Wb(t){return t!=null&&aE(t.length)&&!Jb(t)}function M2(t){return Xl(t)&&Wb(t)}var sE=U4||F2;function Jb(t){if(!Ps(t))return!1;var e=fm(t);return e==WT||e==o4||e==e4||e==c4}function aE(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=KT}function Ps(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Xl(t){return t!=null&&typeof t=="object"}function j2(t){if(!Xl(t)||fm(t)!=JT)return!1;var e=tE(t);if(e===null)return!0;var r=Mo.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&dm.call(r)==M4}var cE=DT?P4(DT):f2;function D2(t){return x2(t,uE(t))}function uE(t){return Wb(t)?u2(t,!0):m2(t)}var L2=$2(function(t,e,r){nE(t,e,r)});function U2(t){return function(){return t}}function lE(t){return t}function F2(){return!1}lc.exports=L2});var xA=P((_de,wA)=>{"use strict";wA.exports=function(t,e){if(typeof t!="string")throw new TypeError("Expected a string");return e=typeof e>"u"?"_":e,t.replace(/([a-z\d])([A-Z])/g,"$1"+e+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+e+"$2").toLowerCase()}});var AA=P((yde,Zw)=>{"use strict";var dB=/[\p{Lu}]/u,pB=/[\p{Ll}]/u,$A=/^[\p{Lu}](?![\p{Lu}])/gu,kA=/([\p{Alpha}\p{N}_]|$)/u,TA=/[_.\- ]+/,fB=new RegExp("^"+TA.source),IA=new RegExp(TA.source+kA.source,"gu"),SA=new RegExp("\\d+"+kA.source,"gu"),mB=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let s=0;s($A.lastIndex=0,t.replace($A,r=>e(r))),gB=(t,e)=>(IA.lastIndex=0,SA.lastIndex=0,t.replace(IA,(r,n)=>e(n)).replace(SA,r=>e(r))),EA=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(t)?t=t.map(i=>i.trim()).filter(i=>i.length).join("-"):t=t.trim(),t.length===0)return"";let r=e.locale===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(e.locale),n=e.locale===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(e.locale);return t.length===1?e.pascalCase?n(t):r(t):(t!==r(t)&&(t=mB(t,r,n)),t=t.replace(fB,""),e.preserveConsecutiveUppercase?t=hB(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),gB(t,n))};Zw.exports=EA;Zw.exports.default=EA});var cP=P((ime,Ix)=>{"use strict";var v6=Object.prototype.hasOwnProperty,hr="~";function Cd(){}Object.create&&(Cd.prototype=Object.create(null),new Cd().__proto__||(hr=!1));function b6(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function aP(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new b6(r,n||t,o),s=hr?hr+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],i]:t._events[s].push(i):(t._events[s]=i,t._eventsCount++),t}function wh(t,e){--t._eventsCount===0?t._events=new Cd:delete t._events[e]}function tr(){this._events=new Cd,this._eventsCount=0}tr.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)v6.call(r,n)&&e.push(hr?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};tr.prototype.listeners=function(e){var r=hr?hr+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,s=new Array(i);o{"use strict";uP.exports=(t,e)=>(e=e||(()=>{}),t.then(r=>new Promise(n=>{n(e())}).then(()=>r),r=>new Promise(n=>{n(e())}).then(()=>{throw r})))});var pP=P((ame,$h)=>{"use strict";var w6=lP(),xh=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},dP=(t,e,r)=>new Promise((n,o)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){n(t);return}let i=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(c){o(c)}return}let s=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,a=r instanceof Error?r:new xh(s);typeof t.cancel=="function"&&t.cancel(),o(a)},e);w6(t.then(n,o),()=>{clearTimeout(i)})});$h.exports=dP;$h.exports.default=dP;$h.exports.TimeoutError=xh});var fP=P(Sx=>{"use strict";Object.defineProperty(Sx,"__esModule",{value:!0});function x6(t,e,r){let n=0,o=t.length;for(;o>0;){let i=o/2|0,s=n+i;r(t[s],e)<=0?(n=++s,o-=i+1):o=i}return n}Sx.default=x6});var mP=P(Tx=>{"use strict";Object.defineProperty(Tx,"__esModule",{value:!0});var $6=fP(),kx=class{constructor(){this._queue=[]}enqueue(e,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let o=$6.default(this._queue,n,(i,s)=>s.priority-i.priority);this._queue.splice(o,0,n)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this._queue.length}};Tx.default=kx});var Sh=P(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:!0});var I6=cP(),hP=pP(),S6=mP(),Ih=()=>{},k6=new hP.TimeoutError,Ex=class extends I6{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Ih,this._resolveIdle=Ih,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:S6.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(i=(o=e.interval)===null||o===void 0?void 0:o.toString())!==null&&i!==void 0?i:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||e.interval===0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=e.throwOnTimeout===!0,this._isPaused=e.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),e&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,r={}){return new Promise((n,o)=>{let i=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&r.timeout===void 0?e():hP.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(k6)});n(await s)}catch(s){o(s)}this._next()};this._queue.enqueue(i,r),this._tryToStartAnother(),this.emit("add")})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(e=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}};Ax.default=Ex});var Nd=P((mme,gP)=>{"use strict";var E6="2.0.0",A6=Number.MAX_SAFE_INTEGER||9007199254740991,O6=16,P6=250,C6=["major","premajor","minor","preminor","patch","prepatch","prerelease"];gP.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:O6,MAX_SAFE_BUILD_LENGTH:P6,MAX_SAFE_INTEGER:A6,RELEASE_TYPES:C6,SEMVER_SPEC_VERSION:E6,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var zd=P((hme,_P)=>{"use strict";var R6=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};_P.exports=R6});var lu=P((fo,yP)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Cx,MAX_SAFE_BUILD_LENGTH:N6,MAX_LENGTH:z6}=Nd(),M6=zd();fo=yP.exports={};var j6=fo.re=[],D6=fo.safeRe=[],X=fo.src=[],L6=fo.safeSrc=[],Y=fo.t={},U6=0,Rx="[a-zA-Z0-9-]",F6=[["\\s",1],["\\d",z6],[Rx,N6]],B6=t=>{for(let[e,r]of F6)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Ie=(t,e,r)=>{let n=B6(e),o=U6++;M6(t,o,e),Y[t]=o,X[o]=e,L6[o]=n,j6[o]=new RegExp(e,r?"g":void 0),D6[o]=new RegExp(n,r?"g":void 0)};Ie("NUMERICIDENTIFIER","0|[1-9]\\d*");Ie("NUMERICIDENTIFIERLOOSE","\\d+");Ie("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Rx}*`);Ie("MAINVERSION",`(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})`);Ie("MAINVERSIONLOOSE",`(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})`);Ie("PRERELEASEIDENTIFIER",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIER]})`);Ie("PRERELEASEIDENTIFIERLOOSE",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIERLOOSE]})`);Ie("PRERELEASE",`(?:-(${X[Y.PRERELEASEIDENTIFIER]}(?:\\.${X[Y.PRERELEASEIDENTIFIER]})*))`);Ie("PRERELEASELOOSE",`(?:-?(${X[Y.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${X[Y.PRERELEASEIDENTIFIERLOOSE]})*))`);Ie("BUILDIDENTIFIER",`${Rx}+`);Ie("BUILD",`(?:\\+(${X[Y.BUILDIDENTIFIER]}(?:\\.${X[Y.BUILDIDENTIFIER]})*))`);Ie("FULLPLAIN",`v?${X[Y.MAINVERSION]}${X[Y.PRERELEASE]}?${X[Y.BUILD]}?`);Ie("FULL",`^${X[Y.FULLPLAIN]}$`);Ie("LOOSEPLAIN",`[v=\\s]*${X[Y.MAINVERSIONLOOSE]}${X[Y.PRERELEASELOOSE]}?${X[Y.BUILD]}?`);Ie("LOOSE",`^${X[Y.LOOSEPLAIN]}$`);Ie("GTLT","((?:<|>)?=?)");Ie("XRANGEIDENTIFIERLOOSE",`${X[Y.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Ie("XRANGEIDENTIFIER",`${X[Y.NUMERICIDENTIFIER]}|x|X|\\*`);Ie("XRANGEPLAIN",`[v=\\s]*(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:${X[Y.PRERELEASE]})?${X[Y.BUILD]}?)?)?`);Ie("XRANGEPLAINLOOSE",`[v=\\s]*(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:${X[Y.PRERELEASELOOSE]})?${X[Y.BUILD]}?)?)?`);Ie("XRANGE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAIN]}$`);Ie("XRANGELOOSE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAINLOOSE]}$`);Ie("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Cx}})(?:\\.(\\d{1,${Cx}}))?(?:\\.(\\d{1,${Cx}}))?`);Ie("COERCE",`${X[Y.COERCEPLAIN]}(?:$|[^\\d])`);Ie("COERCEFULL",X[Y.COERCEPLAIN]+`(?:${X[Y.PRERELEASE]})?(?:${X[Y.BUILD]})?(?:$|[^\\d])`);Ie("COERCERTL",X[Y.COERCE],!0);Ie("COERCERTLFULL",X[Y.COERCEFULL],!0);Ie("LONETILDE","(?:~>?)");Ie("TILDETRIM",`(\\s*)${X[Y.LONETILDE]}\\s+`,!0);fo.tildeTrimReplace="$1~";Ie("TILDE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAIN]}$`);Ie("TILDELOOSE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAINLOOSE]}$`);Ie("LONECARET","(?:\\^)");Ie("CARETTRIM",`(\\s*)${X[Y.LONECARET]}\\s+`,!0);fo.caretTrimReplace="$1^";Ie("CARET",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAIN]}$`);Ie("CARETLOOSE",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAINLOOSE]}$`);Ie("COMPARATORLOOSE",`^${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]})$|^$`);Ie("COMPARATOR",`^${X[Y.GTLT]}\\s*(${X[Y.FULLPLAIN]})$|^$`);Ie("COMPARATORTRIM",`(\\s*)${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]}|${X[Y.XRANGEPLAIN]})`,!0);fo.comparatorTrimReplace="$1$2$3";Ie("HYPHENRANGE",`^\\s*(${X[Y.XRANGEPLAIN]})\\s+-\\s+(${X[Y.XRANGEPLAIN]})\\s*$`);Ie("HYPHENRANGELOOSE",`^\\s*(${X[Y.XRANGEPLAINLOOSE]})\\s+-\\s+(${X[Y.XRANGEPLAINLOOSE]})\\s*$`);Ie("STAR","(<|>)?=?\\s*\\*");Ie("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Ie("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Th=P((gme,vP)=>{"use strict";var Z6=Object.freeze({loose:!0}),q6=Object.freeze({}),V6=t=>t?typeof t!="object"?Z6:t:q6;vP.exports=V6});var Nx=P((_me,xP)=>{"use strict";var bP=/^[0-9]+$/,wP=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:twP(e,t);xP.exports={compareIdentifiers:wP,rcompareIdentifiers:G6}});var rr=P((yme,IP)=>{"use strict";var Eh=zd(),{MAX_LENGTH:$P,MAX_SAFE_INTEGER:Ah}=Nd(),{safeRe:Oh,t:Ph}=lu(),K6=Th(),{compareIdentifiers:zx}=Nx(),Mx=class t{constructor(e,r){if(r=K6(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>$P)throw new TypeError(`version is longer than ${$P} characters`);Eh("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Oh[Ph.LOOSE]:Oh[Ph.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Ah||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ah||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ah||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let i=+o;if(i>=0&&ie.major?1:this.minore.minor?1:this.patche.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(Eh("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return zx(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(Eh("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return zx(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?Oh[Ph.PRERELEASELOOSE]:Oh[Ph.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let i=[r,o];n===!1&&(i=[r]),zx(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};IP.exports=Mx});var pa=P((vme,kP)=>{"use strict";var SP=rr(),H6=(t,e,r=!1)=>{if(t instanceof SP)return t;try{return new SP(t,e)}catch(n){if(!r)return null;throw n}};kP.exports=H6});var EP=P((bme,TP)=>{"use strict";var W6=pa(),J6=(t,e)=>{let r=W6(t,e);return r?r.version:null};TP.exports=J6});var OP=P((wme,AP)=>{"use strict";var X6=pa(),Y6=(t,e)=>{let r=X6(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};AP.exports=Y6});var RP=P((xme,CP)=>{"use strict";var PP=rr(),Q6=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new PP(t instanceof PP?t.version:t,r).inc(e,n,o).version}catch{return null}};CP.exports=Q6});var MP=P(($me,zP)=>{"use strict";var NP=pa(),eZ=(t,e)=>{let r=NP(t,null,!0),n=NP(e,null,!0),o=r.compare(n);if(o===0)return null;let i=o>0,s=i?r:n,a=i?n:r,c=!!s.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0)return a.minor&&!a.patch?"minor":"patch"}let l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};zP.exports=eZ});var DP=P((Ime,jP)=>{"use strict";var tZ=rr(),rZ=(t,e)=>new tZ(t,e).major;jP.exports=rZ});var UP=P((Sme,LP)=>{"use strict";var nZ=rr(),oZ=(t,e)=>new nZ(t,e).minor;LP.exports=oZ});var BP=P((kme,FP)=>{"use strict";var iZ=rr(),sZ=(t,e)=>new iZ(t,e).patch;FP.exports=sZ});var qP=P((Tme,ZP)=>{"use strict";var aZ=pa(),cZ=(t,e)=>{let r=aZ(t,e);return r&&r.prerelease.length?r.prerelease:null};ZP.exports=cZ});var gn=P((Eme,GP)=>{"use strict";var VP=rr(),uZ=(t,e,r)=>new VP(t,r).compare(new VP(e,r));GP.exports=uZ});var HP=P((Ame,KP)=>{"use strict";var lZ=gn(),dZ=(t,e,r)=>lZ(e,t,r);KP.exports=dZ});var JP=P((Ome,WP)=>{"use strict";var pZ=gn(),fZ=(t,e)=>pZ(t,e,!0);WP.exports=fZ});var Ch=P((Pme,YP)=>{"use strict";var XP=rr(),mZ=(t,e,r)=>{let n=new XP(t,r),o=new XP(e,r);return n.compare(o)||n.compareBuild(o)};YP.exports=mZ});var eC=P((Cme,QP)=>{"use strict";var hZ=Ch(),gZ=(t,e)=>t.sort((r,n)=>hZ(r,n,e));QP.exports=gZ});var rC=P((Rme,tC)=>{"use strict";var _Z=Ch(),yZ=(t,e)=>t.sort((r,n)=>_Z(n,r,e));tC.exports=yZ});var Md=P((Nme,nC)=>{"use strict";var vZ=gn(),bZ=(t,e,r)=>vZ(t,e,r)>0;nC.exports=bZ});var Rh=P((zme,oC)=>{"use strict";var wZ=gn(),xZ=(t,e,r)=>wZ(t,e,r)<0;oC.exports=xZ});var jx=P((Mme,iC)=>{"use strict";var $Z=gn(),IZ=(t,e,r)=>$Z(t,e,r)===0;iC.exports=IZ});var Dx=P((jme,sC)=>{"use strict";var SZ=gn(),kZ=(t,e,r)=>SZ(t,e,r)!==0;sC.exports=kZ});var Nh=P((Dme,aC)=>{"use strict";var TZ=gn(),EZ=(t,e,r)=>TZ(t,e,r)>=0;aC.exports=EZ});var zh=P((Lme,cC)=>{"use strict";var AZ=gn(),OZ=(t,e,r)=>AZ(t,e,r)<=0;cC.exports=OZ});var Lx=P((Ume,uC)=>{"use strict";var PZ=jx(),CZ=Dx(),RZ=Md(),NZ=Nh(),zZ=Rh(),MZ=zh(),jZ=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return PZ(t,r,n);case"!=":return CZ(t,r,n);case">":return RZ(t,r,n);case">=":return NZ(t,r,n);case"<":return zZ(t,r,n);case"<=":return MZ(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};uC.exports=jZ});var dC=P((Fme,lC)=>{"use strict";var DZ=rr(),LZ=pa(),{safeRe:Mh,t:jh}=lu(),UZ=(t,e)=>{if(t instanceof DZ)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Mh[jh.COERCEFULL]:Mh[jh.COERCE]);else{let c=e.includePrerelease?Mh[jh.COERCERTLFULL]:Mh[jh.COERCERTL],u;for(;(u=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",i=r[4]||"0",s=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return LZ(`${n}.${o}.${i}${s}${a}`,e)};lC.exports=UZ});var fC=P((Bme,pC)=>{"use strict";var Ux=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};pC.exports=Ux});var _n=P((Zme,_C)=>{"use strict";var FZ=/\s+/g,Fx=class t{constructor(e,r){if(r=ZZ(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Bx)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(FZ," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(o=>!hC(o[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&JZ(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&HZ)|(this.options.loose&&WZ))+":"+e,o=mC.get(n);if(o)return o;let i=this.options.loose,s=i?gr[nr.HYPHENRANGELOOSE]:gr[nr.HYPHENRANGE];e=e.replace(s,s9(this.options.includePrerelease)),at("hyphen replace",e),e=e.replace(gr[nr.COMPARATORTRIM],VZ),at("comparator trim",e),e=e.replace(gr[nr.TILDETRIM],GZ),at("tilde trim",e),e=e.replace(gr[nr.CARETTRIM],KZ),at("caret trim",e);let a=e.split(" ").map(d=>XZ(d,this.options)).join(" ").split(/\s+/).map(d=>i9(d,this.options));i&&(a=a.filter(d=>(at("loose invalid filter",d,this.options),!!d.match(gr[nr.COMPARATORLOOSE])))),at("range list",a);let c=new Map,u=a.map(d=>new Bx(d,this.options));for(let d of u){if(hC(d))return[d];c.set(d.value,d)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return mC.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>gC(n,r)&&e.set.some(o=>gC(o,r)&&n.every(i=>o.every(s=>i.intersects(s,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new qZ(e,this.options)}catch{return!1}for(let r=0;rt.value==="<0.0.0-0",JZ=t=>t.value==="",gC=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(i=>o.intersects(i,e)),o=n.pop();return r},XZ=(t,e)=>(t=t.replace(gr[nr.BUILD],""),at("comp",t,e),t=e9(t,e),at("caret",t),t=YZ(t,e),at("tildes",t),t=r9(t,e),at("xrange",t),t=o9(t,e),at("stars",t),t),_r=t=>!t||t.toLowerCase()==="x"||t==="*",YZ=(t,e)=>t.trim().split(/\s+/).map(r=>QZ(r,e)).join(" "),QZ=(t,e)=>{let r=e.loose?gr[nr.TILDELOOSE]:gr[nr.TILDE];return t.replace(r,(n,o,i,s,a)=>{at("tilde",t,n,o,i,s,a);let c;return _r(o)?c="":_r(i)?c=`>=${o}.0.0 <${+o+1}.0.0-0`:_r(s)?c=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:a?(at("replaceTilde pr",a),c=`>=${o}.${i}.${s}-${a} <${o}.${+i+1}.0-0`):c=`>=${o}.${i}.${s} <${o}.${+i+1}.0-0`,at("tilde return",c),c})},e9=(t,e)=>t.trim().split(/\s+/).map(r=>t9(r,e)).join(" "),t9=(t,e)=>{at("caret",t,e);let r=e.loose?gr[nr.CARETLOOSE]:gr[nr.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,s,a,c)=>{at("caret",t,o,i,s,a,c);let u;return _r(i)?u="":_r(s)?u=`>=${i}.0.0${n} <${+i+1}.0.0-0`:_r(a)?i==="0"?u=`>=${i}.${s}.0${n} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.0${n} <${+i+1}.0.0-0`:c?(at("replaceCaret pr",c),i==="0"?s==="0"?u=`>=${i}.${s}.${a}-${c} <${i}.${s}.${+a+1}-0`:u=`>=${i}.${s}.${a}-${c} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.${a}-${c} <${+i+1}.0.0-0`):(at("no pr"),i==="0"?s==="0"?u=`>=${i}.${s}.${a}${n} <${i}.${s}.${+a+1}-0`:u=`>=${i}.${s}.${a}${n} <${i}.${+s+1}.0-0`:u=`>=${i}.${s}.${a} <${+i+1}.0.0-0`),at("caret return",u),u})},r9=(t,e)=>(at("replaceXRanges",t,e),t.split(/\s+/).map(r=>n9(r,e)).join(" ")),n9=(t,e)=>{t=t.trim();let r=e.loose?gr[nr.XRANGELOOSE]:gr[nr.XRANGE];return t.replace(r,(n,o,i,s,a,c)=>{at("xRange",t,n,o,i,s,a,c);let u=_r(i),l=u||_r(s),d=l||_r(a),f=d;return o==="="&&f&&(o=""),c=e.includePrerelease?"-0":"",u?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&f?(l&&(s=0),a=0,o===">"?(o=">=",l?(i=+i+1,s=0,a=0):(s=+s+1,a=0)):o==="<="&&(o="<",l?i=+i+1:s=+s+1),o==="<"&&(c="-0"),n=`${o+i}.${s}.${a}${c}`):l?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${s}.0${c} <${i}.${+s+1}.0-0`),at("xRange return",n),n})},o9=(t,e)=>(at("replaceStars",t,e),t.trim().replace(gr[nr.STAR],"")),i9=(t,e)=>(at("replaceGTE0",t,e),t.trim().replace(gr[e.includePrerelease?nr.GTE0PRE:nr.GTE0],"")),s9=t=>(e,r,n,o,i,s,a,c,u,l,d,f)=>(_r(n)?r="":_r(o)?r=`>=${n}.0.0${t?"-0":""}`:_r(i)?r=`>=${n}.${o}.0${t?"-0":""}`:s?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,_r(u)?c="":_r(l)?c=`<${+u+1}.0.0-0`:_r(d)?c=`<${u}.${+l+1}.0-0`:f?c=`<=${u}.${l}.${d}-${f}`:t?c=`<${u}.${l}.${+d+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),a9=(t,e,r)=>{for(let n=0;n0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var jd=P((qme,$C)=>{"use strict";var Dd=Symbol("SemVer ANY"),Vx=class t{static get ANY(){return Dd}constructor(e,r){if(r=yC(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),qx("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Dd?this.value="":this.value=this.operator+this.semver.version,qx("comp",this)}parse(e){let r=this.options.loose?vC[bC.COMPARATORLOOSE]:vC[bC.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new wC(n[2],this.options.loose):this.semver=Dd}toString(){return this.value}test(e){if(qx("Comparator.test",e,this.options.loose),this.semver===Dd||e===Dd)return!0;if(typeof e=="string")try{e=new wC(e,this.options)}catch{return!1}return Zx(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new xC(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new xC(this.value,r).test(e.semver):(r=yC(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Zx(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Zx(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};$C.exports=Vx;var yC=Th(),{safeRe:vC,t:bC}=lu(),Zx=Lx(),qx=zd(),wC=rr(),xC=_n()});var Ld=P((Vme,IC)=>{"use strict";var c9=_n(),u9=(t,e,r)=>{try{e=new c9(e,r)}catch{return!1}return e.test(t)};IC.exports=u9});var kC=P((Gme,SC)=>{"use strict";var l9=_n(),d9=(t,e)=>new l9(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));SC.exports=d9});var EC=P((Kme,TC)=>{"use strict";var p9=rr(),f9=_n(),m9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new f9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===-1)&&(n=s,o=new p9(n,r))}),n};TC.exports=m9});var OC=P((Hme,AC)=>{"use strict";var h9=rr(),g9=_n(),_9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new g9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===1)&&(n=s,o=new h9(n,r))}),n};AC.exports=_9});var RC=P((Wme,CC)=>{"use strict";var Gx=rr(),y9=_n(),PC=Md(),v9=(t,e)=>{t=new y9(t,e);let r=new Gx("0.0.0");if(t.test(r)||(r=new Gx("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n{let a=new Gx(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||PC(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),i&&(!r||PC(r,i))&&(r=i)}return r&&t.test(r)?r:null};CC.exports=v9});var zC=P((Jme,NC)=>{"use strict";var b9=_n(),w9=(t,e)=>{try{return new b9(t,e).range||"*"}catch{return null}};NC.exports=w9});var Dh=P((Xme,LC)=>{"use strict";var x9=rr(),DC=jd(),{ANY:$9}=DC,I9=_n(),S9=Ld(),MC=Md(),jC=Rh(),k9=zh(),T9=Nh(),E9=(t,e,r,n)=>{t=new x9(t,n),e=new I9(e,n);let o,i,s,a,c;switch(r){case">":o=MC,i=k9,s=jC,a=">",c=">=";break;case"<":o=jC,i=T9,s=MC,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(S9(t,e,n))return!1;for(let u=0;u{p.semver===$9&&(p=new DC(">=0.0.0")),d=d||p,f=f||p,o(p.semver,d.semver,n)?d=p:s(p.semver,f.semver,n)&&(f=p)}),d.operator===a||d.operator===c||(!f.operator||f.operator===a)&&i(t,f.semver))return!1;if(f.operator===c&&s(t,f.semver))return!1}return!0};LC.exports=E9});var FC=P((Yme,UC)=>{"use strict";var A9=Dh(),O9=(t,e,r)=>A9(t,e,">",r);UC.exports=O9});var ZC=P((Qme,BC)=>{"use strict";var P9=Dh(),C9=(t,e,r)=>P9(t,e,"<",r);BC.exports=C9});var GC=P((ehe,VC)=>{"use strict";var qC=_n(),R9=(t,e,r)=>(t=new qC(t,r),e=new qC(e,r),t.intersects(e,r));VC.exports=R9});var HC=P((the,KC)=>{"use strict";var N9=Ld(),z9=gn();KC.exports=(t,e,r)=>{let n=[],o=null,i=null,s=t.sort((l,d)=>z9(l,d,r));for(let l of s)N9(l,e,r)?(i=l,o||(o=l)):(i&&n.push([o,i]),i=null,o=null);o&&n.push([o,null]);let a=[];for(let[l,d]of n)l===d?a.push(l):!d&&l===s[0]?a.push("*"):d?l===s[0]?a.push(`<=${d}`):a.push(`${l} - ${d}`):a.push(`>=${l}`);let c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length{"use strict";var WC=_n(),Hx=jd(),{ANY:Kx}=Hx,Ud=Ld(),Wx=gn(),M9=(t,e,r={})=>{if(t===e)return!0;t=new WC(t,r),e=new WC(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let s=D9(o,i,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},j9=[new Hx(">=0.0.0-0")],JC=[new Hx(">=0.0.0")],D9=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Kx){if(e.length===1&&e[0].semver===Kx)return!0;r.includePrerelease?t=j9:t=JC}if(e.length===1&&e[0].semver===Kx){if(r.includePrerelease)return!0;e=JC}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=XC(o,p,r):p.operator==="<"||p.operator==="<="?i=YC(i,p,r):n.add(p.semver);if(n.size>1)return null;let s;if(o&&i){if(s=Wx(o.semver,i.semver,r),s>0)return null;if(s===0&&(o.operator!==">="||i.operator!=="<="))return null}for(let p of n){if(o&&!Ud(p,String(o),r)||i&&!Ud(p,String(i),r))return null;for(let m of e)if(!Ud(p,String(m),r))return!1;return!0}let a,c,u,l,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of e){if(l=l||p.operator===">"||p.operator===">=",u=u||p.operator==="<"||p.operator==="<=",o){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator===">"||p.operator===">="){if(a=XC(o,p,r),a===p&&a!==o)return!1}else if(o.operator===">="&&!Ud(o.semver,String(p),r))return!1}if(i){if(d&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===d.major&&p.semver.minor===d.minor&&p.semver.patch===d.patch&&(d=!1),p.operator==="<"||p.operator==="<="){if(c=YC(i,p,r),c===p&&c!==i)return!1}else if(i.operator==="<="&&!Ud(i.semver,String(p),r))return!1}if(!p.operator&&(i||o)&&s!==0)return!1}return!(o&&u&&!i&&s!==0||i&&l&&!o&&s!==0||f||d)},XC=(t,e,r)=>{if(!t)return e;let n=Wx(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},YC=(t,e,r)=>{if(!t)return e;let n=Wx(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};QC.exports=M9});var oR=P((nhe,nR)=>{"use strict";var Jx=lu(),tR=Nd(),L9=rr(),rR=Nx(),U9=pa(),F9=EP(),B9=OP(),Z9=RP(),q9=MP(),V9=DP(),G9=UP(),K9=BP(),H9=qP(),W9=gn(),J9=HP(),X9=JP(),Y9=Ch(),Q9=eC(),eq=rC(),tq=Md(),rq=Rh(),nq=jx(),oq=Dx(),iq=Nh(),sq=zh(),aq=Lx(),cq=dC(),uq=jd(),lq=_n(),dq=Ld(),pq=kC(),fq=EC(),mq=OC(),hq=RC(),gq=zC(),_q=Dh(),yq=FC(),vq=ZC(),bq=GC(),wq=HC(),xq=eR();nR.exports={parse:U9,valid:F9,clean:B9,inc:Z9,diff:q9,major:V9,minor:G9,patch:K9,prerelease:H9,compare:W9,rcompare:J9,compareLoose:X9,compareBuild:Y9,sort:Q9,rsort:eq,gt:tq,lt:rq,eq:nq,neq:oq,gte:iq,lte:sq,cmp:aq,coerce:cq,Comparator:uq,Range:lq,satisfies:dq,toComparators:pq,maxSatisfying:fq,minSatisfying:mq,minVersion:hq,validRange:gq,outside:_q,gtr:yq,ltr:vq,intersects:bq,simplifyRange:wq,subset:xq,SemVer:L9,re:Jx.re,src:Jx.src,tokens:Jx.t,SEMVER_SPEC_VERSION:tR.SEMVER_SPEC_VERSION,RELEASE_TYPES:tR.RELEASE_TYPES,compareIdentifiers:rR.compareIdentifiers,rcompareIdentifiers:rR.rcompareIdentifiers}});var IR=P((Ghe,$R)=>{"use strict";var wR=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,xR=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function qq(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",e.color.ansi256=wR(),e.color.ansi16m=xR(),e.bgColor.ansi256=wR(10),e.bgColor.ansi16m=xR(10),Object.defineProperties(e,{rgbToAnsi256:{value:(r,n,o)=>r===n&&n===o?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:o}=n.groups;o.length===3&&(o=o.split("").map(s=>s+s).join(""));let i=Number.parseInt(o,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:r=>e.rgbToAnsi256(...e.hexToRgb(r)),enumerable:!1}}),e}Object.defineProperty($R,"exports",{enumerable:!0,get:qq})});var KM=P(dv=>{"use strict";dv.byteLength=AW;dv.toByteArray=PW;dv.fromByteArray=NW;var So=[],Sn=[],EW=typeof Uint8Array<"u"?Uint8Array:Array,BI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Va=0,VM=BI.length;Va0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function AW(t){var e=GM(t),r=e[0],n=e[1];return(r+n)*3/4-n}function OW(t,e,r){return(e+r)*3/4-r}function PW(t){var e,r=GM(t),n=r[0],o=r[1],i=new EW(OW(t,n,o)),s=0,a=o>0?n-4:n,c;for(c=0;c>16&255,i[s++]=e>>8&255,i[s++]=e&255;return o===2&&(e=Sn[t.charCodeAt(c)]<<2|Sn[t.charCodeAt(c+1)]>>4,i[s++]=e&255),o===1&&(e=Sn[t.charCodeAt(c)]<<10|Sn[t.charCodeAt(c+1)]<<4|Sn[t.charCodeAt(c+2)]>>2,i[s++]=e>>8&255,i[s++]=e&255),i}function CW(t){return So[t>>18&63]+So[t>>12&63]+So[t>>6&63]+So[t&63]}function RW(t,e,r){for(var n,o=[],i=e;ia?a:s+i));return n===1?(e=t[r-1],o.push(So[e>>2]+So[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(So[e>>10]+So[e>>4&63]+So[e<<2&63]+"=")),o.join("")}});var Cf=P(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.regexpCode=Fe.getEsmExportName=Fe.getProperty=Fe.safeStringify=Fe.stringify=Fe.strConcat=Fe.addCodeArg=Fe.str=Fe._=Fe.nil=Fe._Code=Fe.Name=Fe.IDENTIFIER=Fe._CodeOrName=void 0;var Of=class{};Fe._CodeOrName=Of;Fe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Qa=class extends Of{constructor(e){if(super(),!Fe.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Fe.Name=Qa;var Tn=class extends Of{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Qa&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Fe._Code=Tn;Fe.nil=new Tn("");function Xj(t,...e){let r=[t[0]],n=0;for(;n{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.ValueScope=Br.ValueScopeName=Br.Scope=Br.varKinds=Br.UsedValueState=void 0;var Fr=Cf(),DS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Hv;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Hv||(Br.UsedValueState=Hv={}));Br.varKinds={const:new Fr.Name("const"),let:new Fr.Name("let"),var:new Fr.Name("var")};var Wv=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Fr.Name?e:this.name(e)}name(e){return new Fr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Br.Scope=Wv;var Jv=class extends Fr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Fr._)`.${new Fr.Name(r)}[${n}]`}};Br.ValueScopeName=Jv;var z7=(0,Fr._)`\n`,LS=class extends Wv{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?z7:Fr.nil}}get(){return this._scope}name(e){return new Jv(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:i}=o,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[i];if(a){let l=a.get(s);if(l)return l}else a=this._values[i]=new Map;a.set(s,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Fr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let i=Fr.nil;for(let s in e){let a=e[s];if(!a)continue;let c=n[s]=n[s]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Hv.Started);let l=r(u);if(l){let d=this.opts.es5?Br.varKinds.var:Br.varKinds.const;i=(0,Fr._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Fr._)`${i}${l}${this.opts._n}`;else throw new DS(u);c.set(u,Hv.Completed)})}return i}};Br.ValueScope=LS});var Oe=P(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.or=Ce.and=Ce.not=Ce.CodeGen=Ce.operators=Ce.varKinds=Ce.ValueScopeName=Ce.ValueScope=Ce.Scope=Ce.Name=Ce.regexpCode=Ce.stringify=Ce.getProperty=Ce.nil=Ce.strConcat=Ce.str=Ce._=void 0;var Le=Cf(),Xn=US(),_s=Cf();Object.defineProperty(Ce,"_",{enumerable:!0,get:function(){return _s._}});Object.defineProperty(Ce,"str",{enumerable:!0,get:function(){return _s.str}});Object.defineProperty(Ce,"strConcat",{enumerable:!0,get:function(){return _s.strConcat}});Object.defineProperty(Ce,"nil",{enumerable:!0,get:function(){return _s.nil}});Object.defineProperty(Ce,"getProperty",{enumerable:!0,get:function(){return _s.getProperty}});Object.defineProperty(Ce,"stringify",{enumerable:!0,get:function(){return _s.stringify}});Object.defineProperty(Ce,"regexpCode",{enumerable:!0,get:function(){return _s.regexpCode}});Object.defineProperty(Ce,"Name",{enumerable:!0,get:function(){return _s.Name}});var eb=US();Object.defineProperty(Ce,"Scope",{enumerable:!0,get:function(){return eb.Scope}});Object.defineProperty(Ce,"ValueScope",{enumerable:!0,get:function(){return eb.ValueScope}});Object.defineProperty(Ce,"ValueScopeName",{enumerable:!0,get:function(){return eb.ValueScopeName}});Object.defineProperty(Ce,"varKinds",{enumerable:!0,get:function(){return eb.varKinds}});Ce.operators={GT:new Le._Code(">"),GTE:new Le._Code(">="),LT:new Le._Code("<"),LTE:new Le._Code("<="),EQ:new Le._Code("==="),NEQ:new Le._Code("!=="),NOT:new Le._Code("!"),OR:new Le._Code("||"),AND:new Le._Code("&&"),ADD:new Le._Code("+")};var di=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},FS=class extends di{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Xn.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Sl(this.rhs,e,r)),this}get names(){return this.rhs instanceof Le._CodeOrName?this.rhs.names:{}}},Xv=class extends di{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Le.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Sl(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Le.Name?{}:{...this.lhs.names};return Qv(e,this.rhs)}},BS=class extends Xv{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},ZS=class extends di{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qS=class extends di{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},VS=class extends di{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},GS=class extends di{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Sl(this.code,e,r),this}get names(){return this.code instanceof Le._CodeOrName?this.code.names:{}}},Rf=class extends di{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(e,r)||(M7(e,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rc(e,r.names),{})}},pi=class extends Rf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},KS=class extends Rf{},Il=class extends pi{};Il.kind="else";var ec=class t extends pi{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Il(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Qj(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Sl(this.condition,e,r),this}get names(){let e=super.names;return Qv(e,this.condition),this.else&&rc(e,this.else.names),e}};ec.kind="if";var tc=class extends pi{};tc.kind="for";var HS=class extends tc{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Sl(this.iteration,e,r),this}get names(){return rc(super.names,this.iteration.names)}},WS=class extends tc{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?Xn.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=Qv(super.names,this.from);return Qv(e,this.to)}},Yv=class extends tc{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Sl(this.iterable,e,r),this}get names(){return rc(super.names,this.iterable.names)}},Nf=class extends pi{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Nf.kind="func";var zf=class extends Rf{render(e){return"return "+super.render(e)}};zf.kind="return";var JS=class extends pi{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rc(e,this.catch.names),this.finally&&rc(e,this.finally.names),e}},Mf=class extends pi{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Mf.kind="catch";var jf=class extends pi{render(e){return"finally"+super.render(e)}};jf.kind="finally";var XS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?` +`:""},this._extScope=e,this._scope=new Xn.Scope({parent:e}),this._nodes=[new KS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new FS(e,i,n)),i}const(e,r,n){return this._def(Xn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Xn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Xn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Xv(e,r,n))}add(e,r){return this._leafNode(new BS(e,Ce.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Le.nil&&this._leafNode(new GS(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Le.addCodeArg)(r,o));return r.push("}"),new Le._Code(r)}if(e,r,n){if(this._blockNode(new ec(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ec(e))}else(){return this._elseNode(new Il)}endIf(){return this._endBlockNode(ec,Il)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new HS(e),r)}forRange(e,r,n,o,i=this.opts.es5?Xn.varKinds.var:Xn.varKinds.let){let s=this._scope.toName(e);return this._for(new WS(i,s,r,n),()=>o(s))}forOf(e,r,n,o=Xn.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let s=r instanceof Le.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Le._)`${s}.length`,a=>{this.var(i,(0,Le._)`${s}[${a}]`),n(i)})}return this._for(new Yv("of",o,i,r),()=>n(i))}forIn(e,r,n,o=this.opts.es5?Xn.varKinds.var:Xn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Le._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new Yv("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(tc)}label(e){return this._leafNode(new ZS(e))}break(e){return this._leafNode(new qS(e))}return(e){let r=new zf;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(zf)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new JS;if(this._blockNode(o),this.code(e),r){let i=this.name("e");this._currNode=o.catch=new Mf(i),r(i)}return n&&(this._currNode=o.finally=new jf,this.code(n)),this._endBlockNode(Mf,jf)}throw(e){return this._leafNode(new VS(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Le.nil,n,o){return this._blockNode(new Nf(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Nf)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof ec))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ce.CodeGen=XS;function rc(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Qv(t,e){return e instanceof Le._CodeOrName?rc(t,e.names):t}function Sl(t,e,r){if(t instanceof Le.Name)return n(t);if(!o(t))return t;return new Le._Code(t._items.reduce((i,s)=>(s instanceof Le.Name&&(s=n(s)),s instanceof Le._Code?i.push(...s._items):i.push(s),i),[]));function n(i){let s=r[i.str];return s===void 0||e[i.str]!==1?i:(delete e[i.str],s)}function o(i){return i instanceof Le._Code&&i._items.some(s=>s instanceof Le.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function M7(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Qj(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Le._)`!${YS(t)}`}Ce.not=Qj;var j7=eD(Ce.operators.AND);function D7(...t){return t.reduce(j7)}Ce.and=D7;var L7=eD(Ce.operators.OR);function U7(...t){return t.reduce(L7)}Ce.or=U7;function eD(t){return(e,r)=>e===Le.nil?r:r===Le.nil?e:(0,Le._)`${YS(e)} ${t} ${YS(r)}`}function YS(t){return t instanceof Le.Name?t:(0,Le._)`(${t})`}});var Be=P(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.checkStrictMode=Ne.getErrorPath=Ne.Type=Ne.useFunc=Ne.setEvaluated=Ne.evaluatedPropsToName=Ne.mergeEvaluated=Ne.eachItem=Ne.unescapeJsonPointer=Ne.escapeJsonPointer=Ne.escapeFragment=Ne.unescapeFragment=Ne.schemaRefOrVal=Ne.schemaHasRulesButRef=Ne.schemaHasRules=Ne.checkUnknownRules=Ne.alwaysValidSchema=Ne.toHash=void 0;var rt=Oe(),F7=Cf();function B7(t){let e={};for(let r of t)e[r]=!0;return e}Ne.toHash=B7;function Z7(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(nD(t,e),!oD(e,t.self.RULES.all))}Ne.alwaysValidSchema=Z7;function nD(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let i in e)o[i]||aD(t,`unknown keyword: "${i}"`)}Ne.checkUnknownRules=nD;function oD(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Ne.schemaHasRules=oD;function q7(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Ne.schemaHasRulesButRef=q7;function V7({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,rt._)`${r}`}return(0,rt._)`${t}${e}${(0,rt.getProperty)(n)}`}Ne.schemaRefOrVal=V7;function G7(t){return iD(decodeURIComponent(t))}Ne.unescapeFragment=G7;function K7(t){return encodeURIComponent(ek(t))}Ne.escapeFragment=K7;function ek(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Ne.escapeJsonPointer=ek;function iD(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Ne.unescapeJsonPointer=iD;function H7(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Ne.eachItem=H7;function tD({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,i,s,a)=>{let c=s===void 0?i:s instanceof rt.Name?(i instanceof rt.Name?t(o,i,s):e(o,i,s),s):i instanceof rt.Name?(e(o,s,i),i):r(i,s);return a===rt.Name&&!(c instanceof rt.Name)?n(o,c):c}}Ne.mergeEvaluated={props:tD({mergeNames:(t,e,r)=>t.if((0,rt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,rt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,rt._)`${r} || {}`).code((0,rt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,rt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,rt._)`${r} || {}`),tk(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:sD}),items:tD({mergeNames:(t,e,r)=>t.if((0,rt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,rt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,rt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,rt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function sD(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,rt._)`{}`);return e!==void 0&&tk(t,r,e),r}Ne.evaluatedPropsToName=sD;function tk(t,e,r){Object.keys(r).forEach(n=>t.assign((0,rt._)`${e}${(0,rt.getProperty)(n)}`,!0))}Ne.setEvaluated=tk;var rD={};function W7(t,e){return t.scopeValue("func",{ref:e,code:rD[e.code]||(rD[e.code]=new F7._Code(e.code))})}Ne.useFunc=W7;var QS;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(QS||(Ne.Type=QS={}));function J7(t,e,r){if(t instanceof rt.Name){let n=e===QS.Num;return r?n?(0,rt._)`"[" + ${t} + "]"`:(0,rt._)`"['" + ${t} + "']"`:n?(0,rt._)`"/" + ${t}`:(0,rt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,rt.getProperty)(t).toString():"/"+ek(t)}Ne.getErrorPath=J7;function aD(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Ne.checkStrictMode=aD});var fi=P(rk=>{"use strict";Object.defineProperty(rk,"__esModule",{value:!0});var ur=Oe(),X7={data:new ur.Name("data"),valCxt:new ur.Name("valCxt"),instancePath:new ur.Name("instancePath"),parentData:new ur.Name("parentData"),parentDataProperty:new ur.Name("parentDataProperty"),rootData:new ur.Name("rootData"),dynamicAnchors:new ur.Name("dynamicAnchors"),vErrors:new ur.Name("vErrors"),errors:new ur.Name("errors"),this:new ur.Name("this"),self:new ur.Name("self"),scope:new ur.Name("scope"),json:new ur.Name("json"),jsonPos:new ur.Name("jsonPos"),jsonLen:new ur.Name("jsonLen"),jsonPart:new ur.Name("jsonPart")};rk.default=X7});var Df=P(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.extendErrors=lr.resetErrorsCount=lr.reportExtraError=lr.reportError=lr.keyword$DataError=lr.keywordError=void 0;var Ue=Oe(),tb=Be(),kr=fi();lr.keywordError={message:({keyword:t})=>(0,Ue.str)`must pass "${t}" keyword validation`};lr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ue.str)`"${t}" keyword must be ${e} ($data)`:(0,Ue.str)`"${t}" keyword is invalid ($data)`};function Y7(t,e=lr.keywordError,r,n){let{it:o}=t,{gen:i,compositeRule:s,allErrors:a}=o,c=lD(t,e,r);n??(s||a)?cD(i,c):uD(o,(0,Ue._)`[${c}]`)}lr.reportError=Y7;function Q7(t,e=lr.keywordError,r){let{it:n}=t,{gen:o,compositeRule:i,allErrors:s}=n,a=lD(t,e,r);cD(o,a),i||s||uD(n,kr.default.vErrors)}lr.reportExtraError=Q7;function eX(t,e){t.assign(kr.default.errors,e),t.if((0,Ue._)`${kr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ue._)`${kr.default.vErrors}.length`,e),()=>t.assign(kr.default.vErrors,null)))}lr.resetErrorsCount=eX;function tX({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",o,kr.default.errors,a=>{t.const(s,(0,Ue._)`${kr.default.vErrors}[${a}]`),t.if((0,Ue._)`${s}.instancePath === undefined`,()=>t.assign((0,Ue._)`${s}.instancePath`,(0,Ue.strConcat)(kr.default.instancePath,i.errorPath))),t.assign((0,Ue._)`${s}.schemaPath`,(0,Ue.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,Ue._)`${s}.schema`,r),t.assign((0,Ue._)`${s}.data`,n))})}lr.extendErrors=tX;function cD(t,e){let r=t.const("err",e);t.if((0,Ue._)`${kr.default.vErrors} === null`,()=>t.assign(kr.default.vErrors,(0,Ue._)`[${r}]`),(0,Ue._)`${kr.default.vErrors}.push(${r})`),t.code((0,Ue._)`${kr.default.errors}++`)}function uD(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,Ue._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ue._)`${n}.errors`,e),r.return(!1))}var nc={keyword:new Ue.Name("keyword"),schemaPath:new Ue.Name("schemaPath"),params:new Ue.Name("params"),propertyName:new Ue.Name("propertyName"),message:new Ue.Name("message"),schema:new Ue.Name("schema"),parentSchema:new Ue.Name("parentSchema")};function lD(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Ue._)`{}`:rX(t,e,r)}function rX(t,e,r={}){let{gen:n,it:o}=t,i=[nX(o,r),oX(t,r)];return iX(t,e,i),n.object(...i)}function nX({errorPath:t},{instancePath:e}){let r=e?(0,Ue.str)`${t}${(0,tb.getErrorPath)(e,tb.Type.Str)}`:t;return[kr.default.instancePath,(0,Ue.strConcat)(kr.default.instancePath,r)]}function oX({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,Ue.str)`${e}/${t}`;return r&&(o=(0,Ue.str)`${o}${(0,tb.getErrorPath)(r,tb.Type.Str)}`),[nc.schemaPath,o]}function iX(t,{params:e,message:r},n){let{keyword:o,data:i,schemaValue:s,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([nc.keyword,o],[nc.params,typeof e=="function"?e(t):e||(0,Ue._)`{}`]),c.messages&&n.push([nc.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([nc.schema,s],[nc.parentSchema,(0,Ue._)`${l}${d}`],[kr.default.data,i]),u&&n.push([nc.propertyName,u])}});var pD=P(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.boolOrEmptySchema=kl.topBoolOrEmptySchema=void 0;var sX=Df(),aX=Oe(),cX=fi(),uX={message:"boolean schema is false"};function lX(t){let{gen:e,schema:r,validateName:n}=t;r===!1?dD(t,!1):typeof r=="object"&&r.$async===!0?e.return(cX.default.data):(e.assign((0,aX._)`${n}.errors`,null),e.return(!0))}kl.topBoolOrEmptySchema=lX;function dX(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),dD(t)):r.var(e,!0)}kl.boolOrEmptySchema=dX;function dD(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,sX.reportError)(o,uX,void 0,e)}});var nk=P(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.getRules=Tl.isJSONType=void 0;var pX=["string","number","integer","boolean","null","object","array"],fX=new Set(pX);function mX(t){return typeof t=="string"&&fX.has(t)}Tl.isJSONType=mX;function hX(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Tl.getRules=hX});var ok=P(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.shouldUseRule=ys.shouldUseGroup=ys.schemaHasRulesForType=void 0;function gX({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&fD(t,n)}ys.schemaHasRulesForType=gX;function fD(t,e){return e.rules.some(r=>mD(t,r))}ys.shouldUseGroup=fD;function mD(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ys.shouldUseRule=mD});var Lf=P(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.reportTypeError=dr.checkDataTypes=dr.checkDataType=dr.coerceAndCheckDataType=dr.getJSONTypes=dr.getSchemaTypes=dr.DataType=void 0;var _X=nk(),yX=ok(),vX=Df(),Te=Oe(),hD=Be(),El;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(El||(dr.DataType=El={}));function bX(t){let e=gD(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}dr.getSchemaTypes=bX;function gD(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(_X.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}dr.getJSONTypes=gD;function wX(t,e){let{gen:r,data:n,opts:o}=t,i=xX(e,o.coerceTypes),s=e.length>0&&!(i.length===0&&e.length===1&&(0,yX.schemaHasRulesForType)(t,e[0]));if(s){let a=sk(e,n,o.strictNumbers,El.Wrong);r.if(a,()=>{i.length?$X(t,e,i):ak(t)})}return s}dr.coerceAndCheckDataType=wX;var _D=new Set(["string","number","integer","boolean","null"]);function xX(t,e){return e?t.filter(r=>_D.has(r)||e==="array"&&r==="array"):[]}function $X(t,e,r){let{gen:n,data:o,opts:i}=t,s=n.let("dataType",(0,Te._)`typeof ${o}`),a=n.let("coerced",(0,Te._)`undefined`);i.coerceTypes==="array"&&n.if((0,Te._)`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,Te._)`${o}[0]`).assign(s,(0,Te._)`typeof ${o}`).if(sk(e,o,i.strictNumbers),()=>n.assign(a,o))),n.if((0,Te._)`${a} !== undefined`);for(let u of r)(_D.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),ak(t),n.endIf(),n.if((0,Te._)`${a} !== undefined`,()=>{n.assign(o,a),IX(t,a)});function c(u){switch(u){case"string":n.elseIf((0,Te._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,Te._)`"" + ${o}`).elseIf((0,Te._)`${o} === null`).assign(a,(0,Te._)`""`);return;case"number":n.elseIf((0,Te._)`${s} == "boolean" || ${o} === null + || (${s} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,Te._)`+${o}`);return;case"integer":n.elseIf((0,Te._)`${s} === "boolean" || ${o} === null + || (${s} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,Te._)`+${o}`);return;case"boolean":n.elseIf((0,Te._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,Te._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,Te._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,Te._)`${s} === "string" || ${s} === "number" + || ${s} === "boolean" || ${o} === null`).assign(a,(0,Te._)`[${o}]`)}}}function IX({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Te._)`${e} !== undefined`,()=>t.assign((0,Te._)`${e}[${r}]`,n))}function ik(t,e,r,n=El.Correct){let o=n===El.Correct?Te.operators.EQ:Te.operators.NEQ,i;switch(t){case"null":return(0,Te._)`${e} ${o} null`;case"array":i=(0,Te._)`Array.isArray(${e})`;break;case"object":i=(0,Te._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=s((0,Te._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=s();break;default:return(0,Te._)`typeof ${e} ${o} ${t}`}return n===El.Correct?i:(0,Te.not)(i);function s(a=Te.nil){return(0,Te.and)((0,Te._)`typeof ${e} == "number"`,a,r?(0,Te._)`isFinite(${e})`:Te.nil)}}dr.checkDataType=ik;function sk(t,e,r,n){if(t.length===1)return ik(t[0],e,r,n);let o,i=(0,hD.toHash)(t);if(i.array&&i.object){let s=(0,Te._)`typeof ${e} != "object"`;o=i.null?s:(0,Te._)`!${e} || ${s}`,delete i.null,delete i.array,delete i.object}else o=Te.nil;i.number&&delete i.integer;for(let s in i)o=(0,Te.and)(o,ik(s,e,r,n));return o}dr.checkDataTypes=sk;var SX={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Te._)`{type: ${t}}`:(0,Te._)`{type: ${e}}`};function ak(t){let e=kX(t);(0,vX.reportError)(e,SX)}dr.reportTypeError=ak;function kX(t){let{gen:e,data:r,schema:n}=t,o=(0,hD.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var vD=P(rb=>{"use strict";Object.defineProperty(rb,"__esModule",{value:!0});rb.assignDefaults=void 0;var Al=Oe(),TX=Be();function EX(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)yD(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,i)=>yD(t,i,o.default))}rb.assignDefaults=EX;function yD(t,e,r){let{gen:n,compositeRule:o,data:i,opts:s}=t;if(r===void 0)return;let a=(0,Al._)`${i}${(0,Al.getProperty)(e)}`;if(o){(0,TX.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Al._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,Al._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Al._)`${a} = ${(0,Al.stringify)(r)}`)}});var En=P(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.validateUnion=Xe.validateArray=Xe.usePattern=Xe.callValidateCode=Xe.schemaProperties=Xe.allSchemaProperties=Xe.noPropertyInData=Xe.propertyInData=Xe.isOwnProperty=Xe.hasPropFunc=Xe.reportMissingProp=Xe.checkMissingProp=Xe.checkReportMissingProp=void 0;var ut=Oe(),ck=Be(),vs=fi(),AX=Be();function OX(t,e){let{gen:r,data:n,it:o}=t;r.if(lk(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,ut._)`${e}`},!0),t.error()})}Xe.checkReportMissingProp=OX;function PX({gen:t,data:e,it:{opts:r}},n,o){return(0,ut.or)(...n.map(i=>(0,ut.and)(lk(t,e,i,r.ownProperties),(0,ut._)`${o} = ${i}`)))}Xe.checkMissingProp=PX;function CX(t,e){t.setParams({missingProperty:e},!0),t.error()}Xe.reportMissingProp=CX;function bD(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ut._)`Object.prototype.hasOwnProperty`})}Xe.hasPropFunc=bD;function uk(t,e,r){return(0,ut._)`${bD(t)}.call(${e}, ${r})`}Xe.isOwnProperty=uk;function RX(t,e,r,n){let o=(0,ut._)`${e}${(0,ut.getProperty)(r)} !== undefined`;return n?(0,ut._)`${o} && ${uk(t,e,r)}`:o}Xe.propertyInData=RX;function lk(t,e,r,n){let o=(0,ut._)`${e}${(0,ut.getProperty)(r)} === undefined`;return n?(0,ut.or)(o,(0,ut.not)(uk(t,e,r))):o}Xe.noPropertyInData=lk;function wD(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Xe.allSchemaProperties=wD;function NX(t,e){return wD(e).filter(r=>!(0,ck.alwaysValidSchema)(t,e[r]))}Xe.schemaProperties=NX;function zX({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:s},a,c,u){let l=u?(0,ut._)`${t}, ${e}, ${n}${o}`:e,d=[[vs.default.instancePath,(0,ut.strConcat)(vs.default.instancePath,i)],[vs.default.parentData,s.parentData],[vs.default.parentDataProperty,s.parentDataProperty],[vs.default.rootData,vs.default.rootData]];s.opts.dynamicRef&&d.push([vs.default.dynamicAnchors,vs.default.dynamicAnchors]);let f=(0,ut._)`${l}, ${r.object(...d)}`;return c!==ut.nil?(0,ut._)`${a}.call(${c}, ${f})`:(0,ut._)`${a}(${f})`}Xe.callValidateCode=zX;var MX=(0,ut._)`new RegExp`;function jX({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,i=o(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ut._)`${o.code==="new RegExp"?MX:(0,AX.useFunc)(t,o)}(${r}, ${n})`})}Xe.usePattern=jX;function DX(t){let{gen:e,data:r,keyword:n,it:o}=t,i=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(i,!0),s(()=>e.break()),i;function s(a){let c=e.const("len",(0,ut._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:ck.Type.Num},i),e.if((0,ut.not)(i),a)})}}Xe.validateArray=DX;function LX(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,ck.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(s,(0,ut._)`${s} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,ut.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}Xe.validateUnion=LX});var ID=P(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.validateKeywordUsage=Eo.validSchemaType=Eo.funcKeywordCode=Eo.macroKeywordCode=void 0;var Tr=Oe(),oc=fi(),UX=En(),FX=Df();function BX(t,e){let{gen:r,keyword:n,schema:o,parentSchema:i,it:s}=t,a=e.macro.call(s.self,o,i,s),c=$D(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:Tr.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Eo.macroKeywordCode=BX;function ZX(t,e){var r;let{gen:n,keyword:o,schema:i,parentSchema:s,$data:a,it:c}=t;VX(c,e);let u=!a&&e.compile?e.compile.call(c.self,i,s,c):e.validate,l=$D(n,o,u),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&xD(t),_(()=>t.error());else{let v=e.async?p():m();e.modifying&&xD(t),_(()=>qX(t,v))}}function p(){let v=n.let("ruleErrs",null);return n.try(()=>h((0,Tr._)`await `),b=>n.assign(d,!1).if((0,Tr._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,Tr._)`${b}.errors`),()=>n.throw(b))),v}function m(){let v=(0,Tr._)`${l}.errors`;return n.assign(v,null),h(Tr.nil),v}function h(v=e.async?(0,Tr._)`await `:Tr.nil){let b=c.opts.passContext?oc.default.this:oc.default.self,x=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Tr._)`${v}${(0,UX.callValidateCode)(t,l,b,x)}`,e.modifying)}function _(v){var b;n.if((0,Tr.not)((b=e.valid)!==null&&b!==void 0?b:d),v)}}Eo.funcKeywordCode=ZX;function xD(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Tr._)`${n.parentData}[${n.parentDataProperty}]`))}function qX(t,e){let{gen:r}=t;r.if((0,Tr._)`Array.isArray(${e})`,()=>{r.assign(oc.default.vErrors,(0,Tr._)`${oc.default.vErrors} === null ? ${e} : ${oc.default.vErrors}.concat(${e})`).assign(oc.default.errors,(0,Tr._)`${oc.default.vErrors}.length`),(0,FX.extendErrors)(t)},()=>t.error())}function VX({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function $D(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Tr.stringify)(r)})}function GX(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Eo.validSchemaType=GX;function KX({schema:t,opts:e,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let s=o.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Eo.validateKeywordUsage=KX});var kD=P(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.extendSubschemaMode=bs.extendSubschemaData=bs.getSubschema=void 0;var Ao=Oe(),SD=Be();function HX(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ao._)`${t.schemaPath}${(0,Ao.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ao._)`${t.schemaPath}${(0,Ao.getProperty)(e)}${(0,Ao.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,SD.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:s,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}bs.getSubschema=HX;function WX(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:s}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,f=a.let("data",(0,Ao._)`${e.data}${(0,Ao.getProperty)(r)}`,!0);c(f),t.errorPath=(0,Ao.str)`${u}${(0,SD.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ao._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Ao.Name?o:a.let("data",o,!0);c(u),s!==void 0&&(t.propertyName=s)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}bs.extendSubschemaData=WX;function JX(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}bs.extendSubschemaMode=JX});var dk=P((Z2e,TD)=>{"use strict";TD.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var s=i[o];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var AD=P((q2e,ED)=>{"use strict";var ws=ED.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};nb(e,n,o,t,"",t)};ws.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ws.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ws.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ws.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function nb(t,e,r,n,o,i,s,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,i,s,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ws.arrayKeywords)for(var f=0;f{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.getSchemaRefs=Zr.resolveUrl=Zr.normalizeId=Zr._getFullPath=Zr.getFullPath=Zr.inlineRef=void 0;var YX=Be(),QX=dk(),eY=AD(),tY=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function rY(t,e=!0){return typeof t=="boolean"?!0:e===!0?!pk(t):e?OD(t)<=e:!1}Zr.inlineRef=rY;var nY=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function pk(t){for(let e in t){if(nY.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(pk)||typeof r=="object"&&pk(r))return!0}return!1}function OD(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!tY.has(r)&&(typeof t[r]=="object"&&(0,YX.eachItem)(t[r],n=>e+=OD(n)),e===1/0))return 1/0}return e}function PD(t,e="",r){r!==!1&&(e=Ol(e));let n=t.parse(e);return CD(t,n)}Zr.getFullPath=PD;function CD(t,e){return t.serialize(e).split("#")[0]+"#"}Zr._getFullPath=CD;var oY=/#\/?$/;function Ol(t){return t?t.replace(oY,""):""}Zr.normalizeId=Ol;function iY(t,e,r){return r=Ol(r),t.resolve(e,r)}Zr.resolveUrl=iY;var sY=/^[a-z_][-a-z0-9._]*$/i;function aY(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Ol(t[r]||e),i={"":o},s=PD(n,o,!1),a={},c=new Set;return eY(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=s+f,_=i[m];typeof d[r]=="string"&&(_=v.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),i[f]=_;function v(x){let k=this.opts.uriResolver.resolve;if(x=Ol(_?k(_,x):x),c.has(x))throw l(x);c.add(x);let T=this.refs[x];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?u(d,T.schema,x):x!==Ol(h)&&(x[0]==="#"?(u(d,a[x],x),a[x]=d):this.refs[x]=h),x}function b(x){if(typeof x=="string"){if(!sY.test(x))throw new Error(`invalid anchor "${x}"`);v.call(this,`#${x}`)}}}),a;function u(d,f,p){if(f!==void 0&&!QX(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Zr.getSchemaRefs=aY});var Zf=P(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.getData=xs.KeywordCxt=xs.validateFunctionCode=void 0;var jD=pD(),RD=Lf(),mk=ok(),ob=Lf(),cY=vD(),Bf=ID(),fk=kD(),ae=Oe(),we=fi(),uY=Uf(),mi=Be(),Ff=Df();function lY(t){if(UD(t)&&(FD(t),LD(t))){fY(t);return}DD(t,()=>(0,jD.topBoolOrEmptySchema)(t))}xs.validateFunctionCode=lY;function DD({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,ae._)`${we.default.data}, ${we.default.valCxt}`,n.$async,()=>{t.code((0,ae._)`"use strict"; ${ND(r,o)}`),pY(t,o),t.code(i)}):t.func(e,(0,ae._)`${we.default.data}, ${dY(o)}`,n.$async,()=>t.code(ND(r,o)).code(i))}function dY(t){return(0,ae._)`{${we.default.instancePath}="", ${we.default.parentData}, ${we.default.parentDataProperty}, ${we.default.rootData}=${we.default.data}${t.dynamicRef?(0,ae._)`, ${we.default.dynamicAnchors}={}`:ae.nil}}={}`}function pY(t,e){t.if(we.default.valCxt,()=>{t.var(we.default.instancePath,(0,ae._)`${we.default.valCxt}.${we.default.instancePath}`),t.var(we.default.parentData,(0,ae._)`${we.default.valCxt}.${we.default.parentData}`),t.var(we.default.parentDataProperty,(0,ae._)`${we.default.valCxt}.${we.default.parentDataProperty}`),t.var(we.default.rootData,(0,ae._)`${we.default.valCxt}.${we.default.rootData}`),e.dynamicRef&&t.var(we.default.dynamicAnchors,(0,ae._)`${we.default.valCxt}.${we.default.dynamicAnchors}`)},()=>{t.var(we.default.instancePath,(0,ae._)`""`),t.var(we.default.parentData,(0,ae._)`undefined`),t.var(we.default.parentDataProperty,(0,ae._)`undefined`),t.var(we.default.rootData,we.default.data),e.dynamicRef&&t.var(we.default.dynamicAnchors,(0,ae._)`{}`)})}function fY(t){let{schema:e,opts:r,gen:n}=t;DD(t,()=>{r.$comment&&e.$comment&&ZD(t),yY(t),n.let(we.default.vErrors,null),n.let(we.default.errors,0),r.unevaluated&&mY(t),BD(t),wY(t)})}function mY(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,ae._)`${r}.evaluated`),e.if((0,ae._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ae._)`${t.evaluated}.props`,(0,ae._)`undefined`)),e.if((0,ae._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ae._)`${t.evaluated}.items`,(0,ae._)`undefined`))}function ND(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,ae._)`/*# sourceURL=${r} */`:ae.nil}function hY(t,e){if(UD(t)&&(FD(t),LD(t))){gY(t,e);return}(0,jD.boolOrEmptySchema)(t,e)}function LD({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function UD(t){return typeof t.schema!="boolean"}function gY(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&ZD(t),vY(t),bY(t);let i=n.const("_errs",we.default.errors);BD(t,i),n.var(e,(0,ae._)`${i} === ${we.default.errors}`)}function FD(t){(0,mi.checkUnknownRules)(t),_Y(t)}function BD(t,e){if(t.opts.jtd)return zD(t,[],!1,e);let r=(0,RD.getSchemaTypes)(t.schema),n=(0,RD.coerceAndCheckDataType)(t,r);zD(t,r,!n,e)}function _Y(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,mi.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function yY(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,mi.checkStrictMode)(t,"default is ignored in the schema root")}function vY(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,uY.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function bY(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function ZD({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,ae._)`${we.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let s=(0,ae.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,ae._)`${we.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function wY(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=t;r.$async?e.if((0,ae._)`${we.default.errors} === 0`,()=>e.return(we.default.data),()=>e.throw((0,ae._)`new ${o}(${we.default.vErrors})`)):(e.assign((0,ae._)`${n}.errors`,we.default.vErrors),i.unevaluated&&xY(t),e.return((0,ae._)`${we.default.errors} === 0`))}function xY({gen:t,evaluated:e,props:r,items:n}){r instanceof ae.Name&&t.assign((0,ae._)`${e}.props`,r),n instanceof ae.Name&&t.assign((0,ae._)`${e}.items`,n)}function zD(t,e,r,n){let{gen:o,schema:i,data:s,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,mi.schemaHasRulesButRef)(i,l))){o.block(()=>VD(t,"$ref",l.all.$ref.definition));return}c.jtd||$Y(t,e),o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,mk.shouldUseGroup)(i,f)&&(f.type?(o.if((0,ob.checkDataType)(f.type,s,c.strictNumbers)),MD(t,f),e.length===1&&e[0]===f.type&&r&&(o.else(),(0,ob.reportTypeError)(t)),o.endIf()):MD(t,f),a||o.if((0,ae._)`${we.default.errors} === ${n||0}`))}}function MD(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,cY.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,mk.shouldUseRule)(n,i)&&VD(t,i.keyword,i.definition,e.type)})}function $Y(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(IY(t,e),t.opts.allowUnionTypes||SY(t,e),kY(t,t.dataTypes))}function IY(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{qD(t.dataTypes,r)||hk(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),EY(t,e)}}function SY(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&hk(t,"use allowUnionTypes to allow union type keyword")}function kY(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,mk.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(s=>TY(e,s))&&hk(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function TY(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function qD(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function EY(t,e){let r=[];for(let n of t.dataTypes)qD(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function hk(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,mi.checkStrictMode)(t,e,t.opts.strictTypes)}var ib=class{constructor(e,r,n){if((0,Bf.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,mi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",GD(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Bf.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",we.default.errors))}result(e,r,n){this.failResult((0,ae.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,ae.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,ae._)`${r} !== undefined && (${(0,ae.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Ff.reportExtraError:Ff.reportError)(this,this.def.error,r)}$dataError(){(0,Ff.reportError)(this,this.def.$dataError||Ff.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ff.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=ae.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=ae.nil,r=ae.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:s}=this;n.if((0,ae.or)((0,ae._)`${o} === undefined`,r)),e!==ae.nil&&n.assign(e,!0),(i.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==ae.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,ae.or)(s(),a());function s(){if(n.length){if(!(r instanceof ae.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,ae._)`${(0,ob.checkDataTypes)(c,r,i.opts.strictNumbers,ob.DataType.Wrong)}`}return ae.nil}function a(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,ae._)`!${c}(${r})`}return ae.nil}}subschema(e,r){let n=(0,fk.getSubschema)(this.it,e);(0,fk.extendSubschemaData)(n,this.it,e),(0,fk.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return hY(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=mi.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=mi.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,ae.Name)),!0}};xs.KeywordCxt=ib;function VD(t,e,r,n){let o=new ib(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Bf.funcKeywordCode)(o,r):"macro"in r?(0,Bf.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Bf.funcKeywordCode)(o,r)}var AY=/^\/(?:[^~]|~0|~1)*$/,OY=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function GD(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return we.default.rootData;if(t[0]==="/"){if(!AY.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=we.default.rootData}else{let u=OY.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!o)return i}let s=i,a=o.split("/");for(let u of a)u&&(i=(0,ae._)`${i}${(0,ae.getProperty)((0,mi.unescapeJsonPointer)(u))}`,s=(0,ae._)`${s} && ${i}`);return s;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}xs.getData=GD});var sb=P(_k=>{"use strict";Object.defineProperty(_k,"__esModule",{value:!0});var gk=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};_k.default=gk});var qf=P(bk=>{"use strict";Object.defineProperty(bk,"__esModule",{value:!0});var yk=Uf(),vk=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,yk.resolveUrl)(e,r,n),this.missingSchema=(0,yk.normalizeId)((0,yk.getFullPath)(e,this.missingRef))}};bk.default=vk});var cb=P(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.resolveSchema=An.getCompilingSchema=An.resolveRef=An.compileSchema=An.SchemaEnv=void 0;var Yn=Oe(),PY=sb(),ic=fi(),Qn=Uf(),KD=Be(),CY=Zf(),Pl=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Qn.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};An.SchemaEnv=Pl;function xk(t){let e=HD.call(this,t);if(e)return e;let r=(0,Qn.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,s=new Yn.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),a;t.$async&&(a=s.scopeValue("Error",{ref:PY.default,code:(0,Yn._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");t.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:ic.default.data,parentData:ic.default.parentData,parentDataProperty:ic.default.parentDataProperty,dataNames:[ic.default.data],dataPathArr:[Yn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Yn.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Yn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Yn._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,CY.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let d=s.toString();l=`${s.scopeRefs(ic.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let p=new Function(`${ic.default.self}`,`${ic.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=u;p.evaluated={props:m instanceof Yn.Name?void 0:m,items:h instanceof Yn.Name?void 0:h,dynamicProps:m instanceof Yn.Name,dynamicItems:h instanceof Yn.Name},p.source&&(p.source.evaluated=(0,Yn.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}An.compileSchema=xk;function RY(t,e,r){var n;r=(0,Qn.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let i=MY.call(this,t,r);if(i===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(i=new Pl({schema:s,schemaId:a,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=NY.call(this,i)}An.resolveRef=RY;function NY(t){return(0,Qn.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:xk.call(this,t)}function HD(t){for(let e of this._compilations)if(zY(e,t))return e}An.getCompilingSchema=HD;function zY(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function MY(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||ab.call(this,t,e)}function ab(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Qn._getFullPath)(this.opts.uriResolver,r),o=(0,Qn.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return wk.call(this,r,t);let i=(0,Qn.normalizeId)(n),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){let a=ab.call(this,t,s);return typeof a?.schema!="object"?void 0:wk.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||xk.call(this,s),i===(0,Qn.normalizeId)(e)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,Qn.resolveUrl)(this.opts.uriResolver,o,u)),new Pl({schema:a,schemaId:c,root:t,baseId:o})}return wk.call(this,r,s)}}An.resolveSchema=ab;var jY=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function wk(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,KD.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!jY.has(a)&&u&&(e=(0,Qn.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,KD.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Qn.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=ab.call(this,n,a)}let{schemaId:s}=this.opts;if(i=i||new Pl({schema:r,schemaId:s,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var WD=P((J2e,DY)=>{DY.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Ik=P((X2e,QD)=>{"use strict";var LY=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),XD=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function $k(t){let e="",r=0,n=0;for(n=0;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var UY=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function JD(t){return t.length=0,!0}function FY(t,e,r){if(t.length){let n=$k(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function BY(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,s=!1,a=FY;for(let c=0;c7){r.error=!0;break}c>0&&t[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=JD}else{o.push(u);continue}}return o.length&&(a===JD?r.zone=o.join(""):s?n.push(o.join("")):n.push($k(o))),r.address=n.join(""),r}function YD(t){if(ZY(t,":")<2)return{host:t,isIPV6:!1};let e=BY(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function ZY(t,e){let r=0;for(let n=0;n{"use strict";var{isUUID:KY}=Ik(),HY=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,WY=["http","https","ws","wss","urn","urn:uuid"];function JY(t){return WY.indexOf(t)!==-1}function Sk(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function eL(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function tL(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function XY(t){return t.secure=Sk(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function YY(t){if((t.port===(Sk(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function QY(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(HY);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,i=kk(o);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function eQ(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,i=kk(o);i&&(t=i.serialize(t,e));let s=t,a=t.nss;return s.path=`${n||e.nid}:${a}`,e.skipEscape=!0,s}function tQ(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!KY(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function rQ(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var rL={scheme:"http",domainHost:!0,parse:eL,serialize:tL},nQ={scheme:"https",domainHost:rL.domainHost,parse:eL,serialize:tL},ub={scheme:"ws",domainHost:!0,parse:XY,serialize:YY},oQ={scheme:"wss",domainHost:ub.domainHost,parse:ub.parse,serialize:ub.serialize},iQ={scheme:"urn",parse:QY,serialize:eQ,skipNormalize:!0},sQ={scheme:"urn:uuid",parse:tQ,serialize:rQ,skipNormalize:!0},lb={http:rL,https:nQ,ws:ub,wss:oQ,urn:iQ,"urn:uuid":sQ};Object.setPrototypeOf(lb,null);function kk(t){return t&&(lb[t]||lb[t.toLowerCase()])||void 0}nL.exports={wsIsSecure:Sk,SCHEMES:lb,isValidSchemeName:JY,getSchemeHandler:kk}});var aL=P((Q2e,pb)=>{"use strict";var{normalizeIPv6:aQ,removeDotSegments:Vf,recomposeAuthority:cQ,normalizeComponentEncoding:db,isIPv4:uQ,nonSimpleDomain:lQ}=Ik(),{SCHEMES:dQ,getSchemeHandler:iL}=oL();function pQ(t,e){return typeof t=="string"?t=Oo(hi(t,e),e):typeof t=="object"&&(t=hi(Oo(t,e),e)),t}function fQ(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=sL(hi(t,n),hi(e,n),n,!0);return n.skipEscape=!0,Oo(o,n)}function sL(t,e,r,n){let o={};return n||(t=hi(Oo(t,r),r),e=hi(Oo(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Vf(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Vf(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=Vf(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=Vf(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function mQ(t,e,r){return typeof t=="string"?(t=unescape(t),t=Oo(db(hi(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Oo(db(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Oo(db(hi(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Oo(db(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Oo(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],i=iL(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let s=cQ(r);if(s!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(s),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(a=Vf(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var hQ=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function hi(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(hQ);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(uQ(n.host)===!1){let c=aQ(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let s=iL(r.scheme||n.scheme);if(!r.unicodeSupport&&(!s||!s.unicodeSupport)&&n.host&&(r.domainHost||s&&s.domainHost)&&o===!1&&lQ(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!s||s&&!s.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),s&&s.parse&&s.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Tk={SCHEMES:dQ,normalize:pQ,resolve:fQ,resolveComponent:sL,equal:mQ,serialize:Oo,parse:hi};pb.exports=Tk;pb.exports.default=Tk;pb.exports.fastUri=Tk});var uL=P(Ek=>{"use strict";Object.defineProperty(Ek,"__esModule",{value:!0});var cL=aL();cL.code='require("ajv/dist/runtime/uri").default';Ek.default=cL});var _L=P(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.CodeGen=Xt.Name=Xt.nil=Xt.stringify=Xt.str=Xt._=Xt.KeywordCxt=void 0;var gQ=Zf();Object.defineProperty(Xt,"KeywordCxt",{enumerable:!0,get:function(){return gQ.KeywordCxt}});var Cl=Oe();Object.defineProperty(Xt,"_",{enumerable:!0,get:function(){return Cl._}});Object.defineProperty(Xt,"str",{enumerable:!0,get:function(){return Cl.str}});Object.defineProperty(Xt,"stringify",{enumerable:!0,get:function(){return Cl.stringify}});Object.defineProperty(Xt,"nil",{enumerable:!0,get:function(){return Cl.nil}});Object.defineProperty(Xt,"Name",{enumerable:!0,get:function(){return Cl.Name}});Object.defineProperty(Xt,"CodeGen",{enumerable:!0,get:function(){return Cl.CodeGen}});var _Q=sb(),mL=qf(),yQ=nk(),Gf=cb(),vQ=Oe(),Kf=Uf(),fb=Lf(),Ok=Be(),lL=WD(),bQ=uL(),hL=(t,e)=>new RegExp(t,e);hL.code="new RegExp";var wQ=["removeAdditional","useDefaults","coerceTypes"],xQ=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),$Q={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},IQ={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},dL=200;function SQ(t){var e,r,n,o,i,s,a,c,u,l,d,f,p,m,h,_,v,b,x,k,T,F,J,w,Z;let oe=t.strict,Q=(e=t.code)===null||e===void 0?void 0:e.optimize,wt=Q===!0||Q===void 0?1:Q||0,dn=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:hL,pn=(o=t.uriResolver)!==null&&o!==void 0?o:bQ.default;return{strictSchema:(s=(i=t.strictSchema)!==null&&i!==void 0?i:oe)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:oe)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:oe)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:oe)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:oe)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:wt,regExp:dn}:{optimize:wt,regExp:dn},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:dL,loopEnum:(_=t.loopEnum)!==null&&_!==void 0?_:dL,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(x=t.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(k=t.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(F=t.validateSchema)!==null&&F!==void 0?F:!0,validateFormats:(J=t.validateFormats)!==null&&J!==void 0?J:!0,unicodeRegExp:(w=t.unicodeRegExp)!==null&&w!==void 0?w:!0,int32range:(Z=t.int32range)!==null&&Z!==void 0?Z:!0,uriResolver:pn}}var Hf=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...SQ(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new vQ.ValueScope({scope:{},prefixes:xQ,es5:r,lines:n}),this.logger=PQ(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,yQ.getRules)(),pL.call(this,$Q,e,"NOT SUPPORTED"),pL.call(this,IQ,e,"DEPRECATED","warn"),this._metaOpts=AQ.call(this),e.formats&&TQ.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&EQ.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),kQ.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=lL;n==="id"&&(o={...lL},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await i.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||s.call(this,f)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof mL.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,o);return this}let i;if(typeof e=="object"){let{schemaId:s}=this.opts;if(i=e[s],i!==void 0&&typeof i!="string")throw new Error(`schema ${s} must be string`)}return r=(0,Kf.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(e){let r;for(;typeof(r=fL.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Gf.SchemaEnv({schema:{},schemaId:n});if(r=Gf.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=fL.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Kf.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(RQ.call(this,n,r),!r)return(0,Ok.eachItem)(n,i=>Ak.call(this,i)),this;zQ.call(this,r);let o={...r,type:(0,fb.getJSONTypes)(r.type),schemaType:(0,fb.getJSONTypes)(r.schemaType)};return(0,Ok.eachItem)(n,o.type.length===0?i=>Ak.call(this,i,o):i=>o.type.forEach(s=>Ak.call(this,i,o,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let i=o.split("/").slice(1),s=e;for(let a of i)s=s[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=s[a];u&&l&&(s[a]=gL(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Kf.normalizeId)(s||n);let u=Kf.getSchemaRefs.call(this,e,n);return c=new Gf.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Gf.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Gf.compileSchema.call(this,e)}finally{this.opts=r}}};Hf.ValidationError=_Q.default;Hf.MissingRefError=mL.default;Xt.default=Hf;function pL(t,e,r,n="error"){for(let o in t){let i=o;i in e&&this.logger[n](`${r}: option ${o}. ${t[i]}`)}}function fL(t){return t=(0,Kf.normalizeId)(t),this.schemas[t]||this.refs[t]}function kQ(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function TQ(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function EQ(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function AQ(){let t={...this.opts};for(let e of wQ)delete t[e];return t}var OQ={log(){},warn(){},error(){}};function PQ(t){if(t===!1)return OQ;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var CQ=/^[a-z_$][a-z0-9_$:-]*$/i;function RQ(t,e){let{RULES:r}=this;if((0,Ok.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!CQ.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Ak(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=o?i.post:i.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,fb.getJSONTypes)(e.type),schemaType:(0,fb.getJSONTypes)(e.schemaType)}};e.before?NQ.call(this,s,a,e.before):s.rules.push(a),i.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function NQ(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function zQ(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=gL(e)),t.validateSchema=this.compile(e,!0))}var MQ={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function gL(t){return{anyOf:[t,MQ]}}});var yL=P(Pk=>{"use strict";Object.defineProperty(Pk,"__esModule",{value:!0});var jQ={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Pk.default=jQ});var xL=P(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.callRef=sc.getValidate=void 0;var DQ=qf(),vL=En(),qr=Oe(),Rl=fi(),bL=cb(),mb=Be(),LQ={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:i,validateName:s,opts:a,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=bL.resolveRef.call(c,u,o,r);if(l===void 0)throw new DQ.default(n.opts.uriResolver,o,r);if(l instanceof bL.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return hb(t,s,i,i.$async);let m=e.scopeValue("root",{ref:u});return hb(t,(0,qr._)`${m}.validate`,u,u.$async)}function f(m){let h=wL(t,m);hb(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,qr.stringify)(m)}:{ref:m}),_=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:qr.nil,topSchemaRef:h,errSchemaPath:r},_);t.mergeEvaluated(v),t.ok(_)}}};function wL(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,qr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}sc.getValidate=wL;function hb(t,e,r,n){let{gen:o,it:i}=t,{allErrors:s,schemaEnv:a,opts:c}=i,u=c.passContext?Rl.default.this:qr.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{o.code((0,qr._)`await ${(0,vL.callValidateCode)(t,e,u)}`),p(e),s||o.assign(m,!0)},h=>{o.if((0,qr._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),f(h),s||o.assign(m,!1)}),t.ok(m)}function d(){t.result((0,vL.callValidateCode)(t,e,u),()=>p(e),()=>f(e))}function f(m){let h=(0,qr._)`${m}.errors`;o.assign(Rl.default.vErrors,(0,qr._)`${Rl.default.vErrors} === null ? ${h} : ${Rl.default.vErrors}.concat(${h})`),o.assign(Rl.default.errors,(0,qr._)`${Rl.default.vErrors}.length`)}function p(m){var h;if(!i.opts.unevaluated)return;let _=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(i.props=mb.mergeEvaluated.props(o,_.props,i.props));else{let v=o.var("props",(0,qr._)`${m}.evaluated.props`);i.props=mb.mergeEvaluated.props(o,v,i.props,qr.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=mb.mergeEvaluated.items(o,_.items,i.items));else{let v=o.var("items",(0,qr._)`${m}.evaluated.items`);i.items=mb.mergeEvaluated.items(o,v,i.items,qr.Name)}}}sc.callRef=hb;sc.default=LQ});var $L=P(Ck=>{"use strict";Object.defineProperty(Ck,"__esModule",{value:!0});var UQ=yL(),FQ=xL(),BQ=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",UQ.default,FQ.default];Ck.default=BQ});var IL=P(Rk=>{"use strict";Object.defineProperty(Rk,"__esModule",{value:!0});var gb=Oe(),$s=gb.operators,_b={maximum:{okStr:"<=",ok:$s.LTE,fail:$s.GT},minimum:{okStr:">=",ok:$s.GTE,fail:$s.LT},exclusiveMaximum:{okStr:"<",ok:$s.LT,fail:$s.GTE},exclusiveMinimum:{okStr:">",ok:$s.GT,fail:$s.LTE}},ZQ={message:({keyword:t,schemaCode:e})=>(0,gb.str)`must be ${_b[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,gb._)`{comparison: ${_b[t].okStr}, limit: ${e}}`},qQ={keyword:Object.keys(_b),type:"number",schemaType:"number",$data:!0,error:ZQ,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,gb._)`${r} ${_b[e].fail} ${n} || isNaN(${r})`)}};Rk.default=qQ});var SL=P(Nk=>{"use strict";Object.defineProperty(Nk,"__esModule",{value:!0});var Wf=Oe(),VQ={message:({schemaCode:t})=>(0,Wf.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Wf._)`{multipleOf: ${t}}`},GQ={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:VQ,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,i=o.opts.multipleOfPrecision,s=e.let("res"),a=i?(0,Wf._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:(0,Wf._)`${s} !== parseInt(${s})`;t.fail$data((0,Wf._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};Nk.default=GQ});var TL=P(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});function kL(t){let e=t.length,r=0,n=0,o;for(;n=55296&&o<=56319&&n{"use strict";Object.defineProperty(Mk,"__esModule",{value:!0});var ac=Oe(),KQ=Be(),HQ=TL(),WQ={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,ac.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,ac._)`{limit: ${t}}`},JQ={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:WQ,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,i=e==="maxLength"?ac.operators.GT:ac.operators.LT,s=o.opts.unicode===!1?(0,ac._)`${r}.length`:(0,ac._)`${(0,KQ.useFunc)(t.gen,HQ.default)}(${r})`;t.fail$data((0,ac._)`${s} ${i} ${n}`)}};Mk.default=JQ});var AL=P(jk=>{"use strict";Object.defineProperty(jk,"__esModule",{value:!0});var XQ=En(),yb=Oe(),YQ={message:({schemaCode:t})=>(0,yb.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,yb._)`{pattern: ${t}}`},QQ={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:YQ,code(t){let{data:e,$data:r,schema:n,schemaCode:o,it:i}=t,s=i.opts.unicodeRegExp?"u":"",a=r?(0,yb._)`(new RegExp(${o}, ${s}))`:(0,XQ.usePattern)(t,n);t.fail$data((0,yb._)`!${a}.test(${e})`)}};jk.default=QQ});var OL=P(Dk=>{"use strict";Object.defineProperty(Dk,"__esModule",{value:!0});var Jf=Oe(),eee={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Jf.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Jf._)`{limit: ${t}}`},tee={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:eee,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Jf.operators.GT:Jf.operators.LT;t.fail$data((0,Jf._)`Object.keys(${r}).length ${o} ${n}`)}};Dk.default=tee});var PL=P(Lk=>{"use strict";Object.defineProperty(Lk,"__esModule",{value:!0});var Xf=En(),Yf=Oe(),ree=Be(),nee={message:({params:{missingProperty:t}})=>(0,Yf.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Yf._)`{missingProperty: ${t}}`},oee={keyword:"required",type:"object",schemaType:"array",$data:!0,error:nee,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:i,it:s}=t,{opts:a}=s;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?u():l(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let _=s.schemaEnv.baseId+s.errSchemaPath,v=`required property "${h}" is not defined at "${_}" (strictRequired)`;(0,ree.checkStrictMode)(s,v,s.opts.strictRequired)}}function u(){if(c||i)t.block$data(Yf.nil,d);else for(let p of r)(0,Xf.checkReportMissingProp)(t,p)}function l(){let p=e.let("missing");if(c||i){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,Xf.checkMissingProp)(t,r,p)),(0,Xf.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Xf.noPropertyInData)(e,o,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,Xf.propertyInData)(e,o,p,a.ownProperties)),e.if((0,Yf.not)(m),()=>{t.error(),e.break()})},Yf.nil)}}};Lk.default=oee});var CL=P(Uk=>{"use strict";Object.defineProperty(Uk,"__esModule",{value:!0});var Qf=Oe(),iee={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Qf.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Qf._)`{limit: ${t}}`},see={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:iee,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Qf.operators.GT:Qf.operators.LT;t.fail$data((0,Qf._)`${r}.length ${o} ${n}`)}};Uk.default=see});var vb=P(Fk=>{"use strict";Object.defineProperty(Fk,"__esModule",{value:!0});var RL=dk();RL.code='require("ajv/dist/runtime/equal").default';Fk.default=RL});var NL=P(Zk=>{"use strict";Object.defineProperty(Zk,"__esModule",{value:!0});var Bk=Lf(),Yt=Oe(),aee=Be(),cee=vb(),uee={message:({params:{i:t,j:e}})=>(0,Yt.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Yt._)`{i: ${t}, j: ${e}}`},lee={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:uee,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:i,schemaCode:s,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=i.items?(0,Bk.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Yt._)`${s} === false`),t.ok(c);function l(){let m=e.let("i",(0,Yt._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,Yt._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,h){let _=e.name("item"),v=(0,Bk.checkDataTypes)(u,_,a.opts.strictNumbers,Bk.DataType.Wrong),b=e.const("indices",(0,Yt._)`{}`);e.for((0,Yt._)`;${m}--;`,()=>{e.let(_,(0,Yt._)`${r}[${m}]`),e.if(v,(0,Yt._)`continue`),u.length>1&&e.if((0,Yt._)`typeof ${_} == "string"`,(0,Yt._)`${_} += "_"`),e.if((0,Yt._)`typeof ${b}[${_}] == "number"`,()=>{e.assign(h,(0,Yt._)`${b}[${_}]`),t.error(),e.assign(c,!1).break()}).code((0,Yt._)`${b}[${_}] = ${m}`)})}function p(m,h){let _=(0,aee.useFunc)(e,cee.default),v=e.name("outer");e.label(v).for((0,Yt._)`;${m}--;`,()=>e.for((0,Yt._)`${h} = ${m}; ${h}--;`,()=>e.if((0,Yt._)`${_}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Zk.default=lee});var zL=P(Vk=>{"use strict";Object.defineProperty(Vk,"__esModule",{value:!0});var qk=Oe(),dee=Be(),pee=vb(),fee={message:"must be equal to constant",params:({schemaCode:t})=>(0,qk._)`{allowedValue: ${t}}`},mee={keyword:"const",$data:!0,error:fee,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,qk._)`!${(0,dee.useFunc)(e,pee.default)}(${r}, ${o})`):t.fail((0,qk._)`${i} !== ${r}`)}};Vk.default=mee});var ML=P(Gk=>{"use strict";Object.defineProperty(Gk,"__esModule",{value:!0});var em=Oe(),hee=Be(),gee=vb(),_ee={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,em._)`{allowedValues: ${t}}`},yee={keyword:"enum",schemaType:"array",$data:!0,error:_ee,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:s}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=s.opts.loopEnum,c,u=()=>c??(c=(0,hee.useFunc)(e,gee.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let p=e.const("vSchema",i);l=(0,em.or)(...o.map((m,h)=>f(p,h)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,p=>e.if((0,em._)`${u()}(${r}, ${p})`,()=>e.assign(l,!0).break()))}function f(p,m){let h=o[m];return typeof h=="object"&&h!==null?(0,em._)`${u()}(${r}, ${p}[${m}])`:(0,em._)`${r} === ${h}`}}};Gk.default=yee});var jL=P(Kk=>{"use strict";Object.defineProperty(Kk,"__esModule",{value:!0});var vee=IL(),bee=SL(),wee=EL(),xee=AL(),$ee=OL(),Iee=PL(),See=CL(),kee=NL(),Tee=zL(),Eee=ML(),Aee=[vee.default,bee.default,wee.default,xee.default,$ee.default,Iee.default,See.default,kee.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Tee.default,Eee.default];Kk.default=Aee});var Wk=P(tm=>{"use strict";Object.defineProperty(tm,"__esModule",{value:!0});tm.validateAdditionalItems=void 0;var cc=Oe(),Hk=Be(),Oee={message:({params:{len:t}})=>(0,cc.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,cc._)`{limit: ${t}}`},Pee={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Oee,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Hk.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}DL(t,n)}};function DL(t,e){let{gen:r,schema:n,data:o,keyword:i,it:s}=t;s.items=!0;let a=r.const("len",(0,cc._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,cc._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Hk.alwaysValidSchema)(s,n)){let u=r.var("valid",(0,cc._)`${a} <= ${e.length}`);r.if((0,cc.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:Hk.Type.Num},u),s.allErrors||r.if((0,cc.not)(u),()=>r.break())})}}tm.validateAdditionalItems=DL;tm.default=Pee});var Jk=P(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});rm.validateTuple=void 0;var LL=Oe(),bb=Be(),Cee=En(),Ree={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return UL(t,"additionalItems",e);r.items=!0,!(0,bb.alwaysValidSchema)(r,e)&&t.ok((0,Cee.validateArray)(t))}};function UL(t,e,r=t.schema){let{gen:n,parentSchema:o,data:i,keyword:s,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=bb.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,LL._)`${i}.length`);r.forEach((d,f)=>{(0,bb.alwaysValidSchema)(a,d)||(n.if((0,LL._)`${u} > ${f}`,()=>t.subschema({keyword:s,schemaProp:f,dataProp:f},c)),t.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let _=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,bb.checkStrictMode)(a,_,f.strictTuples)}}}rm.validateTuple=UL;rm.default=Ree});var FL=P(Xk=>{"use strict";Object.defineProperty(Xk,"__esModule",{value:!0});var Nee=Jk(),zee={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Nee.validateTuple)(t,"items")};Xk.default=zee});var ZL=P(Yk=>{"use strict";Object.defineProperty(Yk,"__esModule",{value:!0});var BL=Oe(),Mee=Be(),jee=En(),Dee=Wk(),Lee={message:({params:{len:t}})=>(0,BL.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,BL._)`{limit: ${t}}`},Uee={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Lee,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,Mee.alwaysValidSchema)(n,e)&&(o?(0,Dee.validateAdditionalItems)(t,o):t.ok((0,jee.validateArray)(t)))}};Yk.default=Uee});var qL=P(Qk=>{"use strict";Object.defineProperty(Qk,"__esModule",{value:!0});var On=Oe(),wb=Be(),Fee={message:({params:{min:t,max:e}})=>e===void 0?(0,On.str)`must contain at least ${t} valid item(s)`:(0,On.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,On._)`{minContains: ${t}}`:(0,On._)`{minContains: ${t}, maxContains: ${e}}`},Bee={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Fee,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t,s,a,{minContains:c,maxContains:u}=n;i.opts.next?(s=c===void 0?1:c,a=u):s=1;let l=e.const("len",(0,On._)`${o}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,wb.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,wb.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,wb.alwaysValidSchema)(i,r)){let h=(0,On._)`${l} >= ${s}`;a!==void 0&&(h=(0,On._)`${h} && ${l} <= ${a}`),t.pass(h);return}i.items=!0;let d=e.name("valid");a===void 0&&s===1?p(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,On._)`${o}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),_=e.let("count",0);p(h,()=>e.if(h,()=>m(_)))}function p(h,_){e.forRange("i",0,l,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:wb.Type.Num,compositeRule:!0},h),_()})}function m(h){e.code((0,On._)`${h}++`),a===void 0?e.if((0,On._)`${h} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,On._)`${h} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,On._)`${h} >= ${s}`,()=>e.assign(d,!0)))}}};Qk.default=Bee});var KL=P(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.validateSchemaDeps=Po.validatePropertyDeps=Po.error=void 0;var eT=Oe(),Zee=Be(),nm=En();Po.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,eT.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,eT._)`{property: ${t}, + missingProperty: ${n}, + depsCount: ${e}, + deps: ${r}}`};var qee={keyword:"dependencies",type:"object",schemaType:"object",error:Po.error,code(t){let[e,r]=Vee(t);VL(t,e),GL(t,r)}};function Vee({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function VL(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let c=(0,nm.propertyInData)(r,n,s,o.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,nm.checkReportMissingProp)(t,u)}):(r.if((0,eT._)`${c} && (${(0,nm.checkMissingProp)(t,a,i)})`),(0,nm.reportMissingProp)(t,i),r.else())}}Po.validatePropertyDeps=VL;function GL(t,e=t.schema){let{gen:r,data:n,keyword:o,it:i}=t,s=r.name("valid");for(let a in e)(0,Zee.alwaysValidSchema)(i,e[a])||(r.if((0,nm.propertyInData)(r,n,a,i.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},s);t.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),t.ok(s))}Po.validateSchemaDeps=GL;Po.default=qee});var WL=P(tT=>{"use strict";Object.defineProperty(tT,"__esModule",{value:!0});var HL=Oe(),Gee=Be(),Kee={message:"property name must be valid",params:({params:t})=>(0,HL._)`{propertyName: ${t.propertyName}}`},Hee={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Kee,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,Gee.alwaysValidSchema)(o,r))return;let i=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),e.if((0,HL.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};tT.default=Hee});var nT=P(rT=>{"use strict";Object.defineProperty(rT,"__esModule",{value:!0});var xb=En(),eo=Oe(),Wee=fi(),$b=Be(),Jee={message:"must NOT have additional properties",params:({params:t})=>(0,eo._)`{additionalProperty: ${t.additionalProperty}}`},Xee={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Jee,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,$b.alwaysValidSchema)(s,r))return;let u=(0,xb.allSchemaProperties)(n.properties),l=(0,xb.allSchemaProperties)(n.patternProperties);d(),t.ok((0,eo._)`${i} === ${Wee.default.errors}`);function d(){e.forIn("key",o,_=>{!u.length&&!l.length?m(_):e.if(f(_),()=>m(_))})}function f(_){let v;if(u.length>8){let b=(0,$b.schemaRefOrVal)(s,n.properties,"properties");v=(0,xb.isOwnProperty)(e,b,_)}else u.length?v=(0,eo.or)(...u.map(b=>(0,eo._)`${_} === ${b}`)):v=eo.nil;return l.length&&(v=(0,eo.or)(v,...l.map(b=>(0,eo._)`${(0,xb.usePattern)(t,b)}.test(${_})`))),(0,eo.not)(v)}function p(_){e.code((0,eo._)`delete ${o}[${_}]`)}function m(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(_);return}if(r===!1){t.setParams({additionalProperty:_}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,$b.alwaysValidSchema)(s,r)){let v=e.name("valid");c.removeAdditional==="failing"?(h(_,v,!1),e.if((0,eo.not)(v),()=>{t.reset(),p(_)})):(h(_,v),a||e.if((0,eo.not)(v),()=>e.break()))}}function h(_,v,b){let x={keyword:"additionalProperties",dataProp:_,dataPropType:$b.Type.Str};b===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,v)}}};rT.default=Xee});var YL=P(iT=>{"use strict";Object.defineProperty(iT,"__esModule",{value:!0});var Yee=Zf(),JL=En(),oT=Be(),XL=nT(),Qee={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&XL.default.code(new Yee.KeywordCxt(i,XL.default,"additionalProperties"));let s=(0,JL.allSchemaProperties)(r);for(let d of s)i.definedProperties.add(d);i.opts.unevaluated&&s.length&&i.props!==!0&&(i.props=oT.mergeEvaluated.props(e,(0,oT.toHash)(s),i.props));let a=s.filter(d=>!(0,oT.alwaysValidSchema)(i,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,JL.propertyInData)(e,o,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};iT.default=Qee});var rU=P(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0});var QL=En(),Ib=Oe(),eU=Be(),tU=Be(),ete={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:i}=t,{opts:s}=i,a=(0,QL.allSchemaProperties)(r),c=a.filter(h=>(0,eU.alwaysValidSchema)(i,r[h]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&o.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof Ib.Name)&&(i.props=(0,tU.evaluatedPropsToName)(e,i.props));let{props:d}=i;f();function f(){for(let h of a)u&&p(h),i.allErrors?m(h):(e.var(l,!0),m(h),e.if(l))}function p(h){for(let _ in u)new RegExp(h).test(_)&&(0,eU.checkStrictMode)(i,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,_=>{e.if((0,Ib._)`${(0,QL.usePattern)(t,h)}.test(${_})`,()=>{let v=c.includes(h);v||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:tU.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,Ib._)`${d}[${_}]`,!0):!v&&!i.allErrors&&e.if((0,Ib.not)(l),()=>e.break())})})}}};sT.default=ete});var nU=P(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});var tte=Be(),rte={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,tte.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};aT.default=rte});var oU=P(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});var nte=En(),ote={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:nte.validateUnion,error:{message:"must match a schema in anyOf"}};cT.default=ote});var iU=P(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});var Sb=Oe(),ite=Be(),ste={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Sb._)`{passingSchemas: ${t.passing}}`},ate={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:ste,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,s=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(s,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let f;(0,ite.alwaysValidSchema)(o,l)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Sb._)`${c} && ${s}`).assign(s,!1).assign(a,(0,Sb._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(s,!0),e.assign(a,d),f&&t.mergeEvaluated(f,Sb.Name)})})}}};uT.default=ate});var sU=P(lT=>{"use strict";Object.defineProperty(lT,"__esModule",{value:!0});var cte=Be(),ute={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((i,s)=>{if((0,cte.alwaysValidSchema)(n,i))return;let a=t.subschema({keyword:"allOf",schemaProp:s},o);t.ok(o),t.mergeEvaluated(a)})}};lT.default=ute});var uU=P(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0});var kb=Oe(),cU=Be(),lte={message:({params:t})=>(0,kb.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,kb._)`{failingKeyword: ${t.ifClause}}`},dte={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:lte,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,cU.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=aU(n,"then"),i=aU(n,"else");if(!o&&!i)return;let s=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else o?e.if(a,u("then")):e.if((0,kb.not)(a),u("else"));t.pass(s,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let f=t.subschema({keyword:l},a);e.assign(s,a),t.mergeValidEvaluated(f,s),d?e.assign(d,(0,kb._)`${l}`):t.setParams({ifClause:l})}}}};function aU(t,e){let r=t.schema[e];return r!==void 0&&!(0,cU.alwaysValidSchema)(t,r)}dT.default=dte});var lU=P(pT=>{"use strict";Object.defineProperty(pT,"__esModule",{value:!0});var pte=Be(),fte={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,pte.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};pT.default=fte});var dU=P(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});var mte=Wk(),hte=FL(),gte=Jk(),_te=ZL(),yte=qL(),vte=KL(),bte=WL(),wte=nT(),xte=YL(),$te=rU(),Ite=nU(),Ste=oU(),kte=iU(),Tte=sU(),Ete=uU(),Ate=lU();function Ote(t=!1){let e=[Ite.default,Ste.default,kte.default,Tte.default,Ete.default,Ate.default,bte.default,wte.default,vte.default,xte.default,$te.default];return t?e.push(hte.default,_te.default):e.push(mte.default,gte.default),e.push(yte.default),e}fT.default=Ote});var pU=P(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});var kt=Oe(),Pte={message:({schemaCode:t})=>(0,kt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,kt._)`{format: ${t}}`},Cte={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Pte,code(t,e){let{gen:r,data:n,$data:o,schema:i,schemaCode:s,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,kt._)`${m}[${s}]`),_=r.let("fType"),v=r.let("format");r.if((0,kt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(_,(0,kt._)`${h}.type || "string"`).assign(v,(0,kt._)`${h}.validate`),()=>r.assign(_,(0,kt._)`"string"`).assign(v,h)),t.fail$data((0,kt.or)(b(),x()));function b(){return c.strictSchema===!1?kt.nil:(0,kt._)`${s} && !${v}`}function x(){let k=l.$async?(0,kt._)`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,kt._)`${v}(${n})`,T=(0,kt._)`(typeof ${v} == "function" ? ${k} : ${v}.test(${n}))`;return(0,kt._)`${v} && ${v} !== true && ${_} === ${e} && !${T}`}}function p(){let m=d.formats[i];if(!m){b();return}if(m===!0)return;let[h,_,v]=x(m);h===e&&t.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function x(T){let F=T instanceof RegExp?(0,kt.regexpCode)(T):c.code.formats?(0,kt._)`${c.code.formats}${(0,kt.getProperty)(i)}`:void 0,J=r.scopeValue("formats",{key:i,ref:T,code:F});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,kt._)`${J}.validate`]:["string",T,J]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,kt._)`await ${v}(${n})`}return typeof _=="function"?(0,kt._)`${v}(${n})`:(0,kt._)`${v}.test(${n})`}}}};mT.default=Cte});var fU=P(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});var Rte=pU(),Nte=[Rte.default];hT.default=Nte});var mU=P(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.contentVocabulary=Nl.metadataVocabulary=void 0;Nl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Nl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var gU=P(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});var zte=$L(),Mte=jL(),jte=dU(),Dte=fU(),hU=mU(),Lte=[zte.default,Mte.default,(0,jte.default)(),Dte.default,hU.metadataVocabulary,hU.contentVocabulary];gT.default=Lte});var yU=P(Tb=>{"use strict";Object.defineProperty(Tb,"__esModule",{value:!0});Tb.DiscrError=void 0;var _U;(function(t){t.Tag="tag",t.Mapping="mapping"})(_U||(Tb.DiscrError=_U={}))});var bU=P(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});var zl=Oe(),_T=yU(),vU=cb(),Ute=qf(),Fte=Be(),Bte={message:({params:{discrError:t,tagName:e}})=>t===_T.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,zl._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},Zte={keyword:"discriminator",type:"object",schemaType:"object",error:Bte,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:i}=t,{oneOf:s}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,zl._)`${r}${(0,zl.getProperty)(a)}`);e.if((0,zl._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:_T.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,zl._)`${u} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:_T.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(h,zl.Name),m}function f(){var p;let m={},h=v(o),_=!0;for(let k=0;k{qte.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var bT=P((lt,vT)=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.MissingRefError=lt.ValidationError=lt.CodeGen=lt.Name=lt.nil=lt.stringify=lt.str=lt._=lt.KeywordCxt=lt.Ajv=void 0;var Vte=_L(),Gte=gU(),Kte=bU(),xU=wU(),Hte=["/properties"],Eb="http://json-schema.org/draft-07/schema",Ml=class extends Vte.default{_addVocabularies(){super._addVocabularies(),Gte.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Kte.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(xU,Hte):xU;this.addMetaSchema(e,Eb,!1),this.refs["http://json-schema.org/schema"]=Eb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Eb)?Eb:void 0)}};lt.Ajv=Ml;vT.exports=lt=Ml;vT.exports.Ajv=Ml;Object.defineProperty(lt,"__esModule",{value:!0});lt.default=Ml;var Wte=Zf();Object.defineProperty(lt,"KeywordCxt",{enumerable:!0,get:function(){return Wte.KeywordCxt}});var jl=Oe();Object.defineProperty(lt,"_",{enumerable:!0,get:function(){return jl._}});Object.defineProperty(lt,"str",{enumerable:!0,get:function(){return jl.str}});Object.defineProperty(lt,"stringify",{enumerable:!0,get:function(){return jl.stringify}});Object.defineProperty(lt,"nil",{enumerable:!0,get:function(){return jl.nil}});Object.defineProperty(lt,"Name",{enumerable:!0,get:function(){return jl.Name}});Object.defineProperty(lt,"CodeGen",{enumerable:!0,get:function(){return jl.CodeGen}});var Jte=sb();Object.defineProperty(lt,"ValidationError",{enumerable:!0,get:function(){return Jte.default}});var Xte=qf();Object.defineProperty(lt,"MissingRefError",{enumerable:!0,get:function(){return Xte.default}})});var OU=P(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.formatNames=Ro.fastFormats=Ro.fullFormats=void 0;function Co(t,e){return{validate:t,compare:e}}Ro.fullFormats={date:Co(kU,IT),time:Co(xT(!0),ST),"date-time":Co($U(!0),EU),"iso-time":Co(xT(),TU),"iso-date-time":Co($U(),AU),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:nre,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:lre,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:ore,int32:{type:"number",validate:are},int64:{type:"number",validate:cre},float:{type:"number",validate:SU},double:{type:"number",validate:SU},password:!0,binary:!0};Ro.fastFormats={...Ro.fullFormats,date:Co(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,IT),time:Co(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ST),"date-time":Co(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,EU),"iso-time":Co(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,TU),"iso-date-time":Co(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,AU),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Ro.formatNames=Object.keys(Ro.fullFormats);function Yte(t){return t%4===0&&(t%100!==0||t%400===0)}var Qte=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,ere=[0,31,28,31,30,31,30,31,31,30,31,30,31];function kU(t){let e=Qte.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&Yte(r)?29:ere[n])}function IT(t,e){if(t&&e)return t>e?1:t23||l>59||t&&!a)return!1;if(o<=23&&i<=59&&s<60)return!0;let d=i-l*c,f=o-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&s<61}}function ST(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function TU(t,e){if(!(t&&e))return;let r=wT.exec(t),n=wT.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t=ire}function cre(t){return Number.isInteger(t)}function SU(){return!0}var ure=/[^\\]\\Z/;function lre(t){if(ure.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var PU=P(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.formatLimitDefinition=void 0;var dre=bT(),to=Oe(),Is=to.operators,Ab={formatMaximum:{okStr:"<=",ok:Is.LTE,fail:Is.GT},formatMinimum:{okStr:">=",ok:Is.GTE,fail:Is.LT},formatExclusiveMaximum:{okStr:"<",ok:Is.LT,fail:Is.GTE},formatExclusiveMinimum:{okStr:">",ok:Is.GT,fail:Is.LTE}},pre={message:({keyword:t,schemaCode:e})=>(0,to.str)`should be ${Ab[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,to._)`{comparison: ${Ab[t].okStr}, limit: ${e}}`};Dl.formatLimitDefinition={keyword:Object.keys(Ab),type:"string",schemaType:"string",$data:!0,error:pre,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:i}=t,{opts:s,self:a}=i;if(!s.validateFormats)return;let c=new dre.KeywordCxt(i,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),p=e.const("fmt",(0,to._)`${f}[${c.schemaCode}]`);t.fail$data((0,to.or)((0,to._)`typeof ${p} != "object"`,(0,to._)`${p} instanceof RegExp`,(0,to._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${f}" does not define "compare" function`);let m=e.scopeValue("formats",{key:f,ref:p,code:s.code.formats?(0,to._)`${s.code.formats}${(0,to.getProperty)(f)}`:void 0});t.fail$data(d(m))}function d(f){return(0,to._)`${f}.compare(${r}, ${n}) ${Ab[o].fail} 0`}},dependencies:["format"]};var fre=t=>(t.addKeyword(Dl.formatLimitDefinition),t);Dl.default=fre});var zU=P((om,NU)=>{"use strict";Object.defineProperty(om,"__esModule",{value:!0});var Ll=OU(),mre=PU(),kT=Oe(),CU=new kT.Name("fullFormats"),hre=new kT.Name("fastFormats"),TT=(t,e={keywords:!0})=>{if(Array.isArray(e))return RU(t,e,Ll.fullFormats,CU),t;let[r,n]=e.mode==="fast"?[Ll.fastFormats,hre]:[Ll.fullFormats,CU],o=e.formats||Ll.formatNames;return RU(t,o,r,n),e.keywords&&(0,mre.default)(t),t};TT.get=(t,e="full")=>{let n=(e==="fast"?Ll.fastFormats:Ll.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function RU(t,e,r,n){var o,i;(o=(i=t.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,kT._)`require("ajv-formats/dist/formats").${n}`);for(let s of e)t.addFormat(s,r[s])}NU.exports=om=TT;Object.defineProperty(om,"__esModule",{value:!0});om.default=TT});var Mb={PRETTY:4,COMPACT:0};var Ke={TRACE:6,DEBUG:8,INFO:12,WARN:16,ERROR:20,CRITICAL:24,SILENT:28},OT=["level","message","sampling_rate","service","timestamp"],PT="Uncaught error detected, flushing log buffer before exit";var ql={REQUEST_ID:Symbol.for("_AWS_LAMBDA_REQUEST_ID"),X_RAY_TRACE_ID:Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),TENANT_ID:Symbol.for("_AWS_LAMBDA_TENANT_ID")},jb=["true","1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??"");jb||(globalThis.awslambda=globalThis.awslambda||{});var sm=class{static PROTECTED_KEYS=ql;isProtectedKey(e){return Object.values(ql).includes(e)}getRequestId(){return this.get(ql.REQUEST_ID)??"-"}getXRayTraceId(){return this.get(ql.X_RAY_TRACE_ID)}getTenantId(){return this.get(ql.TENANT_ID)}},Db=class extends sm{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==void 0}get(e){return this.currentContext?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);this.currentContext=this.currentContext||{},this.currentContext[e]=r}run(e,r){this.currentContext=e;try{return r()}finally{this.currentContext=void 0}}},Lb=class t extends sm{als;static async create(){let e=new t,r=await import("node:async_hooks");return e.als=new r.AsyncLocalStorage,e}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==void 0}get(e){return this.als.getStore()?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);let n=this.als.getStore();if(!n)throw new Error("No context available");n[e]=r}run(e,r){return this.als.run(e,r)}},CT;(function(t){let e=null;async function r(){return e||(e=(async()=>{let o="AWS_LAMBDA_MAX_CONCURRENCY"in process.env?await Lb.create():new Db;return!jb&&globalThis.awslambda?.InvokeStore?globalThis.awslambda.InvokeStore:(!jb&&globalThis.awslambda&&(globalThis.awslambda.InvokeStore=o),o)})()),e}t.getInstanceAsync=r,t._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE==="1"?{reset:()=>{e=null,globalThis.awslambda?.InvokeStore&&delete globalThis.awslambda.InvokeStore,globalThis.awslambda={}}}:void 0})(CT||(CT={}));var RT="AWS_LAMBDA_MAX_CONCURRENCY",NT="POWERTOOLS_DEV";var zT="_X_AMZN_TRACE_ID";var Vr=({key:t,defaultValue:e,errorMessage:r})=>{let n=process.env[t];if(n===void 0){if(e!==void 0)return e;throw r?new Error(r):new Error(`Environment variable ${t} is required`)}return n.trim()},MT=({key:t,defaultValue:e,errorMessage:r})=>{let n=Vr({key:t,defaultValue:String(e),errorMessage:r}),o=Number(n);if(Number.isNaN(o))throw new TypeError(`Environment variable ${t} must be a number`);return o},KU=new Set(["1","y","yes","t","true","on"]),HU=new Set(["0","n","no","f","false","off"]),Ub=({key:t,defaultValue:e,errorMessage:r,extendedParsing:n})=>{let i=Vr({key:t,defaultValue:String(e),errorMessage:r}).toLowerCase();if(n){if(KU.has(i))return!0;if(HU.has(i))return!1}if(i!=="true"&&i!=="false")throw new Error(`Environment variable ${t} must be a boolean`);return i==="true"},Vl=()=>{try{return Ub({key:NT,extendedParsing:!0})}catch{return!1}};var WU=()=>{let t=globalThis.awslambda?.InvokeStore?.getXRayTraceId()??Vr({key:zT,defaultValue:""});if(t==="")return;if(!t.includes("="))return{Root:t};let e={};for(let r of t.split(";")){let[n,o]=r.split("=");e[n]=o}return e};var am=()=>Vr({key:RT,defaultValue:""})!=="",Gl=()=>WU()?.Root;var Es=class{formatError(e){let{name:r,message:n,stack:o,cause:i,...s}=e,a={name:r,location:this.getCodeLocation(e.stack),message:n,stack:Vl()&&typeof o=="string"?o?.split(` +`):o,cause:i instanceof Error?this.formatError(i):i};for(let c in e)typeof c=="string"&&!["name","message","stack","cause"].includes(c)&&(a[c]=s[c]);return a}formatTimestamp(e){let n=Vr({key:"TZ",defaultValue:""});return n&&!n.includes("UTC")?this.#r(e,n):e.toISOString()}getCodeLocation(e){if(!e)return"";let r=e.split(` +`),n=/\(([^()]*?):(\d+?):(\d+?)\)\\?$/;for(let o of r){let i=n.exec(o);if(Array.isArray(i))return`${i[1]}:${Number(i[2])}`}return""}#e=e=>{let r="2-digit",n=Intl.supportedValuesOf("timeZone").includes(e)?e:"UTC";return new Intl.DateTimeFormat("en",{hourCycle:"h23",year:"numeric",month:r,day:r,hour:r,minute:r,second:r,timeZone:n})};#r(e,r){let{year:n,month:o,day:i,hour:s,minute:a,second:c}=this.#e(r).formatToParts(e).reduce((_,v)=>(_[v.type]=v.value,_),{}),u=`${n}-${o}-${i}T${s}:${a}:${c}`,l=-e.getTimezoneOffset(),d=l>=0?"+":"-",f=Math.abs(Math.floor(l/60)).toString().padStart(2,"0"),p=Math.abs(l%60).toString().padStart(2,"0"),m=e.getMilliseconds().toString().padStart(3,"0"),h=`${d}${f}:${p}`;return`${u}.${m}${h}`}};var dE=mn(Xb(),1),_i=class{attributes={};constructor(e){this.setAttributes(e.attributes)}addAttributes(e){return(0,dE.default)(this.attributes,e),this}getAttributes(){return this.attributes}prepareForPrint(){this.attributes=this.removeEmptyKeys(this.getAttributes())}removeEmptyKeys(e){let r={};for(let n in e)e[n]!==void 0&&e[n]!==""&&e[n]!==null&&(r[n]=e[n]);return r}setAttributes(e){this.attributes=e}};import{Console as B2}from"node:console";import{randomInt as Z2}from"node:crypto";var Yl="2.29.0";var Rre=process.env.AWS_EXECUTION_ENV||"NA";var gm="powertools-for-aws",pE=`${gm}.tracer`,fE=`${gm}.metrics`,mE=`${gm}.logger`,hE=`${gm}.idempotency`;var Yb=t=>typeof t=="string";var gE=t=>Object.is(t,null),Qb=t=>gE(t)||Object.is(t,void 0);var Ql=class{#e;coldStart=!0;defaultServiceName="service_undefined";constructor(){this.#e=this.getInitializationType(),this.#e!=="on-demand"&&(this.coldStart=!1)}getInitializationType(){let e=process.env.AWS_LAMBDA_INITIALIZATION_TYPE?.trim();return e==="on-demand"?"on-demand":e==="provisioned-concurrency"?"provisioned-concurrency":"unknown"}getColdStart(){return this.#e!=="on-demand"?!1:this.coldStart?(this.coldStart=!1,!0):!1}isValidServiceName(e){return typeof e=="string"&&e.trim().length>0}};var _E=process.env.AWS_EXECUTION_ENV||"NA";process.env.AWS_SDK_UA_APP_ID?process.env.AWS_SDK_UA_APP_ID=`${process.env.AWS_SDK_UA_APP_ID}/PT/NO-OP/${Yl}/PTEnv/${_E}`:process.env.AWS_SDK_UA_APP_ID=`PT/NO-OP/${Yl}/PTEnv/${_E}`;var bm=mn(Xb(),1);var _m=class extends Es{#e;constructor(e){super(),this.#e=e?.logRecordOrder}formatAttributes(e,r){let n={level:e.logLevel,message:e.message,timestamp:this.formatTimestamp(e.timestamp),service:e.serviceName,cold_start:e.lambdaContext?.coldStart,function_arn:e.lambdaContext?.invokedFunctionArn,function_memory_size:e.lambdaContext?.memoryLimitInMB,function_name:e.lambdaContext?.functionName,function_request_id:e.lambdaContext?.awsRequestId,sampling_rate:e.sampleRateValue,xray_trace_id:e.xRayTraceId};if(this.#e===void 0)return new _i({attributes:n}).addAttributes(r);let o={};for(let s of this.#e)s in n&&!(s in o)?o[s]=n[s]:s in r&&!(s in o)&&(o[s]=r[s]);for(let s in n)s in o||(o[s]=n[s]);for(let s in r)s in o||(o[s]=r[s]);return new _i({attributes:o})}};var ym=class{#e=Symbol("powertools.logger.temporaryAttributes");#r=Symbol("powertools.logger.keys");#i={};#c=new Map;#n={};#o(){if(!am())return this.#i;if(globalThis.awslambda?.InvokeStore===void 0)throw new Error("InvokeStore is not available");let e=globalThis.awslambda.InvokeStore,r=e.get(this.#e);return r==null&&(r={},e.set(this.#e,r)),r}#t(){if(!am())return this.#c;if(globalThis.awslambda?.InvokeStore===void 0)throw new Error("InvokeStore is not available");let e=globalThis.awslambda.InvokeStore,r=e.get(this.#r);return r==null&&(r=new Map,e.set(this.#r,r)),r}appendTemporaryKeys(e){let r=this.#o(),n=this.#t();for(let[o,i]of Object.entries(e))r[o]=i,n.set(o,"temp")}removeTemporaryKeys(e){let r=this.#o(),n=this.#t();for(let o of e)r[o]=void 0,this.#n[o]?n.set(o,"persistent"):n.delete(o)}getTemporaryAttributes(){return{...this.#o()}}clearTemporaryAttributes(){let e=this.#o(),r=this.#t();for(let n of Object.keys(e))this.#n[n]?r.set(n,"persistent"):r.delete(n);if(!am()){this.#i={};return}globalThis.awslambda.InvokeStore?.set(this.#e,{})}setPersistentAttributes(e){let r=this.#t();this.#n={...e};for(let n of Object.keys(e))r.set(n,"persistent")}getPersistentAttributes(){return{...this.#n}}getAllAttributes(){let e={},r=this.#o(),n=this.#t();for(let[o,i]of Object.entries(this.#n))i!==void 0&&(e[o]=i);for(let[o,i]of n.entries())i==="temp"&&r[o]!==void 0&&(e[o]=r[o]);return e}removePersistentKeys(e){let r=this.#t(),n=this.#o();for(let o of e)this.#n[o]=void 0,n[o]?r.set(o,"temp"):r.delete(o)}};var ew=class{value;logLevel;byteSize;constructor(e,r){if(!Yb(e))throw new Error("Value should be a string");this.value=e,this.logLevel=r,this.byteSize=Buffer.byteLength(e)}},tw=class extends Set{currentBytesSize=0;hasEvictedLog=!1;add(e){return this.currentBytesSize+=e.byteSize,super.add(e),this}delete(e){let r=super.delete(e);return r&&(this.currentBytesSize-=e.byteSize),r}clear(){super.clear(),this.currentBytesSize=0}shift(){let e=this.values().next().value;return e&&this.delete(e),e}},vm=class extends Map{#e;#r;constructor({maxBytesSize:e,onBufferOverflow:r}){super(),this.#e=e,this.#r=r}setItem(e,r,n){let o=new ew(r,n);if(o.byteSize>this.#e)throw new Error("Item too big");let i=this.get(e)||new tw;return i.currentBytesSize!==0&&i.currentBytesSize+o.byteSize>=this.#e&&(this.#i(i,o),this.#r&&this.#r()),i.add(o),super.set(e,i),this}#i(e,r){for(;e.size!==0&&e.currentBytesSize+r.byteSize>=this.#e;)e.shift(),e.hasEvictedLog=!0}};var ed=class t extends Ql{console;customConfigService;logEvent=!1;logFormatter;logIndentation=Mb.COMPACT;logLevel=Ke.INFO;#e;powertoolsLogData={sampleRateValue:0};#r=new ym;#i=[];#c=!1;#n=Ke.INFO;#o;#t={enabled:!1,flushOnErrorLog:!0,maxBytes:20480,bufferAtVerbosity:Ke.DEBUG};#s;#u;#a={sampleRateValue:0,refreshedTimes:0};#p=new Map;get level(){return this.logLevel}constructor(e={}){super();let{customConfigService:r,...n}=e;this.customConfigService=r||void 0,this.setOptions(n),this.#c=!0;for(let[o,i]of this.#i)this.printLog(o,this.createAndPopulateLogItem(...i));this.#i=[]}addContext(e){this.addToPowertoolsLogData({lambdaContext:{invokedFunctionArn:e.invokedFunctionArn,coldStart:this.getColdStart(),awsRequestId:e.awsRequestId,memoryLimitInMB:e.memoryLimitInMB,functionName:e.functionName,functionVersion:e.functionVersion}})}addPersistentLogAttributes(e){this.appendPersistentKeys(e)}appendKeys(e){this.#m(e,"temp")}appendPersistentKeys(e){this.#m(e,"persistent")}createChild(e={}){let r="persistentLogAttributes"in e&&!("persistentKeys"in e)?"persistentLogAttributes":"persistentKeys",n=this.createLogger((0,bm.default)({},{logLevel:this.getLevelName(),serviceName:this.powertoolsLogData.serviceName,sampleRateValue:this.#a.sampleRateValue,logFormatter:this.getLogFormatter(),customConfigService:this.getCustomConfigService(),environment:this.powertoolsLogData.environment,[r]:this.#r.getPersistentAttributes(),jsonReplacerFn:this.#o,correlationIdSearchFn:this.#u,...this.#t.enabled&&{logBufferOptions:{maxBytes:this.#t.maxBytes,bufferAtVerbosity:this.getLogLevelNameFromNumber(this.#t.bufferAtVerbosity),flushOnErrorLog:this.#t.flushOnErrorLog}}},e));this.powertoolsLogData.lambdaContext&&n.addContext(this.powertoolsLogData.lambdaContext);let o=this.#r.getTemporaryAttributes();return Object.keys(o).length>0&&n.appendKeys(o),n}critical(e,...r){this.processLogItem(Ke.CRITICAL,e,r)}debug(e,...r){this.processLogItem(Ke.DEBUG,e,r)}error(e,...r){this.#t.enabled&&this.#t.flushOnErrorLog&&this.flushBuffer(),this.processLogItem(Ke.ERROR,e,r)}getLevelName(){return this.getLogLevelNameFromNumber(this.logLevel)}getLogEvent(){return this.logEvent}getPersistentLogAttributes(){return this.#r.getPersistentAttributes()}info(e,...r){this.processLogItem(Ke.INFO,e,r)}injectLambdaContext(e){return(r,n,o)=>{let i=o.value,s=this;o.value=async function(...a){s.refreshSampleRateCalculation(),s.addContext(a[1]),s.logEventIfEnabled(a[0],e?.logEvent),e?.correlationIdPath&&s.setCorrelationId(a[0],e?.correlationIdPath);try{return await i.apply(this,a)}catch(c){throw e?.flushBufferOnUncaughtError&&(s.flushBuffer(),s.error({message:PT,error:c})),c}finally{(e?.clearState||e?.resetKeys)&&s.resetKeys(),s.clearBuffer()}}}}static injectLambdaContextAfterOrOnError(e,r,n){n&&(n.clearState||n?.resetKeys)&&e.resetKeys()}static injectLambdaContextBefore(e,r,n,o){e.addContext(n),e.logEventIfEnabled(r,o?.logEvent)}logEventIfEnabled(e,r){this.shouldLogEvent(r)&&this.info("Lambda invocation event",{event:e})}refreshSampleRateCalculation(){if(this.#a.refreshedTimes===0){this.#a.refreshedTimes++;return}this.#h()&&this.logLevel>Ke.TRACE?(this.setLogLevel("DEBUG"),this.debug("Setting log level to DEBUG due to sampling rate")):this.setLogLevel(this.getLogLevelNameFromNumber(this.#n))}removeKeys(e){this.#r.removeTemporaryKeys(e)}removePersistentKeys(e){this.#r.removePersistentKeys(e)}removePersistentLogAttributes(e){this.removePersistentKeys(e)}resetKeys(){this.#r.clearTemporaryAttributes()}setLogLevel(e){if(!this.awsLogLevelShortCircuit(e))if(this.isValidLogLevel(e))this.logLevel=Ke[e];else throw new Error(`Invalid log level: ${e}`)}setPersistentLogAttributes(e){let r=this.#f(e);this.#r.setPersistentAttributes(r)}get persistentLogAttributes(){return this.#r.getPersistentAttributes()}shouldLogEvent(e){return typeof e=="boolean"?e:this.getLogEvent()}trace(e,...r){this.processLogItem(Ke.TRACE,e,r)}warn(e,...r){this.processLogItem(Ke.WARN,e,r)}#l(e){this.#p.has(e)||(this.#p.set(e,!0),this.warn(e))}createLogger(e){return new t(e)}getJsonReplacer(){let e=new WeakSet;return(r,n)=>{let o=n;if(this.#o&&(o=this.#o?.(r,o)),o instanceof Error&&(o=this.getLogFormatter().formatError(o)),typeof o=="bigint")return o.toString();if(typeof o=="object"&&o!==null){if(e.has(o))return;e.add(o)}return o}}addToPowertoolsLogData(e){(0,bm.default)(this.powertoolsLogData,e)}#f(e){let r={};for(let[n,o]of Object.entries(e))this.#d(n)||(r[n]=o);return r}#m(e,r){let n=this.#f(e);if(r==="temp")this.#r.appendTemporaryKeys(n);else{let o=this.#r.getPersistentAttributes();this.#r.setPersistentAttributes((0,bm.default)(o,n))}}awsLogLevelShortCircuit(e){return this.#e!==void 0?(this.logLevel=Ke[this.#e],this.isValidLogLevel(e)&&this.logLevel>Ke[e]&&this.#l(`Current log level (${e}) does not match AWS Lambda Advanced Logging Controls minimum log level (${this.#e}). This can lead to data loss, consider adjusting them.`),!0):!1}createAndPopulateLogItem(e,r,n){let o={logLevel:this.getLogLevelNameFromNumber(e),timestamp:new Date,xRayTraceId:Gl(),...this.getPowertoolsLogData(),message:""},i=this.#r.getAllAttributes();return this.#g(r,o,i),this.#_(n,i),this.getLogFormatter().formatAttributes(o,i)}#g(e,r,n){if(typeof e=="string"){r.message=e;return}let{message:o,...i}=e;r.message=o;for(let[s,a]of Object.entries(i))this.#d(s)||(n[s]=a)}#_(e,r){for(let n of e)Qb(n)||(n instanceof Error?r.error=n:typeof n=="string"?r.extra=n:this.#y(n,r))}#y(e,r){for(let[n,o]of Object.entries(e))this.#d(n)||(r[n]=o)}#h(){return this.#a.sampleRateValue&&Z2(0,100)/100<=this.#a.sampleRateValue}#d(e){return OT.includes(e)?(this.warn(`The key "${e}" is a reserved key and will be dropped.`),!0):!1}getCustomConfigService(){return this.customConfigService}getLogFormatter(){return this.logFormatter}getLogLevelNameFromNumber(e){let r;for(let[n,o]of Object.entries(Ke))if(o===e){r=n;break}return r}getPowertoolsLogData(){return this.powertoolsLogData}isValidLogLevel(e){return typeof e=="string"&&e in Ke}isValidSampleRate(e){return typeof e=="number"&&0<=e&&e<=1}printLog(e,r){r.prepareForPrint();let n=e===Ke.CRITICAL?"error":this.getLogLevelNameFromNumber(e).toLowerCase();this.console[n](JSON.stringify(r.getAttributes(),this.getJsonReplacer(),this.logIndentation))}processLogItem(e,r,n){let o=Gl();if(o!==void 0&&this.shouldBufferLog(o,e)){try{this.bufferLogItem(o,this.createAndPopulateLogItem(e,r,n),e)}catch(i){this.printLog(Ke.WARN,this.createAndPopulateLogItem(Ke.WARN,`Unable to buffer log: ${i.message}`,[i])),this.printLog(e,this.createAndPopulateLogItem(e,r,n))}return}e>=this.logLevel&&(this.#c?this.printLog(e,this.createAndPopulateLogItem(e,r,n)):this.#i.push([e,[e,r,n]]))}setConsole(){Vl()?this.console=console:this.console=new B2({stdout:process.stdout,stderr:process.stderr}),this.console.trace=(e,...r)=>{this.console.log(e,...r)}}setInitialLogLevel(e){let r=e?.toUpperCase();if(this.awsLogLevelShortCircuit(r)){this.#n=this.logLevel;return}if(this.isValidLogLevel(r)){this.logLevel=Ke[r],this.#n=this.logLevel;return}let n=this.getCustomConfigService()?.getLogLevel()?.toUpperCase();if(this.isValidLogLevel(n)){this.logLevel=Ke[n],this.#n=this.logLevel;return}let o=Vr({key:"POWERTOOLS_LOG_LEVEL",defaultValue:""}),i=Vr({key:"LOG_LEVEL",defaultValue:""}),s=o!==""?o:i;this.isValidLogLevel(s)&&(this.logLevel=Ke[s],this.#n=this.logLevel)}setInitialSampleRate(e){let r=e,n=this.getCustomConfigService()?.getSampleRateValue(),o=MT({key:"POWERTOOLS_LOGGER_SAMPLE_RATE",defaultValue:0});for(let i of[r,n,o])if(this.isValidSampleRate(i)){this.#a.sampleRateValue=i,this.powertoolsLogData.sampleRateValue=i,this.#h()&&this.logLevel>Ke.TRACE&&(this.setLogLevel("DEBUG"),this.debug("Setting log level to DEBUG due to sampling rate"));break}}setLogEvent(){this.logEvent=Ub({key:"POWERTOOLS_LOGGER_LOG_EVENT",defaultValue:!1})}setLogFormatter(e,r){this.logFormatter=e??new _m({logRecordOrder:r})}setLogIndentation(){Vl()&&(this.logIndentation=Mb.PRETTY)}setOptions(e){let{logLevel:r,serviceName:n,sampleRateValue:o,logFormatter:i,persistentKeys:s,persistentLogAttributes:a,environment:c,jsonReplacerFn:u,logRecordOrder:l,logBufferOptions:d,correlationIdSearchFn:f}=e;a&&Object.keys(a).length>0&&s&&Object.keys(s).length>0&&this.warn("Both persistentLogAttributes and persistentKeys options were provided. Using persistentKeys as persistentLogAttributes is deprecated and will be removed in future releases"),this.setPowertoolsLogData(n,c,s||a);let p=Vr({key:"AWS_LAMBDA_LOG_LEVEL",defaultValue:""}),m=p==="FATAL"?"CRITICAL":p;return this.isValidLogLevel(m)&&(this.#e=m),this.setLogEvent(),this.setInitialLogLevel(r),this.setInitialSampleRate(o),this.setLogFormatter(i,l),this.setConsole(),this.setLogIndentation(),this.#o=u,this.#v(d),this.#u=f,this}setPowertoolsLogData(e,r,n){this.addToPowertoolsLogData({awsRegion:Vr({key:"AWS_REGION",defaultValue:""}),environment:r||this.getCustomConfigService()?.getCurrentEnvironment()||Vr({key:"ENVIRONMENT",defaultValue:""}),serviceName:e||this.getCustomConfigService()?.getServiceName()||Vr({key:"POWERTOOLS_SERVICE_NAME",defaultValue:""})||this.defaultServiceName}),n&&this.appendPersistentKeys(n)}#v(e){if(e===void 0||(this.#t.enabled=e?.enabled!==!1,this.#t.enabled===!1))return;e?.maxBytes!==void 0&&(this.#t.maxBytes=e.maxBytes),this.#s=new vm({maxBytesSize:this.#t.maxBytes}),e?.flushOnErrorLog===!1&&(this.#t.flushOnErrorLog=!1);let r=e?.bufferAtVerbosity?.toUpperCase();this.isValidLogLevel(r)&&(this.#t.bufferAtVerbosity=Ke[r]),this.#e!==void 0&&Ke[this.#e]>this.#t.bufferAtVerbosity&&this.#l("Advanced Loggging Controls (ALC) Log Level is less verbose than Log Buffering Log Level. Buffered logs will be filtered by ALC")}bufferLogItem(e,r,n){r.prepareForPrint(),this.#s?.has(e)===!1&&this.#s?.clear(),this.#s?.setItem(e,JSON.stringify(r.getAttributes(),this.getJsonReplacer(),this.logIndentation),n)}flushBuffer(){let e=Gl();if(e===void 0)return;let r=this.#s?.get(e);if(r!==void 0){for(let n of r){let o=this.getLogLevelNameFromNumber(n.logLevel).toLowerCase();this.console[o](n.value)}r.hasEvictedLog&&this.printLog(Ke.WARN,this.createAndPopulateLogItem(Ke.WARN,"Some logs are not displayed because they were evicted from the buffer. Increase buffer size to store more logs in the buffer",[])),this.#e!==void 0&&Ke[this.#e]>this.#t.bufferAtVerbosity&&this.#l("Advanced Loggging Controls (ALC) Log Level is less verbose than Log Buffering Log Level. Some logs might be missing."),this.#s?.delete(e)}}clearBuffer(){let e=Gl();e!==void 0&&this.#s?.delete(e)}shouldBufferLog(e,r){return this.#t.enabled&&e!==void 0&&r<=this.#t.bufferAtVerbosity}setCorrelationId(e,r){if(typeof r=="string"){if(!this.#u){this.#l("correlationIdPath is set but no search function was provided. The correlation ID will not be added to the log attributes.");return}let n=this.#u(r,e);n&&this.appendKeys({correlation_id:n});return}this.appendKeys({correlation_id:e})}getCorrelationId(){return this.#r.getTemporaryAttributes().correlation_id}};var rw=class extends Es{formatAttributes(e,r){let n={logLevel:e.logLevel,timestamp:this.formatTimestamp(e.timestamp),message:e.message},o=new _i({attributes:n});return o.addAttributes(r),o}},wm=new ed({logFormatter:new rw});function ce(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function S(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var nw=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return nw=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function td(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var rd=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var V=class extends Error{},Pt=class t extends V{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("x-request-id"),this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new yi({message:n,cause:rd(r)});let i=r?.error;return e===400?new fc(e,i,n,o):e===401?new mc(e,i,n,o):e===403?new hc(e,i,n,o):e===404?new gc(e,i,n,o):e===409?new _c(e,i,n,o):e===422?new yc(e,i,n,o):e===429?new vc(e,i,n,o):e>=500?new bc(e,i,n,o):new t(e,i,n,o)}},xt=class extends Pt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},yi=class extends Pt{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Do=class extends yi{constructor({message:e}={}){super({message:e??"Request timed out."})}},fc=class extends Pt{},mc=class extends Pt{},hc=class extends Pt{},gc=class extends Pt{},_c=class extends Pt{},yc=class extends Pt{},vc=class extends Pt{},bc=class extends Pt{},wc=class extends V{constructor(){super("Could not parse response content as the length limit was reached")}},xc=class extends V{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},ro=class extends Error{constructor(e){super(e)}};var V2=/^[a-z][a-z0-9+.-]*:/i,yE=t=>V2.test(t),Qt=t=>(Qt=Array.isArray,Qt(t)),ow=Qt;function iw(t){return typeof t!="object"?{}:t??{}}function vE(t){if(!t)return!0;for(let e in t)return!1;return!0}function bE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function nd(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var wE=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new V(`${t} must be an integer`);if(e<0)throw new V(`${t} must be a positive integer`);return e};var xE=t=>{try{return JSON.parse(t)}catch{return}};var no=t=>new Promise(e=>setTimeout(e,t));var vi="6.10.0";var kE=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function G2(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var K2=()=>{let t=G2();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":IE(Deno.build.os),"X-Stainless-Arch":$E(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":IE(globalThis.process.platform??"unknown"),"X-Stainless-Arch":$E(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=H2();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":vi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function H2(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,s=n[3]||0;return{browser:e,version:`${o}.${i}.${s}`}}}return null}var $E=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",IE=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),SE,TE=()=>SE??(SE=K2());function EE(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function sw(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function xm(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return sw({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function aw(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function AE(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var OE=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var $m="RFC3986",cw=t=>String(t),Im={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:cw},uw="RFC1738";var Sm=(t,e)=>(Sm=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Sm(t,e)),oo=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var lw=1024,PE=(t,e,r,n,o)=>{if(t.length===0)return t;let i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a=lw?i.slice(a,a+lw):i,u=[];for(let l=0;l=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===uw&&(d===40||d===41)){u[u.length]=c.charAt(l);continue}if(d<128){u[u.length]=oo[d];continue}if(d<2048){u[u.length]=oo[192|d>>6]+oo[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=oo[224|d>>12]+oo[128|d>>6&63]+oo[128|d&63];continue}l+=1,d=65536+((d&1023)<<10|c.charCodeAt(l)&1023),u[u.length]=oo[240|d>>18]+oo[128|d>>12&63]+oo[128|d>>6&63]+oo[128|d&63]}s+=u.join("")}return s};function CE(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function dw(t,e){if(Qt(t)){let r=[];for(let n=0;n"u"&&(k=0)}if(typeof u=="function"?b=u(e,b):b instanceof Date?b=f?.(b):r==="comma"&&Qt(b)&&(b=dw(b,function(oe){return oe instanceof Date?f?.(oe):oe})),b===null){if(i)return c&&!h?c(e,Ct.encoder,_,"key",p):e;b=""}if(X2(b)||CE(b)){if(c){let oe=h?e:c(e,Ct.encoder,_,"key",p);return[m?.(oe)+"="+m?.(c(b,Ct.encoder,_,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let F=[];if(typeof b>"u")return F;let J;if(r==="comma"&&Qt(b))h&&c&&(b=dw(b,c)),J=[{value:b.length>0?b.join(",")||null:void 0}];else if(Qt(u))J=u;else{let oe=Object.keys(b);J=l?oe.sort(l):oe}let w=a?String(e).replace(/\./g,"%2E"):String(e),Z=n&&Qt(b)&&b.length===1?w+"[]":w;if(o&&Qt(b)&&b.length===0)return Z+"[]";for(let oe=0;oe"u"?t.encodeDotInKeys?!0:Ct.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Ct.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Ct.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Ct.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Ct.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Ct.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Ct.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Ct.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Ct.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Ct.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Ct.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Ct.strictNullHandling}}function fw(t,e={}){let r=t,n=Y2(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Qt(n.filter)&&(i=n.filter,o=i);let s=[];if(typeof r!="object"||r===null)return"";let a=NE[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);let u=new WeakMap;for(let f=0;f0?d+l:""}function LE(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}var jE;function $c(t){let e;return(jE??(e=new globalThis.TextEncoder,jE=e.encode.bind(e)))(t)}var DE;function mw(t){let e;return(DE??(e=new globalThis.TextDecoder,DE=e.decode.bind(e)))(t)}var Gr,Kr,Cs=class{constructor(){Gr.set(this,void 0),Kr.set(this,void 0),ce(this,Gr,new Uint8Array,"f"),ce(this,Kr,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?$c(e):e;ce(this,Gr,LE([S(this,Gr,"f"),r]),"f");let n=[],o;for(;(o=eF(S(this,Gr,"f"),S(this,Kr,"f")))!=null;){if(o.carriage&&S(this,Kr,"f")==null){ce(this,Kr,o.index,"f");continue}if(S(this,Kr,"f")!=null&&(o.index!==S(this,Kr,"f")+1||o.carriage)){n.push(mw(S(this,Gr,"f").subarray(0,S(this,Kr,"f")-1))),ce(this,Gr,S(this,Gr,"f").subarray(S(this,Kr,"f")),"f"),ce(this,Kr,null,"f");continue}let i=S(this,Kr,"f")!==null?o.preceding-1:o.preceding,s=mw(S(this,Gr,"f").subarray(0,i));n.push(s),ce(this,Gr,S(this,Gr,"f").subarray(o.index),"f"),ce(this,Kr,null,"f")}return n}flush(){return S(this,Gr,"f").length?this.decode(` +`):[]}};Gr=new WeakMap,Kr=new WeakMap;Cs.NEWLINE_CHARS=new Set([` +`,"\r"]);Cs.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function eF(t,e){for(let o=e??0;o{if(t){if(bE(Tm,t))return t;$t(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Tm))}`)}};function od(){}function km(t,e,r){return!e||Tm[t]>Tm[r]?od:e[t].bind(e)}var tF={error:od,warn:od,info:od,debug:od},FE=new WeakMap;function $t(t){let e=t.logger,r=t.logLevel??"off";if(!e)return tF;let n=FE.get(e);if(n&&n[0]===r)return n[1];let o={error:km("error",e,r),warn:km("warn",e,r),info:km("info",e,r),debug:km("debug",e,r)};return FE.set(e,[r,o]),o}var Lo=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var id,io=class t{constructor(e,r,n){this.iterator=e,id.set(this,void 0),this.controller=r,ce(this,id,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?$t(n):console;async function*s(){if(o)throw new V("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let c of rF(e,r))if(!a){if(c.data.startsWith("[DONE]")){a=!0;continue}if(c.event===null||!c.event.startsWith("thread.")){let u;try{u=JSON.parse(c.data)}catch(l){throw i.error("Could not parse message into JSON:",c.data),i.error("From chunk:",c.raw),l}if(u&&u.error)throw new Pt(void 0,u.error,void 0,e.headers);yield u}else{let u;try{u=JSON.parse(c.data)}catch(l){throw console.error("Could not parse message into JSON:",c.data),console.error("From chunk:",c.raw),l}if(c.event=="error")throw new Pt(void 0,u.error,u.message,void 0);yield{event:c.event,data:u}}}a=!0}catch(c){if(td(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*i(){let a=new Cs,c=aw(e);for await(let u of c)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*s(){if(o)throw new V("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let c of i())a||c&&(yield JSON.parse(c));a=!0}catch(c){if(td(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}[(id=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let s=n.next();e.push(s),r.push(s)}return i.shift()}});return[new t(()=>o(e),this.controller,S(this,id,"f")),new t(()=>o(r),this.controller,S(this,id,"f"))]}toReadableStream(){let e=this,r;return sw({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:i}=await r.next();if(i)return n.close();let s=$c(JSON.stringify(o)+` +`);n.enqueue(s)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};async function*rF(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new V("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new V("Attempted to iterate over a response with no body");let r=new gw,n=new Cs,o=aw(t.body);for await(let i of nF(o))for(let s of n.decode(i)){let a=r.decode(s);a&&(yield a)}for(let i of n.flush()){let s=r.decode(i);s&&(yield s)}}async function*nF(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?$c(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=UE(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var gw=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(` +`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=oF(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function oF(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function Em(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,s=await(async()=>{if(e.options.stream)return $t(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):io.fromSSEResponse(r,e.controller,t);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let c=r.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){let d=await r.json();return _w(d,r)}return await r.text()})();return $t(t).debug(`[${n}] response parsed`,Lo({retryOfRequestLogID:o,url:r.url,status:r.status,body:s,durationMs:Date.now()-i})),s}function _w(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var sd,Rs=class t extends Promise{constructor(e,r,n=Em){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,sd.set(this,void 0),ce(this,sd,e,"f")}_thenUnwrap(e){return new t(S(this,sd,"f"),this.responsePromise,async(r,n)=>_w(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(S(this,sd,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};sd=new WeakMap;var Am,ad=class{constructor(e,r,n,o){Am.set(this,void 0),ce(this,Am,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new V("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await S(this,Am,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Am=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},cd=class extends Rs{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await Em(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},so=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},ke=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),r=e[e.length-1]?.id;return r?{...this.options,query:{...iw(this.options.query),after:r}}:null}},Uo=class extends ad{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1,this.last_id=n.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.last_id;return e?{...this.options,query:{...iw(this.options.query),after:e}}:null}};var bw=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Ic(t,e,r){return bw(),new File(t,e??"unknown_file",r)}function ud(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}var Om=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",ww=async(t,e)=>yw(t.body)?{...t,body:await ZE(t.body,e)}:t,Hr=async(t,e)=>({...t,body:await ZE(t.body,e)}),BE=new WeakMap;function sF(t){let e=typeof t=="function"?t:t.fetch,r=BE.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new o(i).text()}catch{return!0}})();return BE.set(e,n),n}var ZE=async(t,e)=>{if(!await sF(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>vw(r,n,o))),r},qE=t=>t instanceof Blob&&"name"in t,aF=t=>typeof t=="object"&&t!==null&&(t instanceof Response||Om(t)||qE(t)),yw=t=>{if(aF(t))return!0;if(Array.isArray(t))return t.some(yw);if(t&&typeof t=="object"){for(let e in t)if(yw(t[e]))return!0}return!1},vw=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response)t.append(e,Ic([await r.blob()],ud(r)));else if(Om(r))t.append(e,Ic([await new Response(xm(r)).blob()],ud(r)));else if(qE(r))t.append(e,r,ud(r));else if(Array.isArray(r))await Promise.all(r.map(n=>vw(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>vw(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var VE=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",cF=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&VE(t),uF=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";async function ld(t,e,r){if(bw(),t=await t,cF(t))return t instanceof File?t:Ic([await t.arrayBuffer()],t.name);if(uF(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),Ic(await xw(o),e,r)}let n=await xw(t);if(e||(e=ud(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return Ic(n,e,r)}async function xw(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(VE(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(Om(t))for await(let r of t)e.push(...await xw(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${lF(t)}`)}return e}function lF(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var C=class{constructor(e){this._client=e}};function KE(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var GE=Object.freeze(Object.create(null)),pF=(t=KE)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],s=r.reduce((l,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=n[f],m=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??GE)??GE)?.toString)&&(m=p+"",i.push({start:l.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),l+d+(f===n.length?"":m)},""),a=s.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,u;for(;(u=c.exec(a))!==null;)i.push({start:u.index,length:u[0].length,error:`Value "${u[0]}" can't be safely passed as a path parameter`});if(i.sort((l,d)=>l.start-d.start),i.length>0){let l=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-l),h="^".repeat(p.length);return l=p.start+p.length,f+m+h},"");throw new V(`Path parameters result in path with invalid segments: +${i.map(f=>f.error).join(` +`)} +${s} +${d}`)}return s},O=pF(KE);var Ns=class extends C{list(e,r={},n){return this._client.getAPIList(O`/chat/completions/${e}/messages`,ke,{query:r,...n})}};function dd(t){return t!==void 0&&"function"in t&&t.function!==void 0}function pd(t){return t?.$brand==="auto-parseable-response-format"}function zs(t){return t?.$brand==="auto-parseable-tool"}function HE(t,e){return!e||!$w(e)?{...t,choices:t.choices.map(r=>(JE(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:fd(t,e)}function fd(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new wc;if(n.finish_reason==="content_filter")throw new xc;return JE(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>gF(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?hF(e,n.message.content):null}}});return{...t,choices:r}}function hF(t,e){return t.response_format?.type!=="json_schema"?null:t.response_format?.type==="json_schema"?"$parseRaw"in t.response_format?t.response_format.$parseRaw(e):JSON.parse(e):null}function gF(t,e){let r=t.tools?.find(n=>dd(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:zs(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function WE(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>dd(n)&&n.function?.name===e.function.name);return dd(r)&&(zs(r)||r?.function.strict||!1)}function $w(t){return pd(t.response_format)?!0:t.tools?.some(e=>zs(e)||e.type==="function"&&e.function.strict===!0)??!1}function JE(t){for(let e of t||[])if(e.type!=="function")throw new V(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function XE(t){for(let e of t??[]){if(e.type!=="function")throw new V(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new V(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Sc=t=>t?.role==="assistant",Iw=t=>t?.role==="tool";var Sw,Pm,Cm,md,hd,Rm,gd,Fo,_d,Nm,zm,kc,YE,bi=class{constructor(){Sw.add(this),this.controller=new AbortController,Pm.set(this,void 0),Cm.set(this,()=>{}),md.set(this,()=>{}),hd.set(this,void 0),Rm.set(this,()=>{}),gd.set(this,()=>{}),Fo.set(this,{}),_d.set(this,!1),Nm.set(this,!1),zm.set(this,!1),kc.set(this,!1),ce(this,Pm,new Promise((e,r)=>{ce(this,Cm,e,"f"),ce(this,md,r,"f")}),"f"),ce(this,hd,new Promise((e,r)=>{ce(this,Rm,e,"f"),ce(this,gd,r,"f")}),"f"),S(this,Pm,"f").catch(()=>{}),S(this,hd,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},S(this,Sw,"m",YE).bind(this))},0)}_connected(){this.ended||(S(this,Cm,"f").call(this),this._emit("connect"))}get ended(){return S(this,_d,"f")}get errored(){return S(this,Nm,"f")}get aborted(){return S(this,zm,"f")}abort(){this.controller.abort()}on(e,r){return(S(this,Fo,"f")[e]||(S(this,Fo,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=S(this,Fo,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(S(this,Fo,"f")[e]||(S(this,Fo,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ce(this,kc,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ce(this,kc,!0,"f"),await S(this,hd,"f")}_emit(e,...r){if(S(this,_d,"f"))return;e==="end"&&(ce(this,_d,!0,"f"),S(this,Rm,"f").call(this));let n=S(this,Fo,"f")[e];if(n&&(S(this,Fo,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!S(this,kc,"f")&&!n?.length&&Promise.reject(o),S(this,md,"f").call(this,o),S(this,gd,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!S(this,kc,"f")&&!n?.length&&Promise.reject(o),S(this,md,"f").call(this,o),S(this,gd,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Pm=new WeakMap,Cm=new WeakMap,md=new WeakMap,hd=new WeakMap,Rm=new WeakMap,gd=new WeakMap,Fo=new WeakMap,_d=new WeakMap,Nm=new WeakMap,zm=new WeakMap,kc=new WeakMap,Sw=new WeakSet,YE=function(e){if(ce(this,Nm,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new xt),e instanceof xt)return ce(this,zm,!0,"f"),this._emit("abort",e);if(e instanceof V)return this._emit("error",e);if(e instanceof Error){let r=new V(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new V(String(e)))};function QE(t){return typeof t.parse=="function"}var pr,kw,Mm,Tw,Ew,Aw,eA,tA,_F=10,Tc=class extends bi{constructor(){super(...arguments),pr.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let r=e.choices[0]?.message;return r&&this._addMessage(r),e}_addMessage(e,r=!0){if("content"in e||(e.content=null),this.messages.push(e),r){if(this._emit("message",e),Iw(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(Sc(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionToolCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new V("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),S(this,pr,"m",kw).call(this)}async finalMessage(){return await this.done(),S(this,pr,"m",Mm).call(this)}async finalFunctionToolCall(){return await this.done(),S(this,pr,"m",Tw).call(this)}async finalFunctionToolCallResult(){return await this.done(),S(this,pr,"m",Ew).call(this)}async totalUsage(){return await this.done(),S(this,pr,"m",Aw).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=S(this,pr,"m",Mm).call(this);r&&this._emit("finalMessage",r);let n=S(this,pr,"m",kw).call(this);n&&this._emit("finalContent",n);let o=S(this,pr,"m",Tw).call(this);o&&this._emit("finalFunctionToolCall",o);let i=S(this,pr,"m",Ew).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(s=>s.usage)&&this._emit("totalUsage",S(this,pr,"m",Aw).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,pr,"m",eA).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(fd(i,r))}async _runChatCompletion(e,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,r,n)}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:s,...a}=r,c=typeof i!="string"&&i.type==="function"&&i?.function?.name,{maxChatCompletions:u=_F}=n||{},l=r.tools.map(p=>{if(zs(p)){if(!p.$callback)throw new V("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of l)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?l.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;pJSON.stringify(Z)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:v,content:w});continue}let T;try{T=QE(k)?await k.parse(x):x}catch(w){let Z=w instanceof Error?w.message:String(w);this._addMessage({role:o,tool_call_id:v,content:Z});continue}let F=await k.function(T,this),J=S(this,pr,"m",tA).call(this,F);if(this._addMessage({role:o,tool_call_id:v,content:J}),c)return}}}};pr=new WeakSet,kw=function(){return S(this,pr,"m",Mm).call(this).content??null},Mm=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(Sc(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new V("stream ended without producing a ChatCompletionMessage with role=assistant")},Tw=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Sc(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},Ew=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Iw(r)&&r.content!=null&&typeof r.content=="string"&&this.messages.some(n=>n.role==="assistant"&&n.tool_calls?.some(o=>o.type==="function"&&o.id===r.tool_call_id)))return r.content}},Aw=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:r}of this._chatCompletions)r&&(e.completion_tokens+=r.completion_tokens,e.prompt_tokens+=r.prompt_tokens,e.total_tokens+=r.total_tokens);return e},eA=function(e){if(e.n!=null&&e.n>1)throw new V("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},tA=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};var yd=class t extends Tc{static runTools(e,r,n){let o=new t,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}_addMessage(e,r=!0){super._addMessage(e,r),Sc(e)&&e.content&&this._emit("content",e.content)}};var Mt={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511},Ow=class extends Error{},Pw=class extends Error{};function yF(t,e=Mt.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return vF(t.trim(),e)}var vF=(t,e)=>{let r=t.length,n=0,o=f=>{throw new Ow(`${f} at position ${n}`)},i=f=>{throw new Pw(`${f} at position ${n}`)},s=()=>(d(),n>=r&&o("Unexpected end of input"),t[n]==='"'?a():t[n]==="{"?c():t[n]==="["?u():t.substring(n,n+4)==="null"||Mt.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Mt.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Mt.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Mt.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Mt.MINUS_INFINITY&e&&1{let f=n,p=!1;for(n++;n{n++,d();let f={};try{for(;t[n]!=="}";){if(d(),n>=r&&Mt.OBJ&e)return f;let p=a();d(),n++;try{let m=s();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(Mt.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Mt.OBJ&e)return f;o("Expected '}' at end of object")}return n++,f},u=()=>{n++;let f=[];try{for(;t[n]!=="]";)f.push(s()),d(),t[n]===","&&n++}catch{if(Mt.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},l=()=>{if(n===0){t==="-"&&Mt.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Mt.NUM&e)try{return t[t.length-1]==="."?JSON.parse(t.substring(0,t.lastIndexOf("."))):JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch{}i(String(p))}}let f=n;for(t[n]==="-"&&n++;t[n]&&!",]}".includes(t[n]);)n++;n==r&&!(Mt.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Mt.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;nyF(t,Mt.ALL^Mt.NUM);var Rt,Bo,Ec,wi,Rw,jm,Nw,zw,Mw,Dm,jw,rA,Ms=class t extends Tc{constructor(e){super(),Rt.add(this),Bo.set(this,void 0),Ec.set(this,void 0),wi.set(this,void 0),ce(this,Bo,e,"f"),ce(this,Ec,[],"f")}get currentChatCompletionSnapshot(){return S(this,wi,"f")}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createChatCompletion(e,r,n){let o=new t(r);return o._run(()=>o._runChatCompletion(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(e,r,n){super._createChatCompletion;let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,Rt,"m",Rw).call(this);let i=await e.chat.completions.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let s of i)S(this,Rt,"m",Nw).call(this,s);if(i.controller.signal?.aborted)throw new xt;return this._addChatCompletion(S(this,Rt,"m",Dm).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),S(this,Rt,"m",Rw).call(this),this._connected();let o=io.fromReadableStream(e,this.controller),i;for await(let s of o)i&&i!==s.id&&this._addChatCompletion(S(this,Rt,"m",Dm).call(this)),S(this,Rt,"m",Nw).call(this,s),i=s.id;if(o.controller.signal?.aborted)throw new xt;return this._addChatCompletion(S(this,Rt,"m",Dm).call(this))}[(Bo=new WeakMap,Ec=new WeakMap,wi=new WeakMap,Rt=new WeakSet,Rw=function(){this.ended||ce(this,wi,void 0,"f")},jm=function(r){let n=S(this,Ec,"f")[r.index];return n||(n={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},S(this,Ec,"f")[r.index]=n,n)},Nw=function(r){if(this.ended)return;let n=S(this,Rt,"m",rA).call(this,r);this._emit("chunk",r,n);for(let o of r.choices){let i=n.choices[o.index];o.delta.content!=null&&i.message?.role==="assistant"&&i.message?.content&&(this._emit("content",o.delta.content,i.message.content),this._emit("content.delta",{delta:o.delta.content,snapshot:i.message.content,parsed:i.message.parsed})),o.delta.refusal!=null&&i.message?.role==="assistant"&&i.message?.refusal&&this._emit("refusal.delta",{delta:o.delta.refusal,snapshot:i.message.refusal}),o.logprobs?.content!=null&&i.message?.role==="assistant"&&this._emit("logprobs.content.delta",{content:o.logprobs?.content,snapshot:i.logprobs?.content??[]}),o.logprobs?.refusal!=null&&i.message?.role==="assistant"&&this._emit("logprobs.refusal.delta",{refusal:o.logprobs?.refusal,snapshot:i.logprobs?.refusal??[]});let s=S(this,Rt,"m",jm).call(this,i);i.finish_reason&&(S(this,Rt,"m",Mw).call(this,i),s.current_tool_call_index!=null&&S(this,Rt,"m",zw).call(this,i,s.current_tool_call_index));for(let a of o.delta.tool_calls??[])s.current_tool_call_index!==a.index&&(S(this,Rt,"m",Mw).call(this,i),s.current_tool_call_index!=null&&S(this,Rt,"m",zw).call(this,i,s.current_tool_call_index)),s.current_tool_call_index=a.index;for(let a of o.delta.tool_calls??[]){let c=i.message.tool_calls?.[a.index];c?.type&&(c?.type==="function"?this._emit("tool_calls.function.arguments.delta",{name:c.function?.name,index:a.index,arguments:c.function.arguments,parsed_arguments:c.function.parsed_arguments,arguments_delta:a.function?.arguments??""}):(c?.type,void 0))}}},zw=function(r,n){if(S(this,Rt,"m",jm).call(this,r).done_tool_calls.has(n))return;let i=r.message.tool_calls?.[n];if(!i)throw new Error("no tool call snapshot");if(!i.type)throw new Error("tool call snapshot missing `type`");if(i.type==="function"){let s=S(this,Bo,"f")?.tools?.find(a=>dd(a)&&a.function.name===i.function.name);this._emit("tool_calls.function.arguments.done",{name:i.function.name,index:n,arguments:i.function.arguments,parsed_arguments:zs(s)?s.$parseRaw(i.function.arguments):s?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Mw=function(r){let n=S(this,Rt,"m",jm).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=S(this,Rt,"m",jw).call(this);this._emit("content.done",{content:r.message.content,parsed:o?o.$parseRaw(r.message.content):null})}r.message.refusal&&!n.refusal_done&&(n.refusal_done=!0,this._emit("refusal.done",{refusal:r.message.refusal})),r.logprobs?.content&&!n.logprobs_content_done&&(n.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:r.logprobs.content})),r.logprobs?.refusal&&!n.logprobs_refusal_done&&(n.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:r.logprobs.refusal}))},Dm=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");let r=S(this,wi,"f");if(!r)throw new V("request ended without sending any chunks");return ce(this,wi,void 0,"f"),ce(this,Ec,[],"f"),bF(r,S(this,Bo,"f"))},jw=function(){let r=S(this,Bo,"f")?.response_format;return pd(r)?r:null},rA=function(r){var n,o,i,s;let a=S(this,wi,"f"),{choices:c,...u}=r;a?Object.assign(a,u):a=ce(this,wi,{...u,choices:[]},"f");for(let{delta:l,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=a.choices[f];if(h||(h=a.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:F,refusal:J,...w}=p;Object.assign(h.logprobs,w),F&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...F)),J&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...J))}if(d&&(h.finish_reason=d,S(this,Bo,"f")&&$w(S(this,Bo,"f")))){if(d==="length")throw new wc;if(d==="content_filter")throw new xc}if(Object.assign(h,m),!l)continue;let{content:_,refusal:v,function_call:b,role:x,tool_calls:k,...T}=l;if(Object.assign(h.message,T),v&&(h.message.refusal=(h.message.refusal||"")+v),x&&(h.message.role=x),b&&(h.message.function_call?(b.name&&(h.message.function_call.name=b.name),b.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=b.arguments)):h.message.function_call=b),_&&(h.message.content=(h.message.content||"")+_,!h.message.refusal&&S(this,Rt,"m",jw).call(this)&&(h.message.parsed=Cw(h.message.content))),k){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:F,id:J,type:w,function:Z,...oe}of k){let Q=(s=h.message.tool_calls)[F]??(s[F]={});Object.assign(Q,oe),J&&(Q.id=J),w&&(Q.type=w),Z&&(Q.function??(Q.function={name:Z.name??"",arguments:""})),Z?.name&&(Q.function.name=Z.name),Z?.arguments&&(Q.function.arguments+=Z.arguments,WE(S(this,Bo,"f"),Q)&&(Q.function.parsed_arguments=Cw(Q.function.arguments)))}}}return a},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("chunk",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new io(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function bF(t,e){let{id:r,choices:n,created:o,model:i,system_fingerprint:s,...a}=t,c={...a,id:r,choices:n.map(({message:u,finish_reason:l,index:d,logprobs:f,...p})=>{if(!l)throw new V(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:_,...v}=u,b=u.role;if(!b)throw new V(`missing role for choice ${d}`);if(h){let{arguments:x,name:k}=h;if(x==null)throw new V(`missing function_call.arguments for choice ${d}`);if(!k)throw new V(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:x,name:k},role:b,refusal:u.refusal??null},finish_reason:l,index:d,logprobs:f}}return _?{...p,index:d,finish_reason:l,logprobs:f,message:{...v,role:b,content:m,refusal:u.refusal??null,tool_calls:_.map((x,k)=>{let{function:T,type:F,id:J,...w}=x,{arguments:Z,name:oe,...Q}=T||{};if(J==null)throw new V(`missing choices[${d}].tool_calls[${k}].id +${Lm(t)}`);if(F==null)throw new V(`missing choices[${d}].tool_calls[${k}].type +${Lm(t)}`);if(oe==null)throw new V(`missing choices[${d}].tool_calls[${k}].function.name +${Lm(t)}`);if(Z==null)throw new V(`missing choices[${d}].tool_calls[${k}].function.arguments +${Lm(t)}`);return{...w,id:J,type:F,function:{...Q,name:oe,arguments:Z}}})}}:{...p,message:{...v,content:m,role:b,refusal:u.refusal??null},finish_reason:l,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...s?{system_fingerprint:s}:{}};return HE(c,e)}function Lm(t){return JSON.stringify(t)}var vd=class t extends Ms{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runTools(e,r,n){let o=new t(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}};var Zo=class extends C{constructor(){super(...arguments),this.messages=new Ns(this._client)}create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1})}retrieve(e,r){return this._client.get(O`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(O`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/chat/completions/${e}`,r)}parse(e,r){return XE(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>fd(n,e))}runTools(e,r){return e.stream?vd.runTools(this._client,e,r):yd.runTools(this._client,e,r)}stream(e,r){return Ms.createChatCompletion(this._client,e,r)}};Zo.Messages=Ns;var xi=class extends C{constructor(){super(...arguments),this.completions=new Zo(this._client)}};xi.Completions=Zo;var nA=Symbol("brand.privateNullableHeaders");function*xF(t){if(!t)return;if(nA in t){let{values:n,nulls:o}=t;yield*n.entries();for(let i of o)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():ow(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=ow(n[1])?n[1]:[n[1]],s=!1;for(let a of i)a!==void 0&&(e&&!s&&(s=!0,yield[o,null]),yield[o,a])}}var L=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,s]of xF(n)){let a=i.toLowerCase();o.has(a)||(e.delete(i),o.add(a)),s===null?(e.delete(i),r.add(a)):(e.append(i,s),r.delete(a))}}return{[nA]:!0,values:e,nulls:r}};var Ac=class extends C{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:L([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}};var Oc=class extends C{create(e,r){return this._client.post("/audio/transcriptions",Hr({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}};var Pc=class extends C{create(e,r){return this._client.post("/audio/translations",Hr({body:e,...r,__metadata:{model:e.model}},this._client))}};var ao=class extends C{constructor(){super(...arguments),this.transcriptions=new Oc(this._client),this.translations=new Pc(this._client),this.speech=new Ac(this._client)}};ao.Transcriptions=Oc;ao.Translations=Pc;ao.Speech=Ac;var js=class extends C{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(O`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",ke,{query:e,...r})}cancel(e,r){return this._client.post(O`/batches/${e}/cancel`,r)}};var Cc=class extends C{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/assistants/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/assistants/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",ke,{query:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(O`/assistants/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var Rc=class extends C{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var Nc=class extends C{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}};var $i=class extends C{constructor(){super(...arguments),this.sessions=new Rc(this._client),this.transcriptionSessions=new Nc(this._client)}};$i.Sessions=Rc;$i.TranscriptionSessions=Nc;var zc=class extends C{create(e,r){return this._client.post("/chatkit/sessions",{body:e,...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}cancel(e,r){return this._client.post(O`/chatkit/sessions/${e}/cancel`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}};var Mc=class extends C{retrieve(e,r){return this._client.get(O`/chatkit/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}list(e={},r){return this._client.getAPIList("/chatkit/threads",Uo,{query:e,...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}delete(e,r){return this._client.delete(O`/chatkit/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}listItems(e,r={},n){return this._client.getAPIList(O`/chatkit/threads/${e}/items`,Uo,{query:r,...n,headers:L([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers])})}};var Ii=class extends C{constructor(){super(...arguments),this.sessions=new zc(this._client),this.threads=new Mc(this._client)}};Ii.Sessions=zc;Ii.Threads=Mc;var jc=class extends C{create(e,r,n){return this._client.post(O`/threads/${e}/messages`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(O`/threads/${o}/messages/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/messages/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/threads/${e}/messages`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(O`/threads/${o}/messages/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var Dc=class extends C{retrieve(e,r,n){let{thread_id:o,run_id:i,...s}=r;return this._client.get(O`/threads/${o}/runs/${i}/steps/${e}`,{query:s,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r,n){let{thread_id:o,...i}=r;return this._client.getAPIList(O`/threads/${o}/runs/${e}/steps`,ke,{query:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var oA=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()};var Zt,Ls,Dw,co,Um,Nn,Us,Lc,Ds,Zm,Wr,Fm,Bm,xd,bd,wd,iA,sA,aA,cA,uA,lA,dA,qo=class extends bi{constructor(){super(...arguments),Zt.add(this),Dw.set(this,[]),co.set(this,{}),Um.set(this,{}),Nn.set(this,void 0),Us.set(this,void 0),Lc.set(this,void 0),Ds.set(this,void 0),Zm.set(this,void 0),Wr.set(this,void 0),Fm.set(this,void 0),Bm.set(this,void 0),xd.set(this,void 0)}[(Dw=new WeakMap,co=new WeakMap,Um=new WeakMap,Nn=new WeakMap,Us=new WeakMap,Lc=new WeakMap,Ds=new WeakMap,Zm=new WeakMap,Wr=new WeakMap,Fm=new WeakMap,Bm=new WeakMap,xd=new WeakMap,Zt=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new Ls;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=io.fromReadableStream(e,this.controller);for await(let i of o)S(this,Zt,"m",bd).call(this,i);if(o.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}toReadableStream(){return new io(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new Ls;return i._run(()=>i._runToolAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...n,stream:!0},a=await e.submitToolOutputs(r,s,{...o,signal:this.controller.signal});this._connected();for await(let c of a)S(this,Zt,"m",bd).call(this,c);if(a.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}static createThreadAssistantStream(e,r,n){let o=new Ls;return o._run(()=>o._threadAssistantStream(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,r,n,o){let i=new Ls;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return S(this,Fm,"f")}currentRun(){return S(this,Bm,"f")}currentMessageSnapshot(){return S(this,Nn,"f")}currentRunStepSnapshot(){return S(this,xd,"f")}async finalRunSteps(){return await this.done(),Object.values(S(this,co,"f"))}async finalMessages(){return await this.done(),Object.values(S(this,Um,"f"))}async finalRun(){if(await this.done(),!S(this,Us,"f"))throw Error("Final run was not received.");return S(this,Us,"f")}async _createThreadAssistantStream(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));let i={...r,stream:!0},s=await e.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let a of s)S(this,Zt,"m",bd).call(this,a);if(s.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}async _createAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...n,stream:!0},a=await e.create(r,s,{...o,signal:this.controller.signal});this._connected();for await(let c of a)S(this,Zt,"m",bd).call(this,c);if(a.controller.signal?.aborted)throw new xt;return this._addRun(S(this,Zt,"m",wd).call(this))}static accumulateDelta(e,r){for(let[n,o]of Object.entries(r)){if(!e.hasOwnProperty(n)){e[n]=o;continue}let i=e[n];if(i==null){e[n]=o;continue}if(n==="index"||n==="type"){e[n]=o;continue}if(typeof i=="string"&&typeof o=="string")i+=o;else if(typeof i=="number"&&typeof o=="number")i+=o;else if(nd(i)&&nd(o))i=this.accumulateDelta(i,o);else if(Array.isArray(i)&&Array.isArray(o)){if(i.every(s=>typeof s=="string"||typeof s=="number")){i.push(...o);continue}for(let s of o){if(!nd(s))throw new Error(`Expected array delta entry to be an object but got: ${s}`);let a=s.index;if(a==null)throw console.error(s),new Error("Expected array delta entry to have an `index` property");if(typeof a!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${a}`);let c=i[a];c==null?i.push(s):i[a]=this.accumulateDelta(c,s)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${o}, accValue: ${i}`);e[n]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,r,n){return await this._createThreadAssistantStream(r,e,n)}async _runAssistantStream(e,r,n,o){return await this._createAssistantStream(r,e,n,o)}async _runToolAssistantStream(e,r,n,o){return await this._createToolAssistantStream(r,e,n,o)}};Ls=qo,bd=function(e){if(!this.ended)switch(ce(this,Fm,e,"f"),S(this,Zt,"m",aA).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":S(this,Zt,"m",dA).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":S(this,Zt,"m",sA).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":S(this,Zt,"m",iA).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},wd=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");if(!S(this,Us,"f"))throw Error("Final run has not been received");return S(this,Us,"f")},iA=function(e){let[r,n]=S(this,Zt,"m",uA).call(this,e,S(this,Nn,"f"));ce(this,Nn,r,"f"),S(this,Um,"f")[r.id]=r;for(let o of n){let i=r.content[o.index];i?.type=="text"&&this._emit("textCreated",i.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,r),e.data.delta.content)for(let o of e.data.delta.content){if(o.type=="text"&&o.text){let i=o.text,s=r.content[o.index];if(s&&s.type=="text")this._emit("textDelta",i,s.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(o.index!=S(this,Lc,"f")){if(S(this,Ds,"f"))switch(S(this,Ds,"f").type){case"text":this._emit("textDone",S(this,Ds,"f").text,S(this,Nn,"f"));break;case"image_file":this._emit("imageFileDone",S(this,Ds,"f").image_file,S(this,Nn,"f"));break}ce(this,Lc,o.index,"f")}ce(this,Ds,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(S(this,Lc,"f")!==void 0){let o=e.data.content[S(this,Lc,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,S(this,Nn,"f"));break;case"text":this._emit("textDone",o.text,S(this,Nn,"f"));break}}S(this,Nn,"f")&&this._emit("messageDone",e.data),ce(this,Nn,void 0,"f")}},sA=function(e){let r=S(this,Zt,"m",cA).call(this,e);switch(ce(this,xd,r,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let n=e.data.delta;if(n.step_details&&n.step_details.type=="tool_calls"&&n.step_details.tool_calls&&r.step_details.type=="tool_calls")for(let i of n.step_details.tool_calls)i.index==S(this,Zm,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(S(this,Wr,"f")&&this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Zm,i.index,"f"),ce(this,Wr,r.step_details.tool_calls[i.index],"f"),S(this,Wr,"f")&&this._emit("toolCallCreated",S(this,Wr,"f")));this._emit("runStepDelta",e.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":ce(this,xd,void 0,"f"),e.data.step_details.type=="tool_calls"&&S(this,Wr,"f")&&(this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Wr,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},aA=function(e){S(this,Dw,"f").push(e),this._emit("event",e)},cA=function(e){switch(e.event){case"thread.run.step.created":return S(this,co,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=S(this,co,"f")[e.data.id];if(!r)throw Error("Received a RunStepDelta before creation of a snapshot");let n=e.data;if(n.delta){let o=Ls.accumulateDelta(r,n.delta);S(this,co,"f")[e.data.id]=o}return S(this,co,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":S(this,co,"f")[e.data.id]=e.data;break}if(S(this,co,"f")[e.data.id])return S(this,co,"f")[e.data.id];throw new Error("No snapshot available")},uA=function(e,r){let n=[];switch(e.event){case"thread.message.created":return[e.data,n];case"thread.message.delta":if(!r)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let o=e.data;if(o.delta.content)for(let i of o.delta.content)if(i.index in r.content){let s=r.content[i.index];r.content[i.index]=S(this,Zt,"m",lA).call(this,i,s)}else r.content[i.index]=i,n.push(i);return[r,n];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(r)return[r,n];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},lA=function(e,r){return Ls.accumulateDelta(r,e)},dA=function(e){switch(ce(this,Bm,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":ce(this,Us,e.data,"f"),S(this,Wr,"f")&&(this._emit("toolCallDone",S(this,Wr,"f")),ce(this,Wr,void 0,"f"));break;case"thread.run.cancelling":break}};var Fs=class extends C{constructor(){super(...arguments),this.steps=new Dc(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(O`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(O`/threads/${o}/runs/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/runs/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/threads/${e}/runs`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(O`/threads/${o}/runs/${e}/cancel`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(o.id,{thread_id:e},n)}createAndStream(e,r,n){return qo.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(e,r,{...n,headers:{...n?.headers,...o}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return qo.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post(O`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}async submitToolOutputsAndPoll(e,r,n){let o=await this.submitToolOutputs(e,r,n);return await this.poll(o.id,r,n)}submitToolOutputsStream(e,r,n){return qo.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};Fs.Steps=Dc;var ki=class extends C{constructor(){super(...arguments),this.runs=new Fs(this._client),this.messages=new jc(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/threads/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete(O`/threads/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:e.stream??!1})}async createAndRunPoll(e,r){let n=await this.createAndRun(e,r);return await this.runs.poll(n.id,{thread_id:n.thread_id},r)}createAndRunStream(e,r){return qo.createThreadAssistantStream(e,this._client.beta.threads,r)}};ki.Runs=Fs;ki.Messages=jc;var zn=class extends C{constructor(){super(...arguments),this.realtime=new $i(this._client),this.chatkit=new Ii(this._client),this.assistants=new Cc(this._client),this.threads=new ki(this._client)}};zn.Realtime=$i;zn.ChatKit=Ii;zn.Assistants=Cc;zn.Threads=ki;var Bs=class extends C{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}};var Uc=class extends C{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(O`/containers/${o}/files/${e}/content`,{...n,headers:L([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}};var Zs=class extends C{constructor(){super(...arguments),this.content=new Uc(this._client)}create(e,r,n){return this._client.post(O`/containers/${e}/files`,Hr({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(O`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList(O`/containers/${e}/files`,ke,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(O`/containers/${o}/files/${e}`,{...n,headers:L([{Accept:"*/*"},n?.headers])})}};Zs.Content=Uc;var Ti=class extends C{constructor(){super(...arguments),this.files=new Zs(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get(O`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/containers/${e}`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}};Ti.Files=Zs;var Fc=class extends C{create(e,r,n){let{include:o,...i}=r;return this._client.post(O`/conversations/${e}/items`,{query:{include:o},body:i,...n})}retrieve(e,r,n){let{conversation_id:o,...i}=r;return this._client.get(O`/conversations/${o}/items/${e}`,{query:i,...n})}list(e,r={},n){return this._client.getAPIList(O`/conversations/${e}/items`,Uo,{query:r,...n})}delete(e,r,n){let{conversation_id:o}=r;return this._client.delete(O`/conversations/${o}/items/${e}`,n)}};var Ei=class extends C{constructor(){super(...arguments),this.items=new Fc(this._client)}create(e={},r){return this._client.post("/conversations",{body:e,...r})}retrieve(e,r){return this._client.get(O`/conversations/${e}`,r)}update(e,r,n){return this._client.post(O`/conversations/${e}`,{body:r,...n})}delete(e,r){return this._client.delete(O`/conversations/${e}`,r)}};Ei.Items=Fc;var qs=class extends C{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&$t(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:($t(this._client).debug("embeddings/decoding base64 embeddings from base64"),i._thenUnwrap(s=>(s&&s.data&&s.data.forEach(a=>{let c=a.embedding;a.embedding=oA(c)}),s)))}};var Bc=class extends C{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get(O`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList(O`/evals/${o}/runs/${e}/output_items`,ke,{query:i,...n})}};var Vs=class extends C{constructor(){super(...arguments),this.outputItems=new Bc(this._client)}create(e,r,n){return this._client.post(O`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(O`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList(O`/evals/${e}/runs`,ke,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(O`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(O`/evals/${o}/runs/${e}`,n)}};Vs.OutputItems=Bc;var Ai=class extends C{constructor(){super(...arguments),this.runs=new Vs(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(O`/evals/${e}`,r)}update(e,r,n){return this._client.post(O`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/evals/${e}`,r)}};Ai.Runs=Vs;var Gs=class extends C{create(e,r){return this._client.post("/files",Hr({body:e,...r},this._client))}retrieve(e,r){return this._client.get(O`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",ke,{query:e,...r})}delete(e,r){return this._client.delete(O`/files/${e}`,r)}content(e,r){return this._client.get(O`/files/${e}/content`,{...r,headers:L([{Accept:"application/binary"},r?.headers]),__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:n=1800*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),s=await this.retrieve(e);for(;!s.status||!o.has(s.status);)if(await no(r),s=await this.retrieve(e),Date.now()-i>n)throw new Do({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return s}};var Zc=class extends C{};var qc=class extends C{run(e,r){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...r})}validate(e,r){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...r})}};var Ks=class extends C{constructor(){super(...arguments),this.graders=new qc(this._client)}};Ks.Graders=qc;var Vc=class extends C{create(e,r,n){return this._client.getAPIList(O`/fine_tuning/checkpoints/${e}/permissions`,so,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get(O`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(O`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}};var Hs=class extends C{constructor(){super(...arguments),this.permissions=new Vc(this._client)}};Hs.Permissions=Vc;var Gc=class extends C{list(e,r={},n){return this._client.getAPIList(O`/fine_tuning/jobs/${e}/checkpoints`,ke,{query:r,...n})}};var Ws=class extends C{constructor(){super(...arguments),this.checkpoints=new Gc(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(O`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",ke,{query:e,...r})}cancel(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList(O`/fine_tuning/jobs/${e}/events`,ke,{query:r,...n})}pause(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post(O`/fine_tuning/jobs/${e}/resume`,r)}};Ws.Checkpoints=Gc;var Mn=class extends C{constructor(){super(...arguments),this.methods=new Zc(this._client),this.jobs=new Ws(this._client),this.checkpoints=new Hs(this._client),this.alpha=new Ks(this._client)}};Mn.Methods=Zc;Mn.Jobs=Ws;Mn.Checkpoints=Hs;Mn.Alpha=Ks;var Kc=class extends C{};var Oi=class extends C{constructor(){super(...arguments),this.graderModels=new Kc(this._client)}};Oi.GraderModels=Kc;var Js=class extends C{createVariation(e,r){return this._client.post("/images/variations",Hr({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",Hr({body:e,...r,stream:e.stream??!1},this._client))}generate(e,r){return this._client.post("/images/generations",{body:e,...r,stream:e.stream??!1})}};var Xs=class extends C{retrieve(e,r){return this._client.get(O`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",so,e)}delete(e,r){return this._client.delete(O`/models/${e}`,r)}};var Ys=class extends C{create(e,r){return this._client.post("/moderations",{body:e,...r})}};var Hc=class extends C{accept(e,r,n){return this._client.post(O`/realtime/calls/${e}/accept`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}hangup(e,r){return this._client.post(O`/realtime/calls/${e}/hangup`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}refer(e,r,n){return this._client.post(O`/realtime/calls/${e}/refer`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}reject(e,r={},n){return this._client.post(O`/realtime/calls/${e}/reject`,{body:r,...n,headers:L([{Accept:"*/*"},n?.headers])})}};var Wc=class extends C{create(e,r){return this._client.post("/realtime/client_secrets",{body:e,...r})}};var Vo=class extends C{constructor(){super(...arguments),this.clientSecrets=new Wc(this._client),this.calls=new Hc(this._client)}};Vo.ClientSecrets=Wc;Vo.Calls=Hc;function pA(t,e){return!e||!QF(e)?{...t,output_parsed:null,output:t.output.map(r=>r.type==="function_call"?{...r,parsed_arguments:null}:r.type==="message"?{...r,content:r.content.map(n=>({...n,parsed:null}))}:r)}:Lw(t,e)}function Lw(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:rB(e,o)};if(o.type==="message"){let i=o.content.map(s=>s.type==="output_text"?{...s,parsed:YF(e,s.text)}:s);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||qm(n),Object.defineProperty(n,"output_parsed",{enumerable:!0,get(){for(let o of n.output)if(o.type==="message"){for(let i of o.content)if(i.type==="output_text"&&i.parsed!==null)return i.parsed}return null}}),n}function YF(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function QF(t){return!!pd(t.text?.format)}function eB(t){return t?.$brand==="auto-parseable-tool"}function tB(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function rB(t,e){let r=tB(t.tools??[],e.name);return{...e,...e,parsed_arguments:eB(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function qm(t){let e=[];for(let r of t.output)if(r.type==="message")for(let n of r.content)n.type==="output_text"&&e.push(n.text);t.output_text=e.join("")}var Jc,Vm,Pi,Gm,fA,mA,hA,gA,Km=class t extends bi{constructor(e){super(),Jc.add(this),Vm.set(this,void 0),Pi.set(this,void 0),Gm.set(this,void 0),ce(this,Vm,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createOrRetrieveResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createOrRetrieveResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),S(this,Jc,"m",fA).call(this);let i,s=null;"response_id"in r?(i=await e.responses.retrieve(r.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),s=r.starting_after??null):i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(let a of i)S(this,Jc,"m",mA).call(this,a,s);if(i.controller.signal?.aborted)throw new xt;return S(this,Jc,"m",hA).call(this)}[(Vm=new WeakMap,Pi=new WeakMap,Gm=new WeakMap,Jc=new WeakSet,fA=function(){this.ended||ce(this,Pi,void 0,"f")},mA=function(r,n){if(this.ended)return;let o=(s,a)=>{(n==null||a.sequence_number>n)&&this._emit(s,a)},i=S(this,Jc,"m",gA).call(this,r);switch(o("event",r),r.type){case"response.output_text.delta":{let s=i.output[r.output_index];if(!s)throw new V(`missing output at index ${r.output_index}`);if(s.type==="message"){let a=s.content[r.content_index];if(!a)throw new V(`missing content at index ${r.content_index}`);if(a.type!=="output_text")throw new V(`expected content to be 'output_text', got ${a.type}`);o("response.output_text.delta",{...r,snapshot:a.text})}break}case"response.function_call_arguments.delta":{let s=i.output[r.output_index];if(!s)throw new V(`missing output at index ${r.output_index}`);s.type==="function_call"&&o("response.function_call_arguments.delta",{...r,snapshot:s.arguments});break}default:o(r.type,r);break}},hA=function(){if(this.ended)throw new V("stream has ended, this shouldn't happen");let r=S(this,Pi,"f");if(!r)throw new V("request ended without sending any events");ce(this,Pi,void 0,"f");let n=nB(r,S(this,Vm,"f"));return ce(this,Gm,n,"f"),n},gA=function(r){let n=S(this,Pi,"f");if(!n){if(r.type!=="response.created")throw new V(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=ce(this,Pi,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);let i=o.type,s=r.part;i==="message"&&s.type!=="reasoning_text"?o.content.push(s):i==="reasoning"&&s.type==="reasoning_text"&&(o.content||(o.content=[]),o.content.push(s));break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new V(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new V(`expected content to be 'output_text', got ${i.type}`);i.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.reasoning_text.delta":{let o=n.output[r.output_index];if(!o)throw new V(`missing output at index ${r.output_index}`);if(o.type==="reasoning"){let i=o.content?.[r.content_index];if(!i)throw new V(`missing content at index ${r.content_index}`);if(i.type!=="reasoning_text")throw new V(`expected content to be 'reasoning_text', got ${i.type}`);i.text+=r.delta}break}case"response.completed":{ce(this,Pi,r.response,"f");break}}return n},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=S(this,Gm,"f");if(!e)throw new V("stream ended without producing a ChatCompletion");return e}};function nB(t,e){return pA(t,e)}var Xc=class extends C{list(e,r={},n){return this._client.getAPIList(O`/responses/${e}/input_items`,ke,{query:r,...n})}};var Yc=class extends C{count(e={},r){return this._client.post("/responses/input_tokens",{body:e,...r})}};var Go=class extends C{constructor(){super(...arguments),this.inputItems=new Xc(this._client),this.inputTokens=new Yc(this._client)}create(e,r){return this._client.post("/responses",{body:e,...r,stream:e.stream??!1})._thenUnwrap(n=>("object"in n&&n.object==="response"&&qm(n),n))}retrieve(e,r={},n){return this._client.get(O`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&qm(o),o))}delete(e,r){return this._client.delete(O`/responses/${e}`,{...r,headers:L([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>Lw(n,e))}stream(e,r){return Km.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(O`/responses/${e}/cancel`,r)}compact(e={},r){return this._client.post("/responses/compact",{body:e,...r})}};Go.InputItems=Xc;Go.InputTokens=Yc;var Qc=class extends C{create(e,r,n){return this._client.post(O`/uploads/${e}/parts`,Hr({body:r,...n},this._client))}};var Ci=class extends C{constructor(){super(...arguments),this.parts=new Qc(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(O`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(O`/uploads/${e}/complete`,{body:r,...n})}};Ci.Parts=Qc;var _A=async t=>{let e=await Promise.allSettled(t),r=e.filter(o=>o.status==="rejected");if(r.length){for(let o of r)console.error(o.reason);throw new Error(`${r.length} promise(s) failed - see the above errors`)}let n=[];for(let o of e)o.status==="fulfilled"&&n.push(o.value);return n};var eu=class extends C{create(e,r,n){return this._client.post(O`/vector_stores/${e}/file_batches`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(O`/vector_stores/${o}/file_batches/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{vector_store_id:o}=r;return this._client.post(O`/vector_stores/${o}/file_batches/${e}/cancel`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r);return await this.poll(e,o.id,n)}listFiles(e,r,n){let{vector_store_id:o,...i}=r;return this._client.getAPIList(O`/vector_stores/${o}/file_batches/${e}/files`,ke,{query:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse();switch(i.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,s=Math.min(i,r.length),a=this._client,c=r.values(),u=[...n];async function l(f){for(let p of f){let m=await a.files.create({file:p,purpose:"assistants"},o);u.push(m.id)}}let d=Array(s).fill(c).map(l);return await _A(d),await this.createAndPoll(e,{file_ids:u})}};var tu=class extends C{create(e,r,n){return this._client.post(O`/vector_stores/${e}/files`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(O`/vector_stores/${o}/files/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{vector_store_id:o,...i}=r;return this._client.post(O`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(O`/vector_stores/${e}/files`,ke,{query:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{vector_store_id:o}=r;return this._client.delete(O`/vector_stores/${o}/files/${e}`,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}async poll(e,r,n){let o=L([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse(),s=i.data;switch(s.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=i.response.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await no(a);break;case"failed":case"completed":return s}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}content(e,r,n){let{vector_store_id:o}=r;return this._client.getAPIList(O`/vector_stores/${o}/files/${e}/content`,so,{...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};var Ko=class extends C{constructor(){super(...arguments),this.files=new tu(this._client),this.fileBatches=new eu(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(O`/vector_stores/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(O`/vector_stores/${e}`,{body:r,...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",ke,{query:e,...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(O`/vector_stores/${e}`,{...r,headers:L([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList(O`/vector_stores/${e}/search`,so,{body:r,method:"post",...n,headers:L([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};Ko.Files=tu;Ko.FileBatches=eu;var Qs=class extends C{create(e,r){return this._client.post("/videos",ww({body:e,...r},this._client))}retrieve(e,r){return this._client.get(O`/videos/${e}`,r)}list(e={},r){return this._client.getAPIList("/videos",Uo,{query:e,...r})}delete(e,r){return this._client.delete(O`/videos/${e}`,r)}downloadContent(e,r={},n){return this._client.get(O`/videos/${e}/content`,{query:r,...n,headers:L([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}remix(e,r,n){return this._client.post(O`/videos/${e}/remix`,ww({body:r,...n},this._client))}};var ru,yA,Hm,ea=class extends C{constructor(){super(...arguments),ru.add(this)}async unwrap(e,r,n=this._client.webhookSecret,o=300){return await this.verifySignature(e,r,n,o),JSON.parse(e)}async verifySignature(e,r,n=this._client.webhookSecret,o=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");S(this,ru,"m",yA).call(this,n);let i=L([r]).values,s=S(this,ru,"m",Hm).call(this,i,"webhook-signature"),a=S(this,ru,"m",Hm).call(this,i,"webhook-timestamp"),c=S(this,ru,"m",Hm).call(this,i,"webhook-id"),u=parseInt(a,10);if(isNaN(u))throw new ro("Invalid webhook timestamp format");let l=Math.floor(Date.now()/1e3);if(l-u>o)throw new ro("Webhook timestamp is too old");if(u>l+o)throw new ro("Webhook timestamp is too new");let d=s.split(" ").map(h=>h.startsWith("v1,")?h.substring(3):h),f=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),p=c?`${c}.${a}.${e}`:`${a}.${e}`,m=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let h of d)try{let _=Buffer.from(h,"base64");if(await crypto.subtle.verify("HMAC",m,_,new TextEncoder().encode(p)))return}catch{continue}throw new ro("The given webhook signature does not match the expected signature")}};ru=new WeakSet,yA=function(e){if(typeof e!="string"||e.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},Hm=function(e,r){if(!e)throw new Error("Headers are required");let n=e.get(r);if(n==null)throw new Error(`Missing required header: ${r}`);return n};var Uw,Fw,Wm,vA,fe=class{constructor({baseURL:e=Si("OPENAI_BASE_URL"),apiKey:r=Si("OPENAI_API_KEY"),organization:n=Si("OPENAI_ORG_ID")??null,project:o=Si("OPENAI_PROJECT_ID")??null,webhookSecret:i=Si("OPENAI_WEBHOOK_SECRET")??null,...s}={}){if(Uw.add(this),Wm.set(this,void 0),this.completions=new Bs(this),this.chat=new xi(this),this.embeddings=new qs(this),this.files=new Gs(this),this.images=new Js(this),this.audio=new ao(this),this.moderations=new Ys(this),this.models=new Xs(this),this.fineTuning=new Mn(this),this.graders=new Oi(this),this.vectorStores=new Ko(this),this.webhooks=new ea(this),this.beta=new zn(this),this.batches=new js(this),this.uploads=new Ci(this),this.responses=new Go(this),this.realtime=new Vo(this),this.conversations=new Ei(this),this.evals=new Ai(this),this.containers=new Ti(this),this.videos=new Qs(this),r===void 0)throw new V("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");let a={apiKey:r,organization:n,project:o,webhookSecret:i,...s,baseURL:e||"https://api.openai.com/v1"};if(!a.dangerouslyAllowBrowser&&kE())throw new V(`It looks like you're running in a browser-like environment. + +This is disabled by default, as it risks exposing your secret API credentials to attackers. +If you understand the risks and have appropriate mitigations in place, +you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g., + +new OpenAI({ apiKey, dangerouslyAllowBrowser: true }); + +https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety +`);this.baseURL=a.baseURL,this.timeout=a.timeout??Fw.DEFAULT_TIMEOUT,this.logger=a.logger??console;let c="warn";this.logLevel=c,this.logLevel=hw(a.logLevel,"ClientOptions.logLevel",this)??hw(Si("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??c,this.fetchOptions=a.fetchOptions,this.maxRetries=a.maxRetries??2,this.fetch=a.fetch??EE(),ce(this,Wm,OE,"f"),this._options=a,this.apiKey=typeof r=="string"?r:"Missing Key",this.organization=n,this.project=o,this.webhookSecret=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return L([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return fw(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${vi}`}defaultIdempotencyKey(){return`stainless-node-retry-${nw()}`}makeStatusError(e,r,n,o){return Pt.generate(e,r,n,o)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(n){throw n instanceof V?n:new V(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new V(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let o=!S(this,Uw,"m",vA).call(this)&&n||this.baseURL,i=yE(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery();return vE(s)||(r={...s,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}async prepareOptions(e){await this._callApiKey()}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(o=>({method:e,path:r,...o})))}request(e,r=null){return new Rs(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,i=o.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(o);let{req:s,url:a,timeout:c}=await this.buildRequest(o,{retryCount:i-r});await this.prepareRequest(s,{url:a,options:o});let u="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),l=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if($t(this).debug(`[${u}] sending request`,Lo({retryOfRequestLogID:n,method:o.method,url:a,options:o,headers:s.headers})),o.signal?.aborted)throw new xt;let f=new AbortController,p=await this.fetchWithTimeout(a,s,c,f).catch(rd),m=Date.now();if(p instanceof globalThis.Error){let v=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new xt;let b=td(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return $t(this).info(`[${u}] connection ${b?"timed out":"failed"} - ${v}`),$t(this).debug(`[${u}] connection ${b?"timed out":"failed"} (${v})`,Lo({retryOfRequestLogID:n,url:a,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??u);throw $t(this).info(`[${u}] connection ${b?"timed out":"failed"} - error; no more retries left`),$t(this).debug(`[${u}] connection ${b?"timed out":"failed"} (error; no more retries left)`,Lo({retryOfRequestLogID:n,url:a,durationMs:m-d,message:p.message})),b?new Do:new yi({cause:p})}let h=[...p.headers.entries()].filter(([v])=>v==="x-request-id").map(([v,b])=>", "+v+": "+JSON.stringify(b)).join(""),_=`[${u}${l}${h}] ${s.method} ${a} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let v=await this.shouldRetry(p);if(r&&v){let J=`retrying, ${r} attempts remaining`;return await AE(p.body),$t(this).info(`${_} - ${J}`),$t(this).debug(`[${u}] response error (${J})`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??u,p.headers)}let b=v?"error; no more retries left":"error; not retryable";$t(this).info(`${_} - ${b}`);let x=await p.text().catch(J=>rd(J).message),k=xE(x),T=k?void 0:x;throw $t(this).debug(`[${u}] response error (${b})`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:T,durationMs:Date.now()-d})),this.makeStatusError(p.status,k,T,p.headers)}return $t(this).info(_),$t(this).debug(`[${u}] response start`,Lo({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),{response:p,options:o,controller:f,requestLogID:u,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new cd(this,n,e)}async fetchWithTimeout(e,r,n,o){let{signal:i,method:s,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let c=setTimeout(()=>o.abort(),n),u=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,l={signal:o.signal,...u?{duplex:"half"}:{},method:"GET",...a};s&&(l.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,l)}finally{clearTimeout(c)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,o){let i,s=o?.get("retry-after-ms");if(s){let c=parseFloat(s);Number.isNaN(c)||(i=c)}let a=o?.get("retry-after");if(a&&!i){let c=parseFloat(a);Number.isNaN(c)?i=Date.parse(a)-Date.now():i=c*1e3}if(!(i&&0<=i&&i<60*1e3)){let c=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,c)}return await no(i),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,s=Math.min(.5*Math.pow(2,i),8),a=1-Math.random()*.25;return s*a*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:s,defaultBaseURL:a}=n,c=this.buildURL(i,s,a);"timeout"in n&&wE("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:u,body:l}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:u,retryCount:r});return{req:{method:o,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:c,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let s=L([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...TE(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=L([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:xm(e)}:S(this,Wm,"f").call(this,{body:e,headers:n})}};Fw=fe,Wm=new WeakMap,Uw=new WeakSet,vA=function(){return this.baseURL!=="https://api.openai.com/v1"};fe.OpenAI=Fw;fe.DEFAULT_TIMEOUT=6e5;fe.OpenAIError=V;fe.APIError=Pt;fe.APIConnectionError=yi;fe.APIConnectionTimeoutError=Do;fe.APIUserAbortError=xt;fe.NotFoundError=gc;fe.ConflictError=_c;fe.RateLimitError=vc;fe.BadRequestError=fc;fe.AuthenticationError=mc;fe.InternalServerError=bc;fe.PermissionDeniedError=hc;fe.UnprocessableEntityError=yc;fe.InvalidWebhookSignatureError=ro;fe.toFile=ld;fe.Completions=Bs;fe.Chat=xi;fe.Embeddings=qs;fe.Files=Gs;fe.Images=Js;fe.Audio=ao;fe.Moderations=Ys;fe.Models=Xs;fe.FineTuning=Mn;fe.Graders=Oi;fe.VectorStores=Ko;fe.Webhooks=ea;fe.Beta=zn;fe.Batches=js;fe.Uploads=Ci;fe.Responses=Go;fe.Realtime=Vo;fe.Conversations=Ei;fe.Evals=Ai;fe.Containers=Ti;fe.Videos=Qs;var lB=Object.defineProperty,G=(t,e)=>{for(var r in e)lB(t,r,{get:e[r],enumerable:!0})};function Jr(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function nu(t){return Jr(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function ou(t){return Jr(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function bA(t){return Jr(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function Jm(t){return Jr(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function Xm(t){if(Jr(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function Ym(t){let e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);let r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);let o={};for(let i of t.split(";").slice(1)){let s=i.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);let a=s[0].trim(),c=s[1].trim();if(a==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);o[a]=c}return{type:r,subtype:n,parameters:o}}function ta({dataUrl:t,asTypedArray:e=!1}){let r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let o=e?Uint8Array.from(atob(r[2]),i=>i.charCodeAt(0)):r[2];return{mime_type:n,data:o}}}function $d(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}function Qm(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var OA=mn(xA(),1),_B=mn(AA(),1);function PA(t,e){return e?.[t]||(0,OA.default)(t)}function CA(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var yB={};G(yB,{Serializable:()=>uo,get_lc_unique_name:()=>eh});function RA(t){return Array.isArray(t)?[...t]:{...t}}function vB(t,e){let r=RA(t);for(let[n,o]of Object.entries(e)){let[i,...s]=n.split(".").reverse(),a=r;for(let c of s.reverse()){if(a[c]===void 0)break;a[c]=RA(a[c]),a=a[c]}a[i]!==void 0&&(a[i]={lc:1,type:"secret",id:[o]})}return r}function eh(t){let e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var uo=class NA{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eh(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof NA||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((o,i)=>(o[i]=i in this?this[i]:this.lc_kwargs[i],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(e,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));return Object.keys(r).forEach(o=>{let i=this,s=n,[a,...c]=o.split(".").reverse();for(let u of c.reverse()){if(!(u in i)||i[u]===void 0)return;(!(u in s)||s[u]===void 0)&&(typeof i[u]=="object"&&i[u]!=null?s[u]={}:Array.isArray(i[u])&&(s[u]=[])),i=i[u],s=s[u]}a in i&&i[a]!==void 0&&(s[a]=s[a]||i[a])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:CA(Object.keys(r).length?vB(n,r):n,PA,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function re(t,e){return me(t)&&t.type===e}function me(t){return typeof t=="object"&&t!==null}function Ar(t){return Array.isArray(t)}function K(t){return typeof t=="string"}function Xr(t){return typeof t=="number"}function th(t){return t instanceof Uint8Array}function qw(t){try{return JSON.parse(t)}catch{return}}var Ho=t=>t();function bB(t){if(t.type==="char_location"&&K(t.document_title)&&Xr(t.start_char_index)&&Xr(t.end_char_index)&&K(t.cited_text)){let{document_title:e,start_char_index:r,end_char_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"char",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="page_location"&&K(t.document_title)&&Xr(t.start_page_number)&&Xr(t.end_page_number)&&K(t.cited_text)){let{document_title:e,start_page_number:r,end_page_number:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"page",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="content_block_location"&&K(t.document_title)&&Xr(t.start_block_index)&&Xr(t.end_block_index)&&K(t.cited_text)){let{document_title:e,start_block_index:r,end_block_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"block",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="web_search_result_location"&&K(t.url)&&K(t.title)&&K(t.encrypted_index)&&K(t.cited_text)){let{url:e,title:r,encrypted_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"url",url:e,title:r,startIndex:Number(n),endIndex:Number(n),citedText:o}}if(t.type==="search_result_location"&&K(t.source)&&K(t.title)&&Xr(t.start_block_index)&&Xr(t.end_block_index)&&K(t.cited_text)){let{source:e,title:r,start_block_index:n,end_block_index:o,cited_text:i,...s}=t;return{...s,type:"citation",source:"search",url:e,title:r??void 0,startIndex:n,endIndex:o,citedText:i}}}function MA(t){if(re(t,"document")&&me(t.source)&&"type"in t.source){if(t.source.type==="base64"&&K(t.source.media_type)&&K(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&K(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&K(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&K(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(re(t,"image")&&me(t.source)&&"type"in t.source){if(t.source.type==="base64"&&K(t.source.media_type)&&K(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&K(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&K(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function jA(t){function*e(){for(let r of t){let n=MA(r);n?yield n:yield r}}return Array.from(e())}function zA(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"text")&&K(n.text)){let{text:o,citations:i,...s}=n;if(Ar(i)&&i.length){let a=i.reduce((c,u)=>{let l=bB(u);return l?[...c,l]:c},[]);yield{...s,type:"text",text:o,annotations:a};continue}else{yield{...s,type:"text",text:o};continue}}else if(re(n,"thinking")&&K(n.thinking)){let{thinking:o,signature:i,...s}=n;yield{...s,type:"reasoning",reasoning:o,signature:i};continue}else if(re(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(re(n,"tool_use")&&K(n.name)&&K(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(re(n,"input_json_delta")){if(wB(t)&&t.tool_call_chunks?.length){let o=t.tool_call_chunks[0];yield{type:"tool_call_chunk",id:o.id,name:o.name,args:o.args,index:o.index};continue}}else if(re(n,"server_tool_use")&&K(n.name)&&K(n.id)){let{name:o,id:i}=n;if(o==="web_search"){let s=Ho(()=>{if(typeof n.input=="string")return n.input;if(me(n.input)&&K(n.input.query))return n.input.query;if(K(n.partial_json)){let a=qw(n.partial_json);if(a?.query)return a.query}return""});yield{id:i,type:"server_tool_call",name:"web_search",args:{query:s}};continue}else if(n.name==="code_execution"){let s=Ho(()=>{if(typeof n.input=="string")return n.input;if(me(n.input)&&K(n.input.code))return n.input.code;if(K(n.partial_json)){let a=qw(n.partial_json);if(a?.code)return a.code}return""});yield{id:i,type:"server_tool_call",name:"code_execution",args:{code:s}};continue}}else if(re(n,"web_search_tool_result")&&K(n.tool_use_id)&&Ar(n.content)){let{content:o,tool_use_id:i}=n,s=o.reduce((a,c)=>re(c,"web_search_result")?[...a,c.url]:a,[]);yield{type:"server_tool_call_result",name:"web_search",toolCallId:i,status:"success",output:{urls:s}};continue}else if(re(n,"code_execution_tool_result")&&K(n.tool_use_id)&&me(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(re(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(re(n,"mcp_tool_result")&&K(n.tool_use_id)&&me(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(re(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(re(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(re(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let o=MA(n);if(o){yield o;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var DA={translateContent:zA,translateContentChunk:zA};function wB(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}function xB(t){return nu(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:ou(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:Jm(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function LA(t){return t.map(xB)}function UA(t){return!!(re(t,"image_url")&&me(t.image_url)||re(t,"input_audio")&&me(t.input_audio)||re(t,"file")&&me(t.file))}function FA(t){if(re(t,"image_url")&&me(t.image_url)&&K(t.image_url.url)){let e=ta({dataUrl:t.image_url.url});return e?{type:"image",mimeType:e.mime_type,data:e.data}:{type:"image",url:t.image_url.url}}else{if(re(t,"input_audio")&&me(t.input_audio)&&K(t.input_audio.data)&&K(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(re(t,"file")&&me(t.file)&&K(t.file.data)){let e=ta({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(K(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}function $B(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...rh(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function IB(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...rh(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function rh(t){let e=[];for(let r of t)UA(r)?e.push(FA(r)):e.push(r);return e}function SB(t){if(t.type==="url_citation"){let{url:e,title:r,start_index:n,end_index:o}=t;return{type:"citation",url:e,title:r,startIndex:n,endIndex:o}}if(t.type==="file_citation"){let{file_id:e,filename:r,index:n}=t;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:e}}return t}function BA(t){function*e(){me(t.additional_kwargs?.reasoning)&&Ar(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((o,i)=>me(i)&&K(i.text)?`${o}${i.text}`:o,"")});let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r)if(re(n,"text")){let{text:o,annotations:i,...s}=n;Array.isArray(i)?yield{...s,type:"text",text:String(o),annotations:i.map(SB)}:yield{...s,type:"text",text:String(o)}}for(let n of t.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(me(t.additional_kwargs)&&Ar(t.additional_kwargs.tool_outputs))for(let n of t.additional_kwargs.tool_outputs){if(re(n,"web_search_call")){yield{id:n.id,type:"server_tool_call",name:"web_search",args:{query:n.query}};continue}else if(re(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{query:n.query}};continue}else if(re(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(re(n,"code_interpreter_call")){if(K(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),Ar(n.outputs)){let o=Ho(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(let i of n.outputs)if(re(i,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:o??0,stderr:[0,void 0].includes(o)?void 0:String(i.logs),stdout:[0,void 0].includes(o)?String(i.logs):void 0}};continue}}continue}else if(re(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(re(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(re(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(re(n,"image_generation_call")){yield{type:"non_standard",value:n};continue}me(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function kB(t){function*e(){yield*BA(t);for(let r of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(e())}var ZA={translateContent:t=>typeof t.content=="string"?$B(t):BA(t),translateContentChunk:t=>typeof t.content=="string"?IB(t):kB(t)};function qA(t,e="pretty"){return e==="pretty"?TB(t):JSON.stringify(t)}function TB(t){let e=[],r=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),o="=".repeat(n),i=r.length%2===0?o:`${o}=`;if(e.push(`${o}${r}${i}`),t.type==="ai"){let s=t;if(s.tool_calls&&s.tool_calls.length>0){e.push("Tool Calls:");for(let a of s.tool_calls){e.push(` ${a.name} (${a.id})`),e.push(` Call ID: ${a.id}`),e.push(" Args:");for(let[c,u]of Object.entries(a.args))e.push(` ${c}: ${u}`)}}}if(t.type==="tool"){let s=t;s.name&&e.push(`Name: ${s.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(` +`)}var Vw=Symbol.for("langchain.message");function er(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.length===0?t:Array.isArray(e)&&e.some(r=>Jr(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?ra(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>Jr(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function nh(t,e){return t==="error"||e==="error"?"error":"success"}function EB(t,e){function r(n,o){if(typeof n!="object"||n===null||n===void 0)return n;if(o>=e)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(s=>r(s,o+1));let i={};for(let s of Object.keys(n))i[s]=r(n[s],o+1);return i}return JSON.stringify(r(t,0),null,2)}var qt=class extends uo{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[Vw]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(t){let e=typeof t=="string"||Array.isArray(t)?{content:t}:t;e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),this.name=e.name,e.content===void 0&&e.contentBlocks!==void 0?(this.content=e.contentBlocks,this.response_metadata={output_version:"v1",...e.response_metadata}):e.content!==void 0?(this.content=e.content??[],this.response_metadata=e.response_metadata):(this.content=[],this.response_metadata=e.response_metadata),this.additional_kwargs=e.additional_kwargs,this.id=e.id}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(t=>typeof t=="string"?t:t.type==="text"?t.text:"").join(""):""}get contentBlocks(){let t=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[LA,rh,jA].reduce((n,o)=>o(n),t)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(t){return typeof t=="object"&&t!==null&&Vw in t&&t[Vw]===!0&&Qm(t)}_updateId(t){this.id=t,this.lc_kwargs.id=t}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](t){if(t===null)return this;let e=EB(this._printableFields,Math.max(4,t));return`${this.constructor.lc_name()} ${e}`}toFormattedString(t="pretty"){return qA(this,t)}};function VA(t){return Array.isArray(t)&&t.every(e=>typeof e.index=="number")}function dt(t={},e={}){let r={...t};for(let[n,o]of Object.entries(e))if(r[n]==null)r[n]=o;else{if(o==null)continue;if(typeof r[n]!=typeof o||Array.isArray(r[n])!==Array.isArray(o))throw new Error(`field[${n}] already exists in the message chunk, but with a different type.`);if(typeof r[n]=="string"){if(n==="type")continue;["id","name","output_version","model_provider"].includes(n)?o&&(r[n]=o):r[n]+=o}else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=dt(r[n],o);else if(Array.isArray(r[n]))r[n]=ra(r[n],o);else{if(r[n]===o)continue;console.warn(`field[${n}] already exists in this message chunk and value has unsupported type.`)}}return r}function ra(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)return t||e;{let r=[...t];for(let n of e)if(typeof n=="object"&&n!==null&&"index"in n&&typeof n.index=="number"){let o=r.findIndex(i=>{let s=typeof i=="object",a="index"in i&&i.index===n.index,c="id"in i&&"id"in n&&i?.id===n?.id,u=!("id"in i)||!i?.id||!("id"in n)||!n?.id;return s&&a&&(c||u)});o!==-1&&typeof r[o]=="object"&&r[o]!==null?r[o]=dt(r[o],n):r.push(n)}else{if(typeof n=="object"&&n!==null&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function oh(t,e){if(!t&&!e)throw new Error("Cannot merge two undefined objects.");if(!t||!e)return t||e;if(typeof t!=typeof e)throw new Error(`Cannot merge objects of different types. +Left ${typeof t} +Right ${typeof e}`);if(typeof t=="string"&&typeof e=="string")return t+e;if(Array.isArray(t)&&Array.isArray(e))return ra(t,e);if(typeof t=="object"&&typeof e=="object")return dt(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types. +Left ${t} +Right ${e}`)}var fr=class GA extends qt{static isInstance(e){if(!super.isInstance(e))return!1;let r=Object.getPrototypeOf(e);for(;r!==null;){if(r===GA.prototype)return!0;r=Object.getPrototypeOf(r)}return!1}};function ih(t){return typeof t.role=="string"}function Yr(t){return typeof t?._getType=="function"}function iu(t){return fr.isInstance(t)}function sh(t,e){return dt(t??{},e??{})}function KA(t,e){let r={};return(t?.audio!==void 0||e?.audio!==void 0)&&(r.audio=(t?.audio??0)+(e?.audio??0)),(t?.image!==void 0||e?.image!==void 0)&&(r.image=(t?.image??0)+(e?.image??0)),(t?.video!==void 0||e?.video!==void 0)&&(r.video=(t?.video??0)+(e?.video??0)),(t?.document!==void 0||e?.document!==void 0)&&(r.document=(t?.document??0)+(e?.document??0)),(t?.text!==void 0||e?.text!==void 0)&&(r.text=(t?.text??0)+(e?.text??0)),r}function AB(t,e){let r={...KA(t,e)};return(t?.cache_read!==void 0||e?.cache_read!==void 0)&&(r.cache_read=(t?.cache_read??0)+(e?.cache_read??0)),(t?.cache_creation!==void 0||e?.cache_creation!==void 0)&&(r.cache_creation=(t?.cache_creation??0)+(e?.cache_creation??0)),r}function OB(t,e){let r={...KA(t,e)};return(t?.reasoning!==void 0||e?.reasoning!==void 0)&&(r.reasoning=(t?.reasoning??0)+(e?.reasoning??0)),r}function ah(t,e){return{input_tokens:(t?.input_tokens??0)+(e?.input_tokens??0),output_tokens:(t?.output_tokens??0)+(e?.output_tokens??0),total_tokens:(t?.total_tokens??0)+(e?.total_tokens??0),input_token_details:AB(t?.input_token_details,e?.input_token_details),output_token_details:OB(t?.output_token_details,e?.output_token_details)}}var PB={};G(PB,{ToolMessage:()=>Or,ToolMessageChunk:()=>na,defaultToolCallParser:()=>Sd,isDirectToolOutput:()=>Id,isToolMessage:()=>Gw,isToolMessageChunk:()=>Kw});function Id(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}var Or=class extends qt{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}lc_direct_tool_output=!0;type="tool";status;tool_call_id;metadata;artifact;constructor(t,e,r){let n=typeof t=="string"||Array.isArray(t)?{content:t,name:r,tool_call_id:e}:t;super(n),this.tool_call_id=n.tool_call_id,this.artifact=n.artifact,this.status=n.status,this.metadata=n.metadata}static isInstance(t){return super.isInstance(t)&&t.type==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},na=class extends fr{type="tool";tool_call_id;status;artifact;constructor(t){super(t),this.tool_call_id=t.tool_call_id,this.artifact=t.artifact,this.status=t.status}static lc_name(){return"ToolMessageChunk"}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),artifact:oh(this.artifact,t.artifact),tool_call_id:this.tool_call_id,id:this.id??t.id,status:nh(this.status,t.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}};function Sd(t){let e=[],r=[];for(let n of t)if(n.function){let o=n.function.name;try{let i=JSON.parse(n.function.arguments);e.push({name:o||"",args:i||{},id:n.id})}catch{r.push({name:o,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[e,r]}function Gw(t){return typeof t=="object"&&t!==null&&"getType"in t&&typeof t.getType=="function"&&t.getType()==="tool"}function Kw(t){return t._getType()==="tool"}var jn=class HA extends qt{static lc_name(){return"ChatMessage"}type="generic";role;static _chatMessageClass(){return HA}constructor(e,r){(typeof e=="string"||Array.isArray(e))&&(e={content:e,role:r}),super(e),this.role=e.role}static isInstance(e){return super.isInstance(e)&&e.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},Ri=class extends fr{static lc_name(){return"ChatMessageChunk"}type="generic";role;constructor(t,e){(typeof t=="string"||Array.isArray(t))&&(t={content:t,role:e}),super(t),this.role=t.role}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),role:this.role,id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}};function WA(t){return t._getType()==="generic"}function JA(t){return t._getType()==="generic"}var oa=class extends qt{static lc_name(){return"FunctionMessage"}type="function";name;constructor(t){super(t),this.name=t.name}},Ni=class extends fr{static lc_name(){return"FunctionMessageChunk"}type="function";concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),name:this.name??"",id:this.id??t.id})}};function XA(t){return t._getType()==="function"}function YA(t){return t._getType()==="function"}var mr=class extends qt{static lc_name(){return"HumanMessage"}type="human";constructor(t){super(t)}static isInstance(t){return super.isInstance(t)&&t.type==="human"}},zi=class extends fr{static lc_name(){return"HumanMessageChunk"}type="human";constructor(t){super(t)}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="human"}};function QA(t){return t.getType()==="human"}function eO(t){return t.getType()==="human"}var ia=class extends qt{type="remove";id;constructor(t){super({...t,content:[]}),this.id=t.id}get _printableFields(){return{...super._printableFields,id:this.id}}static isInstance(t){return super.isInstance(t)&&t.type==="remove"}};var hn=class ch extends qt{static lc_name(){return"SystemMessage"}type="system";constructor(e){super(e)}concat(e){if(typeof e=="string")return new ch({...this,content:er(this.content,e)});if(ch.isInstance(e))return new ch({...this,additional_kwargs:{...this.additional_kwargs,...e.additional_kwargs},response_metadata:{...this.response_metadata,...e.response_metadata},content:er(this.content,e.content)});throw new Error("Unexpected chunk type for system message")}static isInstance(e){return super.isInstance(e)&&e.type==="system"}},lo=class extends fr{static lc_name(){return"SystemMessageChunk"}type="system";constructor(t){super(t)}concat(t){let e=this.constructor;return new e({content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:dt(this.response_metadata,t.response_metadata),id:this.id??t.id})}static isInstance(t){return super.isInstance(t)&&t.type==="system"}};function tO(t){return t._getType()==="system"}function rO(t){return t._getType()==="system"}function uh(t,e){return t.lc_error_code=e,t.message=`${t.message} + +Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/ +`,t}function Mi(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function nO(t){return!!(t&&typeof t=="object"&&"toolCall"in t&&t.toolCall!=null&&typeof t.toolCall=="object"&&"id"in t.toolCall&&typeof t.toolCall.id=="string")}var su=class extends Error{output;constructor(t,e){super(t),this.output=e}};function kd(t,e=sa){t=t.trim();let r=t.indexOf("```");if(r===-1)return e(t);let n=t.substring(r+3);n.startsWith(`json +`)?n=n.substring(5):n.startsWith("json")?n=n.substring(4):n.startsWith(` +`)&&(n=n.substring(1));let o=n.indexOf("```"),i=n;return o!==-1&&(i=n.substring(0,o)),e(i.trim())}function CB(t){try{return JSON.parse(t)}catch{}let e=t.trim();if(e.length===0)throw new Error("Unexpected end of JSON input");let r=0;function n(){for(;r="0"&&e[r]<="9"))throw new Error(`Invalid number at position ${l}`);if(r="1"&&e[r]<="9")for(;r="0"&&e[r]<="9";)d+=e[r],r+=1;if(r="0"&&e[r]<="9";)d+=e[r],r+=1;if(r="0"&&e[r]<="9";)d+=e[r],r+=1;if(d==="-")return-0;let f=Number.parseFloat(d);if(Number.isNaN(f))throw r=l,new Error(`Invalid number '${d}' at position ${l}`);return f}function s(){if(n(),r>=e.length)throw new Error(`Unexpected end of input at position ${r}`);let l=e[r];if(l==="{")return c();if(l==="[")return a();if(l==='"')return o();if("null".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),null;if("true".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),!0;if("false".startsWith(e.substring(r,r+5)))return r+=Math.min(5,e.length-r),!1;if(l==="-"||l>="0"&&l<="9")return i();throw new Error(`Unexpected character '${l}' at position ${r}`)}function a(){if(e[r]!=="[")throw new Error(`Expected '[' at position ${r}, got '${e[r]}'`);let l=[];if(r+=1,n(),r>=e.length)return l;if(e[r]==="]")return r+=1,l;for(;r=e.length||(l.push(s()),n(),r>=e.length))return l;if(e[r]==="]")return r+=1,l;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or ']' at position ${r}, got '${e[r]}'`)}return l}function c(){if(e[r]!=="{")throw new Error(`Expected '{' at position ${r}, got '${e[r]}'`);let l={};if(r+=1,n(),r>=e.length)return l;if(e[r]==="}")return r+=1,l;for(;r=e.length)return l;let d=o();if(n(),r>=e.length)return l;if(e[r]!==":")throw new Error(`Expected ':' at position ${r}, got '${e[r]}'`);if(r+=1,n(),r>=e.length||(l[d]=s(),n(),r>=e.length))return l;if(e[r]==="}")return r+=1,l;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or '}' at position ${r}, got '${e[r]}'`)}return l}let u=s();if(n(),r"u"?null:CB(t)}catch{return null}}function Hw(t){switch(t){case"csv":return"text/csv";case"doc":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"html":return"text/html";case"md":return"text/markdown";case"pdf":return"application/pdf";case"txt":return"text/plain";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"gif":return"image/gif";case"jpeg":return"image/jpeg";case"jpg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"flv":return"video/flv";case"mkv":return"video/mkv";case"mov":return"video/mov";case"mp4":return"video/mp4";case"mpeg":return"video/mpeg";case"mpg":return"video/mpg";case"three_gp":return"video/three_gp";case"webm":return"video/webm";case"wmv":return"video/wmv";default:return"application/octet-stream"}}function RB(t){if(me(t.document)&&me(t.document.source)){let e=me(t.document)&&K(t.document.format)?t.document.format:"",r=Hw(e);if(me(t.document.source)){if(me(t.document.source.s3Location)&&K(t.document.source.s3Location.uri))return{type:"file",mimeType:r,fileId:t.document.source.s3Location.uri};if(th(t.document.source.bytes))return{type:"file",mimeType:r,data:t.document.source.bytes};if(K(t.document.source.text))return{type:"file",mimeType:r,data:Buffer.from(t.document.source.text).toString("base64")};if(Ar(t.document.source.content)){let n=t.document.source.content.reduce((o,i)=>me(i)&&K(i.text)?o+i.text:o,"");return{type:"file",mimeType:r,data:n}}}}return{type:"non_standard",value:t}}function NB(t){if(re(t,"image")&&me(t.image)){let e=me(t.image)&&K(t.image.format)?t.image.format:"",r=Hw(e);if(me(t.image.source)){if(me(t.image.source.s3Location)&&K(t.image.source.s3Location.uri))return{type:"image",mimeType:r,fileId:t.image.source.s3Location.uri};if(th(t.image.source.bytes))return{type:"image",mimeType:r,data:t.image.source.bytes}}}return{type:"non_standard",value:t}}function zB(t){if(re(t,"video")&&me(t.video)){let e=me(t.video)&&K(t.video.format)?t.video.format:"",r=Hw(e);if(me(t.video.source)){if(me(t.video.source.s3Location)&&K(t.video.source.s3Location.uri))return{type:"video",mimeType:r,fileId:t.video.source.s3Location.uri};if(th(t.video.source.bytes))return{type:"video",mimeType:r,data:t.video.source.bytes}}}return{type:"non_standard",value:t}}function oO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"cache_point")){yield{type:"non_standard",value:n};continue}else if(re(n,"citations_content")&&me(n.citationsContent)){let o=Ar(n.citationsContent.content)?n.citationsContent.content.reduce((s,a)=>me(a)&&K(a.text)?s+a.text:s,""):"",i=Ar(n.citationsContent.citations)?n.citationsContent.citations.reduce((s,a)=>{if(me(a)){let c=Ar(a.sourceContent)?a.sourceContent.reduce((l,d)=>me(d)&&K(d.text)?l+d.text:l,""):"",u=Ho(()=>{if(me(a.location)){let l=a.location.documentChar||a.location.documentPage||a.location.documentChunk;if(me(l))return{source:Xr(l.documentIndex)?l.documentIndex.toString():void 0,startIndex:Xr(l.start)?l.start:void 0,endIndex:Xr(l.end)?l.end:void 0}}return{}});s.push({type:"citation",citedText:c,...u})}return s},[]):[];yield{type:"text",text:o,annotations:i};continue}else if(re(n,"document")&&me(n.document)){yield RB(n);continue}else if(re(n,"guard_content")){yield{type:"non_standard",value:n};continue}else if(re(n,"image")&&me(n.image)){yield NB(n);continue}else if(re(n,"reasoning_content")&&K(n.reasoningText)){yield{type:"reasoning",reasoning:n.reasoningText};continue}else if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"tool_result")){yield{type:"non_standard",value:n};continue}else{if(re(n,"tool_call"))continue;if(re(n,"video")&&me(n.video)){yield zB(n);continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var iO={translateContent:oO,translateContentChunk:oO};function sO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"inlineData")&&me(n.inlineData)&&K(n.inlineData.mimeType)&&K(n.inlineData.data)){yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data};continue}else if(re(n,"functionCall")&&me(n.functionCall)&&K(n.functionCall.name)&&me(n.functionCall.args)){yield{type:"tool_call",id:t.id,name:n.functionCall.name,args:n.functionCall.args};continue}else if(re(n,"functionResponse")){yield{type:"non_standard",value:n};continue}else if(re(n,"fileData")&&me(n.fileData)&&K(n.fileData.mimeType)&&K(n.fileData.fileUri)){yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri};continue}else if(re(n,"executableCode")){yield{type:"non_standard",value:n};continue}else if(re(n,"codeExecutionResult")){yield{type:"non_standard",value:n};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var aO={translateContent:sO,translateContentChunk:sO};function cO(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(re(n,"reasoning")&&K(n.reasoning)){let o=Ho(()=>{let i=r.indexOf(n);if(Ar(t.additional_kwargs?.signatures)&&i>=0)return t.additional_kwargs.signatures.at(i)});K(o)?yield{type:"reasoning",reasoning:n.reasoning,signature:o}:yield{type:"reasoning",reasoning:n.reasoning};continue}else if(re(n,"text")&&K(n.text)){yield{type:"text",text:n.text};continue}else if(re(n,"image_url")){if(K(n.image_url))if(n.image_url.startsWith("data:")){let o=/^data:([^;]+);base64,(.+)$/,i=n.image_url.match(o);i?yield{type:"image",data:i[2],mimeType:i[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url};continue}else if(re(n,"media")&&K(n.mimeType)&&K(n.data)){yield{type:"file",mimeType:n.mimeType,data:n.data};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var uO={translateContent:cO,translateContentChunk:cO};globalThis.lc_block_translators_registry??=new Map([["anthropic",DA],["bedrock-converse",iO],["google-genai",aO],["google-vertexai",uO],["openai",ZA]]);function Ww(t){return globalThis.lc_block_translators_registry.get(t)}var jt=class extends qt{type="ai";tool_calls=[];invalid_tool_calls=[];usage_metadata;get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls"}}constructor(t){let e;if(typeof t=="string"||Array.isArray(t))e={content:t,tool_calls:[],invalid_tool_calls:[],additional_kwargs:{}};else{e=t;let r=e.additional_kwargs?.tool_calls,n=e.tool_calls;r!=null&&r.length>0&&(n===void 0||n.length===0)&&console.warn(["New LangChain packages are available that more efficiently handle",`tool calling. + +Please upgrade your packages to versions that set`,"message tool calls. e.g., `pnpm install @langchain/anthropic`,","pnpm install @langchain/openai`, etc."].join(" "));try{if(r!=null&&n===void 0){let[o,i]=Sd(r);e.tool_calls=o??[],e.invalid_tool_calls=i??[]}else e.tool_calls=e.tool_calls??[],e.invalid_tool_calls=e.invalid_tool_calls??[]}catch{e.tool_calls=[],e.invalid_tool_calls=[]}if(e.response_metadata!==void 0&&"output_version"in e.response_metadata&&e.response_metadata.output_version==="v1"&&(e.contentBlocks=e.content,e.content=void 0),e.contentBlocks!==void 0){e.contentBlocks.push(...e.tool_calls.map(i=>({type:"tool_call",id:i.id,name:i.name,args:i.args})));let o=e.contentBlocks.filter(i=>i.type==="tool_call").filter(i=>!e.tool_calls?.some(s=>s.id===i.id&&s.name===i.name));o.length>0&&(e.tool_calls=o.map(i=>({type:"tool_call",id:i.id,name:i.name,args:i.args})))}}super(e),typeof e!="string"&&(this.tool_calls=e.tool_calls??this.tool_calls,this.invalid_tool_calls=e.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=e.usage_metadata}static lc_name(){return"AIMessage"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let e=Ww(this.response_metadata.model_provider);if(e)return e.translateContent(this)}let t=super.contentBlocks;if(this.tool_calls){let e=this.tool_calls.filter(r=>!t.some(n=>n.id===r.id&&n.name===r.name));t.push(...e.map(r=>({...r,type:"tool_call",id:r.id,name:r.name,args:r.args})))}return t}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}static isInstance(t){return super.isInstance(t)&&t.type==="ai"}};function aa(t){return t._getType()==="ai"}function Td(t){return t._getType()==="ai"}var Dt=class extends fr{type="ai";tool_calls=[];invalid_tool_calls=[];tool_call_chunks=[];usage_metadata;constructor(t){let e;typeof t=="string"||Array.isArray(t)?e={content:t,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]}:t.tool_call_chunks===void 0||t.tool_call_chunks.length===0?e={...t,tool_calls:t.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:t.usage_metadata!==void 0?t.usage_metadata:void 0}:e={...t,...lh(t.tool_call_chunks??[]),usage_metadata:t.usage_metadata!==void 0?t.usage_metadata:void 0},super(e),this.tool_call_chunks=e.tool_call_chunks??this.tool_call_chunks,this.tool_calls=e.tool_calls??this.tool_calls,this.invalid_tool_calls=e.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=e.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks"}}static lc_name(){return"AIMessageChunk"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let e=Ww(this.response_metadata.model_provider);if(e)return e.translateContent(this)}let t=super.contentBlocks;if(this.tool_calls&&typeof this.content!="string"){let e=this.content.filter(r=>r.type==="tool_call").map(r=>r.id);for(let r of this.tool_calls)r.id&&!e.includes(r.id)&&t.push({...r,type:"tool_call",id:r.id,name:r.name,args:r.args})}return t}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(t){let e={content:er(this.content,t.content),additional_kwargs:dt(this.additional_kwargs,t.additional_kwargs),response_metadata:sh(this.response_metadata,t.response_metadata),tool_call_chunks:[],id:this.id??t.id};if(this.tool_call_chunks!==void 0||t.tool_call_chunks!==void 0){let n=ra(this.tool_call_chunks,t.tool_call_chunks);n!==void 0&&n.length>0&&(e.tool_call_chunks=n)}(this.usage_metadata!==void 0||t.usage_metadata!==void 0)&&(e.usage_metadata=ah(this.usage_metadata,t.usage_metadata));let r=this.constructor;return new r(e)}static isInstance(t){return super.isInstance(t)&&t.type==="ai"}};var Xw=t=>t();function MB(t){return Mi(t)?t:typeof t.id=="string"&&t.type==="function"&&typeof t.function=="object"&&t.function!==null&&"arguments"in t.function&&typeof t.function.arguments=="string"&&"name"in t.function&&typeof t.function.name=="string"?{id:t.id,args:JSON.parse(t.function.arguments),name:t.function.name,type:"tool_call"}:t}function jB(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function Jw(t){let e,r;if(jB(t)){let n=t.id.at(-1);n==="HumanMessage"||n==="HumanMessageChunk"?e="user":n==="AIMessage"||n==="AIMessageChunk"?e="assistant":n==="SystemMessage"||n==="SystemMessageChunk"?e="system":n==="FunctionMessage"||n==="FunctionMessageChunk"?e="function":n==="ToolMessage"||n==="ToolMessageChunk"?e="tool":e="unknown",r=t.kwargs}else{let{type:n,...o}=t;e=n,r=o}if(e==="human"||e==="user")return new mr(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new jt(r);let i=n.map(MB);return new jt({...o,tool_calls:i})}else{if(e==="system")return new hn(r);if(e==="developer")return new hn({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new Or({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});if(e==="remove"&&"id"in r&&typeof r.id=="string")return new ia({...r,id:r.id});throw uh(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported. + +Received: ${JSON.stringify(t,null,2)}`),"MESSAGE_COERCION_FAILURE")}}function ji(t){if(typeof t=="string")return new mr(t);if(Yr(t))return t;if(Array.isArray(t)){let[e,r]=t;return Jw({type:e,content:r})}else if(ih(t)){let{role:e,...r}=t;return Jw({...r,type:e})}else return Jw(t)}function au(t,e="Human",r="AI"){let n=[];for(let o of t){let i;if(o._getType()==="human")i=e;else if(o._getType()==="ai")i=r;else if(o._getType()==="system")i="System";else if(o._getType()==="tool")i="Tool";else if(o._getType()==="generic")i=o.role;else throw new Error(`Got unsupported message type: ${o._getType()}`);let s=o.name?`${o.name}, `:"",a=typeof o.content=="string"?o.content:JSON.stringify(o.content,null,2);n.push(`${i}: ${s}${a}`)}return n.join(` +`)}function DB(t){if(t.data!==void 0)return t;{let e=t;return{type:e.type,data:{content:e.text,role:e.role,name:void 0,tool_call_id:void 0}}}}function Ed(t){let e=DB(t);switch(e.type){case"human":return new mr(e.data);case"ai":return new jt(e.data);case"system":return new hn(e.data);case"function":if(e.data.name===void 0)throw new Error("Name must be defined for function messages");return new oa(e.data);case"tool":if(e.data.tool_call_id===void 0)throw new Error("Tool call ID must be defined for tool messages");return new Or(e.data);case"generic":if(e.data.role===void 0)throw new Error("Role must be defined for chat messages");return new jn(e.data);default:throw new Error(`Got unexpected type: ${e.type}`)}}function lO(t){return t.map(Ed)}function dO(t){return t.map(e=>e.toDict())}function ca(t){let e=t._getType();if(e==="human")return new zi({...t});if(e==="ai"){let r={...t};return"tool_calls"in r&&(r={...r,tool_call_chunks:r.tool_calls?.map(n=>({...n,type:"tool_call_chunk",index:void 0,args:JSON.stringify(n.args)}))}),new Dt({...r})}else{if(e==="system")return new lo({...t});if(e==="function")return new Ni({...t});if(jn.isInstance(t))return new Ri({...t});throw new Error("Unknown message type.")}}function lh(t){let e=t.reduce((o,i)=>{let s=o.findIndex(([a])=>"id"in i&&i.id&&"index"in i&&i.index!==void 0?i.id===a.id&&i.index===a.index:"id"in i&&i.id?i.id===a.id:"index"in i&&i.index!==void 0?i.index===a.index:!1);return s!==-1?o[s].push(i):o.push([i]),o},[]),r=[],n=[];for(let o of e){let i=null,s=o[0]?.name??"",a=o.map(l=>l.args||"").join("").trim(),c=a.length?a:"{}",u=o[0]?.id;try{if(i=sa(c),!u||i===null||typeof i!="object"||Array.isArray(i))throw new Error("Malformed tool call chunk args.");r.push({name:s,args:i,id:u,type:"tool_call"})}catch{n.push({name:s,args:c,id:u,error:"Malformed args.",type:"invalid_tool_call"})}}return{tool_call_chunks:t,tool_calls:r,invalid_tool_calls:n}}var pO=Symbol.for("ls:tracing_async_local_storage"),Di=Symbol.for("lc:context_variables"),fO=t=>{globalThis[pO]=t},Li=()=>globalThis[pO];var LB={};G(LB,{getEnv:()=>Qw,getEnvironmentVariable:()=>It,getRuntimeEnvironment:()=>ex,isBrowser:()=>mO,isDeno:()=>dh,isJsDom:()=>gO,isNode:()=>_O,isWebWorker:()=>hO});var mO=()=>typeof window<"u"&&typeof window.document<"u",hO=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",gO=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),dh=()=>typeof Deno<"u",_O=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!dh(),Qw=()=>{let t;return mO()?t="browser":_O()?t="node":hO()?t="webworker":gO()?t="jsdom":dh()?t="deno":t="other",t},Yw;function ex(){return Yw===void 0&&(Yw={library:"langchain-js",runtime:Qw()}),Yw}function It(t){try{return typeof process<"u"?process.env?.[t]:dh()?Deno?.env.get(t):void 0}catch{return}}var yO=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function UB(t){return typeof t=="string"&&yO.test(t)}var Ui=UB;function FB(t){if(!Ui(t))throw TypeError("Invalid UUID");let e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var vO=FB;var Vt=[];for(let t=0;t<256;++t)Vt.push((t+256).toString(16).slice(1));function cu(t,e=0){return(Vt[t[e+0]]+Vt[t[e+1]]+Vt[t[e+2]]+Vt[t[e+3]]+"-"+Vt[t[e+4]]+Vt[t[e+5]]+"-"+Vt[t[e+6]]+Vt[t[e+7]]+"-"+Vt[t[e+8]]+Vt[t[e+9]]+"-"+Vt[t[e+10]]+Vt[t[e+11]]+Vt[t[e+12]]+Vt[t[e+13]]+Vt[t[e+14]]+Vt[t[e+15]]).toLowerCase()}import BB from"node:crypto";var fh=new Uint8Array(256),ph=fh.length;function Ad(){return ph>fh.length-16&&(BB.randomFillSync(fh),ph=0),fh.slice(ph,ph+=16)}function ZB(t){t=unescape(encodeURIComponent(t));let e=[];for(let r=0;rDn&&t.msecs===void 0&&(Dn=s,a!==null&&(c=null,u=null)),a!==null&&(a>2147483647&&(a=2147483647),c=a>>>19&4095,u=a&524287),(c===null||u===null)&&(c=i[6]&127,c=c<<8|i[7],u=i[8]&63,u=u<<8|i[9],u=u<<5|i[10]>>>3),s+1e4>Dn&&a===null?++u>524287&&(u=0,++c>4095&&(c=0,Dn++)):Dn=s,xO=c,wO=u,o[n++]=Dn/1099511627776&255,o[n++]=Dn/4294967296&255,o[n++]=Dn/16777216&255,o[n++]=Dn/65536&255,o[n++]=Dn/256&255,o[n++]=Dn&255,o[n++]=c>>>4&15|112,o[n++]=c&255,o[n++]=u>>>13&63|128,o[n++]=u>>>5&255,o[n++]=u<<3&255|i[10]&7,o[n++]=i[11],o[n++]=i[12],o[n++]=i[13],o[n++]=i[14],o[n++]=i[15],e||cu(o)}var nx=XB;var YB={};G(YB,{BaseCallbackHandler:()=>la,callbackHandlerPrefersStreaming:()=>Od,isBaseCallbackHandler:()=>ox});var QB=class{};function Od(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var la=class extends QB{lc_serializable=!1;get lc_namespace(){return["langchain_core","callbacks",this.name]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eh(this.constructor)]}lc_kwargs;ignoreLLM=!1;ignoreChain=!1;ignoreAgent=!1;ignoreRetriever=!1;ignoreCustomEvent=!1;raiseError=!1;awaitHandlers=It("LANGCHAIN_CALLBACKS_BACKGROUND")==="false";constructor(t){super(),this.lc_kwargs=t||{},t&&(this.ignoreLLM=t.ignoreLLM??this.ignoreLLM,this.ignoreChain=t.ignoreChain??this.ignoreChain,this.ignoreAgent=t.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=t.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=t.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=t.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(t._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return uo.prototype.toJSON.call(this)}toJSONNotImplemented(){return uo.prototype.toJSONNotImplemented.call(this)}static fromMethods(t){class e extends la{name=Et();constructor(){super(),Object.assign(this,t)}}return new e}},ox=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"};var IO="gen_ai.operation.name",SO="gen_ai.system",ix="gen_ai.request.model",kO="gen_ai.response.model",sx="gen_ai.usage.input_tokens",ax="gen_ai.usage.output_tokens",cx="gen_ai.usage.total_tokens",TO="gen_ai.request.max_tokens",EO="gen_ai.request.temperature",AO="gen_ai.request.top_p",OO="gen_ai.request.frequency_penalty",PO="gen_ai.request.presence_penalty",CO="gen_ai.response.finish_reasons",RO="gen_ai.prompt",NO="gen_ai.completion",zO="gen_ai.request.extra_query",MO="gen_ai.request.extra_body",jO="gen_ai.serialized.name",DO="gen_ai.serialized.signature",LO="gen_ai.serialized.doc",UO="gen_ai.response.id",FO="gen_ai.response.service_tier",BO="gen_ai.response.system_fingerprint",ZO="gen_ai.usage.input_token_details",qO="gen_ai.usage.output_token_details",VO="langsmith.trace.session_id",GO="langsmith.trace.session_name",KO="langsmith.span.kind",HO="langsmith.trace.name",WO="langsmith.metadata",ux="langsmith.span.tags";var JO="langsmith.request.streaming",XO="langsmith.request.headers";var t6=(...t)=>fetch(...t),YO=Symbol.for("ls:fetch_implementation");var QO=()=>{let t=globalThis[YO];return t?typeof t=="function"&&"Headers"in t&&"Request"in t&&"Response"in t:!1},eP=t=>async(...e)=>{if(t||At("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[YO]??t6)(...e);return(t||At("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r};var Pd=()=>At("PROJECT")??Qr("LANGCHAIN_SESSION")??"default";var tP={};function uu(t){tP[t]||(console.warn(t),tP[t]=!0)}var r6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function $e(t,e){if(!r6.test(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}function mh(t){let e=typeof t=="string"?Date.parse(t):t;return nx({msecs:e,seq:0})}var hh="0.3.82";var po,n6=()=>typeof window<"u"&&typeof window.document<"u",o6=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",i6=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),rP=()=>typeof Deno<"u",s6=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!rP(),px=()=>po||(typeof Bun<"u"?po="bun":n6()?po="browser":s6()?po="node":o6()?po="webworker":i6()?po="jsdom":rP()?po="deno":po="other",po),lx;function gh(){if(lx===void 0){let t=px(),e=c6();lx={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:hh,...e}}return lx}function fx(){let t=a6(),e={},r=["LANGCHAIN_API_KEY","LANGCHAIN_ENDPOINT","LANGCHAIN_TRACING_V2","LANGCHAIN_PROJECT","LANGCHAIN_SESSION","LANGSMITH_API_KEY","LANGSMITH_ENDPOINT","LANGSMITH_TRACING_V2","LANGSMITH_PROJECT","LANGSMITH_SESSION"];for(let[n,o]of Object.entries(t))typeof o=="string"&&!r.includes(n)&&!n.toLowerCase().includes("key")&&!n.toLowerCase().includes("secret")&&!n.toLowerCase().includes("token")&&(n==="LANGCHAIN_REVISION_ID"?e.revision_id=o:e[n]=o);return e}function a6(){let t={};try{if(typeof process<"u"&&process.env)for(let[e,r]of Object.entries(process.env))(e.startsWith("LANGCHAIN_")||e.startsWith("LANGSMITH_"))&&r!=null&&((e.toLowerCase().includes("key")||e.toLowerCase().includes("secret")||e.toLowerCase().includes("token"))&&typeof r=="string"?t[e]=r.slice(0,2)+"*".repeat(r.length-4)+r.slice(-2):t[e]=r)}catch{}return t}function Qr(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function At(t){return Qr(`LANGSMITH_${t}`)||Qr(`LANGCHAIN_${t}`)}var dx;function c6(){if(dx!==void 0)return dx;let t=["VERCEL_GIT_COMMIT_SHA","NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA","COMMIT_REF","RENDER_GIT_COMMIT","CI_COMMIT_SHA","CIRCLE_SHA1","CF_PAGES_COMMIT_SHA","REACT_APP_GIT_SHA","SOURCE_VERSION","GITHUB_SHA","TRAVIS_COMMIT","GIT_COMMIT","BUILD_VCS_NUMBER","bamboo_planRepository_revision","Build.SourceVersion","BITBUCKET_COMMIT","DRONE_COMMIT_SHA","SEMAPHORE_GIT_SHA","BUILDKITE_COMMIT"],e={};for(let r of t){let n=Qr(r);n!==void 0&&(e[r]=n)}return dx=e,e}function _h(){return Qr("OTEL_ENABLED")==="true"||At("OTEL_ENABLED")==="true"}var gx=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&_h()&&(console.warn('You have enabled OTEL export via the `OTEL_ENABLED` or `LANGSMITH_OTEL_ENABLED` environment variable, but have not initialized the required OTEL instances. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0);let n;if(r.length===1&&typeof r[0]=="function"?n=r[0]:r.length===2&&typeof r[1]=="function"?n=r[1]:r.length===3&&typeof r[2]=="function"&&(n=r[2]),typeof n=="function")return n()}},_x=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new gx})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},yx=class{active(){return{}}with(e,r){return r()}},mx=Symbol.for("ls:otel_trace"),hx=Symbol.for("ls:otel_context"),nP=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),u6=new _x,l6=new yx,vx=class{getTraceInstance(){return globalThis[mx]??u6}getContextInstance(){return globalThis[hx]??l6}initializeGlobalInstances(e){globalThis[mx]===void 0&&(globalThis[mx]=e.trace),globalThis[hx]===void 0&&(globalThis[hx]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[nP]=e}getDefaultOTLPTracerComponents(){return globalThis[nP]??void 0}},bx=new vx;function yh(){return bx.getTraceInstance()}function oP(){return bx.getContextInstance()}function iP(){return bx.getDefaultOTLPTracerComponents()}var d6={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};function p6(t){return d6[t]||t}var vh=class{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(e,r){for(let n of e)try{if(!n.run)continue;if(n.operation==="post"){let o=this.createSpanForRun(n,n.run,r.get(n.id));o&&!n.run.end_time&&this.spans.set(n.id,o)}else this.updateSpanForRun(n,n.run)}catch(o){console.error(`Error processing operation ${n.id}:`,o)}}createSpanForRun(e,r,n){let o=n&&yh().getSpan(n);if(o)try{return this.finishSpanSetup(o,r,e)}catch(i){console.error(`Failed to create span for run ${e.id}:`,i);return}}finishSpanSetup(e,r,n){return this.setSpanAttributes(e,r,n),r.error?(e.setStatus({code:2}),e.recordException(new Error(r.error))):e.setStatus({code:1}),r.end_time&&e.end(new Date(r.end_time)),e}updateSpanForRun(e,r){try{let n=this.spans.get(e.id);if(!n){console.debug(`No span found for run ${e.id} during update`);return}this.setSpanAttributes(n,r,e),r.error?(n.setStatus({code:2}),n.recordException(new Error(r.error))):n.setStatus({code:1});let o=r.end_time;o&&(n.end(new Date(o)),this.spans.delete(e.id))}catch(n){console.error(`Failed to update span for run ${e.id}:`,n)}}extractModelName(e){if(e.extra?.metadata){let r=e.extra.metadata;if(r.ls_model_name)return r.ls_model_name;if(r.invocation_params){let n=r.invocation_params;if(n.model)return n.model;if(n.model_name)return n.model_name}}}setSpanAttributes(e,r,n){if("run_type"in r&&r.run_type){e.setAttribute(KO,r.run_type);let a=p6(r.run_type||"chain");e.setAttribute(IO,a)}"name"in r&&r.name&&e.setAttribute(HO,r.name),"session_id"in r&&r.session_id&&e.setAttribute(VO,r.session_id),"session_name"in r&&r.session_name&&e.setAttribute(GO,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute(ix,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute(sx,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(ax,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(cx,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[a,c]of Object.entries(i))c!=null&&e.setAttribute(`${WO}.${a}`,String(c));let s=r.tags;if(s&&Array.isArray(s)?e.setAttribute(ux,s.join(", ")):s&&e.setAttribute(ux,String(s)),"serialized"in r&&typeof r.serialized=="object"){let a=r.serialized;a.name&&e.setAttribute(jO,String(a.name)),a.signature&&e.setAttribute(DO,String(a.signature)),a.doc&&e.setAttribute(LO,String(a.doc))}this.setIOAttributes(e,n)}setGenAiSystem(e,r){let n="langchain",o=this.extractModelName(r);if(o){let i=o.toLowerCase();i.includes("anthropic")||i.startsWith("claude")?n="anthropic":i.includes("bedrock")?n="aws.bedrock":i.includes("azure")&&i.includes("openai")?n="az.ai.openai":i.includes("azure")&&i.includes("inference")?n="az.ai.inference":i.includes("cohere")?n="cohere":i.includes("deepseek")?n="deepseek":i.includes("gemini")?n="gemini":i.includes("groq")?n="groq":i.includes("watson")||i.includes("ibm")?n="ibm.watsonx.ai":i.includes("mistral")?n="mistral_ai":i.includes("gpt")||i.includes("openai")?n="openai":i.includes("perplexity")||i.includes("sonar")?n="perplexity":i.includes("vertex")?n="vertex_ai":(i.includes("xai")||i.includes("grok"))&&(n="xai")}e.setAttribute(SO,n)}setInvocationParameters(e,r){if(!r.extra?.metadata?.invocation_params)return;let n=r.extra.metadata.invocation_params;n.max_tokens!==void 0&&e.setAttribute(TO,n.max_tokens),n.temperature!==void 0&&e.setAttribute(EO,n.temperature),n.top_p!==void 0&&e.setAttribute(AO,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(OO,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute(PO,n.presence_penalty)}setIOAttributes(e,r){if(r.run.inputs)try{let n=r.run.inputs;typeof n=="object"&&n!==null&&(n.model&&Array.isArray(n.messages)&&e.setAttribute(ix,n.model),n.stream!==void 0&&e.setAttribute(JO,n.stream),n.extra_headers&&e.setAttribute(XO,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute(zO,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(MO,JSON.stringify(n.extra_body))),e.setAttribute(RO,JSON.stringify(n))}catch(n){console.debug(`Failed to process inputs for run ${r.id}`,n)}if(r.run.outputs)try{let n=r.run.outputs,o=this.getUnifiedRunTokens(n);if(o&&(e.setAttribute(sx,o[0]),e.setAttribute(ax,o[1]),e.setAttribute(cx,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(kO,String(n.model)),n.id&&e.setAttribute(UO,n.id),n.choices&&Array.isArray(n.choices)){let i=n.choices.map(s=>s.finish_reason).filter(s=>s).map(String);i.length>0&&e.setAttribute(CO,i.join(", "))}if(n.service_tier&&e.setAttribute(FO,n.service_tier),n.system_fingerprint&&e.setAttribute(BO,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let i=n.usage_metadata;i.input_token_details&&e.setAttribute(ZO,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(qO,JSON.stringify(i.output_token_details))}}e.setAttribute(NO,JSON.stringify(n))}catch(n){console.debug(`Failed to process outputs for run ${r.id}`,n)}}getUnifiedRunTokens(e){if(!e)return null;let r=this.extractUnifiedRunTokens(e.usage_metadata);if(r)return r;let n=Object.keys(e);for(let s of n){let a=e[s];if(!(!a||typeof a!="object")&&(r=this.extractUnifiedRunTokens(a.usage_metadata),r||a.lc===1&&a.kwargs&&typeof a.kwargs=="object"&&(r=this.extractUnifiedRunTokens(a.kwargs.usage_metadata),r)))return r}let o=e.generations||[];if(!Array.isArray(o))return null;let i=Array.isArray(o[0])?o.flat():o;for(let s of i)if(typeof s=="object"&&s.message&&typeof s.message=="object"&&s.message.kwargs&&typeof s.message.kwargs=="object"&&(r=this.extractUnifiedRunTokens(s.message.kwargs.usage_metadata),r))return r;return null}extractUnifiedRunTokens(e){return!e||typeof e!="object"||typeof e.input_tokens!="number"||typeof e.output_tokens!="number"?null:[e.input_tokens,e.output_tokens]}};var f6=Object.prototype.toString,m6=t=>f6.call(t)==="[object Error]",h6=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function wx(t){if(!(t&&m6(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:h6.has(r)}function g6(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function bh(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(_),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},_=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&_.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function $x(t,e={}){if(e={...e},g6(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,bh("factor",e.factor,{min:0,allowInfinity:!1}),bh("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),bh("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),bh("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await y6({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var kh=mn(Sh(),1),T6=[408,425,429,500,502,503,504],Rd=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxQueueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.maxQueueSizeBytes=e.maxQueueSizeBytes,"default"in kh.default?this.queue=new kh.default.default({concurrency:this.maxConcurrency}):this.queue=new kh.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){return this.callWithOptions({},e,...r)}callWithOptions(e,r,...n){let o=e.sizeBytes??0;if(this.maxQueueSizeBytes!==void 0&&o>0&&this.queueSizeBytes+o>this.maxQueueSizeBytes)return Promise.reject(new Error(`Queue size limit (${this.maxQueueSizeBytes} bytes) exceeded. Current queue size: ${this.queueSizeBytes} bytes, attempted addition: ${o} bytes.`));o>0&&(this.queueSizeBytes+=o);let i=this.onFailedResponseHook,s=this.queue.add(()=>$x(()=>r(...n).catch(a=>{throw a instanceof Error?a:new Error(a)}),{async onFailedAttempt({error:a}){if(a.message.startsWith("Cancel")||a.message.startsWith("TimeoutError")||a.name==="TimeoutError"||a.message.startsWith("AbortError")||a?.code==="ECONNABORTED")throw a;let c=a?.response;if(i&&await i(c))return;let u=c?.status??a?.status;if(u&&!T6.includes(+u))throw a},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0});return o>0&&(s=s.finally(()=>{this.queueSizeBytes-=o})),e.signal?Promise.race([s,new Promise((a,c)=>{e.signal?.addEventListener("abort",()=>{c(new Error("AbortError"))})})]):s}};function Ox(t){return typeof t?._getType=="function"}function Px(t){let e={type:t._getType(),data:{content:t.content}};return t?.additional_kwargs&&Object.keys(t.additional_kwargs).length>0&&(e.data.additional_kwargs={...t.additional_kwargs}),e}var $q=mn(oR(),1);function Wo(t){if(!t||t.split("/").length>2||t.startsWith("/")||t.endsWith("/")||t.split(":").length>2)throw new Error(`Invalid identifier format: ${t}`);let[e,r]=t.split(":"),n=r||"latest";if(e.includes("/")){let[o,i]=e.split("/",2);if(!o||!i)throw new Error(`Invalid identifier format: ${t}`);return[o,i,n]}else{if(!e)throw new Error(`Invalid identifier format: ${t}`);return["-",e,n]}}var Xx=class extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}};async function ue(t,e,r){let n;if(t.ok){r&&(n=await t.text());return}if(t.status===403)try{(await t.json())?.error==="org_scoped_key_requires_workspace"&&(n="This API key is org-scoped and requires workspace specification. Please provide 'workspaceId' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.")}catch{let a=new Error(`${t.status} ${t.statusText}`);throw a.status=t?.status,a}if(n===void 0)try{n=await t.text()}catch{n=""}let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Message: ${n}`;if(t.status===409)throw new Xx(o);let i=new Error(o);throw i.status=t.status,i}var iR="ERR_CONFLICTING_ENDPOINTS",Lh=class extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:iR}),this.name="ConflictingEndpointsError"}};function sR(t){return typeof t=="object"&&t!==null&&t.code===iR}var aR="[...]",Iq={result:"[Circular]"},Fh=[],du=[],Sq=new TextEncoder;function kq(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Uh(t){return Sq.encode(t)}function cR(t){if(t&&typeof t=="object"&&t!==null){if(t instanceof Map)return Object.fromEntries(t);if(t instanceof Set)return Array.from(t);if(t instanceof Date)return t.toISOString();if(t instanceof RegExp)return t.toString();if(t instanceof Error)return{name:t.name,message:t.message}}else if(typeof t=="bigint")return t.toString();return t}function Tq(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return cR(r)}}function Pr(t,e,r,n,o){try{let i=JSON.stringify(t,Tq(r),n);return Uh(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?` +Context: ${e}`:""}`),Uh("[Unserializable]");At("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?` +Context: ${e}`:""}`),typeof o>"u"&&(o=kq()),Qx(t,"",0,[],void 0,0,o);let s;try{du.length===0?s=JSON.stringify(t,r,n):s=JSON.stringify(t,Eq(r),n)}catch{return Uh("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Fh.length!==0;){let a=Fh.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return Uh(s)}}function Yx(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),Fh.push([n,r,e,o])):du.push([e,r,t]):(n[r]=t,Fh.push([n,r,e]))}function Qx(t,e,r,n,o,i,s){i+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;as.depthLimit){Yx(aR,t,e,o);return}if(typeof s.edgesLimit<"u"&&r+1>s.edgesLimit){Yx(aR,t,e,o);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n{let e=t?.toString()??At("TRACING_SAMPLING_RATE");if(e===void 0)return;let r=parseFloat(e);if(r<0||r>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${r}`);return r},Oq=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};async function Pq(t){let e=[];for await(let r of t)e.push(r);return e}function Bh(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}var Cq=async t=>{if(t?.status===429){let e=parseInt(t.headers.get("retry-after")??"10",10)*1e3;if(e>0)return await new Promise(r=>setTimeout(r,e)),!0}return!1};function lR(t){return typeof t=="number"?Number(t.toFixed(4)):t}var Rq=24*1024*1024,fR=1024*1024*1024,Nq=1e4,zq=100,dR="https://api.smith.langchain.com",e0=class{constructor(e){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSizeBytes=e??fR}peek(){return this.items[0]}push(e){let r,n=new Promise(i=>{r=i}),o=Pr(e.item,`Serializing run with id: ${e.item.id}`).length;return this.sizeBytes+o>this.maxSizeBytes&&this.items.length>0?(console.warn(`AutoBatchQueue size limit (${this.maxSizeBytes} bytes) exceeded. Dropping run with id: ${e.item.id}. Current queue size: ${this.sizeBytes} bytes, attempted addition: ${o} bytes.`),r(),n):(this.items.push({action:e.action,payload:e.item,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n)}pop({upToSizeBytes:e,upToSize:r}){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let n=[],o=0;for(;o+(this.peek()?.size??0)0&&n.length0){let i=this.items.shift();n.push(i),o+=i.size,this.sizeBytes-=i.size}return[n.map(i=>({action:i.action,item:i.payload,otelContext:i.otelContext,apiKey:i.apiKey,apiUrl:i.apiUrl,size:i.size})),()=>n.forEach(i=>i.itemPromiseResolve())]}},da=class t{get _fetch(){return this.fetchImplementation||eP(this.debug)}constructor(e={}){Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"webUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"workspaceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchIngestCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout_ms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tenantId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filteredPostUuids",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchAggregationDelayMs",{enumerable:!0,configurable:!0,writable:!0,value:250}),Object.defineProperty(this,"batchSizeBytesLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSizeLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"blockOnRootRunFinalization",{enumerable:!0,configurable:!0,writable:!0,value:Qr("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"langSmithToOTELTranslator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchImplementation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cachedLSEnvVarsForMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Qr("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=Aq(e.tracingSamplingRate),this.apiUrl=Bh(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=Bh(e.apiKey??r.apiKey),this.webUrl=Bh(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=Bh(e.workspaceId??At("WORKSPACE_ID")),this.timeout_ms=e.timeout_ms??9e4,this.caller=new Rd({...e.callerOptions??{},maxRetries:4,debug:e.debug??this.debug}),this.traceBatchConcurrency=e.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.debug=e.debug??this.debug,this.fetchImplementation=e.fetchImplementation;let n=e.maxIngestMemoryBytes??fR;this.batchIngestCaller=new Rd({maxRetries:4,maxConcurrency:this.traceBatchConcurrency,maxQueueSizeBytes:n,...e.callerOptions??{},onFailedResponseHook:Cq,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.autoBatchQueue=new e0(n),this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.batchSizeLimit=e.batchSizeLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode,_h()&&(this.langSmithToOTELTranslator=new vh),this.cachedLSEnvVarsForMetadata=fx()}static getDefaultClientConfig(){let e=At("API_KEY"),r=At("ENDPOINT")??dR,n=At("HIDE_INPUTS")==="true",o=At("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:Oq(this.apiUrl)?(this.webUrl="http://localhost:3000",this.webUrl):this.apiUrl.endsWith("/api/v1")?(this.webUrl=this.apiUrl.replace("/api/v1",""),this.webUrl):this.apiUrl.includes("/api")&&!this.apiUrl.split(".",1)[0].endsWith("api")?(this.webUrl=this.apiUrl.replace("/api",""),this.webUrl):this.apiUrl.split(".",1)[0].includes("dev")?(this.webUrl="https://dev.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("eu")?(this.webUrl="https://eu.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("beta")?(this.webUrl="https://beta.smith.langchain.com",this.webUrl):(this.webUrl="https://smith.langchain.com",this.webUrl)}get headers(){let e={"User-Agent":`langsmith-js/${hh}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),this.workspaceId&&(e["x-tenant-id"]=this.workspaceId),e}_getPlatformEndpointPath(e){return this.apiUrl.slice(-3)!=="/v1"&&this.apiUrl.slice(-4)!=="/v1/"?`/v1/platform/${e}`:`/platform/${e}`}async processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}async processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}async prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`;return await this.caller.call(async()=>{let s=await this._fetch(o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,`fetch ${e}`),s})}async _get(e,r){return(await this._getResponse(e,r)).json()}async*_getPaginated(e,r=new URLSearchParams,n){let o=Number(r.get("offset"))||0,i=Number(r.get("limit"))||100;for(;;){r.set("offset",String(o)),r.set("limit",String(i));let s=`${this.apiUrl}${e}?${r}`,a=await this.caller.call(async()=>{let u=await this._fetch(s,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(u,`fetch ${e}`),u}),c=n?n(await a.json()):await a.json();if(c.length===0||(yield c,c.length{let l=await this._fetch(`${this.apiUrl}${e}`,{method:n,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(l,`fetch ${e}`),l})).json();if(!c||!c[o])break;yield c[o];let u=c.cursors;if(!u||!u.next)break;i.cursor=u.next}}_shouldSample(){return this.tracingSampleRate===void 0?!0:Math.random()0;){let[o,i]=this.autoBatchQueue.pop({upToSizeBytes:e,upToSize:r});if(!o.length){i();break}let s=o.reduce((u,l)=>{let d=l.apiUrl??this.apiUrl,f=l.apiKey??this.apiKey,m=l.apiKey===this.apiKey&&l.apiUrl===this.apiUrl?"default":`${d}|${f}`;return u[m]||(u[m]=[]),u[m].push(l),u},{}),a=[];for(let[u,l]of Object.entries(s)){let d=this._processBatch(l,{apiUrl:u==="default"?void 0:u.split("|")[0],apiKey:u==="default"?void 0:u.split("|")[1]});a.push(d)}let c=Promise.all(a).finally(i);n.push(c)}return Promise.all(n)}async _processBatch(e,r){if(!e.length)return;let n=e.reduce((o,i)=>o+(i.size??0),0);try{if(this.langSmithToOTELTranslator!==void 0)this._sendBatchToOTELTranslator(e);else{let o={runCreates:e.filter(s=>s.action==="create").map(s=>s.item),runUpdates:e.filter(s=>s.action==="update").map(s=>s.item)},i=await this._ensureServerInfo();if(i?.batch_ingest_config?.use_multipart_endpoint){let s=i?.instance_flags?.gzip_body_enabled;await this.multipartIngestRuns(o,{...r,useGzip:s,sizeBytes:n})}else await this.batchIngestRuns(o,{...r,sizeBytes:n})}}catch(o){console.error("Error exporting batch:",o)}}_sendBatchToOTELTranslator(e){if(this.langSmithToOTELTranslator!==void 0){let r=new Map,n=[];for(let o of e)o.item.id&&o.otelContext&&(r.set(o.item.id,o.otelContext),o.action==="create"?n.push({operation:"post",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}):n.push({operation:"patch",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}));this.langSmithToOTELTranslator.exportBatch(n,r)}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.item=uR(e.item,this.cachedLSEnvVarsForMetadata);let r=this.autoBatchQueue.push(e);if(this.manualFlushMode)return r;let n=await this._getBatchSizeLimitBytes(),o=await this._getBatchSizeLimit();return(this.autoBatchQueue.sizeBytes>n||this.autoBatchQueue.items.length>o)&&this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o}),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o})},this.autoBatchAggregationDelayMs)),r}async _getServerInfo(){let r=await(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(Nq),...this.fetchOptions});return await ue(n,"get server info"),n})).json();return this.debug&&console.log(` +=== LangSmith Server Configuration === +`+JSON.stringify(r,null,2)+` +`),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch(e){console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${e.status??"Unspecified status code"} ${e.message}`)}return this._serverInfo??{}})()),this._getServerInfoPromise.then(e=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),e))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let e=await this._getBatchSizeLimitBytes(),r=await this._getBatchSizeLimit();await this.drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:r})}_cloneCurrentOTELContext(){let e=yh(),r=oP();if(this.langSmithToOTELTranslator!==void 0){let n=e.getActiveSpan();if(n)return e.setSpan(r.active(),n)}}async createRun(e,r){if(!this._filterForSampling([e]).length)return;let n={...this.headers,"Content-Type":"application/json"},o=e.project_name;delete e.project_name;let i=await this.prepareRunCreateOrUpdateInputs({session_name:o,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&i.trace_id!==void 0&&i.dotted_order!==void 0){let c=this._cloneCurrentOTELContext();this.processRunOperation({action:"create",item:i,otelContext:c,apiKey:r?.apiKey,apiUrl:r?.apiUrl}).catch(console.error);return}let s=uR(i,this.cachedLSEnvVarsForMetadata);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),r?.workspaceId!==void 0&&(n["x-tenant-id"]=r.workspaceId);let a=Pr(s,`Creating run with id: ${s.id}`);await this.caller.call(async()=>{let c=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"create run",!0),c})}async batchIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o=await Promise.all(e?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]),i=await Promise.all(r?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]);if(o.length>0&&i.length>0){let c=o.reduce((l,d)=>(d.id&&(l[d.id]=d),l),{}),u=[];for(let l of i)l.id!==void 0&&c[l.id]?c[l.id]={...c[l.id],...l}:u.push(l);o=Object.values(c),i=u}let s={post:o,patch:i};if(!s.post.length&&!s.patch.length)return;let a={post:[],patch:[]};for(let c of["post","patch"]){let u=c,l=s[u].reverse(),d=l.pop();for(;d!==void 0;)a[u].push(d),d=l.pop()}if(a.post.length>0||a.patch.length>0){let c=a.post.map(u=>u.id).concat(a.patch.map(u=>u.id)).join(",");await this._postBatchIngestRuns(Pr(a,`Ingesting runs with ids: ${c}`),n)}}async _postBatchIngestRuns(e,r){let n={...this.headers,"Content-Type":"application/json",Accept:"application/json"};r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),await this.batchIngestCaller.callWithOptions({sizeBytes:r?.sizeBytes},async()=>{let o=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:e});return await ue(o,"batch create run",!0),o})}async multipartIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o={},i=[];for(let d of e??[]){let f=await this.prepareRunCreateOrUpdateInputs(d);f.id!==void 0&&f.attachments!==void 0&&(o[f.id]=f.attachments),delete f.attachments,i.push(f)}let s=[];for(let d of r??[])s.push(await this.prepareRunCreateOrUpdateInputs(d));if(i.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(s.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(i.length>0&&s.length>0){let d=i.reduce((p,m)=>(m.id&&(p[m.id]=m),p),{}),f=[];for(let p of s)p.id!==void 0&&d[p.id]?d[p.id]={...d[p.id],...p}:f.push(p);i=Object.values(d),s=f}if(i.length===0&&s.length===0)return;let u=[],l=[];for(let[d,f]of[["post",i],["patch",s]])for(let p of f){let{inputs:m,outputs:h,events:_,extra:v,error:b,serialized:x,attachments:k,...T}=p,F={inputs:m,outputs:h,events:_,extra:v,error:b,serialized:x},J=Pr(T,`Serializing for multipart ingestion of run with id: ${T.id}`);l.push({name:`${d}.${T.id}`,payload:new Blob([J],{type:`application/json; length=${J.length}`})});for(let[w,Z]of Object.entries(F)){if(Z===void 0)continue;let oe=Pr(Z,`Serializing ${w} for multipart ingestion of run with id: ${T.id}`);l.push({name:`${d}.${T.id}.${w}`,payload:new Blob([oe],{type:`application/json; length=${oe.length}`})})}if(T.id!==void 0){let w=o[T.id];if(w){delete o[T.id];for(let[Z,oe]of Object.entries(w)){let Q,wt;if(Array.isArray(oe)?[Q,wt]=oe:(Q=oe.mimeType,wt=oe.data),Z.includes(".")){console.warn(`Skipping attachment '${Z}' for run ${T.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}l.push({name:`attachment.${T.id}.${Z}`,payload:new Blob([wt],{type:`${Q}; length=${wt.byteLength}`})})}}}u.push(`trace=${T.trace_id},id=${T.id}`)}await this._sendMultipartRequest(l,u.join("; "),n)}async _createNodeFetchBody(e,r){let n=[];for(let s of e)n.push(new Blob([`--${r}\r +`])),n.push(new Blob([`Content-Disposition: form-data; name="${s.name}"\r +`,`Content-Type: ${s.payload.type}\r +\r +`])),n.push(s.payload),n.push(new Blob([`\r +`]));return n.push(new Blob([`--${r}--\r +`])),await new Blob(n).arrayBuffer()}async _createMultipartStream(e,r){let n=new TextEncoder;return new ReadableStream({async start(i){let s=async a=>{typeof a=="string"?i.enqueue(n.encode(a)):i.enqueue(a)};for(let a of e){await s(`--${r}\r +`),await s(`Content-Disposition: form-data; name="${a.name}"\r +`),await s(`Content-Type: ${a.payload.type}\r +\r +`);let u=a.payload.stream().getReader();try{let l;for(;!(l=await u.read()).done;)i.enqueue(l.value)}finally{u.releaseLock()}await s(`\r +`)}await s(`--${r}--\r +`),i.close()}})}async _sendMultipartRequest(e,r,n){let o="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),i=QO(),s=()=>this._createNodeFetchBody(e,o),a=()=>this._createMultipartStream(e,o),c=async u=>this.batchIngestCaller.callWithOptions({sizeBytes:n?.sizeBytes},async()=>{let l=await u(),d={...this.headers,"Content-Type":`multipart/form-data; boundary=${o}`};n?.apiKey!==void 0&&(d["x-api-key"]=n.apiKey);let f=l;n?.useGzip&&typeof l=="object"&&"pipeThrough"in l&&(f=l.pipeThrough(new CompressionStream("gzip")),d["Content-Encoding"]="gzip");let p=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:d,body:f,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(p,"Failed to send multipart request",!0),p});try{let u,l=!1;!i&&!this.multipartStreamingDisabled&&px()!=="bun"?(l=!0,u=await c(a)):u=await c(s),(!this.multipartStreamingDisabled||l)&&u.status===422&&(n?.apiUrl??this.apiUrl)!==dR&&(console.warn(`Streaming multipart upload to ${n?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${r}".`),this.multipartStreamingDisabled=!0,u=await c(s))}catch(u){console.warn(`${u.message.trim()} + +Context: ${r}`)}}async updateRun(e,r,n){$e(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let o={...r,id:e};if(!this._filterForSampling([o],!0).length)return;if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){let a=this._cloneCurrentOTELContext();if(r.end_time!==void 0&&o.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}else this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}let i={...this.headers,"Content-Type":"application/json"};n?.apiKey!==void 0&&(i["x-api-key"]=n.apiKey),n?.workspaceId!==void 0&&(i["x-tenant-id"]=n.workspaceId);let s=Pr(r,`Serializing payload to update run with id: ${e}`);await this.caller.call(async()=>{let a=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(a,"update run",!0),a})}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){$e(e);let n=await this._get(`/runs/${e}`);return r&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:r,projectOpts:n}){if(r!==void 0){let o;r.session_id?o=r.session_id:n?.projectName?o=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?o=n?.projectId:o=(await this.readProject({projectName:At("PROJECT")||"default"})).id;let i=await this._getTenantId();return`${this.getHostUrl()}/o/${i}/projects/p/${o}/r/${r.id}?poll=true`}else if(e!==void 0){let o=await this.readRun(e);if(!o.app_path)throw new Error(`Run ${e} has no app_path`);return`${this.getHostUrl()}${o.app_path}`}else throw new Error("Must provide either runId or run")}async _loadChildRuns(e){let r=await Pq(this.listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),n={},o={};r.sort((i,s)=>(i?.dotted_order??"").localeCompare(s?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.dotted_order?.startsWith(e.dotted_order??"")&&i.id!==e.id&&(i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i)}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:s,startTime:a,executionOrder:c,isRoot:u,runType:l,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:_,limit:v,select:b,order:x}=e,k=[];if(r&&(k=Array.isArray(r)?r:[r]),n){let w=Array.isArray(n)?n:[n],Z=await Promise.all(w.map(oe=>this.readProject({projectName:oe}).then(Q=>Q.id)));k.push(...Z)}let T=["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],F={session:k.length?k:null,run_type:l,reference_example:s,query:p,filter:m,trace_filter:h,tree_filter:_,execution_order:c,parent_run:o,start_time:a?a.toISOString():null,error:d,id:f,limit:v,trace:i,select:b||T,is_root:u,order:x};F.select.includes("child_run_ids")&&uu("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let J=0;for await(let w of this._getCursorPaginatedList("/runs/query",F))if(v){if(J>=v)break;if(w.length+J>v){yield*w.slice(0,v-J);break}J+=w.length,yield*w}else yield*w}async*listGroupRuns(e){let{projectId:r,projectName:n,groupBy:o,filter:i,startTime:s,endTime:a,limit:c,offset:u}=e,d={session_id:r||(await this.readProject({projectName:n})).id,group_by:o,filter:i,start_time:s?s.toISOString():null,end_time:a?a.toISOString():null,limit:Number(c)||100},f=Number(u)||0,p="/runs/group",m=`${this.apiUrl}${p}`;for(;;){let h={...d,offset:f},_=Object.fromEntries(Object.entries(h).filter(([F,J])=>J!==void 0)),v=JSON.stringify(_),x=await(await this.caller.call(async()=>{let F=await this._fetch(m,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:v});return await ue(F,`Failed to fetch ${p}`),F})).json(),{groups:k,total:T}=x;if(k.length===0)break;for(let F of k)yield F;if(f+=k.length,f>=T)break}}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:s,referenceExampleIds:a,startTime:c,endTime:u,error:l,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:_}){let v=s||[];i&&(v=[...s||[],...await Promise.all(i.map(J=>this.readProject({projectName:J}).then(w=>w.id)))]);let x=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:v,reference_example:a,start_time:c,end_time:u,error:l,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:_}).filter(([J,w])=>w!==void 0)),k=JSON.stringify(x);return await(await this.caller.call(async()=>{let J=await this._fetch(`${this.apiUrl}/runs/stats`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:k});return await ue(J,"get run stats"),J})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||Et()};$e(e);let o=JSON.stringify(n),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ue(a,"share run"),a})).json();if(s===null||!("share_token"in s))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${s.share_token}/r`}async unshareRun(e){$e(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"unshare run",!0),r})}async readRunSharedLink(e){$e(e);let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"read run shared link"),o})).json();if(!(n===null||!("share_token"in n)))return`${this.getHostUrl()}/public/${n.share_token}/r`}async listSharedRuns(e,{runIds:r}={}){let n=new URLSearchParams({share_token:e});if(r!==void 0)for(let s of r)n.append("id",s);return $e(e),await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"list shared runs"),s})).json()}async readDatasetSharedSchema(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id),$e(e);let o=await(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,"read dataset shared schema"),i})).json();return o.url=`${this.getHostUrl()}/public/${o.share_token}/d`,o}async shareDataset(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id);let n={dataset_id:e};$e(e);let o=JSON.stringify(n),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ue(a,"share dataset"),a})).json();return s.url=`${this.getHostUrl()}/public/${s.share_token}/d`,s}async unshareDataset(e){$e(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"unshare dataset",!0),r})}async readSharedDataset(e){return $e(e),await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"read shared dataset"),o})).json()}async listSharedExamples(e,r){let n={};r?.exampleIds&&(n.id=r.exampleIds);let o=new URLSearchParams;Object.entries(n).forEach(([a,c])=>{Array.isArray(c)?c.forEach(u=>o.append(a,u)):o.append(a,c)});let i=await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/public/${e}/examples?${o.toString()}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(a,"list shared examples"),a}),s=await i.json();if(!i.ok)throw"detail"in s?new Error(`Failed to list shared examples. +Status: ${i.status} +Message: ${Array.isArray(s.detail)?s.detail.join(` +`):"Unspecified error"}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return s.map(a=>({...a,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:r=null,metadata:n=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:s=null}){let a=o?"?upsert=true":"",c=`${this.apiUrl}/sessions${a}`,u=i||{};n&&(u.metadata=n);let l={name:e,extra:u,description:r};s!==null&&(l.reference_dataset_id=s);let d=JSON.stringify(l);return await(await this.caller.call(async()=>{let m=await this._fetch(c,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:d});return await ue(m,"create project"),m})).json()}async updateProject(e,{name:r=null,description:n=null,metadata:o=null,projectExtra:i=null,endTime:s=null}){let a=`${this.apiUrl}/sessions/${e}`,c=i;o&&(c={...c||{},metadata:o});let u=JSON.stringify({name:r,extra:c,description:n,end_time:s?new Date(s).toISOString():null});return await(await this.caller.call(async()=>{let f=await this._fetch(a,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"update project"),f})).json()}async hasProject({projectId:e,projectName:r}){let n="/sessions",o=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)$e(e),n+=`/${e}`;else if(r!==void 0)o.append("name",r);else throw new Error("Must provide projectName or projectId");let i=await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${n}?${o}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"has project"),s});try{let s=await i.json();return i.ok?Array.isArray(s)?s.length>0:!0:!1}catch{return!1}}async readProject({projectId:e,projectName:r,includeStats:n}){let o="/sessions",i=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)$e(e),o+=`/${e}`;else if(r!==void 0)i.append("name",r);else throw new Error("Must provide projectName or projectId");n!==void 0&&i.append("include_stats",n.toString());let s=await this._get(o,i),a;if(Array.isArray(s)){if(s.length===0)throw new Error(`Project[id=${e}, name=${r}] not found`);a=s[0]}else a=s;return a}async getProjectUrl({projectId:e,projectName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either projectName or projectId");let n=await this.readProject({projectId:e,projectName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/projects/p/${n.id}`}async getDatasetUrl({datasetId:e,datasetName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");let n=await this.readDataset({datasetId:e,datasetName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/datasets/${n.id}`}async _getTenantId(){if(this._tenantId!==null)return this._tenantId;let e=new URLSearchParams({limit:"1"});for await(let r of this._getPaginated("/sessions",e))return this._tenantId=r[0].tenant_id,r[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:e,name:r,nameContains:n,referenceDatasetId:o,referenceDatasetName:i,includeStats:s,datasetVersion:a,referenceFree:c,metadata:u}={}){let l=new URLSearchParams;if(e!==void 0)for(let d of e)l.append("id",d);if(r!==void 0&&l.append("name",r),n!==void 0&&l.append("name_contains",n),o!==void 0)l.append("reference_dataset",o);else if(i!==void 0){let d=await this.readDataset({datasetName:i});l.append("reference_dataset",d.id)}s!==void 0&&l.append("include_stats",s.toString()),a!==void 0&&l.append("dataset_version",a),c!==void 0&&l.append("reference_free",c.toString()),u!==void 0&&l.append("metadata",JSON.stringify(u));for await(let d of this._getPaginated("/sessions",l))yield*d}async deleteProject({projectId:e,projectName:r}){let n;if(e===void 0&&r===void 0)throw new Error("Must provide projectName or projectId");if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");e===void 0?n=(await this.readProject({projectName:r})).id:n=e,$e(n),await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,`delete session ${n} (${r})`,!0),o})}async uploadCsv({csvFile:e,fileName:r,inputKeys:n,outputKeys:o,description:i,dataType:s,name:a}){let c=`${this.apiUrl}/datasets/upload`,u=new FormData;return u.append("file",e,r),n.forEach(f=>{u.append("input_keys",f)}),o.forEach(f=>{u.append("output_keys",f)}),i&&u.append("description",i),s&&u.append("data_type",s),a&&u.append("name",a),await(await this.caller.call(async()=>{let f=await this._fetch(c,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"upload CSV"),f})).json()}async createDataset(e,{description:r,dataType:n,inputsSchema:o,outputsSchema:i,metadata:s}={}){let a={name:e,description:r,extra:s?{metadata:s}:void 0};n&&(a.data_type=n),o&&(a.inputs_schema_definition=o),i&&(a.outputs_schema_definition=i);let c=JSON.stringify(a);return await(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(d,"create dataset"),d})).json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e&&r)throw new Error("Must provide either datasetName or datasetId, not both");if(e)$e(e),n+=`/${e}`;else if(r)o.append("name",r);else throw new Error("Must provide datasetName or datasetId");let i=await this._get(n,o),s;if(Array.isArray(i)){if(i.length===0)throw new Error(`Dataset[id=${e}, name=${r}] not found`);s=i[0]}else s=i;return s}async hasDataset({datasetId:e,datasetName:r}){try{return await this.readDataset({datasetId:e,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:r,fromVersion:n,toVersion:o}){let i=e;if(i===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:r})).id);let s=new URLSearchParams({from_version:typeof n=="string"?n:n.toISOString(),to_version:typeof o=="string"?o:o.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,s)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:r}){let n="/datasets";if(e===void 0)if(r!==void 0)e=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide either datasetName or datasetId");return(await(await this._getResponse(`${n}/${e}/openai_ft`)).text()).trim().split(` +`).map(a=>JSON.parse(a))}async*listDatasets({limit:e=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:s}={}){let a="/datasets",c=new URLSearchParams({limit:e.toString(),offset:r.toString()});if(n!==void 0)for(let u of n)c.append("id",u);o!==void 0&&c.append("name",o),i!==void 0&&c.append("name_contains",i),s!==void 0&&c.append("metadata",JSON.stringify(s));for await(let u of this._getPaginated(a,c))yield*u}async updateDataset(e){let{datasetId:r,datasetName:n,...o}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;$e(i);let s=JSON.stringify(o);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${i}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"update dataset"),c})).json()}async updateDatasetTag(e){let{datasetId:r,datasetName:n,asOf:o,tag:i}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let s=r??(await this.readDataset({datasetName:n})).id;$e(s);let a=JSON.stringify({as_of:typeof o=="string"?o:o.toISOString(),tag:i});await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${s}/tags`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"update dataset tags",!0),c})}async deleteDataset({datasetId:e,datasetName:r}){let n="/datasets",o=e;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(r!==void 0&&(o=(await this.readDataset({datasetName:r})).id),o!==void 0)$e(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");await this.caller.call(async()=>{let i=await this._fetch(this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,`delete ${n}`,!0),i})}async indexDataset({datasetId:e,datasetName:r,tag:n}){let o=e;if(!o&&!r)throw new Error("Must provide either datasetName or datasetId");if(o&&r)throw new Error("Must provide either datasetName or datasetId, not both");o||(o=(await this.readDataset({datasetName:r})).id),$e(o);let s=JSON.stringify({tag:n});await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${o}/index`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"index dataset"),c})).json()}async similarExamples(e,r,n,{filter:o}={}){let i={limit:n,inputs:e};o!==void 0&&(i.filter=o),$e(r);let s=JSON.stringify(i);return(await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${r}/search`,{headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,method:"POST",body:s});return await ue(u,"fetch similar examples"),u})).json()).examples}async createExample(e,r,n){if(pR(e)&&(r!==void 0||n!==void 0))throw new Error("Cannot provide outputs or options when using ExampleCreate object");let o=r?n?.datasetId:e.dataset_id,i=r?n?.datasetName:e.dataset_name;if(o===void 0&&i===void 0)throw new Error("Must provide either datasetName or datasetId");if(o!==void 0&&i!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");o===void 0&&(o=(await this.readDataset({datasetName:i})).id);let s=(r?n?.createdAt:e.created_at)||new Date,a;pR(e)?a=e:a={inputs:e,outputs:r,created_at:s?.toISOString(),id:n?.exampleId,metadata:n?.metadata,split:n?.split,source_run_id:n?.sourceRunId,use_source_run_io:n?.useSourceRunIO,use_source_run_attachments:n?.useSourceRunAttachments,attachments:n?.attachments};let c=await this._uploadExamplesMultipart(o,[a]);return await this.readExample(c.example_ids?.[0]??Et())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let b=e,x=b[0].dataset_id,k=b[0].dataset_name;if(x===void 0&&k===void 0)throw new Error("Must provide either datasetName or datasetId");if(x!==void 0&&k!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");x===void 0&&(x=(await this.readDataset({datasetName:k})).id);let T=await this._uploadExamplesMultipart(x,b);return await Promise.all(T.example_ids.map(J=>this.readExample(J)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:s,useSourceRunIOs:a,useSourceRunAttachments:c,attachments:u,exampleIds:l,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((b,x)=>({dataset_id:p,inputs:b,outputs:n?.[x],metadata:o?.[x],split:i?.[x],id:l?.[x],attachments:u?.[x],source_run_id:s?.[x],use_source_run_io:a?.[x],use_source_run_attachments:c?.[x]})),_=await this._uploadExamplesMultipart(p,h);return await Promise.all(_.example_ids.map(b=>this.readExample(b)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(s=>Ox(s)?Px(s):s),i=Ox(r)?Px(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){$e(e);let r=`/examples/${e}`,n=await this._get(r),{attachment_urls:o,...i}=n,s=i;return o&&(s.attachments=Object.entries(o).reduce((a,[c,u])=>(a[c.slice(11)]={presigned_url:u.presigned_url,mime_type:u.mime_type},a),{})),s}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:s,metadata:a,limit:c,offset:u,filter:l,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=o?typeof o=="string"?o:o?.toISOString():void 0;m&&p.append("as_of",m);let h=s??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let v of n)p.append("id",v);if(i!==void 0)for(let v of i)p.append("splits",v);if(a!==void 0){let v=JSON.stringify(a);p.append("metadata",v)}c!==void 0&&p.append("limit",c.toString()),u!==void 0&&p.append("offset",u.toString()),l!==void 0&&p.append("filter",l),d===!0&&["attachment_urls","outputs","metadata"].forEach(v=>p.append("select",v));let _=0;for await(let v of this._getPaginated("/examples",p)){for(let b of v){let{attachment_urls:x,...k}=b,T=k;x&&(T.attachments=Object.entries(x).reduce((F,[J,w])=>(F[J.slice(11)]={presigned_url:w.presigned_url,mime_type:w.mime_type||void 0},F),{})),yield T,_++}if(c!==void 0&&_>=c)break}}async deleteExample(e){$e(e);let r=`/examples/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,`delete ${r}`,!0),n})}async updateExample(e,r){let n;r?n=e:n=e.id,$e(n);let o;r?o={id:n,...r}:o=e;let i;return o.dataset_id!==void 0?i=o.dataset_id:i=(await this.readExample(n)).dataset_id,this._updateExamplesMultipart(i,[o])}async updateExamples(e){let r;return e[0].dataset_id===void 0?r=(await this.readExample(e[0].id)).dataset_id:r=e[0].dataset_id,this._updateExamplesMultipart(r,e)}async readDatasetVersion({datasetId:e,datasetName:r,asOf:n,tag:o}){let i;if(e?i=e:i=(await this.readDataset({datasetName:r})).id,$e(i),n&&o||!n&&!o)throw new Error("Exactly one of asOf and tag must be specified.");let s=new URLSearchParams;return n!==void 0&&s.append("as_of",typeof n=="string"?n:n.toISOString()),o!==void 0&&s.append("tag",o),await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${i}/version?${s.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(c,"read dataset version"),c})).json()}async listDatasetSplits({datasetId:e,datasetName:r,asOf:n}){let o;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?o=(await this.readDataset({datasetName:r})).id:o=e,$e(o);let i=new URLSearchParams,s=n?typeof n=="string"?n:n?.toISOString():void 0;return s&&i.append("as_of",s),await this._get(`/datasets/${o}/splits`,i)}async updateDatasetSplits({datasetId:e,datasetName:r,splitName:n,exampleIds:o,remove:i=!1}){let s;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?s=(await this.readDataset({datasetName:r})).id:s=e,$e(s);let a={split_name:n,examples:o.map(u=>($e(u),u)),remove:i},c=JSON.stringify(a);await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${s}/splits`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(u,"update dataset splits",!0),u})}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){uu("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let s;if(typeof e=="string")s=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)s=e;else throw new Error(`Invalid run type: ${typeof e}`);s.reference_example_id!==null&&s.reference_example_id!==void 0&&(i=await this.readExample(s.reference_example_id));let a=await r.evaluateRun(s,i),[c,u]=await this._logEvaluationFeedback(a,s,n);return u[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:s,sourceInfo:a,feedbackSourceType:c="api",sourceRunId:u,feedbackId:l,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:c??"api",metadata:a??{}};u!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:u}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&$e(m.metadata.__run.run_id);let h={id:l??Et(),run_id:e,key:r,score:lR(n),value:o,correction:i,comment:s,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},_=JSON.stringify(h),v=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{let b=await this._fetch(v,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:_});return await ue(b,"create feedback",!0),b}),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let s={};r!=null&&(s.score=lR(r)),n!=null&&(s.value=n),o!=null&&(s.correction=o),i!=null&&(s.comment=i),$e(e);let a=JSON.stringify(s);await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(c,"update feedback",!0),c})}async readFeedback(e){$e(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){$e(e);let r=`/feedback/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,`delete ${r}`,!0),n})}async*listFeedback({runIds:e,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(e)for(let i of e)$e(i),o.append("run",i);if(r)for(let i of r)o.append("key",i);if(n)for(let i of n)o.append("source",i);for await(let i of this._getPaginated("/feedback",o))yield*i}async createPresignedFeedbackToken(e,r,{expiration:n,feedbackConfig:o}={}){let i={run_id:e,feedback_key:r,feedback_config:o};n?typeof n=="string"?i.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(i.expires_in=n):i.expires_in={hours:3};let s=JSON.stringify(i);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"create presigned feedback token"),c})).json()}async createComparativeExperiment({name:e,experimentIds:r,referenceDatasetId:n,createdAt:o,description:i,metadata:s,id:a}){if(r.length===0)throw new Error("At least one experiment is required");if(n||(n=(await this.readProject({projectId:r[0]})).reference_dataset_id),!n==null)throw new Error("A reference dataset is required");let c={id:a,name:e,experiment_ids:r,reference_dataset_id:n,description:i,created_at:(o??new Date)?.toISOString(),extra:{}};s&&(c.extra.metadata=s);let u=JSON.stringify(c);return(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(d,"create comparative experiment"),d})).json()}async*listPresignedFeedbackTokens(e){$e(e);let r=new URLSearchParams({run_id:e});for await(let n of this._getPaginated("/feedback/tokens",r))yield*n}_selectEvalResults(e){let r;return"results"in e?r=e.results:Array.isArray(e)?r=e:r=[e],r}async _logEvaluationFeedback(e,r,n){let o=this._selectEvalResults(e),i=[];for(let s of o){let a=n||{};s.evaluatorInfo&&(a={...s.evaluatorInfo,...a});let c=null;s.targetRunId?c=s.targetRunId:r&&(c=r.id),i.push(await this.createFeedback(c,s.key,{score:s.score,value:s.value,comment:s.comment,correction:s.correction,sourceInfo:a,sourceRunId:s.sourceRunId,feedbackConfig:s.feedbackConfig,feedbackSourceType:"model"}))}return[o,i]}async logEvaluationFeedback(e,r,n){let[o]=await this._logEvaluationFeedback(e,r,n);return o}async*listAnnotationQueues(e={}){let{queueIds:r,name:n,nameContains:o,limit:i}=e,s=new URLSearchParams;r&&r.forEach((c,u)=>{$e(c,`queueIds[${u}]`),s.append("ids",c)}),n&&s.append("name",n),o&&s.append("name_contains",o),s.append("limit",(i!==void 0?Math.min(i,100):100).toString());let a=0;for await(let c of this._getPaginated("/annotation-queues",s))if(yield*c,a++,i!==void 0&&a>=i)break}async createAnnotationQueue(e){let{name:r,description:n,queueId:o,rubricInstructions:i}=e,s={name:r,description:n,id:o||Et(),rubric_instructions:i},a=JSON.stringify(Object.fromEntries(Object.entries(s).filter(([u,l])=>l!==void 0)));return(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ue(u,"create annotation queue"),u})).json()}async readAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"read annotation queue"),n})).json()}async updateAnnotationQueue(e,r){let{name:n,description:o,rubricInstructions:i}=r,s=JSON.stringify({name:n,description:o,rubric_instructions:i});await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(a,"update annotation queue",!0),a})}async deleteAnnotationQueue(e){await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(r,"delete annotation queue",!0),r})}async addRunsToAnnotationQueue(e,r){let n=JSON.stringify(r.map((o,i)=>$e(o,`runIds[${i}]`).toString()));await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(o,"add runs to annotation queue",!0),o})}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${$e(e,"queueId")}/run`;return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(i,"get run from annotation queue"),i})).json()}async deleteRunFromAnnotationQueue(e,r){await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/runs/${$e(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"delete run from annotation queue",!0),n})}async getSizeFromAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${$e(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(n,"get size from annotation queue"),n})).json()}async _currentTenantIsOwner(e){let r=await this._getSettings();return e=="-"||r.tenant_handle===e}async _ownerConflictError(e,r){let n=await this._getSettings();return new Error(`Cannot ${e} for another tenant. + + Current tenant: ${n.tenant_handle} + + Requested tenant: ${r}`)}async _getLatestCommitHash(e){let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/commits/${e}/?limit=1&offset=0`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(o,"get latest commit hash"),o})).json();if(n.commits.length!==0)return n.commits[0].commit_hash}async _likeOrUnlikePrompt(e,r){let[n,o,i]=Wo(e),s=JSON.stringify({like:r});return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/likes/${n}/${o}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,`${r?"like":"unlike"} prompt`),c})).json()}async _getPromptUrl(e){let[r,n,o]=Wo(e);if(await this._currentTenantIsOwner(r)){let i=await this._getSettings();return o!=="latest"?`${this.getHostUrl()}/prompts/${n}/${o.substring(0,8)}?organizationId=${i.id}`:`${this.getHostUrl()}/prompts/${n}?organizationId=${i.id}`}else return o!=="latest"?`${this.getHostUrl()}/hub/${r}/${n}/${o.substring(0,8)}`:`${this.getHostUrl()}/hub/${r}/${n}`}async promptExists(e){return!!await this.getPrompt(e)}async likePrompt(e){return this._likeOrUnlikePrompt(e,!0)}async unlikePrompt(e){return this._likeOrUnlikePrompt(e,!1)}async*listCommits(e){for await(let r of this._getPaginated(`/commits/${e}/`,new URLSearchParams,n=>n.commits))yield*r}async*listPrompts(e){let r=new URLSearchParams;r.append("sort_field",e?.sortField??"updated_at"),r.append("sort_direction","desc"),r.append("is_archived",(!!e?.isArchived).toString()),e?.isPublic!==void 0&&r.append("is_public",e.isPublic.toString()),e?.query&&r.append("query",e.query);for await(let n of this._getPaginated("/repos",r,o=>o.repos))yield*n}async getPrompt(e){let[r,n,o]=Wo(e),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return a?.status===404?null:(await ue(a,"get prompt"),a)}))?.json();return s?.repo?s.repo:null}async createPrompt(e,r){let n=await this._getSettings();if(r?.isPublic&&!n.tenant_handle)throw new Error(`Cannot create a public prompt without first + + creating a LangChain Hub handle. + You can add a handle by creating a public prompt at: + + https://smith.langchain.com/prompts`);let[o,i,s]=Wo(e);if(!await this._currentTenantIsOwner(o))throw await this._ownerConflictError("create a prompt",o);let a={repo_handle:i,...r?.description&&{description:r.description},...r?.readme&&{readme:r.readme},...r?.tags&&{tags:r.tags},is_public:!!r?.isPublic},c=JSON.stringify(a),u=await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ue(d,"create prompt"),d}),{repo:l}=await u.json();return l}async createCommit(e,r,n){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[o,i,s]=Wo(e),a=n?.parentCommitHash==="latest"||!n?.parentCommitHash?await this._getLatestCommitHash(`${o}/${i}`):n?.parentCommitHash,c={manifest:JSON.parse(JSON.stringify(r)),parent_commit:a},u=JSON.stringify(c),d=await(await this.caller.call(async()=>{let f=await this._fetch(`${this.apiUrl}/commits/${o}/${i}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await ue(f,"create commit"),f})).json();return this._getPromptUrl(`${o}/${i}${d.commit_hash?`:${d.commit_hash}`:""}`)}async updateExamplesMultipart(e,r=[]){return this._updateExamplesMultipart(e,r)}async _updateExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let s of r){let a=s.id,c={...s.metadata&&{metadata:s.metadata},...s.split&&{split:s.split}},u=Pr(c,`Serializing body for example with id: ${a}`),l=new Blob([u],{type:"application/json"});if(n.append(a,l),s.inputs){let d=Pr(s.inputs,`Serializing inputs for example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.inputs`,f)}if(s.outputs){let d=Pr(s.outputs,`Serializing outputs whle updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.outputs`,f)}if(s.attachments)for(let[d,f]of Object.entries(s.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${a}.attachment.${d}`,h)}if(s.attachments_operations){let d=Pr(s.attachments_operations,`Serializing attachments while updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});n.append(`${a}.attachments_operations`,f)}}let o=e??r[0]?.dataset_id;return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${o}/examples`)}`,{method:"PATCH",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(s,"update examples"),s})).json()}async uploadExamplesMultipart(e,r=[]){return this._uploadExamplesMultipart(e,r)}async _uploadExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let i of r){let s=(i.id??Et()).toString(),a={created_at:i.created_at,...i.metadata&&{metadata:i.metadata},...i.split&&{split:i.split},...i.source_run_id&&{source_run_id:i.source_run_id},...i.use_source_run_io&&{use_source_run_io:i.use_source_run_io},...i.use_source_run_attachments&&{use_source_run_attachments:i.use_source_run_attachments}},c=Pr(a,`Serializing body for uploaded example with id: ${s}`),u=new Blob([c],{type:"application/json"});if(n.append(s,u),i.inputs){let l=Pr(i.inputs,`Serializing inputs for uploaded example with id: ${s}`),d=new Blob([l],{type:"application/json"});n.append(`${s}.inputs`,d)}if(i.outputs){let l=Pr(i.outputs,`Serializing outputs for uploaded example with id: ${s}`),d=new Blob([l],{type:"application/json"});n.append(`${s}.outputs`,d)}if(i.attachments)for(let[l,d]of Object.entries(i.attachments)){let f,p;Array.isArray(d)?[f,p]=d:(f=d.mimeType,p=d.data);let m=new Blob([p],{type:`${f}; length=${p.byteLength}`});n.append(`${s}.attachment.${l}`,m)}}return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ue(i,"upload examples"),i})).json()}async updatePrompt(e,r){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[n,o]=Wo(e);if(!await this._currentTenantIsOwner(n))throw await this._ownerConflictError("update a prompt",n);let i={};if(r?.description!==void 0&&(i.description=r.description),r?.readme!==void 0&&(i.readme=r.readme),r?.tags!==void 0&&(i.tags=r.tags),r?.isPublic!==void 0&&(i.is_public=r.isPublic),r?.isArchived!==void 0&&(i.is_archived=r.isArchived),Object.keys(i).length===0)throw new Error("No valid update options provided");let s=JSON.stringify(i);return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/repos/${n}/${o}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ue(c,"update prompt"),c})).json()}async deletePrompt(e){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[r,n,o]=Wo(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(s,"delete prompt"),s})).json()}async pullPromptCommit(e,r){let[n,o,i]=Wo(e),a=await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/commits/${n}/${o}/${i}${r?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ue(c,"pull prompt commit"),c})).json();return{owner:n,repo:o,commit_hash:a.commit_hash,manifest:a.manifest,examples:a.examples}}async _pullPrompt(e,r){let n=await this.pullPromptCommit(e,{includeModel:r?.includeModel});return JSON.stringify(n.manifest)}async pushPrompt(e,r){return await this.promptExists(e)?r&&Object.keys(r).some(o=>o!=="object")&&await this.updatePrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}):await this.createPrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}),r?.object?await this.createCommit(e,r?.object,{parentCommitHash:r?.parentCommitHash}):await this._getPromptUrl(e)}async clonePublicDataset(e,r={}){let{sourceApiUrl:n=this.apiUrl,datasetName:o}=r,[i,s]=this.parseTokenOrUrl(e,n),a=new t({apiUrl:i,apiKey:"placeholder"}),c=await a.readSharedDataset(s),u=o||c.name;try{if(await this.hasDataset({datasetId:u})){console.log(`Dataset ${u} already exists in your tenant. Skipping.`);return}}catch{}let l=await a.listSharedExamples(s),d=await this.createDataset(u,{description:c.description,dataType:c.data_type||"kv",inputsSchema:c.inputs_schema_definition??void 0,outputsSchema:c.outputs_schema_definition??void 0});try{await this.createExamples({inputs:l.map(f=>f.inputs),outputs:l.flatMap(f=>f.outputs?[f.outputs]:[]),datasetId:d.id})}catch(f){throw console.error(`An error occurred while creating dataset ${u}. You should delete it manually.`),f}}parseTokenOrUrl(e,r,n=2,o="dataset"){try{return $e(e),[r,e]}catch{}try{let s=new URL(e).pathname.split("/").filter(a=>a!=="");if(s.length>=n){let a=s[s.length-n];return[r,a]}else throw new Error(`Invalid public ${o} URL: ${e}`)}catch{throw new Error(`Invalid public ${o} URL or token: ${e}`)}}async awaitPendingTraceBatches(){if(this.manualFlushMode)return console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve();await Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()]),this.langSmithToOTELTranslator!==void 0&&await iP()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}};function pR(t){return"dataset_id"in t||"dataset_name"in t}var mR=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>At(r)==="true");var mo=Symbol.for("lc:context_variables"),Zh=Symbol.for("langsmith:replica_trace_roots");function t0(t,e){if(mo in t)return t[mo][e]}function hR(t,e,r){let n=mo in t?t[mo]:{};n[e]=r,t[mo]=n}var Fd=36,Bd="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function gR(t){let r=Object.keys(t).sort().map(n=>`${n}:${t[n]??""}`).join("|");return ua(r,Bd)}function Mq(t){return t.replace(/[-:.]/g,"")}function yR(t,e=1){let r=e.toFixed(0).slice(0,3).padStart(3,"0");return`${new Date(t).toISOString().slice(0,-1)}${r}Z`}function r0(t,e,r=1){let n=yR(t,r);return{dottedOrder:Mq(n)+e,microsecondPrecisionDatestring:n}}var qh=class t{constructor(e,r,n,o){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n,this.replicas=o}static fromHeader(e){let r=e.split(","),n={},o=[],i,s;for(let a of r){let[c,u]=a.split("="),l=decodeURIComponent(u);c==="langsmith-metadata"?n=JSON.parse(l):c==="langsmith-tags"?o=l.split(","):c==="langsmith-project"?i=l:c==="langsmith-replicas"&&(s=JSON.parse(l))}return new t(n,o,i,s)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}},Ln=class t{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"distributedParentId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),vR(e)){Object.assign(this,{...e});return}let r=t.getDefaultConfig(),{metadata:n,...o}=e,i=o.client??t.getSharedClient(),s={...n,...o?.extra?.metadata};if(o.extra={...o.extra,metadata:s},"id"in o&&o.id==null&&delete o.id,Object.assign(this,{...r,...o,client:i}),this.execution_order??=1,this.child_execution_order??=1,this.dotted_order||(this._serialized_start_time=yR(this.start_time,this.execution_order)),this.id||(this.id=mh(this._serialized_start_time??this.start_time)),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.replicas=Uq(this.replicas),!this.dotted_order){let{dottedOrder:a}=r0(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+a:this.dotted_order=a}}set metadata(e){this.extra={...this.extra,metadata:{...this.extra?.metadata,...e}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){let e=Date.now();return{run_type:"chain",project_name:Pd(),child_runs:[],api_url:Qr("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Qr("LANGCHAIN_API_KEY"),caller_options:{},start_time:e,serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new da),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=this.replicas?.map(l=>{let{reroot:d,...f}=l;return f}),o=e.replicas??n,i=new t({...e,parent_run:this,project_name:this.project_name,replicas:o,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});mo in this&&(i[mo]=this[mo]);let s=Symbol.for("lc:child_config"),a=e.extra?.[s]??this.extra[s];if(Dq(a)){let l={...a},d=jq(l.callbacks)?l.callbacks.copy?.():void 0;d&&(Object.assign(d,{_parentRunId:i.id}),d.handlers?.find(bR)?.updateFromRunTree?.(i),l.callbacks=d),i.extra[s]=l}let c=new Set,u=this;for(;u!=null&&!c.has(u.id);)c.add(u.id),u.child_execution_order=Math.max(u.child_execution_order,r),u=u.parent_run;return this.child_runs.push(i),i}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o?.runtime?.library===void 0&&(o.runtime||(o.runtime={}),r))for(let[a,c]of Object.entries(r))o.runtime[a]||(o.runtime[a]=c);let i,s;return n?(s=e.parent_run?.id??e.parent_run_id,i=[]):(i=e.child_runs.map(a=>this._convertToCreate(a,r,n)),s=void 0),{id:e.id,name:e.name,start_time:e._serialized_start_time??e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:o,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:i,parent_run_id:s,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments,events:e.events}}_sliceParentId(e,r){if(r.dotted_order){let n=r.dotted_order.split("."),o=null;for(let i=0;i0?r.trace_id=i[0].slice(-Fd):r.trace_id=r.id}}r.parent_run_id===e&&(r.parent_run_id=void 0)}_setReplicaTraceRoot(e,r){let n=t0(this,Zh)??{};n[e]=r,hR(this,Zh,n);for(let o of this.child_runs)o._setReplicaTraceRoot(e,r)}_remapForProject(e){let{projectName:r,runtimeEnv:n,excludeChildRuns:o=!0,reroot:i=!1,distributedParentId:s,apiUrl:a,apiKey:c,workspaceId:u}=e,l=this._convertToCreate(this,n,o);if(r===this.project_name)return{...l,session_name:r};if(i){if(s)this._sliceParentId(s,l);else if(l.parent_run_id=void 0,l.dotted_order){let b=l.dotted_order.split(".");b.length>0&&(l.dotted_order=b[b.length-1],l.trace_id=l.id)}let v=gR({projectName:r,apiUrl:a,apiKey:c,workspaceId:u});this._setReplicaTraceRoot(v,l.id)}let d;if(!i){let v=t0(this,Zh)??{},b=gR({projectName:r,apiUrl:a,apiKey:c,workspaceId:u});if(d=v[b],d&&(l.trace_id=d,l.dotted_order)){let x=l.dotted_order.split("."),k=null;for(let T=0;T{let k=x.slice(-Fd),T=ua(`${k}:${r}`,Bd);return x.slice(0,-Fd)+T}).join(".")),{...l,id:p,trace_id:m,parent_run_id:h,dotted_order:_,session_name:r}}async postRun(e=!0){try{let r=gh();if(this.replicas&&this.replicas.length>0)for(let{projectName:n,apiKey:o,apiUrl:i,workspaceId:s,reroot:a}of this.replicas){let c=this._remapForProject({projectName:n??this.project_name,runtimeEnv:r,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:i,apiKey:o,workspaceId:s});await this.client.createRun(c,{apiKey:o,apiUrl:i,workspaceId:s})}else{let n=this._convertToCreate(this,r,e);await this.client.createRun(n)}if(!e){uu("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let n of this.child_runs)await n.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(e){if(this.replicas&&this.replicas.length>0)for(let{projectName:r,apiKey:n,apiUrl:o,workspaceId:i,updates:s,reroot:a}of this.replicas){let c=this._remapForProject({projectName:r??this.project_name,runtimeEnv:void 0,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:o,apiKey:n,workspaceId:i}),u={id:c.id,name:c.name,run_type:c.run_type,start_time:c.start_time,outputs:c.outputs,error:c.error,parent_run_id:c.parent_run_id,session_name:c.session_name,reference_example_id:c.reference_example_id,end_time:c.end_time,dotted_order:c.dotted_order,trace_id:c.trace_id,events:c.events,tags:c.tags,extra:c.extra,attachments:this.attachments,...s};e?.excludeInputs||(u.inputs=c.inputs),await this.client.updateRun(c.id,u,{apiKey:n,apiUrl:o,workspaceId:i})}else try{let r={name:this.name,run_type:this.run_type,start_time:this._serialized_start_time??this.start_time,end_time:this.end_time,error:this.error,outputs:this.outputs,parent_run_id:this.parent_run?.id??this.parent_run_id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};e?.excludeInputs||(r.inputs=this.inputs),await this.client.updateRun(this.id,r)}catch(r){console.error(`Error in patchRun for run ${this.id}`,r)}}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(e){this.events||(this.events=[]),typeof e=="string"?this.events.push({name:"event",time:new Date().toISOString(),message:e}):this.events.push({...e,time:e.time??new Date().toISOString()})}static fromRunnableConfig(e,r){let n=e?.callbacks,o,i,s,a=mR();if(n){let u=n?.getParentRunId?.()??"",l=n?.handlers?.find(d=>d?.name=="langchain_tracer");o=l?.getRun?.(u),i=l?.projectName,s=l?.client,a=a||!!l}return o?new t({name:o.name,id:o.id,trace_id:o.trace_id,dotted_order:o.dotted_order,client:s,tracingEnabled:a,project_name:i,tags:[...new Set((o?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...o?.extra?.metadata,...e?.metadata}}}).createChild(r):new t({...r,client:s,tracingEnabled:a,project_name:i})}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,r){let n="get"in e&&typeof e.get=="function"?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,o=n["langsmith-trace"];if(!o||typeof o!="string")return;let i=o.trim(),s=i.split(".").map(l=>{let[d,f]=l.split("Z");return{strTime:d,time:Date.parse(d+"Z"),uuid:f}}),a=s[0].uuid,c={...r,name:r?.name??"parent",run_type:r?.run_type??"chain",start_time:r?.start_time??Date.now(),id:s.at(-1)?.uuid,trace_id:a,dotted_order:i};if(n.baggage&&typeof n.baggage=="string"){let l=qh.fromHeader(n.baggage);c.metadata=l.metadata,c.tags=l.tags,c.project_name=l.project_name,c.replicas=l.replicas}let u=new t(c);return u.distributedParentId=u.id,u}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new qh(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(Ln,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null});function vR(t){return t!=null&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function bR(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function _R(t){return Array.isArray(t)&&t.some(e=>bR(e))}function jq(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function Dq(t){return t!=null&&typeof t.callbacks=="object"&&(_R(t.callbacks?.handlers)||_R(t.callbacks))}function Lq(){let t=Qr("LANGSMITH_RUNS_ENDPOINTS");if(!t)return[];try{let e=JSON.parse(t);if(Array.isArray(e)){let r=[];for(let n of e){if(typeof n!="object"||n===null){console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got ${typeof n}`);continue}if(typeof n.api_url!="string"){console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_url}`);continue}if(typeof n.api_key!="string"){console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_key}`);continue}r.push({apiUrl:n.api_url.replace(/\/$/,""),apiKey:n.api_key})}return r}else if(typeof e=="object"&&e!==null){Fq(e);let r=[];for(let[n,o]of Object.entries(e)){let i=n.replace(/\/$/,"");if(typeof o=="string")r.push({apiUrl:i,apiKey:o});else{console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${n}: expected string, got ${typeof o}`);continue}}return r}else return console.warn(`Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey, got ${typeof e}`),[]}catch(e){if(sR(e))throw e;return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey"),[]}}function Uq(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):Lq()}function Fq(t){if(Object.keys(t).length>0&&At("ENDPOINT"))throw new Lh}var Bq={};G(Bq,{BaseTracer:()=>Un,isBaseTracer:()=>fa});var Zq=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};function o0(t,e){if(t)return new Ln({...t,start_time:t._serialized_start_time??t.start_time,parent_run:o0(e),child_runs:t.child_runs.map(r=>o0(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:ex()},tracingEnabled:!1})}function n0(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function fa(t){return typeof t._addRunToRunMap=="function"}var Un=class extends la{runMap=new Map;runTreeMap=new Map;usesRunTreeMap=!1;constructor(t){super(...arguments)}copy(){return this}getRunById(t){if(t!==void 0)return this.usesRunTreeMap?Zq(this.runTreeMap.get(t)):this.runMap.get(t)}stringifyError(t){return t instanceof Error?t.message+(t?.stack?` + +${t.stack}`:""):typeof t=="string"?t:`${t}`}_addChildRun(t,e){t.child_runs.push(e)}_addRunToRunMap(t){let{dottedOrder:e,microsecondPrecisionDatestring:r}=r0(new Date(t.start_time).getTime(),t.id,t.execution_order),n={...t},o=this.getRunById(n.parent_run_id);if(n.parent_run_id!==void 0?o&&(this._addChildRun(o,n),o.child_execution_order=Math.max(o.child_execution_order,n.child_execution_order),n.trace_id=o.trace_id,o.dotted_order!==void 0&&(n.dotted_order=[o.dotted_order,e].join("."),n._serialized_start_time=r)):(n.trace_id=n.id,n.dotted_order=e,n._serialized_start_time=r),this.usesRunTreeMap){let i=o0(n,o);i!==void 0&&this.runTreeMap.set(n.id,i)}else this.runMap.set(n.id,n);return n}async _endTrace(t){let e=t.parent_run_id!==void 0&&this.getRunById(t.parent_run_id);e?e.child_execution_order=Math.max(e.child_execution_order,t.child_execution_order):await this.persistRun(t),await this.onRunUpdate?.(t),this.usesRunTreeMap?this.runTreeMap.delete(t.id):this.runMap.delete(t.id)}_getExecutionOrder(t){let e=t!==void 0&&this.getRunById(t);return e?e.child_execution_order+1:1}_createRunForLLMStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l=s?{...o,metadata:s}:o,d={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{prompts:e},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:l??{},tags:i||[]};return this._addRunToRunMap(d)}async handleLLMStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForLLMStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}_createRunForChatModelStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l=s?{...o,metadata:s}:o,d={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{messages:e},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:l??{},tags:i||[]};return this._addRunToRunMap(d)}async handleChatModelStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForChatModelStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}async handleLLMEnd(t,e,r,n,o){let i=this.getRunById(e);if(!i||i?.run_type!=="llm")throw new Error("No LLM run to end.");return i.end_time=Date.now(),i.outputs=t,i.events.push({name:"end",time:new Date(i.end_time).toISOString()}),i.extra={...i.extra,...o},await this.onLLMEnd?.(i),await this._endTrace(i),i}async handleLLMError(t,e,r,n,o){let i=this.getRunById(e);if(!i||i?.run_type!=="llm")throw new Error("No LLM run to end.");return i.end_time=Date.now(),i.error=this.stringifyError(t),i.events.push({name:"error",time:new Date(i.end_time).toISOString()}),i.extra={...i.extra,...o},await this.onLLMError?.(i),await this._endTrace(i),i}_createRunForChainStart(t,e,r,n,o,i,s,a){let c=this._getExecutionOrder(n),u=Date.now(),l={id:r,name:a??t.id[t.id.length-1],parent_run_id:n,start_time:u,serialized:t,events:[{name:"start",time:new Date(u).toISOString()}],inputs:e,execution_order:c,child_execution_order:c,run_type:s??"chain",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(l)}async handleChainStart(t,e,r,n,o,i,s,a){let c=this.getRunById(r)??this._createRunForChainStart(t,e,r,n,o,i,s,a);return await this.onRunCreate?.(c),await this.onChainStart?.(c),c}async handleChainEnd(t,e,r,n,o){let i=this.getRunById(e);if(!i)throw new Error("No chain run to end.");return i.end_time=Date.now(),i.outputs=n0(t,"output"),i.events.push({name:"end",time:new Date(i.end_time).toISOString()}),o?.inputs!==void 0&&(i.inputs=n0(o.inputs,"input")),await this.onChainEnd?.(i),await this._endTrace(i),i}async handleChainError(t,e,r,n,o){let i=this.getRunById(e);if(!i)throw new Error("No chain run to end.");return i.end_time=Date.now(),i.error=this.stringifyError(t),i.events.push({name:"error",time:new Date(i.end_time).toISOString()}),o?.inputs!==void 0&&(i.inputs=n0(o.inputs,"input")),await this.onChainError?.(i),await this._endTrace(i),i}_createRunForToolStart(t,e,r,n,o,i,s){let a=this._getExecutionOrder(n),c=Date.now(),u={id:r,name:s??t.id[t.id.length-1],parent_run_id:n,start_time:c,serialized:t,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{input:e},execution_order:a,child_execution_order:a,run_type:"tool",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(u)}async handleToolStart(t,e,r,n,o,i,s){let a=this.getRunById(r)??this._createRunForToolStart(t,e,r,n,o,i,s);return await this.onRunCreate?.(a),await this.onToolStart?.(a),a}async handleToolEnd(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.outputs={output:t},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onToolEnd?.(r),await this._endTrace(r),r}async handleToolError(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.error=this.stringifyError(t),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onToolError?.(r),await this._endTrace(r),r}async handleAgentAction(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="chain")return;let n=r;n.actions=n.actions||[],n.actions.push(t),n.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentAction?.(r)}async handleAgentEnd(t,e){let r=this.getRunById(e);!r||r?.run_type!=="chain"||(r.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:t}}),await this.onAgentEnd?.(r))}_createRunForRetrieverStart(t,e,r,n,o,i,s){let a=this._getExecutionOrder(n),c=Date.now(),u={id:r,name:s??t.id[t.id.length-1],parent_run_id:n,start_time:c,serialized:t,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{query:e},execution_order:a,child_execution_order:a,run_type:"retriever",child_runs:[],extra:i?{metadata:i}:{},tags:o||[]};return this._addRunToRunMap(u)}async handleRetrieverStart(t,e,r,n,o,i,s){let a=this.getRunById(r)??this._createRunForRetrieverStart(t,e,r,n,o,i,s);return await this.onRunCreate?.(a),await this.onRetrieverStart?.(a),a}async handleRetrieverEnd(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.outputs={documents:t},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onRetrieverEnd?.(r),await this._endTrace(r),r}async handleRetrieverError(t,e){let r=this.getRunById(e);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.error=this.stringifyError(t),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onRetrieverError?.(r),await this._endTrace(r),r}async handleText(t,e){let r=this.getRunById(e);!r||r?.run_type!=="chain"||(r.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:t}}),await this.onText?.(r))}async handleLLMNewToken(t,e,r,n,o,i){let s=this.getRunById(r);if(!s||s?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return s.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:t,idx:e,chunk:i?.chunk}}),await this.onLLMNewToken?.(s,t,{chunk:i?.chunk}),s}};var i0=mn(IR(),1),Vq={};G(Vq,{ConsoleCallbackHandler:()=>Vh});function yr(t,e){return`${t.open}${e}${t.close}`}function yn(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function SR(t){return typeof t=="string"?t.trim():t==null?t:yn(t,t.toString())}function Fi(t){if(!t.end_time)return"";let e=t.end_time-t.start_time;return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}var{color:Cr}=i0.default,Vh=class extends Un{name="console_callback_handler";persistRun(t){return Promise.resolve()}getParents(t){let e=[],r=t;for(;r.parent_run_id;){let n=this.runMap.get(r.parent_run_id);if(n)e.push(n),r=n;else break}return e}getBreadcrumbs(t){let r=[...this.getParents(t).reverse(),t].map((n,o,i)=>{let s=`${n.execution_order}:${n.run_type}:${n.name}`;return o===i.length-1?yr(i0.default.bold,s):s}).join(" > ");return yr(Cr.grey,r)}onChainStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[chain/start]")} [${e}] Entering Chain run with input: ${yn(t.inputs,"[inputs]")}`)}onChainEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[chain/end]")} [${e}] [${Fi(t)}] Exiting Chain run with output: ${yn(t.outputs,"[outputs]")}`)}onChainError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[chain/error]")} [${e}] [${Fi(t)}] Chain run errored with error: ${yn(t.error,"[error]")}`)}onLLMStart(t){let e=this.getBreadcrumbs(t),r="prompts"in t.inputs?{prompts:t.inputs.prompts.map(n=>n.trim())}:t.inputs;console.log(`${yr(Cr.green,"[llm/start]")} [${e}] Entering LLM run with input: ${yn(r,"[inputs]")}`)}onLLMEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[llm/end]")} [${e}] [${Fi(t)}] Exiting LLM run with output: ${yn(t.outputs,"[response]")}`)}onLLMError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[llm/error]")} [${e}] [${Fi(t)}] LLM run errored with error: ${yn(t.error,"[error]")}`)}onToolStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[tool/start]")} [${e}] Entering Tool run with input: "${SR(t.inputs.input)}"`)}onToolEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[tool/end]")} [${e}] [${Fi(t)}] Exiting Tool run with output: "${SR(t.outputs?.output)}"`)}onToolError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[tool/error]")} [${e}] [${Fi(t)}] Tool run errored with error: ${yn(t.error,"[error]")}`)}onRetrieverStart(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.green,"[retriever/start]")} [${e}] Entering Retriever run with input: ${yn(t.inputs,"[inputs]")}`)}onRetrieverEnd(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.cyan,"[retriever/end]")} [${e}] [${Fi(t)}] Exiting Retriever run with output: ${yn(t.outputs,"[outputs]")}`)}onRetrieverError(t){let e=this.getBreadcrumbs(t);console.log(`${yr(Cr.red,"[retriever/error]")} [${e}] [${Fi(t)}] Retriever run errored with error: ${yn(t.error,"[error]")}`)}onAgentAction(t){let e=t,r=this.getBreadcrumbs(t);console.log(`${yr(Cr.blue,"[agent/action]")} [${r}] Agent selected action: ${yn(e.actions[e.actions.length-1],"[action]")}`)}};var s0,Gh=()=>{if(s0===void 0){let t=It("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};s0=new da(t)}return s0};var c0=class{getStore(){}run(e,r){return r()}},a0=Symbol.for("ls:tracing_async_local_storage"),Gq=new c0,u0=class{getInstance(){return globalThis[a0]??Gq}initializeGlobalInstance(e){globalThis[a0]===void 0&&(globalThis[a0]=e)}},Kq=new u0;function kR(t=!1){let e=Kq.getInstance().getStore();if(!t&&e===void 0)throw new Error(`Could not get the current run tree. + +Please make sure you are calling this method within a traceable function and that tracing is enabled.`);return e}var rge=Symbol.for("langsmith:traceable:root");function Kh(t){return typeof t=="function"&&"langsmith:traceable"in t}var Hq={};G(Hq,{LangChainTracer:()=>Zd});var Zd=class TR extends Un{name="langchain_tracer";projectName;exampleId;client;replicas;usesRunTreeMap=!0;constructor(e={}){super(e);let{exampleId:r,projectName:n,client:o,replicas:i}=e;this.projectName=n??Pd(),this.replicas=i,this.exampleId=r,this.client=o??Gh();let s=TR.getTraceableRunTree();s&&this.updateFromRunTree(s)}async persistRun(e){}async onRunCreate(e){await this.getRunTreeWithTracingConfig(e.id)?.postRun()}async onRunUpdate(e){await this.getRunTreeWithTracingConfig(e.id)?.patchRun()}getRun(e){return this.runTreeMap.get(e)}updateFromRunTree(e){this.runTreeMap.set(e.id,e);let r=e,n=new Set;for(;r.parent_run&&!(n.has(r.id)||(n.add(r.id),!r.parent_run));)r=r.parent_run;n.clear();let o=[r];for(;o.length>0;){let i=o.shift();!i||n.has(i.id)||(n.add(i.id),this.runTreeMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.replicas=e.replicas??this.replicas,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}getRunTreeWithTracingConfig(e){let r=this.runTreeMap.get(e);if(r)return new Ln({...r,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return kR(!0)}catch{return}}};var Hh=mn(Sh(),1),ma;function Wq(){let t="default"in Hh.default?Hh.default.default:Hh.default;return new t({autoStart:!0,concurrency:1})}function Jq(){return typeof ma>"u"&&(ma=Wq()),ma}async function gt(t,e){if(e===!0){let r=Li();r!==void 0?await r.run(void 0,async()=>t()):await t()}else ma=Jq(),ma.add(async()=>{let r=Li();r!==void 0?await r.run(void 0,async()=>t()):await t()})}async function ER(){let t=Gh();await Promise.allSettled([typeof ma<"u"?ma.onIdle():Promise.resolve(),t.awaitPendingTraceBatches()])}var Xq={};G(Xq,{awaitAllCallbacks:()=>ER,consumeCallback:()=>gt});var AR=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>It(r)==="true");function l0(t){let e=Li();return e===void 0?void 0:e.getStore()?.[Di]?.[t]}var Yq=Symbol("lc:configure_hooks"),OR=()=>l0(Yq)||[];var Qq={};G(Qq,{BaseCallbackManager:()=>PR,BaseRunManager:()=>Vd,CallbackManager:()=>St,CallbackManagerForChainRun:()=>RR,CallbackManagerForLLMRun:()=>d0,CallbackManagerForRetrieverRun:()=>CR,CallbackManagerForToolRun:()=>NR,ensureHandler:()=>pu,parseCallbackConfigArg:()=>ha});function ha(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}var PR=class{setHandler(t){return this.setHandlers([t])}},Vd=class{constructor(t,e,r,n,o,i,s,a){this.runId=t,this.handlers=e,this.inheritableHandlers=r,this.tags=n,this.inheritableTags=o,this.metadata=i,this.inheritableMetadata=s,this._parentRunId=a}get parentRunId(){return this._parentRunId}async handleText(t){await Promise.all(this.handlers.map(e=>gt(async()=>{try{await e.handleText?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleText: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleCustomEvent(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{try{await i.handleCustomEvent?.(t,e,this.runId,this.tags,this.metadata)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleCustomEvent: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},CR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleRetrieverEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetriever`),e.raiseError)throw r}},e.awaitHandlers)))}async handleRetrieverError(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetrieverError: ${r}`),e.raiseError)throw t}},e.awaitHandlers)))}},d0=class extends Vd{async handleLLMNewToken(t,e,r,n,o,i){await Promise.all(this.handlers.map(s=>gt(async()=>{if(!s.ignoreLLM)try{await s.handleLLMNewToken?.(t,e??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,i)}catch(a){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleLLMNewToken: ${a}`),s.raiseError)throw a}},s.awaitHandlers)))}async handleLLMError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreLLM)try{await i.handleLLMError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleLLMEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreLLM)try{await i.handleLLMEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},RR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleChainError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreChain)try{await i.handleChainError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleChainEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>gt(async()=>{if(!i.ignoreChain)try{await i.handleChainEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleAgentAction(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleAgentAction?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentAction: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleAgentEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleAgentEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},NR=class extends Vd{getChild(t){let e=new St(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleToolError(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleToolError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolError: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleToolEnd(t){await Promise.all(this.handlers.map(e=>gt(async()=>{if(!e.ignoreAgent)try{await e.handleToolEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},St=class qd extends PR{handlers=[];inheritableHandlers=[];tags=[];inheritableTags=[];metadata={};inheritableMetadata={};name="callback_manager";_parentRunId;constructor(e,r){super(),this.handlers=r?.handlers??this.handlers,this.inheritableHandlers=r?.inheritableHandlers??this.inheritableHandlers,this.tags=r?.tags??this.tags,this.inheritableTags=r?.inheritableTags??this.inheritableTags,this.metadata=r?.metadata??this.metadata,this.inheritableMetadata=r?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=e}getParentRunId(){return this._parentRunId}async handleLLMStart(e,r,n=void 0,o=void 0,i=void 0,s=void 0,a=void 0,c=void 0){return Promise.all(r.map(async(u,l)=>{let d=l===0&&n?n:Et();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return fa(f)&&f._createRunForLLMStart(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c),gt(async()=>{try{await f.handleLLMStart?.(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c)}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new d0(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(e,r,n=void 0,o=void 0,i=void 0,s=void 0,a=void 0,c=void 0){return Promise.all(r.map(async(u,l)=>{let d=l===0&&n?n:Et();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return fa(f)&&f._createRunForChatModelStart(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c),gt(async()=>{try{if(f.handleChatModelStart)await f.handleChatModelStart?.(e,[u],d,this._parentRunId,i,this.tags,this.metadata,c);else if(f.handleLLMStart){let p=au(u);await f.handleLLMStart?.(e,[p],d,this._parentRunId,i,this.tags,this.metadata,c)}}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new d0(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreChain)return fa(c)&&c._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,a),gt(async()=>{try{await c.handleChainStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,o,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleChainStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new RR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreAgent)return fa(c)&&c._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,a),gt(async()=>{try{await c.handleToolStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleToolStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new NR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=Et(),o=void 0,i=void 0,s=void 0,a=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreRetriever)return fa(c)&&c._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,a),gt(async()=>{try{await c.handleRetrieverStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,a)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleRetrieverStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new CR(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(e,r,n,o,i){await Promise.all(this.handlers.map(s=>gt(async()=>{if(!s.ignoreCustomEvent)try{await s.handleCustomEvent?.(e,r,n,this.tags,this.metadata)}catch(a){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleCustomEvent: ${a}`),s.raiseError)throw a}},s.awaitHandlers)))}addHandler(e,r=!0){this.handlers.push(e),r&&this.inheritableHandlers.push(e)}removeHandler(e){this.handlers=this.handlers.filter(r=>r!==e),this.inheritableHandlers=this.inheritableHandlers.filter(r=>r!==e)}setHandlers(e,r=!0){this.handlers=[],this.inheritableHandlers=[];for(let n of e)this.addHandler(n,r)}addTags(e,r=!0){this.removeTags(e),this.tags.push(...e),r&&this.inheritableTags.push(...e)}removeTags(e){this.tags=this.tags.filter(r=>!e.includes(r)),this.inheritableTags=this.inheritableTags.filter(r=>!e.includes(r))}addMetadata(e,r=!0){this.metadata={...this.metadata,...e},r&&(this.inheritableMetadata={...this.inheritableMetadata,...e})}removeMetadata(e){for(let r of Object.keys(e))delete this.metadata[r],delete this.inheritableMetadata[r]}copy(e=[],r=!0){let n=new qd(this._parentRunId);for(let o of this.handlers){let i=this.inheritableHandlers.includes(o);n.addHandler(o,i)}for(let o of this.tags){let i=this.inheritableTags.includes(o);n.addTags([o],i)}for(let o of Object.keys(this.metadata)){let i=Object.keys(this.inheritableMetadata).includes(o);n.addMetadata({[o]:this.metadata[o]},i)}for(let o of e)n.handlers.filter(i=>i.name==="console_callback_handler").some(i=>i.name===o.name)||n.addHandler(o,r);return n}static fromHandlers(e){class r extends la{name=Et();constructor(){super(),Object.assign(this,e)}}let n=new this;return n.addHandler(new r),n}static configure(e,r,n,o,i,s,a){return this._configureSync(e,r,n,o,i,s,a)}static _configureSync(e,r,n,o,i,s,a){let c;(e||r)&&(Array.isArray(e)||!e?(c=new qd,c.setHandlers(e?.map(pu)??[],!0)):c=e,c=c.copy(Array.isArray(r)?r.map(pu):r?.handlers,!1));let u=It("LANGCHAIN_VERBOSE")==="true"||a?.verbose,l=Zd.getTraceableRunTree()?.tracingEnabled||AR(),d=l||(It("LANGCHAIN_TRACING")??!1);if(u||d){if(c||(c=new qd),u&&!c.handlers.some(f=>f.name===Vh.prototype.name)){let f=new Vh;c.addHandler(f,!0)}if(d&&!c.handlers.some(f=>f.name==="langchain_tracer")&&l){let f=new Zd;c.addHandler(f,!0)}if(l){let f=Zd.getTraceableRunTree();f&&c._parentRunId===void 0&&(c._parentRunId=f.id,c.handlers.find(m=>m.name==="langchain_tracer")?.updateFromRunTree(f))}}for(let{contextVar:f,inheritable:p=!0,handlerClass:m,envVar:h}of OR()){let _=h&&It(h)==="true"&&m,v,b=f!==void 0?l0(f):void 0;b&&ox(b)?v=b:_&&(v=new m({})),v!==void 0&&(c||(c=new qd),c.handlers.some(x=>x.name===v.name)||c.addHandler(v,p))}return(n||o)&&c&&(c.addTags(n??[]),c.addTags(o??[],!1)),(i||s)&&c&&(c.addMetadata(i??{}),c.addMetadata(s??{},!1)),c}};function pu(t){return"name"in t?t:la.fromMethods(t)}var p0=class{getStore(){}run(t,e){return e()}enterWith(t){}},eV=new p0,zR=Symbol.for("lc:child_config"),tV=class{getInstance(){return Li()??eV}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[zR]}runWithConfig(t,e,r){let n=St._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata),o=this.getInstance(),i=o.getStore(),s=n?.getParentRunId(),a=n?.handlers?.find(u=>u?.name==="langchain_tracer"),c;return a&&s?c=a.getRunTreeWithTracingConfig(s):r||(c=new Ln({name:"",tracingEnabled:!1})),c&&(c.extra={...c.extra,[zR]:t}),i!==void 0&&i[Di]!==void 0&&(c===void 0&&(c={}),c[Di]=i[Di]),o.run(c,e)}initializeGlobalInstance(t){Li()===void 0&&fO(t)}},Lt=new tV;var rV={};G(rV,{AsyncLocalStorageProviderSingleton:()=>Lt,MockAsyncLocalStorage:()=>p0,_CONTEXT_VARIABLES_KEY:()=>Di});var Wh=25;async function or(t){return St._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function ga(...t){let e={};for(let r of t.filter(n=>!!n))for(let n of Object.keys(r))if(n==="metadata")e[n]={...e[n],...r[n]};else if(n==="tags"){let o=e[n]??[];e[n]=[...new Set(o.concat(r[n]??[]))]}else if(n==="configurable")e[n]={...e[n],...r[n]};else if(n==="timeout")e.timeout===void 0?e.timeout=r.timeout:r.timeout!==void 0&&(e.timeout=Math.min(e.timeout,r.timeout));else if(n==="signal")e.signal===void 0?e.signal=r.signal:r.signal!==void 0&&("any"in AbortSignal?e.signal=AbortSignal.any([e.signal,r.signal]):e.signal=r.signal);else if(n==="callbacks"){let o=e.callbacks,i=r.callbacks;if(Array.isArray(i))if(!o)e.callbacks=i;else if(Array.isArray(o))e.callbacks=o.concat(i);else{let s=o.copy();for(let a of i)s.addHandler(pu(a),!0);e.callbacks=s}else if(i)if(!o)e.callbacks=i;else if(Array.isArray(o)){let s=i.copy();for(let a of o)s.addHandler(pu(a),!0);e.callbacks=s}else e.callbacks=new St(i._parentRunId,{handlers:o.handlers.concat(i.handlers),inheritableHandlers:o.inheritableHandlers.concat(i.inheritableHandlers),tags:Array.from(new Set(o.tags.concat(i.tags))),inheritableTags:Array.from(new Set(o.inheritableTags.concat(i.inheritableTags))),metadata:{...o.metadata,...i.metadata}})}else{let o=n;e[o]=r[o]??e[o]}return e}var nV=new Set(["string","number","boolean"]);function Pe(t){let e=Lt.getRunnableConfig(),r={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(e){let{runId:n,runName:o,...i}=e;r=Object.entries(i).reduce((s,[a,c])=>(c!==void 0&&(s[a]=c),s),r)}if(t&&(r=Object.entries(t).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),r)),r?.configurable)for(let n of Object.keys(r.configurable))nV.has(typeof r.configurable[n])&&!r.metadata?.[n]&&(r.metadata||(r.metadata={}),r.metadata[n]=r.configurable[n]);if(r.timeout!==void 0){if(r.timeout<=0)throw new Error("Timeout must be a positive number");let n=AbortSignal.timeout(r.timeout);r.signal!==void 0?"any"in AbortSignal&&(r.signal=AbortSignal.any([r.signal,n])):r.signal=n,delete r.timeout}return r}function Ve(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:s}={}){let a=Pe(t);return e!==void 0&&(delete a.runName,a.callbacks=e),n!==void 0&&(a.recursionLimit=n),r!==void 0&&(a.maxConcurrency=r),o!==void 0&&(a.runName=o),i!==void 0&&(a.configurable={...a.configurable,...i}),s!==void 0&&delete a.runId,a}function vr(t){if(t)return{configurable:t.configurable,recursionLimit:t.recursionLimit,callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,maxConcurrency:t.maxConcurrency,timeout:t.timeout,signal:t.signal,store:t.store}}async function vn(t,e){if(e===void 0)return t;let r;return Promise.race([t.catch(n=>{if(!e?.aborted)throw n}),new Promise((n,o)=>{r=()=>{o(Bi(e))},e.addEventListener("abort",r),e.aborted&&o(Bi(e))})]).finally(()=>e.removeEventListener("abort",r))}function Bi(t){return t?.reason instanceof Error?t.reason:typeof t?.reason=="string"?new Error(t.reason):new Error("Aborted")}var oV={};G(oV,{AsyncGeneratorWithSetup:()=>Zi,IterableReadableStream:()=>br,atee:()=>Jh,concat:()=>en,pipeGeneratorWithSetup:()=>m0});var br=class f0 extends ReadableStream{reader;ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let e=await this.reader.read();return e.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}throw e}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(e){let r=e.getReader();return new f0({start(n){return o();function o(){return r.read().then(({done:i,value:s})=>{if(i){n.close();return}return n.enqueue(s),o()})}},cancel(){r.releaseLock()}})}static fromAsyncGenerator(e){return new f0({async pull(r){let{value:n,done:o}=await e.next();o&&r.close(),r.enqueue(n)},async cancel(r){await e.return(r)}})}};function Jh(t,e=2){let r=Array.from({length:e},()=>[]);return r.map(async function*(o){for(;;)if(o.length===0){let i=await t.next();for(let s of r)s.push(i)}else{if(o[0].done)return;yield o.shift().value}})}function en(t,e){if(Array.isArray(t)&&Array.isArray(e))return t.concat(e);if(typeof t=="string"&&typeof e=="string")return t+e;if(typeof t=="number"&&typeof e=="number")return t+e;if("concat"in t&&typeof t.concat=="function")return t.concat(e);if(typeof t=="object"&&typeof e=="object"){let r={...t};for(let[n,o]of Object.entries(e))n in r&&!Array.isArray(r[n])?r[n]=en(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}var Zi=class{generator;setup;config;signal;firstResult;firstResultUsed=!1;constructor(t){this.generator=t.generator,this.config=t.config,this.signal=t.signal??this.config?.signal,this.setup=new Promise((e,r)=>{Lt.runWithConfig(vr(t.config),async()=>{this.firstResult=t.generator.next(),t.startSetup?this.firstResult.then(t.startSetup).then(e,r):this.firstResult.then(n=>e(void 0),r)},!0)})}async next(...t){return this.signal?.throwIfAborted(),this.firstResultUsed?Lt.runWithConfig(vr(this.config),this.signal?async()=>vn(this.generator.next(...t),this.signal):async()=>this.generator.next(...t),!0):(this.firstResultUsed=!0,this.firstResult)}async return(t){return this.generator.return(t)}async throw(t){return this.generator.throw(t)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}};async function m0(t,e,r,n,...o){let i=new Zi({generator:e,startSetup:r,signal:n}),s=await i.setup;return{output:t(i,s,...o),setup:s}}var iV=Object.prototype.hasOwnProperty;function Yh(t,e){return iV.call(t,e)}function Qh(t){if(Array.isArray(t)){let r=new Array(t.length);for(let n=0;n=48&&n<=57){e++;continue}return!1}return!0}function Jo(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function tg(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function Xh(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r_t,_areEquals:()=>Gd,applyOperation:()=>_a,applyPatch:()=>qi,applyReducer:()=>cV,deepClone:()=>sV,getValueByPointer:()=>ng,validate:()=>jR,validator:()=>og});var _t=rg,sV=wr,fu={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){let n=ng(r,this.path);n&&(n=wr(n));let o=_a(r,{op:"remove",path:this.from}).removed;return _a(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=ng(r,this.from);return _a(r,{op:"add",path:this.path,value:wr(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:Gd(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},aV={add:function(t,e,r){return eg(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:fu.move,copy:fu.copy,test:fu.test,_get:fu._get};function ng(t,e){if(e=="")return t;var r={op:"_get",path:e};return _a(t,r),r.value}function _a(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):og(e,0)),e.path===""){let s={newDocument:t};if(e.op==="add")return s.newDocument=e.value,s;if(e.op==="replace")return s.newDocument=e.value,s.removed=t,s;if(e.op==="move"||e.op==="copy")return s.newDocument=ng(t,e.from),e.op==="move"&&(s.removed=t),s;if(e.op==="test"){if(s.test=Gd(t,e.value),s.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return s.newDocument=t,s}else{if(e.op==="remove")return s.removed=t,s.newDocument=null,s;if(e.op==="_get")return e.value=t,s;if(r)throw new _t("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return s}}else{n||(t=wr(t));let a=(e.path||"").split("/"),c=t,u=1,l=a.length,d,f,p;for(typeof r=="function"?p=r:p=og;;){if(f=a[u],f&&f.indexOf("~")!=-1&&(f=tg(f)),o&&(f=="__proto__"||f=="prototype"&&u>0&&a[u-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&d===void 0&&(c[f]===void 0?d=a.slice(0,u).join("/"):u==l-1&&(d=e.path),d!==void 0&&p(e,0,t,d)),u++,Array.isArray(c)){if(f==="-")f=c.length;else{if(r&&!eg(f))throw new _t("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,e,t);eg(f)&&(f=~~f)}if(u>=l){if(r&&e.op==="add"&&f>c.length)throw new _t("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let m=aV[e.op].call(e,c,f,t);if(m.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(u>=l){let m=fu[e.op].call(e,c,f,t);if(m.test===!1)throw new _t("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(c=c[f],r&&u0)throw new _t('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new _t("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new _t("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&Xh(t.value))throw new _t("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var o=t.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new _t("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==n)throw new _t("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var s={op:"_get",path:t.from,value:void 0},a=jR([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new _t("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new _t("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function jR(t,e,r){try{if(!Array.isArray(t))throw new _t("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)qi(wr(e),wr(t),r||!0);else{r=r||og;for(var n=0;n=0;u--){var l=s[u],d=t[l];if(Yh(e,l)&&!(e[l]===void 0&&d!==void 0&&Array.isArray(e)===!1)){var f=e[l];typeof d=="object"&&d!=null&&typeof f=="object"&&f!=null&&Array.isArray(d)===Array.isArray(f)?DR(d,f,r,n+"/"+Jo(l),o):d!==f&&(a=!0,o&&r.push({op:"test",path:n+"/"+Jo(l),value:wr(d)}),r.push({op:"replace",path:n+"/"+Jo(l),value:wr(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+Jo(l),value:wr(d)}),r.push({op:"remove",path:n+"/"+Jo(l)}),c=!0):(o&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),a=!0)}if(!(!c&&i.length==s.length))for(var u=0;usg,RunLog:()=>ig,RunLogPatch:()=>ho,isLogStreamHandler:()=>_0});var ho=class{ops;constructor(t){this.ops=t.ops??[]}concat(t){let e=this.ops.concat(t.ops),r=qi({},e);return new ig({ops:e,state:r[r.length-1].newDocument})}},ig=class g0 extends ho{state;constructor(e){super(e),this.state=e.state}concat(e){let r=this.ops.concat(e.ops),n=qi(this.state,e.ops);return new g0({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=qi({},e.ops);return new g0({ops:e.ops,state:r[r.length-1].newDocument})}},_0=t=>t.name==="log_stream_tracer";async function LR(t,e){if(e==="original")throw new Error("Do not assign inputs with original schema drop the key for now. When inputs are added to streamLog they should be added with standardized schema for streaming events.");let{inputs:r}=t;if(["retriever","llm","prompt"].includes(t.run_type))return r;if(!(Object.keys(r).length===1&&r?.input===""))return r.input}async function UR(t,e){let{outputs:r}=t;return e==="original"||["retriever","llm","prompt"].includes(t.run_type)?r:r!==void 0&&Object.keys(r).length===1&&r?.output!==void 0?r.output:r}function lV(t){return t!==void 0&&t.message!==void 0}var sg=class extends Un{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;_schemaFormat="original";rootId;keyMapByRunId={};counterMapByRunName={};transformStream;writer;receiveStream;name="log_stream_tracer";lc_prefer_streaming=!0;constructor(t){super({_awaitHandler:!0,...t}),this.autoClose=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this._schemaFormat=t?._schemaFormat??this._schemaFormat,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=br.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){if(t.id===this.rootId)return!1;let e=t.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(t.run_type)),this.includeTags!==void 0&&(r=r||e.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(t.run_type)),this.excludeTags!==void 0&&(r=r&&e.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(t,e){for await(let r of e){if(t!==this.rootId){let n=this.keyMapByRunId[t];n&&await this.writer.write(new ho({ops:[{op:"add",path:`/logs/${n}/streamed_output/-`,value:r}]}))}yield r}}async onRunCreate(t){if(this.rootId===void 0&&(this.rootId=t.id,await this.writer.write(new ho({ops:[{op:"replace",path:"",value:{id:t.id,name:t.name,type:t.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(t))return;this.counterMapByRunName[t.name]===void 0&&(this.counterMapByRunName[t.name]=0),this.counterMapByRunName[t.name]+=1;let e=this.counterMapByRunName[t.name];this.keyMapByRunId[t.id]=e===1?t.name:`${t.name}:${e}`;let r={id:t.id,name:t.name,type:t.run_type,tags:t.tags??[],metadata:t.extra?.metadata??{},start_time:new Date(t.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};this._schemaFormat==="streaming_events"&&(r.inputs=await LR(t,this._schemaFormat)),await this.writer.write(new ho({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[t.id]}`,value:r}]}))}async onRunUpdate(t){try{let e=this.keyMapByRunId[t.id];if(e===void 0)return;let r=[];this._schemaFormat==="streaming_events"&&r.push({op:"replace",path:`/logs/${e}/inputs`,value:await LR(t,this._schemaFormat)}),r.push({op:"add",path:`/logs/${e}/final_output`,value:await UR(t,this._schemaFormat)}),t.end_time!==void 0&&r.push({op:"add",path:`/logs/${e}/end_time`,value:new Date(t.end_time).toISOString()});let n=new ho({ops:r});await this.writer.write(n)}finally{if(t.id===this.rootId){let e=new ho({ops:[{op:"replace",path:"/final_output",value:await UR(t,this._schemaFormat)}]});await this.writer.write(e),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(t,e,r){let n=this.keyMapByRunId[t.id];if(n===void 0)return;let o=t.inputs.messages!==void 0,i;o?lV(r?.chunk)?i=r?.chunk:i=new Dt({id:`run-${t.id}`,content:e}):i=e;let s=new ho({ops:[{op:"add",path:`/logs/${n}/streamed_output_str/-`,value:e},{op:"add",path:`/logs/${n}/streamed_output/-`,value:i}]});await this.writer.write(s)}};var dV={};G(dV,{ChatGenerationChunk:()=>Vi,GenerationChunk:()=>go,RUN_KEY:()=>ya});var ya="__run",go=class FR{text;generationInfo;constructor(e){this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new FR({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},Vi=class BR extends go{message;constructor(e){super(e),this.message=e.message}concat(e){return new BR({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo},message:this.message.concat(e.message)})}};function ag({name:t,serialized:e}){return t!==void 0?t:e?.name!==void 0?e.name:e?.id!==void 0&&Array.isArray(e?.id)?e.id[e.id.length-1]:"Unnamed"}var ZR=t=>t.name==="event_stream_tracer",qR=class extends Un{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;runInfoMap=new Map;tappedPromises=new Map;transformStream;writer;receiveStream;name="event_stream_tracer";lc_prefer_streaming=!0;constructor(t){super({_awaitHandler:!0,...t}),this.autoClose=t?.autoClose??!0,this.includeNames=t?.includeNames,this.includeTypes=t?.includeTypes,this.includeTags=t?.includeTags,this.excludeNames=t?.excludeNames,this.excludeTypes=t?.excludeTypes,this.excludeTags=t?.excludeTags,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=br.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(t){}_includeRun(t){let e=t.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(t.runType)),this.includeTags!==void 0&&(r=r||e.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(t.runType)),this.excludeTags!==void 0&&(r=r&&e.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(t,e){let r=await e.next();if(r.done)return;let n=this.runInfoMap.get(t);if(n===void 0){yield r.value;return}function o(s,a){return s==="llm"&&typeof a=="string"?new go({text:a}):a}let i=this.tappedPromises.get(t);if(i===void 0){let s;i=new Promise(a=>{s=a}),this.tappedPromises.set(t,i);try{let a={event:`on_${n.runType}_stream`,run_id:t,name:n.name,tags:n.tags,metadata:n.metadata,data:{}};await this.send({...a,data:{chunk:o(n.runType,r.value)}},n),yield r.value;for await(let c of e)n.runType!=="tool"&&n.runType!=="retriever"&&await this.send({...a,data:{chunk:o(n.runType,c)}},n),yield c}finally{s?.()}}else{yield r.value;for await(let s of e)yield s}}async send(t,e){this._includeRun(e)&&await this.writer.write(t)}async sendEndEvent(t,e){let r=this.tappedPromises.get(t.run_id);r!==void 0?r.then(()=>{this.send(t,e)}):await this.send(t,e)}async onLLMStart(t){let e=ag(t),r=t.inputs.messages!==void 0?"chat_model":"llm",n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:r,inputs:t.inputs};this.runInfoMap.set(t.id,n);let o=`on_${r}_start`;await this.send({event:o,data:{input:t.inputs},name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onLLMNewToken(t,e,r){let n=this.runInfoMap.get(t.id),o,i;if(n===void 0)throw new Error(`onLLMNewToken: Run ID ${t.id} not found in run map.`);if(this.runInfoMap.size!==1){if(n.runType==="chat_model")i="on_chat_model_stream",r?.chunk===void 0?o=new Dt({content:e,id:`run-${t.id}`}):o=r.chunk.message;else if(n.runType==="llm")i="on_llm_stream",r?.chunk===void 0?o=new go({text:e}):o=r.chunk;else throw new Error(`Unexpected run type ${n.runType}`);await this.send({event:i,data:{chunk:o},run_id:t.id,name:n.name,tags:n.tags,metadata:n.metadata},n)}}async onLLMEnd(t){let e=this.runInfoMap.get(t.id);this.runInfoMap.delete(t.id);let r;if(e===void 0)throw new Error(`onLLMEnd: Run ID ${t.id} not found in run map.`);let n=t.outputs?.generations,o;if(e.runType==="chat_model"){for(let i of n??[]){if(o!==void 0)break;o=i[0]?.message}r="on_chat_model_end"}else if(e.runType==="llm")o={generations:n?.map(i=>i.map(s=>({text:s.text,generationInfo:s.generationInfo}))),llmOutput:t.outputs?.llmOutput??{}},r="on_llm_end";else throw new Error(`onLLMEnd: Unexpected run type: ${e.runType}`);await this.sendEndEvent({event:r,data:{output:o,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async onChainStart(t){let e=ag(t),r=t.run_type??"chain",n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:t.run_type},o={};t.inputs.input===""&&Object.keys(t.inputs).length===1?(o={},n.inputs={}):t.inputs.input!==void 0?(o.input=t.inputs.input,n.inputs=t.inputs.input):(o.input=t.inputs,n.inputs=t.inputs),this.runInfoMap.set(t.id,n),await this.send({event:`on_${r}_start`,data:o,name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onChainEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onChainEnd: Run ID ${t.id} not found in run map.`);let r=`on_${t.run_type}_end`,n=t.inputs??e.inputs??{},i={output:t.outputs?.output??t.outputs,input:n};n.input&&Object.keys(n).length===1&&(i.input=n.input,e.inputs=n.input),await this.sendEndEvent({event:r,data:i,run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata??{}},e)}async onToolStart(t){let e=ag(t),r={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:"tool",inputs:t.inputs??{}};this.runInfoMap.set(t.id,r),await this.send({event:"on_tool_start",data:{input:t.inputs??{}},name:e,run_id:t.id,tags:t.tags??[],metadata:t.extra?.metadata??{}},r)}async onToolEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onToolEnd: Run ID ${t.id} not found in run map.`);if(e.inputs===void 0)throw new Error(`onToolEnd: Run ID ${t.id} is a tool call, and is expected to have traced inputs.`);let r=t.outputs?.output===void 0?t.outputs:t.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:r,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async onRetrieverStart(t){let e=ag(t),n={tags:t.tags??[],metadata:t.extra?.metadata??{},name:e,runType:"retriever",inputs:{query:t.inputs.query}};this.runInfoMap.set(t.id,n),await this.send({event:"on_retriever_start",data:{input:{query:t.inputs.query}},name:e,tags:t.tags??[],run_id:t.id,metadata:t.extra?.metadata??{}},n)}async onRetrieverEnd(t){let e=this.runInfoMap.get(t.id);if(this.runInfoMap.delete(t.id),e===void 0)throw new Error(`onRetrieverEnd: Run ID ${t.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:t.outputs?.documents??t.outputs,input:e.inputs},run_id:t.id,name:e.name,tags:e.tags,metadata:e.metadata},e)}async handleCustomEvent(t,e,r){let n=this.runInfoMap.get(r);if(n===void 0)throw new Error(`handleCustomEvent: Run ID ${r} not found in run map.`);await this.send({event:"on_custom_event",run_id:r,name:t,tags:n.tags,metadata:n.metadata,data:e},n)}async finish(){let t=[...this.tappedPromises.values()];Promise.all(t).finally(()=>{this.writer.close()})}};var pV=Object.prototype.toString,fV=t=>pV.call(t)==="[object Error]",mV=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function VR(t){if(!(t&&fV(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:mV.has(r)}function hV(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function cg(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(_),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},_=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&_.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function Kd(t,e={}){if(e={...e},hV(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,cg("factor",e.factor,{min:0,allowInfinity:!1}),cg("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),cg("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),cg("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await yV({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var ug=mn(Sh(),1),vV={};G(vV,{AsyncCaller:()=>Xo});var bV=[400,401,402,403,404,405,406,407,409],wV=t=>{if(t.message.startsWith("Cancel")||t.message.startsWith("AbortError")||t.name==="AbortError"||t?.code==="ECONNABORTED")throw t;let e=t?.response?.status??t?.status;if(e&&bV.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},Xo=class{maxConcurrency;maxRetries;onFailedAttempt;queue;constructor(t){this.maxConcurrency=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??6,this.onFailedAttempt=t.onFailedAttempt??wV;let e="default"in ug.default?ug.default.default:ug.default;this.queue=new e({concurrency:this.maxConcurrency})}async call(t,...e){return this.queue.add(()=>Kd(()=>t(...e).catch(r=>{throw r instanceof Error?r:new Error(r)}),{onFailedAttempt:({error:r})=>this.onFailedAttempt?.(r),retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(t,e,...r){if(t.signal){let n;return Promise.race([this.call(e,...r),new Promise((o,i)=>{n=()=>{i(Bi(t.signal))},t.signal?.addEventListener("abort",n)})]).finally(()=>{t.signal&&n&&t.signal.removeEventListener("abort",n)})}return this.call(e,...r)}fetch(...t){return this.call(()=>fetch(...t).then(e=>e.ok?e:Promise.reject(e)))}};var y0=class extends Un{name="RootListenersTracer";rootId;config;argOnStart;argOnEnd;argOnError;constructor({config:t,onStart:e,onEnd:r,onError:n}){super({_awaitHandler:!0}),this.config=t,this.argOnStart=e,this.argOnEnd=r,this.argOnError=n}persistRun(t){return Promise.resolve()}async onRunCreate(t){this.rootId||(this.rootId=t.id,this.argOnStart&&await this.argOnStart(t,this.config))}async onRunUpdate(t){t.id===this.rootId&&(t.error?this.argOnError&&await this.argOnError(t,this.config):this.argOnEnd&&await this.argOnEnd(t,this.config))}};function Hd(t){return t?t.lc_runnable:!1}var KR=class{includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;constructor(t){this.includeNames=t.includeNames,this.includeTypes=t.includeTypes,this.includeTags=t.includeTags,this.excludeNames=t.excludeNames,this.excludeTypes=t.excludeTypes,this.excludeTags=t.excludeTags}includeEvent(t,e){let r=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,n=t.tags??[];return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(e)),this.includeTags!==void 0&&(r=r||n.some(o=>this.includeTags?.includes(o))),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(e)),this.excludeTags!==void 0&&(r=r&&n.every(o=>!this.excludeTags?.includes(o))),r}},HR=t=>btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");var nn={};gi(nn,{$ZodAny:()=>a_,$ZodArray:()=>l_,$ZodAsyncError:()=>Fn,$ZodBase64:()=>Xg,$ZodBase64URL:()=>Yg,$ZodBigInt:()=>cp,$ZodBigIntFormat:()=>n_,$ZodBoolean:()=>ku,$ZodCIDRv4:()=>Wg,$ZodCIDRv6:()=>Jg,$ZodCUID:()=>jg,$ZodCUID2:()=>Dg,$ZodCatch:()=>S_,$ZodCheck:()=>Je,$ZodCheckBigIntFormat:()=>s$,$ZodCheckEndsWith:()=>y$,$ZodCheckGreaterThan:()=>Sg,$ZodCheckIncludes:()=>g$,$ZodCheckLengthEquals:()=>p$,$ZodCheckLessThan:()=>Ig,$ZodCheckLowerCase:()=>m$,$ZodCheckMaxLength:()=>l$,$ZodCheckMaxSize:()=>a$,$ZodCheckMimeType:()=>b$,$ZodCheckMinLength:()=>d$,$ZodCheckMinSize:()=>c$,$ZodCheckMultipleOf:()=>o$,$ZodCheckNumberFormat:()=>i$,$ZodCheckOverwrite:()=>w$,$ZodCheckProperty:()=>v$,$ZodCheckRegex:()=>f$,$ZodCheckSizeEquals:()=>u$,$ZodCheckStartsWith:()=>_$,$ZodCheckStringFormat:()=>Su,$ZodCheckUpperCase:()=>h$,$ZodCodec:()=>Au,$ZodCustom:()=>R_,$ZodCustomStringFormat:()=>t_,$ZodDate:()=>u_,$ZodDefault:()=>w_,$ZodDiscriminatedUnion:()=>d_,$ZodE164:()=>Qg,$ZodEmail:()=>Rg,$ZodEmoji:()=>zg,$ZodEncodeError:()=>Gi,$ZodEnum:()=>g_,$ZodError:()=>np,$ZodFile:()=>y_,$ZodFunction:()=>O_,$ZodGUID:()=>Pg,$ZodIPv4:()=>Gg,$ZodIPv6:()=>Kg,$ZodISODate:()=>Zg,$ZodISODateTime:()=>Bg,$ZodISODuration:()=>Vg,$ZodISOTime:()=>qg,$ZodIntersection:()=>p_,$ZodJWT:()=>e_,$ZodKSUID:()=>Fg,$ZodLazy:()=>C_,$ZodLiteral:()=>__,$ZodMAC:()=>Hg,$ZodMap:()=>m_,$ZodNaN:()=>k_,$ZodNanoID:()=>Mg,$ZodNever:()=>Eu,$ZodNonOptional:()=>$_,$ZodNull:()=>s_,$ZodNullable:()=>b_,$ZodNumber:()=>ap,$ZodNumberFormat:()=>r_,$ZodObject:()=>S$,$ZodObjectJIT:()=>k$,$ZodOptional:()=>xa,$ZodPipe:()=>T_,$ZodPrefault:()=>x_,$ZodPromise:()=>P_,$ZodReadonly:()=>E_,$ZodRealError:()=>Rr,$ZodRecord:()=>f_,$ZodRegistry:()=>Pu,$ZodSet:()=>h_,$ZodString:()=>Yi,$ZodStringFormat:()=>He,$ZodSuccess:()=>I_,$ZodSymbol:()=>o_,$ZodTemplateLiteral:()=>A_,$ZodTransform:()=>v_,$ZodTuple:()=>lp,$ZodType:()=>ye,$ZodULID:()=>Lg,$ZodURL:()=>Ng,$ZodUUID:()=>Cg,$ZodUndefined:()=>i_,$ZodUnion:()=>up,$ZodUnknown:()=>Tu,$ZodVoid:()=>c_,$ZodXID:()=>Ug,$brand:()=>Jd,$constructor:()=>$,$input:()=>D_,$output:()=>j_,Doc:()=>sp,JSONSchema:()=>$z,JSONSchemaGenerator:()=>zp,NEVER:()=>lg,TimePrecision:()=>B_,_any:()=>uy,_array:()=>T$,_base64:()=>Op,_base64url:()=>Pp,_bigint:()=>ry,_boolean:()=>ey,_catch:()=>j5,_check:()=>xz,_cidrv4:()=>Ep,_cidrv6:()=>Ap,_coercedBigint:()=>ny,_coercedBoolean:()=>ty,_coercedDate:()=>py,_coercedNumber:()=>H_,_coercedString:()=>U_,_cuid:()=>wp,_cuid2:()=>xp,_custom:()=>by,_date:()=>dy,_decode:()=>gg,_decodeAsync:()=>yg,_default:()=>N5,_discriminatedUnion:()=>x5,_e164:()=>Cp,_email:()=>mp,_emoji:()=>vp,_encode:()=>hg,_encodeAsync:()=>_g,_endsWith:()=>Bu,_enum:()=>E5,_file:()=>vy,_float32:()=>J_,_float64:()=>X_,_gt:()=>yo,_gte:()=>ir,_guid:()=>Cu,_includes:()=>Uu,_int:()=>W_,_int32:()=>Y_,_int64:()=>oy,_intersection:()=>$5,_ipv4:()=>kp,_ipv6:()=>Tp,_isoDate:()=>q_,_isoDateTime:()=>Z_,_isoDuration:()=>G_,_isoTime:()=>V_,_jwt:()=>Rp,_ksuid:()=>Sp,_lazy:()=>F5,_length:()=>Sa,_literal:()=>O5,_lowercase:()=>Du,_lt:()=>_o,_lte:()=>zr,_mac:()=>F_,_map:()=>k5,_max:()=>zr,_maxLength:()=>Ia,_maxSize:()=>$a,_mime:()=>Zu,_min:()=>ir,_minLength:()=>Qo,_minSize:()=>es,_multipleOf:()=>Qi,_nan:()=>fy,_nanoid:()=>bp,_nativeEnum:()=>A5,_negative:()=>hy,_never:()=>zu,_nonnegative:()=>_y,_nonoptional:()=>z5,_nonpositive:()=>gy,_normalize:()=>qu,_null:()=>cy,_nullable:()=>R5,_number:()=>K_,_optional:()=>C5,_overwrite:()=>Zn,_parse:()=>bu,_parseAsync:()=>wu,_pipe:()=>D5,_positive:()=>my,_promise:()=>B5,_property:()=>yy,_readonly:()=>L5,_record:()=>S5,_refine:()=>wy,_regex:()=>ju,_safeDecode:()=>bg,_safeDecodeAsync:()=>xg,_safeEncode:()=>vg,_safeEncodeAsync:()=>wg,_safeParse:()=>xu,_safeParseAsync:()=>$u,_set:()=>T5,_size:()=>Mu,_slugify:()=>Np,_startsWith:()=>Fu,_string:()=>L_,_stringFormat:()=>ka,_stringbool:()=>Sy,_success:()=>M5,_superRefine:()=>xy,_symbol:()=>sy,_templateLiteral:()=>U5,_toLowerCase:()=>Gu,_toUpperCase:()=>Ku,_transform:()=>P5,_trim:()=>Vu,_tuple:()=>I5,_uint32:()=>Q_,_uint64:()=>iy,_ulid:()=>$p,_undefined:()=>ay,_union:()=>w5,_unknown:()=>Nu,_uppercase:()=>Lu,_url:()=>Ru,_uuid:()=>hp,_uuidv4:()=>gp,_uuidv6:()=>_p,_uuidv7:()=>yp,_void:()=>ly,_xid:()=>Ip,clone:()=>Qe,config:()=>yt,decode:()=>tN,decodeAsync:()=>nN,describe:()=>$y,encode:()=>eN,encodeAsync:()=>rN,flattenError:()=>yu,formatError:()=>vu,globalConfig:()=>Wd,globalRegistry:()=>Ge,isValidBase64:()=>I$,isValidBase64URL:()=>IN,isValidJWT:()=>SN,locales:()=>Ou,meta:()=>Iy,parse:()=>Bn,parseAsync:()=>Yo,prettifyError:()=>mg,regexes:()=>Nr,registry:()=>fp,safeDecode:()=>iN,safeDecodeAsync:()=>aN,safeEncode:()=>oN,safeEncodeAsync:()=>sN,safeParse:()=>ba,safeParseAsync:()=>Iu,toDotPath:()=>QR,toJSONSchema:()=>vo,treeifyError:()=>fg,util:()=>M,version:()=>x$});var lg=Object.freeze({status:"aborted"});function $(t,e,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let u=s.prototype,l=Object.keys(u);for(let d=0;dr?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var Jd=Symbol("zod_brand"),Fn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Gi=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Wd={};function yt(t){return t&&Object.assign(Wd,t),Wd}var M={};gi(M,{BIGINT_FORMAT_RANGES:()=>E0,Class:()=>b0,NUMBER_FORMAT_RANGES:()=>T0,aborted:()=>Xi,allowsEval:()=>$0,assert:()=>kV,assertEqual:()=>xV,assertIs:()=>IV,assertNever:()=>SV,assertNotEqual:()=>$V,assignProp:()=>Hi,base64ToUint8Array:()=>JR,base64urlToUint8Array:()=>ZV,cached:()=>gu,captureStackTrace:()=>pg,cleanEnum:()=>BV,cleanRegex:()=>Qd,clone:()=>Qe,cloneDef:()=>EV,createTransparentProxy:()=>NV,defineLazy:()=>Me,esc:()=>dg,escapeRegex:()=>bn,extend:()=>jV,finalizeIssue:()=>rn,floatSafeRemainder:()=>w0,getElementAtPath:()=>AV,getEnumValues:()=>Yd,getLengthableOrigin:()=>rp,getParsedType:()=>RV,getSizableOrigin:()=>tp,hexToUint8Array:()=>VV,isObject:()=>va,isPlainObject:()=>Ji,issue:()=>_u,joinValues:()=>E,jsonStringifyReplacer:()=>hu,merge:()=>LV,mergeDefs:()=>Wi,normalizeParams:()=>D,nullish:()=>Ki,numKeys:()=>CV,objectClone:()=>TV,omit:()=>MV,optionalKeys:()=>k0,partial:()=>UV,pick:()=>zV,prefixIssues:()=>tn,primitiveTypes:()=>S0,promiseAllObject:()=>OV,propertyKeyTypes:()=>ep,randomString:()=>PV,required:()=>FV,safeExtend:()=>DV,shallowClone:()=>I0,slugify:()=>x0,stringifyPrimitive:()=>j,uint8ArrayToBase64:()=>XR,uint8ArrayToBase64url:()=>qV,uint8ArrayToHex:()=>GV,unwrapMessage:()=>Xd});function xV(t){return t}function $V(t){return t}function IV(t){}function SV(t){throw new Error}function kV(t){}function Yd(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function E(t,e="|"){return t.map(r=>j(r)).join(e)}function hu(t,e){return typeof e=="bigint"?e.toString():e}function gu(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ki(t){return t==null}function Qd(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function w0(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,s=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return s%a/10**i}var WR=Symbol("evaluating");function Me(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==WR)return n===void 0&&(n=WR,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function TV(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Hi(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Wi(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function EV(t){return Wi(t._zod.def)}function AV(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function OV(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i{};function va(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var $0=gu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Ji(t){if(va(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(va(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function I0(t){return Ji(t)?{...t}:Array.isArray(t)?[...t]:t}function CV(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var RV=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},ep=new Set(["string","number","symbol"]),S0=new Set(["string","number","bigint","boolean","symbol","undefined"]);function bn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qe(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function D(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function NV(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function j(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function k0(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var T0={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},E0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zV(t,e){let r=t._zod.def,n=Wi(t._zod.def,{get shape(){let o={};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&(o[i]=r.shape[i])}return Hi(this,"shape",o),o},checks:[]});return Qe(t,n)}function MV(t,e){let r=t._zod.def,n=Wi(t._zod.def,{get shape(){let o={...t._zod.def.shape};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&delete o[i]}return Hi(this,"shape",o),o},checks:[]});return Qe(t,n)}function jV(t,e){if(!Ji(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let o=Wi(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return Hi(this,"shape",i),i},checks:[]});return Qe(t,o)}function DV(t,e){if(!Ji(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return Hi(this,"shape",n),n},checks:t._zod.def.checks};return Qe(t,r)}function LV(t,e){let r=Wi(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return Hi(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Qe(t,r)}function UV(t,e,r){let n=Wi(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=t?new t({type:"optional",innerType:o[s]}):o[s])}else for(let s in o)i[s]=t?new t({type:"optional",innerType:o[s]}):o[s];return Hi(this,"shape",i),i},checks:[]});return Qe(e,n)}function FV(t,e,r){let n=Wi(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new t({type:"nonoptional",innerType:o[s]}))}else for(let s in o)i[s]=new t({type:"nonoptional",innerType:o[s]});return Hi(this,"shape",i),i},checks:[]});return Qe(e,n)}function Xi(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Xd(t){return typeof t=="string"?t:t?.message}function rn(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=Xd(t.inst?._zod.def?.error?.(t))??Xd(e?.error?.(t))??Xd(r.customError?.(t))??Xd(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function tp(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function rp(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function _u(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function BV(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function JR(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;ne.toString(16).padStart(2,"0")).join("")}var b0=class{constructor(...e){}};var YR=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,hu,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},np=$("$ZodError",YR),Rr=$("$ZodError",YR,{Parent:Error});function yu(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function vu(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>n({issues:s}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let s=r,a=0;for(;ar.message){let r={errors:[]},n=(o,i=[])=>{var s,a;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>n({issues:u},c.path));else if(c.code==="invalid_key")n({issues:c.issues},c.path);else if(c.code==="invalid_element")n({issues:c.issues},c.path);else{let u=[...i,...c.path];if(u.length===0){r.errors.push(e(c));continue}let l=r,d=0;for(;dtypeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function mg(t){let e=[],r=[...t.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${QR(n.path)}`);return e.join(` +`)}var bu=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Fn;if(s.issues.length){let a=new(o?.Err??t)(s.issues.map(c=>rn(c,i,yt())));throw pg(a,o?.callee),a}return s.value},Bn=bu(Rr),wu=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(o?.Err??t)(s.issues.map(c=>rn(c,i,yt())));throw pg(a,o?.callee),a}return s.value},Yo=wu(Rr),xu=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Fn;return i.issues.length?{success:!1,error:new(t??np)(i.issues.map(s=>rn(s,o,yt())))}:{success:!0,data:i.value}},ba=xu(Rr),$u=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(s=>rn(s,o,yt())))}:{success:!0,data:i.value}},Iu=$u(Rr),hg=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return bu(t)(e,r,o)},eN=hg(Rr),gg=t=>(e,r,n)=>bu(t)(e,r,n),tN=gg(Rr),_g=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wu(t)(e,r,o)},rN=_g(Rr),yg=t=>async(e,r,n)=>wu(t)(e,r,n),nN=yg(Rr),vg=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return xu(t)(e,r,o)},oN=vg(Rr),bg=t=>(e,r,n)=>xu(t)(e,r,n),iN=bg(Rr),wg=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return $u(t)(e,r,o)},sN=wg(Rr),xg=t=>async(e,r,n)=>$u(t)(e,r,n),aN=xg(Rr);var Nr={};gi(Nr,{base64:()=>q0,base64url:()=>$g,bigint:()=>J0,boolean:()=>Q0,browserEmail:()=>t3,cidrv4:()=>B0,cidrv6:()=>Z0,cuid:()=>A0,cuid2:()=>O0,date:()=>G0,datetime:()=>H0,domain:()=>o3,duration:()=>z0,e164:()=>V0,email:()=>j0,emoji:()=>D0,extendedDuration:()=>HV,guid:()=>M0,hex:()=>i3,hostname:()=>n3,html5Email:()=>YV,idnEmail:()=>e3,integer:()=>X0,ipv4:()=>L0,ipv6:()=>U0,ksuid:()=>R0,lowercase:()=>r$,mac:()=>F0,md5_base64:()=>a3,md5_base64url:()=>c3,md5_hex:()=>s3,nanoid:()=>N0,null:()=>e$,number:()=>Y0,rfc5322Email:()=>QV,sha1_base64:()=>l3,sha1_base64url:()=>d3,sha1_hex:()=>u3,sha256_base64:()=>f3,sha256_base64url:()=>m3,sha256_hex:()=>p3,sha384_base64:()=>g3,sha384_base64url:()=>_3,sha384_hex:()=>h3,sha512_base64:()=>v3,sha512_base64url:()=>b3,sha512_hex:()=>y3,string:()=>W0,time:()=>K0,ulid:()=>P0,undefined:()=>t$,unicodeEmail:()=>cN,uppercase:()=>n$,uuid:()=>wa,uuid4:()=>WV,uuid6:()=>JV,uuid7:()=>XV,xid:()=>C0});var A0=/^[cC][^\s-]{8,}$/,O0=/^[0-9a-z]+$/,P0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,C0=/^[0-9a-vA-V]{20}$/,R0=/^[A-Za-z0-9]{27}$/,N0=/^[a-zA-Z0-9_-]{21}$/,z0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,HV=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,M0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,wa=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,WV=wa(4),JV=wa(6),XV=wa(7),j0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,YV=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,QV=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,cN=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,e3=cN,t3=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,r3="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function D0(){return new RegExp(r3,"u")}var L0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,U0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,F0=t=>{let e=bn(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},B0=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Z0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,q0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$g=/^[A-Za-z0-9_-]*$/,n3=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,o3=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,V0=/^\+(?:[0-9]){6,14}[0-9]$/,uN="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",G0=new RegExp(`^${uN}$`);function lN(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function K0(t){return new RegExp(`^${lN(t)}$`)}function H0(t){let e=lN({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${uN}T(?:${n})$`)}var W0=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},J0=/^-?\d+n?$/,X0=/^-?\d+$/,Y0=/^-?\d+(?:\.\d+)?/,Q0=/^(?:true|false)$/i,e$=/^null$/i;var t$=/^undefined$/i;var r$=/^[^A-Z]*$/,n$=/^[^a-z]*$/,i3=/^[0-9a-fA-F]*$/;function op(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function ip(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var s3=/^[0-9a-fA-F]{32}$/,a3=op(22,"=="),c3=ip(22),u3=/^[0-9a-fA-F]{40}$/,l3=op(27,"="),d3=ip(27),p3=/^[0-9a-fA-F]{64}$/,f3=op(43,"="),m3=ip(43),h3=/^[0-9a-fA-F]{96}$/,g3=op(64,""),_3=ip(64),y3=/^[0-9a-fA-F]{128}$/,v3=op(86,"=="),b3=ip(86);var Je=$("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),pN={number:"number",bigint:"bigint",object:"date"},Ig=$("$ZodCheckLessThan",(t,e)=>{Je.init(t,e);let r=pN[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?n.value<=e.value:n.value{Je.init(t,e);let r=pN[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),o$=$("$ZodCheckMultipleOf",(t,e)=>{Je.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):w0(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),i$=$("$ZodCheckNumberFormat",(t,e)=>{Je.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=T0[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=o,a.maximum=i,r&&(a.pattern=X0)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}ai&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:t})}}),s$=$("$ZodCheckBigIntFormat",(t,e)=>{Je.init(t,e);let[r,n]=E0[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;in&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inst:t})}}),a$=$("$ZodCheckMaxSize",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=n.value;o.size<=e.maximum||n.issues.push({origin:tp(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),c$=$("$ZodCheckMinSize",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:tp(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),u$=$("$ZodCheckSizeEquals",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let s=i>e.size;n.issues.push({origin:tp(o),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),l$=$("$ZodCheckMaxLength",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=n.value;if(o.length<=e.maximum)return;let s=rp(o);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),d$=$("$ZodCheckMinLength",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let s=rp(o);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),p$=$("$ZodCheckLengthEquals",(t,e)=>{var r;Je.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Ki(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let s=rp(o),a=i>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Su=$("$ZodCheckStringFormat",(t,e)=>{var r,n;Je.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),f$=$("$ZodCheckRegex",(t,e)=>{Su.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),m$=$("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=r$),Su.init(t,e)}),h$=$("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=n$),Su.init(t,e)}),g$=$("$ZodCheckIncludes",(t,e)=>{Je.init(t,e);let r=bn(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),_$=$("$ZodCheckStartsWith",(t,e)=>{Je.init(t,e);let r=new RegExp(`^${bn(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),y$=$("$ZodCheckEndsWith",(t,e)=>{Je.init(t,e);let r=new RegExp(`.*${bn(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function dN(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues))}var v$=$("$ZodCheckProperty",(t,e)=>{Je.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>dN(o,r,e.property));dN(n,r,e.property)}}),b$=$("$ZodCheckMimeType",(t,e)=>{Je.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),w$=$("$ZodCheckOverwrite",(t,e)=>{Je.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var sp=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(` +`).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,o.join(` +`))}};var x$={major:4,minor:1,patch:13};var ye=$("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=x$;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(s,a,c)=>{let u=Xi(s),l;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(u)continue;let f=s.issues.length,p=d._zod.check(s);if(p instanceof Promise&&c?.async===!1)throw new Fn;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,s.issues.length!==f&&(u||(u=Xi(s,f)))});else{if(s.issues.length===f)continue;u||(u=Xi(s,f))}}return l?l.then(()=>s):s},i=(s,a,c)=>{if(Xi(s))return s.aborted=!0,s;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new Fn;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let u=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,s,a)):i(u,s,a)}let c=t._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Fn;return c.then(u=>o(u,n,a))}return o(c,n,a)}}t["~standard"]={validate:o=>{try{let i=ba(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Iu(t,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),Yi=$("$ZodString",(t,e)=>{ye.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??W0(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),He=$("$ZodStringFormat",(t,e)=>{Su.init(t,e),Yi.init(t,e)}),Pg=$("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=M0),He.init(t,e)}),Cg=$("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=wa(n))}else e.pattern??(e.pattern=wa());He.init(t,e)}),Rg=$("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=j0),He.init(t,e)}),Ng=$("$ZodURL",(t,e)=>{He.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),zg=$("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=D0()),He.init(t,e)}),Mg=$("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=N0),He.init(t,e)}),jg=$("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=A0),He.init(t,e)}),Dg=$("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=O0),He.init(t,e)}),Lg=$("$ZodULID",(t,e)=>{e.pattern??(e.pattern=P0),He.init(t,e)}),Ug=$("$ZodXID",(t,e)=>{e.pattern??(e.pattern=C0),He.init(t,e)}),Fg=$("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=R0),He.init(t,e)}),Bg=$("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=H0(e)),He.init(t,e)}),Zg=$("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=G0),He.init(t,e)}),qg=$("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=K0(e)),He.init(t,e)}),Vg=$("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=z0),He.init(t,e)}),Gg=$("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=L0),He.init(t,e),t._zod.bag.format="ipv4"}),Kg=$("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=U0),He.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Hg=$("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=F0(e.delimiter)),He.init(t,e),t._zod.bag.format="mac"}),Wg=$("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=B0),He.init(t,e)}),Jg=$("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Z0),He.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function I$(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Xg=$("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=q0),He.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{I$(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function IN(t){if(!$g.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return I$(r)}var Yg=$("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=$g),He.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{IN(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Qg=$("$ZodE164",(t,e)=>{e.pattern??(e.pattern=V0),He.init(t,e)});function SN(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var e_=$("$ZodJWT",(t,e)=>{He.init(t,e),t._zod.check=r=>{SN(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),t_=$("$ZodCustomStringFormat",(t,e)=>{He.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),ap=$("$ZodNumber",(t,e)=>{ye.init(t,e),t._zod.pattern=t._zod.bag.pattern??Y0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),r_=$("$ZodNumberFormat",(t,e)=>{i$.init(t,e),ap.init(t,e)}),ku=$("$ZodBoolean",(t,e)=>{ye.init(t,e),t._zod.pattern=Q0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),cp=$("$ZodBigInt",(t,e)=>{ye.init(t,e),t._zod.pattern=J0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),n_=$("$ZodBigIntFormat",(t,e)=>{s$.init(t,e),cp.init(t,e)}),o_=$("$ZodSymbol",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),i_=$("$ZodUndefined",(t,e)=>{ye.init(t,e),t._zod.pattern=t$,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),s_=$("$ZodNull",(t,e)=>{ye.init(t,e),t._zod.pattern=e$,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),a_=$("$ZodAny",(t,e)=>{ye.init(t,e),t._zod.parse=r=>r}),Tu=$("$ZodUnknown",(t,e)=>{ye.init(t,e),t._zod.parse=r=>r}),Eu=$("$ZodNever",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),c_=$("$ZodVoid",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),u_=$("$ZodDate",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});function mN(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues)),e.value[r]=t.value}var l_=$("$ZodArray",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let s=0;smN(u,r,s))):mN(c,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function Og(t,e,r,n){t.issues.length&&e.issues.push(...tn(r,t.issues)),t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function kN(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=k0(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function TN(t,e,r,n,o,i){let s=[],a=o.keySet,c=o.catchall._zod,u=c.def.type;for(let l in e){if(a.has(l))continue;if(u==="never"){s.push(l);continue}let d=c.run({value:e[l],issues:[]},n);d instanceof Promise?t.push(d.then(f=>Og(f,r,l,e))):Og(d,r,l,e)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var S$=$("$ZodObject",(t,e)=>{if(ye.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=gu(()=>kN(e));Me(t._zod,"propValues",()=>{let a=e.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=va,i=e.catchall,s;t._zod.parse=(a,c)=>{s??(s=n.value);let u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),a;a.value={};let l=[],d=s.shape;for(let f of s.keys){let m=d[f]._zod.run({value:u[f],issues:[]},c);m instanceof Promise?l.push(m.then(h=>Og(h,a,f,u))):Og(m,a,f,u)}return i?TN(l,u,a,c,n.value,t):l.length?Promise.all(l).then(()=>a):a}}),k$=$("$ZodObjectJIT",(t,e)=>{S$.init(t,e);let r=t._zod.parse,n=gu(()=>kN(e)),o=f=>{let p=new sp(["shape","payload","ctx"]),m=n.value,h=x=>{let k=dg(x);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};p.write("const input = payload.value;");let _=Object.create(null),v=0;for(let x of m.keys)_[x]=`key_${v++}`;p.write("const newResult = {};");for(let x of m.keys){let k=_[x],T=dg(x);p.write(`const ${k} = ${h(x)};`),p.write(` + if (${k}.issues.length) { + payload.issues = payload.issues.concat(${k}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${T}, ...iss.path] : [${T}] + }))); + } + + + if (${k}.value === undefined) { + if (${T} in input) { + newResult[${T}] = undefined; + } + } else { + newResult[${T}] = ${k}.value; + } + + `)}p.write("payload.value = newResult;"),p.write("return payload;");let b=p.compile();return(x,k)=>b(f,x,k)},i,s=va,a=!Wd.jitless,u=a&&$0.value,l=e.catchall,d;t._zod.parse=(f,p)=>{d??(d=n.value);let m=f.value;return s(m)?a&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(e.shape)),f=i(f,p),l?TN([],m,f,p,d,t):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function hN(t,e,r,n){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let o=t.filter(i=>!Xi(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(s=>rn(s,n,yt())))}),e)}var up=$("$ZodUnion",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Me(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Me(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),Me(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Qd(i.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1,a=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}return s?Promise.all(a).then(c=>hN(c,o,t,i)):hN(a,o,t,i)}}),d_=$("$ZodDiscriminatedUnion",(t,e)=>{up.init(t,e);let r=t._zod.parse;Me(t._zod,"propValues",()=>{let o={};for(let i of e.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=gu(()=>{let o=e.options,i=new Map;for(let s of o){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});t._zod.parse=(o,i)=>{let s=o.value;if(!va(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),o;let a=n.value.get(s?.[e.discriminator]);return a?a._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:s,path:[e.discriminator],inst:t}),o)}}),p_=$("$ZodIntersection",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),s=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>gN(r,c,u)):gN(r,i,s)}});function $$(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Ji(t)&&Ji(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let s=$$(t[i],e[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n{ye.init(t,e);let r=e.items;t._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let s=[],a=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=a===-1?0:r.length-a;if(!e.rest){let l=i.length>r.length,d=i.length=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?s.push(d.then(f=>kg(f,n,u))):kg(d,n,u)}if(e.rest){let l=i.slice(r.length);for(let d of l){u++;let f=e.rest._zod.run({value:d,issues:[]},o);f instanceof Promise?s.push(f.then(p=>kg(p,n,u))):kg(f,n,u)}}return s.length?Promise.all(s).then(()=>n):n}});function kg(t,e,r){t.issues.length&&e.issues.push(...tn(r,t.issues)),e.value[r]=t.value}var f_=$("$ZodRecord",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Ji(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...tn(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...tn(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let c=e.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(l=>rn(l,n,yt())),input:a,path:[a],inst:t}),r.value[c.value]=c.value;continue}let u=e.valueType._zod.run({value:o[a],issues:[]},n);u instanceof Promise?i.push(u.then(l=>{l.issues.length&&r.issues.push(...tn(a,l.issues)),r.value[c.value]=l.value})):(u.issues.length&&r.issues.push(...tn(a,u.issues)),r.value[c.value]=u.value)}}return i.length?Promise.all(i).then(()=>r):r}}),m_=$("$ZodMap",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[s,a]of o){let c=e.keyType._zod.run({value:s,issues:[]},n),u=e.valueType._zod.run({value:a,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{_N(l,d,r,s,o,t,n)})):_N(c,u,r,s,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});function _N(t,e,r,n,o,i,s){t.issues.length&&(ep.has(typeof n)?r.issues.push(...tn(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(a=>rn(a,s,yt()))})),e.issues.length&&(ep.has(typeof n)?r.issues.push(...tn(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(a=>rn(a,s,yt()))})),r.value.set(t.value,e.value)}var h_=$("$ZodSet",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of o){let a=e.valueType._zod.run({value:s,issues:[]},n);a instanceof Promise?i.push(a.then(c=>yN(c,r))):yN(a,r)}return i.length?Promise.all(i).then(()=>r):r}});function yN(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var g_=$("$ZodEnum",(t,e)=>{ye.init(t,e);let r=Yd(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>ep.has(typeof o)).map(o=>typeof o=="string"?bn(o):o.toString()).join("|")})$`),t._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:t}),o}}),__=$("$ZodLiteral",(t,e)=>{if(ye.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?bn(n):n?bn(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),y_=$("$ZodFile",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),v_=$("$ZodTransform",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new Fn;return r.value=o,r}});function vN(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var xa=$("$ZodOptional",(t,e)=>{ye.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Me(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Me(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qd(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>vN(i,r.value)):vN(o,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),b_=$("$ZodNullable",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.innerType._zod.optin),Me(t._zod,"optout",()=>e.innerType._zod.optout),Me(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qd(r.source)}|null)$`):void 0}),Me(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),w_=$("$ZodDefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>bN(i,e)):bN(o,e)}});function bN(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var x_=$("$ZodPrefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),$_=$("$ZodNonOptional",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>wN(i,t)):wN(o,t)}});function wN(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var I_=$("$ZodSuccess",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi("ZodSuccess");let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),S_=$("$ZodCatch",(t,e)=>{ye.init(t,e),Me(t._zod,"optin",()=>e.innerType._zod.optin),Me(t._zod,"optout",()=>e.innerType._zod.optout),Me(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(s=>rn(s,n,yt()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>rn(i,n,yt()))},input:r.value}),r.issues=[]),r)}}),k_=$("$ZodNaN",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),T_=$("$ZodPipe",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>e.in._zod.values),Me(t._zod,"optin",()=>e.in._zod.optin),Me(t._zod,"optout",()=>e.out._zod.optout),Me(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Tg(s,e.in,n)):Tg(i,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Tg(i,e.out,n)):Tg(o,e.out,n)}});function Tg(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var Au=$("$ZodCodec",(t,e)=>{ye.init(t,e),Me(t._zod,"values",()=>e.in._zod.values),Me(t._zod,"optin",()=>e.in._zod.optin),Me(t._zod,"optout",()=>e.out._zod.optout),Me(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(s=>Eg(s,e,n)):Eg(i,e,n)}else{let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Eg(s,e,n)):Eg(i,e,n)}}});function Eg(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(i=>Ag(t,i,e.out,r)):Ag(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(i=>Ag(t,i,e.in,r)):Ag(t,o,e.in,r)}}function Ag(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}var E_=$("$ZodReadonly",(t,e)=>{ye.init(t,e),Me(t._zod,"propValues",()=>e.innerType._zod.propValues),Me(t._zod,"values",()=>e.innerType._zod.values),Me(t._zod,"optin",()=>e.innerType?._zod?.optin),Me(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(xN):xN(o)}});function xN(t){return t.value=Object.freeze(t.value),t}var A_=$("$ZodTemplateLiteral",(t,e)=>{ye.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,s=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,s))}else if(n===null||S0.has(typeof n))r.push(bn(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"template_literal",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),O_=$("$ZodFunction",(t,e)=>(ye.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=t._def.input?Bn(t._def.input,n):n,i=Reflect.apply(r,this,o);return t._def.output?Bn(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=t._def.input?await Yo(t._def.input,n):n,i=await Reflect.apply(r,this,o);return t._def.output?await Yo(t._def.output,i):i}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new lp({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),P_=$("$ZodPromise",(t,e)=>{ye.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),C_=$("$ZodLazy",(t,e)=>{ye.init(t,e),Me(t._zod,"innerType",()=>e.getter()),Me(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),Me(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),Me(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),Me(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),R_=$("$ZodCustom",(t,e)=>{Je.init(t,e),ye.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>$N(i,r,n,t));$N(o,r,n,t)}});function $N(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(_u(o))}}var Ou={};gi(Ou,{ar:()=>EN,az:()=>AN,be:()=>PN,bg:()=>CN,ca:()=>RN,cs:()=>NN,da:()=>zN,de:()=>MN,en:()=>N_,eo:()=>jN,es:()=>DN,fa:()=>LN,fi:()=>UN,fr:()=>FN,frCA:()=>BN,he:()=>ZN,hu:()=>qN,id:()=>VN,is:()=>GN,it:()=>KN,ja:()=>HN,ka:()=>WN,kh:()=>JN,km:()=>z_,ko:()=>XN,lt:()=>QN,mk:()=>ez,ms:()=>tz,nl:()=>rz,no:()=>nz,ota:()=>oz,pl:()=>sz,ps:()=>iz,pt:()=>az,ru:()=>uz,sl:()=>lz,sv:()=>dz,ta:()=>pz,th:()=>fz,tr:()=>mz,ua:()=>hz,uk:()=>M_,ur:()=>gz,vi:()=>_z,yo:()=>bz,zhCN:()=>yz,zhTW:()=>vz});var x3=()=>{let t={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return o=>{switch(o.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${j(o.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${o.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${n[i.format]??o.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${o.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${o.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${o.keys.length>1?"\u0629":""}: ${E(o.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function EN(){return{localeError:x3()}}var $3=()=>{let t={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o.expected}, daxil olan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${j(o.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${n[i.format]??o.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${o.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${o.keys.length>1?"lar":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${o.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function AN(){return{localeError:$3()}}function ON(t,e,r,n){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?n:i===1?e:i>=2&&i<=4?r:n}var I3=()=>{let t={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0456\u045E";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${j(o.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),c=ON(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${o.maximum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),c=ON(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${o.minimum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${o.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${o.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function PN(){return{localeError:I3()}}var S3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(t))return"\u043C\u0430\u0441\u0438\u0432";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},k3=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function e(n){return t[n]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"};return n=>{switch(n.code){case"invalid_type":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${S3(n.input)}`;case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${j(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.maximum.toString()} ${i.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.minimum.toString()} ${i.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;if(o.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${o.prefix}"`;if(o.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${o.suffix}"`;if(o.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${o.includes}"`;if(o.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${o.pattern}`;let i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return o.format==="emoji"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="datetime"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="date"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),o.format==="time"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="duration"&&(i="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${i} ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${E(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function CN(){return{localeError:k3()}}var T3=()=>{let t={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${o.expected}, s'ha rebut ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Valor inv\xE0lid: s'esperava ${j(o.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${E(o.values," o ")}`;case"too_big":{let i=o.inclusive?"com a m\xE0xim":"menys de",s=e(o.origin);return s?`Massa gran: s'esperava que ${o.origin??"el valor"} contingu\xE9s ${i} ${o.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${o.origin??"el valor"} fos ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"com a m\xEDnim":"m\xE9s de",s=e(o.origin);return s?`Massa petit: s'esperava que ${o.origin} contingu\xE9s ${i} ${o.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${o.origin} fos ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${n[i.format]??o.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${o.divisor}`;case"unrecognized_keys":return`Clau${o.keys.length>1?"s":""} no reconeguda${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${o.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${o.origin}`;default:return"Entrada inv\xE0lida"}}};function RN(){return{localeError:T3()}}var E3=()=>{let t={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(o))return"pole";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return o=>{switch(o.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o.expected}, obdr\u017Eeno ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${j(o.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${n[i.format]??o.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${o.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${E(o.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${o.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${o.origin}`;default:return"Neplatn\xFD vstup"}}};function NN(){return{localeError:E3()}}var A3=()=>{let t={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},e={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};function r(s){return t[s]??null}function n(s){return e[s]??s}let o=s=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"tal";case"object":return Array.isArray(s)?"liste":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype&&s.constructor?s.constructor.name:"objekt"}return a},i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return s=>{switch(s.code){case"invalid_type":return`Ugyldigt input: forventede ${n(s.expected)}, fik ${n(o(s.input))}`;case"invalid_value":return s.values.length===1?`Ugyldig v\xE6rdi: forventede ${j(s.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${E(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=r(s.origin),u=n(s.origin);return c?`For stor: forventede ${u??"value"} ${c.verb} ${a} ${s.maximum.toString()} ${c.unit??"elementer"}`:`For stor: forventede ${u??"value"} havde ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=r(s.origin),u=n(s.origin);return c?`For lille: forventede ${u} ${c.verb} ${a} ${s.minimum.toString()} ${c.unit}`:`For lille: forventede ${u} havde ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Ugyldig streng: skal starte med "${a.prefix}"`:a.format==="ends_with"?`Ugyldig streng: skal ende med "${a.suffix}"`:a.format==="includes"?`Ugyldig streng: skal indeholde "${a.includes}"`:a.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${a.pattern}`:`Ugyldig ${i[a.format]??s.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${s.divisor}`;case"unrecognized_keys":return`${s.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${E(s.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${s.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${s.origin}`;default:return"Ugyldigt input"}}};function zN(){return{localeError:A3()}}var O3=()=>{let t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"Zahl";case"object":{if(Array.isArray(o))return"Array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return o=>{switch(o.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${o.expected}, erhalten ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ung\xFCltige Eingabe: erwartet ${j(o.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ist`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ist`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${o.divisor} sein`;case"unrecognized_keys":return`${o.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${o.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${o.origin}`;default:return"Ung\xFCltige Eingabe"}}};function MN(){return{localeError:O3()}}var P3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},C3=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${P3(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${j(n.values[0])}`:`Invalid option: expected one of ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function N_(){return{localeError:C3()}}var R3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"nombro";case"object":{if(Array.isArray(t))return"tabelo";if(t===null)return"senvalora";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},N3=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(n){return t[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return n=>{switch(n.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${n.expected}, ricevi\u011Dis ${R3(n.input)}`;case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${j(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()} ${i.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${o}${n.minimum.toString()} ${i.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${r[o.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function jN(){return{localeError:N3()}}var z3=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},e={string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};function r(s){return t[s]??null}function n(s){return e[s]??s}let o=s=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"number";case"object":return Array.isArray(s)?"array":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype?s.constructor.name:"object"}return a},i={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return s=>{switch(s.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${n(s.expected)}, recibido ${n(o(s.input))}`;case"invalid_value":return s.values.length===1?`Entrada inv\xE1lida: se esperaba ${j(s.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${E(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=r(s.origin),u=n(s.origin);return c?`Demasiado grande: se esperaba que ${u??"valor"} tuviera ${a}${s.maximum.toString()} ${c.unit??"elementos"}`:`Demasiado grande: se esperaba que ${u??"valor"} fuera ${a}${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=r(s.origin),u=n(s.origin);return c?`Demasiado peque\xF1o: se esperaba que ${u} tuviera ${a}${s.minimum.toString()} ${c.unit}`:`Demasiado peque\xF1o: se esperaba que ${u} fuera ${a}${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${a.prefix}"`:a.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${a.suffix}"`:a.format==="includes"?`Cadena inv\xE1lida: debe incluir "${a.includes}"`:a.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${a.pattern}`:`Inv\xE1lido ${i[a.format]??s.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${s.divisor}`;case"unrecognized_keys":return`Llave${s.keys.length>1?"s":""} desconocida${s.keys.length>1?"s":""}: ${E(s.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${n(s.origin)}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${n(s.origin)}`;default:return"Entrada inv\xE1lida"}}};function DN(){return{localeError:z3()}}var M3=()=>{let t={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0622\u0631\u0627\u06CC\u0647";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return o=>{switch(o.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${r(o.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":return o.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${j(o.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${E(o.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${n[i.format]??o.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${o.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${o.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${E(o.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${o.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${o.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function LN(){return{localeError:M3()}}var j3=()=>{let t={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return o=>{switch(o.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${o.expected}, oli ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${j(o.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${i}${o.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${i}${o.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${n[i.format]??o.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${o.divisor} monikerta`;case"unrecognized_keys":return`${o.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${E(o.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function UN(){return{localeError:j3()}}var D3=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombre";case"object":{if(Array.isArray(o))return"tableau";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : ${o.expected} attendu, ${r(o.input)} re\xE7u`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : ${j(o.values[0])} attendu`:`Option invalide : une valeur parmi ${E(o.values,"|")} attendue`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Trop grand : ${o.origin??"valeur"} doit ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o.origin??"valeur"} doit \xEAtre ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Trop petit : ${o.origin} doit ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Trop petit : ${o.origin} doit \xEAtre ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${E(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function FN(){return{localeError:D3()}}var L3=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${o.expected}, re\xE7u ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : attendu ${j(o.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u2264":"<",s=e(o.origin);return s?`Trop grand : attendu que ${o.origin??"la valeur"} ait ${i}${o.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${o.origin??"la valeur"} soit ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u2265":">",s=e(o.origin);return s?`Trop petit : attendu que ${o.origin} ait ${i}${o.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${o.origin} soit ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${E(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function BN(){return{localeError:L3()}}var U3=()=>{let t={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},e={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=u=>u?t[u]:void 0,n=u=>{let l=r(u);return l?l.label:u??t.unknown.label},o=u=>`\u05D4${n(u)}`,i=u=>(r(u)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",s=u=>u?e[u]??null:null,a=u=>{let l=typeof u;switch(l){case"number":return Number.isNaN(u)?"NaN":"number";case"object":return Array.isArray(u)?"array":u===null?"null":Object.getPrototypeOf(u)!==Object.prototype&&u.constructor?u.constructor.name:"object";default:return l}},c={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}};return u=>{switch(u.code){case"invalid_type":{let l=u.expected,d=n(l),f=a(u.input),p=t[f]?.label??f;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`}case"invalid_value":{if(u.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${j(u.values[0])}`;let l=u.values.map(p=>j(p));if(u.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l[0]} \u05D0\u05D5 ${l[1]}`;let d=l[l.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let l=s(u.origin),d=o(u.origin??"value");if(u.origin==="string")return`${l?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${u.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=u.inclusive?`${u.maximum} ${l?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${l?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?"<=":"<",p=i(u.origin??"value");return l?.unit?`${l.longLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()} ${l.unit}`:`${l?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()}`}case"too_small":{let l=s(u.origin),d=o(u.origin??"value");if(u.origin==="string")return`${l?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${u.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let _=(u.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${_}`}let h=u.inclusive?`${u.minimum} ${l?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${l?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?">=":">",p=i(u.origin??"value");return l?.unit?`${l.shortLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()} ${l.unit}`:`${l?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()}`}case"invalid_format":{let l=u;if(l.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${l.prefix}"`;if(l.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${l.suffix}"`;if(l.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${l.includes}"`;if(l.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${l.pattern}`;let d=c[l.format],f=d?.label??l.format,m=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${f} \u05DC\u05D0 ${m}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${u.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${u.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${u.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${E(u.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${o(u.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function ZN(){return{localeError:U3()}}var F3=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(o))return"t\xF6mb";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return o=>{switch(o.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o.expected}, a kapott \xE9rt\xE9k ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${j(o.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`T\xFAl nagy: ${o.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${o.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${o.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} m\xE9rete t\xFAl kicsi ${i}${o.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} t\xFAl kicsi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${n[i.format]??o.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${o.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${o.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${o.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function qN(){return{localeError:F3()}}var B3=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak valid: diharapkan ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak valid: diharapkan ${j(o.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: diharapkan ${o.origin??"value"} memiliki ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${o.origin??"value"} menjadi ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: diharapkan ${o.origin} memiliki ${i}${o.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${o.origin} menjadi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${n[i.format]??o.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${o.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${o.origin}`;default:return"Input tidak valid"}}};function VN(){return{localeError:B3()}}var Z3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"n\xFAmer";case"object":{if(Array.isArray(t))return"fylki";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},q3=()=>{let t={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function e(n){return t[n]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"};return n=>{switch(n.code){case"invalid_type":return`Rangt gildi: \xDE\xFA sl\xF3st inn ${Z3(n.input)} \xFEar sem \xE1 a\xF0 vera ${n.expected}`;case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${j(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${o}${n.maximum.toString()} ${i.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${o}${n.minimum.toString()} ${i.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${o.prefix}"`:o.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${o.suffix}"`:o.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${o.includes}"`:o.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${o.pattern}`:`Rangt ${r[o.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${E(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}};function GN(){return{localeError:q3()}}var V3=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numero";case"object":{if(Array.isArray(o))return"vettore";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input non valido: atteso ${o.expected}, ricevuto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input non valido: atteso ${j(o.values[0])}`:`Opzione non valida: atteso uno tra ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Troppo grande: ${o.origin??"valore"} deve avere ${i}${o.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${o.origin??"valore"} deve essere ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Troppo piccolo: ${o.origin} deve avere ${i}${o.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${o.origin} deve essere ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${o.divisor}`;case"unrecognized_keys":return`Chiav${o.keys.length>1?"i":"e"} non riconosciut${o.keys.length>1?"e":"a"}: ${E(o.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${o.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${o.origin}`;default:return"Input non valido"}}};function KN(){return{localeError:V3()}}var G3=()=>{let t={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(o))return"\u914D\u5217";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${o.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${r(o.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":return o.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${j(o.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${E(o.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=o.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=e(o.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${s.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=o.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=e(o.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${s.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${o.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${o.keys.length>1?"\u7FA4":""}: ${E(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function HN(){return{localeError:G3()}}var K3=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8";case"object":{if(Array.isArray(t))return"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return{string:"\u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0"}[e]??e},H3=()=>{let t={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function e(n){return t[n]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",json_string:"JSON \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"};return n=>{switch(n.code){case"invalid_type":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${K3(n.input)}`;case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${j(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${E(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${i.verb} ${o}${n.maximum.toString()} ${i.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${i.verb} ${o}${n.minimum.toString()} ${i.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.prefix}"-\u10D8\u10D7`:o.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.suffix}"-\u10D8\u10D7`:o.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${o.includes}"-\u10E1`:o.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${o.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${E(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function WN(){return{localeError:H3()}}var W3=()=>{let t={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(o))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(o===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return o=>{switch(o.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${j(o.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${o.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${E(o.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function z_(){return{localeError:W3()}}function JN(){return z_()}var J3=()=>{let t={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return o=>{switch(o.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${r(o.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":return o.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${j(o.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${E(o.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=o.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),c=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()}${c} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()} ${i}${s}`}case"too_small":{let i=o.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),c=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()}${c} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${n[i.format]??o.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${o.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${E(o.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${o.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${o.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function XN(){return{localeError:J3()}}var X3=t=>pp(typeof t,t),pp=(t,e=void 0)=>{switch(t){case"number":return Number.isNaN(e)?"NaN":"skai\u010Dius";case"bigint":return"sveikasis skai\u010Dius";case"string":return"eilut\u0117";case"boolean":return"login\u0117 reik\u0161m\u0117";case"undefined":case"void":return"neapibr\u0117\u017Eta reik\u0161m\u0117";case"function":return"funkcija";case"symbol":return"simbolis";case"object":return e===void 0?"ne\u017Einomas objektas":e===null?"nulin\u0117 reik\u0161m\u0117":Array.isArray(e)?"masyvas":Object.getPrototypeOf(e)!==Object.prototype&&e.constructor?e.constructor.name:"objektas";case"null":return"nulin\u0117 reik\u0161m\u0117"}return t},dp=t=>t.charAt(0).toUpperCase()+t.slice(1);function YN(t){let e=Math.abs(t),r=e%10,n=e%100;return n>=11&&n<=19||r===0?"many":r===1?"one":"few"}var Y3=()=>{let t={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function e(n,o,i,s){let a=t[n]??null;return a===null?a:{unit:a.unit[o],verb:a.verb[s][i?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"};return n=>{switch(n.code){case"invalid_type":return`Gautas tipas ${X3(n.input)}, o tik\u0117tasi - ${pp(n.expected)}`;case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${j(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${E(n.values,"|")} pasirinkim\u0173`;case"too_big":{let o=pp(n.origin),i=e(n.origin,YN(Number(n.maximum)),n.inclusive??!1,"smaller");if(i?.verb)return`${dp(o??n.origin??"reik\u0161m\u0117")} ${i.verb} ${n.maximum.toString()} ${i.unit??"element\u0173"}`;let s=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${dp(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.maximum.toString()} ${i?.unit}`}case"too_small":{let o=pp(n.origin),i=e(n.origin,YN(Number(n.minimum)),n.inclusive??!1,"bigger");if(i?.verb)return`${dp(o??n.origin??"reik\u0161m\u0117")} ${i.verb} ${n.minimum.toString()} ${i.unit??"element\u0173"}`;let s=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${dp(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.minimum.toString()} ${i?.unit}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${o.prefix}"`:o.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${o.includes}"`:o.format==="regex"?`Eilut\u0117 privalo atitikti ${o.pattern}`:`Neteisingas ${r[o.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${E(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let o=pp(n.origin);return`${dp(o??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function QN(){return{localeError:Y3()}}var Q3=()=>{let t={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(o))return"\u043D\u0438\u0437\u0430";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return o=>{switch(o.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${j(o.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${o.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${o.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function ez(){return{localeError:Q3()}}var e5=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombor";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak sah: dijangka ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak sah: dijangka ${j(o.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: dijangka ${o.origin??"nilai"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${o.origin??"nilai"} adalah ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: dijangka ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${o.origin} adalah ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${n[i.format]??o.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${E(o.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${o.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${o.origin}`;default:return"Input tidak sah"}}};function tz(){return{localeError:e5()}}var t5=()=>{let t={string:{unit:"tekens",verb:"te hebben"},file:{unit:"bytes",verb:"te hebben"},array:{unit:"elementen",verb:"te hebben"},set:{unit:"elementen",verb:"te hebben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"getal";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return o=>{switch(o.code){case"invalid_type":return`Ongeldige invoer: verwacht ${o.expected}, ontving ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ongeldige invoer: verwacht ${j(o.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Te groot: verwacht dat ${o.origin??"waarde"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"elementen"}`:`Te groot: verwacht dat ${o.origin??"waarde"} ${i}${o.maximum.toString()} is`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Te klein: verwacht dat ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Te klein: verwacht dat ${o.origin} ${i}${o.minimum.toString()} is`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${o.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${o.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${o.origin}`;default:return"Ongeldige invoer"}}};function rz(){return{localeError:t5()}}var r5=()=>{let t={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"tall";case"object":{if(Array.isArray(o))return"liste";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Ugyldig input: forventet ${o.expected}, fikk ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ugyldig verdi: forventet ${j(o.values[0])}`:`Ugyldig valg: forventet en av ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${n[i.format]??o.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${o.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${o.origin}`;default:return"Ugyldig input"}}};function nz(){return{localeError:r5()}}var n5=()=>{let t={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numara";case"object":{if(Array.isArray(o))return"saf";if(o===null)return"gayb";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return o=>{switch(o.code){case"invalid_type":return`F\xE2sit giren: umulan ${o.expected}, al\u0131nan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`F\xE2sit giren: umulan ${j(o.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=o;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${n[i.format]??o.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${o.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${o.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function oz(){return{localeError:n5()}}var o5=()=>{let t={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0627\u0631\u06D0";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return o=>{switch(o.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${r(o.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":return o.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${j(o.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${E(o.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0648\u064A`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${n[i.format]??o.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${o.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${o.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${E(o.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${o.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${o.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function iz(){return{localeError:o5()}}var i5=()=>{let t={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"liczba";case"object":{if(Array.isArray(o))return"tablica";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return o=>{switch(o.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o.expected}, otrzymano ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${j(o.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${n[i.format]??o.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${o.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${o.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${o.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function sz(){return{localeError:i5()}}var s5=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(o))return"array";if(o===null)return"nulo";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${o.expected}, recebido ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: esperado ${j(o.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Muito grande: esperado que ${o.origin??"valor"} tivesse ${i}${o.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${o.origin??"valor"} fosse ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Muito pequeno: esperado que ${o.origin} tivesse ${i}${o.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${o.origin} fosse ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`:i.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inv\xE1lido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`:`${n[i.format]??o.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${o.divisor}`;case"unrecognized_keys":return`Chave${o.keys.length>1?"s":""} desconhecida${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${o.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${o.origin}`;default:return"Campo inv\xE1lido"}}};function az(){return{localeError:s5()}}function cz(t,e,r,n){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?n:i===1?e:i>=2&&i<=4?r:n}var a5=()=>{let t={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${j(o.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),c=cz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.maximum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),c=cz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.minimum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${o.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0438":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${o.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function uz(){return{localeError:a5()}}var c5=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(o))return"tabela";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return o=>{switch(o.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${o.expected}, prejeto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${j(o.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} imelo ${i}${o.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${o.origin} imelo ${i}${o.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${n[i.format]??o.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${o.divisor}`;case"unrecognized_keys":return`Neprepoznan${o.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${E(o.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${o.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${o.origin}`;default:return"Neveljaven vnos"}}};function lz(){return{localeError:c5()}}var u5=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"antal";case"object":{if(Array.isArray(o))return"lista";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return o=>{switch(o.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${o.expected}, fick ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${j(o.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${n[i.format]??o.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${E(o.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${o.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${o.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function dz(){return{localeError:u5()}}var l5=()=>{let t={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(o))return"\u0B85\u0BA3\u0BBF";if(o===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${j(o.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${E(o.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${o.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${o.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function pz(){return{localeError:l5()}}var d5=()=>{let t={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(o))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(o===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return o=>{switch(o.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${j(o.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=e(o.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=e(o.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${o.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${E(o.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function fz(){return{localeError:d5()}}var p5=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},f5=()=>{let t={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(n){return t[n]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return n=>{switch(n.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${n.expected}, al\u0131nan ${p5(n.input)}`;case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${j(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${E(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()} ${i.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()} ${i.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[o.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function mz(){return{localeError:f5()}}var m5=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${j(o.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} \u0431\u0443\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0456":""}: ${E(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${o.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function M_(){return{localeError:m5()}}function hz(){return M_()}var h5=()=>{let t={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(o))return"\u0622\u0631\u06D2";if(o===null)return"\u0646\u0644";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return o=>{switch(o.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${r(o.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":return o.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${j(o.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${E(o.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${o.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${o.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u06D2 ${i}${o.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u0627 ${i}${o.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${o.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${o.keys.length>1?"\u0632":""}: ${E(o.keys,"\u060C ")}`;case"invalid_key":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function gz(){return{localeError:h5()}}var g5=()=>{let t={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(o))return"m\u1EA3ng";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return o=>{switch(o.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${j(o.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${n[i.format]??o.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${o.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${E(o.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function _z(){return{localeError:g5()}}var _5=()=>{let t={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(o))return"\u6570\u7EC4";if(o===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${j(o.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${n[i.format]??o.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${o.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${o.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function yz(){return{localeError:_5()}}var y5=()=>{let t={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o.expected}\uFF0C\u4F46\u6536\u5230 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${j(o.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${o.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${o.keys.length>1?"\u5011":""}\uFF1A${E(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function vz(){return{localeError:y5()}}var v5=()=>{let t={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\u1ECD\u0301mb\xE0";case"object":{if(Array.isArray(o))return"akop\u1ECD";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"};return o=>{switch(o.code){case"invalid_type":return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${o.expected}, \xE0m\u1ECD\u0300 a r\xED ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${j(o.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${E(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin??"iye"} ${s.verb} ${i}${o.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${o.maximum}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin} ${s.verb} ${i}${o.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${o.minimum}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`:i.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`:i.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`:i.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`:`A\u1E63\xEC\u1E63e: ${n[i.format]??o.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${o.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${E(o.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function bz(){return{localeError:v5()}}var wz,j_=Symbol("ZodOutput"),D_=Symbol("ZodInput"),Pu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function fp(){return new Pu}(wz=globalThis).__zod_globalRegistry??(wz.__zod_globalRegistry=fp());var Ge=globalThis.__zod_globalRegistry;function L_(t,e){return new t({type:"string",...D(e)})}function U_(t,e){return new t({type:"string",coerce:!0,...D(e)})}function mp(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...D(e)})}function Cu(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...D(e)})}function hp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...D(e)})}function gp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(e)})}function _p(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(e)})}function yp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(e)})}function Ru(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...D(e)})}function vp(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...D(e)})}function bp(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(e)})}function wp(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...D(e)})}function xp(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(e)})}function $p(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...D(e)})}function Ip(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...D(e)})}function Sp(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(e)})}function kp(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(e)})}function Tp(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(e)})}function F_(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...D(e)})}function Ep(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(e)})}function Ap(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(e)})}function Op(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...D(e)})}function Pp(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...D(e)})}function Cp(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...D(e)})}function Rp(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...D(e)})}var B_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Z_(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(e)})}function q_(t,e){return new t({type:"string",format:"date",check:"string_format",...D(e)})}function V_(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...D(e)})}function G_(t,e){return new t({type:"string",format:"duration",check:"string_format",...D(e)})}function K_(t,e){return new t({type:"number",checks:[],...D(e)})}function H_(t,e){return new t({type:"number",coerce:!0,checks:[],...D(e)})}function W_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...D(e)})}function J_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...D(e)})}function X_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...D(e)})}function Y_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...D(e)})}function Q_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...D(e)})}function ey(t,e){return new t({type:"boolean",...D(e)})}function ty(t,e){return new t({type:"boolean",coerce:!0,...D(e)})}function ry(t,e){return new t({type:"bigint",...D(e)})}function ny(t,e){return new t({type:"bigint",coerce:!0,...D(e)})}function oy(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...D(e)})}function iy(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...D(e)})}function sy(t,e){return new t({type:"symbol",...D(e)})}function ay(t,e){return new t({type:"undefined",...D(e)})}function cy(t,e){return new t({type:"null",...D(e)})}function uy(t){return new t({type:"any"})}function Nu(t){return new t({type:"unknown"})}function zu(t,e){return new t({type:"never",...D(e)})}function ly(t,e){return new t({type:"void",...D(e)})}function dy(t,e){return new t({type:"date",...D(e)})}function py(t,e){return new t({type:"date",coerce:!0,...D(e)})}function fy(t,e){return new t({type:"nan",...D(e)})}function _o(t,e){return new Ig({check:"less_than",...D(e),value:t,inclusive:!1})}function zr(t,e){return new Ig({check:"less_than",...D(e),value:t,inclusive:!0})}function yo(t,e){return new Sg({check:"greater_than",...D(e),value:t,inclusive:!1})}function ir(t,e){return new Sg({check:"greater_than",...D(e),value:t,inclusive:!0})}function my(t){return yo(0,t)}function hy(t){return _o(0,t)}function gy(t){return zr(0,t)}function _y(t){return ir(0,t)}function Qi(t,e){return new o$({check:"multiple_of",...D(e),value:t})}function $a(t,e){return new a$({check:"max_size",...D(e),maximum:t})}function es(t,e){return new c$({check:"min_size",...D(e),minimum:t})}function Mu(t,e){return new u$({check:"size_equals",...D(e),size:t})}function Ia(t,e){return new l$({check:"max_length",...D(e),maximum:t})}function Qo(t,e){return new d$({check:"min_length",...D(e),minimum:t})}function Sa(t,e){return new p$({check:"length_equals",...D(e),length:t})}function ju(t,e){return new f$({check:"string_format",format:"regex",...D(e),pattern:t})}function Du(t){return new m$({check:"string_format",format:"lowercase",...D(t)})}function Lu(t){return new h$({check:"string_format",format:"uppercase",...D(t)})}function Uu(t,e){return new g$({check:"string_format",format:"includes",...D(e),includes:t})}function Fu(t,e){return new _$({check:"string_format",format:"starts_with",...D(e),prefix:t})}function Bu(t,e){return new y$({check:"string_format",format:"ends_with",...D(e),suffix:t})}function yy(t,e,r){return new v$({check:"property",property:t,schema:e,...D(r)})}function Zu(t,e){return new b$({check:"mime_type",mime:t,...D(e)})}function Zn(t){return new w$({check:"overwrite",tx:t})}function qu(t){return Zn(e=>e.normalize(t))}function Vu(){return Zn(t=>t.trim())}function Gu(){return Zn(t=>t.toLowerCase())}function Ku(){return Zn(t=>t.toUpperCase())}function Np(){return Zn(t=>x0(t))}function T$(t,e,r){return new t({type:"array",element:e,...D(r)})}function w5(t,e,r){return new t({type:"union",options:e,...D(r)})}function x5(t,e,r,n){return new t({type:"union",options:r,discriminator:e,...D(n)})}function $5(t,e,r){return new t({type:"intersection",left:e,right:r})}function I5(t,e,r,n){let o=r instanceof ye,i=o?n:r,s=o?r:null;return new t({type:"tuple",items:e,rest:s,...D(i)})}function S5(t,e,r,n){return new t({type:"record",keyType:e,valueType:r,...D(n)})}function k5(t,e,r,n){return new t({type:"map",keyType:e,valueType:r,...D(n)})}function T5(t,e,r){return new t({type:"set",valueType:e,...D(r)})}function E5(t,e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new t({type:"enum",entries:n,...D(r)})}function A5(t,e,r){return new t({type:"enum",entries:e,...D(r)})}function O5(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...D(r)})}function vy(t,e){return new t({type:"file",...D(e)})}function P5(t,e){return new t({type:"transform",transform:e})}function C5(t,e){return new t({type:"optional",innerType:e})}function R5(t,e){return new t({type:"nullable",innerType:e})}function N5(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():I0(r)}})}function z5(t,e,r){return new t({type:"nonoptional",innerType:e,...D(r)})}function M5(t,e){return new t({type:"success",innerType:e})}function j5(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function D5(t,e,r){return new t({type:"pipe",in:e,out:r})}function L5(t,e){return new t({type:"readonly",innerType:e})}function U5(t,e,r){return new t({type:"template_literal",parts:e,...D(r)})}function F5(t,e){return new t({type:"lazy",getter:e})}function B5(t,e){return new t({type:"promise",innerType:e})}function by(t,e,r){let n=D(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function wy(t,e,r){return new t({type:"custom",check:"custom",fn:e,...D(r)})}function xy(t){let e=xz(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(_u(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(_u(o))}},t(r.value,r)));return e}function xz(t,e){let r=new Je({check:"custom",...D(e)});return r._zod.check=t,r}function $y(t){let e=new Je({check:"describe"});return e._zod.onattach=[r=>{let n=Ge.get(r)??{};Ge.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function Iy(t){let e=new Je({check:"meta"});return e._zod.onattach=[r=>{let n=Ge.get(r)??{};Ge.add(r,{...n,...t})}],e._zod.check=()=>{},e}function Sy(t,e){let r=D(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(n),s=new Set(o),a=t.Codec??Au,c=t.Boolean??ku,u=t.String??Yi,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new a({type:"pipe",in:l,out:d,transform:((p,m)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:s.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((p,m)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return f}function ka(t,e,r,n={}){let o=D(n),i={...D(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:a=>r.test(a),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}var zp=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Ge,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},f=e._zod.parent;if(f)a.ref=f,this.process(f,d),this.seen.get(f).isParent=!0;else{let p=a.schema;switch(o.type){case"string":{let m=p;m.type="string";let{minimum:h,maximum:_,format:v,patterns:b,contentEncoding:x}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof _=="number"&&(m.maxLength=_),v&&(m.format=i[v]??v,m.format===""&&delete m.format),x&&(m.contentEncoding=x),b&&b.size>0){let k=[...b];k.length===1?m.pattern=k[0].source:k.length>1&&(a.schema.allOf=[...k.map(T=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:T.source}))])}break}case"number":{let m=p,{minimum:h,maximum:_,format:v,multipleOf:b,exclusiveMaximum:x,exclusiveMinimum:k}=e._zod.bag;typeof v=="string"&&v.includes("int")?m.type="integer":m.type="number",typeof k=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.minimum=k,m.exclusiveMinimum=!0):m.exclusiveMinimum=k),typeof h=="number"&&(m.minimum=h,typeof k=="number"&&this.target!=="draft-4"&&(k>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof x=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(m.maximum=x,m.exclusiveMaximum=!0):m.exclusiveMaximum=x),typeof _=="number"&&(m.maximum=_,typeof x=="number"&&this.target!=="draft-4"&&(x<=_?delete m.maximum:delete m.exclusiveMaximum)),typeof b=="number"&&(m.multipleOf=b);break}case"boolean":{let m=p;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{this.target==="openapi-3.0"?(p.type="string",p.nullable=!0,p.enum=[null]):p.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{p.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let m=p,{minimum:h,maximum:_}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof _=="number"&&(m.maxItems=_),m.type="array",m.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let m=p;m.type="object",m.properties={};let h=o.shape;for(let b in h)m.properties[b]=this.process(h[b],{...d,path:[...d.path,"properties",b]});let _=new Set(Object.keys(h)),v=new Set([..._].filter(b=>{let x=o.shape[b]._zod;return this.io==="input"?x.optin===void 0:x.optout===void 0}));v.size>0&&(m.required=Array.from(v)),o.catchall?._zod.def.type==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{let m=p,h=o.discriminator!==void 0,_=o.options.map((v,b)=>this.process(v,{...d,path:[...d.path,h?"oneOf":"anyOf",b]}));h?m.oneOf=_:m.anyOf=_;break}case"intersection":{let m=p,h=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),_=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),v=x=>"allOf"in x&&Object.keys(x).length===1,b=[...v(h)?h.allOf:[h],...v(_)?_.allOf:[_]];m.allOf=b;break}case"tuple":{let m=p;m.type="array";let h=this.target==="draft-2020-12"?"prefixItems":"items",_=this.target==="draft-2020-12"||this.target==="openapi-3.0"?"items":"additionalItems",v=o.items.map((T,F)=>this.process(T,{...d,path:[...d.path,h,F]})),b=o.rest?this.process(o.rest,{...d,path:[...d.path,_,...this.target==="openapi-3.0"?[o.items.length]:[]]}):null;this.target==="draft-2020-12"?(m.prefixItems=v,b&&(m.items=b)):this.target==="openapi-3.0"?(m.items={anyOf:v},b&&m.items.anyOf.push(b),m.minItems=v.length,b||(m.maxItems=v.length)):(m.items=v,b&&(m.additionalItems=b));let{minimum:x,maximum:k}=e._zod.bag;typeof x=="number"&&(m.minItems=x),typeof k=="number"&&(m.maxItems=k);break}case"record":{let m=p;m.type="object",(this.target==="draft-7"||this.target==="draft-2020-12")&&(m.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]})),m.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=p,h=Yd(o.entries);h.every(_=>typeof _=="number")&&(m.type="number"),h.every(_=>typeof _=="string")&&(m.type="string"),m.enum=h;break}case"literal":{let m=p,h=[];for(let _ of o.values)if(_===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof _=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(_))}else h.push(_);if(h.length!==0)if(h.length===1){let _=h[0];m.type=_===null?"null":typeof _,this.target==="draft-4"||this.target==="openapi-3.0"?m.enum=[_]:m.const=_}else h.every(_=>typeof _=="number")&&(m.type="number"),h.every(_=>typeof _=="string")&&(m.type="string"),h.every(_=>typeof _=="boolean")&&(m.type="string"),h.every(_=>_===null)&&(m.type="null"),m.enum=h;break}case"file":{let m=p,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:_,maximum:v,mime:b}=e._zod.bag;_!==void 0&&(h.minLength=_),v!==void 0&&(h.maxLength=v),b?b.length===1?(h.contentMediaType=b[0],Object.assign(m,h)):m.anyOf=b.map(x=>({...h,contentMediaType:x})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,d);this.target==="openapi-3.0"?(a.ref=o.innerType,p.nullable=!0):p.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"success":{let m=p;m.type="boolean";break}case"default":{this.process(o.innerType,d),a.ref=o.innerType,p.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),a.ref=o.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),a.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}p.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=p,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,d),a.ref=m;break}case"readonly":{this.process(o.innerType,d),a.ref=o.innerType,p.readOnly=!0;break}case"promise":{this.process(o.innerType,d),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,d),a.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&xr(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let h=n.external.registry.get(l[0])?.id,_=n.external.uri??(b=>b);if(h)return{ref:_(h)};let v=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=v,{defId:v,ref:`${_("__shared")}#/${d}/${v}`}}if(l[1]===o)return{ref:"#"};let p=`#/${d}/`,m=l[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:p+m}},s=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:f,defId:p}=i(l);d.def={...d.schema},p&&(d.defId=p);let m=d.schema;for(let h in m)delete m[h];m.$ref=f};if(n.cycles==="throw")for(let l of this.seen.entries()){let d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/ + +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(e===l[0]){s(l);continue}if(n.external){let p=n.external.registry.get(l[0])?.id;if(e!==l[0]&&p){s(l);continue}}if(this.metadataRegistry.get(l[0])?.id){s(l);continue}if(d.cycle){s(l);continue}if(d.count>1&&n.reused==="ref"){s(l);continue}}let a=(l,d)=>{let f=this.seen.get(l),p=f.def??f.schema,m={...p};if(f.ref===null)return;let h=f.ref;if(f.ref=null,h){a(h,d);let _=this.seen.get(h).schema;_.$ref&&(d.target==="draft-7"||d.target==="draft-4"||d.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(_)):(Object.assign(p,_),Object.assign(p,m))}f.isParent||this.override({zodSchema:l,jsonSchema:p,path:f.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?c.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,o.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let d=l[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function vo(t,e){if(t instanceof Pu){let n=new zp(e),o={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let i={},s={registry:t,uri:e?.uri,defs:o};for(let a of t._idmap.entries()){let[c,u]=a;i[c]=n.emit(u,{...e,external:s})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}let r=new zp(e);return r.process(t),r.emit(t,e)}function xr(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return xr(n.element,r);if(n.type==="set")return xr(n.valueType,r);if(n.type==="lazy")return xr(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return xr(n.innerType,r);if(n.type==="intersection")return xr(n.left,r)||xr(n.right,r);if(n.type==="record"||n.type==="map")return xr(n.keyType,r)||xr(n.valueType,r);if(n.type==="pipe")return xr(n.in,r)||xr(n.out,r);if(n.type==="object"){for(let o in n.shape)if(xr(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(xr(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(xr(o,r))return!0;return!!(n.rest&&xr(n.rest,r))}return!1}var $z={};function nt(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_zod"in e))return!1;let r=e._zod;return typeof r=="object"&&r!==null&&"def"in r}function vt(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_def"in e)||"_zod"in e)return!1;let r=e._def;return typeof r=="object"&&r!=null&&"typeName"in r}function Iz(t){return nt(t)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),vt(t)}function on(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(nt(t)||vt(t))}function E$(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodLiteral"}function A$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="literal":!1}function Sz(t){return!!(E$(t)||A$(t))}async function Ey(t,e){if(nt(t))try{return{success:!0,data:await Yo(t,e)}}catch(r){return{success:!1,error:r}}if(vt(t))return await t.safeParseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function ts(t,e){if(nt(t))return await Yo(t,e);if(vt(t))return await t.parseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function kz(t,e){if(nt(t))try{return{success:!0,data:Bn(t,e)}}catch(r){return{success:!1,error:r}}if(vt(t))return t.safeParse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Tz(t,e){if(nt(t))return Bn(t,e);if(vt(t))return t.parse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function rs(t){if(nt(t))return Ge.get(t)?.description;if(vt(t)||"description"in t&&typeof t.description=="string")return t.description}function Ez(t){if(!on(t))return!1;if(vt(t)){let e=t._def;if(e.typeName==="ZodObject"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.typeName==="ZodRecord")return!0}if(nt(t)){let e=t._zod.def;if(e.type==="object"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.type==="record")return!0}return typeof t=="object"&&t!==null&&!("shape"in t)}function Wu(t){return on(t)?vt(t)?t._def.typeName==="ZodString":nt(t)?t._zod.def.type==="string":!1:!1}function Ay(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodObject"}function wn(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="object":!1}function Mp(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="array":!1}function O$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="optional":!1}function P$(t){return nt(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="nullable":!1}function Az(t){return!!(Ay(t)||wn(t))}function ky(t){if(vt(t))return t.shape;if(nt(t))return t._zod.def.shape;throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Oz(t,e){if(vt(t))return t.extend(e);if(nt(t))return M.extend(t,e);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Pz(t){if(vt(t))return t.partial();if(nt(t))return M.partial(xa,t,void 0);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Hu(t,e=!1){if(vt(t))return t.strict();if(wn(t)){let r=t._zod.def.shape;if(e)for(let[i,s]of Object.entries(t._zod.def.shape)){if(wn(s)){let c=Hu(s,e);r[i]=c}else if(Mp(s)){let c=s._zod.def.element;wn(c)&&(c=Hu(c,e)),r[i]=Qe(s,{...s._zod.def,element:c})}else r[i]=s;let a=Ge.get(s);a&&Ge.add(r[i],a)}let n=Qe(t,{...t._zod.def,shape:r,catchall:zu(Eu)}),o=Ge.get(t);return o&&Ge.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Ty(t,e=!1){if(Ay(t))return t.passthrough();if(wn(t)){let r=t._zod.def.shape;if(e)for(let[i,s]of Object.entries(t._zod.def.shape)){if(wn(s)){let c=Ty(s,e);r[i]=c}else if(Mp(s)){let c=s._zod.def.element;wn(c)&&(c=Ty(c,e)),r[i]=Qe(s,{...s._zod.def,element:c})}else r[i]=s;let a=Ge.get(s);a&&Ge.add(r[i],a)}let n=Qe(t,{...t._zod.def,shape:r,catchall:Nu(Tu)}),o=Ge.get(t);return o&&Ge.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Cz(t){if(vt(t))try{let e=t.parse(void 0);return()=>e}catch{return}if(nt(t))try{let e=Bn(t,void 0);return()=>e}catch{return}}function Z5(t){return vt(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function q5(t){return nt(t)&&t._zod.def.type==="pipe"}function Ta(t,e,r){let n=r.get(t);if(n!==void 0)return n;if(vt(t))return Z5(t)?Ta(t._def.schema,e,r):t;if(nt(t)){let o=t;if(q5(t)&&(o=Ta(t._zod.def.in,e,r)),e){if(wn(o)){let s=o._zod.def.shape;for(let[a,c]of Object.entries(o._zod.def.shape))s[a]=Ta(c,e,r);o=Qe(o,{...o._zod.def,shape:s})}else if(Mp(o)){let s=Ta(o._zod.def.element,e,r);o=Qe(o,{...o._zod.def,element:s})}else if(O$(o)){let s=Ta(o._zod.def.innerType,e,r);o=Qe(o,{...o._zod.def,innerType:s})}else if(P$(o)){let s=Ta(o._zod.def.innerType,e,r);o=Qe(o,{...o._zod.def,innerType:s})}}let i=Ge.get(t);return i&&Ge.add(o,i),r.set(t,o),o}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Oy(t,e=!1){return Ta(t,e,new WeakMap)}function Rz(t,e){if(vt(t)){let r=ky(t),n={};for(let[o,i]of Object.entries(r))e(o,i)?n[o]=i.optional():n[o]=i;return t.extend(n)}if(nt(t)){let r=ky(t),n={...t._zod.def.shape};for(let[s,a]of Object.entries(r))e(s,a)&&(n[s]=new xa({type:"optional",innerType:a}));let o=Qe(t,{...t._zod.def,shape:n}),i=Ge.get(t);return i&&Ge.add(o,i),o}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Py(t){return t instanceof Error&&(t.constructor.name==="ZodError"||t.constructor.name==="$ZodError")}function C$(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}var V5=["*","_","`"];function G5(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n}; +`;return e}function Nz(t,e,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:s=!0,curveStyle:a="linear",wrapLabelNWords:c=9}=r??{},u=s?`%%{init: {'flowchart': {'curve': '${a}'}}}%% +graph TD; +`:`graph TD; +`;if(s){let p="default",m={[p]:"{0}({1})"};n!==void 0&&(m[n]="{0}([{1}]):::first"),o!==void 0&&(m[o]="{0}([{1}]):::last");for(let[h,_]of Object.entries(t)){let v=_.name.split(":").pop()??"",x=V5.some(T=>v.startsWith(T)&&v.endsWith(T))?`

${v}

`:v;Object.keys(_.metadata??{}).length&&(x+=`
${Object.entries(_.metadata??{}).map(([T,F])=>`${T} = ${F}`).join(` +`)}`);let k=(m[h]??m[p]).replace("{0}",C$(h)).replace("{1}",x);u+=` ${k} +`}}let l={};for(let p of e){let m=p.source.split(":"),h=p.target.split(":"),_=m.filter((v,b)=>v===h[b]).join(":");l[_]||(l[_]=[]),l[_].push(p)}let d=new Set;function f(p,m){let h=p.length===1&&p[0].source===p[0].target;if(m&&!h){let _=m.split(":").pop();if(d.has(_))throw new Error(`Found duplicate subgraph '${_}' -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);d.add(_),u+=` subgraph ${_} +`}for(let _ of p){let{source:v,target:b,data:x,conditional:k}=_,T="";if(x!==void 0){let F=x,J=F.split(" ");J.length>c&&(F=Array.from({length:Math.ceil(J.length/c)},(w,Z)=>J.slice(Z*c,(Z+1)*c).join(" ")).join(" 
 ")),T=k?` -.  ${F}  .-> `:` --  ${F}  --> `}else T=k?" -.-> ":" --> ";u+=` ${C$(v)}${T}${C$(b)}; +`}for(let _ in l)_.startsWith(`${m}:`)&&_!==m&&f(l[_],_);m&&!h&&(u+=` end +`)}f(l[""]??[],"");for(let p in l)!p.includes(":")&&p!==""&&f(l[p],p);return s&&(u+=G5(i??{})),u}async function zz(t,e){let r=e?.backgroundColor??"white",n=e?.imageType??"png",o=HR(t);r!==void 0&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(r)||(r=`!${r}`));let i=`https://mermaid.ink/img/${o}?bgColor=${r}&type=${n}`,s=await fetch(i);if(!s.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${s.status}`,`Status text: ${s.statusText}`].join(` +`));return await s.blob()}var jz=Symbol("Let zodToJsonSchema decide on which parser to use"),Mz={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Dz=t=>typeof t=="string"?{...Mz,name:t}:{...Mz,...t};var Lz=t=>{let e=Dz(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};var Cy=(t,e)=>{let r=0;for(;ryG,DIRTY:()=>Ea,EMPTY_PATH:()=>J5,INVALID:()=>pe,NEVER:()=>tK,OK:()=>sr,ParseStatus:()=>Gt,Schema:()=>Ee,ZodAny:()=>is,ZodArray:()=>ni,ZodBigInt:()=>Oa,ZodBoolean:()=>Pa,ZodBranded:()=>Dp,ZodCatch:()=>Ba,ZodDate:()=>Ca,ZodDefault:()=>Fa,ZodDiscriminatedUnion:()=>zy,ZodEffects:()=>In,ZodEnum:()=>La,ZodError:()=>Mr,ZodFirstPartyTypeKind:()=>N,ZodFunction:()=>jy,ZodIntersection:()=>Ma,ZodIssueCode:()=>z,ZodLazy:()=>ja,ZodLiteral:()=>Da,ZodMap:()=>tl,ZodNaN:()=>nl,ZodNativeEnum:()=>Ua,ZodNever:()=>qn,ZodNull:()=>Na,ZodNullable:()=>xo,ZodNumber:()=>Aa,ZodObject:()=>jr,ZodOptional:()=>xn,ZodParsedType:()=>W,ZodPipeline:()=>Lp,ZodPromise:()=>ss,ZodReadonly:()=>Za,ZodRecord:()=>My,ZodSchema:()=>Ee,ZodSet:()=>rl,ZodString:()=>os,ZodSymbol:()=>Qu,ZodTransformer:()=>In,ZodTuple:()=>wo,ZodType:()=>Ee,ZodUndefined:()=>Ra,ZodUnion:()=>za,ZodUnknown:()=>ri,ZodVoid:()=>el,addIssueToContext:()=>B,any:()=>TG,array:()=>PG,bigint:()=>xG,boolean:()=>Jz,coerce:()=>eK,custom:()=>Kz,date:()=>$G,datetimeRegex:()=>Vz,defaultErrorMap:()=>ei,discriminatedUnion:()=>NG,effect:()=>GG,enum:()=>ZG,function:()=>UG,getErrorMap:()=>Ju,getParsedType:()=>bo,instanceof:()=>bG,intersection:()=>zG,isAborted:()=>Ry,isAsync:()=>Xu,isDirty:()=>Ny,isValid:()=>ns,late:()=>vG,lazy:()=>FG,literal:()=>BG,makeIssue:()=>jp,map:()=>DG,nan:()=>wG,nativeEnum:()=>qG,never:()=>AG,null:()=>kG,nullable:()=>HG,number:()=>Wz,object:()=>Xz,objectUtil:()=>N$,oboolean:()=>QG,onumber:()=>YG,optional:()=>KG,ostring:()=>XG,pipeline:()=>JG,preprocess:()=>WG,promise:()=>VG,quotelessJson:()=>K5,record:()=>jG,set:()=>LG,setErrorMap:()=>W5,strictObject:()=>CG,string:()=>Hz,symbol:()=>IG,transformer:()=>GG,tuple:()=>MG,undefined:()=>SG,union:()=>RG,unknown:()=>EG,util:()=>je,void:()=>OG});var je;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(je||(je={}));var N$;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(N$||(N$={}));var W=je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bo=t=>{switch(typeof t){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(t)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(t)?W.array:t===null?W.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?W.promise:typeof Map<"u"&&t instanceof Map?W.map:typeof Set<"u"&&t instanceof Set?W.set:typeof Date<"u"&&t instanceof Date?W.date:W.object;default:return W.unknown}};var z=je.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),K5=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Mr=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;cr.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Mr.create=t=>new Mr(t);var H5=(t,e)=>{let r;switch(t.code){case z.invalid_type:t.received===W.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,je.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${je.joinValues(t.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${je.joinValues(t.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${je.joinValues(t.options)}, received '${t.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:je.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case z.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case z.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=e.defaultError,je.assertNever(t)}return{message:r}},ei=H5;var Uz=ei;function W5(t){Uz=t}function Ju(){return Uz}var jp=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}},J5=[];function B(t,e){let r=Ju(),n=jp({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ei?void 0:ei].filter(o=>!!o)});t.common.issues.push(n)}var Gt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return pe;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return pe;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}},pe=Object.freeze({status:"aborted"}),Ea=t=>({status:"dirty",value:t}),sr=t=>({status:"valid",value:t}),Ry=t=>t.status==="aborted",Ny=t=>t.status==="dirty",ns=t=>t.status==="valid",Xu=t=>typeof Promise<"u"&&t instanceof Promise;var ne;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ne||(ne={}));var $n=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Fz=(t,e)=>{if(ns(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Mr(t.common.issues);return this._error=r,this._error}}};function Se(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var Ee=class{get description(){return this._def.description}_getType(e){return bo(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Gt,ctx:{common:e.parent.common,data:e.data,parsedType:bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Xu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Fz(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return ns(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>ns(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bo(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Xu(o)?o:Promise.resolve(o));return Fz(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:z.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new In({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return xn.create(this,this._def)}nullable(){return xo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ni.create(this)}promise(){return ss.create(this,this._def)}or(e){return za.create([this,e],this._def)}and(e){return Ma.create(this,e,this._def)}transform(e){return new In({...Se(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Fa({...Se(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new Dp({typeName:N.ZodBranded,type:this,...Se(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Ba({...Se(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Lp.create(this,e)}readonly(){return Za.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},X5=/^c[^\s-]{8,}$/i,Y5=/^[0-9a-z]+$/,Q5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,eG=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tG=/^[a-z0-9_-]{21}$/i,rG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,nG=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",z$,sG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,aG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,cG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,uG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zz="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",pG=new RegExp(`^${Zz}$`);function qz(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function fG(t){return new RegExp(`^${qz(t)}$`)}function Vz(t){let e=`${Zz}T${qz(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function mG(t,e){return!!((e==="v4"||!e)&&sG.test(t)||(e==="v6"||!e)&&cG.test(t))}function hG(t,e){if(!rG.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function gG(t,e){return!!((e==="v4"||!e)&&aG.test(t)||(e==="v6"||!e)&&uG.test(t))}var os=class t extends Ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.string,received:i.parsedType}),pe}let n=new Gt,o;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(o=this._getOrReturnCtx(e,o),B(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.lengthe.test(o),{validation:r,code:z.invalid_string,...ne.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ne.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ne.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ne.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ne.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ne.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ne.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ne.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ne.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ne.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ne.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ne.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ne.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ne.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ne.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ne.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ne.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ne.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ne.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ne.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ne.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ne.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ne.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ne.errToObj(r)})}nonempty(e){return this.min(1,ne.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew os({checks:[],typeName:N.ZodString,coerce:t?.coerce??!1,...Se(t)});function _G(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var Aa=class t extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==W.number){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.number,received:i.parsedType}),pe}let n,o=new Gt;for(let i of this._def.checks)i.kind==="int"?je.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?_G(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_finite,message:i.message}),o.dirty()):je.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ne.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ne.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ne.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ne.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ne.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ne.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ne.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ne.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ne.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ne.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&je.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew Aa({checks:[],typeName:N.ZodNumber,coerce:t?.coerce||!1,...Se(t)});var Oa=class t extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==W.bigint)return this._getInvalidInput(e);let n,o=new Gt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),B(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):je.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return B(r,{code:z.invalid_type,expected:W.bigint,received:r.parsedType}),pe}gte(e,r){return this.setLimit("min",e,!0,ne.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ne.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ne.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ne.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ne.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ne.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Oa({checks:[],typeName:N.ZodBigInt,coerce:t?.coerce??!1,...Se(t)});var Pa=class extends Ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.boolean,received:n.parsedType}),pe}return sr(e.data)}};Pa.create=t=>new Pa({typeName:N.ZodBoolean,coerce:t?.coerce||!1,...Se(t)});var Ca=class t extends Ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_type,expected:W.date,received:i.parsedType}),pe}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return B(i,{code:z.invalid_date}),pe}let n=new Gt,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(o=this._getOrReturnCtx(e,o),B(o,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):je.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ne.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ne.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ca({checks:[],coerce:t?.coerce||!1,typeName:N.ZodDate,...Se(t)});var Qu=class extends Ee{_parse(e){if(this._getType(e)!==W.symbol){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.symbol,received:n.parsedType}),pe}return sr(e.data)}};Qu.create=t=>new Qu({typeName:N.ZodSymbol,...Se(t)});var Ra=class extends Ee{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.undefined,received:n.parsedType}),pe}return sr(e.data)}};Ra.create=t=>new Ra({typeName:N.ZodUndefined,...Se(t)});var Na=class extends Ee{_parse(e){if(this._getType(e)!==W.null){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.null,received:n.parsedType}),pe}return sr(e.data)}};Na.create=t=>new Na({typeName:N.ZodNull,...Se(t)});var is=class extends Ee{constructor(){super(...arguments),this._any=!0}_parse(e){return sr(e.data)}};is.create=t=>new is({typeName:N.ZodAny,...Se(t)});var ri=class extends Ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return sr(e.data)}};ri.create=t=>new ri({typeName:N.ZodUnknown,...Se(t)});var qn=class extends Ee{_parse(e){let r=this._getOrReturnCtx(e);return B(r,{code:z.invalid_type,expected:W.never,received:r.parsedType}),pe}};qn.create=t=>new qn({typeName:N.ZodNever,...Se(t)});var el=class extends Ee{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.void,received:n.parsedType}),pe}return sr(e.data)}};el.create=t=>new el({typeName:N.ZodVoid,...Se(t)});var ni=class t extends Ee{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==W.array)return B(r,{code:z.invalid_type,expected:W.array,received:r.parsedType}),pe;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.lengtho.maxLength.value&&(B(r,{code:z.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new $n(r,s,r.path,a)))).then(s=>Gt.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new $n(r,s,r.path,a)));return Gt.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:ne.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:ne.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:ne.toString(r)}})}nonempty(e){return this.min(1,e)}};ni.create=(t,e)=>new ni({type:t,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...Se(e)});function Yu(t){if(t instanceof jr){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=xn.create(Yu(n))}return new jr({...t._def,shape:()=>e})}else return t instanceof ni?new ni({...t._def,type:Yu(t.element)}):t instanceof xn?xn.create(Yu(t.unwrap())):t instanceof xo?xo.create(Yu(t.unwrap())):t instanceof wo?wo.create(t.items.map(e=>Yu(e))):t}var jr=class t extends Ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=je.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==W.object){let u=this._getOrReturnCtx(e);return B(u,{code:z.invalid_type,expected:W.object,received:u.parsedType}),pe}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof qn&&this._def.unknownKeys==="strip"))for(let u in o.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new $n(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof qn){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(B(o,{code:z.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new $n(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Gt.mergeObjectSync(n,u)):Gt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return ne.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ne.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of je.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of je.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Yu(this)}partial(e){let r={};for(let n of je.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of je.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof xn;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Gz(je.objectKeys(this.shape))}};jr.create=(t,e)=>new jr({shape:()=>t,unknownKeys:"strip",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});jr.strictCreate=(t,e)=>new jr({shape:()=>t,unknownKeys:"strict",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});jr.lazycreate=(t,e)=>new jr({shape:t,unknownKeys:"strip",catchall:qn.create(),typeName:N.ZodObject,...Se(e)});var za=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new Mr(a.ctx.common.issues));return B(r,{code:z.invalid_union,unionErrors:s}),pe}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new Mr(c));return B(r,{code:z.invalid_union,unionErrors:a}),pe}}get options(){return this._def.options}};za.create=(t,e)=>new za({options:t,typeName:N.ZodUnion,...Se(e)});var ti=t=>t instanceof ja?ti(t.schema):t instanceof In?ti(t.innerType()):t instanceof Da?[t.value]:t instanceof La?t.options:t instanceof Ua?je.objectValues(t.enum):t instanceof Fa?ti(t._def.innerType):t instanceof Ra?[void 0]:t instanceof Na?[null]:t instanceof xn?[void 0,...ti(t.unwrap())]:t instanceof xo?[null,...ti(t.unwrap())]:t instanceof Dp||t instanceof Za?ti(t.unwrap()):t instanceof Ba?ti(t._def.innerType):[],zy=class t extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.object)return B(r,{code:z.invalid_type,expected:W.object,received:r.parsedType}),pe;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(B(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=ti(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Se(n)})}};function M$(t,e){let r=bo(t),n=bo(e);if(t===e)return{valid:!0,data:t};if(r===W.object&&n===W.object){let o=je.objectKeys(e),i=je.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let c=M$(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===W.array&&n===W.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i{if(Ry(i)||Ry(s))return pe;let a=M$(i.value,s.value);return a.valid?((Ny(i)||Ny(s))&&r.dirty(),{status:r.value,value:a.data}):(B(n,{code:z.invalid_intersection_types}),pe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ma.create=(t,e,r)=>new Ma({left:t,right:e,typeName:N.ZodIntersection,...Se(r)});var wo=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.array)return B(n,{code:z.invalid_type,expected:W.array,received:n.parsedType}),pe;if(n.data.lengththis._def.items.length&&(B(n,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new $n(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>Gt.mergeArray(r,s)):Gt.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};wo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wo({items:t,typeName:N.ZodTuple,rest:null,...Se(e)})};var My=class t extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.object)return B(n,{code:z.invalid_type,expected:W.object,received:n.parsedType}),pe;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new $n(n,a,n.path,a)),value:s._parse(new $n(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Gt.mergeObjectAsync(r,o):Gt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ee?new t({keyType:e,valueType:r,typeName:N.ZodRecord,...Se(n)}):new t({keyType:os.create(),valueType:e,typeName:N.ZodRecord,...Se(r)})}},tl=class extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.map)return B(n,{code:z.invalid_type,expected:W.map,received:n.parsedType}),pe;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new $n(n,a,n.path,[u,"key"])),value:i._parse(new $n(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return pe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return pe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};tl.create=(t,e,r)=>new tl({valueType:e,keyType:t,typeName:N.ZodMap,...Se(r)});var rl=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.set)return B(n,{code:z.invalid_type,expected:W.set,received:n.parsedType}),pe;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&(B(n,{code:z.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return pe;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>i._parse(new $n(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:ne.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:ne.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};rl.create=(t,e)=>new rl({valueType:t,minSize:null,maxSize:null,typeName:N.ZodSet,...Se(e)});var jy=class t extends Ee{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.function)return B(r,{code:z.invalid_type,expected:W.function,received:r.parsedType}),pe;function n(a,c){return jp({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ju(),ei].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function o(a,c){return jp({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ju(),ei].filter(u=>!!u),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof ss){let a=this;return sr(async function(...c){let u=new Mr([]),l=await a._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(o(d,p)),u})})}else{let a=this;return sr(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new Mr([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new Mr([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:wo.create(e).rest(ri.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||wo.create([]).rest(ri.create()),returns:r||ri.create(),typeName:N.ZodFunction,...Se(n)})}},ja=class extends Ee{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ja.create=(t,e)=>new ja({getter:t,typeName:N.ZodLazy,...Se(e)});var Da=class extends Ee{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return B(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}};Da.create=(t,e)=>new Da({value:t,typeName:N.ZodLiteral,...Se(e)});function Gz(t,e){return new La({values:t,typeName:N.ZodEnum,...Se(e)})}var La=class t extends Ee{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{expected:je.joinValues(n),received:r.parsedType,code:z.invalid_type}),pe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{received:r.data,code:z.invalid_enum_value,options:n}),pe}return sr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};La.create=Gz;var Ua=class extends Ee{_parse(e){let r=je.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==W.string&&n.parsedType!==W.number){let o=je.objectValues(r);return B(n,{expected:je.joinValues(o),received:n.parsedType,code:z.invalid_type}),pe}if(this._cache||(this._cache=new Set(je.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=je.objectValues(r);return B(n,{received:n.data,code:z.invalid_enum_value,options:o}),pe}return sr(e.data)}get enum(){return this._def.values}};Ua.create=(t,e)=>new Ua({values:t,typeName:N.ZodNativeEnum,...Se(e)});var ss=class extends Ee{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.promise&&r.common.async===!1)return B(r,{code:z.invalid_type,expected:W.promise,received:r.parsedType}),pe;let n=r.parsedType===W.promise?r.data:Promise.resolve(r.data);return sr(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ss.create=(t,e)=>new ss({type:t,typeName:N.ZodPromise,...Se(e)});var In=class extends Ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{B(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return pe;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?pe:c.status==="dirty"?Ea(c.value):r.value==="dirty"?Ea(c.value):c});{if(r.value==="aborted")return pe;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?pe:a.status==="dirty"?Ea(a.value):r.value==="dirty"?Ea(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?pe:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?pe:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ns(s))return pe;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>ns(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):pe);je.assertNever(o)}};In.create=(t,e,r)=>new In({schema:t,typeName:N.ZodEffects,effect:e,...Se(r)});In.createWithPreprocess=(t,e,r)=>new In({schema:e,effect:{type:"preprocess",transform:t},typeName:N.ZodEffects,...Se(r)});var xn=class extends Ee{_parse(e){return this._getType(e)===W.undefined?sr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xn.create=(t,e)=>new xn({innerType:t,typeName:N.ZodOptional,...Se(e)});var xo=class extends Ee{_parse(e){return this._getType(e)===W.null?sr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xo.create=(t,e)=>new xo({innerType:t,typeName:N.ZodNullable,...Se(e)});var Fa=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===W.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Fa.create=(t,e)=>new Fa({innerType:t,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Se(e)});var Ba=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Xu(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Se(e)});var nl=class extends Ee{_parse(e){if(this._getType(e)!==W.nan){let n=this._getOrReturnCtx(e);return B(n,{code:z.invalid_type,expected:W.nan,received:n.parsedType}),pe}return{status:"valid",value:e.data}}};nl.create=t=>new nl({typeName:N.ZodNaN,...Se(t)});var yG=Symbol("zod_brand"),Dp=class extends Ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Lp=class t extends Ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?pe:i.status==="dirty"?(r.dirty(),Ea(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?pe:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:N.ZodPipeline})}},Za=class extends Ee{_parse(e){let r=this._def.innerType._parse(e),n=o=>(ns(o)&&(o.value=Object.freeze(o.value)),o);return Xu(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Za.create=(t,e)=>new Za({innerType:t,typeName:N.ZodReadonly,...Se(e)});function Bz(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Kz(t,e={},r){return t?is.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=Bz(e,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!i){let s=Bz(e,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):is.create()}var vG={object:jr.lazycreate},N;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(N||(N={}));var bG=(t,e={message:`Input not instance of ${t.name}`})=>Kz(r=>r instanceof t,e),Hz=os.create,Wz=Aa.create,wG=nl.create,xG=Oa.create,Jz=Pa.create,$G=Ca.create,IG=Qu.create,SG=Ra.create,kG=Na.create,TG=is.create,EG=ri.create,AG=qn.create,OG=el.create,PG=ni.create,Xz=jr.create,CG=jr.strictCreate,RG=za.create,NG=zy.create,zG=Ma.create,MG=wo.create,jG=My.create,DG=tl.create,LG=rl.create,UG=jy.create,FG=ja.create,BG=Da.create,ZG=La.create,qG=Ua.create,VG=ss.create,GG=In.create,KG=xn.create,HG=xo.create,WG=In.createWithPreprocess,JG=Lp.create,XG=()=>Hz().optional(),YG=()=>Wz().optional(),QG=()=>Jz().optional(),eK={string:(t=>os.create({...t,coerce:!0})),number:(t=>Aa.create({...t,coerce:!0})),boolean:(t=>Pa.create({...t,coerce:!0})),bigint:(t=>Oa.create({...t,coerce:!0})),date:(t=>Ca.create({...t,coerce:!0}))};var tK=pe;function Yz(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==N.ZodAny&&(r.items=he(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&De(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&De(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(De(r,"minItems",t.exactLength.value,t.exactLength.message,e),De(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Qz(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?De(r,"minimum",n.value,n.message,e):De(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),De(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?De(r,"maximum",n.value,n.message,e):De(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),De(r,"maximum",n.value,n.message,e));break;case"multipleOf":De(r,"multipleOf",n.value,n.message,e);break}return r}function e1(){return{type:"boolean"}}function Dy(t,e){return he(t.type._def,e)}var t1=(t,e)=>he(t.innerType._def,e);function j$(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map(o=>j$(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return nK(t,e)}}var nK=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":De(r,"minimum",n.value,n.message,e);break;case"max":De(r,"maximum",n.value,n.message,e);break}return r};function r1(t,e){return{...he(t.innerType._def,e),default:t.defaultValue()}}function n1(t,e){return e.effectStrategy==="input"?he(t.schema._def,e):pt(e)}function o1(t){return{type:"string",enum:Array.from(t.values)}}var oK=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function i1(t,e){let r=[he(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),he(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(oK(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...c}=i;s=c}else n=void 0;o.push(s)}}),o.length?{allOf:o,...n}:void 0}function s1(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var D$,Vn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(D$===void 0&&(D$=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),D$),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Ly(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":De(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":De(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Gn(r,"email",n.message,e);break;case"format:idn-email":Gn(r,"idn-email",n.message,e);break;case"pattern:zod":Ir(r,Vn.email,n.message,e);break}break;case"url":Gn(r,"uri",n.message,e);break;case"uuid":Gn(r,"uuid",n.message,e);break;case"regex":Ir(r,n.regex,n.message,e);break;case"cuid":Ir(r,Vn.cuid,n.message,e);break;case"cuid2":Ir(r,Vn.cuid2,n.message,e);break;case"startsWith":Ir(r,RegExp(`^${L$(n.value,e)}`),n.message,e);break;case"endsWith":Ir(r,RegExp(`${L$(n.value,e)}$`),n.message,e);break;case"datetime":Gn(r,"date-time",n.message,e);break;case"date":Gn(r,"date",n.message,e);break;case"time":Gn(r,"time",n.message,e);break;case"duration":Gn(r,"duration",n.message,e);break;case"length":De(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),De(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":Ir(r,RegExp(L$(n.value,e)),n.message,e);break;case"ip":n.version!=="v6"&&Gn(r,"ipv4",n.message,e),n.version!=="v4"&&Gn(r,"ipv6",n.message,e);break;case"base64url":Ir(r,Vn.base64url,n.message,e);break;case"jwt":Ir(r,Vn.jwt,n.message,e);break;case"cidr":n.version!=="v6"&&Ir(r,Vn.ipv4Cidr,n.message,e),n.version!=="v4"&&Ir(r,Vn.ipv6Cidr,n.message,e);break;case"emoji":Ir(r,Vn.emoji(),n.message,e);break;case"ulid":Ir(r,Vn.ulid,n.message,e);break;case"base64":switch(e.base64Strategy){case"format:binary":Gn(r,"binary",n.message,e);break;case"contentEncoding:base64":De(r,"contentEncoding","base64",n.message,e);break;case"pattern:zod":Ir(r,Vn.base64,n.message,e);break}break;case"nanoid":Ir(r,Vn.nanoid,n.message,e);break;case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function L$(t,e){return e.patternStrategy==="escape"?sK(t):t}var iK=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function sK(t){let e="";for(let r=0;ro.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):De(t,"format",e,r,n)}function Ir(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:a1(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):De(t,"pattern",a1(e,n),r,n)}function a1(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",i=!1,s=!1,a=!1;for(let c=0;c({...n,[o]:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??pt(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===N.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=Ly(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===N.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===N.ZodBranded&&t.keyType._def.type._def.typeName===N.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=Dy(t.keyType._def,e);return{...r,propertyNames:o}}}return r}function c1(t,e){if(e.mapStrategy==="record")return Uy(t,e);let r=he(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||pt(e),n=he(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||pt(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function u1(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function l1(t){return t.target==="openAi"?void 0:{not:pt({...t,currentPath:[...t.currentPath,"not"]})}}function d1(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Up={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function f1(t,e){if(e.target==="openApi3")return p1(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Up&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let s=Up[i._def.typeName];return s&&!o.includes(s)?[...o,s]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,i)=>{let s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];case"bigint":return[...o,"integer"];case"object":return i._def.value===null?[...o,"null"]:o;case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((i,s,a)=>a.indexOf(i)===s);return{type:o.length>1?o:o[0],enum:r.reduce((i,s)=>i.includes(s._def.value)?i:[...i,s._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return p1(t,e)}var p1=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>he(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function m1(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Up[t.innerType._def.typeName],nullable:!0}:{type:[Up[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=he(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function h1(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",R$(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?De(r,"minimum",n.value,n.message,e):De(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),De(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?De(r,"maximum",n.value,n.message,e):De(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),De(r,"maximum",n.value,n.message,e));break;case"multipleOf":De(r,"multipleOf",n.value,n.message,e);break}return r}function g1(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},o=[],i=t.shape();for(let a in i){let c=i[a];if(c===void 0||c._def===void 0)continue;let u=cK(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=he(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||o.push(a))}o.length&&(n.required=o);let s=aK(t,e);return s!==void 0&&(n.additionalProperties=s),n}function aK(t,e){if(t.catchall._def.typeName!=="ZodNever")return he(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function cK(t){try{return t.isOptional()}catch{return!0}}var _1=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return he(t.innerType._def,e);let r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:pt(e)},r]}:pt(e)};var y1=(t,e)=>{if(e.pipeStrategy==="input")return he(t.in._def,e);if(e.pipeStrategy==="output")return he(t.out._def,e);let r=he(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=he(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function v1(t,e){return he(t.type._def,e)}function b1(t,e){let n={type:"array",uniqueItems:!0,items:he(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&De(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&De(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function w1(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>he(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:he(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>he(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function x1(t){return{not:pt(t)}}function $1(t){return pt(t)}var I1=(t,e)=>he(t.innerType._def,e);var S1=(t,e,r)=>{switch(e){case N.ZodString:return Ly(t,r);case N.ZodNumber:return h1(t,r);case N.ZodObject:return g1(t,r);case N.ZodBigInt:return Qz(t,r);case N.ZodBoolean:return e1();case N.ZodDate:return j$(t,r);case N.ZodUndefined:return x1(r);case N.ZodNull:return d1(r);case N.ZodArray:return Yz(t,r);case N.ZodUnion:case N.ZodDiscriminatedUnion:return f1(t,r);case N.ZodIntersection:return i1(t,r);case N.ZodTuple:return w1(t,r);case N.ZodRecord:return Uy(t,r);case N.ZodLiteral:return s1(t,r);case N.ZodEnum:return o1(t);case N.ZodNativeEnum:return u1(t);case N.ZodNullable:return m1(t,r);case N.ZodOptional:return _1(t,r);case N.ZodMap:return c1(t,r);case N.ZodSet:return b1(t,r);case N.ZodLazy:return()=>t.getter()._def;case N.ZodPromise:return v1(t,r);case N.ZodNaN:case N.ZodNever:return l1(r);case N.ZodEffects:return n1(t,r);case N.ZodAny:return pt(r);case N.ZodUnknown:return $1(r);case N.ZodDefault:return r1(t,r);case N.ZodBranded:return Dy(t,r);case N.ZodReadonly:return I1(t,r);case N.ZodCatch:return t1(t,r);case N.ZodPipeline:return y1(t,r);case N.ZodFunction:case N.ZodVoid:case N.ZodSymbol:return;default:return(n=>{})(e)}};function he(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==jz)return a}if(n&&!r){let a=uK(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=S1(t,t.typeName,e),s=typeof i=="function"?he(i(),e):i;if(s&&lK(t,e,s),e.postProcess){let a=e.postProcess(s,t,e);return o.jsonSchema=s,a}return o.jsonSchema=s,s}var uK=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Cy(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),pt(e)):e.$refStrategy==="seen"?pt(e):void 0}},lK=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var k1=(t,e)=>{let r=Lz(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:he(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??pt(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=he(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??pt(r),s=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;s!==void 0&&(i.title=s),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=o===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function $o(t,e){let r=typeof t;if(r!==typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let n=t.length;if(n!==e.length)return!1;for(let o=0;o1?e[s.href]=t:(s.hash="",n===""?r=s:Kn(t,e,r))}}else if(t!==!0&&t!==!1)return e;let o=r.href+(n?"#"+n:"");if(e[o]!==void 0)throw new Error(`Duplicate schema URI "${o}".`);if(e[o]=t,t===!0||t===!1)return e;if(t.__absolute_uri__===void 0&&Object.defineProperty(t,"__absolute_uri__",{enumerable:!1,value:o}),t.$ref&&t.__absolute_ref__===void 0){let i=new URL(t.$ref,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_ref__",{enumerable:!1,value:i.href})}if(t.$recursiveRef&&t.__absolute_recursive_ref__===void 0){let i=new URL(t.$recursiveRef,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(t.$anchor){let i=new URL("#"+t.$anchor,r.href);e[i.href]=t}for(let i in t){if(mK[i])continue;let s=`${n}/${sn(i)}`,a=t[i];if(Array.isArray(a)){if(pK[i]){let c=a.length;for(let u=0;u%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,xK=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,$K=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,IK=/^(?:\/(?:[^~/]|~0|~1)*)*$/,SK=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,kK=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,TK=t=>{if(t[0]==='"')return!1;let[e,r,...n]=t.split("@");return!e||!r||n.length!==0||e.length>64||r.length>253||e[0]==="."||e.endsWith(".")||e.includes("..")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(e)?!1:r.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},EK=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,AK=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,OK=t=>t.length>1&&t.length<80&&(/^P\d+([.,]\d+)?W$/.test(t)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(t)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(t));function Io(t){return t.test.bind(t)}var U$={date:T1,time:E1.bind(void 0,!1),"date-time":RK,duration:OK,uri:MK,"uri-reference":Io(bK),"uri-template":Io(wK),url:Io(xK),email:TK,hostname:Io(vK),ipv4:Io(EK),ipv6:Io(AK),regex:DK,uuid:Io($K),"json-pointer":Io(IK),"json-pointer-uri-fragment":Io(SK),"relative-json-pointer":Io(kK)};function PK(t){return t%4===0&&(t%100!==0||t%400===0)}function T1(t){let e=t.match(gK);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&PK(r)?29:_K[n])}function E1(t,e){let r=e.match(yK);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3],s=!!r[5];return(n<=23&&o<=59&&i<=59||n==23&&o==59&&i==60)&&(!t||s)}var CK=/t|\s/i;function RK(t){let e=t.split(CK);return e.length==2&&T1(e[0])&&E1(!0,e[1])}var NK=/\/|:/,zK=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function MK(t){return NK.test(t)&&zK.test(t)}var jK=/[^\\]\\Z/;function DK(t){if(jK.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var A1;(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(A1||(A1={}));function O1(t){let e=0,r=t.length,n=0,o;for(;n=55296&&o<=56319&&n$o(t,ge))||H.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`}):_.some(ge=>t===ge)||H.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`})),b!==void 0){let ge=`${a}/not`;ot(t,b,r,n,o,i,s,ge).valid&&H.push({instanceLocation:s,keyword:"not",keywordLocation:ge,error:'Instance matched "not" schema.'})}let Ts=[];if(x!==void 0){let ge=`${a}/anyOf`,le=H.length,xe=!1;for(let ee=0;ee{let ve=Object.create(c),_e=ot(t,ee,r,n,o,p===!0?i:null,s,`${ge}/${q}`,ve);return H.push(..._e.errors),_e.valid&&Ts.push(ve),_e.valid}).length;xe===1?H.length=le:H.splice(le,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:ge,error:`Instance does not match exactly one subschema (${xe} matches).`})}if((l==="object"||l==="array")&&Object.assign(c,...Ts),F!==void 0){let ge=`${a}/if`;if(ot(t,F,r,n,o,i,s,ge,c).valid){if(J!==void 0){let xe=ot(t,J,r,n,o,i,s,`${a}/then`,c);xe.valid||H.push({instanceLocation:s,keyword:"if",keywordLocation:ge,error:'Instance does not match "then" schema.'},...xe.errors)}}else if(w!==void 0){let xe=ot(t,w,r,n,o,i,s,`${a}/else`,c);xe.valid||H.push({instanceLocation:s,keyword:"if",keywordLocation:ge,error:'Instance does not match "else" schema.'},...xe.errors)}}if(l==="object"){if(v!==void 0)for(let ee of v)ee in t||H.push({instanceLocation:s,keyword:"required",keywordLocation:`${a}/required`,error:`Instance does not have required property "${ee}".`});let ge=Object.keys(t);if(pn!==void 0&&ge.lengthNo&&H.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${No} properties.`}),qe!==void 0){let ee=`${a}/propertyNames`;for(let q in t){let ve=`${s}/${sn(q)}`,_e=ot(q,qe,r,n,o,i,ve,ee);_e.valid||H.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:ee,error:`Property name "${q}" does not match schema.`},..._e.errors)}}if(Ul!==void 0){let ee=`${a}/dependantRequired`;for(let q in Ul)if(q in t){let ve=Ul[q];for(let _e of ve)_e in t||H.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:ee,error:`Instance has "${q}" but does not have "${_e}".`})}}if(Ss!==void 0)for(let ee in Ss){let q=`${a}/dependentSchemas`;if(ee in t){let ve=ot(t,Ss[ee],r,n,o,i,s,`${q}/${sn(ee)}`,c);ve.valid||H.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:q,error:`Instance has "${ee}" but does not match dependant schema.`},...ve.errors)}}if(ks!==void 0){let ee=`${a}/dependencies`;for(let q in ks)if(q in t){let ve=ks[q];if(Array.isArray(ve))for(let _e of ve)_e in t||H.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ee,error:`Instance has "${q}" but does not have "${_e}".`});else{let _e=ot(t,ve,r,n,o,i,s,`${ee}/${sn(q)}`);_e.valid||H.push({instanceLocation:s,keyword:"dependencies",keywordLocation:ee,error:`Instance has "${q}" but does not match dependant schema.`},..._e.errors)}}}let le=Object.create(null),xe=!1;if(oe!==void 0){let ee=`${a}/properties`;for(let q in oe){if(!(q in t))continue;let ve=`${s}/${sn(q)}`,_e=ot(t[q],oe[q],r,n,o,i,ve,`${ee}/${sn(q)}`);if(_e.valid)c[q]=le[q]=!0;else if(xe=o,H.push({instanceLocation:s,keyword:"properties",keywordLocation:ee,error:`Property "${q}" does not match schema.`},..._e.errors),xe)break}}if(!xe&&Q!==void 0){let ee=`${a}/patternProperties`;for(let q in Q){let ve=new RegExp(q,"u"),_e=Q[q];for(let Er in t){if(!ve.test(Er))continue;let ET=`${s}/${sn(Er)}`,AT=ot(t[Er],_e,r,n,o,i,ET,`${ee}/${sn(q)}`);AT.valid?c[Er]=le[Er]=!0:(xe=o,H.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:ee,error:`Property "${Er}" matches pattern "${q}" but does not match associated schema.`},...AT.errors))}}}if(!xe&&wt!==void 0){let ee=`${a}/additionalProperties`;for(let q in t){if(le[q])continue;let ve=`${s}/${sn(q)}`,_e=ot(t[q],wt,r,n,o,i,ve,ee);_e.valid?c[q]=!0:(xe=o,H.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:ee,error:`Property "${q}" does not match additional properties schema.`},..._e.errors))}}else if(!xe&&dn!==void 0){let ee=`${a}/unevaluatedProperties`;for(let q in t)if(!c[q]){let ve=`${s}/${sn(q)}`,_e=ot(t[q],dn,r,n,o,i,ve,ee);_e.valid?c[q]=!0:H.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:ee,error:`Property "${q}" does not match unevaluated properties schema.`},..._e.errors)}}}else if(l==="array"){R!==void 0&&t.length>R&&H.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${t.length} > ${R}).`}),g!==void 0&&t.length=(Cn||0)&&(H.length=q),Cn===void 0&&y===void 0&&ve===0?H.splice(q,0,{instanceLocation:s,keyword:"contains",keywordLocation:ee,error:"Array does not contain item matching schema."}):Cn!==void 0&&vey&&H.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${y} items matching schema. ${ve} items were found.`})}if(!xe&&Bl!==void 0){let ee=`${a}/unevaluatedItems`;for(le;le=Ye||t>Ye)&&H.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${Tt?"or equal to ":""} ${Ye}.`})):(ze!==void 0&&tYe&&H.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${Ye}.`}),it!==void 0&&t<=it&&H.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${a}/exclusiveMinimum`,error:`${t} is less than ${it}.`}),Tt!==void 0&&t>=Tt&&H.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${a}/exclusiveMaximum`,error:`${t} is greater than or equal to ${Tt}.`})),Bt!==void 0){let ge=t%Bt;Math.abs(0-ge)>=11920929e-14&&Math.abs(Bt-ge)>=11920929e-14&&H.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${a}/multipleOf`,error:`${t} is not a multiple of ${Bt}.`})}}else if(l==="string"){let ge=Rn===void 0&&ht===void 0?0:O1(t);Rn!==void 0&&geht&&H.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${a}/maxLength`,error:`String is too long (${ge} > ${ht}).`}),fn!==void 0&&!new RegExp(fn,"u").test(t)&&H.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${a}/pattern`,error:"String does not match pattern."}),Z!==void 0&&U$[Z]&&!U$[Z](t)&&H.push({instanceLocation:s,keyword:"format",keywordLocation:`${a}/format`,error:`String does not match format "${Z}".`})}return{valid:H.length===0,errors:H}}var Fy=class{schema;draft;shortCircuit;lookup;constructor(e,r="2019-09",n=!0){this.schema=e,this.draft=r,this.shortCircuit=n,this.lookup=Kn(e)}validate(e){return ot(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,r){r&&(e={...e,$id:r}),Kn(e,this.lookup)}};var LK={};G(LK,{Validator:()=>Fy,deepCompareStrict:()=>$o,toJsonSchema:()=>an,validatesOnlyStrings:()=>ol});function an(t){if(nt(t)){let e=Oy(t,!0);if(wn(e)){let r=Hu(e,!0);return vo(r)}else return vo(t)}return vt(t)?k1(t):t}function ol(t){if(!t||typeof t!="object"||Object.keys(t).length===0||Array.isArray(t))return!1;if("type"in t)return typeof t.type=="string"?t.type==="string":Array.isArray(t.type)?t.type.every(e=>e==="string"):!1;if("enum"in t)return Array.isArray(t.enum)&&t.enum.length>0&&t.enum.every(e=>typeof e=="string");if("const"in t)return typeof t.const=="string";if("allOf"in t&&Array.isArray(t.allOf))return t.allOf.some(e=>ol(e));if("anyOf"in t&&Array.isArray(t.anyOf)||"oneOf"in t&&Array.isArray(t.oneOf)){let e="anyOf"in t?t.anyOf:t.oneOf;return e.length>0&&e.every(r=>ol(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=Kn(t);return r[e]?ol(r[e]):!1}return!1}var UK={};G(UK,{Graph:()=>By});function FK(t,e){if(t!==void 0&&!Ui(t))return t;if(Hd(e))try{let r=e.getName();return r=r.startsWith("Runnable")?r.slice(8):r,r}catch{return e.getName()}else return e.name??"UnknownSchema"}function BK(t){return Hd(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...an(t.data.schema),title:t.data.name}}}var By=class R1{nodes={};edges=[];constructor(e){this.nodes=e?.nodes??this.nodes,this.edges=e?.edges??this.edges}toJSON(){let e={};return Object.values(this.nodes).forEach((r,n)=>{e[r.id]=Ui(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...BK(r)})),edges:this.edges.map(r=>{let n={source:e[r.source],target:e[r.target]};return typeof r.data<"u"&&(n.data=r.data),typeof r.conditional<"u"&&(n.conditional=r.conditional),n})}}addNode(e,r,n){if(r!==void 0&&this.nodes[r]!==void 0)throw new Error(`Node with id ${r} already exists`);let o=r??Et(),i={id:o,data:e,name:FK(r,e),metadata:n};return this.nodes[o]=i,i}removeNode(e){delete this.nodes[e.id],this.edges=this.edges.filter(r=>r.source!==e.id&&r.target!==e.id)}addEdge(e,r,n,o){if(this.nodes[e.id]===void 0)throw new Error(`Source node ${e.id} not in graph`);if(this.nodes[r.id]===void 0)throw new Error(`Target node ${r.id} not in graph`);let i={source:e.id,target:r.id,data:n,conditional:o};return this.edges.push(i),i}firstNode(){return P1(this)}lastNode(){return C1(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(u=>u.id).every(Ui)&&(n="");let i=u=>n?`${n}:${u}`:u;Object.entries(e.nodes).forEach(([u,l])=>{this.nodes[i(u)]={...l,id:i(u)}});let s=e.edges.map(u=>({...u,source:i(u.source),target:i(u.target)}));this.edges=[...this.edges,...s];let a=e.firstNode(),c=e.lastNode();return[a?{id:i(a.id),data:a.data}:void 0,c?{id:i(c.id),data:c.data}:void 0]}trimFirstNode(){let e=this.firstNode();e&&P1(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&C1(this,[e.id])&&this.removeNode(e)}reid(){let e=Object.fromEntries(Object.values(this.nodes).map(o=>[o.id,o.name])),r=new Map;Object.values(e).forEach(o=>{r.set(o,(r.get(o)||0)+1)});let n=o=>{let i=e[o];return Ui(o)&&r.get(i)===1?i:o};return new R1({nodes:Object.fromEntries(Object.entries(this.nodes).map(([o,i])=>[n(o),{...i,id:n(o)}])),edges:this.edges.map(o=>({...o,source:n(o.source),target:n(o.target)}))})}drawMermaid(e){let{withStyles:r,curveStyle:n,nodeColors:o={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=e??{},s=this.reid(),a=s.firstNode(),c=s.lastNode();return Nz(s.nodes,s.edges,{firstNode:a?.id,lastNode:c?.id,withStyles:r,curveStyle:n,nodeColors:o,wrapLabelNWords:i})}async drawMermaidPng(e){let r=this.drawMermaid(e);return zz(r,{backgroundColor:e?.backgroundColor})}};function P1(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.source)).map(o=>o.target)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function C1(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.target)).map(o=>o.source)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function N1(t){let e=new TextEncoder,r=new ReadableStream({async start(n){for await(let o of t)n.enqueue(e.encode(`event: data +data: ${JSON.stringify(o)} + +`));n.enqueue(e.encode(`event: end + +`)),n.close()}});return br.fromReadableStream(r)}function F$(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}var z1=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function";function Zy(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*B$(t,e){for(;;){let{value:r,done:n}=Lt.runWithConfig(vr(t),e.next.bind(e),!0);if(n)break;yield r}}async function*qy(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Lt.runWithConfig(vr(t),r.next.bind(e),!0);if(o)break;yield n}}function Ot(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}var Ze=class extends uo{lc_runnable=!0;name;getName(t){let e=this.name??this.constructor.lc_name()??this.constructor.name;return t?`${e}${t}`:e}withRetry(t){return new Gy({bound:this,kwargs:{},config:{},maxAttemptNumber:t?.stopAfterAttempt,...t})}withConfig(t){return new as({bound:this,config:t,kwargs:{}})}withFallbacks(t){let e=Array.isArray(t)?t:t.fallbacks;return new Z$({runnable:this,fallbacks:e})}_getOptionsList(t,e=0){if(Array.isArray(t)&&t.length!==e)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${t.length} options for ${e} inputs`);if(Array.isArray(t))return t.map(Pe);if(e>1&&!Array.isArray(t)&&t.runId){console.warn("Provided runId will be used only for the first element of the batch.");let r=Object.fromEntries(Object.entries(t).filter(([n])=>n!=="runId"));return Array.from({length:e},(n,o)=>Pe(o===0?t:r))}return Array.from({length:e},()=>Pe(t))}async batch(t,e,r){let n=this._getOptionsList(e??{},t.length),o=n[0]?.maxConcurrency??r?.maxConcurrency,i=new Xo({maxConcurrency:o,onFailedAttempt:a=>{throw a}}),s=t.map((a,c)=>i.call(async()=>{try{return await this.invoke(a,n[c])}catch(u){if(r?.returnExceptions)return u;throw u}}));return Promise.all(s)}async*_streamIterator(t,e){yield this.invoke(t,e)}async stream(t,e){let r=Pe(e),n=new Zi({generator:this._streamIterator(t,r),config:r});return await n.setup,br.fromAsyncGenerator(n)}_separateRunnableConfigFromCallOptions(t){let e;t===void 0?e=Pe(t):e=Pe({callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,runName:t.runName,configurable:t.configurable,recursionLimit:t.recursionLimit,maxConcurrency:t.maxConcurrency,runId:t.runId,timeout:t.timeout,signal:t.signal});let r={...t};return delete r.callbacks,delete r.tags,delete r.metadata,delete r.runName,delete r.configurable,delete r.recursionLimit,delete r.maxConcurrency,delete r.runId,delete r.timeout,delete r.signal,[e,r]}async _callWithConfig(t,e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),Ot(e,"input"),n.runId,n?.runType,void 0,void 0,n?.runName??this.getName());delete n.runId;let s;try{let a=t.call(this,e,n,i);s=await vn(a,r?.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(Ot(s,"output")),s}async _batchWithConfig(t,e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(or)),s=await Promise.all(i.map(async(c,u)=>{let l=await c?.handleChainStart(this.toJSON(),Ot(e[u],"input"),o[u].runId,o[u].runType,void 0,void 0,o[u].runName??this.getName());return delete o[u].runId,l})),a;try{let c=t.call(this,e,o,s,n);a=await vn(c,o?.[0]?.signal)}catch(c){throw await Promise.all(s.map(u=>u?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(Ot(a,"output")))),a}_concatOutputChunks(t,e){return en(t,e)}async*_transformStreamWithConfig(t,e,r){let n,o=!0,i,s=!0,a=Pe(r),c=await or(a),u=this;async function*l(){for await(let f of t){if(o)if(n===void 0)n=f;else try{n=u._concatOutputChunks(n,f)}catch{n=void 0,o=!1}yield f}}let d;try{let f=await m0(e.bind(this),l(),async()=>c?.handleChainStart(this.toJSON(),{input:""},a.runId,a.runType,void 0,void 0,a.runName??this.getName()),r?.signal,a);delete a.runId,d=f.setup;let p=d?.handlers.find(ZR),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(_0);h!==void 0&&d!==void 0&&(m=h.tapOutputIterable(d.runId,m));for await(let _ of m)if(yield _,s)if(i===void 0)i=_;else try{i=this._concatOutputChunks(i,_)}catch{i=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:Ot(n,"input")}),f}await d?.handleChainEnd(i??{},void 0,void 0,void 0,{inputs:Ot(n,"input")})}getGraph(t){let e=new By,r=e.addNode({name:`${this.getName()}Input`,schema:$r.any()}),n=e.addNode(this),o=e.addNode({name:`${this.getName()}Output`,schema:$r.any()});return e.addEdge(r,n),e.addEdge(n,o),e}pipe(t){return new cs({first:this,last:cn(t)})}pick(t){return this.pipe(new q$(t))}assign(t){return this.pipe(new Bp(new us({steps:t})))}async*transform(t,e){let r;for await(let n of t)r===void 0?r=n:r=this._concatOutputChunks(r,n);yield*this._streamIterator(r,Pe(e))}async*streamLog(t,e,r){let n=new sg({...r,autoClose:!1,_schemaFormat:"original"}),o=Pe(e);yield*this._streamLog(t,n,o)}async*_streamLog(t,e,r){let{callbacks:n}=r;if(n===void 0)r.callbacks=[e];else if(Array.isArray(n))r.callbacks=n.concat([e]);else{let a=n.copy();a.addHandler(e,!0),r.callbacks=a}let o=this.stream(t,r);async function i(){try{let a=await o;for await(let c of a){let u=new ho({ops:[{op:"add",path:"/streamed_output/-",value:c}]});await e.writer.write(u)}}finally{await e.writer.close()}}let s=i();try{for await(let a of e)yield a}finally{await s}}streamEvents(t,e,r){let n;if(e.version==="v1")n=this._streamEventsV1(t,e,r);else if(e.version==="v2")n=this._streamEventsV2(t,e,r);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return e.encoding==="text/event-stream"?N1(n):br.fromAsyncGenerator(n)}async*_streamEventsV2(t,e,r){let n=new qR({...r,autoClose:!1}),o=Pe(e),i=o.runId??Et();o.runId=i;let s=o.callbacks;if(s===void 0)o.callbacks=[n];else if(Array.isArray(s))o.callbacks=s.concat(n);else{let p=s.copy();p.addHandler(n,!0),o.callbacks=p}let a=new AbortController,c=this;async function u(){let p,m=null;try{e?.signal?"any"in AbortSignal?p=AbortSignal.any([a.signal,e.signal]):(p=e.signal,m=()=>{a.abort()},e.signal.addEventListener("abort",m,{once:!0})):p=a.signal;let h=await c.stream(t,{...o,signal:p}),_=n.tapOutputIterable(i,h);for await(let v of _)if(a.signal.aborted)break}finally{await n.finish(),p&&m&&p.removeEventListener("abort",m)}}let l=u(),d=!1,f;try{for await(let p of n){if(!d){p.data.input=t,d=!0,f=p.run_id,yield p;continue}p.run_id===f&&p.event.endsWith("_end")&&p.data?.input&&delete p.data.input,yield p}}finally{a.abort(),await l}}async*_streamEventsV1(t,e,r){let n,o=!1,i=Pe(e),s=i.tags??[],a=i.metadata??{},c=i.runName??this.getName(),u=new sg({...r,autoClose:!1,_schemaFormat:"streaming_events"}),l=new KR({...r}),d=this._streamLog(t,u,i);for await(let p of d){if(n?n=n.concat(p):n=ig.fromRunLogPatch(p),n.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!o){o=!0;let v={...n.state},b={run_id:v.id,event:`on_${v.type}_start`,name:c,tags:s,metadata:a,data:{input:t}};l.includeEvent(b,v.type)&&(yield b)}let m=p.ops.filter(v=>v.path.startsWith("/logs/")).map(v=>v.path.split("/")[2]),h=[...new Set(m)];for(let v of h){let b,x={},k=n.state.logs[v];if(k.end_time===void 0?k.streamed_output.length>0?b="stream":b="start":b="end",b==="start")k.inputs!==void 0&&(x.input=k.inputs);else if(b==="end")k.inputs!==void 0&&(x.input=k.inputs),x.output=k.final_output;else if(b==="stream"){let T=k.streamed_output.length;if(T!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${T} instead. Encountered in: "${k.name}"`);x={chunk:k.streamed_output[0]},k.streamed_output=[]}yield{event:`on_${k.type}_${b}`,name:k.name,run_id:k.id,tags:k.tags,metadata:k.metadata,data:x}}let{state:_}=n;if(_.streamed_output.length>0){let v=_.streamed_output.length;if(v!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${v} instead. Encountered in: "${_.name}"`);let b={chunk:_.streamed_output[0]};_.streamed_output=[];let x={event:`on_${_.type}_stream`,run_id:_.id,tags:s,metadata:a,name:c,data:b};l.includeEvent(x,_.type)&&(yield x)}}let f=n?.state;if(f!==void 0){let p={event:`on_${f.type}_end`,name:c,run_id:f.id,tags:s,metadata:a,data:{output:f.final_output}};l.includeEvent(p,f.type)&&(yield p)}}static isRunnable(t){return Hd(t)}withListeners({onStart:t,onEnd:e,onError:r}){return new as({bound:this,config:{},configFactories:[n=>({callbacks:[new y0({config:n,onStart:t,onEnd:e,onError:r})]})]})}asTool(t){return VK(this,t)}},as=class M1 extends Ze{static lc_name(){return"RunnableBinding"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;bound;config;kwargs;configFactories;constructor(e){super(e),this.bound=e.bound,this.kwargs=e.kwargs,this.config=e.config,this.configFactories=e.configFactories}getName(e){return this.bound.getName(e)}async _mergeConfig(...e){let r=ga(this.config,...e);return ga(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new Gy({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:e?.stopAfterAttempt,...e})}async invoke(e,r){return this.bound.invoke(e,await this._mergeConfig(r,this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(Pe(i),this.kwargs))):await this._mergeConfig(Pe(r),this.kwargs);return this.bound.batch(e,o,n)}_concatOutputChunks(e,r){return this.bound._concatOutputChunks(e,r)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(Pe(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(Pe(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(Pe(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(Pe(r),o.kwargs),version:r.version},n)};return br.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&Ze.isRunnable(e.bound)}withListeners({onStart:e,onEnd:r,onError:n}){return new M1({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[o=>({callbacks:[new y0({config:o,onStart:e,onEnd:r,onError:n})]})]})}},j1=class D1 extends Ze{static lc_name(){return"RunnableEach"}lc_serializable=!0;lc_namespace=["langchain_core","runnables"];bound;constructor(e){super(e),this.bound=e.bound}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _invoke(e,r,n){return this.bound.batch(e,Ve(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new D1({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},Gy=class extends as{static lc_name(){return"RunnableRetry"}lc_namespace=["langchain_core","runnables"];maxAttemptNumber=3;onFailedAttempt=()=>{};constructor(t){super(t),this.maxAttemptNumber=t.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=t.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(t,e,r){let n=t>1?`retry:attempt:${t}`:void 0;return Ve(e,{callbacks:r?.getChild(n)})}async _invoke(t,e,r){return Kd(n=>super.invoke(t,this._patchConfigForRetry(n,e,r)),{onFailedAttempt:({error:n})=>this.onFailedAttempt(n,t),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(t,e){return this._callWithConfig(this._invoke.bind(this),t,e)}async _batch(t,e,r,n){let o={};try{await Kd(async i=>{let s=t.map((d,f)=>f).filter(d=>o[d.toString()]===void 0||o[d.toString()]instanceof Error),a=s.map(d=>t[d]),c=s.map(d=>this._patchConfigForRetry(i,e?.[d],r?.[d])),u=await super.batch(a,c,{...n,returnExceptions:!0}),l;for(let d=0;dthis.onFailedAttempt(i,i.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(i){if(n?.returnExceptions!==!0)throw i}return Object.keys(o).sort((i,s)=>parseInt(i,10)-parseInt(s,10)).map(i=>o[parseInt(i,10)])}async batch(t,e,r){return this._batchWithConfig(this._batch.bind(this),t,e,r)}},cs=class Fp extends Ze{static lc_name(){return"RunnableSequence"}first;middle=[];last;omitSequenceTags=!1;lc_serializable=!0;lc_namespace=["langchain_core","runnables"];constructor(e){super(e),this.first=e.first,this.middle=e.middle??this.middle,this.last=e.last,this.name=e.name,this.omitSequenceTags=e.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),Ot(e,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let s=e,a;try{let c=[this.first,...this.middle];for(let u=0;u{let l=await c?.handleChainStart(this.toJSON(),Ot(e[u],"input"),o[u].runId,void 0,void 0,void 0,o[u].runName);return delete o[u].runId,l})),a=e;try{for(let c=0;c{let p=d?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`);return Ve(o[f],{callbacks:p})}),n);a=await vn(l,o[0]?.signal)}}catch(c){throw await Promise.all(s.map(u=>u?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(Ot(a,"output")))),a}_concatOutputChunks(e,r){return this.last._concatOutputChunks(e,r)}async*_streamIterator(e,r){let n=await or(r),{runId:o,...i}=r??{},s=await n?.handleChainStart(this.toJSON(),Ot(e,"input"),o,void 0,void 0,void 0,i?.runName),a=[this.first,...this.middle,this.last],c=!0,u;async function*l(){yield e}try{let d=a[0].transform(l(),Ve(i,{callbacks:s?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let f=1;f{let s=o.getGraph(e);i!==0&&s.trimFirstNode(),i!==this.steps.length-1&&s.trimLastNode(),r.extend(s);let a=s.firstNode();if(!a)throw new Error(`Runnable ${o} has no first node`);n&&r.addEdge(n,a),n=s.lastNode()}),r}pipe(e){return Fp.isRunnableSequence(e)?new Fp({first:this.first,middle:this.middle.concat([this.last,e.first,...e.middle]),last:e.last,name:this.name??e.name}):new Fp({first:this.first,middle:[...this.middle,this.last],last:cn(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&Ze.isRunnable(e)}static from([e,...r],n){let o={};return typeof n=="string"?o.name=n:n!==void 0&&(o=n),new Fp({...o,first:cn(e),middle:r.slice(0,-1).map(cn),last:cn(r[r.length-1])})}},us=class L1 extends Ze{static lc_name(){return"RunnableMap"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;steps;getStepsKeys(){return Object.keys(this.steps)}constructor(e){super(e),this.steps={};for(let[r,n]of Object.entries(e.steps))this.steps[r]=cn(n)}static from(e){return new L1({steps:e})}async invoke(e,r){let n=Pe(r),i=await(await or(n))?.handleChainStart(this.toJSON(),{input:e},n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let s={};try{let a=Object.entries(this.steps).map(async([c,u])=>{s[c]=await u.invoke(e,Ve(n,{callbacks:i?.getChild(`map:key:${c}`)}))});await vn(Promise.all(a),r?.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(s),s}async*_transform(e,r,n){let o={...this.steps},i=Jh(e,Object.keys(o).length),s=new Map(Object.entries(o).map(([a,c],u)=>{let l=c.transform(i[u],Ve(n,{callbacks:r?.getChild(`map:key:${a}`)}));return[a,l.next().then(d=>({key:a,gen:l,result:d}))]}));for(;s.size;){let a=Promise.race(s.values()),{key:c,result:u,gen:l}=await vn(a,n?.signal);s.delete(c),u.done||(yield{[c]:u.value},s.set(c,l.next().then(d=>({key:c,gen:l,result:d}))))}}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Pe(r),i=new Zi({generator:this.transform(n(),o),config:o});return await i.setup,br.fromAsyncGenerator(i)}},ZK=class U1 extends Ze{lc_serializable=!1;lc_namespace=["langchain_core","runnables"];func;constructor(e){if(super(e),!Kh(e.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=e.func}async invoke(e,r){let[n]=this._getOptionsList(r??{},1),o=await or(n),i=this.func(Ve(n,{callbacks:o}),e);return vn(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(Zy(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(z1(o)){for(;;){n?.signal?.throwIfAborted();let i=o.next();if(i.done)break;yield i.value}return}yield o}static from(e){return new U1({func:e})}};function qK(t){if(Kh(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}var Dr=class F1 extends Ze{static lc_name(){return"RunnableLambda"}lc_namespace=["langchain_core","runnables"];func;constructor(e){if(Kh(e.func))return ZK.from(e.func);super(e),qK(e.func),this.func=e.func}static from(e){return new F1({func:e})}async _invoke(e,r,n){return new Promise((o,i)=>{let s=Ve(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??Wh)-1});Lt.runWithConfig(vr(s),async()=>{try{let a=await this.func(e,{...s});if(a&&Ze.isRunnable(a)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");a=await a.invoke(e,{...s,recursionLimit:(s.recursionLimit??Wh)-1})}else if(Zy(a)){let c;for await(let u of qy(s,a))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}a=c}else if(F$(a)){let c;for(let u of B$(s,a))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}a=c}o(a)}catch(a){i(a)}})})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async*_transform(e,r,n){let o;for await(let a of e)if(o===void 0)o=a;else try{o=this._concatOutputChunks(o,a)}catch{o=a}let i=Ve(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??Wh)-1}),s=await new Promise((a,c)=>{Lt.runWithConfig(vr(i),async()=>{try{let u=await this.func(o,{...i,config:i});a(u)}catch(u){c(u)}})});if(s&&Ze.isRunnable(s)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");let a=await s.stream(o,i);for await(let c of a)yield c}else if(Zy(s))for await(let a of qy(i,s))n?.signal?.throwIfAborted(),yield a;else if(F$(s))for(let a of B$(i,s))n?.signal?.throwIfAborted(),yield a;else yield s}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Pe(r),i=new Zi({generator:this.transform(n(),o),config:o});return await i.setup,br.fromAsyncGenerator(i)}},B1=class extends us{},Z$=class extends Ze{static lc_name(){return"RunnableWithFallbacks"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnable;fallbacks;constructor(t){super(t),this.runnable=t.runnable,this.fallbacks=t.fallbacks}*runnables(){yield this.runnable;for(let t of this.fallbacks)yield t}async invoke(t,e){let r=Pe(e),n=await or(r),{runId:o,...i}=r,s=await n?.handleChainStart(this.toJSON(),Ot(t,"input"),o,void 0,void 0,void 0,i?.runName),a=Ve(i,{callbacks:s?.getChild()});return await Lt.runWithConfig(a,async()=>{let u;for(let l of this.runnables()){r?.signal?.throwIfAborted();try{let d=await l.invoke(t,a);return await s?.handleChainEnd(Ot(d,"output")),d}catch(d){u===void 0&&(u=d)}}throw u===void 0?new Error("No error stored at end of fallback."):(await s?.handleChainError(u),u)})}async*_streamIterator(t,e){let r=Pe(e),n=await or(r),{runId:o,...i}=r,s=await n?.handleChainStart(this.toJSON(),Ot(t,"input"),o,void 0,void 0,void 0,i?.runName),a,c;for(let l of this.runnables()){r?.signal?.throwIfAborted();let d=Ve(i,{callbacks:s?.getChild()});try{let f=await l.stream(t,d);c=qy(d,f);break}catch(f){a===void 0&&(a=f)}}if(c===void 0){let l=a??new Error("No error stored at end of fallback.");throw await s?.handleChainError(l),l}let u;try{for await(let l of c){yield l;try{u=u===void 0?u:this._concatOutputChunks(u,l)}catch{u=void 0}}}catch(l){throw await s?.handleChainError(l),l}await s?.handleChainEnd(Ot(u,"output"))}async batch(t,e,r){if(r?.returnExceptions)throw new Error("Not implemented.");let n=this._getOptionsList(e??{},t.length),o=await Promise.all(n.map(a=>or(a))),i=await Promise.all(o.map(async(a,c)=>{let u=await a?.handleChainStart(this.toJSON(),Ot(t[c],"input"),n[c].runId,void 0,void 0,void 0,n[c].runName);return delete n[c].runId,u})),s;for(let a of this.runnables()){n[0].signal?.throwIfAborted();try{let c=await a.batch(t,i.map((u,l)=>Ve(n[l],{callbacks:u?.getChild()})),r);return await Promise.all(i.map((u,l)=>u?.handleChainEnd(Ot(c[l],"output")))),c}catch(c){s===void 0&&(s=c)}}throw s?(await Promise.all(i.map(a=>a?.handleChainError(s))),s):new Error("No error stored at end of fallbacks.")}};function cn(t){if(typeof t=="function")return new Dr({func:t});if(Ze.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=cn(n);return new us({steps:e})}else throw new Error(`Expected a Runnable, function or object. +Instead got an unsupported type.`)}var Bp=class extends Ze{static lc_name(){return"RunnableAssign"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;mapper;constructor(t){t instanceof us&&(t={mapper:t}),super(t),this.mapper=t.mapper}async invoke(t,e){let r=await this.mapper.invoke(t,e);return{...t,...r}}async*_transform(t,e,r){let n=this.mapper.getStepsKeys(),[o,i]=Jh(t),s=this.mapper.transform(i,Ve(r,{callbacks:e?.getChild()})),a=s.next();for await(let c of o){if(typeof c!="object"||Array.isArray(c))throw new Error(`RunnableAssign can only be used with objects as input, got ${typeof c}`);let u=Object.fromEntries(Object.entries(c).filter(([l])=>!n.includes(l)));Object.keys(u).length>0&&(yield u)}yield(await a).value;for await(let c of s)yield c}transform(t,e){return this._transformStreamWithConfig(t,this._transform.bind(this),e)}async stream(t,e){async function*r(){yield t}let n=Pe(e),o=new Zi({generator:this.transform(r(),n),config:n});return await o.setup,br.fromAsyncGenerator(o)}},q$=class extends Ze{static lc_name(){return"RunnablePick"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;keys;constructor(t){(typeof t=="string"||Array.isArray(t))&&(t={keys:t}),super(t),this.keys=t.keys}async _pick(t){if(typeof this.keys=="string")return t[this.keys];{let e=this.keys.map(r=>[r,t[r]]).filter(r=>r[1]!==void 0);return e.length===0?void 0:Object.fromEntries(e)}}async invoke(t,e){return this._callWithConfig(this._pick.bind(this),t,e)}async*_transform(t){for await(let e of t){let r=await this._pick(e);r!==void 0&&(yield r)}}transform(t,e){return this._transformStreamWithConfig(t,this._transform.bind(this),e)}async stream(t,e){async function*r(){yield t}let n=Pe(e),o=new Zi({generator:this.transform(r(),n),config:n});return await o.setup,br.fromAsyncGenerator(o)}},Vy=class extends as{name;description;schema;constructor(t){let e=cs.from([Dr.from(async r=>{let n;if(Mi(r))try{n=await ts(this.schema,r.args)}catch{throw new su("Received tool input did not match expected schema",JSON.stringify(r.args))}else n=r;return n}).withConfig({runName:`${t.name}:parse_input`}),t.bound]).withConfig({runName:t.name});super({bound:e,config:t.config??{}}),this.name=t.name,this.description=t.description,this.schema=t.schema}static lc_name(){return"RunnableToolLike"}};function VK(t,e){let r=e.name??t.getName(),n=e.description??rs(e.schema);return Wu(e.schema)?new Vy({name:r,description:n,schema:$r.object({input:$r.string()}).transform(o=>o.input),bound:t}):new Vy({name:r,description:n,schema:e.schema,bound:t})}var Ky=(t,e)=>{let r=[...new Set(e?.map(o=>{if(typeof o=="string")return o;let i=new o({});if(!("getType"in i)||typeof i.getType!="function")throw new Error("Invalid type provided.");return i.getType()}))],n=t.getType();return r.some(o=>o===n)};function K1(t,e){return Array.isArray(t)?Z1(t,e):Dr.from(r=>Z1(r,t))}function Z1(t,e={}){let{includeNames:r,excludeNames:n,includeTypes:o,excludeTypes:i,includeIds:s,excludeIds:a}=e,c=[];for(let u of t)if(!(n&&u.name&&n.includes(u.name))){{if(i&&Ky(u,i))continue;if(a&&u.id&&a.includes(u.id))continue}o||s||r?(r&&u.name&&r.some(l=>l===u.name)||o&&Ky(u,o)||s&&u.id&&s.some(l=>l===u.id))&&c.push(u):c.push(u)}return c}function H1(t){return Array.isArray(t)?q1(t):Dr.from(q1)}function q1(t){if(!t.length)return[];let e=[];for(let r of t){let n=r,o=e.pop();if(!o)e.push(n);else if(n.getType()==="tool"||n.getType()!==o.getType())e.push(o,n);else{let i=ca(o),s=ca(n),a=i.concat(s);typeof i.content=="string"&&typeof s.content=="string"&&(a.content=`${i.content} +${s.content}`),e.push(KK(a))}}return e}function W1(t,e){if(Array.isArray(t)){let r=t;if(!e)throw new Error("Options parameter is required when providing messages.");return V1(r,e)}else{let r=t;return Dr.from(n=>V1(n,r)).withConfig({runName:"trim_messages"})}}async function V1(t,e){let{maxTokens:r,tokenCounter:n,strategy:o="last",allowPartial:i=!1,endOn:s,startOn:a,includeSystem:c=!1,textSplitter:u}=e;if(a&&o==="first")throw new Error("`startOn` should only be specified if `strategy` is 'last'.");if(c&&o==="first")throw new Error("`includeSystem` should only be specified if `strategy` is 'last'.");let l;"getNumTokens"in n?l=async f=>(await Promise.all(f.map(m=>n.getNumTokens(m.content)))).reduce((m,h)=>m+h,0):l=async f=>n(f);let d=G$;if(u&&("splitText"in u?d=u.splitText:d=async f=>u(f)),o==="first")return J1(t,{maxTokens:r,tokenCounter:l,textSplitter:d,partialStrategy:i?"first":void 0,endOn:s});if(o==="last")return GK(t,{maxTokens:r,tokenCounter:l,textSplitter:d,allowPartial:i,includeSystem:c,startOn:a,endOn:s});throw new Error(`Unrecognized strategy: '${o}'. Must be one of 'first' or 'last'.`)}async function J1(t,e){let{maxTokens:r,tokenCounter:n,textSplitter:o,partialStrategy:i,endOn:s}=e,a=[...t],c=0;for(let u=0;u0?a.slice(0,-u):a;if(await n(l)<=r){c=a.length-u;break}}if(cb!=="type"&&!b.startsWith("lc_"))),_=V$(l.getType(),{...h,content:m}),v=[...a.slice(0,c),_];if(await n(v)<=r)a=v,c+=1,u=!0;else break}u&&i==="last"&&(l.content=[...f].reverse())}if(!u){let l=a[c],d;if(Array.isArray(l.content)&&l.content.some(f=>typeof f=="string"||f.type==="text")?d=l.content.find(p=>p.type==="text"&&p.text)?.text:typeof l.content=="string"&&(d=l.content),d){let f=await o(d),p=f.length;i==="last"&&f.reverse();for(let m=0;m0&&!Ky(a[c-1],u);)c-=1}return a.slice(0,c)}async function GK(t,e){let{allowPartial:r=!1,includeSystem:n=!1,endOn:o,startOn:i,...s}=e,a=t.map(l=>{let d=Object.fromEntries(Object.entries(l).filter(([f])=>f!=="type"&&!f.startsWith("lc_")));return V$(l.getType(),d,iu(l))});if(o){let l=Array.isArray(o)?o:[o];for(;a.length>0&&!Ky(a[a.length-1],l);)a=a.slice(0,-1)}let c=n&&a[0]?.getType()==="system",u=c?a.slice(0,1).concat(a.slice(1).reverse()):a.reverse();return u=await J1(u,{...s,partialStrategy:r?"last":void 0,endOn:i}),c?[u[0],...u.slice(1).reverse()]:u.reverse()}var G1={human:{message:mr,messageChunk:zi},ai:{message:jt,messageChunk:Dt},system:{message:hn,messageChunk:lo},developer:{message:hn,messageChunk:lo},tool:{message:Or,messageChunk:na},function:{message:oa,messageChunk:Ni},generic:{message:jn,messageChunk:Ri},remove:{message:ia,messageChunk:ia}};function V$(t,e,r){let n,o;switch(t){case"human":r?n=new zi(e):o=new mr(e);break;case"ai":if(r){let i={...e};"tool_calls"in i&&(i={...i,tool_call_chunks:i.tool_calls?.map(s=>({...s,type:"tool_call_chunk",index:void 0,args:JSON.stringify(s.args)}))}),n=new Dt(i)}else o=new jt(e);break;case"system":r?n=new lo(e):o=new hn(e);break;case"developer":r?n=new lo({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}}):o=new hn({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in e)r?n=new na(e):o=new Or(e);else throw new Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(r)n=new Ni(e);else{if(!e.name)throw new Error("FunctionMessage must have a 'name' field");o=new oa(e)}break;case"generic":if("role"in e)r?n=new Ri(e):o=new jn(e);else throw new Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw new Error(`Unrecognized message type ${t}`)}if(r&&n)return n;if(o)return o;throw new Error(`Unrecognized message type ${t}`)}function KK(t){let e=t.getType(),r,n=Object.fromEntries(Object.entries(t).filter(([o])=>!["type","tool_call_chunks"].includes(o)&&!o.startsWith("lc_")));if(e in G1&&(r=V$(e,n)),!r)throw new Error(`Unrecognized message chunk class ${e}. Supported classes are ${Object.keys(G1)}`);return r}function G$(t){let e=t.split(` +`);return Promise.resolve([...e.slice(0,-1).map(r=>`${r} +`),e[e.length-1]])}var X1=["tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result"];var Y1=["image","video","audio","text-plain","file"];var Q1=["text","reasoning",...X1,...Y1];var HK={};G(HK,{AIMessage:()=>jt,AIMessageChunk:()=>Dt,BaseMessage:()=>qt,BaseMessageChunk:()=>fr,ChatMessage:()=>jn,ChatMessageChunk:()=>Ri,FunctionMessage:()=>oa,FunctionMessageChunk:()=>Ni,HumanMessage:()=>mr,HumanMessageChunk:()=>zi,KNOWN_BLOCK_TYPES:()=>Q1,RemoveMessage:()=>ia,SystemMessage:()=>hn,SystemMessageChunk:()=>lo,ToolMessage:()=>Or,ToolMessageChunk:()=>na,_isMessageFieldWithRole:()=>ih,_mergeDicts:()=>dt,_mergeLists:()=>ra,_mergeObj:()=>oh,_mergeStatus:()=>nh,coerceMessageLikeToMessage:()=>ji,collapseToolCallChunks:()=>lh,convertToChunk:()=>ca,convertToOpenAIImageBlock:()=>Xm,convertToProviderContentBlock:()=>$d,defaultTextSplitter:()=>G$,defaultToolCallParser:()=>Sd,filterMessages:()=>K1,getBufferString:()=>au,iife:()=>Xw,isAIMessage:()=>aa,isAIMessageChunk:()=>Td,isBase64ContentBlock:()=>ou,isBaseMessage:()=>Yr,isBaseMessageChunk:()=>iu,isChatMessage:()=>WA,isChatMessageChunk:()=>JA,isDataContentBlock:()=>Jr,isDirectToolOutput:()=>Id,isFunctionMessage:()=>XA,isFunctionMessageChunk:()=>YA,isHumanMessage:()=>QA,isHumanMessageChunk:()=>eO,isIDContentBlock:()=>Jm,isMessage:()=>Qm,isOpenAIToolCallArray:()=>VA,isPlainTextContentBlock:()=>bA,isSystemMessage:()=>tO,isSystemMessageChunk:()=>rO,isToolMessage:()=>Gw,isToolMessageChunk:()=>Kw,isURLContentBlock:()=>nu,mapChatMessagesToStoredMessages:()=>dO,mapStoredMessageToChatMessage:()=>Ed,mapStoredMessagesToChatMessages:()=>lO,mergeContent:()=>er,mergeMessageRuns:()=>H1,mergeResponseMetadata:()=>sh,mergeUsageMetadata:()=>ah,parseBase64DataUrl:()=>ta,parseMimeType:()=>Ym,trimMessages:()=>W1});function Zp(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function qp(t){return t!==void 0&&Ze.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function Vp(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(on(t.schema)||t.schema!=null&&typeof t.schema=="object"&&"type"in t.schema&&typeof t.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(t.schema.type))}function qa(t){return Vp(t)||qp(t)||Zp(t)}var JK={};G(JK,{convertToOpenAIFunction:()=>eM,convertToOpenAITool:()=>tM,isLangChainTool:()=>qa,isRunnableToolLike:()=>qp,isStructuredTool:()=>Zp,isStructuredToolParams:()=>Vp});function eM(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:an(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function tM(t,e){let r=typeof e=="number"?void 0:e,n;return qa(t)?n={type:"function",function:eM(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var XK={};G(XK,{extendInteropZodObject:()=>Oz,getInteropZodDefaultGetter:()=>Cz,getInteropZodObjectShape:()=>ky,getSchemaDescription:()=>rs,interopParse:()=>Tz,interopParseAsync:()=>ts,interopSafeParse:()=>kz,interopSafeParseAsync:()=>Ey,interopZodObjectMakeFieldsOptional:()=>Rz,interopZodObjectPartial:()=>Pz,interopZodObjectPassthrough:()=>Ty,interopZodObjectStrict:()=>Hu,interopZodTransformInputSchema:()=>Oy,isInteropZodError:()=>Py,isInteropZodLiteral:()=>Sz,isInteropZodObject:()=>Az,isInteropZodSchema:()=>on,isShapelessZodSchema:()=>Ez,isSimpleStringZodSchema:()=>Wu,isZodArrayV4:()=>Mp,isZodLiteralV3:()=>E$,isZodLiteralV4:()=>A$,isZodNullableV4:()=>P$,isZodObjectV3:()=>Ay,isZodObjectV4:()=>wn,isZodOptionalV4:()=>O$,isZodSchema:()=>Iz,isZodSchemaV3:()=>vt,isZodSchemaV4:()=>nt});var av={};gi(av,{$brand:()=>Jd,$input:()=>D_,$output:()=>j_,NEVER:()=>lg,TimePrecision:()=>B_,ZodAny:()=>cM,ZodArray:()=>pM,ZodBase64:()=>$I,ZodBase64URL:()=>II,ZodBigInt:()=>Xp,ZodBigIntFormat:()=>TI,ZodBoolean:()=>Jp,ZodCIDRv4:()=>wI,ZodCIDRv6:()=>xI,ZodCUID:()=>mI,ZodCUID2:()=>hI,ZodCatch:()=>AM,ZodCodec:()=>zI,ZodCustom:()=>iv,ZodCustomStringFormat:()=>Hp,ZodDate:()=>rv,ZodDefault:()=>$M,ZodDiscriminatedUnion:()=>fM,ZodE164:()=>SI,ZodEmail:()=>dI,ZodEmoji:()=>pI,ZodEnum:()=>Gp,ZodError:()=>QK,ZodFile:()=>bM,ZodFirstPartyTypeKind:()=>jI,ZodFunction:()=>DM,ZodGUID:()=>Yy,ZodIPv4:()=>vI,ZodIPv6:()=>bI,ZodISODate:()=>Wy,ZodISODateTime:()=>Hy,ZodISODuration:()=>Xy,ZodISOTime:()=>Jy,ZodIntersection:()=>mM,ZodIssueCode:()=>aW,ZodJWT:()=>kI,ZodKSUID:()=>yI,ZodLazy:()=>zM,ZodLiteral:()=>vM,ZodMAC:()=>oM,ZodMap:()=>_M,ZodNaN:()=>PM,ZodNanoID:()=>fI,ZodNever:()=>lM,ZodNonOptional:()=>RI,ZodNull:()=>aM,ZodNullable:()=>xM,ZodNumber:()=>Wp,ZodNumberFormat:()=>sl,ZodObject:()=>nv,ZodOptional:()=>CI,ZodPipe:()=>NI,ZodPrefault:()=>SM,ZodPromise:()=>jM,ZodReadonly:()=>CM,ZodRealError:()=>Lr,ZodRecord:()=>OI,ZodSet:()=>yM,ZodString:()=>Kp,ZodStringFormat:()=>et,ZodSuccess:()=>EM,ZodSymbol:()=>iM,ZodTemplateLiteral:()=>NM,ZodTransform:()=>wM,ZodTuple:()=>hM,ZodType:()=>Ae,ZodULID:()=>gI,ZodURL:()=>tv,ZodUUID:()=>oi,ZodUndefined:()=>sM,ZodUnion:()=>AI,ZodUnknown:()=>uM,ZodVoid:()=>dM,ZodXID:()=>_I,_ZodString:()=>lI,_default:()=>IM,_function:()=>eW,any:()=>DH,array:()=>Re,base64:()=>wH,base64url:()=>xH,bigint:()=>RH,boolean:()=>Nt,catch:()=>OM,check:()=>tW,cidrv4:()=>vH,cidrv6:()=>bH,clone:()=>Qe,codec:()=>XH,coerce:()=>DI,config:()=>yt,core:()=>nn,cuid:()=>dH,cuid2:()=>pH,custom:()=>MI,date:()=>UH,decode:()=>rI,decodeAsync:()=>oI,describe:()=>rW,discriminatedUnion:()=>ov,e164:()=>$H,email:()=>tH,emoji:()=>uH,encode:()=>tI,encodeAsync:()=>nI,endsWith:()=>Bu,enum:()=>zt,file:()=>KH,flattenError:()=>yu,float32:()=>AH,float64:()=>OH,formatError:()=>vu,function:()=>eW,getErrorMap:()=>uW,globalRegistry:()=>Ge,gt:()=>yo,gte:()=>ir,guid:()=>rH,hash:()=>EH,hex:()=>TH,hostname:()=>kH,httpUrl:()=>cH,includes:()=>Uu,instanceof:()=>oW,int:()=>uI,int32:()=>PH,int64:()=>NH,intersection:()=>Qp,ipv4:()=>gH,ipv6:()=>yH,iso:()=>il,json:()=>sW,jwt:()=>IH,keyof:()=>FH,ksuid:()=>hH,lazy:()=>MM,length:()=>Sa,literal:()=>se,locales:()=>Ou,looseObject:()=>un,lowercase:()=>Du,lt:()=>_o,lte:()=>zr,mac:()=>_H,map:()=>qH,maxLength:()=>Ia,maxSize:()=>$a,meta:()=>nW,mime:()=>Zu,minLength:()=>Qo,minSize:()=>es,multipleOf:()=>Qi,nan:()=>JH,nanoid:()=>lH,nativeEnum:()=>GH,negative:()=>hy,never:()=>EI,nonnegative:()=>_y,nonoptional:()=>TM,nonpositive:()=>gy,normalize:()=>qu,null:()=>Yp,nullable:()=>Qy,nullish:()=>HH,number:()=>We,object:()=>U,optional:()=>ie,overwrite:()=>Zn,parse:()=>X$,parseAsync:()=>Y$,partialRecord:()=>ZH,pipe:()=>ev,positive:()=>my,prefault:()=>kM,preprocess:()=>sv,prettifyError:()=>mg,promise:()=>QH,property:()=>yy,readonly:()=>RM,record:()=>bt,refine:()=>LM,regex:()=>ju,regexes:()=>Nr,registry:()=>fp,safeDecode:()=>sI,safeDecodeAsync:()=>cI,safeEncode:()=>iI,safeEncodeAsync:()=>aI,safeParse:()=>Q$,safeParseAsync:()=>eI,set:()=>VH,setErrorMap:()=>cW,size:()=>Mu,slugify:()=>Np,startsWith:()=>Fu,strictObject:()=>BH,string:()=>A,stringFormat:()=>SH,stringbool:()=>iW,success:()=>WH,superRefine:()=>UM,symbol:()=>MH,templateLiteral:()=>YH,toJSONSchema:()=>vo,toLowerCase:()=>Gu,toUpperCase:()=>Ku,transform:()=>PI,treeifyError:()=>fg,trim:()=>Vu,tuple:()=>gM,uint32:()=>CH,uint64:()=>zH,ulid:()=>fH,undefined:()=>jH,union:()=>tt,unknown:()=>ft,uppercase:()=>Lu,url:()=>aH,util:()=>M,uuid:()=>nH,uuidv4:()=>oH,uuidv6:()=>iH,uuidv7:()=>sH,void:()=>LH,xid:()=>mH});var il={};gi(il,{ZodISODate:()=>Wy,ZodISODateTime:()=>Hy,ZodISODuration:()=>Xy,ZodISOTime:()=>Jy,date:()=>H$,datetime:()=>K$,duration:()=>J$,time:()=>W$});var Hy=$("ZodISODateTime",(t,e)=>{Bg.init(t,e),et.init(t,e)});function K$(t){return Z_(Hy,t)}var Wy=$("ZodISODate",(t,e)=>{Zg.init(t,e),et.init(t,e)});function H$(t){return q_(Wy,t)}var Jy=$("ZodISOTime",(t,e)=>{qg.init(t,e),et.init(t,e)});function W$(t){return V_(Jy,t)}var Xy=$("ZodISODuration",(t,e)=>{Vg.init(t,e),et.init(t,e)});function J$(t){return G_(Xy,t)}var nM=(t,e)=>{np.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>vu(t,r)},flatten:{value:r=>yu(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,hu,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,hu,2)}},isEmpty:{get(){return t.issues.length===0}}})},QK=$("ZodError",nM),Lr=$("ZodError",nM,{Parent:Error});var X$=bu(Lr),Y$=wu(Lr),Q$=xu(Lr),eI=$u(Lr),tI=hg(Lr),rI=gg(Lr),nI=_g(Lr),oI=yg(Lr),iI=vg(Lr),sI=bg(Lr),aI=wg(Lr),cI=xg(Lr);var Ae=$("ZodType",(t,e)=>(ye.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(M.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>Qe(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>X$(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Q$(t,r,n),t.parseAsync=async(r,n)=>Y$(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>eI(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>tI(t,r,n),t.decode=(r,n)=>rI(t,r,n),t.encodeAsync=async(r,n)=>nI(t,r,n),t.decodeAsync=async(r,n)=>oI(t,r,n),t.safeEncode=(r,n)=>iI(t,r,n),t.safeDecode=(r,n)=>sI(t,r,n),t.safeEncodeAsync=async(r,n)=>aI(t,r,n),t.safeDecodeAsync=async(r,n)=>cI(t,r,n),t.refine=(r,n)=>t.check(LM(r,n)),t.superRefine=r=>t.check(UM(r)),t.overwrite=r=>t.check(Zn(r)),t.optional=()=>ie(t),t.nullable=()=>Qy(t),t.nullish=()=>ie(Qy(t)),t.nonoptional=r=>TM(t,r),t.array=()=>Re(t),t.or=r=>tt([t,r]),t.and=r=>Qp(t,r),t.transform=r=>ev(t,PI(r)),t.default=r=>IM(t,r),t.prefault=r=>kM(t,r),t.catch=r=>OM(t,r),t.pipe=r=>ev(t,r),t.readonly=()=>RM(t),t.describe=r=>{let n=t.clone();return Ge.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ge.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ge.get(t);let n=t.clone();return Ge.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),lI=$("_ZodString",(t,e)=>{Yi.init(t,e),Ae.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(ju(...n)),t.includes=(...n)=>t.check(Uu(...n)),t.startsWith=(...n)=>t.check(Fu(...n)),t.endsWith=(...n)=>t.check(Bu(...n)),t.min=(...n)=>t.check(Qo(...n)),t.max=(...n)=>t.check(Ia(...n)),t.length=(...n)=>t.check(Sa(...n)),t.nonempty=(...n)=>t.check(Qo(1,...n)),t.lowercase=n=>t.check(Du(n)),t.uppercase=n=>t.check(Lu(n)),t.trim=()=>t.check(Vu()),t.normalize=(...n)=>t.check(qu(...n)),t.toLowerCase=()=>t.check(Gu()),t.toUpperCase=()=>t.check(Ku()),t.slugify=()=>t.check(Np())}),Kp=$("ZodString",(t,e)=>{Yi.init(t,e),lI.init(t,e),t.email=r=>t.check(mp(dI,r)),t.url=r=>t.check(Ru(tv,r)),t.jwt=r=>t.check(Rp(kI,r)),t.emoji=r=>t.check(vp(pI,r)),t.guid=r=>t.check(Cu(Yy,r)),t.uuid=r=>t.check(hp(oi,r)),t.uuidv4=r=>t.check(gp(oi,r)),t.uuidv6=r=>t.check(_p(oi,r)),t.uuidv7=r=>t.check(yp(oi,r)),t.nanoid=r=>t.check(bp(fI,r)),t.guid=r=>t.check(Cu(Yy,r)),t.cuid=r=>t.check(wp(mI,r)),t.cuid2=r=>t.check(xp(hI,r)),t.ulid=r=>t.check($p(gI,r)),t.base64=r=>t.check(Op($I,r)),t.base64url=r=>t.check(Pp(II,r)),t.xid=r=>t.check(Ip(_I,r)),t.ksuid=r=>t.check(Sp(yI,r)),t.ipv4=r=>t.check(kp(vI,r)),t.ipv6=r=>t.check(Tp(bI,r)),t.cidrv4=r=>t.check(Ep(wI,r)),t.cidrv6=r=>t.check(Ap(xI,r)),t.e164=r=>t.check(Cp(SI,r)),t.datetime=r=>t.check(K$(r)),t.date=r=>t.check(H$(r)),t.time=r=>t.check(W$(r)),t.duration=r=>t.check(J$(r))});function A(t){return L_(Kp,t)}var et=$("ZodStringFormat",(t,e)=>{He.init(t,e),lI.init(t,e)}),dI=$("ZodEmail",(t,e)=>{Rg.init(t,e),et.init(t,e)});function tH(t){return mp(dI,t)}var Yy=$("ZodGUID",(t,e)=>{Pg.init(t,e),et.init(t,e)});function rH(t){return Cu(Yy,t)}var oi=$("ZodUUID",(t,e)=>{Cg.init(t,e),et.init(t,e)});function nH(t){return hp(oi,t)}function oH(t){return gp(oi,t)}function iH(t){return _p(oi,t)}function sH(t){return yp(oi,t)}var tv=$("ZodURL",(t,e)=>{Ng.init(t,e),et.init(t,e)});function aH(t){return Ru(tv,t)}function cH(t){return Ru(tv,{protocol:/^https?$/,hostname:Nr.domain,...M.normalizeParams(t)})}var pI=$("ZodEmoji",(t,e)=>{zg.init(t,e),et.init(t,e)});function uH(t){return vp(pI,t)}var fI=$("ZodNanoID",(t,e)=>{Mg.init(t,e),et.init(t,e)});function lH(t){return bp(fI,t)}var mI=$("ZodCUID",(t,e)=>{jg.init(t,e),et.init(t,e)});function dH(t){return wp(mI,t)}var hI=$("ZodCUID2",(t,e)=>{Dg.init(t,e),et.init(t,e)});function pH(t){return xp(hI,t)}var gI=$("ZodULID",(t,e)=>{Lg.init(t,e),et.init(t,e)});function fH(t){return $p(gI,t)}var _I=$("ZodXID",(t,e)=>{Ug.init(t,e),et.init(t,e)});function mH(t){return Ip(_I,t)}var yI=$("ZodKSUID",(t,e)=>{Fg.init(t,e),et.init(t,e)});function hH(t){return Sp(yI,t)}var vI=$("ZodIPv4",(t,e)=>{Gg.init(t,e),et.init(t,e)});function gH(t){return kp(vI,t)}var oM=$("ZodMAC",(t,e)=>{Hg.init(t,e),et.init(t,e)});function _H(t){return F_(oM,t)}var bI=$("ZodIPv6",(t,e)=>{Kg.init(t,e),et.init(t,e)});function yH(t){return Tp(bI,t)}var wI=$("ZodCIDRv4",(t,e)=>{Wg.init(t,e),et.init(t,e)});function vH(t){return Ep(wI,t)}var xI=$("ZodCIDRv6",(t,e)=>{Jg.init(t,e),et.init(t,e)});function bH(t){return Ap(xI,t)}var $I=$("ZodBase64",(t,e)=>{Xg.init(t,e),et.init(t,e)});function wH(t){return Op($I,t)}var II=$("ZodBase64URL",(t,e)=>{Yg.init(t,e),et.init(t,e)});function xH(t){return Pp(II,t)}var SI=$("ZodE164",(t,e)=>{Qg.init(t,e),et.init(t,e)});function $H(t){return Cp(SI,t)}var kI=$("ZodJWT",(t,e)=>{e_.init(t,e),et.init(t,e)});function IH(t){return Rp(kI,t)}var Hp=$("ZodCustomStringFormat",(t,e)=>{t_.init(t,e),et.init(t,e)});function SH(t,e,r={}){return ka(Hp,t,e,r)}function kH(t){return ka(Hp,"hostname",Nr.hostname,t)}function TH(t){return ka(Hp,"hex",Nr.hex,t)}function EH(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=Nr[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return ka(Hp,n,o,e)}var Wp=$("ZodNumber",(t,e)=>{ap.init(t,e),Ae.init(t,e),t.gt=(n,o)=>t.check(yo(n,o)),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.lt=(n,o)=>t.check(_o(n,o)),t.lte=(n,o)=>t.check(zr(n,o)),t.max=(n,o)=>t.check(zr(n,o)),t.int=n=>t.check(uI(n)),t.safe=n=>t.check(uI(n)),t.positive=n=>t.check(yo(0,n)),t.nonnegative=n=>t.check(ir(0,n)),t.negative=n=>t.check(_o(0,n)),t.nonpositive=n=>t.check(zr(0,n)),t.multipleOf=(n,o)=>t.check(Qi(n,o)),t.step=(n,o)=>t.check(Qi(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function We(t){return K_(Wp,t)}var sl=$("ZodNumberFormat",(t,e)=>{r_.init(t,e),Wp.init(t,e)});function uI(t){return W_(sl,t)}function AH(t){return J_(sl,t)}function OH(t){return X_(sl,t)}function PH(t){return Y_(sl,t)}function CH(t){return Q_(sl,t)}var Jp=$("ZodBoolean",(t,e)=>{ku.init(t,e),Ae.init(t,e)});function Nt(t){return ey(Jp,t)}var Xp=$("ZodBigInt",(t,e)=>{cp.init(t,e),Ae.init(t,e),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.gt=(n,o)=>t.check(yo(n,o)),t.gte=(n,o)=>t.check(ir(n,o)),t.min=(n,o)=>t.check(ir(n,o)),t.lt=(n,o)=>t.check(_o(n,o)),t.lte=(n,o)=>t.check(zr(n,o)),t.max=(n,o)=>t.check(zr(n,o)),t.positive=n=>t.check(yo(BigInt(0),n)),t.negative=n=>t.check(_o(BigInt(0),n)),t.nonpositive=n=>t.check(zr(BigInt(0),n)),t.nonnegative=n=>t.check(ir(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(Qi(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function RH(t){return ry(Xp,t)}var TI=$("ZodBigIntFormat",(t,e)=>{n_.init(t,e),Xp.init(t,e)});function NH(t){return oy(TI,t)}function zH(t){return iy(TI,t)}var iM=$("ZodSymbol",(t,e)=>{o_.init(t,e),Ae.init(t,e)});function MH(t){return sy(iM,t)}var sM=$("ZodUndefined",(t,e)=>{i_.init(t,e),Ae.init(t,e)});function jH(t){return ay(sM,t)}var aM=$("ZodNull",(t,e)=>{s_.init(t,e),Ae.init(t,e)});function Yp(t){return cy(aM,t)}var cM=$("ZodAny",(t,e)=>{a_.init(t,e),Ae.init(t,e)});function DH(){return uy(cM)}var uM=$("ZodUnknown",(t,e)=>{Tu.init(t,e),Ae.init(t,e)});function ft(){return Nu(uM)}var lM=$("ZodNever",(t,e)=>{Eu.init(t,e),Ae.init(t,e)});function EI(t){return zu(lM,t)}var dM=$("ZodVoid",(t,e)=>{c_.init(t,e),Ae.init(t,e)});function LH(t){return ly(dM,t)}var rv=$("ZodDate",(t,e)=>{u_.init(t,e),Ae.init(t,e),t.min=(n,o)=>t.check(ir(n,o)),t.max=(n,o)=>t.check(zr(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function UH(t){return dy(rv,t)}var pM=$("ZodArray",(t,e)=>{l_.init(t,e),Ae.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Qo(r,n)),t.nonempty=r=>t.check(Qo(1,r)),t.max=(r,n)=>t.check(Ia(r,n)),t.length=(r,n)=>t.check(Sa(r,n)),t.unwrap=()=>t.element});function Re(t,e){return T$(pM,t,e)}function FH(t){let e=t._zod.def.shape;return zt(Object.keys(e))}var nv=$("ZodObject",(t,e)=>{k$.init(t,e),Ae.init(t,e),M.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>zt(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ft()}),t.loose=()=>t.clone({...t._zod.def,catchall:ft()}),t.strict=()=>t.clone({...t._zod.def,catchall:EI()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>M.extend(t,r),t.safeExtend=r=>M.safeExtend(t,r),t.merge=r=>M.merge(t,r),t.pick=r=>M.pick(t,r),t.omit=r=>M.omit(t,r),t.partial=(...r)=>M.partial(CI,t,r[0]),t.required=(...r)=>M.required(RI,t,r[0])});function U(t,e){let r={type:"object",shape:t??{},...M.normalizeParams(e)};return new nv(r)}function BH(t,e){return new nv({type:"object",shape:t,catchall:EI(),...M.normalizeParams(e)})}function un(t,e){return new nv({type:"object",shape:t,catchall:ft(),...M.normalizeParams(e)})}var AI=$("ZodUnion",(t,e)=>{up.init(t,e),Ae.init(t,e),t.options=e.options});function tt(t,e){return new AI({type:"union",options:t,...M.normalizeParams(e)})}var fM=$("ZodDiscriminatedUnion",(t,e)=>{AI.init(t,e),d_.init(t,e)});function ov(t,e,r){return new fM({type:"union",options:e,discriminator:t,...M.normalizeParams(r)})}var mM=$("ZodIntersection",(t,e)=>{p_.init(t,e),Ae.init(t,e)});function Qp(t,e){return new mM({type:"intersection",left:t,right:e})}var hM=$("ZodTuple",(t,e)=>{lp.init(t,e),Ae.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});function gM(t,e,r){let n=e instanceof ye,o=n?r:e,i=n?e:null;return new hM({type:"tuple",items:t,rest:i,...M.normalizeParams(o)})}var OI=$("ZodRecord",(t,e)=>{f_.init(t,e),Ae.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function bt(t,e,r){return new OI({type:"record",keyType:t,valueType:e,...M.normalizeParams(r)})}function ZH(t,e,r){let n=Qe(t);return n._zod.values=void 0,new OI({type:"record",keyType:n,valueType:e,...M.normalizeParams(r)})}var _M=$("ZodMap",(t,e)=>{m_.init(t,e),Ae.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function qH(t,e,r){return new _M({type:"map",keyType:t,valueType:e,...M.normalizeParams(r)})}var yM=$("ZodSet",(t,e)=>{h_.init(t,e),Ae.init(t,e),t.min=(...r)=>t.check(es(...r)),t.nonempty=r=>t.check(es(1,r)),t.max=(...r)=>t.check($a(...r)),t.size=(...r)=>t.check(Mu(...r))});function VH(t,e){return new yM({type:"set",valueType:t,...M.normalizeParams(e)})}var Gp=$("ZodEnum",(t,e)=>{g_.init(t,e),Ae.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Gp({...e,checks:[],...M.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Gp({...e,checks:[],...M.normalizeParams(o),entries:i})}});function zt(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Gp({type:"enum",entries:r,...M.normalizeParams(e)})}function GH(t,e){return new Gp({type:"enum",entries:t,...M.normalizeParams(e)})}var vM=$("ZodLiteral",(t,e)=>{__.init(t,e),Ae.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function se(t,e){return new vM({type:"literal",values:Array.isArray(t)?t:[t],...M.normalizeParams(e)})}var bM=$("ZodFile",(t,e)=>{y_.init(t,e),Ae.init(t,e),t.min=(r,n)=>t.check(es(r,n)),t.max=(r,n)=>t.check($a(r,n)),t.mime=(r,n)=>t.check(Zu(Array.isArray(r)?r:[r],n))});function KH(t){return vy(bM,t)}var wM=$("ZodTransform",(t,e)=>{v_.init(t,e),Ae.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Gi(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(M.issue(i,r.value,e));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(M.issue(s))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function PI(t){return new wM({type:"transform",transform:t})}var CI=$("ZodOptional",(t,e)=>{xa.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function ie(t){return new CI({type:"optional",innerType:t})}var xM=$("ZodNullable",(t,e)=>{b_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Qy(t){return new xM({type:"nullable",innerType:t})}function HH(t){return ie(Qy(t))}var $M=$("ZodDefault",(t,e)=>{w_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function IM(t,e){return new $M({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var SM=$("ZodPrefault",(t,e)=>{x_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function kM(t,e){return new SM({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var RI=$("ZodNonOptional",(t,e)=>{$_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function TM(t,e){return new RI({type:"nonoptional",innerType:t,...M.normalizeParams(e)})}var EM=$("ZodSuccess",(t,e)=>{I_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function WH(t){return new EM({type:"success",innerType:t})}var AM=$("ZodCatch",(t,e)=>{S_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function OM(t,e){return new AM({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var PM=$("ZodNaN",(t,e)=>{k_.init(t,e),Ae.init(t,e)});function JH(t){return fy(PM,t)}var NI=$("ZodPipe",(t,e)=>{T_.init(t,e),Ae.init(t,e),t.in=e.in,t.out=e.out});function ev(t,e){return new NI({type:"pipe",in:t,out:e})}var zI=$("ZodCodec",(t,e)=>{NI.init(t,e),Au.init(t,e)});function XH(t,e,r){return new zI({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var CM=$("ZodReadonly",(t,e)=>{E_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function RM(t){return new CM({type:"readonly",innerType:t})}var NM=$("ZodTemplateLiteral",(t,e)=>{A_.init(t,e),Ae.init(t,e)});function YH(t,e){return new NM({type:"template_literal",parts:t,...M.normalizeParams(e)})}var zM=$("ZodLazy",(t,e)=>{C_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.getter()});function MM(t){return new zM({type:"lazy",getter:t})}var jM=$("ZodPromise",(t,e)=>{P_.init(t,e),Ae.init(t,e),t.unwrap=()=>t._zod.def.innerType});function QH(t){return new jM({type:"promise",innerType:t})}var DM=$("ZodFunction",(t,e)=>{O_.init(t,e),Ae.init(t,e)});function eW(t){return new DM({type:"function",input:Array.isArray(t?.input)?gM(t?.input):t?.input??Re(ft()),output:t?.output??ft()})}var iv=$("ZodCustom",(t,e)=>{R_.init(t,e),Ae.init(t,e)});function tW(t){let e=new Je({check:"custom"});return e._zod.check=t,e}function MI(t,e){return by(iv,t??(()=>!0),e)}function LM(t,e={}){return wy(iv,t,e)}function UM(t){return xy(t)}var rW=$y,nW=Iy;function oW(t,e={error:`Input not instance of ${t.name}`}){let r=new iv({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...M.normalizeParams(e)});return r._zod.bag.Class=t,r}var iW=(...t)=>Sy({Codec:zI,Boolean:Jp,String:Kp},...t);function sW(t){let e=MM(()=>tt([A(t),We(),Nt(),Yp(),Re(e),bt(A(),e)]));return e}function sv(t,e){return ev(PI(t),e)}var aW={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function cW(t){yt({customError:t})}function uW(){return yt().customError}var jI;jI||(jI={});var DI={};gi(DI,{bigint:()=>fW,boolean:()=>pW,date:()=>mW,number:()=>dW,string:()=>lW});function lW(t){return U_(Kp,t)}function dW(t){return H_(Wp,t)}function pW(t){return ty(Jp,t)}function fW(t){return ny(Xp,t)}function mW(t){return py(rv,t)}yt(N_());var hW=Symbol("Let zodToJsonSchema decide on which parser to use");var bW={};G(bW,{BasePromptValue:()=>cv,ChatPromptValue:()=>UI,ImagePromptValue:()=>wW,StringPromptValue:()=>LI});var cv=class extends uo{},LI=class extends cv{static lc_name(){return"StringPromptValue"}lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;value;constructor(t){super({value:t}),this.value=t}toString(){return this.value}toChatMessages(){return[new mr(this.value)]}},UI=class extends cv{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ChatPromptValue"}messages;constructor(t){Array.isArray(t)&&(t={messages:t}),super(t),this.messages=t.messages}toString(){return au(this.messages)}toChatMessages(){return this.messages}},wW=class extends cv{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ImagePromptValue"}imageUrl;value;constructor(t){"imageUrl"in t||(t={imageUrl:t}),super(t),this.imageUrl=t.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new mr({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}};var te="0123456789abcdef".split(""),xW=[-2147483648,8388608,32768,128],Hn=[24,16,8,0],uv=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Ut=[];function Wn(t,e){e?(Ut[0]=Ut[16]=Ut[1]=Ut[2]=Ut[3]=Ut[4]=Ut[5]=Ut[6]=Ut[7]=Ut[8]=Ut[9]=Ut[10]=Ut[11]=Ut[12]=Ut[13]=Ut[14]=Ut[15]=0,this.blocks=Ut):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}Wn.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if(r!=="string"){if(r==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);e=!0}for(var n,o=0,i,s=t.length,a=this.blocks;o>>2]|=t[o]<>>2]|=n<>>2]|=(192|n>>>6)<>>2]|=(128|n&63)<=57344?(a[i>>>2]|=(224|n>>>12)<>>2]|=(128|n>>>6&63)<>>2]|=(128|n&63)<>>2]|=(240|n>>>18)<>>2]|=(128|n>>>12&63)<>>2]|=(128|n>>>6&63)<>>2]|=(128|n&63)<=64?(this.block=a[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};Wn.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=xW[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}};Wn.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=this.blocks,u,l,d,f,p,m,h,_,v,b,x;for(u=16;u<64;++u)p=c[u-15],l=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=c[u-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,c[u]=c[u-16]+l+c[u-7]+d<<0;for(x=e&r,u=0;u<64;u+=4)this.first?(this.is224?(_=300032,p=c[0]-1413257819,a=p-150054599<<0,n=p+24177077<<0):(_=704751109,p=c[0]-210244248,a=p-1521486534<<0,n=p+143694565<<0),this.first=!1):(l=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),_=t&e,f=_^t&r^x,h=o&i^~o&s,p=a+d+h+uv[u]+c[u],m=l+f,a=n+p<<0,n=p+m<<0),l=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),v=n&t,f=v^n&e^_,h=s&a^~s&o,p=i+d+h+uv[u+1]+c[u+1],m=l+f,s=r+p<<0,r=p+m<<0,l=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=r&n,f=b^r&t^v,h=i&s^~i&a,p=o+d+h+uv[u+2]+c[u+2],m=l+f,i=e+p<<0,e=p+m<<0,l=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),x=e&r,f=x^e&n^b,h=i&s^~i&a,p=o+d+h+uv[u+3]+c[u+3],m=l+f,o=t+p<<0,t=p+m<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0,this.h5=this.h5+i<<0,this.h6=this.h6+s<<0,this.h7=this.h7+a<<0};Wn.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=te[t>>>28&15]+te[t>>>24&15]+te[t>>>20&15]+te[t>>>16&15]+te[t>>>12&15]+te[t>>>8&15]+te[t>>>4&15]+te[t&15]+te[e>>>28&15]+te[e>>>24&15]+te[e>>>20&15]+te[e>>>16&15]+te[e>>>12&15]+te[e>>>8&15]+te[e>>>4&15]+te[e&15]+te[r>>>28&15]+te[r>>>24&15]+te[r>>>20&15]+te[r>>>16&15]+te[r>>>12&15]+te[r>>>8&15]+te[r>>>4&15]+te[r&15]+te[n>>>28&15]+te[n>>>24&15]+te[n>>>20&15]+te[n>>>16&15]+te[n>>>12&15]+te[n>>>8&15]+te[n>>>4&15]+te[n&15]+te[o>>>28&15]+te[o>>>24&15]+te[o>>>20&15]+te[o>>>16&15]+te[o>>>12&15]+te[o>>>8&15]+te[o>>>4&15]+te[o&15]+te[i>>>28&15]+te[i>>>24&15]+te[i>>>20&15]+te[i>>>16&15]+te[i>>>12&15]+te[i>>>8&15]+te[i>>>4&15]+te[i&15]+te[s>>>28&15]+te[s>>>24&15]+te[s>>>20&15]+te[s>>>16&15]+te[s>>>12&15]+te[s>>>8&15]+te[s>>>4&15]+te[s&15];return this.is224||(c+=te[a>>>28&15]+te[a>>>24&15]+te[a>>>20&15]+te[a>>>16&15]+te[a>>>12&15]+te[a>>>8&15]+te[a>>>4&15]+te[a&15]),c};Wn.prototype.toString=Wn.prototype.hex;Wn.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,c=[t>>>24&255,t>>>16&255,t>>>8&255,t&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255];return this.is224||c.push(a>>>24&255,a>>>16&255,a>>>8&255,a&255),c};Wn.prototype.array=Wn.prototype.digest;Wn.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};var lv=(...t)=>new Wn(!1,!0).update(t.join("")).hex();var $W={};G($W,{sha256:()=>lv});var IW={};G(IW,{BaseCache:()=>ZM,InMemoryCache:()=>FI,defaultHashKeyEncoder:()=>BM,deserializeStoredGeneration:()=>SW,serializeGeneration:()=>kW});var BM=(...t)=>lv(t.join("_"));function SW(t){return t.message!==void 0?{text:t.text,message:Ed(t.message)}:{text:t.text}}function kW(t){let e={text:t.text};return t.message!==void 0&&(e.message=t.message.toDict()),e}var ZM=class{keyEncoder=BM;makeDefaultKeyEncoder(t){this.keyEncoder=t}},TW=new Map,FI=class qM extends ZM{cache;constructor(e){super(),this.cache=e??new Map}lookup(e,r){return Promise.resolve(this.cache.get(this.keyEncoder(e,r))??null)}async update(e,r,n){this.cache.set(this.keyEncoder(e,r),n)}static global(){return new qM(TW)}};var HM=mn(KM(),1),zW=Object.defineProperty,MW=(t,e,r)=>e in t?zW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jW=(t,e,r)=>(MW(t,typeof e!="symbol"?e+"":e,r),r);function DW(t,e){let r=Array.from({length:t.length},(n,o)=>({start:o,end:o+1}));for(;r.length>1;){let n=null;for(let o=0;oe.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function UW(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}var ZI=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(t,e){this.patStr=t.pat_str;let r=t.bpe_ranks.split(` +`).filter(Boolean).reduce((n,o)=>{let[i,s,...a]=o.split(" "),c=Number.parseInt(s,10);return a.forEach((u,l)=>n[u]=c+l),n},{});for(let[n,o]of Object.entries(r)){let i=HM.default.toByteArray(n);this.rankMap.set(i.join(","),o),this.textMap.set(o,i)}this.specialTokens={...t.special_tokens,...e},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((n,[o,i])=>(n[i]=this.textEncoder.encode(o),n),{})}encode(t,e=[],r="all"){let n=new RegExp(this.patStr,"ug"),o=ZI.specialTokenRegex(Object.keys(this.specialTokens)),i=[],s=new Set(e==="all"?Object.keys(this.specialTokens):e),a=new Set(r==="all"?Object.keys(this.specialTokens).filter(u=>!s.has(u)):r);if(a.size>0){let u=ZI.specialTokenRegex([...a]),l=t.match(u);if(l!=null)throw new Error(`The text contains a special token that is not allowed: ${l[0]}`)}let c=0;for(;;){let u=null,l=c;for(;o.lastIndex=l,u=o.exec(t),!(u==null||s.has(u[0]));)l=u.index+1;let d=u?.index??t.length;for(let p of t.substring(c,d).matchAll(n)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){i.push(h);continue}i.push(...LW(m,this.rankMap))}if(u==null)break;let f=this.specialTokens[u[0]];i.push(f),c=u.index+u[0].length}return i}decode(t){let e=[],r=0;for(let i=0;inew RegExp(t.map(e=>UW(e)).join("|"),"g"));function qI(t){switch(t){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw new Error("Unknown model")}}var FW={};G(FW,{encodingForModel:()=>mv,getEncoding:()=>WM});var fv={},BW=new Xo({});async function WM(t){return t in fv||(fv[t]=BW.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new pv(e)).catch(e=>{throw delete fv[t],e})),await fv[t]}async function mv(t){return WM(qI(t))}var ZW={};G(ZW,{BaseLangChain:()=>_v,BaseLanguageModel:()=>tf,calculateMaxTokens:()=>XM,getEmbeddingContextSize:()=>qW,getModelContextSize:()=>JM,getModelNameForTiktoken:()=>hv,isOpenAITool:()=>gv});var hv=t=>t.startsWith("gpt-5")?"gpt-5":t.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":t.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":t.startsWith("gpt-4-32k")?"gpt-4-32k":t.startsWith("gpt-4-")?"gpt-4":t.startsWith("gpt-4o")?"gpt-4o":t,qW=t=>{switch(t){case"text-embedding-ada-002":return 8191;default:return 2046}},JM=t=>{switch(hv(t)){case"gpt-5":case"gpt-5-turbo":case"gpt-5-turbo-preview":return 4e5;case"gpt-4o":case"gpt-4o-mini":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":return 128e3;case"gpt-4-turbo":case"gpt-4-turbo-preview":case"gpt-4-turbo-2024-04-09":case"gpt-4-0125-preview":case"gpt-4-1106-preview":return 128e3;case"gpt-4-32k":case"gpt-4-32k-0314":case"gpt-4-32k-0613":return 32768;case"gpt-4":case"gpt-4-0314":case"gpt-4-0613":return 8192;case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-16k-0613":return 16384;case"gpt-3.5-turbo":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-1106":case"gpt-3.5-turbo-0125":return 4096;case"text-davinci-003":case"text-davinci-002":return 4097;case"text-davinci-001":return 2049;case"text-curie-001":case"text-babbage-001":case"text-ada-001":return 2048;case"code-davinci-002":case"code-davinci-001":return 8e3;case"code-cushman-001":return 2048;case"claude-3-5-sonnet-20241022":case"claude-3-5-sonnet-20240620":case"claude-3-opus-20240229":case"claude-3-sonnet-20240229":case"claude-3-haiku-20240307":case"claude-2.1":return 2e5;case"claude-2.0":case"claude-instant-1.2":return 1e5;case"gemini-1.5-pro":case"gemini-1.5-pro-latest":case"gemini-1.5-flash":case"gemini-1.5-flash-latest":return 1e6;case"gemini-pro":case"gemini-pro-vision":return 32768;default:return 4097}};function gv(t){return typeof t!="object"||!t?!1:!!("type"in t&&t.type==="function"&&"function"in t&&typeof t.function=="object"&&t.function&&"name"in t.function&&"parameters"in t.function)}var XM=async({prompt:t,modelName:e})=>{let r;try{r=(await mv(hv(e))).encode(t).length}catch{console.warn("Failed to calculate number of tokens, falling back to approximate count"),r=Math.ceil(t.length/4)}return JM(e)-r},VW=()=>!1,_v=class extends Ze{verbose;callbacks;tags;metadata;get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(t){super(t),this.verbose=t.verbose??VW(),this.callbacks=t.callbacks,this.tags=t.tags??[],this.metadata=t.metadata??{}}},tf=class extends _v{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}caller;cache;constructor({callbacks:t,callbackManager:e,...r}){let{cache:n,...o}=r;super({callbacks:t??e,...o}),typeof n=="object"?this.cache=n:n?this.cache=FI.global():this.cache=void 0,this.caller=new Xo(r??{})}_encoding;async getNumTokens(t){let e;typeof t=="string"?e=t:e=t.map(n=>typeof n=="string"?n:n.type==="text"&&"text"in n?n.text:"").join("");let r=Math.ceil(e.length/4);if(!this._encoding)try{this._encoding=await mv("modelName"in this?hv(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(e).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(t){return typeof t=="string"?new LI(t):Array.isArray(t)?new UI(t.map(ji)):t}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:t,...e}){let r={...this._identifyingParams(),...e,_type:this._llmType(),_model:this._modelType()};return Object.entries(r).filter(([i,s])=>s!==void 0).map(([i,s])=>`${i}:${JSON.stringify(s)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(t){throw new Error("Use .toJSON() instead")}get profile(){return{}}};var ii=class extends Ze{static lc_name(){return"RunnablePassthrough"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;func;constructor(t){super(t),t&&(this.func=t.func)}async invoke(t,e){let r=Pe(e);return this.func&&await this.func(t,r),this._callWithConfig(n=>Promise.resolve(n),t,r)}async*transform(t,e){let r=Pe(e),n,o=!0;for await(let i of this._transformStreamWithConfig(t,s=>s,r))if(yield i,o)if(n===void 0)n=i;else try{n=en(n,i)}catch{n=void 0,o=!1}this.func&&n!==void 0&&await this.func(n,r)}static assign(t){return new Bp(new us({steps:t}))}};var YM=t=>t();function yv(t){let e=t.constructor;return new e({...t,content:t.contentBlocks,response_metadata:{...t.response_metadata,output_version:"v1"}})}var GW={};G(GW,{BaseChatModel:()=>vv,SimpleChatModel:()=>KW});function VI(t){let e=[];for(let r of t){let n=r;if(Array.isArray(r.content))for(let o=0;o{let r=e.outputVersion??It("LC_OUTPUT_VERSION");return r&&["v0","v1"].includes(r)?r:"v0"})}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async invoke(e,r){let n=Ga._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].message}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}async*_streamIterator(e,r){if(this._streamResponseChunks===Ga.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(e,r);else{let o=Ga._convertInputToPromptValue(e).toChatMessages(),[i,s]=this._separateRunnableConfigFromCallOptionsCompat(r),a={...i.metadata,...this.getLsParams(s)},c=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,a,this.metadata,{verbose:this.verbose}),u={options:s,invocation_params:this?.invocationParams(s),batch_size:1},l=s.outputVersion??this.outputVersion,d=await c?.handleChatModelStart(this.toJSON(),[VI(o)],i.runId,void 0,u,void 0,void 0,i.runName),f,p;try{for await(let m of this._streamResponseChunks(o,s,d?.[0])){if(m.message.id==null){let h=d?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}m.message.response_metadata={...m.generationInfo,...m.message.response_metadata},l==="v1"?yield yv(m.message):yield m.message,f?f=f.concat(m):f=m,Td(m.message)&&m.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:m.message.usage_metadata.input_tokens,completionTokens:m.message.usage_metadata.output_tokens,totalTokens:m.message.usage_metadata.total_tokens}})}}catch(m){throw await Promise.all((d??[]).map(h=>h?.handleLLMError(m))),m}await Promise.all((d??[]).map(m=>m?.handleLLMEnd({generations:[[f]],llmOutput:p})))}}getLsParams(e){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:r}}async _generateUncached(e,r,n,o){let i=e.map(f=>f.map(ji)),s;if(o!==void 0&&o.length===i.length)s=o;else{let f={...n.metadata,...this.getLsParams(r)},p=await St.configure(n.callbacks,this.callbacks,n.tags,this.tags,f,this.metadata,{verbose:this.verbose}),m={options:r,invocation_params:this?.invocationParams(r),batch_size:1};s=await p?.handleChatModelStart(this.toJSON(),i.map(VI),n.runId,void 0,m,void 0,void 0,n.runName)}let a=r.outputVersion??this.outputVersion,c=[],u=[];if(!!s?.[0].handlers.find(Od)&&!this.disableStreaming&&i.length===1&&this._streamResponseChunks!==Ga.prototype._streamResponseChunks)try{let f=await this._streamResponseChunks(i[0],r,s?.[0]),p,m;for await(let h of f){if(h.message.id==null){let _=s?.at(0)?.runId;_!=null&&h.message._updateId(`run-${_}`)}p===void 0?p=h:p=en(p,h),Td(h.message)&&h.message.usage_metadata!==void 0&&(m={tokenUsage:{promptTokens:h.message.usage_metadata.input_tokens,completionTokens:h.message.usage_metadata.output_tokens,totalTokens:h.message.usage_metadata.total_tokens}})}if(p===void 0)throw new Error("Received empty response from chat model call.");c.push([p]),await s?.[0].handleLLMEnd({generations:c,llmOutput:m})}catch(f){throw await s?.[0].handleLLMError(f),f}else{let f=await Promise.allSettled(i.map(async(p,m)=>{let h=await this._generate(p,{...r,promptIndex:m},s?.[m]);if(a==="v1")for(let _ of h.generations)_.message=yv(_.message);return h}));await Promise.all(f.map(async(p,m)=>{if(p.status==="fulfilled"){let h=p.value;for(let _ of h.generations){if(_.message.id==null){let v=s?.at(0)?.runId;v!=null&&_.message._updateId(`run-${v}`)}_.message.response_metadata={..._.generationInfo,..._.message.response_metadata}}return h.generations.length===1&&(h.generations[0].message.response_metadata={...h.llmOutput,...h.generations[0].message.response_metadata}),c[m]=h.generations,u[m]=h.llmOutput,s?.[m]?.handleLLMEnd({generations:[h.generations],llmOutput:h.llmOutput})}else return await s?.[m]?.handleLLMError(p.reason),Promise.reject(p.reason)}))}let d={generations:c,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(d,ya,{value:s?{runIds:s?.map(f=>f.runId)}:void 0,configurable:!0}),d}async _generateCached({messages:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i}){let s=e.map(v=>v.map(ji)),a={...i.metadata,...this.getLsParams(o)},c=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,a,this.metadata,{verbose:this.verbose}),u={options:o,invocation_params:this?.invocationParams(o),batch_size:1},l=await c?.handleChatModelStart(this.toJSON(),s.map(VI),i.runId,void 0,u,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(s.map(async(v,b)=>{let x=Ga._convertInputToPromptValue(v).toString(),k=await r.lookup(x,n);return k==null&&d.push(b),k}))).map((v,b)=>({result:v,runManager:l?.[b]})).filter(({result:v})=>v.status==="fulfilled"&&v.value!=null||v.status==="rejected"),m=o.outputVersion??this.outputVersion,h=[];await Promise.all(p.map(async({result:v,runManager:b},x)=>{if(v.status==="fulfilled"){let k=v.value;return h[x]=k.map(T=>("message"in T&&Yr(T.message)&&aa(T.message)&&(T.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},m==="v1"&&(T.message=yv(T.message))),T.generationInfo={...T.generationInfo,tokenUsage:{}},T)),k.length&&await b?.handleLLMNewToken(k[0].text),b?.handleLLMEnd({generations:[k]},void 0,void 0,void 0,{cached:!0})}else return await b?.handleLLMError(v.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(v.reason)}));let _={generations:h,missingPromptIndices:d,startedRunManagers:l};return Object.defineProperty(_,ya,{value:l?{runIds:l?.map(v=>v.runId)}:void 0,configurable:!0}),_}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(m=>m.map(ji)),[s,a]=this._separateRunnableConfigFromCallOptionsCompat(o);if(s.callbacks=s.callbacks??n,!this.cache)return this._generateUncached(i,a,s);let{cache:c}=this,u=this._getSerializedCacheKeyParametersForCall(a),{generations:l,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:i,cache:c,llmStringKey:u,parsedOptions:a,handledOptions:s}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>i[h]),a,s,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,_)=>{let v=d[_];l[v]=h;let b=Ga._convertInputToPromptValue(i[v]).toString();return c.update(b,u,h)})),p=m.llmOutput??{}}return{generations:l,llmOutput:p}}invocationParams(e){return{}}_modelType(){return"base_chat_model"}async generatePrompt(e,r,n){let o=e.map(i=>i.toChatMessages());return this.generate(o,r,n)}withStructuredOutput(e,r){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(r?.strict)throw new Error('"strict" mode is not supported for this model by default.');let n=e,o=r?.name,i=rs(n)??"A function available to call.",s=r?.method,a=r?.includeRaw;if(s==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let c=o??"extract",u;on(n)?u=[{type:"function",function:{name:c,description:i,parameters:an(n)}}]:("name"in n&&(c=n.name),u=[{type:"function",function:{name:c,description:i,parameters:n}}]);let l=this.bindTools(u),d=Dr.from(h=>{if(!Dt.isInstance(h))throw new Error("Input is not an AIMessageChunk.");if(!h.tool_calls||h.tool_calls.length===0)throw new Error("No tool calls found in the response.");let _=h.tool_calls.find(v=>v.name===c);if(!_)throw new Error(`No tool call found with name ${c}.`);return _.args});if(!a)return l.pipe(d).withConfig({runName:"StructuredOutput"});let f=ii.assign({parsed:(h,_)=>d.invoke(h.raw,_)}),p=ii.assign({parsed:()=>null}),m=f.withFallbacks({fallbacks:[p]});return cs.from([{raw:l},m]).withConfig({runName:"StructuredOutputRunnable"})}},KW=class extends vv{async _generate(t,e,r){let n=await this._call(t,e,r),o=new jt(n);if(typeof o.content!="string")throw new Error("Cannot generate with a simple chat model when output is not a string.");return{generations:[{text:o.content,message:o}]}}};var QM=class extends Ze{static lc_name(){return"RouterRunnable"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnables;constructor(t){super(t),this.runnables=t.runnables}async invoke(t,e){let{key:r,input:n}=t,o=this.runnables[r];if(o===void 0)throw new Error(`No runnable associated with key "${r}".`);return o.invoke(n,Pe(e))}async batch(t,e,r){let n=t.map(d=>d.key),o=t.map(d=>d.input);if(n.find(d=>this.runnables[d]===void 0)!==void 0)throw new Error("One or more keys do not have a corresponding runnable.");let s=n.map(d=>this.runnables[d]),a=this._getOptionsList(e??{},t.length),c=a[0]?.maxConcurrency??r?.maxConcurrency,u=c&&c>0?c:t.length,l=[];for(let d=0;ds[h].invoke(m,a[h])),p=await Promise.all(f);l.push(p)}return l.flat()}async stream(t,e){let{key:r,input:n}=t,o=this.runnables[r];if(o===void 0)throw new Error(`No runnable associated with key "${r}".`);return o.stream(n,e)}};var ej=class extends Ze{static lc_name(){return"RunnableBranch"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;default;branches;constructor(t){super(t),this.branches=t.branches,this.default=t.default}static from(t){if(t.length<1)throw new Error("RunnableBranch requires at least one branch");let r=t.slice(0,-1).map(([o,i])=>[cn(o),cn(i)]),n=cn(t[t.length-1]);return new this({branches:r,default:n})}async _invoke(t,e,r){let n;for(let o=0;othis._enterHistory(i,s??{})).withConfig({runName:"loadHistory"}),r=t.historyMessagesKey??t.inputMessagesKey;r&&(e=ii.assign({[r]:e}).withConfig({runName:"insertHistory"}));let n=e.pipe(t.runnable.withListeners({onEnd:(i,s)=>this._exitHistory(i,s??{})})).withConfig({runName:"RunnableWithMessageHistory"}),o=t.config??{};super({...t,config:o,bound:n}),this.runnable=t.runnable,this.getMessageHistory=t.getMessageHistory,this.inputMessagesKey=t.inputMessagesKey,this.outputMessagesKey=t.outputMessagesKey,this.historyMessagesKey=t.historyMessagesKey}_getInputMessages(t){let e;if(typeof t=="object"&&!Array.isArray(t)&&!Yr(t)){let r;this.inputMessagesKey?r=this.inputMessagesKey:Object.keys(t).length===1?r=Object.keys(t)[0]:r="input",Array.isArray(t[r])&&Array.isArray(t[r][0])?e=t[r][0]:e=t[r]}else e=t;if(typeof e=="string")return[new mr(e)];if(Array.isArray(e))return e;if(Yr(e))return[e];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. +Got ${JSON.stringify(e,null,2)}`)}_getOutputMessages(t){let e;if(!Array.isArray(t)&&!Yr(t)&&typeof t!="string"){let r;this.outputMessagesKey!==void 0?r=this.outputMessagesKey:Object.keys(t).length===1?r=Object.keys(t)[0]:r="output",t.generations!==void 0?e=t.generations[0][0].message:e=t[r]}else e=t;if(typeof e=="string")return[new jt(e)];if(Array.isArray(e))return e;if(Yr(e))return[e];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. Received: ${JSON.stringify(e,null,2)}`)}async _enterHistory(t,e){let n=await(e?.configurable?.messageHistory).getMessages();return this.historyMessagesKey===void 0?n.concat(this._getInputMessages(t)):n}async _exitHistory(t,e){let r=e.configurable?.messageHistory,n;Array.isArray(t.inputs)&&Array.isArray(t.inputs[0])?n=t.inputs[0]:n=t.inputs;let o=this._getInputMessages(n);if(this.historyMessagesKey===void 0){let a=await r.getMessages();o=o.slice(a.length)}let i=t.outputs;if(!i)throw new Error(`Output values from 'Run' undefined. Run: ${JSON.stringify(t,null,2)}`);let s=this._getOutputMessages(i);await r.addMessages([...o,...s])}async _mergeConfig(...t){let e=await super._mergeConfig(...t);if(!e.configurable||!e.configurable.sessionId){let n={[this.inputMessagesKey??"input"]:"foo"},o={configurable:{sessionId:"123"}};throw new Error(`sessionId is required. Pass it in as part of the config argument to .invoke() or .stream() +eg. chain.invoke(${JSON.stringify(n)}, ${JSON.stringify(o)})`)}let{sessionId:r}=e.configurable;return e.configurable.messageHistory=await this.getMessageHistory(r),e}};var HW={};G(HW,{RouterRunnable:()=>QM,Runnable:()=>Ze,RunnableAssign:()=>Bp,RunnableBinding:()=>as,RunnableBranch:()=>ej,RunnableEach:()=>j1,RunnableLambda:()=>Dr,RunnableMap:()=>us,RunnableParallel:()=>B1,RunnablePassthrough:()=>ii,RunnablePick:()=>q$,RunnableRetry:()=>Gy,RunnableSequence:()=>cs,RunnableToolLike:()=>Vy,RunnableWithFallbacks:()=>Z$,RunnableWithMessageHistory:()=>tj,_coerceToRunnable:()=>cn,ensureConfig:()=>Pe,getCallbackManagerForConfig:()=>or,mergeConfigs:()=>ga,patchConfig:()=>Ve,pickRunnableConfigKeys:()=>vr,raceWithSignal:()=>vn});var GI=class extends Ze{parseResultWithPrompt(t,e,r){return this.parseResult(t,r)}_baseMessageToString(t){return typeof t.content=="string"?t.content:this._baseMessageContentToString(t.content)}_baseMessageContentToString(t){return JSON.stringify(t)}async invoke(t,e){return typeof t=="string"?this._callWithConfig(async(r,n)=>this.parseResult([{text:r}],n?.callbacks),t,{...e,runType:"parser"}):this._callWithConfig(async(r,n)=>this.parseResult([{message:r,text:this._baseMessageToString(r)}],n?.callbacks),t,{...e,runType:"parser"})}},Ka=class extends GI{parseResult(t,e){return this.parse(t[0].text,e)}async parseWithPrompt(t,e,r){return this.parse(t,r)}_type(){throw new Error("_type not implemented")}},ln=class extends Error{llmOutput;observation;sendToLLM;constructor(t,e,r,n=!1){if(super(t),this.llmOutput=e,this.observation=r,this.sendToLLM=n,n&&(r===void 0||e===void 0))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");uh(this,"OUTPUT_PARSING_FAILURE")}};var si=class extends Ka{async*_transform(t){for await(let e of t)typeof e=="string"?yield this.parseResult([{text:e}]):yield this.parseResult([{message:e,text:this._baseMessageToString(e)}])}async*transform(t,e){yield*this._transformStreamWithConfig(t,this._transform.bind(this),{...e,runType:"parser"})}},ls=class extends si{diff=!1;constructor(t){super(t),this.diff=t?.diff??this.diff}async*_transform(t){let e,r;for await(let n of t){if(typeof n!="string"&&typeof n.content!="string")throw new Error("Cannot handle non-string output.");let o;if(iu(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");o=new Vi({message:n,text:n.content})}else if(Yr(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");o=new Vi({message:ca(n),text:n.content})}else o=new go({text:n});r===void 0?r=o:r=r.concat(o);let i=await this.parsePartialResult([r]);i!=null&&!$o(i,e)&&(this.diff?yield this._diff(e,i):yield i,e=i)}}getFormatInstructions(){return""}};var WW={};G(WW,{applyPatch:()=>qi,compare:()=>mu});var KI=class extends ls{static lc_name(){return"JsonOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_concatOutputChunks(t,e){return this.diff?super._concatOutputChunks(t,e):e}_diff(t,e){if(e)return t?mu(t,e):[{op:"replace",path:"",value:e}]}async parsePartialResult(t){return kd(t[0].text)}async parse(t){return kd(t,JSON.parse)}getFormatInstructions(){return""}};var rj=class extends si{static lc_name(){return"BytesOutputParser"}lc_namespace=["langchain_core","output_parsers","bytes"];lc_serializable=!0;textEncoder=new TextEncoder;parse(t){return Promise.resolve(this.textEncoder.encode(t))}getFormatInstructions(){return""}};var al=class extends si{re;async*_transform(t){let e="";for await(let r of t)if(typeof r=="string"?e+=r:e+=r.content,this.re){let n=[...e.matchAll(this.re)];if(n.length>1){let o=0;for(let i of n.slice(0,-1))yield[i[1]],o+=(i.index??0)+i[0].length;e=e.slice(o)}}else{let n=await this.parse(e);if(n.length>1){for(let o of n.slice(0,-1))yield[o];e=n[n.length-1]}}for(let r of await this.parse(e))yield[r]}},nj=class extends al{static lc_name(){return"CommaSeparatedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;async parse(t){try{return t.trim().split(",").map(e=>e.trim())}catch{throw new ln(`Could not parse output: ${t}`,t)}}getFormatInstructions(){return"Your response should be a list of comma separated values, eg: `foo, bar, baz`"}},oj=class extends al{lc_namespace=["langchain_core","output_parsers","list"];length;separator;constructor({length:t,separator:e}){super(...arguments),this.length=t,this.separator=e||","}async parse(t){try{let e=t.trim().split(this.separator).map(r=>r.trim());if(this.length!==void 0&&e.length!==this.length)throw new ln(`Incorrect number of items. Expected ${this.length}, got ${e.length}.`);return e}catch(e){throw Object.getPrototypeOf(e)===ln.prototype?e:new ln(`Could not parse output: ${t}`)}}getFormatInstructions(){return`Your response should be a list of ${this.length===void 0?"":`${this.length} `}items separated by "${this.separator}" (eg: \`foo${this.separator} bar${this.separator} baz\`)`}},ij=class extends al{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example: + +1. foo + +2. bar + +3. baz`}re=/\d+\.\s([^\n]+)/g;async parse(t){return[...t.matchAll(this.re)??[]].map(e=>e[1])}},sj=class extends al{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example: + +1. foo + +2. bar + +3. baz`}re=/^\s*[-*]\s([^\n]+)$/gm;async parse(t){return[...t.matchAll(this.re)??[]].map(e=>e[1])}};var aj=class extends si{static lc_name(){return"StrOutputParser"}lc_namespace=["langchain_core","output_parsers","string"];lc_serializable=!0;parse(t){return Promise.resolve(t)}getFormatInstructions(){return""}_textContentToString(t){return t.text}_imageUrlContentToString(t){throw new Error('Cannot coerce a multimodal "image_url" message part into a string.')}_messageContentToString(t){switch(t.type){case"text":case"text_delta":if("text"in t)return this._textContentToString(t);break;case"image_url":if("image_url"in t)return this._imageUrlContentToString(t);break;default:throw new Error(`Cannot coerce "${t.type}" message part into a string.`)}throw new Error(`Invalid content type: ${t.type}`)}_baseMessageContentToString(t){return t.reduce((e,r)=>e+this._messageContentToString(r),"")}};var bv=class extends Ka{static lc_name(){return"StructuredOutputParser"}lc_namespace=["langchain","output_parsers","structured"];toJSON(){return this.toJSONNotImplemented()}constructor(t){super(t),this.schema=t}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=$r.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,$r.string().describe(n)])));return new this(e)}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance. + +"JSON Schema" is a declarative language that allows you to annotate and validate JSON documents. + +For example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}} +would match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings. +Thus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted. + +Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas! + +Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock: +\`\`\`json +${JSON.stringify(an(this.schema))} +\`\`\` +`}async parse(t){try{let e=t.trim(),n=(e.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||e.match(/```json\s*([\s\S]*?)```/)?.[1]||e).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(o,i)=>`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await ts(this.schema,JSON.parse(n))}catch(e){throw new ln(`Failed to parse. Text: "${t}". Error: ${e}`,t)}}},HI=class extends bv{static lc_name(){return"JsonMarkdownStructuredOutputParser"}getFormatInstructions(t){let e=t?.interpolationDepth??1;if(e<1)throw new Error("f string interpolation depth must be at least 1");return`Return a markdown code snippet with a JSON object formatted to look like: +\`\`\`json +${this._schemaToInstruction(an(this.schema)).replaceAll("{","{".repeat(e)).replaceAll("}","}".repeat(e))} +\`\`\``}_schemaToInstruction(t,e=2){let r=t;if("type"in r){let n=!1,o;if(Array.isArray(r.type)){let a=r.type.findIndex(c=>c==="null");a!==-1&&(n=!0,r.type.splice(a,1)),o=r.type.join(" | ")}else o=r.type;if(r.type==="object"&&r.properties){let a=r.description?` // ${r.description}`:"";return`{ +${Object.entries(r.properties).map(([u,l])=>{let d=r.required?.includes(u)?"":" (optional)";return`${" ".repeat(e)}"${u}": ${this._schemaToInstruction(l,e+2)}${d}`}).join(` +`)} +${" ".repeat(e-2)}}${a}`}if(r.type==="array"&&r.items){let a=r.description?` // ${r.description}`:"";return`array[ +${" ".repeat(e)}${this._schemaToInstruction(r.items,e+2)} +${" ".repeat(e-2)}] ${a}`}let i=n?" (nullable)":"",s=r.description?` // ${r.description}`:"";return`${o}${s}${i}`}if("anyOf"in r)return r.anyOf.map(n=>this._schemaToInstruction(n,e)).join(` +${" ".repeat(e-2)}`);throw new Error("unsupported schema type")}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=$r.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,$r.string().describe(n)])));return new this(e)}},cj=class extends Ka{structuredInputParser;constructor({inputSchema:t}){super(...arguments),this.structuredInputParser=new HI(t)}async parse(t){let e;try{e=await this.structuredInputParser.parse(t)}catch(r){throw new ln(`Failed to parse. Text: "${t}". Error: ${r}`,t)}return this.outputProcessor(e)}getFormatInstructions(){return this.structuredInputParser.getFormatInstructions()}};var JW=function(){let t={};t.parser=function(y,g){return new r(y,g)},t.SAXParser=r,t.SAXStream=u,t.createStream=c,t.MAX_BUFFER_LENGTH=65536;let e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(y,g){if(!(this instanceof r))return new r(y,g);var R=this;o(R),R.q=R.c="",R.bufferCheckPosition=t.MAX_BUFFER_LENGTH,R.opt=g||{},R.opt.lowercase=R.opt.lowercase||R.opt.lowercasetags,R.looseCase=R.opt.lowercase?"toLowerCase":"toUpperCase",R.tags=[],R.closed=R.closedRoot=R.sawRoot=!1,R.tag=R.error=null,R.strict=!!y,R.noscript=!!(y||R.opt.noscript),R.state=w.BEGIN,R.strictEntities=R.opt.strictEntities,R.ENTITIES=R.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),R.attribList=[],R.opt.xmlns&&(R.ns=Object.create(m)),R.trackPosition=R.opt.position!==!1,R.trackPosition&&(R.position=R.line=R.column=0),oe(R,"onready")}Object.create||(Object.create=function(y){function g(){}g.prototype=y;var R=new g;return R}),Object.keys||(Object.keys=function(y){var g=[];for(var R in y)y.hasOwnProperty(R)&&g.push(R);return g});function n(y){for(var g=Math.max(t.MAX_BUFFER_LENGTH,10),R=0,I=0,ze=e.length;Ig)switch(e[I]){case"textNode":wt(y);break;case"cdata":Q(y,"oncdata",y.cdata),y.cdata="";break;case"script":Q(y,"onscript",y.script),y.script="";break;default:pn(y,"Max buffer length exceeded: "+e[I])}R=Math.max(R,Ye)}var it=t.MAX_BUFFER_LENGTH-R;y.bufferCheckPosition=it+y.position}function o(y){for(var g=0,R=e.length;g"||x(y)}function F(y,g){return y.test(g)}function J(y,g){return!F(y,g)}var w=0;t.STATE={BEGIN:w++,BEGIN_WHITESPACE:w++,TEXT:w++,TEXT_ENTITY:w++,OPEN_WAKA:w++,SGML_DECL:w++,SGML_DECL_QUOTED:w++,DOCTYPE:w++,DOCTYPE_QUOTED:w++,DOCTYPE_DTD:w++,DOCTYPE_DTD_QUOTED:w++,COMMENT_STARTING:w++,COMMENT:w++,COMMENT_ENDING:w++,COMMENT_ENDED:w++,CDATA:w++,CDATA_ENDING:w++,CDATA_ENDING_2:w++,PROC_INST:w++,PROC_INST_BODY:w++,PROC_INST_ENDING:w++,OPEN_TAG:w++,OPEN_TAG_SLASH:w++,ATTRIB:w++,ATTRIB_NAME:w++,ATTRIB_NAME_SAW_WHITE:w++,ATTRIB_VALUE:w++,ATTRIB_VALUE_QUOTED:w++,ATTRIB_VALUE_CLOSED:w++,ATTRIB_VALUE_UNQUOTED:w++,ATTRIB_VALUE_ENTITY_Q:w++,ATTRIB_VALUE_ENTITY_U:w++,CLOSE_TAG:w++,CLOSE_TAG_SAW_WHITE:w++,SCRIPT:w++,SCRIPT_ENDING:w++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(y){var g=t.ENTITIES[y],R=typeof g=="number"?String.fromCharCode(g):g;t.ENTITIES[y]=R});for(var Z in t.STATE)t.STATE[t.STATE[Z]]=Z;w=t.STATE;function oe(y,g,R){y[g]&&y[g](R)}function Q(y,g,R){y.textNode&&wt(y),oe(y,g,R)}function wt(y){y.textNode=dn(y.opt,y.textNode),y.textNode&&oe(y,"ontext",y.textNode),y.textNode=""}function dn(y,g){return y.trim&&(g=g.trim()),y.normalize&&(g=g.replace(/\s+/g," ")),g}function pn(y,g){return wt(y),y.trackPosition&&(g+=` +Line: `+y.line+` +Column: `+y.column+` +Char: `+y.c),g=new Error(g),y.error=g,oe(y,"onerror",g),y}function No(y){return y.sawRoot&&!y.closedRoot&&qe(y,"Unclosed root tag"),y.state!==w.BEGIN&&y.state!==w.BEGIN_WHITESPACE&&y.state!==w.TEXT&&pn(y,"Unexpected end"),wt(y),y.c="",y.closed=!0,oe(y,"onend"),r.call(y,y.strict,y.opt),y}function qe(y,g){if(typeof y!="object"||!(y instanceof r))throw new Error("bad call to strictFail");y.strict&&pn(y,g)}function Ul(y){y.strict||(y.tagName=y.tagName[y.looseCase]());var g=y.tags[y.tags.length-1]||y,R=y.tag={name:y.tagName,attributes:{}};y.opt.xmlns&&(R.ns=g.ns),y.attribList.length=0,Q(y,"onopentagstart",R)}function Ss(y,g){var R=y.indexOf(":"),I=R<0?["",y]:y.split(":"),ze=I[0],Ye=I[1];return g&&y==="xmlns"&&(ze="xmlns",Ye=""),{prefix:ze,local:Ye}}function ks(y){if(y.strict||(y.attribName=y.attribName[y.looseCase]()),y.attribList.indexOf(y.attribName)!==-1||y.tag.attributes.hasOwnProperty(y.attribName)){y.attribName=y.attribValue="";return}if(y.opt.xmlns){var g=Ss(y.attribName,!0),R=g.prefix,I=g.local;if(R==="xmlns")if(I==="xml"&&y.attribValue!==f)qe(y,"xml: prefix must be bound to "+f+` +Actual: `+y.attribValue);else if(I==="xmlns"&&y.attribValue!==p)qe(y,"xmlns: prefix must be bound to "+p+` +Actual: `+y.attribValue);else{var ze=y.tag,Ye=y.tags[y.tags.length-1]||y;ze.ns===Ye.ns&&(ze.ns=Object.create(Ye.ns)),ze.ns[I]=y.attribValue}y.attribList.push([y.attribName,y.attribValue])}else y.tag.attributes[y.attribName]=y.attribValue,Q(y,"onattribute",{name:y.attribName,value:y.attribValue});y.attribName=y.attribValue=""}function Pn(y,g){if(y.opt.xmlns){var R=y.tag,I=Ss(y.tagName);R.prefix=I.prefix,R.local=I.local,R.uri=R.ns[I.prefix]||"",R.prefix&&!R.uri&&(qe(y,"Unbound namespace prefix: "+JSON.stringify(y.tagName)),R.uri=I.prefix);var ze=y.tags[y.tags.length-1]||y;R.ns&&ze.ns!==R.ns&&Object.keys(R.ns).forEach(function(Ts){Q(y,"onopennamespace",{prefix:Ts,uri:R.ns[Ts]})});for(var Ye=0,it=y.attribList.length;Ye",y.tagName="",y.state=w.SCRIPT;return}Q(y,"onscript",y.script),y.script=""}var g=y.tags.length,R=y.tagName;y.strict||(R=R[y.looseCase]());for(var I=R;g--;){var ze=y.tags[g];if(ze.name!==I)qe(y,"Unexpected close tag");else break}if(g<0){qe(y,"Unmatched closing tag: "+y.tagName),y.textNode+="",y.state=w.TEXT;return}y.tagName=R;for(var Ye=y.tags.length;Ye-- >g;){var it=y.tag=y.tags.pop();y.tagName=y.tag.name,Q(y,"onclosetag",y.tagName);var Tt={};for(var Bt in it.ns)Tt[Bt]=it.ns[Bt];var Rn=y.tags[y.tags.length-1]||y;y.opt.xmlns&&it.ns!==Rn.ns&&Object.keys(it.ns).forEach(function(ht){var fn=it.ns[ht];Q(y,"onclosenamespace",{prefix:ht,uri:fn})})}g===0&&(y.closedRoot=!0),y.tagName=y.attribValue=y.attribName="",y.attribList.length=0,y.state=w.TEXT}function Fl(y){var g=y.entity,R=g.toLowerCase(),I,ze="";return y.ENTITIES[g]?y.ENTITIES[g]:y.ENTITIES[R]?y.ENTITIES[R]:(g=R,g.charAt(0)==="#"&&(g.charAt(1)==="x"?(g=g.slice(2),I=parseInt(g,16),ze=I.toString(16)):(g=g.slice(1),I=parseInt(g,10),ze=I.toString(10))),g=g.replace(/^0+/,""),isNaN(I)||ze.toLowerCase()!==g?(qe(y,"Invalid character entity"),"&"+y.entity+";"):String.fromCodePoint(I))}function Bl(y,g){g==="<"?(y.state=w.OPEN_WAKA,y.startTagPosition=y.position):x(g)||(qe(y,"Non-whitespace before first tag."),y.textNode=g,y.state=w.TEXT)}function Zl(y,g){var R="";return g"?(Q(g,"onsgmldeclaration",g.sgmlDecl),g.sgmlDecl="",g.state=w.TEXT):(k(I)&&(g.state=w.SGML_DECL_QUOTED),g.sgmlDecl+=I);continue;case w.SGML_DECL_QUOTED:I===g.q&&(g.state=w.SGML_DECL,g.q=""),g.sgmlDecl+=I;continue;case w.DOCTYPE:I===">"?(g.state=w.TEXT,Q(g,"ondoctype",g.doctype),g.doctype=!0):(g.doctype+=I,I==="["?g.state=w.DOCTYPE_DTD:k(I)&&(g.state=w.DOCTYPE_QUOTED,g.q=I));continue;case w.DOCTYPE_QUOTED:g.doctype+=I,I===g.q&&(g.q="",g.state=w.DOCTYPE);continue;case w.DOCTYPE_DTD:g.doctype+=I,I==="]"?g.state=w.DOCTYPE:k(I)&&(g.state=w.DOCTYPE_DTD_QUOTED,g.q=I);continue;case w.DOCTYPE_DTD_QUOTED:g.doctype+=I,I===g.q&&(g.state=w.DOCTYPE_DTD,g.q="");continue;case w.COMMENT:I==="-"?g.state=w.COMMENT_ENDING:g.comment+=I;continue;case w.COMMENT_ENDING:I==="-"?(g.state=w.COMMENT_ENDED,g.comment=dn(g.opt,g.comment),g.comment&&Q(g,"oncomment",g.comment),g.comment=""):(g.comment+="-"+I,g.state=w.COMMENT);continue;case w.COMMENT_ENDED:I!==">"?(qe(g,"Malformed comment"),g.comment+="--"+I,g.state=w.COMMENT):g.state=w.TEXT;continue;case w.CDATA:I==="]"?g.state=w.CDATA_ENDING:g.cdata+=I;continue;case w.CDATA_ENDING:I==="]"?g.state=w.CDATA_ENDING_2:(g.cdata+="]"+I,g.state=w.CDATA);continue;case w.CDATA_ENDING_2:I===">"?(g.cdata&&Q(g,"oncdata",g.cdata),Q(g,"onclosecdata"),g.cdata="",g.state=w.TEXT):I==="]"?g.cdata+="]":(g.cdata+="]]"+I,g.state=w.CDATA);continue;case w.PROC_INST:I==="?"?g.state=w.PROC_INST_ENDING:x(I)?g.state=w.PROC_INST_BODY:g.procInstName+=I;continue;case w.PROC_INST_BODY:if(!g.procInstBody&&x(I))continue;I==="?"?g.state=w.PROC_INST_ENDING:g.procInstBody+=I;continue;case w.PROC_INST_ENDING:I===">"?(Q(g,"onprocessinginstruction",{name:g.procInstName,body:g.procInstBody}),g.procInstName=g.procInstBody="",g.state=w.TEXT):(g.procInstBody+="?"+I,g.state=w.PROC_INST_BODY);continue;case w.OPEN_TAG:F(_,I)?g.tagName+=I:(Ul(g),I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:(x(I)||qe(g,"Invalid character in tag name"),g.state=w.ATTRIB));continue;case w.OPEN_TAG_SLASH:I===">"?(Pn(g,!0),zo(g)):(qe(g,"Forward-slash in opening tag not followed by >"),g.state=w.ATTRIB);continue;case w.ATTRIB:if(x(I))continue;I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:F(h,I)?(g.attribName=I,g.attribValue="",g.state=w.ATTRIB_NAME):qe(g,"Invalid attribute name");continue;case w.ATTRIB_NAME:I==="="?g.state=w.ATTRIB_VALUE:I===">"?(qe(g,"Attribute without value"),g.attribValue=g.attribName,ks(g),Pn(g)):x(I)?g.state=w.ATTRIB_NAME_SAW_WHITE:F(_,I)?g.attribName+=I:qe(g,"Invalid attribute name");continue;case w.ATTRIB_NAME_SAW_WHITE:if(I==="=")g.state=w.ATTRIB_VALUE;else{if(x(I))continue;qe(g,"Attribute without value"),g.tag.attributes[g.attribName]="",g.attribValue="",Q(g,"onattribute",{name:g.attribName,value:""}),g.attribName="",I===">"?Pn(g):F(h,I)?(g.attribName=I,g.state=w.ATTRIB_NAME):(qe(g,"Invalid attribute name"),g.state=w.ATTRIB)}continue;case w.ATTRIB_VALUE:if(x(I))continue;k(I)?(g.q=I,g.state=w.ATTRIB_VALUE_QUOTED):(qe(g,"Unquoted attribute value"),g.state=w.ATTRIB_VALUE_UNQUOTED,g.attribValue=I);continue;case w.ATTRIB_VALUE_QUOTED:if(I!==g.q){I==="&"?g.state=w.ATTRIB_VALUE_ENTITY_Q:g.attribValue+=I;continue}ks(g),g.q="",g.state=w.ATTRIB_VALUE_CLOSED;continue;case w.ATTRIB_VALUE_CLOSED:x(I)?g.state=w.ATTRIB:I===">"?Pn(g):I==="/"?g.state=w.OPEN_TAG_SLASH:F(h,I)?(qe(g,"No whitespace between attributes"),g.attribName=I,g.attribValue="",g.state=w.ATTRIB_NAME):qe(g,"Invalid attribute name");continue;case w.ATTRIB_VALUE_UNQUOTED:if(!T(I)){I==="&"?g.state=w.ATTRIB_VALUE_ENTITY_U:g.attribValue+=I;continue}ks(g),I===">"?Pn(g):g.state=w.ATTRIB;continue;case w.CLOSE_TAG:if(g.tagName)I===">"?zo(g):F(_,I)?g.tagName+=I:g.script?(g.script+=""?zo(g):qe(g,"Invalid characters in closing tag");continue;case w.TEXT_ENTITY:case w.ATTRIB_VALUE_ENTITY_Q:case w.ATTRIB_VALUE_ENTITY_U:var it,Tt;switch(g.state){case w.TEXT_ENTITY:it=w.TEXT,Tt="textNode";break;case w.ATTRIB_VALUE_ENTITY_Q:it=w.ATTRIB_VALUE_QUOTED,Tt="attribValue";break;case w.ATTRIB_VALUE_ENTITY_U:it=w.ATTRIB_VALUE_UNQUOTED,Tt="attribValue";break}if(I===";")if(g.opt.unparsedEntities){var Bt=Fl(g);g.entity="",g.state=it,g.write(Bt)}else g[Tt]+=Fl(g),g.entity="",g.state=it;else F(g.entity.length?b:v,I)?g.entity+=I:(qe(g,"Invalid character in entity name"),g[Tt]+="&"+g.entity+I,g.entity="",g.state=it);continue;default:throw new Error(g,"Unknown state: "+g.state)}return g.position>=g.bufferCheckPosition&&n(g),g}return String.fromCodePoint||(function(){var y=String.fromCharCode,g=Math.floor,R=function(){var I=16384,ze=[],Ye,it,Tt=-1,Bt=arguments.length;if(!Bt)return"";for(var Rn="";++Tt1114111||g(ht)!==ht)throw RangeError("Invalid code point: "+ht);ht<=65535?ze.push(ht):(ht-=65536,Ye=(ht>>10)+55296,it=ht%1024+56320,ze.push(Ye,it)),(Tt+1===Bt||ze.length>I)&&(Rn+=y.apply(null,ze),ze.length=0)}return Rn};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:R,configurable:!0,writable:!0}):String.fromCodePoint=R})(),t},uj=JW();var wv=`The output should be formatted as a XML file. +1. Output should conform to the tags below. +2. If tags are not given, make them on your own. +3. Remember to always open and close all the tags. + +As an example, for the tags ["foo", "bar", "baz"]: +1. String " + + + +" is a well-formatted instance of the schema. +2. String " + + " is a badly-formatted instance. +3. String " + + +" is a badly-formatted instance. + +Here are the output tags: +\`\`\` +{tags} +\`\`\``,lj=class extends ls{tags;constructor(t){super(t),this.tags=t?.tags}static lc_name(){return"XMLOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_diff(t,e){if(e)return t?mu(t,e):[{op:"replace",path:"",value:e}]}async parsePartialResult(t){return xv(t[0].text)}async parse(t){return xv(t)}getFormatInstructions(){return!!(this.tags&&this.tags.length>0)?wv.replace("{tags}",this.tags?.join(", ")??""):wv}},XW=t=>t.split(` +`).map(e=>e.replace(/^\s+/,"")).join(` +`).trim(),dj=t=>{if(Object.keys(t).length===0)return{};let e={};return t.children.length>0?(e[t.name]=t.children.map(dj),e):(e[t.name]=t.text??void 0,e)};function xv(t){let e=XW(t),r=uj.parser(!0),n={},o=[];r.onopentag=a=>{let c={name:a.name,attributes:a.attributes,children:[],text:"",isSelfClosing:a.isSelfClosing};o.length>0?o[o.length-1].children.push(c):n=c,a.isSelfClosing||o.push(c)},r.onclosetag=()=>{if(o.length>0){let a=o.pop();o.length===0&&a&&(n=a)}},r.ontext=a=>{if(o.length>0){let c=o[o.length-1];c.text+=a}},r.onattribute=a=>{if(o.length>0){let c=o[o.length-1];c.attributes[a.name]=a.value}};let i=/```(xml)?(.*)```/s.exec(e),s=i?i[2]:e;return r.write(s).close(),n&&n.name==="?xml"&&(n=n.children[0]),dj(n)}var YW={};G(YW,{AsymmetricStructuredOutputParser:()=>cj,BaseCumulativeTransformOutputParser:()=>ls,BaseLLMOutputParser:()=>GI,BaseOutputParser:()=>Ka,BaseTransformOutputParser:()=>si,BytesOutputParser:()=>rj,CommaSeparatedListOutputParser:()=>nj,CustomListOutputParser:()=>oj,JsonMarkdownStructuredOutputParser:()=>HI,JsonOutputParser:()=>KI,ListOutputParser:()=>al,MarkdownListOutputParser:()=>sj,NumberedListOutputParser:()=>ij,OutputParserException:()=>ln,StringOutputParser:()=>aj,StructuredOutputParser:()=>bv,XMLOutputParser:()=>lj,XML_FORMAT_INSTRUCTIONS:()=>wv,parseJsonMarkdown:()=>kd,parsePartialJson:()=>sa,parseXMLMarkdown:()=>xv});function rf(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=sa(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new ln([`Function "${t.function.name}" arguments:`,"",t.function.arguments,"","are not valid JSON.",`Error: ${o.message}`].join(` +`))}let n={name:t.function.name,args:r,type:"tool_call"};return e?.returnId&&(n.id=t.id),n}function WI(t){if(t.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:t.id,type:"function",function:{name:t.name,arguments:JSON.stringify(t.args)}}}function $v(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var JI=class extends ls{static lc_name(){return"JsonOutputToolsParser"}returnId=!1;lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;constructor(t){super(t),this.returnId=t?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(t){return await this.parsePartialResult(t,!1)}async parsePartialResult(t,e=!0){let r=t[0].message,n;if(aa(r)&&r.tool_calls?.length?n=r.tool_calls.map(i=>{let{id:s,...a}=i;return this.returnId?{id:s,...a}:a}):r.additional_kwargs.tool_calls!==void 0&&(n=JSON.parse(JSON.stringify(r.additional_kwargs.tool_calls)).map(s=>rf(s,{returnId:this.returnId,partial:e}))),!n)return[];let o=[];for(let i of n)if(i!==void 0){let s={type:i.name,args:i.args,id:i.id};o.push(s)}return o}},XI=class extends JI{static lc_name(){return"JsonOutputKeyToolsParser"}lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(t){super(t),this.keyName=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){if(this.zodSchema===void 0)return t;let e=await Ey(this.zodSchema,t);if(e.success)return e.data;throw new ln(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(e.error?.issues)}`,JSON.stringify(t,null,2))}async parsePartialResult(t){let r=(await super.parsePartialResult(t)).filter(o=>o.type===this.keyName),n=r;if(r.length)return this.returnId||(n=r.map(o=>o.args)),this.returnSingle?n[0]:n}async parseResult(t){let r=(await super.parsePartialResult(t,!1)).filter(i=>i.type===this.keyName),n=r;return r.length?(this.returnId||(n=r.map(i=>i.args)),this.returnSingle?this._validateResult(n[0]):await Promise.all(n.map(i=>this._validateResult(i)))):void 0}};var QW={};G(QW,{JsonOutputKeyToolsParser:()=>XI,JsonOutputToolsParser:()=>JI,convertLangChainToolCallToOpenAI:()=>WI,makeInvalidToolCall:()=>$v,parseToolCall:()=>rf});var p8={};G(p8,{BaseLLM:()=>tS,LLM:()=>f8});var tS=class of extends tf{lc_namespace=["langchain","llms",this._llmType()];async invoke(e,r){let n=of._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].text}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async*_streamIterator(e,r){if(this._streamResponseChunks===of.prototype._streamResponseChunks)yield this.invoke(e,r);else{let n=of._convertInputToPromptValue(e),[o,i]=this._separateRunnableConfigFromCallOptionsCompat(r),s=await St.configure(o.callbacks,this.callbacks,o.tags,this.tags,o.metadata,this.metadata,{verbose:this.verbose}),a={options:i,invocation_params:this?.invocationParams(i),batch_size:1},c=await s?.handleLLMStart(this.toJSON(),[n.toString()],o.runId,void 0,a,void 0,void 0,o.runName),u=new go({text:""});try{for await(let l of this._streamResponseChunks(n.toString(),i,c?.[0]))u?u=u.concat(l):u=l,typeof l.text=="string"&&(yield l.text)}catch(l){throw await Promise.all((c??[]).map(d=>d?.handleLLMError(l))),l}await Promise.all((c??[]).map(l=>l?.handleLLMEnd({generations:[[u]]})))}}async generatePrompt(e,r,n){let o=e.map(i=>i.toString());return this.generate(o,r,n)}invocationParams(e){return{}}_flattenLLMResult(e){let r=[];for(let n=0;nd?.handleLLMError(l))),l}let u=this._flattenLLMResult(a);await Promise.all((i??[]).map((l,d)=>l?.handleLLMEnd(u[d])))}let c=i?.map(u=>u.runId)||void 0;return Object.defineProperty(a,ya,{value:c?{runIds:c}:void 0,configurable:!0}),a}async _generateCached({prompts:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i,runId:s}){let a=await St.configure(i.callbacks,this.callbacks,i.tags,this.tags,i.metadata,this.metadata,{verbose:this.verbose}),c={options:o,invocation_params:this?.invocationParams(o),batch_size:e.length},u=await a?.handleLLMStart(this.toJSON(),e,s,void 0,c,void 0,void 0,i?.runName),l=[],f=(await Promise.allSettled(e.map(async(h,_)=>{let v=await r.lookup(h,n);return v==null&&l.push(_),v}))).map((h,_)=>({result:h,runManager:u?.[_]})).filter(({result:h})=>h.status==="fulfilled"&&h.value!=null||h.status==="rejected"),p=[];await Promise.all(f.map(async({result:h,runManager:_},v)=>{if(h.status==="fulfilled"){let b=h.value;return p[v]=b.map(x=>(x.generationInfo={...x.generationInfo,tokenUsage:{}},x)),b.length&&await _?.handleLLMNewToken(b[0].text),_?.handleLLMEnd({generations:[b]},void 0,void 0,void 0,{cached:!0})}else return await _?.handleLLMError(h.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(h.reason)}));let m={generations:p,missingPromptIndices:l,startedRunManagers:u};return Object.defineProperty(m,ya,{value:u?{runIds:u?.map(h=>h.runId)}:void 0,configurable:!0}),m}async generate(e,r,n){if(!Array.isArray(e))throw new Error("Argument 'prompts' is expected to be a string[]");let o;Array.isArray(r)?o={stop:r}:o=r;let[i,s]=this._separateRunnableConfigFromCallOptionsCompat(o);if(i.callbacks=i.callbacks??n,!this.cache)return this._generateUncached(e,s,i);let{cache:a}=this,c=this._getSerializedCacheKeyParametersForCall(s),{generations:u,missingPromptIndices:l,startedRunManagers:d}=await this._generateCached({prompts:e,cache:a,llmStringKey:c,parsedOptions:s,handledOptions:i,runId:i.runId}),f={};if(l.length>0){let p=await this._generateUncached(l.map(m=>e[m]),s,i,d!==void 0?l.map(m=>d?.[m]):void 0);await Promise.all(p.generations.map(async(m,h)=>{let _=l[h];return u[_]=m,a.update(e[_],c,m)})),f=p.llmOutput??{}}return{generations:u,llmOutput:f}}_identifyingParams(){return{}}_modelType(){return"base_llm"}},f8=class extends tS{async _generate(t,e,r){return{generations:await Promise.all(t.map((o,i)=>this._call(o,{...e,promptIndex:i},r).then(s=>[{text:s}])))}}};var m8={};G(m8,{chunkArray:()=>rS});var rS=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),s=r[i]||[];return r[i]=s.concat([n]),r},[]);var g8={};G(g8,{Embeddings:()=>nS});var nS=class{caller;constructor(t){this.caller=new Xo(t??{})}};var y8={};G(y8,{BaseToolkit:()=>v8,DynamicStructuredTool:()=>xj,DynamicTool:()=>sS,StructuredTool:()=>oS,Tool:()=>iS,ToolInputParsingException:()=>su,isLangChainTool:()=>qa,isRunnableToolLike:()=>qp,isStructuredTool:()=>Zp,isStructuredToolParams:()=>Vp,tool:()=>b8});var oS=class extends _v{extras;returnDirect=!1;verboseParsingErrors=!1;get lc_namespace(){return["langchain","tools"]}responseFormat="content";defaultConfig;constructor(t){super(t??{}),this.verboseParsingErrors=t?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=t?.responseFormat??this.responseFormat,this.defaultConfig=t?.defaultConfig??this.defaultConfig,this.metadata=t?.metadata??this.metadata,this.extras=t?.extras??this.extras}async invoke(t,e){let r,n=Pe(ga(this.defaultConfig,e));return Mi(t)?(r=t.args,n={...n,toolCall:t}):r=t,this.call(r,n)}async call(t,e,r){let n=Mi(t)?t.args:t,o;if(on(this.schema))try{o=await ts(this.schema,n)}catch(p){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m} +Details: ${p.message}`),Py(p)&&(m=`${m} + +${av.prettifyError(p)}`),new su(m,JSON.stringify(t))}else{let p=ot(n,this.schema);if(!p.valid){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m} +Details: ${p.errors.map(h=>`${h.keywordLocation}: ${h.error}`).join(` +`)}`),new su(m,JSON.stringify(t))}o=n}let i=ha(e),a=await St.configure(i.callbacks,this.callbacks,i.tags||r,this.tags,i.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof t=="string"?t:JSON.stringify(t),i.runId,void 0,void 0,void 0,i.runName);delete i.runId;let c;try{c=await this._call(o,a,i)}catch(p){throw await a?.handleToolError(p),p}let u,l;if(this.responseFormat==="content_and_artifact")if(Array.isArray(c)&&c.length===2)[u,l]=c;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple. +Result: ${JSON.stringify(c)}`);else u=c;let d;Mi(t)&&(d=t.id),!d&&nO(i)&&(d=i.toolCall.id);let f=w8({content:u,artifact:l,toolCallId:d,name:this.name,metadata:this.metadata});return await a?.handleToolEnd(f),f}},iS=class extends oS{schema=$r.object({input:$r.string().optional()}).transform(t=>t.input);constructor(t){super(t)}call(t,e){let r=typeof t=="string"||t==null?{input:t}:t;return super.call(r,e)}},sS=class extends iS{static lc_name(){return"DynamicTool"}name;description;func;constructor(t){super(t),this.name=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect}async call(t,e){let r=ha(e);return r.runName===void 0&&(r.runName=this.name),super.call(t,r)}async _call(t,e,r){return this.func(t,e,r)}},xj=class extends oS{static lc_name(){return"DynamicStructuredTool"}name;description;func;schema;constructor(t){super(t),this.name=t.name,this.description=t.description,this.func=t.func,this.returnDirect=t.returnDirect??this.returnDirect,this.schema=t.schema}async call(t,e,r){let n=ha(e);return n.runName===void 0&&(n.runName=this.name),super.call(t,n,r)}_call(t,e,r){return this.func(t,e,r)}},v8=class{getTools(){return this.tools}};function b8(t,e){let r=Wu(e.schema),n=ol(e.schema);if(!e.schema||r||n)return new sS({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(s,a,c)=>new Promise((u,l)=>{let d=Ve(c,{callbacks:a?.getChild()});Lt.runWithConfig(vr(d),async()=>{try{u(t(s,d))}catch(f){l(f)}})})});let o=e.schema,i=e.description??e.schema.description??`${e.name} tool`;return new xj({...e,description:i,schema:o,func:async(s,a,c)=>new Promise((u,l)=>{let d,f=()=>{c?.signal&&d&&c.signal.removeEventListener("abort",d)};c?.signal&&(d=()=>{f(),l(Bi(c.signal))},c.signal.addEventListener("abort",d));let p=Ve(c,{callbacks:a?.getChild()});Lt.runWithConfig(vr(p),async()=>{try{let m=await t(s,p);if(c?.signal?.aborted){f();return}f(),u(m)}catch(m){f(),l(m)}})})})}function w8(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!Id(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new Or({status:"success",content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new Or({status:"success",content:x8(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function x8(t){try{return JSON.stringify(t,null,2)??""}catch{return`${t}`}}import{BedrockRuntimeClient as G1e,ConverseCommand as K1e,ConverseStreamCommand as H1e}from"@aws-sdk/client-bedrock-runtime";import{defaultProvider as Y1e}from"@aws-sdk/credential-provider-node";import{BedrockAgentRuntimeClient as lMe,RetrieveCommand as dMe}from"@aws-sdk/client-bedrock-agent-runtime";var I8={};G(I8,{BaseRetriever:()=>aS});var aS=class extends Ze{callbacks;tags;metadata;verbose;constructor(t){super(t),this.callbacks=t?.callbacks,this.tags=t?.tags??[],this.metadata=t?.metadata??{},this.verbose=t?.verbose??!1}_getRelevantDocuments(t,e){throw new Error("Not implemented!")}async invoke(t,e){let r=Pe(ha(e)),o=await(await St.configure(r.callbacks,this.callbacks,r.tags,this.tags,r.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),t,r.runId,void 0,void 0,void 0,r.runName);try{let i=await this._getRelevantDocuments(t,o);return await o?.handleRetrieverEnd(i),i}catch(i){throw await o?.handleRetrieverError(i),i}}};import{KendraClient as kMe,QueryCommand as TMe,RetrieveCommand as EMe}from"@aws-sdk/client-kendra";var cS=class{pageContent;metadata;id;constructor(t){this.pageContent=t.pageContent!==void 0?t.pageContent.toString():"",this.metadata=t.metadata??{},this.id=t.id}};var uS=class extends Ze{lc_namespace=["langchain_core","documents","transformers"];invoke(t,e){return this.transformDocuments(t)}},$j=class extends uS{async transformDocuments(t){let e=[];for(let r of t){let n=await this._transformDocument(r);e.push(n)}return e}};var S8={};G(S8,{BaseDocumentTransformer:()=>uS,Document:()=>cS,MappingDocumentTransformer:()=>$j});import{BedrockRuntimeClient as MMe,InvokeModelCommand as jMe}from"@aws-sdk/client-bedrock-runtime";var ll=class{uri;bucketOwner;constructor(e){this.uri=e.uri,e.bucketOwner!==void 0&&(this.bucketOwner=e.bucketOwner)}},sf=class{type="imageBlock";format;source;constructor(e){this.format=e.format,this.source=this._convertSource(e.source)}_convertSource(e){if("bytes"in e)return{type:"imageSourceBytes",bytes:e.bytes};if("url"in e)return{type:"imageSourceUrl",url:e.url};if("s3Location"in e)return{type:"imageSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid image source")}},af=class{type="videoBlock";format;source;constructor(e){this.format=e.format,this.source=this._convertSource(e.source)}_convertSource(e){if("bytes"in e)return{type:"videoSourceBytes",bytes:e.bytes};if("s3Location"in e)return{type:"videoSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid video source")}},cf=class{type="documentBlock";name;format;source;citations;context;constructor(e){this.name=e.name,this.format=e.format,this.source=this._convertSource(e.source),e.citations!==void 0&&(this.citations=e.citations),e.context!==void 0&&(this.context=e.context)}_convertSource(e){if("bytes"in e)return{type:"documentSourceBytes",bytes:e.bytes};if("text"in e)return{type:"documentSourceText",text:e.text};if("content"in e)return{type:"documentSourceContentBlock",content:e.content.map(r=>new mt(r.text))};if("s3Location"in e)return{type:"documentSourceS3Location",s3Location:new ll(e.s3Location)};throw new Error("Invalid document source")}};var Sr=class t{type="message";role;content;constructor(e){this.role=e.role,this.content=e.content}static fromMessageData(e){let r=e.content.map(Iv);return new t({role:e.role,content:r})}},mt=class{type="textBlock";text;constructor(e){this.text=e}},dl=class{type="toolUseBlock";name;toolUseId;input;constructor(e){this.name=e.name,this.toolUseId=e.toolUseId,this.input=e.input}},Ht=class{type="toolResultBlock";toolUseId;status;content;error;constructor(e){this.toolUseId=e.toolUseId,this.status=e.status,this.content=e.content,e.error!==void 0&&(this.error=e.error)}},pl=class{type="reasoningBlock";text;signature;redactedContent;constructor(e){e.text!==void 0&&(this.text=e.text),e.signature!==void 0&&(this.signature=e.signature),e.redactedContent!==void 0&&(this.redactedContent=e.redactedContent)}},uf=class{type="cachePointBlock";cacheType;constructor(e){this.cacheType=e.cacheType}},Ha=class{type="jsonBlock";json;constructor(e){this.json=e.json}};function Ij(t){return typeof t=="string"?t:t.map(e=>{if("type"in e)return e;if("cachePoint"in e)return new uf(e.cachePoint);if("guardContent"in e)return new lf(e.guardContent);if("text"in e)return new mt(e.text);throw new Error("Unknown SystemContentBlockData type")})}var lf=class{type="guardContentBlock";text;image;constructor(e){if(!e.text&&!e.image)throw new Error("GuardContentBlock must have either text or image content");if(e.text&&e.image)throw new Error("GuardContentBlock cannot have both text and image content");e.text&&(this.text=e.text),e.image&&(this.image=e.image)}};function Iv(t){if("text"in t)return new mt(t.text);if("toolUse"in t)return new dl(t.toolUse);if("toolResult"in t)return new Ht({toolUseId:t.toolResult.toolUseId,status:t.toolResult.status,content:t.toolResult.content.map(e=>{if("text"in e)return new mt(e.text);if("json"in e)return new Ha(e);throw new Error("Unknown ToolResultContentData type")})});if("reasoning"in t)return new pl(t.reasoning);if("cachePoint"in t)return new uf(t.cachePoint);if("guardContent"in t)return new lf(t.guardContent);if("image"in t)return new sf(t.image);if("video"in t)return new af(t.video);if("document"in t)return new cf(t.document);throw new Error("Unknown ContentBlockData type")}var ds=class extends Error{constructor(e){super(e),this.name="ContextWindowOverflowError"}},df=class extends Error{partialMessage;constructor(e,r){super(e),this.name="MaxTokensError",this.partialMessage=r}},ps=class extends Error{constructor(e){super(e),this.name="JsonValidationError"}},pf=class extends Error{constructor(e){super(e),this.name="ConcurrentInvocationError"}};function ai(t){return t instanceof Error?t:new Error(String(t))}var ff=class extends Error{constructor(e){super(`Item with id '${e}' not found`),this.name="ItemNotFoundError"}},mf=class extends Error{constructor(e){super(`An item with the ID '${e}' already exists.`),this.name="DuplicateItemError"}},Ft=class extends Error{constructor(e){super(e),this.name="ValidationError"}},hf=class{_items;constructor(e){this._items=new Map,e&&this.addAll(e)}get(e){return this._items.get(e)}find(e){for(let r of this._items.values())if(e(r))return r}keys(){return Array.from(this._items.keys())}values(){return Array.from(this._items.values())}pairs(){return Array.from(this._items.entries())}clear(){this._items.clear()}add(e){this.validate(e);let r=this.generateId(e);if(this._items.has(r))throw new mf(r);return this._items.set(r,e),r}addAll(e){return e.map(r=>this.add(r))}remove(e){let r=this._items.get(e);if(r===void 0)throw new ff(e);return this._items.delete(e),r}removeAll(e){return e.map(r=>this.remove(r))}findRemove(e){for(let[r,n]of this._items.entries())if(e(n))return this._items.delete(r),n}};if(import.meta.vitest){let{describe:t,it:e,expect:r,beforeEach:n,vi:o}=import.meta.vitest;class i extends hf{nextId=1;generateId(){return this.nextId++}validate(a){if(a.length===0)throw new Ft("Item cannot be an empty string.")}}t("Error Classes",()=>{e("ItemNotFoundError should have the correct name and message",()=>{let s=new ff(123);r(s.name).toBe("ItemNotFoundError"),r(s.message).toBe("Item with id '123' not found")}),e("DuplicateItemError should have the correct name and message",()=>{let s=new mf("abc");r(s.name).toBe("DuplicateItemError"),r(s.message).toBe("An item with the ID 'abc' already exists.")}),e("ValidationError should have the correct name and message",()=>{let s=new Ft("Invalid item");r(s.name).toBe("ValidationError"),r(s.message).toBe("Invalid item")})}),t("Registry",()=>{let s;n(()=>{s=new i}),e("should register an item and return a new ID",()=>{let a=s.add("test-item");r(a).toBe(1),r(s.get(1)).toBe("test-item")}),e("should throw DuplicateItemError when registering with an existing ID",()=>{let a=o.spyOn(s,"generateId").mockReturnValue(1);s.add("test-item"),r(()=>s.add("another-item")).toThrow(mf),a.mockRestore()}),e("should deregister an item and return it",()=>{let a=s.add("test-item"),c=s.remove(a);r(c).toBe("test-item"),r(s.get(a)).toBeUndefined()}),e("should throw ItemNotFoundError when deregistering a non-existent item",()=>{r(()=>s.remove(999)).toThrow(ff)}),e("should get an item by its ID",()=>{let a=s.add("test-item"),c=s.get(a);r(c).toBe("test-item")}),e("should return undefined when getting a non-existent item",()=>{let a=s.get(999);r(a).toBeUndefined()}),e("should find an item using a predicate",()=>{s.add("item-a"),s.add("item-b");let a=s.find(c=>c.includes("b"));r(a).toBe("item-b")}),e("should return undefined when no item matches the predicate",()=>{s.add("item-a");let a=s.find(c=>c.includes("c"));r(a).toBeUndefined()}),e("should return all keys",()=>{s.add("item-1"),s.add("item-2"),r(s.keys()).toEqual([1,2])}),e("should return all values",()=>{s.add("item-1"),s.add("item-2"),r(s.values()).toEqual(["item-1","item-2"])}),e("should return all key-value pairs",()=>{s.add("item-1"),s.add("item-2"),r(s.pairs()).toEqual([[1,"item-1"],[2,"item-2"]])}),e("should clear all items from the registry",()=>{s.add("item-1"),s.clear(),r(s.keys()).toEqual([]),r(s.values()).toEqual([])}),e("should register multiple items",()=>{let a=s.addAll(["item-a","item-b"]);r(a).toEqual([1,2]),r(s.values()).toEqual(["item-a","item-b"])}),e("should deregister multiple items",()=>{let a=s.addAll(["item-a","item-b","item-c"]),c=s.removeAll([a[0],a[2]]);r(c).toEqual(["item-a","item-c"]),r(s.values()).toEqual(["item-b"])}),e("should find and deregister an item",()=>{s.add("item-a"),s.add("item-b");let a=s.findRemove(c=>c.includes("a"));r(a).toBe("item-a"),r(s.values()).toEqual(["item-b"])}),e("should return undefined from findRemove if no item matches",()=>{let a=s.findRemove(c=>c.includes("c"));r(a).toBeUndefined()}),e("should call the validate method on register",()=>{let a=o.spyOn(s,"validate");s.add("a-valid-item"),r(a).toHaveBeenCalledWith("a-valid-item"),a.mockRestore()}),e("should throw a validation error for an invalid item",()=>{r(()=>s.add("")).toThrow(Ft)})})}var gf=class{type="toolStreamEvent";data;constructor(e){e.data!==void 0&&(this.data=e.data)}},fl=class{};function lS(t,e){let r=ai(t);return new Ht({toolUseId:e,status:"error",content:[new mt(`Error: ${r.message}`)],error:r})}var _f=class extends hf{generateId(e){return e}validate(e){if(typeof e.name!="string")throw new Ft("Tool name must be a string");if(e.name.length<1||e.name.length>64)throw new Ft("Tool name must be between 1 and 64 characters");if(!/^[a-zA-Z0-9_-]+$/.test(e.name))throw new Ft("Tool name must contain only alphanumeric characters, hyphens, and underscores");if(e.description!==void 0&&e.description!==null&&(typeof e.description!="string"||e.description.length<1))throw new Ft("Tool description must be a non-empty string");if(this.values().some(n=>n.name===e.name))throw new Ft(`Tool with name '${e.name}' already registered`)}getByName(e){return this.values().find(r=>r.name===e)}removeByName(e){this.findRemove(r=>r.name===e)}};if(import.meta.vitest){let{describe:t,it:e,expect:r,beforeEach:n}=import.meta.vitest,o=(i={})=>({name:"valid-tool",description:"A valid tool description.",toolSpec:{name:"valid-tool",description:"A valid tool description.",inputSchema:{type:"object",properties:{}}},stream:async function*(){return yield new gf({data:"mock data"}),new Ht({toolUseId:"",status:"success",content:[]})},...i});t("ToolRegistry",()=>{let i;n(()=>{i=new _f}),e("should register a valid tool successfully",()=>{let s=o();r(()=>i.add(s)).not.toThrow(),r(i.values()).toHaveLength(1),r(i.values()[0]?.name).toBe("valid-tool")}),e("should throw ValidationError for a duplicate tool name",()=>{let s=o({name:"duplicate-name"}),a=o({name:"duplicate-name"});i.add(s),r(()=>i.add(a)).toThrow(Ft),r(()=>i.add(a)).toThrow("Tool with name 'duplicate-name' already registered")}),e("should throw ValidationError for an invalid tool name pattern",()=>{let s=o({name:"invalid name!"});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must contain only alphanumeric characters, hyphens, and underscores")}),e("should throw ValidationError for a tool name that is too long",()=>{let s="a".repeat(65),a=o({name:s});r(()=>i.add(a)).toThrow(Ft),r(()=>i.add(a)).toThrow("Tool name must be between 1 and 64 characters")}),e("should throw ValidationError for a tool name that is too short",()=>{let s=o({name:""});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must be between 1 and 64 characters")}),e("should throw ValidationError for an invalid description",()=>{let s=o({description:123});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool description must be a non-empty string")}),e("should throw ValidationError for an empty string description",()=>{let s=o({description:""});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool description must be a non-empty string")}),e("should allow a tool with a null or undefined description",()=>{let s=o();s.description=void 0;let a=o();a.name="another-valid-tool",a.description=null,r(()=>i.add(s)).not.toThrow(),r(()=>i.add(a)).not.toThrow()}),e("should retrieve a tool by its name",()=>{let s=o({name:"find-me"});i.add(s);let a=i.getByName("find-me");r(a).toBe(s)}),e("should return undefined when getting a tool by a name that does not exist",()=>{let s=i.getByName("non-existent");r(s).toBeUndefined()}),e("should remove a tool by its name",()=>{let s=o({name:"remove-me"});i.add(s),r(i.getByName("remove-me")).toBeDefined(),i.removeByName("remove-me"),r(i.getByName("remove-me")).toBeUndefined()}),e("should not throw when removing a tool by a name that does not exist",()=>{r(()=>i.removeByName("non-existent")).not.toThrow()}),e("should generate a valid ToolIdentifier",()=>{let s=o(),a=i.generateId(s);r(a).toBe(s)}),e("should register a tool with a name at the maximum length",()=>{let s="a".repeat(64),a=o({name:s});r(()=>i.add(a)).not.toThrow()}),e("should throw ValidationError for a non-string tool name",()=>{let s=o({name:123});r(()=>i.add(s)).toThrow(Ft),r(()=>i.add(s)).toThrow("Tool name must be a string")})})}function Sv(t){try{return JSON.parse(JSON.stringify(t))}catch(e){let r=e instanceof Error?e.message:String(e);throw new Error(`Unable to serialize tool result: ${r}`)}}function dS(t,e="value"){let r=[],n=(o,i)=>{let s=e;if(o!==""&&(/^\d+$/.test(o)?s=r.length>0?`${r[r.length-1]}[${o}]`:`${e}[${o}]`:s=r.length>0?`${r[r.length-1]}.${o}`:`${e}.${o}`),typeof i=="function")throw new ps(`${s} contains a function which cannot be serialized`);if(typeof i=="symbol")throw new ps(`${s} contains a symbol which cannot be serialized`);if(i===void 0)throw new ps(`${s} is undefined which cannot be serialized`);return i!==null&&typeof i=="object"&&r.push(s),i};try{let o=JSON.stringify(t,n);return JSON.parse(o)}catch(o){if(o instanceof ps)throw o;let i=o instanceof Error?o.message:String(o);throw new Error(`Unable to serialize value: ${i}`)}}var kv=class{_state;constructor(e){e!==void 0?this._state=dS(e,"initialState"):this._state={}}get(e){if(e==null)throw new Error("key is required");let r=this._state[e];if(r!==void 0)return Sv(r)}set(e,r){this._state[e]=dS(r,`value for key "${e}"`)}delete(e){delete this._state[e]}clear(){this._state={}}getAll(){return Sv(this._state)}keys(){return Object.keys(this._state)}};function Sj(){return typeof process<"u"&&process.stdout?.write?t=>process.stdout.write(t):t=>console.log(t)}var Tv=class{_appender;_inReasoningBlock=!1;_toolCount=0;_needReasoningIndent=!1;constructor(e){this._appender=e}write(e){this._appender(e)}processEvent(e){switch(e.type){case"modelContentBlockDeltaEvent":this.handleContentBlockDelta(e);break;case"modelContentBlockStartEvent":this.handleContentBlockStart(e);break;case"modelContentBlockStopEvent":this.handleContentBlockStop();break;case"toolResultBlock":this.handleToolResult(e);break;default:break}}handleContentBlockDelta(e){let{delta:r}=e;r.type==="textDelta"?r.text&&r.text.length>0&&this.write(r.text):r.type==="reasoningContentDelta"&&(this._inReasoningBlock||(this._inReasoningBlock=!0,this._needReasoningIndent=!0,this.write(` +\u{1F4AD} Reasoning: +`)),r.text&&r.text.length>0&&this.writeReasoningText(r.text))}writeReasoningText(e){let r="";for(let n=0;n{this.applyManagement(r.agent.messages)}),e.addCallback(ui,r=>{r.error instanceof ds&&(this.reduceContext(r.agent.messages,r.error),r.retryModelCall=!0)})}applyManagement(e){e.length<=this._windowSize||this.reduceContext(e)}reduceContext(e,r){let n=this.findLastMessageWithToolResults(e);if(r&&n!==void 0&&this._shouldTruncateResults&&this.truncateToolResults(e,n))return;let o=e.length<=this._windowSize?2:e.length-this._windowSize;for(;oc.type==="toolResultBlock")){o++;continue}if(i.content.some(c=>c.type==="toolUseBlock")){let c=e[o+1];if(!(c&&c.content.some(l=>l.type==="toolResultBlock"))){o++;continue}}break}if(o>=e.length)throw new ds("Unable to trim conversation context!");e.splice(0,o)}truncateToolResults(e,r){if(r>=e.length||r<0)return!1;let n=e[r];if(!n)return!1;let o="The tool result was too large!",i=!1;for(let a of n.content)if(a.type==="toolResultBlock"){let c=a,u=c.content[0],l=u&&u.type==="textBlock"?u.text:"";if(c.status==="error"&&l===o)return!1;i=!0;break}if(!i)return!1;let s=n.content.map(a=>{if(a.type==="toolResultBlock"){let c=a;return new Ht({toolUseId:c.toolUseId,status:"error",content:[new mt(o)]})}return a});return e[r]=new Sr({role:n.role,content:s}),!0}findLastMessageWithToolResults(e){for(let r=e.length-1;r>=0;r--)if(e[r].content.some(i=>i.type==="toolResultBlock"))return r}};var vl=class{_callbacks;_currentProvider;constructor(){this._callbacks=new Map,this._currentProvider=void 0}addCallback(e,r){let n={callback:r,source:this._currentProvider},o=this._callbacks.get(e)??[];return o.push(n),this._callbacks.set(e,o),()=>{let i=this._callbacks.get(e);if(!i)return;let s=i.indexOf(n);s!==-1&&i.splice(s,1)}}addHook(e){this._currentProvider=e;try{e.registerCallbacks(this)}finally{this._currentProvider=void 0}}addAllHooks(e){for(let r of e)this.addHook(r)}removeHook(e){for(let[r,n]of this._callbacks.entries()){let o=n.filter(i=>i.source!==e);o.length===0?this._callbacks.delete(r):o.length!==n.length&&this._callbacks.set(r,o)}}async invokeCallbacks(e){let r=this.getCallbacksFor(e);for(let n of r)await n(e);return e}getCallbacksFor(e){let n=(this._callbacks.get(e.constructor)??[]).map(o=>o.callback);return e._shouldReverseCallbacks()?[...n].reverse():n}};var E8=function(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e},A8=(function(t){return function(e){function r(s){e.error=e.hasError?new t(s,e.error,"An error was suppressed during disposal."):s,e.hasError=!0}var n,o=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&o===1)return o=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return o|=2,Promise.resolve(s).then(i,function(a){return r(a),i()})}else o|=1}catch(a){r(a)}if(o===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}})(typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n}),bf=class{messages;state;conversationManager;hooks;model;systemPrompt;_toolRegistry;_mcpClients;_initialized;_isInvoking=!1;_printer;constructor(e){this.messages=(e?.messages??[]).map(i=>i instanceof Sr?i:Sr.fromMessageData(i)),this.state=new kv(e?.state),this.conversationManager=e?.conversationManager??new vf({windowSize:40}),this.hooks=new vl,this.hooks.addHook(this.conversationManager),this.hooks.addAllHooks(e?.hooks??[]),typeof e?.model=="string"?this.model=new ms({modelId:e.model}):this.model=e?.model??new ms;let{tools:r,mcpClients:n}=kj(e?.tools??[]);this._toolRegistry=new _f(r),this._mcpClients=n,e?.systemPrompt!==void 0&&(this.systemPrompt=Ij(e.systemPrompt)),(e?.printer??!0)&&(this._printer=new Tv(Sj())),this._initialized=!1}async initialize(){this._initialized||(await Promise.all(this._mcpClients.map(async e=>{let r=await e.listTools();this._toolRegistry.addAll(r)})),this._initialized=!0)}acquireLock(){if(this._isInvoking)throw new pf("Agent is already processing an invocation. Wait for the current invoke() or stream() call to complete before invoking again.");return this._isInvoking=!0,{[Symbol.dispose]:()=>{this._isInvoking=!1}}}get tools(){return this._toolRegistry.values()}get toolRegistry(){return this._toolRegistry}async invoke(e){let r=this.stream(e),n=await r.next();for(;!n.done;)n=await r.next();return n.value}async*stream(e){let r={stack:[],error:void 0,hasError:!1};try{let n=E8(r,this.acquireLock(),!1);await this.initialize();let o=this._stream(e),i=await o.next();for(;!i.done;){let s=i.value;s instanceof ar&&!(s instanceof Wa)&&await this.hooks.invokeCallbacks(s),this._printer?.processEvent(s),yield s,i=await o.next()}return yield i.value,i.value}catch(n){r.error=n,r.hasError=!0}finally{A8(r)}}async*_stream(e){let r=e;yield new ml({agent:this});try{for(;;){let n=yield*this.invokeModel(r);if(r=void 0,n.stopReason!=="toolUse")return yield await this._appendMessage(n.message),new wf({stopReason:n.stopReason,lastMessage:n.message});let o=yield*this.executeTools(n.message,this._toolRegistry);yield await this._appendMessage(n.message),yield await this._appendMessage(o)}}finally{yield new fs({agent:this})}}_normalizeInput(e){if(e!==void 0){if(typeof e=="string")return[new Sr({role:"user",content:[new mt(e)]})];if(Array.isArray(e)&&e.length>0){let r=e[0];if("role"in r&&typeof r.role=="string")return r instanceof Sr?e:e.map(n=>Sr.fromMessageData(n));{let n;return"type"in r&&typeof r.type=="string"?n=e:n=e.map(Iv),[new Sr({role:"user",content:n})]}}}return[]}async*invokeModel(e){let r=this._normalizeInput(e);for(let i of r)yield await this._appendMessage(i);let o={toolSpecs:this._toolRegistry.values().map(i=>i.toolSpec)};this.systemPrompt!==void 0&&(o.systemPrompt=this.systemPrompt),yield new gl({agent:this});try{let{message:i,stopReason:s}=yield*this._streamFromModel(this.messages,o);return yield new ui({agent:this,stopData:{message:i,stopReason:s}}),{message:i,stopReason:s}}catch(i){let s=ai(i),a=new ui({agent:this,error:s});if(yield a,a.retryModelCall)return yield*this.invokeModel(e);throw i}}async*_streamFromModel(e,r){let n=this.model.streamAggregated(e,r),o=await n.next();for(;!o.done;){let i=o.value;yield new yf({agent:this,event:i}),yield i,o=await n.next()}return o.value}async*executeTools(e,r){yield new _l({agent:this,message:e});let n=e.content.filter(s=>s.type==="toolUseBlock");if(n.length===0)throw new Error("Model indicated toolUse but no tool use blocks found in message");let o=[];for(let s of n){let a=yield*this.executeTool(s,r);o.push(a),yield a}let i=new Sr({role:"user",content:o});return yield new yl({agent:this,message:i}),i}async*executeTool(e,r){let n=r.find(s=>s.name===e.name),o={name:e.name,toolUseId:e.toolUseId,input:e.input};if(yield new hl({agent:this,toolUse:o,tool:n}),!n){let s=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(`Tool '${e.name}' not found in registry`)]});return yield new ci({agent:this,toolUse:o,tool:n,result:s}),s}let i={toolUse:{name:e.name,toolUseId:e.toolUseId,input:e.input},agent:this};try{let a=yield*n.stream(i);if(!a){let c=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(`Tool '${e.name}' did not return a result`)]});return yield new ci({agent:this,toolUse:o,tool:n,result:c}),c}return yield new ci({agent:this,toolUse:o,tool:n,result:a}),a}catch(s){let a=ai(s),c=new Ht({toolUseId:e.toolUseId,status:"error",content:[new mt(a.message)],error:a});return yield new ci({agent:this,toolUse:o,tool:n,result:c,error:a}),c}}async _appendMessage(e){this.messages.push(e);let r=new Wa({agent:this,message:e});return await this.hooks.invokeCallbacks(r),r}};function kj(t){let e=[],r=[];for(let n of t)if(Array.isArray(n)){let{tools:o,mcpClients:i}=kj(n);e.push(...o),r.push(...i)}else n instanceof xf?r.push(n):e.push(n);return{tools:e,mcpClients:r}}var wf=class{type="agentResult";stopReason;lastMessage;constructor(e){this.stopReason=e.stopReason,this.lastMessage=e.lastMessage}toString(){let e=[];for(let r of this.lastMessage.content)switch(r.type){case"textBlock":e.push(r.text);break;case"reasoningBlock":if(r.text){let n=r.text.replace(/\n/g,` + `);e.push(`\u{1F4AD} Reasoning: + ${n}`)}break;default:console.debug(`Skipping content block type: ${r.type}`);break}return e.join(` +`)}};import{BedrockRuntimeClient as C8,ConverseCommand as R8,ConverseStreamCommand as N8}from"@aws-sdk/client-bedrock-runtime";var Ev=class{type="modelMessageStartEvent";role;constructor(e){this.role=e.role}},Av=class{type="modelContentBlockStartEvent";start;constructor(e){e.start!==void 0&&(this.start=e.start)}},Ov=class{type="modelContentBlockDeltaEvent";contentBlockIndex;delta;constructor(e){this.delta=e.delta}},Pv=class{type="modelContentBlockStopEvent";constructor(e){}},Cv=class{type="modelMessageStopEvent";stopReason;additionalModelResponseFields;constructor(e){this.stopReason=e.stopReason,e.additionalModelResponseFields!==void 0&&(this.additionalModelResponseFields=e.additionalModelResponseFields)}},Rv=class{type="modelMetadataEvent";usage;metrics;trace;constructor(e){e.usage!==void 0&&(this.usage=e.usage),e.metrics!==void 0&&(this.metrics=e.metrics),e.trace!==void 0&&(this.trace=e.trace)}};var Nv=class{_convert_to_class_event(e){switch(e.type){case"modelMessageStartEvent":return new Ev(e);case"modelContentBlockStartEvent":return new Av(e);case"modelContentBlockDeltaEvent":return new Ov(e);case"modelContentBlockStopEvent":return new Pv(e);case"modelMessageStopEvent":return new Cv(e);case"modelMetadataEvent":return new Rv(e);default:throw new Error(`Unsupported event type: ${e}`)}}async*streamAggregated(e,r){let n=null,o=[],i="",s="",a="",c="",u={},l,d=null,f=null,p;for await(let h of this.stream(e,r)){let _=this._convert_to_class_event(h);switch(yield _,_.type){case"modelMessageStartEvent":n=_.role,o.length=0;break;case"modelContentBlockStartEvent":_.start?.type==="toolUseStart"&&(a=_.start.name,c=_.start.toolUseId),s="",i="",u={};break;case"modelContentBlockDeltaEvent":switch(_.delta.type){case"textDelta":i+=_.delta.text;break;case"toolUseInputDelta":s+=_.delta.input;break;case"reasoningContentDelta":_.delta.text&&(u.text=(u.text??"")+_.delta.text),_.delta.signature&&(u.signature=_.delta.signature),_.delta.redactedContent&&(u.redactedContent=_.delta.redactedContent);break}break;case"modelContentBlockStopEvent":{let v;try{c?(v=new dl({name:a,toolUseId:c,input:s?JSON.parse(s):{}}),c="",a=""):Object.keys(u).length>0?v=new pl({...u}):v=new mt(i),o.push(v),yield v}catch(b){b instanceof SyntaxError&&(console.error("Unable to parse JSON string."),l=b)}break}case"modelMessageStopEvent":n&&(d=new Sr({role:n,content:[...o]}),f=_.stopReason);break;case"modelMetadataEvent":p=_;break;default:break}}if(!d||!f)throw new Error("Stream ended without completing a message",{cause:l});if(f==="maxTokens"){let h=new df("Model reached maximum token limit. This is an unrecoverable state that requires intervention.",d);l!==void 0?l.cause=h:l=h}if(l!==void 0)throw l;let m={message:d,stopReason:f};return p!==void 0&&(m.metadata=p),m}};function ct(t,e){if(t==null)throw new Error(`Expected ${e} to be defined, but got ${t}`);return t}var P8={debug:()=>{},info:()=>{},warn:(...t)=>console.warn(...t),error:(...t)=>console.error(...t)},hs=P8;var z8="global.anthropic.claude-sonnet-4-5-20250929-v1:0",M8="us-west-2",j8=!1,D8=["anthropic.claude"],L8=["Input is too long for requested model","input length and `max_tokens` exceed context limit","too many total text bytes"],Tj={end_turn:"endTurn",tool_use:"toolUse",max_tokens:"maxTokens",stop_sequence:"stopSequence",content_filtered:"contentFiltered",guardrail_intervened:"guardrailIntervened"};function U8(t){return t.replace(/_([a-z])/g,(e,r)=>r.toUpperCase())}var ms=class extends Nv{_config;_client;constructor(e){super();let{region:r,clientConfig:n,...o}=e??{};this._config={modelId:z8,...o};let i=n?.customUserAgent?`${n.customUserAgent} strands-agents-ts-sdk`:"strands-agents-ts-sdk";this._client=new C8({...n??{},...r?{region:r}:{},customUserAgent:i}),F8(this._client.config)}updateConfig(e){this._config={...this._config,...e}}getConfig(){return this._config}async*stream(e,r){try{let n=this._formatRequest(e,r);if(this._config.stream!==!1){let o=new N8(n),i=await this._client.send(o);if(i.stream)for await(let s of i.stream){let a=this._mapStreamedBedrockEventToSDKEvent(s);for(let c of a)yield c}}else{let o=new R8(n),i=await this._client.send(o);for(let s of this._mapBedrockEventToSDKEvent(i))yield s}}catch(n){let o=ai(n);throw L8.some(i=>o.message.includes(i))?new ds(o.message):o}}_formatRequest(e,r){let n={modelId:this._config.modelId,messages:this._formatMessages(e)};if(r?.systemPrompt!==void 0)if(typeof r.systemPrompt=="string"){let i=[{text:r.systemPrompt}];this._config.cachePrompt&&i.push({cachePoint:{type:this._config.cachePrompt}}),n.system=i}else r.systemPrompt.length>0&&(this._config.cachePrompt&&hs.warn("cachePrompt config is ignored when systemPrompt is an array, use explicit cache points instead"),n.system=r.systemPrompt.map(i=>this._formatContentBlock(i)));if(r?.toolSpecs&&r.toolSpecs.length>0){let i=r.toolSpecs.map(a=>({toolSpec:{name:a.name,description:a.description,inputSchema:{json:a.inputSchema}}}));this._config.cacheTools&&i.push({cachePoint:{type:this._config.cacheTools}});let s={tools:i};r.toolChoice&&(s.toolChoice=r.toolChoice),n.toolConfig=s}let o={};return this._config.maxTokens!==void 0&&(o.maxTokens=this._config.maxTokens),this._config.temperature!==void 0&&(o.temperature=this._config.temperature),this._config.topP!==void 0&&(o.topP=this._config.topP),this._config.stopSequences!==void 0&&(o.stopSequences=this._config.stopSequences),Object.keys(o).length>0&&(n.inferenceConfig=o),this._config.additionalRequestFields&&(n.additionalModelRequestFields=this._config.additionalRequestFields),this._config.additionalResponseFieldPaths&&(n.additionalModelResponseFieldPaths=this._config.additionalResponseFieldPaths),this._config.additionalArgs&&Object.assign(n,this._config.additionalArgs),n}_formatMessages(e){return e.reduce((r,n)=>{let o=n.content.map(i=>this._formatContentBlock(i)).filter(i=>i!==void 0);return o.length>0&&r.push({role:n.role,content:o}),r},[])}_shouldIncludeToolResultStatus(){let e=this._config.includeToolResultStatus??"auto";if(e===!0)return!0;if(e===!1)return!1;let r=D8.some(n=>this._config.modelId?.includes(n));return hs.debug(`model_id=<${this._config.modelId}>, include_tool_result_status=<${r}> | auto-detected includeToolResultStatus`),r}_formatContentBlock(e){switch(e.type){case"textBlock":return{text:e.text};case"toolUseBlock":return{toolUse:{toolUseId:e.toolUseId,name:e.name,input:e.input}};case"toolResultBlock":{let r=e.content.map(n=>{switch(n.type){case"textBlock":return{text:n.text};case"jsonBlock":return{json:n.json}}});return{toolResult:{toolUseId:e.toolUseId,content:r,...this._shouldIncludeToolResultStatus()&&{status:e.status}}}}case"reasoningBlock":{if(e.text)return{reasoningContent:{reasoningText:{text:e.text,signature:e.signature}}};if(e.redactedContent)return{reasoningContent:{redactedContent:e.redactedContent}};throw Error("reasoning content format incorrect. Either 'text' or 'redactedContent' must be set.")}case"cachePointBlock":return{cachePoint:{type:e.cacheType}};case"imageBlock":return{image:{format:e.format,source:this._formatMediaSource(e.source)}};case"videoBlock":return{video:{format:e.format==="3gp"?"three_gp":e.format,source:this._formatMediaSource(e.source)}};case"documentBlock":return{document:{name:e.name,format:e.format,source:this._formatDocumentSource(e.source),...e.citations&&{citations:e.citations},...e.context&&{context:e.context}}};case"guardContentBlock":{if(e.text)return{guardContent:{text:{text:e.text.text,qualifiers:e.text.qualifiers}}};if(e.image)return{guardContent:{image:{format:e.image.format,source:{bytes:e.image.source.bytes}}}};throw new Error("guardContent must have either text or image")}}}_formatMediaSource(e){switch(e.type){case"imageSourceBytes":case"videoSourceBytes":return{bytes:e.bytes};case"imageSourceUrl":if(e.url.startsWith("s3://"))return{s3Location:{uri:e.url}};console.warn("Ignoring imageSourceUrl content block as its not supported by bedrock");return;case"imageSourceS3Location":case"videoSourceS3Location":return{s3Location:{uri:e.s3Location.uri,...e.s3Location.bucketOwner&&{bucketOwner:e.s3Location.bucketOwner}}};default:throw new Error("Invalid media source")}}_formatDocumentSource(e){switch(e.type){case"documentSourceBytes":return{bytes:e.bytes};case"documentSourceText":return{bytes:new TextEncoder().encode(e.text)};case"documentSourceContentBlock":return{content:e.content.map(r=>({text:r.text}))};case"documentSourceS3Location":return{s3Location:{uri:e.s3Location.uri,...e.s3Location.bucketOwner&&{bucketOwner:e.s3Location.bucketOwner}}};default:throw new Error("Invalid document source")}}_mapBedrockEventToSDKEvent(e){let r=[],n=ct(e.output,"event.output"),o=ct(n.message,"output.message"),i=ct(o.role,"message.role");r.push({type:"modelMessageStartEvent",role:i});let s={text:d=>{r.push({type:"modelContentBlockStartEvent"}),r.push({type:"modelContentBlockDeltaEvent",delta:{type:"textDelta",text:d}}),r.push({type:"modelContentBlockStopEvent"})},toolUse:d=>{r.push({type:"modelContentBlockStartEvent",start:{type:"toolUseStart",name:ct(d.name,"toolUse.name"),toolUseId:ct(d.toolUseId,"toolUse.toolUseId")}}),r.push({type:"modelContentBlockDeltaEvent",delta:{type:"toolUseInputDelta",input:JSON.stringify(ct(d.input,"toolUse.input"))}}),r.push({type:"modelContentBlockStopEvent"})},reasoningContent:d=>{if(!d)return;r.push({type:"modelContentBlockStartEvent"});let f={type:"reasoningContentDelta"};d.reasoningText?(f.text=ct(d.reasoningText.text,"reasoningText.text"),d.reasoningText.signature&&(f.signature=d.reasoningText.signature)):d.redactedContent&&(f.redactedContent=d.redactedContent),Object.keys(f).length>1&&r.push({type:"modelContentBlockDeltaEvent",delta:f}),r.push({type:"modelContentBlockStopEvent"})}};ct(o.content,"message.content").forEach(d=>{for(let f in d)if(f in s){let p=f;s[p](d[p])}else hs.warn(`block_key=<${f}> | skipping unsupported block key`)});let c=ct(e.stopReason,"event.stopReason");r.push({type:"modelMessageStopEvent",stopReason:this._transformStopReason(c,e)});let u=ct(e.usage,"output.usage"),l={type:"modelMetadataEvent",usage:{inputTokens:ct(u.inputTokens,"usage.inputTokens"),outputTokens:ct(u.outputTokens,"usage.outputTokens"),totalTokens:ct(u.totalTokens,"usage.totalTokens")}};return e.metrics&&(l.metrics={latencyMs:ct(e.metrics.latencyMs,"metrics.latencyMs")}),r.push(l),r}_mapStreamedBedrockEventToSDKEvent(e){let r=[],n=ct(Object.keys(e)[0],"eventType"),o=e[n];switch(n){case"messageStart":{let i=o;r.push({type:"modelMessageStartEvent",role:ct(i.role,"messageStart.role")});break}case"contentBlockStart":{let i=o,s={type:"modelContentBlockStartEvent"};if(i.start?.toolUse){let a=i.start.toolUse;s.start={type:"toolUseStart",name:ct(a.name,"toolUse.name"),toolUseId:ct(a.toolUseId,"toolUse.toolUseId")}}r.push(s);break}case"contentBlockDelta":{let s=ct(o.delta,"contentBlockDelta.delta"),a={text:c=>{r.push({type:"modelContentBlockDeltaEvent",delta:{type:"textDelta",text:c}})},toolUse:c=>{c?.input&&r.push({type:"modelContentBlockDeltaEvent",delta:{type:"toolUseInputDelta",input:c.input}})},reasoningContent:c=>{if(!c)return;let u={type:"reasoningContentDelta"};c.text&&(u.text=c.text),c.signature&&(u.signature=c.signature),c.redactedContent&&(u.redactedContent=c.redactedContent),Object.keys(u).length>1&&r.push({type:"modelContentBlockDeltaEvent",delta:u})}};for(let c in s)if(c in a){let u=c;a[u](s[u])}else hs.warn(`delta_key=<${c}> | skipping unsupported delta key`);break}case"contentBlockStop":{r.push({type:"modelContentBlockStopEvent"});break}case"messageStop":{let i=o,s=ct(i.stopReason,"messageStop.stopReason"),a={type:"modelMessageStopEvent",stopReason:this._transformStopReason(s,i)};i.additionalModelResponseFields&&(a.additionalModelResponseFields=i.additionalModelResponseFields),r.push(a);break}case"metadata":{let i=o,s={type:"modelMetadataEvent"};if(i.usage){let a=i.usage,c={inputTokens:ct(a.inputTokens,"usage.inputTokens"),outputTokens:ct(a.outputTokens,"usage.outputTokens"),totalTokens:ct(a.totalTokens,"usage.totalTokens")};a.cacheReadInputTokens!==void 0&&(c.cacheReadInputTokens=a.cacheReadInputTokens),a.cacheWriteInputTokens!==void 0&&(c.cacheWriteInputTokens=a.cacheWriteInputTokens),s.usage=c}i.metrics&&(s.metrics={latencyMs:ct(i.metrics.latencyMs,"metrics.latencyMs")}),i.trace&&(s.trace=i.trace),r.push(s);break}case"internalServerException":case"modelStreamErrorException":case"serviceUnavailableException":case"validationException":case"throttlingException":throw o;default:hs.warn(`event_type=<${n}> | unsupported bedrock event type`);break}return r}_transformStopReason(e,r){let n;if(e in Tj)n=Tj[e];else{let o=U8(e);hs.warn(`stop_reason=<${e}>, fallback=<${o}> | unknown stop reason, converting to camelCase`),n=o}return n==="endTurn"&&r&&"output"in r&&r.output?.message?.content?.some(o=>"toolUse"in o)&&(n="toolUse",hs.warn("stop_reason= | adjusting to tool_use due to tool use in content blocks")),n}};function F8(t){let e=t.region.bind(t);t.region=async()=>{try{return await e()}catch(n){if(ai(n).message==="Region is missing")return M8;throw n}};let r=t.useFipsEndpoint.bind(t);t.useFipsEndpoint=async()=>{try{return await r()}catch(n){if(ai(n).message==="Region is missing")return j8;throw n}}}function bl(t){return!!t._zod}function Jn(t,e){return bl(t)?ba(t,e):t.safeParse(e)}function zv(t){var e,r;if(!t)return;let n;if(bl(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function Oj(t){var e;if(bl(t)){let s=(e=t._zod)===null||e===void 0?void 0:e.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let o=t.value;if(o!==void 0)return o}var fS="2025-11-25";var Pj=[fS,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],To="io.modelcontextprotocol/related-task",jv="2.0",ko=MI(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Cj=tt([A(),We().int()]),Rj=A(),G8=un({ttl:tt([We(),Yp()]).optional(),pollInterval:We().optional()}),mS=un({taskId:A()}),K8=un({progressToken:Cj.optional(),[To]:mS.optional()}),Ur=un({task:G8.optional(),_meta:K8.optional()}),Wt=U({method:A(),params:Ur.optional()}),Ja=un({_meta:U({[To]:ie(mS)}).passthrough().optional()}),kn=U({method:A(),params:Ja.optional()}),cr=un({_meta:un({[To]:mS.optional()}).optional()}),Dv=tt([A(),We().int()]),Nj=U({jsonrpc:se(jv),id:Dv,...Wt.shape}).strict(),hS=t=>Nj.safeParse(t).success,zj=U({jsonrpc:se(jv),...kn.shape}).strict(),Mj=t=>zj.safeParse(t).success,jj=U({jsonrpc:se(jv),id:Dv,result:cr}).strict(),$f=t=>jj.safeParse(t).success,be;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(be||(be={}));var Dj=U({jsonrpc:se(jv),id:Dv,error:U({code:We().int(),message:A(),data:ie(ft())})}).strict(),Lj=t=>Dj.safeParse(t).success,BDe=tt([Nj,zj,jj,Dj]),Xa=cr.strict(),H8=Ja.extend({requestId:Dv,reason:A().optional()}),Lv=kn.extend({method:se("notifications/cancelled"),params:H8}),W8=U({src:A(),mimeType:A().optional(),sizes:Re(A()).optional()}),If=U({icons:Re(W8).optional()}),wl=U({name:A(),title:A().optional()}),Uj=wl.extend({...wl.shape,...If.shape,version:A(),websiteUrl:A().optional()}),J8=Qp(U({applyDefaults:Nt().optional()}),bt(A(),ft())),X8=sv(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Qp(U({form:J8.optional(),url:ko.optional()}),bt(A(),ft()).optional())),Y8=U({list:ie(U({}).passthrough()),cancel:ie(U({}).passthrough()),requests:ie(U({sampling:ie(U({createMessage:ie(U({}).passthrough())}).passthrough()),elicitation:ie(U({create:ie(U({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),Q8=U({list:ie(U({}).passthrough()),cancel:ie(U({}).passthrough()),requests:ie(U({tools:ie(U({call:ie(U({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),eJ=U({experimental:bt(A(),ko).optional(),sampling:U({context:ko.optional(),tools:ko.optional()}).optional(),elicitation:X8.optional(),roots:U({listChanged:Nt().optional()}).optional(),tasks:ie(Y8)}),tJ=Ur.extend({protocolVersion:A(),capabilities:eJ,clientInfo:Uj}),rJ=Wt.extend({method:se("initialize"),params:tJ});var nJ=U({experimental:bt(A(),ko).optional(),logging:ko.optional(),completions:ko.optional(),prompts:ie(U({listChanged:ie(Nt())})),resources:U({subscribe:Nt().optional(),listChanged:Nt().optional()}).optional(),tools:U({listChanged:Nt().optional()}).optional(),tasks:ie(Q8)}).passthrough(),gS=cr.extend({protocolVersion:A(),capabilities:nJ,serverInfo:Uj,instructions:A().optional()}),oJ=kn.extend({method:se("notifications/initialized")});var Uv=Wt.extend({method:se("ping")}),iJ=U({progress:We(),total:ie(We()),message:ie(A())}),sJ=U({...Ja.shape,...iJ.shape,progressToken:Cj}),Fv=kn.extend({method:se("notifications/progress"),params:sJ}),aJ=Ur.extend({cursor:Rj.optional()}),Sf=Wt.extend({params:aJ.optional()}),kf=cr.extend({nextCursor:ie(Rj)}),Tf=U({taskId:A(),status:zt(["working","input_required","completed","failed","cancelled"]),ttl:tt([We(),Yp()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:ie(We()),statusMessage:ie(A())}),Ya=cr.extend({task:Tf}),cJ=Ja.merge(Tf),Ef=kn.extend({method:se("notifications/tasks/status"),params:cJ}),Bv=Wt.extend({method:se("tasks/get"),params:Ur.extend({taskId:A()})}),Zv=cr.merge(Tf),qv=Wt.extend({method:se("tasks/result"),params:Ur.extend({taskId:A()})}),Vv=Sf.extend({method:se("tasks/list")}),Gv=kf.extend({tasks:Re(Tf)}),Fj=Wt.extend({method:se("tasks/cancel"),params:Ur.extend({taskId:A()})}),Bj=cr.merge(Tf),Zj=U({uri:A(),mimeType:ie(A()),_meta:bt(A(),ft()).optional()}),qj=Zj.extend({text:A()}),_S=A().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Vj=Zj.extend({blob:_S}),xl=U({audience:Re(zt(["user","assistant"])).optional(),priority:We().min(0).max(1).optional(),lastModified:il.datetime({offset:!0}).optional()}),Gj=U({...wl.shape,...If.shape,uri:A(),description:ie(A()),mimeType:ie(A()),annotations:xl.optional(),_meta:ie(un({}))}),uJ=U({...wl.shape,...If.shape,uriTemplate:A(),description:ie(A()),mimeType:ie(A()),annotations:xl.optional(),_meta:ie(un({}))}),lJ=Sf.extend({method:se("resources/list")}),yS=kf.extend({resources:Re(Gj)}),dJ=Sf.extend({method:se("resources/templates/list")}),vS=kf.extend({resourceTemplates:Re(uJ)}),bS=Ur.extend({uri:A()}),pJ=bS,fJ=Wt.extend({method:se("resources/read"),params:pJ}),wS=cr.extend({contents:Re(tt([qj,Vj]))}),mJ=kn.extend({method:se("notifications/resources/list_changed")}),hJ=bS,gJ=Wt.extend({method:se("resources/subscribe"),params:hJ}),_J=bS,yJ=Wt.extend({method:se("resources/unsubscribe"),params:_J}),vJ=Ja.extend({uri:A()}),bJ=kn.extend({method:se("notifications/resources/updated"),params:vJ}),wJ=U({name:A(),description:ie(A()),required:ie(Nt())}),xJ=U({...wl.shape,...If.shape,description:ie(A()),arguments:ie(Re(wJ)),_meta:ie(un({}))}),$J=Sf.extend({method:se("prompts/list")}),xS=kf.extend({prompts:Re(xJ)}),IJ=Ur.extend({name:A(),arguments:bt(A(),A()).optional()}),SJ=Wt.extend({method:se("prompts/get"),params:IJ}),$S=U({type:se("text"),text:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),IS=U({type:se("image"),data:_S,mimeType:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),SS=U({type:se("audio"),data:_S,mimeType:A(),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),kJ=U({type:se("tool_use"),name:A(),id:A(),input:U({}).passthrough(),_meta:ie(U({}).passthrough())}).passthrough(),TJ=U({type:se("resource"),resource:tt([qj,Vj]),annotations:xl.optional(),_meta:bt(A(),ft()).optional()}),EJ=Gj.extend({type:se("resource_link")}),kS=tt([$S,IS,SS,EJ,TJ]),AJ=U({role:zt(["user","assistant"]),content:kS}),TS=cr.extend({description:ie(A()),messages:Re(AJ)}),OJ=kn.extend({method:se("notifications/prompts/list_changed")}),PJ=U({title:A().optional(),readOnlyHint:Nt().optional(),destructiveHint:Nt().optional(),idempotentHint:Nt().optional(),openWorldHint:Nt().optional()}),CJ=U({taskSupport:zt(["required","optional","forbidden"]).optional()}),Kj=U({...wl.shape,...If.shape,description:A().optional(),inputSchema:U({type:se("object"),properties:bt(A(),ko).optional(),required:Re(A()).optional()}).catchall(ft()),outputSchema:U({type:se("object"),properties:bt(A(),ko).optional(),required:Re(A()).optional()}).catchall(ft()).optional(),annotations:ie(PJ),execution:ie(CJ),_meta:bt(A(),ft()).optional()}),RJ=Sf.extend({method:se("tools/list")}),ES=kf.extend({tools:Re(Kj)}),$l=cr.extend({content:Re(kS).default([]),structuredContent:bt(A(),ft()).optional(),isError:ie(Nt())}),ZDe=$l.or(cr.extend({toolResult:ft()})),NJ=Ur.extend({name:A(),arguments:ie(bt(A(),ft()))}),zJ=Wt.extend({method:se("tools/call"),params:NJ}),MJ=kn.extend({method:se("notifications/tools/list_changed")}),Hj=zt(["debug","info","notice","warning","error","critical","alert","emergency"]),jJ=Ur.extend({level:Hj}),DJ=Wt.extend({method:se("logging/setLevel"),params:jJ}),LJ=Ja.extend({level:Hj,logger:A().optional(),data:ft()}),UJ=kn.extend({method:se("notifications/message"),params:LJ}),FJ=U({name:A().optional()}),BJ=U({hints:ie(Re(FJ)),costPriority:ie(We().min(0).max(1)),speedPriority:ie(We().min(0).max(1)),intelligencePriority:ie(We().min(0).max(1))}),ZJ=U({mode:ie(zt(["auto","required","none"]))}),qJ=U({type:se("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:Re(kS).default([]),structuredContent:U({}).passthrough().optional(),isError:ie(Nt()),_meta:ie(U({}).passthrough())}).passthrough(),VJ=ov("type",[$S,IS,SS]),Mv=ov("type",[$S,IS,SS,kJ,qJ]),GJ=U({role:zt(["user","assistant"]),content:tt([Mv,Re(Mv)]),_meta:ie(U({}).passthrough())}).passthrough(),KJ=Ur.extend({messages:Re(GJ),modelPreferences:BJ.optional(),systemPrompt:A().optional(),includeContext:zt(["none","thisServer","allServers"]).optional(),temperature:We().optional(),maxTokens:We().int(),stopSequences:Re(A()).optional(),metadata:ko.optional(),tools:ie(Re(Kj)),toolChoice:ie(ZJ)}),AS=Wt.extend({method:se("sampling/createMessage"),params:KJ}),OS=cr.extend({model:A(),stopReason:ie(zt(["endTurn","stopSequence","maxTokens"]).or(A())),role:zt(["user","assistant"]),content:VJ}),HJ=cr.extend({model:A(),stopReason:ie(zt(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:zt(["user","assistant"]),content:tt([Mv,Re(Mv)])}),WJ=U({type:se("boolean"),title:A().optional(),description:A().optional(),default:Nt().optional()}),JJ=U({type:se("string"),title:A().optional(),description:A().optional(),minLength:We().optional(),maxLength:We().optional(),format:zt(["email","uri","date","date-time"]).optional(),default:A().optional()}),XJ=U({type:zt(["number","integer"]),title:A().optional(),description:A().optional(),minimum:We().optional(),maximum:We().optional(),default:We().optional()}),YJ=U({type:se("string"),title:A().optional(),description:A().optional(),enum:Re(A()),default:A().optional()}),QJ=U({type:se("string"),title:A().optional(),description:A().optional(),oneOf:Re(U({const:A(),title:A()})),default:A().optional()}),e7=U({type:se("string"),title:A().optional(),description:A().optional(),enum:Re(A()),enumNames:Re(A()).optional(),default:A().optional()}),t7=tt([YJ,QJ]),r7=U({type:se("array"),title:A().optional(),description:A().optional(),minItems:We().optional(),maxItems:We().optional(),items:U({type:se("string"),enum:Re(A())}),default:Re(A()).optional()}),n7=U({type:se("array"),title:A().optional(),description:A().optional(),minItems:We().optional(),maxItems:We().optional(),items:U({anyOf:Re(U({const:A(),title:A()}))}),default:Re(A()).optional()}),o7=tt([r7,n7]),i7=tt([e7,t7,o7]),s7=tt([i7,WJ,JJ,XJ]),a7=Ur.extend({mode:se("form").optional(),message:A(),requestedSchema:U({type:se("object"),properties:bt(A(),s7),required:Re(A()).optional()})}),c7=Ur.extend({mode:se("url"),message:A(),elicitationId:A(),url:A().url()}),u7=tt([a7,c7]),PS=Wt.extend({method:se("elicitation/create"),params:u7}),l7=Ja.extend({elicitationId:A()}),d7=kn.extend({method:se("notifications/elicitation/complete"),params:l7}),CS=cr.extend({action:zt(["accept","decline","cancel"]),content:sv(t=>t===null?void 0:t,bt(A(),tt([A(),We(),Nt(),Re(A())])).optional())}),p7=U({type:se("ref/resource"),uri:A()});var f7=U({type:se("ref/prompt"),name:A()}),m7=Ur.extend({ref:tt([f7,p7]),argument:U({name:A(),value:A()}),context:U({arguments:bt(A(),A()).optional()}).optional()}),h7=Wt.extend({method:se("completion/complete"),params:m7});var RS=cr.extend({completion:un({values:Re(A()).max(100),total:ie(We().int()),hasMore:ie(Nt())})}),g7=U({uri:A().startsWith("file://"),name:A().optional(),_meta:bt(A(),ft()).optional()}),_7=Wt.extend({method:se("roots/list")}),y7=cr.extend({roots:Re(g7)}),v7=kn.extend({method:se("notifications/roots/list_changed")}),qDe=tt([Uv,rJ,h7,DJ,SJ,$J,lJ,dJ,fJ,gJ,yJ,zJ,RJ,Bv,qv,Vv]),VDe=tt([Lv,Fv,oJ,v7,Ef]),GDe=tt([Xa,OS,HJ,CS,y7,Zv,Gv,Ya]),KDe=tt([Uv,AS,PS,_7,Bv,qv,Vv]),HDe=tt([Lv,Fv,UJ,bJ,mJ,MJ,OJ,Ef,d7]),WDe=tt([Xa,gS,RS,TS,xS,yS,vS,wS,$l,ES,Zv,Gv,Ya]),de=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===be.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new pS(o.elicitations,r)}return new t(e,r,n)}},pS=class extends de{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(be.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}};function gs(t){return t==="completed"||t==="failed"||t==="cancelled"}var b7=Symbol("Let zodToJsonSchema decide on which parser to use");var ALe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function NS(t){let e=zv(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Oj(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function zS(t,e){let r=Jn(t,e);if(!r.success)throw r.error;return r.data}var k7=6e4,Kv=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Lv,r=>{this._oncancel(r)}),this.setNotificationHandler(Fv,r=>{this._onprogress(r)}),this.setRequestHandler(Uv,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Bv,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new de(be.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(qv,async(r,n)=>{let o=async()=>{var i;let s=r.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(c.type==="response"||c.type==="error"){let u=c.message,l=u.id,d=this._requestResolvers.get(l);if(d)if(this._requestResolvers.delete(l),c.type==="response")d(u);else{let f=u,p=new de(f.error.code,f.error.message,f.error.data);d(p)}else{let f=c.type==="response"?"Response":"Error";this._onerror(new Error(`${f} handler missing for request ${l}`))}continue}await((i=this._transport)===null||i===void 0?void 0:i.send(c.message,{relatedRequestId:n.requestId}))}}let a=await this._taskStore.getTask(s,n.sessionId);if(!a)throw new de(be.InvalidParams,`Task not found: ${s}`);if(!gs(a.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(gs(a.status)){let c=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...c,_meta:{...c._meta,[To]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(Vv,async(r,n)=>{var o;try{let{tasks:i,nextCursor:s}=await this._taskStore.listTasks((o=r.params)===null||o===void 0?void 0:o.cursor,n.sessionId);return{tasks:i,nextCursor:s,_meta:{}}}catch(i){throw new de(be.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Fj,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new de(be.InvalidParams,`Task not found: ${r.params.taskId}`);if(gs(o.status))throw new de(be.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new de(be.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof de?o:new de(be.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){let r=this._requestHandlerAbortControllers.get(e.params.requestId);r?.abort(e.params.reason)}_setupTimeout(e,r,n,o,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),de.fromError(be.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,o;this._transport=e;let i=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};let s=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{s?.(c),this._onerror(c)};let a=(o=this._transport)===null||o===void 0?void 0:o.onmessage;this._transport.onmessage=(c,u)=>{a?.(c,u),$f(c)||Lj(c)?this._onresponse(c):hS(c)?this._onrequest(c,u):Mj(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let n=de.fromError(be.ConnectionClosed,"Connection closed");this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);for(let o of r.values())o(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){var n,o,i,s,a,c;let u=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,l=this._transport,d=(s=(i=(o=e.params)===null||o===void 0?void 0:o._meta)===null||i===void 0?void 0:i[To])===null||s===void 0?void 0:s.taskId;if(u===void 0){let _={jsonrpc:"2.0",id:e.id,error:{code:be.MethodNotFound,message:"Method not found"}};d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:_,timestamp:Date.now()},l?.sessionId).catch(v=>this._onerror(new Error(`Failed to enqueue error response: ${v}`))):l?.send(_).catch(v=>this._onerror(new Error(`Failed to send an error response: ${v}`)));return}let f=new AbortController;this._requestHandlerAbortControllers.set(e.id,f);let p=(a=e.params)===null||a===void 0?void 0:a.task,m=this._taskStore?this.requestTaskStore(e,l?.sessionId):void 0,h={signal:f.signal,sessionId:l?.sessionId,_meta:(c=e.params)===null||c===void 0?void 0:c._meta,sendNotification:async _=>{let v={relatedRequestId:e.id};d&&(v.relatedTask={taskId:d}),await this.notification(_,v)},sendRequest:async(_,v,b)=>{var x,k;let T={...b,relatedRequestId:e.id};d&&!T.relatedTask&&(T.relatedTask={taskId:d});let F=(k=(x=T.relatedTask)===null||x===void 0?void 0:x.taskId)!==null&&k!==void 0?k:d;return F&&m&&await m.updateTaskStatus(F,"input_required"),await this.request(_,v,T)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:d,taskStore:m,taskRequestedTtl:p?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{p&&this.assertTaskHandlerCapability(e.method)}).then(()=>u(e,h)).then(async _=>{if(f.signal.aborted)return;let v={result:_,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:v,timestamp:Date.now()},l?.sessionId):await l?.send(v)},async _=>{var v;if(f.signal.aborted)return;let b={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(_.code)?_.code:be.InternalError,message:(v=_.message)!==null&&v!==void 0?v:"Internal error",..._.data!==void 0&&{data:_.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:b,timestamp:Date.now()},l?.sessionId):await l?.send(b)}).catch(_=>this._onerror(new Error(`Failed to send response: ${_}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),$f(e))n(e);else{let s=new de(e.error.code,e.error.message,e.error.data);n(s)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if($f(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(i=!0,this._taskProgressTokens.set(a.taskId,r))}}if(i||this._progressHandlers.delete(r),$f(e))o(e);else{let s=de.fromError(e.error.code,e.error.message,e.error.data);o(s)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}async*requestStream(e,r,n){var o,i,s,a;let{task:c}=n??{};if(!c){try{yield{type:"result",result:await this.request(e,r,n)}}catch(l){yield{type:"error",error:l instanceof de?l:new de(be.InternalError,String(l))}}return}let u;try{let l=await this.request(e,Ya,n);if(l.task)u=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new de(be.InternalError,"Task creation did not return a task");for(;;){let d=await this.getTask({taskId:u},n);if(yield{type:"taskStatus",task:d},gs(d.status)){d.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)}:d.status==="failed"?yield{type:"error",error:new de(be.InternalError,`Task ${u} failed`)}:d.status==="cancelled"&&(yield{type:"error",error:new de(be.InternalError,`Task ${u} was cancelled`)});return}if(d.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)};return}let f=(s=(o=d.pollInterval)!==null&&o!==void 0?o:(i=this._options)===null||i===void 0?void 0:i.defaultTaskPollInterval)!==null&&s!==void 0?s:1e3;await new Promise(p=>setTimeout(p,f)),(a=n?.signal)===null||a===void 0||a.throwIfAborted()}}catch(l){yield{type:"error",error:l instanceof de?l:new de(be.InternalError,String(l))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{var d,f,p,m,h,_,v;let b=Z=>{l(Z)};if(!this._transport){b(new Error("Not connected"));return}if(((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(Z){b(Z);return}(f=n?.signal)===null||f===void 0||f.throwIfAborted();let x=this._requestMessageId++,k={...e,jsonrpc:"2.0",id:x};n?.onprogress&&(this._progressHandlers.set(x,n.onprogress),k.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:x}}),a&&(k.params={...k.params,task:a}),c&&(k.params={...k.params,_meta:{...((m=k.params)===null||m===void 0?void 0:m._meta)||{},[To]:c}});let T=Z=>{var oe;this._responseHandlers.delete(x),this._progressHandlers.delete(x),this._cleanupTimeout(x),(oe=this._transport)===null||oe===void 0||oe.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:x,reason:String(Z)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(wt=>this._onerror(new Error(`Failed to send cancellation: ${wt}`)));let Q=Z instanceof de?Z:new de(be.RequestTimeout,String(Z));l(Q)};this._responseHandlers.set(x,Z=>{var oe;if(!(!((oe=n?.signal)===null||oe===void 0)&&oe.aborted)){if(Z instanceof Error)return l(Z);try{let Q=Jn(r,Z.result);Q.success?u(Q.data):l(Q.error)}catch(Q){l(Q)}}}),(h=n?.signal)===null||h===void 0||h.addEventListener("abort",()=>{var Z;T((Z=n?.signal)===null||Z===void 0?void 0:Z.reason)});let F=(_=n?.timeout)!==null&&_!==void 0?_:k7,J=()=>T(de.fromError(be.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(x,F,n?.maxTotalTimeout,J,(v=n?.resetTimeoutOnProgress)!==null&&v!==void 0?v:!1);let w=c?.taskId;if(w){let Z=oe=>{let Q=this._responseHandlers.get(x);Q?Q(oe):this._onerror(new Error(`Response handler missing for side-channeled request ${x}`))};this._requestResolvers.set(x,Z),this._enqueueTaskMessage(w,{type:"request",message:k,timestamp:Date.now()}).catch(oe=>{this._cleanupTimeout(x),l(oe)})}else this._transport.send(k,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(Z=>{this._cleanupTimeout(x),l(Z)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Zv,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Gv,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Bj,r)}async notification(e,r){var n,o,i,s,a;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let c=(n=r?.relatedTask)===null||n===void 0?void 0:n.taskId;if(c){let f={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...((o=e.params)===null||o===void 0?void 0:o._meta)||{},[To]:r.relatedTask}}};await this._enqueueTaskMessage(c,{type:"notification",message:f,timestamp:Date.now()});return}if(((s=(i=this._options)===null||i===void 0?void 0:i.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var f,p;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let m={...e,jsonrpc:"2.0"};r?.relatedTask&&(m={...m,params:{...m.params,_meta:{...((f=m.params)===null||f===void 0?void 0:f._meta)||{},[To]:r.relatedTask}}}),(p=this._transport)===null||p===void 0||p.send(m,r).catch(h=>this._onerror(h))});return}let d={...e,jsonrpc:"2.0"};r?.relatedTask&&(d={...d,params:{...d.params,_meta:{...((a=d.params)===null||a===void 0?void 0:a._meta)||{},[To]:r.relatedTask}}}),await this._transport.send(d,r)}setRequestHandler(e,r){let n=NS(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let s=zS(e,o);return Promise.resolve(r(s,i))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=NS(e);this._notificationHandlers.set(n,o=>{let i=zS(e,o);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){var o;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=(o=this._options)===null||o===void 0?void 0:o.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,i)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&hS(o.message)){let i=o.message.id,s=this._requestResolvers.get(i);s?(s(new de(be.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){var n,o,i;let s=(o=(n=this._options)===null||n===void 0?void 0:n.defaultTaskPollInterval)!==null&&o!==void 0?o:1e3;try{let a=await((i=this._taskStore)===null||i===void 0?void 0:i.getTask(e));a?.pollInterval&&(s=a.pollInterval)}catch{}return new Promise((a,c)=>{if(r.aborted){c(new de(be.InvalidRequest,"Request cancelled"));return}let u=setTimeout(a,s);r.addEventListener("abort",()=>{clearTimeout(u),c(new de(be.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new de(be.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await n.storeTaskResult(o,i,s,r);let a=await n.getTask(o,r);if(a){let c=Ef.parse({method:"notifications/tasks/status",params:a});await this.notification(c),gs(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,s)=>{let a=await n.getTask(o,r);if(!a)throw new de(be.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(gs(a.status))throw new de(be.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,s,r);let c=await n.getTask(o,r);if(c){let u=Ef.parse({method:"notifications/tasks/status",params:c});await this.notification(u),gs(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Wj(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Jj(t,e){let r={...t};for(let n in e){let o=n,i=e[o];if(i===void 0)continue;let s=r[o];Wj(s)&&Wj(i)?r[o]={...s,...i}:r[o]=i}return r}var MU=mn(bT(),1),jU=mn(zU(),1);function gre(){let t=new MU.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,jU.default)(t),t}var Ob=class{constructor(e){this._ajv=e??gre()}getValidator(e){var r;let n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return o=>n(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Pb=class{constructor(e){this._client=e}async*callToolStream(e,r=$l,n){var o;let i=this._client,s={...n,task:(o=n?.task)!==null&&o!==void 0?o:i.isToolTask(e.name)?{}:void 0},a=i.requestStream({method:"tools/call",params:e},r,s),c=i.getToolOutputValidator(e.name);for await(let u of a){if(u.type==="result"&&c){let l=u.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new de(be.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{let d=c(l.structuredContent);if(!d.valid){yield{type:"error",error:new de(be.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof de){yield{type:"error",error:d};return}yield{type:"error",error:new de(be.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield u}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function DU(t,e,r){var n;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!(!((n=t.tools)===null||n===void 0)&&n.call))throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function LU(t,e,r){var n,o;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!(!((n=t.sampling)===null||n===void 0)&&n.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!(!((o=t.elicitation)===null||o===void 0)&&o.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function Cb(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let o of Object.keys(n)){let i=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[o]=i.default),r[o]!==void 0&&Cb(i,r[o])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)Cb(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)Cb(r,e)}}function _re(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var Rb=class extends Kv{constructor(e,r){var n,o;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._jsonSchemaValidator=(o=r?.jsonSchemaValidator)!==null&&o!==void 0?o:new Ob}get experimental(){return this._experimental||(this._experimental={tasks:new Pb(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Jj(this._capabilities,e)}setRequestHandler(e,r){var n,o,i;let s=zv(e),a=s?.method;if(!a)throw new Error("Schema is missing a method literal");let c;if(bl(a)){let l=a,d=(n=l._zod)===null||n===void 0?void 0:n.def;c=(o=d?.value)!==null&&o!==void 0?o:l.value}else{let l=a,d=l._def;c=(i=d?.value)!==null&&i!==void 0?i:l.value}if(typeof c!="string")throw new Error("Schema method literal must be a string");let u=c;if(u==="elicitation/create"){let l=async(d,f)=>{var p,m,h;let _=Jn(PS,d);if(!_.success){let Z=_.error instanceof Error?_.error.message:String(_.error);throw new de(be.InvalidParams,`Invalid elicitation request: ${Z}`)}let{params:v}=_.data,b=(p=v.mode)!==null&&p!==void 0?p:"form",{supportsFormMode:x,supportsUrlMode:k}=_re(this._capabilities.elicitation);if(b==="form"&&!x)throw new de(be.InvalidParams,"Client does not support form-mode elicitation requests");if(b==="url"&&!k)throw new de(be.InvalidParams,"Client does not support URL-mode elicitation requests");let T=await Promise.resolve(r(d,f));if(v.task){let Z=Jn(Ya,T);if(!Z.success){let oe=Z.error instanceof Error?Z.error.message:String(Z.error);throw new de(be.InvalidParams,`Invalid task creation result: ${oe}`)}return Z.data}let F=Jn(CS,T);if(!F.success){let Z=F.error instanceof Error?F.error.message:String(F.error);throw new de(be.InvalidParams,`Invalid elicitation result: ${Z}`)}let J=F.data,w=b==="form"?v.requestedSchema:void 0;if(b==="form"&&J.action==="accept"&&J.content&&w&&!((h=(m=this._capabilities.elicitation)===null||m===void 0?void 0:m.form)===null||h===void 0)&&h.applyDefaults)try{Cb(w,J.content)}catch{}return J};return super.setRequestHandler(e,l)}if(u==="sampling/createMessage"){let l=async(d,f)=>{let p=Jn(AS,d);if(!p.success){let v=p.error instanceof Error?p.error.message:String(p.error);throw new de(be.InvalidParams,`Invalid sampling request: ${v}`)}let{params:m}=p.data,h=await Promise.resolve(r(d,f));if(m.task){let v=Jn(Ya,h);if(!v.success){let b=v.error instanceof Error?v.error.message:String(v.error);throw new de(be.InvalidParams,`Invalid task creation result: ${b}`)}return v.data}let _=Jn(OS,h);if(!_.success){let v=_.error instanceof Error?_.error.message:String(_.error);throw new de(be.InvalidParams,`Invalid sampling result: ${v}`)}return _.data};return super.setRequestHandler(e,l)}return super.setRequestHandler(e,r)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:fS,capabilities:this._capabilities,clientInfo:this._clientInfo}},gS,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!Pj.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,o,i,s;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){var r,n;DU((n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests,e,"Server")}assertTaskHandlerCapability(e){var r;this._capabilities&&LU((r=this._capabilities.tasks)===null||r===void 0?void 0:r.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Xa,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},RS,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Xa,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},TS,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},xS,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},yS,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},vS,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},wS,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Xa,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Xa,r)}async callTool(e,r=$l,n){if(this.isToolTaskRequired(e.name))throw new de(be.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},r,n),i=this.getToolOutputValidator(e.name);if(i){if(!o.structuredContent&&!o.isError)throw new de(be.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let s=i(o.structuredContent);if(!s.valid)throw new de(be.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof de?s:new de(be.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return o}isToolTask(e){var r,n,o,i;return!((i=(o=(n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests)===null||o===void 0?void 0:o.tools)===null||i===void 0)&&i.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){var r;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let n of e){if(n.outputSchema){let i=this._jsonSchemaValidator.getValidator(n.outputSchema);this._cachedToolOutputValidators.set(n.name,i)}let o=(r=n.execution)===null||r===void 0?void 0:r.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(n.name),o==="required"&&this._cachedRequiredTaskTools.add(n.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},ES,r);return this.cacheToolMetadata(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Nb=class extends fl{name;description;toolSpec;mcpClient;constructor(e){super(),this.name=e.name,this.description=e.description,this.toolSpec={name:e.name,description:e.description,inputSchema:e.inputSchema},this.mcpClient=e.client}async*stream(e){let{toolUseId:r,input:n}=e.toolUse;try{let o=await this.mcpClient.callTool(this,n);if(!this._isMcpToolResult(o))throw new Error("Invalid tool result from MCP Client: missing content array");let i=o.content.map(s=>this._isMcpTextContent(s)?new mt(s.text):new Ha({json:s}));return i.length===0&&i.push(new mt("Tool execution completed successfully with no output.")),new Ht({toolUseId:r,status:o.isError?"error":"success",content:i})}catch(o){return lS(o,r)}}_isMcpToolResult(e){return typeof e!="object"||e===null?!1:Array.isArray(e.content)}_isMcpTextContent(e){if(typeof e!="object"||e===null)return!1;let r=e;return r.type==="text"&&typeof r.text=="string"}};var xf=class{_clientName;_clientVersion;_transport;_connected;_client;constructor(e){this._clientName=e.applicationName||"strands-agents-ts-sdk",this._clientVersion=e.applicationVersion||"0.0.1",this._transport=e.transport,this._connected=!1,this._client=new Rb({name:this._clientName,version:this._clientVersion})}get client(){return this._client}async connect(e=!1){this._connected&&!e||(this._connected&&e&&(await this._client.close(),this._connected=!1),await this._client.connect(this._transport),this._connected=!0)}async disconnect(){await this._client.close(),await this._transport.close(),this._connected=!1}async listTools(){return await this.connect(),(await this._client.listTools()).tools.map(r=>new Nb({name:r.name,description:r.description??"",inputSchema:r.inputSchema,client:this}))}async callTool(e,r){if(await this.connect(),r==null)return await this.callTool(e,{});if(typeof r!="object"||Array.isArray(r))throw new Error(`MCP Protocol Error: Tool arguments must be a JSON Object (named parameters). Received: ${Array.isArray(r)?"Array":typeof r}`);return await this._client.callTool({name:e.name,arguments:r})}};var UU=({model:t})=>{let e=new ms({region:"us-east-1",modelId:t,maxTokens:4096,temperature:.7});return new bf({model:e})};var yre=async({question:t="\u3053\u3093\u306B\u3061\u306F\uFF01",model:e="us.amazon.nova-micro-v1:0"},r)=>{let n=UU({model:e});for await(let o of n.stream(t))o.type==="modelContentBlockDeltaEvent"&&o.delta.type==="textDelta"&&r.write(o.delta.text)},vre=awslambda.streamifyResponse(async(t,e)=>{wm.debug("event",{event:t});let{question:r,model:n}=t.body?JSON.parse(t.body):{question:"\u3042\u306A\u305F\u306F\u8AB0\uFF1F",model:"gpt"};await yre({question:r,model:n},e),e.end()}),EBe=vre;export{EBe as default,yre as handle,vre as handler}; +/*! Bundled license information: + +@aws-lambda-powertools/logger/lib/esm/logBuffer.js: + (* v8 ignore next -- @preserve *) + +@langchain/core/dist/utils/fast-json-patch/src/helpers.js: + (*! + * https://github.com/Starcounter-Jack/JSON-Patch + * (c) 2017-2022 Joachim Wester + * MIT licensed + *) + +@langchain/core/dist/utils/sax-js/sax.js: + (*! http://mths.be/fromcodepoint v0.1.0 by @mathias *) +*/ diff --git a/agents/agent-strands/cdk.out/cdk.out b/agents/agent-strands/cdk.out/cdk.out new file mode 100644 index 00000000..523a9aac --- /dev/null +++ b/agents/agent-strands/cdk.out/cdk.out @@ -0,0 +1 @@ +{"version":"48.0.0"} \ No newline at end of file diff --git a/agents/agent-strands/cdk.out/manifest.json b/agents/agent-strands/cdk.out/manifest.json new file mode 100644 index 00000000..dcc463af --- /dev/null +++ b/agents/agent-strands/cdk.out/manifest.json @@ -0,0 +1,521 @@ +{ + "version": "48.0.0", + "artifacts": { + "agent-strands-lambda-example.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "agent-strands-lambda-example.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "agent-strands-lambda-example": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "agent-strands-lambda-example.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/3f8dbdc3ac62bea8df0a326a27741714ed2c72c72c4f444c3c879792383f5078.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "agent-strands-lambda-example.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "agent-strands-lambda-example.assets" + ], + "metadata": { + "/agent-strands-lambda-example/ApolloLambdaFunctionLogGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApolloLambdaFunctionLogGroup34540FC6" + } + ], + "/agent-strands-lambda-example/ApolloLambdaFunctionExecutionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApolloLambdaFunctionExecutionRole85D9D1FB" + } + ], + "/agent-strands-lambda-example/Lambda/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaD247545B" + } + ], + "/agent-strands-lambda-example/Lambda/EventInvokeConfig/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaEventInvokeConfig9A47C8EE" + } + ], + "/agent-strands-lambda-example/Lambda/invoke-function-url": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdainvokefunctionurlECBD6AC0" + } + ], + "/agent-strands-lambda-example/Lambda/invoke-function": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdainvokefunctionCF40E9E5" + } + ], + "/agent-strands-lambda-example/LambdaFunctionUrl/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaFunctionUrl62966E86" + } + ], + "/agent-strands-lambda-example/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/agent-strands-lambda-example/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "agent-strands-lambda-example" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "aws-cdk-lib/feature-flag-report": { + "type": "cdk:feature-flag-report", + "properties": { + "module": "aws-cdk-lib", + "flags": { + "@aws-cdk/aws-signer:signingProfileNamePassedToCfn": { + "recommendedValue": true, + "explanation": "Pass signingProfileName to CfnSigningProfile" + }, + "@aws-cdk/core:newStyleStackSynthesis": { + "recommendedValue": true, + "explanation": "Switch to new stack synthesis method which enables CI/CD", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/core:stackRelativeExports": { + "recommendedValue": true, + "explanation": "Name exports based on the construct paths relative to the stack, rather than the global construct path", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-ecs-patterns:secGroupsDisablesImplicitOpenListener": { + "recommendedValue": true, + "explanation": "Disable implicit openListener when custom security groups are provided" + }, + "@aws-cdk/aws-rds:lowercaseDbIdentifier": { + "recommendedValue": true, + "explanation": "Force lowercasing of RDS Cluster names in CDK", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": { + "recommendedValue": true, + "explanation": "Allow adding/removing multiple UsagePlanKeys independently", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-lambda:recognizeVersionProps": { + "recommendedValue": true, + "explanation": "Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-lambda:recognizeLayerVersion": { + "recommendedValue": true, + "explanation": "Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`." + }, + "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": { + "recommendedValue": true, + "explanation": "Enable this feature flag to have cloudfront distributions use the security policy TLSv1.2_2021 by default.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/core:checkSecretUsage": { + "recommendedValue": true, + "explanation": "Enable this flag to make it impossible to accidentally use SecretValues in unsafe locations" + }, + "@aws-cdk/core:target-partitions": { + "recommendedValue": [ + "aws", + "aws-cn" + ], + "explanation": "What regions to include in lookup tables of environment agnostic stacks" + }, + "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": { + "recommendedValue": true, + "explanation": "ECS extensions will automatically add an `awslogs` driver if no logging is specified" + }, + "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": { + "recommendedValue": true, + "explanation": "Enable this feature flag to have Launch Templates generated by the `InstanceRequireImdsv2Aspect` use unique names." + }, + "@aws-cdk/aws-ecs:arnFormatIncludesClusterName": { + "recommendedValue": true, + "explanation": "ARN format used by ECS. In the new ARN format, the cluster name is part of the resource ID." + }, + "@aws-cdk/aws-iam:minimizePolicies": { + "recommendedValue": true, + "explanation": "Minimize IAM policies by combining Statements" + }, + "@aws-cdk/core:validateSnapshotRemovalPolicy": { + "recommendedValue": true, + "explanation": "Error on snapshot removal policies on resources that do not support it." + }, + "@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": { + "recommendedValue": true, + "explanation": "Generate key aliases that include the stack name" + }, + "@aws-cdk/aws-s3:createDefaultLoggingPolicy": { + "recommendedValue": true, + "explanation": "Enable this feature flag to create an S3 bucket policy by default in cases where an AWS service would automatically create the Policy if one does not exist." + }, + "@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": { + "recommendedValue": true, + "explanation": "Restrict KMS key policy for encrypted Queues a bit more" + }, + "@aws-cdk/aws-apigateway:disableCloudWatchRole": { + "recommendedValue": true, + "explanation": "Make default CloudWatch Role behavior safe for multiple API Gateways in one environment" + }, + "@aws-cdk/core:enablePartitionLiterals": { + "recommendedValue": true, + "explanation": "Make ARNs concrete if AWS partition is known" + }, + "@aws-cdk/aws-events:eventsTargetQueueSameAccount": { + "recommendedValue": true, + "explanation": "Event Rules may only push to encrypted SQS queues in the same account" + }, + "@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": { + "recommendedValue": true, + "explanation": "Avoid setting the \"ECS\" deployment controller when adding a circuit breaker" + }, + "@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": { + "recommendedValue": true, + "explanation": "Enable this feature to create default policy names for imported roles that depend on the stack the role is in." + }, + "@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": { + "recommendedValue": true, + "explanation": "Use S3 Bucket Policy instead of ACLs for Server Access Logging" + }, + "@aws-cdk/aws-route53-patters:useCertificate": { + "recommendedValue": true, + "explanation": "Use the official `Certificate` resource instead of `DnsValidatedCertificate`" + }, + "@aws-cdk/customresources:installLatestAwsSdkDefault": { + "recommendedValue": false, + "explanation": "Whether to install the latest SDK by default in AwsCustomResource" + }, + "@aws-cdk/aws-rds:databaseProxyUniqueResourceName": { + "recommendedValue": true, + "explanation": "Use unique resource name for Database Proxy" + }, + "@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": { + "recommendedValue": true, + "explanation": "Remove CloudWatch alarms from deployment group" + }, + "@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": { + "recommendedValue": true, + "explanation": "Include authorizer configuration in the calculation of the API deployment logical ID." + }, + "@aws-cdk/aws-ec2:launchTemplateDefaultUserData": { + "recommendedValue": true, + "explanation": "Define user data for a launch template by default when a machine image is provided." + }, + "@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": { + "recommendedValue": true, + "explanation": "SecretTargetAttachments uses the ResourcePolicy of the attached Secret." + }, + "@aws-cdk/aws-redshift:columnId": { + "recommendedValue": true, + "explanation": "Whether to use an ID to track Redshift column changes" + }, + "@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": { + "recommendedValue": true, + "explanation": "Enable AmazonEMRServicePolicy_v2 managed policies" + }, + "@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": { + "recommendedValue": true, + "explanation": "Restrict access to the VPC default security group" + }, + "@aws-cdk/aws-apigateway:requestValidatorUniqueId": { + "recommendedValue": true, + "explanation": "Generate a unique id for each RequestValidator added to a method" + }, + "@aws-cdk/aws-kms:aliasNameRef": { + "recommendedValue": true, + "explanation": "KMS Alias name and keyArn will have implicit reference to KMS Key" + }, + "@aws-cdk/aws-kms:applyImportedAliasPermissionsToPrincipal": { + "recommendedValue": true, + "explanation": "Enable grant methods on Aliases imported by name to use kms:ResourceAliases condition" + }, + "@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": { + "recommendedValue": true, + "explanation": "Generate a launch template when creating an AutoScalingGroup" + }, + "@aws-cdk/core:includePrefixInUniqueNameGeneration": { + "recommendedValue": true, + "explanation": "Include the stack prefix in the stack name generation process" + }, + "@aws-cdk/aws-efs:denyAnonymousAccess": { + "recommendedValue": true, + "explanation": "EFS denies anonymous clients accesses" + }, + "@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": { + "recommendedValue": true, + "explanation": "Enables support for Multi-AZ with Standby deployment for opensearch domains" + }, + "@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": { + "recommendedValue": true, + "explanation": "Enables aws-lambda-nodejs.Function to use the latest available NodeJs runtime as the default" + }, + "@aws-cdk/aws-efs:mountTargetOrderInsensitiveLogicalId": { + "recommendedValue": true, + "explanation": "When enabled, mount targets will have a stable logicalId that is linked to the associated subnet." + }, + "@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": { + "recommendedValue": true, + "explanation": "When enabled, a scope of InstanceParameterGroup for AuroraClusterInstance with each parameters will change." + }, + "@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": { + "recommendedValue": true, + "explanation": "When enabled, will always use the arn for identifiers for CfnSourceApiAssociation in the GraphqlApi construct rather than id." + }, + "@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": { + "recommendedValue": true, + "explanation": "When enabled, creating an RDS database cluster from a snapshot will only render credentials for snapshot credentials." + }, + "@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": { + "recommendedValue": true, + "explanation": "When enabled, the CodeCommit source action is using the default branch name 'main'." + }, + "@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction": { + "recommendedValue": true, + "explanation": "When enabled, the logical ID of a Lambda permission for a Lambda action includes an alarm ID." + }, + "@aws-cdk/aws-codepipeline:crossAccountKeysDefaultValueToFalse": { + "recommendedValue": true, + "explanation": "Enables Pipeline to set the default value for crossAccountKeys to false." + }, + "@aws-cdk/aws-codepipeline:defaultPipelineTypeToV2": { + "recommendedValue": true, + "explanation": "Enables Pipeline to set the default pipeline type to V2." + }, + "@aws-cdk/aws-kms:reduceCrossAccountRegionPolicyScope": { + "recommendedValue": true, + "explanation": "When enabled, IAM Policy created from KMS key grant will reduce the resource scope to this key only." + }, + "@aws-cdk/pipelines:reduceAssetRoleTrustScope": { + "recommendedValue": true, + "explanation": "Remove the root account principal from PipelineAssetsFileRole trust policy", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-eks:nodegroupNameAttribute": { + "recommendedValue": true, + "explanation": "When enabled, nodegroupName attribute of the provisioned EKS NodeGroup will not have the cluster name prefix." + }, + "@aws-cdk/aws-ec2:ebsDefaultGp3Volume": { + "recommendedValue": true, + "explanation": "When enabled, the default volume type of the EBS volume will be GP3" + }, + "@aws-cdk/aws-ecs:removeDefaultDeploymentAlarm": { + "recommendedValue": true, + "explanation": "When enabled, remove default deployment alarm settings" + }, + "@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault": { + "recommendedValue": false, + "explanation": "When enabled, the custom resource used for `AwsCustomResource` will configure the `logApiResponseData` property as true by default" + }, + "@aws-cdk/aws-s3:keepNotificationInImportedBucket": { + "recommendedValue": false, + "explanation": "When enabled, Adding notifications to a bucket in the current stack will not remove notification from imported stack." + }, + "@aws-cdk/aws-stepfunctions-tasks:useNewS3UriParametersForBedrockInvokeModelTask": { + "recommendedValue": true, + "explanation": "When enabled, use new props for S3 URI field in task definition of state machine for bedrock invoke model.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/core:explicitStackTags": { + "recommendedValue": true, + "explanation": "When enabled, stack tags need to be assigned explicitly on a Stack." + }, + "@aws-cdk/aws-ecs:enableImdsBlockingDeprecatedFeature": { + "recommendedValue": false, + "explanation": "When set to true along with canContainersAccessInstanceRole=false in ECS cluster, new updated commands will be added to UserData to block container accessing IMDS. **Applicable to Linux only. IMPORTANT: See [details.](#aws-cdkaws-ecsenableImdsBlockingDeprecatedFeature)**" + }, + "@aws-cdk/aws-ecs:disableEcsImdsBlocking": { + "recommendedValue": true, + "explanation": "When set to true, CDK synth will throw exception if canContainersAccessInstanceRole is false. **IMPORTANT: See [details.](#aws-cdkaws-ecsdisableEcsImdsBlocking)**" + }, + "@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions": { + "recommendedValue": true, + "explanation": "When enabled, we will only grant the necessary permissions when users specify cloudwatch log group through logConfiguration" + }, + "@aws-cdk/aws-dynamodb:resourcePolicyPerReplica": { + "recommendedValue": true, + "explanation": "When enabled will allow you to specify a resource policy per replica, and not copy the source table policy to all replicas" + }, + "@aws-cdk/aws-ec2:ec2SumTImeoutEnabled": { + "recommendedValue": true, + "explanation": "When enabled, initOptions.timeout and resourceSignalTimeout values will be summed together." + }, + "@aws-cdk/aws-appsync:appSyncGraphQLAPIScopeLambdaPermission": { + "recommendedValue": true, + "explanation": "When enabled, a Lambda authorizer Permission created when using GraphqlApi will be properly scoped with a SourceArn." + }, + "@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId": { + "recommendedValue": true, + "explanation": "When enabled, the value of property `instanceResourceId` in construct `DatabaseInstanceReadReplica` will be set to the correct value which is `DbiResourceId` instead of currently `DbInstanceArn`" + }, + "@aws-cdk/core:cfnIncludeRejectComplexResourceUpdateCreatePolicyIntrinsics": { + "recommendedValue": true, + "explanation": "When enabled, CFN templates added with `cfn-include` will error if the template contains Resource Update or Create policies with CFN Intrinsics that include non-primitive values." + }, + "@aws-cdk/aws-lambda-nodejs:sdkV3ExcludeSmithyPackages": { + "recommendedValue": true, + "explanation": "When enabled, both `@aws-sdk` and `@smithy` packages will be excluded from the Lambda Node.js 18.x runtime to prevent version mismatches in bundled applications." + }, + "@aws-cdk/aws-stepfunctions-tasks:fixRunEcsTaskPolicy": { + "recommendedValue": true, + "explanation": "When enabled, the resource of IAM Run Ecs policy generated by SFN EcsRunTask will reference the definition, instead of constructing ARN." + }, + "@aws-cdk/aws-ec2:bastionHostUseAmazonLinux2023ByDefault": { + "recommendedValue": true, + "explanation": "When enabled, the BastionHost construct will use the latest Amazon Linux 2023 AMI, instead of Amazon Linux 2." + }, + "@aws-cdk/core:aspectStabilization": { + "recommendedValue": true, + "explanation": "When enabled, a stabilization loop will be run when invoking Aspects during synthesis.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-route53-targets:userPoolDomainNameMethodWithoutCustomResource": { + "recommendedValue": true, + "explanation": "When enabled, use a new method for DNS Name of user pool domain target without creating a custom resource." + }, + "@aws-cdk/aws-elasticloadbalancingV2:albDualstackWithoutPublicIpv4SecurityGroupRulesDefault": { + "recommendedValue": true, + "explanation": "When enabled, the default security group ingress rules will allow IPv6 ingress from anywhere" + }, + "@aws-cdk/aws-iam:oidcRejectUnauthorizedConnections": { + "recommendedValue": true, + "explanation": "When enabled, the default behaviour of OIDC provider will reject unauthorized connections" + }, + "@aws-cdk/core:enableAdditionalMetadataCollection": { + "recommendedValue": true, + "explanation": "When enabled, CDK will expand the scope of usage data collected to better inform CDK development and improve communication for security concerns and emerging issues." + }, + "@aws-cdk/aws-lambda:createNewPoliciesWithAddToRolePolicy": { + "recommendedValue": false, + "explanation": "[Deprecated] When enabled, Lambda will create new inline policies with AddToRolePolicy instead of adding to the Default Policy Statement" + }, + "@aws-cdk/aws-s3:setUniqueReplicationRoleName": { + "recommendedValue": true, + "explanation": "When enabled, CDK will automatically generate a unique role name that is used for s3 object replication." + }, + "@aws-cdk/pipelines:reduceStageRoleTrustScope": { + "recommendedValue": true, + "explanation": "Remove the root account principal from Stage addActions trust policy", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-events:requireEventBusPolicySid": { + "recommendedValue": true, + "explanation": "When enabled, grantPutEventsTo() will use resource policies with Statement IDs for service principals." + }, + "@aws-cdk/core:aspectPrioritiesMutating": { + "recommendedValue": true, + "explanation": "When set to true, Aspects added by the construct library on your behalf will be given a priority of MUTATING." + }, + "@aws-cdk/aws-dynamodb:retainTableReplica": { + "recommendedValue": true, + "explanation": "When enabled, table replica will be default to the removal policy of source table unless specified otherwise." + }, + "@aws-cdk/cognito:logUserPoolClientSecretValue": { + "recommendedValue": false, + "explanation": "When disabled, the value of the user pool client secret will not be logged in the custom resource lambda function logs." + }, + "@aws-cdk/pipelines:reduceCrossAccountActionRoleTrustScope": { + "recommendedValue": true, + "explanation": "When enabled, scopes down the trust policy for the cross-account action role", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-stepfunctions:useDistributedMapResultWriterV2": { + "recommendedValue": true, + "explanation": "When enabled, the resultWriterV2 property of DistributedMap will be used insted of resultWriter" + }, + "@aws-cdk/s3-notifications:addS3TrustKeyPolicyForSnsSubscriptions": { + "recommendedValue": true, + "explanation": "Add an S3 trust policy to a KMS key resource policy for SNS subscriptions." + }, + "@aws-cdk/aws-ec2:requirePrivateSubnetsForEgressOnlyInternetGateway": { + "recommendedValue": true, + "explanation": "When enabled, the EgressOnlyGateway resource is only created if private subnets are defined in the dual-stack VPC." + }, + "@aws-cdk/aws-ec2-alpha:useResourceIdForVpcV2Migration": { + "recommendedValue": false, + "explanation": "When enabled, use resource IDs for VPC V2 migration" + }, + "@aws-cdk/aws-s3:publicAccessBlockedByDefault": { + "recommendedValue": true, + "explanation": "When enabled, setting any combination of options for BlockPublicAccess will automatically set true for any options not defined." + }, + "@aws-cdk/aws-lambda:useCdkManagedLogGroup": { + "recommendedValue": true, + "explanation": "When enabled, CDK creates and manages loggroup for the lambda function" + }, + "@aws-cdk/aws-elasticloadbalancingv2:networkLoadBalancerWithSecurityGroupByDefault": { + "recommendedValue": true, + "explanation": "When enabled, Network Load Balancer will be created with a security group by default." + }, + "@aws-cdk/aws-stepfunctions-tasks:httpInvokeDynamicJsonPathEndpoint": { + "recommendedValue": true, + "explanation": "When enabled, allows using a dynamic apiEndpoint with JSONPath format in HttpInvoke tasks.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-ecs-patterns:uniqueTargetGroupId": { + "recommendedValue": true, + "explanation": "When enabled, ECS patterns will generate unique target group IDs to prevent conflicts during load balancer replacement" + } + } + } + } + }, + "minimumCliVersion": "2.1033.0" +} \ No newline at end of file diff --git a/agents/agent-strands/cdk.out/tree.json b/agents/agent-strands/cdk.out/tree.json new file mode 100644 index 00000000..d985640c --- /dev/null +++ b/agents/agent-strands/cdk.out/tree.json @@ -0,0 +1 @@ +{"version":"tree-0.1","tree":{"id":"App","path":"","constructInfo":{"fqn":"aws-cdk-lib.App","version":"2.232.1"},"children":{"agent-strands-lambda-example":{"id":"agent-strands-lambda-example","path":"agent-strands-lambda-example","constructInfo":{"fqn":"aws-cdk-lib.Stack","version":"2.232.1"},"children":{"ApolloLambdaFunctionLogGroup":{"id":"ApolloLambdaFunctionLogGroup","path":"agent-strands-lambda-example/ApolloLambdaFunctionLogGroup","constructInfo":{"fqn":"aws-cdk-lib.aws_logs.LogGroup","version":"2.232.1","metadata":[]},"children":{"Resource":{"id":"Resource","path":"agent-strands-lambda-example/ApolloLambdaFunctionLogGroup/Resource","constructInfo":{"fqn":"aws-cdk-lib.aws_logs.CfnLogGroup","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::Logs::LogGroup","aws:cdk:cloudformation:props":{"logGroupName":"/aws/lambda/agent-strands-lambda-example","retentionInDays":1}}}}},"ApolloLambdaFunctionExecutionRole":{"id":"ApolloLambdaFunctionExecutionRole","path":"agent-strands-lambda-example/ApolloLambdaFunctionExecutionRole","constructInfo":{"fqn":"aws-cdk-lib.aws_iam.Role","version":"2.232.1","metadata":[]},"children":{"ImportApolloLambdaFunctionExecutionRole":{"id":"ImportApolloLambdaFunctionExecutionRole","path":"agent-strands-lambda-example/ApolloLambdaFunctionExecutionRole/ImportApolloLambdaFunctionExecutionRole","constructInfo":{"fqn":"aws-cdk-lib.Resource","version":"2.232.1","metadata":[]}},"Resource":{"id":"Resource","path":"agent-strands-lambda-example/ApolloLambdaFunctionExecutionRole/Resource","constructInfo":{"fqn":"aws-cdk-lib.aws_iam.CfnRole","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::IAM::Role","aws:cdk:cloudformation:props":{"assumeRolePolicyDocument":{"Statement":[{"Action":"sts:AssumeRole","Effect":"Allow","Principal":{"Service":"lambda.amazonaws.com"}}],"Version":"2012-10-17"},"managedPolicyArns":[{"Fn::Join":["",["arn:",{"Ref":"AWS::Partition"},":iam::aws:policy/AWSLambdaExecute"]]},{"Fn::Join":["",["arn:",{"Ref":"AWS::Partition"},":iam::aws:policy/CloudFrontReadOnlyAccess"]]}],"policies":[{"policyName":"bedrock-policy","policyDocument":{"Statement":[{"Action":["bedrock:InvokeModel*","logs:PutLogEvents"],"Effect":"Allow","Resource":"*"}],"Version":"2012-10-17"}}]}}}}},"Lambda":{"id":"Lambda","path":"agent-strands-lambda-example/Lambda","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda_nodejs.NodejsFunction","version":"2.232.1","metadata":[]},"children":{"Code":{"id":"Code","path":"agent-strands-lambda-example/Lambda/Code","constructInfo":{"fqn":"aws-cdk-lib.aws_s3_assets.Asset","version":"2.232.1"},"children":{"Stage":{"id":"Stage","path":"agent-strands-lambda-example/Lambda/Code/Stage","constructInfo":{"fqn":"aws-cdk-lib.AssetStaging","version":"2.232.1"}},"AssetBucket":{"id":"AssetBucket","path":"agent-strands-lambda-example/Lambda/Code/AssetBucket","constructInfo":{"fqn":"aws-cdk-lib.aws_s3.BucketBase","version":"2.232.1","metadata":[]}}}},"Resource":{"id":"Resource","path":"agent-strands-lambda-example/Lambda/Resource","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.CfnFunction","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::Lambda::Function","aws:cdk:cloudformation:props":{"architectures":["arm64"],"code":{"s3Bucket":{"Fn::Sub":"cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"},"s3Key":"60c83558490202f3ff95469351bd6d14d4a0546afc96a8b8bb0bac2acb3ce321.zip"},"functionName":"agent-strands-lambda-example","handler":"index.handler","loggingConfig":{"logFormat":"JSON","applicationLogLevel":"TRACE"},"memorySize":256,"role":{"Fn::GetAtt":["ApolloLambdaFunctionExecutionRole85D9D1FB","Arn"]},"runtime":"nodejs24.x","timeout":60}}},"EventInvokeConfig":{"id":"EventInvokeConfig","path":"agent-strands-lambda-example/Lambda/EventInvokeConfig","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.EventInvokeConfig","version":"2.232.1","metadata":[]},"children":{"Resource":{"id":"Resource","path":"agent-strands-lambda-example/Lambda/EventInvokeConfig/Resource","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.CfnEventInvokeConfig","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::Lambda::EventInvokeConfig","aws:cdk:cloudformation:props":{"functionName":{"Ref":"LambdaD247545B"},"maximumRetryAttempts":0,"qualifier":"$LATEST"}}}}},"invoke-function-url":{"id":"invoke-function-url","path":"agent-strands-lambda-example/Lambda/invoke-function-url","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.CfnPermission","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::Lambda::Permission","aws:cdk:cloudformation:props":{"action":"lambda:InvokeFunctionUrl","functionName":{"Fn::GetAtt":["LambdaD247545B","Arn"]},"functionUrlAuthType":"NONE","principal":"*"}}},"invoke-function":{"id":"invoke-function","path":"agent-strands-lambda-example/Lambda/invoke-function","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.CfnPermission","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::Lambda::Permission","aws:cdk:cloudformation:props":{"action":"lambda:InvokeFunction","functionName":{"Fn::GetAtt":["LambdaD247545B","Arn"]},"invokedViaFunctionUrl":true,"principal":"*"}}}}},"LambdaFunctionUrl":{"id":"LambdaFunctionUrl","path":"agent-strands-lambda-example/LambdaFunctionUrl","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.FunctionUrl","version":"2.232.1","metadata":[]},"children":{"Resource":{"id":"Resource","path":"agent-strands-lambda-example/LambdaFunctionUrl/Resource","constructInfo":{"fqn":"aws-cdk-lib.aws_lambda.CfnUrl","version":"2.232.1"},"attributes":{"aws:cdk:cloudformation:type":"AWS::Lambda::Url","aws:cdk:cloudformation:props":{"authType":"NONE","invokeMode":"RESPONSE_STREAM","targetFunctionArn":{"Fn::GetAtt":["LambdaD247545B","Arn"]}}}}}},"BootstrapVersion":{"id":"BootstrapVersion","path":"agent-strands-lambda-example/BootstrapVersion","constructInfo":{"fqn":"aws-cdk-lib.CfnParameter","version":"2.232.1"}},"CheckBootstrapVersion":{"id":"CheckBootstrapVersion","path":"agent-strands-lambda-example/CheckBootstrapVersion","constructInfo":{"fqn":"aws-cdk-lib.CfnRule","version":"2.232.1"}}}},"Tree":{"id":"Tree","path":"Tree","constructInfo":{"fqn":"constructs.Construct","version":"10.4.3"}}}}} \ No newline at end of file diff --git a/agents/agent-strands/eslint.config.ts b/agents/agent-strands/eslint.config.ts new file mode 100644 index 00000000..dea76a81 --- /dev/null +++ b/agents/agent-strands/eslint.config.ts @@ -0,0 +1,73 @@ +import { Config, defineConfig } from 'eslint/config'; +import eslint from '@eslint/js'; +import { configs, parser } from 'typescript-eslint'; +import stylistic from '@stylistic/eslint-plugin'; +import importPlugin from 'eslint-plugin-import'; +// @ts-expect-error ignore type errors +import pluginPromise from 'eslint-plugin-promise'; + +import { includeIgnoreFile } from '@eslint/compat'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const gitignorePath = path.resolve(__dirname, '.gitignore'); + +const eslintConfig: Config[] = defineConfig( + { + ignores: [ + ...(includeIgnoreFile(gitignorePath).ignores || []), + '**/*.d.ts', + 'src/tsconfig.json', + 'src/stories', + '**/*.css', + 'node_modules/**/*', + 'out', + 'cdk.out', + 'dist', + 'app', + ], + }, + eslint.configs.recommended, + configs.strict, + configs.stylistic, + pluginPromise.configs['flat/recommended'], + { + files: ['**/*.ts', '*.js'], + plugins: { + '@stylistic': stylistic, + }, + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + parser, + parserOptions: { + projectService: true, + tsconfigRootDir: __dirname, + allowDefaultProject: ['eslint.config.ts'], + }, + }, + extends: [ + importPlugin.flatConfigs.recommended, + importPlugin.flatConfigs.typescript, + ], + settings: { + 'import/resolver': { + // You will also need to install and configure the TypeScript resolver + // See also https://github.com/import-js/eslint-import-resolver-typescript#configuration + 'typescript': true, + 'node': true, + }, + }, + rules: { + '@stylistic/semi': ['error', 'always'], + '@stylistic/indent': ['error', 2], + '@stylistic/comma-dangle': ['error', 'always-multiline'], + '@stylistic/arrow-parens': ['error', 'always'], + '@stylistic/quotes': ['error', 'single'], + }, + }, +); + +export default eslintConfig; diff --git a/agents/agent-strands/lambda/agent.d.ts b/agents/agent-strands/lambda/agent.d.ts new file mode 100644 index 00000000..ec2fd7ea --- /dev/null +++ b/agents/agent-strands/lambda/agent.d.ts @@ -0,0 +1,5 @@ +import { Agent } from '@strands-agents/sdk'; +declare const createAgent: ({ model: modelId }: { + model: string; +}) => Agent; +export { createAgent }; diff --git a/agents/agent-strands/lambda/agent.js b/agents/agent-strands/lambda/agent.js new file mode 100644 index 00000000..60abed8b --- /dev/null +++ b/agents/agent-strands/lambda/agent.js @@ -0,0 +1,12 @@ +import { Agent, BedrockModel } from '@strands-agents/sdk'; +const createAgent = ({ model: modelId }) => { + const model = new BedrockModel({ + region: 'us-east-1', + modelId: modelId, + maxTokens: 4096, + temperature: 0.7, + }); + return new Agent({ model }); +}; +export { createAgent }; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWdlbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhZ2VudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRTFELE1BQU0sV0FBVyxHQUFHLENBQUMsRUFBRSxLQUFLLEVBQUUsT0FBTyxFQUFxQixFQUFFLEVBQUU7SUFDNUQsTUFBTSxLQUFLLEdBQUcsSUFBSSxZQUFZLENBQUM7UUFDN0IsTUFBTSxFQUFFLFdBQVc7UUFDbkIsT0FBTyxFQUFFLE9BQU87UUFDaEIsU0FBUyxFQUFFLElBQUk7UUFDZixXQUFXLEVBQUUsR0FBRztLQUNqQixDQUFDLENBQUM7SUFFSCxPQUFPLElBQUksS0FBSyxDQUFDLEVBQUUsS0FBSyxFQUFFLENBQUMsQ0FBQztBQUM5QixDQUFDLENBQUM7QUFFRixPQUFPLEVBQUUsV0FBVyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBZ2VudCwgQmVkcm9ja01vZGVsIH0gZnJvbSAnQHN0cmFuZHMtYWdlbnRzL3Nkayc7XG5cbmNvbnN0IGNyZWF0ZUFnZW50ID0gKHsgbW9kZWw6IG1vZGVsSWQgfTogeyBtb2RlbDogc3RyaW5nIH0pID0+IHtcbiAgY29uc3QgbW9kZWwgPSBuZXcgQmVkcm9ja01vZGVsKHtcbiAgICByZWdpb246ICd1cy1lYXN0LTEnLFxuICAgIG1vZGVsSWQ6IG1vZGVsSWQsXG4gICAgbWF4VG9rZW5zOiA0MDk2LFxuICAgIHRlbXBlcmF0dXJlOiAwLjcsXG4gIH0pO1xuXG4gIHJldHVybiBuZXcgQWdlbnQoeyBtb2RlbCB9KTtcbn07XG5cbmV4cG9ydCB7IGNyZWF0ZUFnZW50IH07XG4iXX0= \ No newline at end of file diff --git a/agents/agent-strands/lambda/agent.ts b/agents/agent-strands/lambda/agent.ts new file mode 100644 index 00000000..67e2c5ea --- /dev/null +++ b/agents/agent-strands/lambda/agent.ts @@ -0,0 +1,14 @@ +import { Agent, BedrockModel } from '@strands-agents/sdk'; + +const createAgent = ({ model: modelId }: { model: string }) => { + const model = new BedrockModel({ + region: 'us-east-1', + modelId: modelId, + maxTokens: 4096, + temperature: 0.7, + }); + + return new Agent({ model }); +}; + +export { createAgent }; diff --git a/agents/agent-strands/lambda/awslambda.d.ts b/agents/agent-strands/lambda/awslambda.d.ts new file mode 100644 index 00000000..8fa8cc6d --- /dev/null +++ b/agents/agent-strands/lambda/awslambda.d.ts @@ -0,0 +1,24 @@ +'use strict'; + +import { APIGatewayProxyEvent, APIGatewayProxyEvent, Context, Callback } from 'aws-lambda'; +import { Stream } from 'stream' + +export type Event = APIGatewayProxyEvent | APIGatewayProxyEventV2; + +export class HttpResponseStream { + static from(underlyingStream: any, prelude: any): any; +} + +export type RequestHandler = ( + event: Event, + streamResponse: Stream.WritableStream, + ctx?: Context, + callback?: Callback, +) => any | Promise; + +declare global { + namespace awslambda { + function streamifyResponse(handler: RequestHandler, option?: any): RequestHandler; + let HttpResponseStream: HttpResponseStream; + } +} diff --git a/agents/agent-strands/lambda/index.d.ts b/agents/agent-strands/lambda/index.d.ts new file mode 100644 index 00000000..b1bc7c1a --- /dev/null +++ b/agents/agent-strands/lambda/index.d.ts @@ -0,0 +1,7 @@ +import { APIGatewayProxyEvent } from 'aws-lambda'; +export declare const handle: ({ question: message, model: model }: { + question: string; + model: string; +}, output: NodeJS.WritableStream) => Promise; +export declare const handler: import("aws-lambda").StreamifyHandler; +export default handler; diff --git a/agents/agent-strands/lambda/index.js b/agents/agent-strands/lambda/index.js new file mode 100644 index 00000000..f9013c83 --- /dev/null +++ b/agents/agent-strands/lambda/index.js @@ -0,0 +1,21 @@ +import { logger } from '@llm-ts-example/common-backend'; +import { createAgent } from './agent.js'; +export const handle = async ({ question: message = 'こんにちは!', model: model = 'us.amazon.nova-micro-v1:0' }, output) => { + const agent = createAgent({ model }); + for await (const event of agent.stream(message)) { + // console.log('[Event]', event.type); + if (event.type === 'modelContentBlockDeltaEvent') { + if (event.delta.type === 'textDelta') { + output.write(event.delta.text); + } + } + } +}; +export const handler = awslambda.streamifyResponse(async (event, responseStream) => { + logger.debug('event', { event }); + const { question, model } = event.body ? JSON.parse(event.body) : { question: 'あなたは誰?', model: 'gpt' }; + await handle({ question, model }, responseStream); + responseStream.end(); +}); +export default handler; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFFeEQsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUV6QyxNQUFNLENBQUMsTUFBTSxNQUFNLEdBQUcsS0FBSyxFQUFFLEVBQUUsUUFBUSxFQUFFLE9BQU8sR0FBRyxRQUFRLEVBQUUsS0FBSyxFQUFFLEtBQUssR0FBRywyQkFBMkIsRUFBdUMsRUFBRSxNQUE2QixFQUFFLEVBQUU7SUFDL0ssTUFBTSxLQUFLLEdBQUcsV0FBVyxDQUFDLEVBQUUsS0FBSyxFQUFFLENBQUMsQ0FBQztJQUNyQyxJQUFJLEtBQUssRUFBRSxNQUFNLEtBQUssSUFBSSxLQUFLLENBQUMsTUFBTSxDQUFDLE9BQU8sQ0FBQyxFQUFFLENBQUM7UUFDaEQsc0NBQXNDO1FBQ3RDLElBQUksS0FBSyxDQUFDLElBQUksS0FBSyw2QkFBNkIsRUFBRSxDQUFDO1lBQ2pELElBQUksS0FBSyxDQUFDLEtBQUssQ0FBQyxJQUFJLEtBQUssV0FBVyxFQUFFLENBQUM7Z0JBQ3JDLE1BQU0sQ0FBQyxLQUFLLENBQUMsS0FBSyxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsQ0FBQztZQUNqQyxDQUFDO1FBQ0gsQ0FBQztJQUNILENBQUM7QUFDSCxDQUFDLENBQUM7QUFFRixNQUFNLENBQUMsTUFBTSxPQUFPLEdBQUcsU0FBUyxDQUFDLGlCQUFpQixDQUNoRCxLQUFLLEVBQ0gsS0FBMkIsRUFBRSxjQUFxQyxFQUNsRSxFQUFFO0lBQ0YsTUFBTSxDQUFDLEtBQUssQ0FBQyxPQUFPLEVBQUUsRUFBRSxLQUFLLEVBQUUsQ0FBQyxDQUFDO0lBQ2pDLE1BQU0sRUFBRSxRQUFRLEVBQUUsS0FBSyxFQUFFLEdBQUcsS0FBSyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDLEVBQUUsUUFBUSxFQUFFLFFBQVEsRUFBRSxLQUFLLEVBQUUsS0FBSyxFQUFFLENBQUM7SUFDdkcsTUFBTSxNQUFNLENBQUMsRUFBRSxRQUFRLEVBQUUsS0FBSyxFQUFFLEVBQUUsY0FBYyxDQUFDLENBQUM7SUFDbEQsY0FBYyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQ3ZCLENBQUMsQ0FBQyxDQUFDO0FBRUwsZUFBZSxPQUFPLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBsb2dnZXIgfSBmcm9tICdAbGxtLXRzLWV4YW1wbGUvY29tbW9uLWJhY2tlbmQnO1xuaW1wb3J0IHsgQVBJR2F0ZXdheVByb3h5RXZlbnQgfSBmcm9tICdhd3MtbGFtYmRhJztcbmltcG9ydCB7IGNyZWF0ZUFnZW50IH0gZnJvbSAnLi9hZ2VudC5qcyc7XG5cbmV4cG9ydCBjb25zdCBoYW5kbGUgPSBhc3luYyAoeyBxdWVzdGlvbjogbWVzc2FnZSA9ICfjgZPjgpPjgavjgaHjga/vvIEnLCBtb2RlbDogbW9kZWwgPSAndXMuYW1hem9uLm5vdmEtbWljcm8tdjE6MCcgfTogeyBxdWVzdGlvbjogc3RyaW5nLCBtb2RlbDogc3RyaW5nIH0sIG91dHB1dDogTm9kZUpTLldyaXRhYmxlU3RyZWFtKSA9PiB7XG4gIGNvbnN0IGFnZW50ID0gY3JlYXRlQWdlbnQoeyBtb2RlbCB9KTtcbiAgZm9yIGF3YWl0IChjb25zdCBldmVudCBvZiBhZ2VudC5zdHJlYW0obWVzc2FnZSkpIHtcbiAgICAvLyBjb25zb2xlLmxvZygnW0V2ZW50XScsIGV2ZW50LnR5cGUpO1xuICAgIGlmIChldmVudC50eXBlID09PSAnbW9kZWxDb250ZW50QmxvY2tEZWx0YUV2ZW50Jykge1xuICAgICAgaWYgKGV2ZW50LmRlbHRhLnR5cGUgPT09ICd0ZXh0RGVsdGEnKSB7XG4gICAgICAgIG91dHB1dC53cml0ZShldmVudC5kZWx0YS50ZXh0KTtcbiAgICAgIH1cbiAgICB9XG4gIH1cbn07XG5cbmV4cG9ydCBjb25zdCBoYW5kbGVyID0gYXdzbGFtYmRhLnN0cmVhbWlmeVJlc3BvbnNlKFxuICBhc3luYyAoXG4gICAgZXZlbnQ6IEFQSUdhdGV3YXlQcm94eUV2ZW50LCByZXNwb25zZVN0cmVhbTogTm9kZUpTLldyaXRhYmxlU3RyZWFtLFxuICApID0+IHtcbiAgICBsb2dnZXIuZGVidWcoJ2V2ZW50JywgeyBldmVudCB9KTtcbiAgICBjb25zdCB7IHF1ZXN0aW9uLCBtb2RlbCB9ID0gZXZlbnQuYm9keSA/IEpTT04ucGFyc2UoZXZlbnQuYm9keSkgOiB7IHF1ZXN0aW9uOiAn44GC44Gq44Gf44Gv6Kqw77yfJywgbW9kZWw6ICdncHQnIH07XG4gICAgYXdhaXQgaGFuZGxlKHsgcXVlc3Rpb24sIG1vZGVsIH0sIHJlc3BvbnNlU3RyZWFtKTtcbiAgICByZXNwb25zZVN0cmVhbS5lbmQoKTtcbiAgfSk7XG5cbmV4cG9ydCBkZWZhdWx0IGhhbmRsZXI7XG4iXX0= \ No newline at end of file diff --git a/agents/agent-strands/lambda/index.ts b/agents/agent-strands/lambda/index.ts new file mode 100644 index 00000000..ec583ba2 --- /dev/null +++ b/agents/agent-strands/lambda/index.ts @@ -0,0 +1,27 @@ +import { logger } from '@llm-ts-example/common-backend'; +import { APIGatewayProxyEvent } from 'aws-lambda'; +import { createAgent } from './agent.js'; + +export const handle = async ({ message: message = 'こんにちは!', model: model = 'us.amazon.nova-micro-v1:0' }: { message: string, model: string }, output: NodeJS.WritableStream) => { + const agent = createAgent({ model }); + for await (const event of agent.stream(message)) { + // console.log('[Event]', event.type); + if (event.type === 'modelContentBlockDeltaEvent') { + if (event.delta.type === 'textDelta') { + output.write(event.delta.text); + } + } + } +}; + +export const handler = awslambda.streamifyResponse( + async ( + event: APIGatewayProxyEvent, responseStream: NodeJS.WritableStream, + ) => { + logger.debug('event', { event }); + const { message, model } = event.body ? JSON.parse(event.body) : {}; + await handle({ message, model }, responseStream); + responseStream.end(); + }); + +export default handler; diff --git a/agents/agent-strands/lib/cdk-stack.d.ts b/agents/agent-strands/lib/cdk-stack.d.ts new file mode 100644 index 00000000..bae723f3 --- /dev/null +++ b/agents/agent-strands/lib/cdk-stack.d.ts @@ -0,0 +1,9 @@ +import * as cdk from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +interface CloudfrontCdnTemplateStackProps extends cdk.StackProps { + appName: string; +} +export declare class CloudfrontCdnTemplateStack extends cdk.Stack { + constructor(scope: Construct, id: string, props: CloudfrontCdnTemplateStackProps); +} +export {}; diff --git a/agents/agent-strands/lib/cdk-stack.js b/agents/agent-strands/lib/cdk-stack.js new file mode 100644 index 00000000..b5d7eeba --- /dev/null +++ b/agents/agent-strands/lib/cdk-stack.js @@ -0,0 +1,64 @@ +import * as cdk from 'aws-cdk-lib'; +import { buildCommon, buildFrontend } from './process/setup.js'; +export class CloudfrontCdnTemplateStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const { appName, } = props; + buildCommon(); + buildFrontend(); + const functionName = appName; + new cdk.aws_logs.LogGroup(this, 'ApolloLambdaFunctionLogGroup', { + logGroupName: `/aws/lambda/${functionName}`, + removalPolicy: cdk.RemovalPolicy.DESTROY, + retention: cdk.aws_logs.RetentionDays.ONE_DAY, + }); + const devOptions = { + applicationLogLevelV2: cdk.aws_lambda.ApplicationLogLevel.TRACE, + }; + const fn = new cdk.aws_lambda_nodejs.NodejsFunction(this, 'Lambda', { + runtime: cdk.aws_lambda.Runtime.NODEJS_24_X, + architecture: cdk.aws_lambda.Architecture.ARM_64, + entry: './lambda/index.ts', + functionName, + retryAttempts: 0, + bundling: { + target: 'node24', + minify: true, + format: cdk.aws_lambda_nodejs.OutputFormat.ESM, + banner: 'import { createRequire } from \'module\';const require = createRequire(import.meta.url);', + // ...devOptions.bundling, + }, + memorySize: 256, + timeout: cdk.Duration.minutes(1), + role: new cdk.aws_iam.Role(this, 'ApolloLambdaFunctionExecutionRole', { + assumedBy: new cdk.aws_iam.ServicePrincipal('cdk.aws_lambda.amazonaws.com'), + managedPolicies: [ + cdk.aws_iam.ManagedPolicy.fromAwsManagedPolicyName('AWSLambdaExecute'), + cdk.aws_iam.ManagedPolicy.fromAwsManagedPolicyName('CloudFrontReadOnlyAccess'), + ], + inlinePolicies: { + 'bedrock-policy': new cdk.aws_iam.PolicyDocument({ + statements: [ + new cdk.aws_iam.PolicyStatement({ + effect: cdk.aws_iam.Effect.ALLOW, + actions: [ + 'bedrock:InvokeModel*', + 'logs:PutLogEvents', + ], + resources: ['*'], + }), + ], + }), + }, + }), + loggingFormat: cdk.aws_lambda.LoggingFormat.JSON, + applicationLogLevelV2: devOptions.applicationLogLevelV2, + }); + new cdk.aws_lambda.FunctionUrl(this, 'LambdaFunctionUrl', { + function: fn, + authType: cdk.aws_lambda.FunctionUrlAuthType.NONE, + invokeMode: cdk.aws_lambda.InvokeMode.RESPONSE_STREAM, + }); + } +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2RrLXN0YWNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY2RrLXN0YWNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxHQUFHLE1BQU0sYUFBYSxDQUFDO0FBRW5DLE9BQU8sRUFBRSxXQUFXLEVBQUUsYUFBYSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFNaEUsTUFBTSxPQUFPLDBCQUEyQixTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQ3ZELFlBQ0UsS0FBZ0IsRUFDaEIsRUFBVSxFQUNWLEtBQXNDO1FBRXRDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0sRUFDSixPQUFPLEdBQ1IsR0FBRyxLQUFLLENBQUM7UUFFVixXQUFXLEVBQUUsQ0FBQztRQUNkLGFBQWEsRUFBRSxDQUFDO1FBRWhCLE1BQU0sWUFBWSxHQUFHLE9BQU8sQ0FBQztRQUM3QixJQUFJLEdBQUcsQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLElBQUksRUFBRSw4QkFBOEIsRUFBRTtZQUM5RCxZQUFZLEVBQUUsZUFBZSxZQUFZLEVBQUU7WUFDM0MsYUFBYSxFQUFFLEdBQUcsQ0FBQyxhQUFhLENBQUMsT0FBTztZQUN4QyxTQUFTLEVBQUUsR0FBRyxDQUFDLFFBQVEsQ0FBQyxhQUFhLENBQUMsT0FBTztTQUM5QyxDQUFDLENBQUM7UUFFSCxNQUFNLFVBQVUsR0FBRztZQUNqQixxQkFBcUIsRUFBRSxHQUFHLENBQUMsVUFBVSxDQUFDLG1CQUFtQixDQUFDLEtBQUs7U0FDaEUsQ0FBQztRQUVGLE1BQU0sRUFBRSxHQUFHLElBQUksR0FBRyxDQUFDLGlCQUFpQixDQUFDLGNBQWMsQ0FBQyxJQUFJLEVBQUUsUUFBUSxFQUFFO1lBQ2xFLE9BQU8sRUFBRSxHQUFHLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQyxXQUFXO1lBQzNDLFlBQVksRUFBRSxHQUFHLENBQUMsVUFBVSxDQUFDLFlBQVksQ0FBQyxNQUFNO1lBQ2hELEtBQUssRUFBRSxtQkFBbUI7WUFDMUIsWUFBWTtZQUNaLGFBQWEsRUFBRSxDQUFDO1lBQ2hCLFFBQVEsRUFBRTtnQkFDUixNQUFNLEVBQUUsUUFBUTtnQkFDaEIsTUFBTSxFQUFFLElBQUk7Z0JBQ1osTUFBTSxFQUFFLEdBQUcsQ0FBQyxpQkFBaUIsQ0FBQyxZQUFZLENBQUMsR0FBRztnQkFDOUMsTUFBTSxFQUFFLDBGQUEwRjtnQkFDbEcsMEJBQTBCO2FBQzNCO1lBQ0QsVUFBVSxFQUFFLEdBQUc7WUFDZixPQUFPLEVBQUUsR0FBRyxDQUFDLFFBQVEsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDO1lBQ2hDLElBQUksRUFBRSxJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksRUFBRSxtQ0FBbUMsRUFBRTtnQkFDcEUsU0FBUyxFQUFFLElBQUksR0FBRyxDQUFDLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyw4QkFBOEIsQ0FBQztnQkFDM0UsZUFBZSxFQUFFO29CQUNmLEdBQUcsQ0FBQyxPQUFPLENBQUMsYUFBYSxDQUFDLHdCQUF3QixDQUFDLGtCQUFrQixDQUFDO29CQUN0RSxHQUFHLENBQUMsT0FBTyxDQUFDLGFBQWEsQ0FBQyx3QkFBd0IsQ0FBQywwQkFBMEIsQ0FBQztpQkFDL0U7Z0JBQ0QsY0FBYyxFQUFFO29CQUNkLGdCQUFnQixFQUFFLElBQUksR0FBRyxDQUFDLE9BQU8sQ0FBQyxjQUFjLENBQUM7d0JBQy9DLFVBQVUsRUFBRTs0QkFDVixJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQUMsZUFBZSxDQUFDO2dDQUM5QixNQUFNLEVBQUUsR0FBRyxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsS0FBSztnQ0FDaEMsT0FBTyxFQUFFO29DQUNQLHNCQUFzQjtvQ0FDdEIsbUJBQW1CO2lDQUNwQjtnQ0FDRCxTQUFTLEVBQUUsQ0FBQyxHQUFHLENBQUM7NkJBQ2pCLENBQUM7eUJBQ0g7cUJBQ0YsQ0FBQztpQkFDSDthQUNGLENBQUM7WUFDRixhQUFhLEVBQUUsR0FBRyxDQUFDLFVBQVUsQ0FBQyxhQUFhLENBQUMsSUFBSTtZQUNoRCxxQkFBcUIsRUFBRSxVQUFVLENBQUMscUJBQXFCO1NBQ3hELENBQUMsQ0FBQztRQUVILElBQUksR0FBRyxDQUFDLFVBQVUsQ0FBQyxXQUFXLENBQUMsSUFBSSxFQUFFLG1CQUFtQixFQUFFO1lBQ3hELFFBQVEsRUFBRSxFQUFFO1lBQ1osUUFBUSxFQUFFLEdBQUcsQ0FBQyxVQUFVLENBQUMsbUJBQW1CLENBQUMsSUFBSTtZQUNqRCxVQUFVLEVBQUUsR0FBRyxDQUFDLFVBQVUsQ0FBQyxVQUFVLENBQUMsZUFBZTtTQUN0RCxDQUFDLENBQUM7SUFDTCxDQUFDO0NBQ0YiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBjZGsgZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0IHsgQ29uc3RydWN0IH0gZnJvbSAnY29uc3RydWN0cyc7XG5pbXBvcnQgeyBidWlsZENvbW1vbiwgYnVpbGRGcm9udGVuZCB9IGZyb20gJy4vcHJvY2Vzcy9zZXR1cC5qcyc7XG5cbmludGVyZmFjZSBDbG91ZGZyb250Q2RuVGVtcGxhdGVTdGFja1Byb3BzIGV4dGVuZHMgY2RrLlN0YWNrUHJvcHMge1xuICBhcHBOYW1lOiBzdHJpbmdcbn1cblxuZXhwb3J0IGNsYXNzIENsb3VkZnJvbnRDZG5UZW1wbGF0ZVN0YWNrIGV4dGVuZHMgY2RrLlN0YWNrIHtcbiAgY29uc3RydWN0b3IoXG4gICAgc2NvcGU6IENvbnN0cnVjdCxcbiAgICBpZDogc3RyaW5nLFxuICAgIHByb3BzOiBDbG91ZGZyb250Q2RuVGVtcGxhdGVTdGFja1Byb3BzLFxuICApIHtcbiAgICBzdXBlcihzY29wZSwgaWQsIHByb3BzKTtcblxuICAgIGNvbnN0IHtcbiAgICAgIGFwcE5hbWUsXG4gICAgfSA9IHByb3BzO1xuXG4gICAgYnVpbGRDb21tb24oKTtcbiAgICBidWlsZEZyb250ZW5kKCk7XG5cbiAgICBjb25zdCBmdW5jdGlvbk5hbWUgPSBhcHBOYW1lO1xuICAgIG5ldyBjZGsuYXdzX2xvZ3MuTG9nR3JvdXAodGhpcywgJ0Fwb2xsb0xhbWJkYUZ1bmN0aW9uTG9nR3JvdXAnLCB7XG4gICAgICBsb2dHcm91cE5hbWU6IGAvYXdzL2xhbWJkYS8ke2Z1bmN0aW9uTmFtZX1gLFxuICAgICAgcmVtb3ZhbFBvbGljeTogY2RrLlJlbW92YWxQb2xpY3kuREVTVFJPWSxcbiAgICAgIHJldGVudGlvbjogY2RrLmF3c19sb2dzLlJldGVudGlvbkRheXMuT05FX0RBWSxcbiAgICB9KTtcblxuICAgIGNvbnN0IGRldk9wdGlvbnMgPSB7XG4gICAgICBhcHBsaWNhdGlvbkxvZ0xldmVsVjI6IGNkay5hd3NfbGFtYmRhLkFwcGxpY2F0aW9uTG9nTGV2ZWwuVFJBQ0UsXG4gICAgfTtcblxuICAgIGNvbnN0IGZuID0gbmV3IGNkay5hd3NfbGFtYmRhX25vZGVqcy5Ob2RlanNGdW5jdGlvbih0aGlzLCAnTGFtYmRhJywge1xuICAgICAgcnVudGltZTogY2RrLmF3c19sYW1iZGEuUnVudGltZS5OT0RFSlNfMjRfWCxcbiAgICAgIGFyY2hpdGVjdHVyZTogY2RrLmF3c19sYW1iZGEuQXJjaGl0ZWN0dXJlLkFSTV82NCxcbiAgICAgIGVudHJ5OiAnLi9sYW1iZGEvaW5kZXgudHMnLFxuICAgICAgZnVuY3Rpb25OYW1lLFxuICAgICAgcmV0cnlBdHRlbXB0czogMCxcbiAgICAgIGJ1bmRsaW5nOiB7XG4gICAgICAgIHRhcmdldDogJ25vZGUyNCcsXG4gICAgICAgIG1pbmlmeTogdHJ1ZSxcbiAgICAgICAgZm9ybWF0OiBjZGsuYXdzX2xhbWJkYV9ub2RlanMuT3V0cHV0Rm9ybWF0LkVTTSxcbiAgICAgICAgYmFubmVyOiAnaW1wb3J0IHsgY3JlYXRlUmVxdWlyZSB9IGZyb20gXFwnbW9kdWxlXFwnO2NvbnN0IHJlcXVpcmUgPSBjcmVhdGVSZXF1aXJlKGltcG9ydC5tZXRhLnVybCk7JyxcbiAgICAgICAgLy8gLi4uZGV2T3B0aW9ucy5idW5kbGluZyxcbiAgICAgIH0sXG4gICAgICBtZW1vcnlTaXplOiAyNTYsXG4gICAgICB0aW1lb3V0OiBjZGsuRHVyYXRpb24ubWludXRlcygxKSxcbiAgICAgIHJvbGU6IG5ldyBjZGsuYXdzX2lhbS5Sb2xlKHRoaXMsICdBcG9sbG9MYW1iZGFGdW5jdGlvbkV4ZWN1dGlvblJvbGUnLCB7XG4gICAgICAgIGFzc3VtZWRCeTogbmV3IGNkay5hd3NfaWFtLlNlcnZpY2VQcmluY2lwYWwoJ2Nkay5hd3NfbGFtYmRhLmFtYXpvbmF3cy5jb20nKSxcbiAgICAgICAgbWFuYWdlZFBvbGljaWVzOiBbXG4gICAgICAgICAgY2RrLmF3c19pYW0uTWFuYWdlZFBvbGljeS5mcm9tQXdzTWFuYWdlZFBvbGljeU5hbWUoJ0FXU0xhbWJkYUV4ZWN1dGUnKSxcbiAgICAgICAgICBjZGsuYXdzX2lhbS5NYW5hZ2VkUG9saWN5LmZyb21Bd3NNYW5hZ2VkUG9saWN5TmFtZSgnQ2xvdWRGcm9udFJlYWRPbmx5QWNjZXNzJyksXG4gICAgICAgIF0sXG4gICAgICAgIGlubGluZVBvbGljaWVzOiB7XG4gICAgICAgICAgJ2JlZHJvY2stcG9saWN5JzogbmV3IGNkay5hd3NfaWFtLlBvbGljeURvY3VtZW50KHtcbiAgICAgICAgICAgIHN0YXRlbWVudHM6IFtcbiAgICAgICAgICAgICAgbmV3IGNkay5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCh7XG4gICAgICAgICAgICAgICAgZWZmZWN0OiBjZGsuYXdzX2lhbS5FZmZlY3QuQUxMT1csXG4gICAgICAgICAgICAgICAgYWN0aW9uczogW1xuICAgICAgICAgICAgICAgICAgJ2JlZHJvY2s6SW52b2tlTW9kZWwqJyxcbiAgICAgICAgICAgICAgICAgICdsb2dzOlB1dExvZ0V2ZW50cycsXG4gICAgICAgICAgICAgICAgXSxcbiAgICAgICAgICAgICAgICByZXNvdXJjZXM6IFsnKiddLFxuICAgICAgICAgICAgICB9KSxcbiAgICAgICAgICAgIF0sXG4gICAgICAgICAgfSksXG4gICAgICAgIH0sXG4gICAgICB9KSxcbiAgICAgIGxvZ2dpbmdGb3JtYXQ6IGNkay5hd3NfbGFtYmRhLkxvZ2dpbmdGb3JtYXQuSlNPTixcbiAgICAgIGFwcGxpY2F0aW9uTG9nTGV2ZWxWMjogZGV2T3B0aW9ucy5hcHBsaWNhdGlvbkxvZ0xldmVsVjIsXG4gICAgfSk7XG5cbiAgICBuZXcgY2RrLmF3c19sYW1iZGEuRnVuY3Rpb25VcmwodGhpcywgJ0xhbWJkYUZ1bmN0aW9uVXJsJywge1xuICAgICAgZnVuY3Rpb246IGZuLFxuICAgICAgYXV0aFR5cGU6IGNkay5hd3NfbGFtYmRhLkZ1bmN0aW9uVXJsQXV0aFR5cGUuTk9ORSxcbiAgICAgIGludm9rZU1vZGU6IGNkay5hd3NfbGFtYmRhLkludm9rZU1vZGUuUkVTUE9OU0VfU1RSRUFNLFxuICAgIH0pO1xuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/agents/agent-strands/lib/cdk-stack.ts b/agents/agent-strands/lib/cdk-stack.ts new file mode 100644 index 00000000..ae8632b8 --- /dev/null +++ b/agents/agent-strands/lib/cdk-stack.ts @@ -0,0 +1,77 @@ +import * as cdk from 'aws-cdk-lib'; +import { Construct } from 'constructs'; + +interface CloudfrontCdnTemplateStackProps extends cdk.StackProps { + appName: string +} + +export class CloudfrontCdnTemplateStack extends cdk.Stack { + constructor( + scope: Construct, + id: string, + props: CloudfrontCdnTemplateStackProps, + ) { + super(scope, id, props); + + const { + appName, + } = props; + + const functionName = appName; + new cdk.aws_logs.LogGroup(this, 'ApolloLambdaFunctionLogGroup', { + logGroupName: `/aws/lambda/${functionName}`, + removalPolicy: cdk.RemovalPolicy.DESTROY, + retention: cdk.aws_logs.RetentionDays.ONE_DAY, + }); + + const devOptions = { + applicationLogLevelV2: cdk.aws_lambda.ApplicationLogLevel.TRACE, + }; + + const fn = new cdk.aws_lambda_nodejs.NodejsFunction(this, 'Lambda', { + runtime: cdk.aws_lambda.Runtime.NODEJS_24_X, + architecture: cdk.aws_lambda.Architecture.ARM_64, + entry: './lambda/index.ts', + functionName, + retryAttempts: 0, + bundling: { + target: 'node24', + minify: true, + format: cdk.aws_lambda_nodejs.OutputFormat.ESM, + banner: 'import { createRequire } from \'module\';const require = createRequire(import.meta.url);', + // ...devOptions.bundling, + }, + memorySize: 256, + timeout: cdk.Duration.minutes(1), + role: new cdk.aws_iam.Role(this, 'ApolloLambdaFunctionExecutionRole', { + assumedBy: new cdk.aws_iam.ServicePrincipal('lambda.amazonaws.com'), + managedPolicies: [ + cdk.aws_iam.ManagedPolicy.fromAwsManagedPolicyName('AWSLambdaExecute'), + cdk.aws_iam.ManagedPolicy.fromAwsManagedPolicyName('CloudFrontReadOnlyAccess'), + ], + inlinePolicies: { + 'bedrock-policy': new cdk.aws_iam.PolicyDocument({ + statements: [ + new cdk.aws_iam.PolicyStatement({ + effect: cdk.aws_iam.Effect.ALLOW, + actions: [ + 'bedrock:InvokeModel*', + 'logs:PutLogEvents', + ], + resources: ['*'], + }), + ], + }), + }, + }), + loggingFormat: cdk.aws_lambda.LoggingFormat.JSON, + applicationLogLevelV2: devOptions.applicationLogLevelV2, + }); + + new cdk.aws_lambda.FunctionUrl(this, 'LambdaFunctionUrl', { + function: fn, + authType: cdk.aws_lambda.FunctionUrlAuthType.NONE, + invokeMode: cdk.aws_lambda.InvokeMode.RESPONSE_STREAM, + }); + } +} diff --git a/agents/agent-strands/package.json b/agents/agent-strands/package.json new file mode 100644 index 00000000..40b7fcc9 --- /dev/null +++ b/agents/agent-strands/package.json @@ -0,0 +1,43 @@ +{ + "name": "agent-strands", + "version": "0.1.0", + "type": "module", + "scripts": { + "build": "tsc", + "watch": "tsc -w", + "test": "vitest run --passWithNoTests", + "lint": "eslint .", + "lint-fix": "eslint . --fix" + }, + "devDependencies": { + "@eslint/compat": "^2.0.0", + "@eslint/js": "^9.39.1", + "@stylistic/eslint-plugin": "^5.6.1", + "@types/aws-lambda": "^8.10.159", + "@types/node": "24.10.1", + "@vitest/eslint-plugin": "^1.5.1", + "aws-cdk": "^2.1033.0", + "dotenv": "^17.2.3", + "esbuild": "^0.25.12", + "eslint": "^9.39.1", + "eslint-import-resolver-typescript": "^4.4.4", + "eslint-plugin-import": "^2.32.0", + "eslint-plugin-promise": "^7.2.1", + "jiti": "^2.6.1", + "tsx": "^4.21.0", + "typescript": "^5.9.3", + "typescript-eslint": "^8.48.1", + "vite": "^7.2.6", + "vite-tsconfig-paths": "^5.1.4", + "vitest": "^4.0.15" + }, + "dependencies": { + "@aws-lambda-powertools/logger": "^2.29.0", + "@aws-sdk/credential-provider-node": "^3.946.0", + "@llm-ts-example/common-backend": "workspace:*", + "@strands-agents/sdk": "^0.1.2", + "aws-cdk-lib": "^2.232.1", + "constructs": "^10.4.3", + "uuid": "^13.0.0" + } +} diff --git a/agents/agent-strands/test/index.test.d.ts b/agents/agent-strands/test/index.test.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/agents/agent-strands/test/index.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/agents/agent-strands/test/index.test.js b/agents/agent-strands/test/index.test.js new file mode 100644 index 00000000..b29c9d26 --- /dev/null +++ b/agents/agent-strands/test/index.test.js @@ -0,0 +1,20 @@ +import { test } from 'vitest'; +import { stdout } from 'node:process'; +import { PassThrough } from 'node:stream'; +import { handle } from '../lambda/index.js'; +function sleep(time) { + return new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, time); + }); +} +const model = process.env.USE_MODEL ?? ''; +const isDefinedModel = model.length > 0; +test.runIf(isDefinedModel)('test', { retry: 0 }, async () => { + const output = process.env.DISABLE_STDOUT === 'true' ? new PassThrough() : stdout; + const question = process.env.QUESTION && process.env.QUESTION.length > 0 ? process.env.QUESTION : 'あなたは誰?質問と同じ言語で答えてください。'; + await handle({ question, model }, output); + await sleep(2000); +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgudGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImluZGV4LnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLElBQUksRUFBRSxNQUFNLFFBQVEsQ0FBQztBQUM5QixPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sY0FBYyxDQUFDO0FBQ3RDLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDMUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRTVDLFNBQVMsS0FBSyxDQUFDLElBQVk7SUFDekIsT0FBTyxJQUFJLE9BQU8sQ0FBTyxDQUFDLE9BQU8sRUFBRSxFQUFFO1FBQ25DLFVBQVUsQ0FBQyxHQUFHLEVBQUU7WUFDZCxPQUFPLEVBQUUsQ0FBQztRQUNaLENBQUMsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUNYLENBQUMsQ0FBQyxDQUFDO0FBQ0wsQ0FBQztBQUVELE1BQU0sS0FBSyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsU0FBUyxJQUFJLEVBQUUsQ0FBQztBQUMxQyxNQUFNLGNBQWMsR0FBRyxLQUFLLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQztBQUN4QyxJQUFJLENBQUMsS0FBSyxDQUFDLGNBQWMsQ0FBQyxDQUFDLE1BQU0sRUFBRSxFQUFFLEtBQUssRUFBRSxDQUFDLEVBQUUsRUFBRSxLQUFLLElBQUksRUFBRTtJQUUxRCxNQUFNLE1BQU0sR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLGNBQWMsS0FBSyxNQUFNLENBQUMsQ0FBQyxDQUFDLElBQUksV0FBVyxFQUFFLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQztJQUNsRixNQUFNLFFBQVEsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLFFBQVEsSUFBSSxPQUFPLENBQUMsR0FBRyxDQUFDLFFBQVEsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsd0JBQXdCLENBQUM7SUFFM0gsTUFBTSxNQUFNLENBQUMsRUFBQyxRQUFRLEVBQUUsS0FBSyxFQUFDLEVBQUUsTUFBTSxDQUFDLENBQUM7SUFDeEMsTUFBTSxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUM7QUFDcEIsQ0FBQyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyB0ZXN0IH0gZnJvbSAndml0ZXN0JztcbmltcG9ydCB7IHN0ZG91dCB9IGZyb20gJ25vZGU6cHJvY2Vzcyc7XG5pbXBvcnQgeyBQYXNzVGhyb3VnaCB9IGZyb20gJ25vZGU6c3RyZWFtJztcbmltcG9ydCB7IGhhbmRsZSB9IGZyb20gJy4uL2xhbWJkYS9pbmRleC5qcyc7XG5cbmZ1bmN0aW9uIHNsZWVwKHRpbWU6IG51bWJlcikge1xuICByZXR1cm4gbmV3IFByb21pc2U8dm9pZD4oKHJlc29sdmUpID0+IHtcbiAgICBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgIHJlc29sdmUoKTtcbiAgICB9LCB0aW1lKTtcbiAgfSk7XG59XG5cbmNvbnN0IG1vZGVsID0gcHJvY2Vzcy5lbnYuVVNFX01PREVMID8/ICcnO1xuY29uc3QgaXNEZWZpbmVkTW9kZWwgPSBtb2RlbC5sZW5ndGggPiAwO1xudGVzdC5ydW5JZihpc0RlZmluZWRNb2RlbCkoJ3Rlc3QnLCB7IHJldHJ5OiAwIH0sIGFzeW5jICgpID0+IHtcblxuICBjb25zdCBvdXRwdXQgPSBwcm9jZXNzLmVudi5ESVNBQkxFX1NURE9VVCA9PT0gJ3RydWUnID8gbmV3IFBhc3NUaHJvdWdoKCkgOiBzdGRvdXQ7XG4gIGNvbnN0IHF1ZXN0aW9uID0gcHJvY2Vzcy5lbnYuUVVFU1RJT04gJiYgcHJvY2Vzcy5lbnYuUVVFU1RJT04ubGVuZ3RoID4gMCA/IHByb2Nlc3MuZW52LlFVRVNUSU9OIDogJ+OBguOBquOBn+OBr+iqsO+8n+izquWVj+OBqOWQjOOBmOiogOiqnuOBp+etlOOBiOOBpuOBj+OBoOOBleOBhOOAgic7XG5cbiAgYXdhaXQgaGFuZGxlKHtxdWVzdGlvbiwgbW9kZWx9LCBvdXRwdXQpO1xuICBhd2FpdCBzbGVlcCgyMDAwKTtcbn0pO1xuIl19 \ No newline at end of file diff --git a/agents/agent-strands/test/index.test.ts b/agents/agent-strands/test/index.test.ts new file mode 100644 index 00000000..34150c94 --- /dev/null +++ b/agents/agent-strands/test/index.test.ts @@ -0,0 +1,23 @@ +import { test } from 'vitest'; +import { stdout } from 'node:process'; +import { PassThrough } from 'node:stream'; +import { handle } from '../lambda/index.js'; + +function sleep(time: number) { + return new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, time); + }); +} + +const model = process.env.USE_MODEL ?? ''; +const isDefinedModel = model.length > 0; +test.runIf(isDefinedModel)('test', { retry: 0 }, async () => { + + const output = process.env.DISABLE_STDOUT === 'true' ? new PassThrough() : stdout; + const message = process.env.QUESTION && process.env.QUESTION.length > 0 ? process.env.QUESTION : 'あなたは誰?質問と同じ言語で答えてください。'; + + await handle({message, model}, output); + await sleep(2000); +}); diff --git a/agents/agent-strands/tsconfig.json b/agents/agent-strands/tsconfig.json new file mode 100644 index 00000000..6d3c7d41 --- /dev/null +++ b/agents/agent-strands/tsconfig.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "lib": [ + "es2022" + ], + "declaration": true, + "strict": true, + "noImplicitAny": true, + "strictNullChecks": true, + "noImplicitThis": true, + "alwaysStrict": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": false, + "inlineSourceMap": true, + "inlineSources": true, + "experimentalDecorators": true, + "strictPropertyInitialization": false, + "skipLibCheck": true, + "typeRoots": [ + "./node_modules/@types" + ] + }, + "exclude": [ + "node_modules" + ] +} diff --git a/agents/agent-voltagent/package.json b/agents/agent-voltagent/package.json index 83137483..55e83142 100644 --- a/agents/agent-voltagent/package.json +++ b/agents/agent-voltagent/package.json @@ -22,7 +22,7 @@ "@voltagent/libsql": "^1.0.13", "@voltagent/logger": "^1.0.4", "@voltagent/server-hono": "^1.2.5", - "ai": "^5.0.106", + "ai": "^5.0.107", "dotenv": "^16.6.1", "hono": "^4.10.7", "zod": "^4.1.13" diff --git a/basic/cdk/package.json b/basic/cdk/package.json index 8e940343..e00fac11 100644 --- a/basic/cdk/package.json +++ b/basic/cdk/package.json @@ -38,10 +38,10 @@ "@arizeai/openinference-instrumentation-bedrock": "^0.4.3", "@arizeai/openinference-instrumentation-langchain": "^3.4.6", "@aws-lambda-powertools/logger": "^2.29.0", - "@aws-sdk/credential-provider-node": "^3.943.0", + "@aws-sdk/credential-provider-node": "^3.946.0", "@langchain/aws": "^1.1.0", "@langchain/classic": "^1.0.5", - "@langchain/core": "^1.1.3", + "@langchain/core": "^1.1.4", "@langchain/langgraph": "^1.0.4", "@langchain/openai": "^1.1.3", "@llm-ts-example/common-backend": "workspace:*", @@ -55,7 +55,7 @@ "@opentelemetry/sdk-trace-node": "^2.2.0", "@opentelemetry/semantic-conventions": "^1.38.0", "@smithy/eventstream-codec": "^4.2.5", - "aws-cdk-lib": "^2.231.0", + "aws-cdk-lib": "^2.232.1", "constructs": "^10.4.3", "langfuse": "^3.38.6", "langfuse-langchain": "^3.38.6", diff --git a/common/backend/package.json b/common/backend/package.json index f3ac402e..bcc5fef1 100644 --- a/common/backend/package.json +++ b/common/backend/package.json @@ -26,7 +26,7 @@ "dependencies": { "@aws-lambda-powertools/logger": "^2.29.0", "@langchain/aws": "^1.1.0", - "@langchain/core": "^1.1.3", + "@langchain/core": "^1.1.4", "@langchain/openai": "^1.1.3", "@llm-ts-example/common-core": "workspace:*" }, diff --git a/mcp/clients/langgraph-mcp-client/package.json b/mcp/clients/langgraph-mcp-client/package.json index 2d5414b3..5e0b25e7 100644 --- a/mcp/clients/langgraph-mcp-client/package.json +++ b/mcp/clients/langgraph-mcp-client/package.json @@ -34,17 +34,17 @@ "vitest": "^4.0.15" }, "dependencies": { - "@aws-sdk/client-bedrock-runtime": "^3.943.0", + "@aws-sdk/client-bedrock-runtime": "^3.946.0", "@inquirer/prompts": "^7.10.1", "@langchain/aws": "^1.1.0", - "@langchain/core": "^1.1.3", + "@langchain/core": "^1.1.4", "@langchain/langgraph": "^1.0.4", "@langchain/mcp-adapters": "^1.0.3", "@langchain/openai": "^1.1.3", "@modelcontextprotocol/sdk": "^1.24.3", "@smithy/eventstream-codec": "^4.2.5", "dotenv": "^16.6.1", - "langchain": "^1.1.4", + "langchain": "^1.1.5", "langfuse": "^3.38.6", "langfuse-langchain": "^3.38.6", "uuid": "^13.0.0" diff --git a/mcp/clients/mastra-mcp-client/tsconfig.json b/mcp/clients/mastra-mcp-client/tsconfig.json index b4f461ee..e1014a14 100644 --- a/mcp/clients/mastra-mcp-client/tsconfig.json +++ b/mcp/clients/mastra-mcp-client/tsconfig.json @@ -8,7 +8,8 @@ "strict": true, "skipLibCheck": true, "noEmit": true, - "outDir": "dist" + "outDir": "dist", + "rootDir": "./src/mastra" }, "include": [ "src/**/*" diff --git a/mcp/clients/mcp-client-http/package.json b/mcp/clients/mcp-client-http/package.json index 33138f0c..a3b91b59 100644 --- a/mcp/clients/mcp-client-http/package.json +++ b/mcp/clients/mcp-client-http/package.json @@ -18,7 +18,7 @@ "license": "ISC", "dependencies": { "@anthropic-ai/sdk": "^0.69.0", - "@aws-sdk/client-bedrock-runtime": "^3.943.0", + "@aws-sdk/client-bedrock-runtime": "^3.946.0", "@inquirer/prompts": "^8.0.2", "@modelcontextprotocol/sdk": "^1.24.3", "dotenv": "^17.2.3" diff --git a/mcp/clients/mcp-client-typescript/package.json b/mcp/clients/mcp-client-typescript/package.json index cb95a3d6..2d534cb0 100644 --- a/mcp/clients/mcp-client-typescript/package.json +++ b/mcp/clients/mcp-client-typescript/package.json @@ -14,7 +14,7 @@ "license": "ISC", "dependencies": { "@anthropic-ai/sdk": "^0.69.0", - "@aws-sdk/client-bedrock-runtime": "^3.943.0", + "@aws-sdk/client-bedrock-runtime": "^3.946.0", "@inquirer/prompts": "^8.0.2", "@modelcontextprotocol/sdk": "^1.24.3", "dotenv": "^17.2.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 205388e0..d3c5e4f6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -61,7 +61,7 @@ importers: version: 0.15.12(@mastra/core@0.24.6(openapi-types@12.1.3)(zod@4.1.13))(zod@4.1.13) langfuse-vercel: specifier: ^3.38.6 - version: 3.38.6(ai@5.0.106(zod@4.1.13)) + version: 3.38.6(ai@5.0.107(zod@4.1.13)) zod: specifier: ^4.1.13 version: 4.1.13 @@ -103,8 +103,8 @@ importers: agents/agent-sdk: dependencies: '@anthropic-ai/claude-agent-sdk': - specifier: ^0.1.59 - version: 0.1.59(zod@4.1.13) + specifier: ^0.1.60 + version: 0.1.60(zod@4.1.13) source-map-support: specifier: ^0.5.21 version: 0.5.21 @@ -170,6 +170,91 @@ importers: specifier: ^4.0.15 version: 4.0.15(@opentelemetry/api@1.9.0)(@types/node@24.10.1)(jiti@2.6.1)(jsdom@27.2.0)(lightningcss@1.30.1)(tsx@4.21.0)(yaml@2.8.2) + agents/agent-strands: + dependencies: + '@aws-lambda-powertools/logger': + specifier: ^2.29.0 + version: 2.29.0 + '@aws-sdk/credential-provider-node': + specifier: ^3.946.0 + version: 3.946.0 + '@llm-ts-example/common-backend': + specifier: workspace:* + version: link:../../common/backend + '@strands-agents/sdk': + specifier: ^0.1.2 + version: 0.1.2(@cfworker/json-schema@4.1.1)(ws@8.18.3) + aws-cdk-lib: + specifier: ^2.232.1 + version: 2.232.1(constructs@10.4.3) + constructs: + specifier: ^10.4.3 + version: 10.4.3 + uuid: + specifier: ^13.0.0 + version: 13.0.0 + devDependencies: + '@eslint/compat': + specifier: ^2.0.0 + version: 2.0.0(eslint@9.39.1(jiti@2.6.1)) + '@eslint/js': + specifier: ^9.39.1 + version: 9.39.1 + '@stylistic/eslint-plugin': + specifier: ^5.6.1 + version: 5.6.1(eslint@9.39.1(jiti@2.6.1)) + '@types/aws-lambda': + specifier: ^8.10.159 + version: 8.10.159 + '@types/node': + specifier: 24.10.1 + version: 24.10.1 + '@vitest/eslint-plugin': + specifier: ^1.5.1 + version: 1.5.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3)(vitest@4.0.15(@opentelemetry/api@1.9.0)(@types/node@24.10.1)(jiti@2.6.1)(jsdom@27.2.0)(lightningcss@1.30.1)(tsx@4.21.0)(yaml@2.8.2)) + aws-cdk: + specifier: ^2.1033.0 + version: 2.1033.0 + dotenv: + specifier: ^17.2.3 + version: 17.2.3 + esbuild: + specifier: ^0.25.12 + version: 0.25.12 + eslint: + specifier: ^9.39.1 + version: 9.39.1(jiti@2.6.1) + eslint-import-resolver-typescript: + specifier: ^4.4.4 + version: 4.4.4(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint@9.39.1(jiti@2.6.1)))(eslint-plugin-import@2.32.0)(eslint@9.39.1(jiti@2.6.1)) + eslint-plugin-import: + specifier: ^2.32.0 + version: 2.32.0(@typescript-eslint/parser@8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1(jiti@2.6.1)) + eslint-plugin-promise: + specifier: ^7.2.1 + version: 7.2.1(eslint@9.39.1(jiti@2.6.1)) + jiti: + specifier: ^2.6.1 + version: 2.6.1 + tsx: + specifier: ^4.21.0 + version: 4.21.0 + typescript: + specifier: ^5.9.3 + version: 5.9.3 + typescript-eslint: + specifier: ^8.48.1 + version: 8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + vite: + specifier: ^7.2.6 + version: 7.2.6(@types/node@24.10.1)(jiti@2.6.1)(lightningcss@1.30.1)(tsx@4.21.0)(yaml@2.8.2) + vite-tsconfig-paths: + specifier: ^5.1.4 + version: 5.1.4(typescript@5.9.3)(vite@7.2.6(@types/node@24.10.1)(jiti@2.6.1)(lightningcss@1.30.1)(tsx@4.21.0)(yaml@2.8.2)) + vitest: + specifier: ^4.0.15 + version: 4.0.15(@opentelemetry/api@1.9.0)(@types/node@24.10.1)(jiti@2.6.1)(jsdom@27.2.0)(lightningcss@1.30.1)(tsx@4.21.0)(yaml@2.8.2) + agents/agent-voltagent: dependencies: '@ai-sdk/amazon-bedrock': @@ -177,22 +262,22 @@ importers: version: 3.0.67(zod@4.1.13) '@voltagent/cli': specifier: ^0.1.16 - version: 0.1.16(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@types/node@24.10.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + version: 0.1.16(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@types/node@24.10.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/core': specifier: ^1.2.15 - version: 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + version: 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/libsql': specifier: ^1.0.13 - version: 1.0.13(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13)) + version: 1.0.13(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13)) '@voltagent/logger': specifier: ^1.0.4 version: 1.0.4(@opentelemetry/api@1.9.0) '@voltagent/server-hono': specifier: ^1.2.5 - version: 1.2.5(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(zod@4.1.13) + version: 1.2.5(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(zod@4.1.13) ai: - specifier: ^5.0.106 - version: 5.0.106(zod@4.1.13) + specifier: ^5.0.107 + version: 5.0.107(zod@4.1.13) dotenv: specifier: ^16.6.1 version: 16.6.1 @@ -290,31 +375,31 @@ importers: dependencies: '@arizeai/openinference-instrumentation-bedrock': specifier: ^0.4.3 - version: 0.4.3(@aws-sdk/client-bedrock-runtime@3.943.0) + version: 0.4.3(@aws-sdk/client-bedrock-runtime@3.946.0) '@arizeai/openinference-instrumentation-langchain': specifier: ^3.4.6 - version: 3.4.6(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + version: 3.4.6(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@aws-lambda-powertools/logger': specifier: ^2.29.0 version: 2.29.0 '@aws-sdk/credential-provider-node': - specifier: ^3.943.0 - version: 3.943.0 + specifier: ^3.946.0 + version: 3.946.0 '@langchain/aws': specifier: ^1.1.0 - version: 1.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + version: 1.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@langchain/classic': specifier: ^1.0.5 - version: 1.0.5(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3) + version: 1.0.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3) '@langchain/core': - specifier: ^1.1.3 - version: 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + specifier: ^1.1.4 + version: 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@langchain/langgraph': specifier: ^1.0.4 - version: 1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) + version: 1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) '@langchain/openai': specifier: ^1.1.3 - version: 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + version: 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) '@llm-ts-example/common-backend': specifier: workspace:* version: link:../../common/backend @@ -349,8 +434,8 @@ importers: specifier: ^4.2.5 version: 4.2.5 aws-cdk-lib: - specifier: ^2.231.0 - version: 2.231.0(constructs@10.4.3) + specifier: ^2.232.1 + version: 2.232.1(constructs@10.4.3) constructs: specifier: ^10.4.3 version: 10.4.3 @@ -359,7 +444,7 @@ importers: version: 3.38.6 langfuse-langchain: specifier: ^3.38.6 - version: 3.38.6(langchain@1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))) + version: 3.38.6(langchain@1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))) source-map-support: specifier: ^0.5.21 version: 0.5.21 @@ -444,13 +529,13 @@ importers: version: 2.29.0 '@langchain/aws': specifier: ^1.1.0 - version: 1.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + version: 1.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@langchain/core': - specifier: ^1.1.3 - version: 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + specifier: ^1.1.4 + version: 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@langchain/openai': specifier: ^1.1.3 - version: 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + version: 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) '@llm-ts-example/common-core': specifier: workspace:* version: link:../core @@ -534,26 +619,26 @@ importers: mcp/clients/langgraph-mcp-client: dependencies: '@aws-sdk/client-bedrock-runtime': - specifier: ^3.943.0 - version: 3.943.0 + specifier: ^3.946.0 + version: 3.946.0 '@inquirer/prompts': specifier: ^7.10.1 version: 7.10.1(@types/node@24.10.1) '@langchain/aws': specifier: ^1.1.0 - version: 1.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + version: 1.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@langchain/core': - specifier: ^1.1.3 - version: 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + specifier: ^1.1.4 + version: 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@langchain/langgraph': specifier: ^1.0.4 - version: 1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) + version: 1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) '@langchain/mcp-adapters': specifier: ^1.0.3 - version: 1.0.3(@cfworker/json-schema@4.1.1)(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@langchain/langgraph@1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13)) + version: 1.0.3(@cfworker/json-schema@4.1.1)(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@langchain/langgraph@1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13)) '@langchain/openai': specifier: ^1.1.3 - version: 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + version: 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) '@modelcontextprotocol/sdk': specifier: ^1.24.3 version: 1.24.3(@cfworker/json-schema@4.1.1)(zod@4.1.13) @@ -564,14 +649,14 @@ importers: specifier: ^16.6.1 version: 16.6.1 langchain: - specifier: ^1.1.4 - version: 1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) + specifier: ^1.1.5 + version: 1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) langfuse: specifier: ^3.38.6 version: 3.38.6 langfuse-langchain: specifier: ^3.38.6 - version: 3.38.6(langchain@1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))) + version: 3.38.6(langchain@1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))) uuid: specifier: ^13.0.0 version: 13.0.0 @@ -647,7 +732,7 @@ importers: version: 0.14.4(@cfworker/json-schema@4.1.1)(@mastra/core@0.24.6(openapi-types@12.1.3)(zod@4.1.13))(@types/json-schema@7.0.15)(zod@4.1.13) langfuse-vercel: specifier: ^3.38.6 - version: 3.38.6(ai@5.0.106(zod@4.1.13)) + version: 3.38.6(ai@5.0.107(zod@4.1.13)) zod: specifier: ^4.1.13 version: 4.1.13 @@ -695,8 +780,8 @@ importers: specifier: ^0.69.0 version: 0.69.0(zod@4.1.13) '@aws-sdk/client-bedrock-runtime': - specifier: ^3.943.0 - version: 3.943.0 + specifier: ^3.946.0 + version: 3.946.0 '@inquirer/prompts': specifier: ^8.0.2 version: 8.0.2(@types/node@24.10.1) @@ -747,8 +832,8 @@ importers: specifier: ^0.69.0 version: 0.69.0(zod@4.1.13) '@aws-sdk/client-bedrock-runtime': - specifier: ^3.943.0 - version: 3.943.0 + specifier: ^3.946.0 + version: 3.946.0 '@inquirer/prompts': specifier: ^8.0.2 version: 8.0.2(@types/node@24.10.1) @@ -1096,25 +1181,25 @@ importers: dependencies: '@langchain/aws': specifier: ^1.1.0 - version: 1.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + version: 1.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@langchain/classic': specifier: ^1.0.5 - version: 1.0.5(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3) + version: 1.0.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3) '@langchain/community': specifier: ^1.0.7 - version: 1.0.7(ee9edf035d3124403fc21c2491f2a8b8) + version: 1.0.7(964061b1ee7e8f3b0e1fa21e45f97373) '@langchain/core': - specifier: ^1.1.3 - version: 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + specifier: ^1.1.4 + version: 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@langchain/langgraph': specifier: ^1.0.4 - version: 1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) + version: 1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) '@langchain/openai': specifier: ^1.1.3 - version: 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + version: 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) '@langchain/pinecone': specifier: ^1.0.1 - version: 1.0.1(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@pinecone-database/pinecone@6.1.3) + version: 1.0.1(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@pinecone-database/pinecone@6.1.3) '@pinecone-database/pinecone': specifier: ^6.1.3 version: 6.1.3 @@ -1134,8 +1219,8 @@ importers: specifier: ^27.2.0 version: 27.2.0 langchain: - specifier: ^1.1.4 - version: 1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) + specifier: ^1.1.5 + version: 1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) source-map-support: specifier: ^0.5.21 version: 0.5.21 @@ -1180,23 +1265,23 @@ importers: specifier: ^2.29.0 version: 2.29.0 '@aws-sdk/credential-provider-node': - specifier: ^3.943.0 - version: 3.943.0 + specifier: ^3.946.0 + version: 3.946.0 '@langchain/aws': specifier: ^1.1.0 - version: 1.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + version: 1.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@langchain/core': - specifier: ^1.1.3 - version: 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + specifier: ^1.1.4 + version: 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@langchain/langgraph': specifier: ^1.0.4 - version: 1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) + version: 1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) '@langchain/openai': specifier: ^1.1.3 - version: 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + version: 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) '@langchain/pinecone': specifier: ^1.0.1 - version: 1.0.1(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@pinecone-database/pinecone@6.1.3) + version: 1.0.1(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@pinecone-database/pinecone@6.1.3) '@llm-ts-example/common-backend': specifier: workspace:* version: link:../../common/backend @@ -1207,20 +1292,20 @@ importers: specifier: ^4.2.5 version: 4.2.5 aws-cdk-lib: - specifier: ^2.231.0 - version: 2.231.0(constructs@10.4.3) + specifier: ^2.232.1 + version: 2.232.1(constructs@10.4.3) constructs: specifier: ^10.4.3 version: 10.4.3 langchain: - specifier: ^1.1.4 - version: 1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) + specifier: ^1.1.5 + version: 1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) langfuse: specifier: ^3.38.6 version: 3.38.6 langfuse-langchain: specifier: ^3.38.6 - version: 3.38.6(langchain@1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))) + version: 3.38.6(langchain@1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))) source-map-support: specifier: ^0.5.21 version: 0.5.21 @@ -1444,8 +1529,8 @@ packages: peerDependencies: zod: ^3.25.76 || ^4.1.8 - '@anthropic-ai/claude-agent-sdk@0.1.59': - resolution: {integrity: sha512-9TMxQCkIOd9W3c+owLtTW7d1ZgWeYoz1tbUwqz1TiKJTZmsmAFHUfXebQsJBZ+W15g6msqA6ln9yYxOKlNnlGw==} + '@anthropic-ai/claude-agent-sdk@0.1.60': + resolution: {integrity: sha512-Kl7zo4yNiUs3fRc9CQ5kcRuihdPEzH26boC5E8szO9WMNwPFBfJExLfYZDAcYmFaE3+M6mLpuYzmTGLxSoXrhg==} engines: {node: '>=18.0.0'} peerDependencies: zod: ^3.24.1 @@ -1491,8 +1576,8 @@ packages: '@asamuzakjp/css-color@4.1.0': resolution: {integrity: sha512-9xiBAtLn4aNsa4mDnpovJvBn72tNEIACyvlqaNJ+ADemR+yeMJWnBudOi2qGDviJa7SwcDOU/TRh5dnET7qk0w==} - '@asamuzakjp/dom-selector@6.7.5': - resolution: {integrity: sha512-Eks6dY8zau4m4wNRQjRVaKQRTalNcPcBvU1ZQ35w5kKRk1gUeNCkVLsRiATurjASTp3TKM4H10wsI50nx3NZdw==} + '@asamuzakjp/dom-selector@6.7.6': + resolution: {integrity: sha512-hBaJER6A9MpdG3WgdlOolHmbOYvSk46y7IQN/1+iqiCuUu6iWdQrs9DGKF8ocqsEqWujWf/V7b7vaDgiUmIvUg==} '@asamuzakjp/nwsapi@2.3.9': resolution: {integrity: sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==} @@ -1547,96 +1632,96 @@ packages: '@middy/core': optional: true - '@aws-sdk/client-bedrock-agent-runtime@3.943.0': - resolution: {integrity: sha512-/Q6okJgiMDZfUjMbGgzWKItSsfqF94/ifV1gzia2wLRhEA8Hdgg+YeCIow0oLYiCg556juHDz4CqL03MApgwQw==} + '@aws-sdk/client-bedrock-agent-runtime@3.946.0': + resolution: {integrity: sha512-QKOp8y4Q9Rzt91ZYi9BFgZk2P40TTd4e5MiCk85JTp36VCSgYl9zOTPPxUllEV6wpegz4CtICdBISsQqI0IqXg==} engines: {node: '>=18.0.0'} - '@aws-sdk/client-bedrock-runtime@3.943.0': - resolution: {integrity: sha512-mEiv1g5BeZFIQjBrzM5nT//KYLOBwUkXtHzsufkV99TIEKW5qzgOgx9Q9O8IbFQk3c7C6HYkV/kNOUI3KGyH6g==} + '@aws-sdk/client-bedrock-runtime@3.946.0': + resolution: {integrity: sha512-ZuUBQh5VswxHp8xBUmSyn/6u/IZ/kjxC2B3kBQMoaJlEriokBvDkc6tKWEeWEM/gEwFhJxYfXgJSpAZUmsjGFQ==} engines: {node: '>=18.0.0'} '@aws-sdk/client-dynamodb@3.919.0': resolution: {integrity: sha512-RXIebz/xPJN0Sl00FX5dVElHAuWOmHN3c5JyuC72h4kXeDpULPa+I1rFdZ458+FequaLt4JGk7unrT7QO2noCA==} engines: {node: '>=18.0.0'} - '@aws-sdk/client-kendra@3.943.0': - resolution: {integrity: sha512-HSW2XDkylaLBnDqCYdmtRgqKMiY6W12+bxfycz13V8e5dU2JarFf8Z61oh6onvdtE2E/KSu8WBK4m55/smp7NQ==} + '@aws-sdk/client-kendra@3.946.0': + resolution: {integrity: sha512-arkkD4NKcOKeHvblpN4vBqfR5wuWkpRuG7gFdHpl6WbFgqcXgJr2zov8f16VxI5iGUGMX4SJDzIdsQrapGHyRQ==} engines: {node: '>=18.0.0'} '@aws-sdk/client-sso@3.919.0': resolution: {integrity: sha512-9DVw/1DCzZ9G7Jofnhpg/XDC3wdJ3NAJdNWY1TrgE5ZcpTM+UTIQMGyaljCv9rgxggutHBgmBI5lP3YMcPk9ZQ==} engines: {node: '>=18.0.0'} - '@aws-sdk/client-sso@3.943.0': - resolution: {integrity: sha512-kOTO2B8Ks2qX73CyKY8PAajtf5n39aMe2spoiOF5EkgSzGV7hZ/HONRDyADlyxwfsX39Q2F2SpPUaXzon32IGw==} + '@aws-sdk/client-sso@3.946.0': + resolution: {integrity: sha512-kGAs5iIVyUz4p6TX3pzG5q3cNxXnVpC4pwRC6DCSaSv9ozyPjc2d74FsK4fZ+J+ejtvCdJk72uiuQtWJc86Wuw==} engines: {node: '>=18.0.0'} '@aws-sdk/core@3.916.0': resolution: {integrity: sha512-1JHE5s6MD5PKGovmx/F1e01hUbds/1y3X8rD+Gvi/gWVfdg5noO7ZCerpRsWgfzgvCMZC9VicopBqNHCKLykZA==} engines: {node: '>=18.0.0'} - '@aws-sdk/core@3.943.0': - resolution: {integrity: sha512-8CBy2hI9ABF7RBVQuY1bgf/ue+WPmM/hl0adrXFlhnhkaQP0tFY5zhiy1Y+n7V+5f3/ORoHBmCCQmcHDDYJqJQ==} + '@aws-sdk/core@3.946.0': + resolution: {integrity: sha512-u2BkbLLVbMFrEiXrko2+S6ih5sUZPlbVyRPtXOqMHlCyzr70sE8kIiD6ba223rQeIFPcYfW/wHc6k4ihW2xxVg==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-env@3.916.0': resolution: {integrity: sha512-3gDeqOXcBRXGHScc6xb7358Lyf64NRG2P08g6Bu5mv1Vbg9PKDyCAZvhKLkG7hkdfAM8Yc6UJNhbFxr1ud/tCQ==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-env@3.943.0': - resolution: {integrity: sha512-WnS5w9fK9CTuoZRVSIHLOMcI63oODg9qd1vXMYb7QGLGlfwUm4aG3hdu7i9XvYrpkQfE3dzwWLtXF4ZBuL1Tew==} + '@aws-sdk/credential-provider-env@3.946.0': + resolution: {integrity: sha512-P4l+K6wX1tf8LmWUvZofdQ+BgCNyk6Tb9u1H10npvqpuCD+dCM4pXIBq3PQcv/juUBOvLGGREo+Govuh3lfD0Q==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-http@3.916.0': resolution: {integrity: sha512-NmooA5Z4/kPFJdsyoJgDxuqXC1C6oPMmreJjbOPqcwo6E/h2jxaG8utlQFgXe5F9FeJsMx668dtxVxSYnAAqHQ==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-http@3.943.0': - resolution: {integrity: sha512-SA8bUcYDEACdhnhLpZNnWusBpdmj4Vl67Vxp3Zke7SvoWSYbuxa+tiDiC+c92Z4Yq6xNOuLPW912ZPb9/NsSkA==} + '@aws-sdk/credential-provider-http@3.946.0': + resolution: {integrity: sha512-/zeOJ6E7dGZQ/l2k7KytEoPJX0APIhwt0A79hPf/bUpMF4dDs2P6JmchDrotk0a0Y/MIdNF8sBQ/MEOPnBiYoQ==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-ini@3.919.0': resolution: {integrity: sha512-fAWVfh0P54UFbyAK4tmIPh/X3COFAyXYSp8b2Pc1R6GRwDDMvrAigwGJuyZS4BmpPlXij1gB0nXbhM5Yo4MMMA==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-ini@3.943.0': - resolution: {integrity: sha512-BcLDb8l4oVW+NkuqXMlO7TnM6lBOWW318ylf4FRED/ply5eaGxkQYqdGvHSqGSN5Rb3vr5Ek0xpzSjeYD7C8Kw==} + '@aws-sdk/credential-provider-ini@3.946.0': + resolution: {integrity: sha512-Pdgcra3RivWj/TuZmfFaHbqsvvgnSKO0CxlRUMMr0PgBiCnUhyl+zBktdNOeGsOPH2fUzQpYhcUjYUgVSdcSDQ==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-login@3.943.0': - resolution: {integrity: sha512-9iCOVkiRW+evxiJE94RqosCwRrzptAVPhRhGWv4osfYDhjNAvUMyrnZl3T1bjqCoKNcETRKEZIU3dqYHnUkcwQ==} + '@aws-sdk/credential-provider-login@3.946.0': + resolution: {integrity: sha512-5iqLNc15u2Zx+7jOdQkIbP62N7n2031tw5hkmIG0DLnozhnk64osOh2CliiOE9x3c4P9Pf4frAwgyy9GzNTk2g==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-node@3.919.0': resolution: {integrity: sha512-GL5filyxYS+eZq8ZMQnY5hh79Wxor7Rljo0SUJxZVwEj8cf3zY0MMuwoXU1HQrVabvYtkPDOWSreX8GkIBtBCw==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-node@3.943.0': - resolution: {integrity: sha512-14eddaH/gjCWoLSAELVrFOQNyswUYwWphIt+PdsJ/FqVfP4ay2HsiZVEIYbQtmrKHaoLJhiZKwBQRjcqJDZG0w==} + '@aws-sdk/credential-provider-node@3.946.0': + resolution: {integrity: sha512-I7URUqnBPng1a5y81OImxrwERysZqMBREG6svhhGeZgxmqcpAZ8z5ywILeQXdEOCuuES8phUp/ojzxFjPXp/eA==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-process@3.916.0': resolution: {integrity: sha512-SXDyDvpJ1+WbotZDLJW1lqP6gYGaXfZJrgFSXIuZjHb75fKeNRgPkQX/wZDdUvCwdrscvxmtyJorp2sVYkMcvA==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-process@3.943.0': - resolution: {integrity: sha512-GIY/vUkthL33AdjOJ8r9vOosKf/3X+X7LIiACzGxvZZrtoOiRq0LADppdiKIB48vTL63VvW+eRIOFAxE6UDekw==} + '@aws-sdk/credential-provider-process@3.946.0': + resolution: {integrity: sha512-GtGHX7OGqIeVQ3DlVm5RRF43Qmf3S1+PLJv9svrdvAhAdy2bUb044FdXXqrtSsIfpzTKlHgQUiRo5MWLd35Ntw==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-sso@3.919.0': resolution: {integrity: sha512-oN1XG/frOc2K2KdVwRQjLTBLM1oSFJLtOhuV/6g9N0ASD+44uVJai1CF9JJv5GjHGV+wsqAt+/Dzde0tZEXirA==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-sso@3.943.0': - resolution: {integrity: sha512-1c5G11syUrru3D9OO6Uk+ul5e2lX1adb+7zQNyluNaLPXP6Dina6Sy6DFGRLu7tM8+M7luYmbS3w63rpYpaL+A==} + '@aws-sdk/credential-provider-sso@3.946.0': + resolution: {integrity: sha512-LeGSSt2V5iwYey1ENGY75RmoDP3bA2iE/py8QBKW8EDA8hn74XBLkprhrK5iccOvU3UGWY8WrEKFAFGNjJOL9g==} engines: {node: '>=18.0.0'} '@aws-sdk/credential-provider-web-identity@3.919.0': resolution: {integrity: sha512-Wi7RmyWA8kUJ++/8YceC7U5r4LyvOHGCnJLDHliP8rOC8HLdSgxw/Upeq3WmC+RPw1zyGOtEDRS/caop2xLXEA==} engines: {node: '>=18.0.0'} - '@aws-sdk/credential-provider-web-identity@3.943.0': - resolution: {integrity: sha512-VtyGKHxICSb4kKGuaqotxso8JVM8RjCS3UYdIMOxUt9TaFE/CZIfZKtjTr+IJ7M0P7t36wuSUb/jRLyNmGzUUA==} + '@aws-sdk/credential-provider-web-identity@3.946.0': + resolution: {integrity: sha512-ocBCvjWfkbjxElBI1QUxOnHldsNhoU0uOICFvuRDAZAoxvypJHN3m5BJkqb7gqorBbcv3LRgmBdEnWXOAvq+7Q==} engines: {node: '>=18.0.0'} '@aws-sdk/endpoint-cache@3.893.0': @@ -1683,8 +1768,8 @@ packages: resolution: {integrity: sha512-mzF5AdrpQXc2SOmAoaQeHpDFsK2GE6EGcEACeNuoESluPI2uYMpuuNMYrUufdnIAIyqgKlis0NVxiahA5jG42w==} engines: {node: '>=18.0.0'} - '@aws-sdk/middleware-user-agent@3.943.0': - resolution: {integrity: sha512-956n4kVEwFNXndXfhSAN5wO+KRgqiWEEY+ECwLvxmmO8uQ0NWOa8l6l65nTtyuiWzMX81c9BvlyNR5EgUeeUvA==} + '@aws-sdk/middleware-user-agent@3.946.0': + resolution: {integrity: sha512-7QcljCraeaWQNuqmOoAyZs8KpZcuhPiqdeeKoRd397jVGNRehLFsZbIMOvwaluUDFY11oMyXOkQEERe1Zo2fCw==} engines: {node: '>=18.0.0'} '@aws-sdk/middleware-websocket@3.936.0': @@ -1695,8 +1780,8 @@ packages: resolution: {integrity: sha512-5D9OQsMPkbkp4KHM7JZv/RcGCpr3E1L7XX7U9sCxY+sFGeysltoviTmaIBXsJ2IjAJbBULtf0G/J+2cfH5OP+w==} engines: {node: '>=18.0.0'} - '@aws-sdk/nested-clients@3.943.0': - resolution: {integrity: sha512-anFtB0p2FPuyUnbOULwGmKYqYKSq1M73c9uZ08jR/NCq6Trjq9cuF5TFTeHwjJyPRb4wMf2Qk859oiVfFqnQiw==} + '@aws-sdk/nested-clients@3.946.0': + resolution: {integrity: sha512-rjAtEguukeW8mlyEQMQI56vxFoyWlaNwowmz1p1rav948SUjtrzjHAp4TOQWhibb7AR7BUTHBCgIcyCRjBEf4g==} engines: {node: '>=18.0.0'} '@aws-sdk/region-config-resolver@3.914.0': @@ -1711,8 +1796,8 @@ packages: resolution: {integrity: sha512-6aFv4lzXbfbkl0Pv37Us8S/ZkqplOQZIEgQg7bfMru7P96Wv2jVnDGsEc5YyxMnnRyIB90naQ5JgslZ4rkpknw==} engines: {node: '>=18.0.0'} - '@aws-sdk/token-providers@3.943.0': - resolution: {integrity: sha512-cRKyIzwfkS+XztXIFPoWORuaxlIswP+a83BJzelX4S1gUZ7FcXB4+lj9Jxjn8SbQhR4TPU3Owbpu+S7pd6IRbQ==} + '@aws-sdk/token-providers@3.946.0': + resolution: {integrity: sha512-a5c+rM6CUPX2ExmUZ3DlbLlS5rQr4tbdoGcgBsjnAHiYx8MuMNAI+8M7wfjF13i2yvUQj5WEIddvLpayfEZj9g==} engines: {node: '>=18.0.0'} '@aws-sdk/types@3.914.0': @@ -1754,8 +1839,8 @@ packages: aws-crt: optional: true - '@aws-sdk/util-user-agent-node@3.943.0': - resolution: {integrity: sha512-gn+ILprVRrgAgTIBk2TDsJLRClzIOdStQFeFTcN0qpL8Z4GBCqMFhw7O7X+MM55Stt5s4jAauQ/VvoqmCADnQg==} + '@aws-sdk/util-user-agent-node@3.946.0': + resolution: {integrity: sha512-a2UwwvzbK5AxHKUBupfg4s7VnkqRAHjYsuezHnKCniczmT4HZfP1NnfwwvLKEH8qaTrwenxjKSfq4UWmWkvG+Q==} engines: {node: '>=18.0.0'} peerDependencies: aws-crt: '>=1.0.0' @@ -2348,8 +2433,8 @@ packages: resolution: {integrity: sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@expo/devcert@1.2.0': - resolution: {integrity: sha512-Uilcv3xGELD5t/b0eM4cxBFEKQRIivB3v7i+VhWLV/gL98aw810unLKKJbGAxAIhY6Ipyz8ChWibFsKFXYwstA==} + '@expo/devcert@1.2.1': + resolution: {integrity: sha512-qC4eaxmKMTmJC2ahwyui6ud8f3W60Ss7pMkpBq40Hu3zyiAaugPXnZ24145U7K36qO9UHdZUVxsCvIpz2RYYCA==} '@expo/sudo-prompt@9.3.2': resolution: {integrity: sha512-HHQigo3rQWKMDzYDLkubN5WQOYXJJE2eNqIQC2axC2iO3mHdwnIR7FgZVvHWtBwAdzBgAP0ECp8KqS8TiMKvgw==} @@ -3186,8 +3271,8 @@ packages: youtubei.js: optional: true - '@langchain/core@1.1.3': - resolution: {integrity: sha512-jSxHL3GHamHYPm+Gy3Sz+mZ9LUfCY2ni8cU+ChcmNFNO63luqM8Bl36KZPX/EMTIaqk+ib+IVK/pOVAKZi4pTw==} + '@langchain/core@1.1.4': + resolution: {integrity: sha512-AZVHVoLJzhHU/jsjeNto1pvfHaPxGT+V3PcVyvUw0kCiWftdu1bxfwhwSsZJ9B9iJeXJdCIUe089+NYd3FsEuw==} engines: {node: '>=20'} '@langchain/langgraph-checkpoint@1.0.0': @@ -4979,6 +5064,10 @@ packages: '@standard-schema/spec@1.0.0': resolution: {integrity: sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==} + '@strands-agents/sdk@0.1.2': + resolution: {integrity: sha512-qVJ6V0EDVUYGticux0e0kUvPWxUQnqd3estEF1rOaytStH1yu6C+a8puOhVOq0ZeK9cTY8wwkCdLvLc3VfMfIQ==} + engines: {node: '>=20.0.0'} + '@stylistic/eslint-plugin@5.6.1': resolution: {integrity: sha512-JCs+MqoXfXrRPGbGmho/zGS/jMcn3ieKl/A8YImqib76C8kjgZwq5uUFzc30lJkMvcchuRn6/v8IApLxli3Jyw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -5498,8 +5587,8 @@ packages: resolution: {integrity: sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==} engines: {node: '>= 8.0.0'} - ai@5.0.106: - resolution: {integrity: sha512-M5obwavxSJJ3tGlAFqI6eltYNJB0D20X6gIBCFx/KVorb/X1fxVVfiZZpZb+Gslu4340droSOjT0aKQFCarNVg==} + ai@5.0.107: + resolution: {integrity: sha512-laZlS9ZC/DZfSaxPgrBqI4mM+kxRvTPBBQfa74ceBFskkunZKEsaGVFNEs4cfyGa3nCCCl1WO/fjxixp4V8Zag==} engines: {node: '>=18'} peerDependencies: zod: ^3.25.76 || ^4.1.8 @@ -5637,8 +5726,8 @@ packages: resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} engines: {node: '>= 0.4'} - aws-cdk-lib@2.231.0: - resolution: {integrity: sha512-RMt88F1vhsM28j81EjvIXRoPeYQdtk72EGh9xAP6LjuyF8df1hDBIy5cawUvagdp5eCBPVHrPJ2U0eaUUKtjFg==} + aws-cdk-lib@2.232.1: + resolution: {integrity: sha512-F1vNcpWBo85pSxa0DJ5DO4k7Ok4vVp0vh1cFO4Y12LLX07ixOcnJn/6B97/XVC0fgZNvzPx/sYgioEd0u8oKkQ==} engines: {node: '>= 18.0.0'} peerDependencies: constructs: ^10.0.0 @@ -5735,8 +5824,8 @@ packages: base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - baseline-browser-mapping@2.9.2: - resolution: {integrity: sha512-PxSsosKQjI38iXkmb3d0Y32efqyA0uW4s41u4IVBsLlWLhCiYNpH/AfNOVWRqCQBlD8TFJTz6OUWNd4DFJCnmw==} + baseline-browser-mapping@2.9.3: + resolution: {integrity: sha512-8QdH6czo+G7uBsNo0GiUfouPN1lRzKdJTGnKXwe12gkFbnnOUaUKGN55dMkfy+mnxmvjwl9zcI4VncczcVXDhA==} hasBin: true before-after-hook@4.0.0: @@ -6174,6 +6263,10 @@ packages: supports-color: optional: true + decamelize@1.2.0: + resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} + engines: {node: '>=0.10.0'} + decimal.js@10.6.0: resolution: {integrity: sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==} @@ -6301,8 +6394,8 @@ packages: ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - electron-to-chromium@1.5.265: - resolution: {integrity: sha512-B7IkLR1/AE+9jR2LtVF/1/6PFhY5TlnEHnlrKmGk7PvkJibg5jr+mLXLLzq3QYl6PA1T/vLDthQPqIPAlS/PPA==} + electron-to-chromium@1.5.266: + resolution: {integrity: sha512-kgWEglXvkEfMH7rxP5OSZZwnaDWT7J9EoZCujhnpLbfi0bbNtRkgdX2E3gt0Uer11c61qCYktB3hwkAS325sJg==} emoji-regex@10.6.0: resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==} @@ -6859,11 +6952,6 @@ packages: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} - glob@13.0.0: - resolution: {integrity: sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==} - engines: {node: 20 || >=22} - hasBin: true - global-dirs@3.0.1: resolution: {integrity: sha512-NBcGGFbBA9s1VzD41QXDG+3++t9Mn5t1FpLdhESY6oKY4gYTFpX4wO3sqGUa0Srjtbfj3szX0RnemmrVRUdULA==} engines: {node: '>=10'} @@ -7471,11 +7559,11 @@ packages: known-css-properties@0.30.0: resolution: {integrity: sha512-VSWXYUnsPu9+WYKkfmJyLKtIvaRJi1kXUqVmBACORXZQxT5oZDsoZ2vQP+bQFDnWtpI/4eq3MLoRMjI2fnLzTQ==} - langchain@1.1.4: - resolution: {integrity: sha512-aCc3r339qALNDqBs1ZA3FlciiH5j5qGRe7pcAUKjbutKCtroriUut8f+XmLFMYaedJknwBDJ1EdAvGk4O+VB6Q==} + langchain@1.1.5: + resolution: {integrity: sha512-tmJHdCsi4AQLEWDeTm9QTWgdwYgIaA4kfp14KFw6e1sUPxjsoHqdFqdf1ZJZxhs1h/n+hpIr3NBfGNBQnWxWEQ==} engines: {node: '>=20'} peerDependencies: - '@langchain/core': 1.1.3 + '@langchain/core': 1.1.4 langfuse-core@3.38.6: resolution: {integrity: sha512-EcZXa+DK9FJdi1I30+u19eKjuBJ04du6j2Nybk19KKCuraLczg/ppkTQcGvc4QOk//OAi3qUHrajUuV74RXsBQ==} @@ -7892,10 +7980,6 @@ packages: resolution: {integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==} engines: {node: '>=8'} - minipass@7.1.2: - resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} - engines: {node: '>=16 || 14 >=14.17'} - minizlib@2.1.2: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} @@ -8204,10 +8288,6 @@ packages: resolution: {integrity: sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==} engines: {node: '>=8'} - p-queue@9.0.1: - resolution: {integrity: sha512-RhBdVhSwJb7Ocn3e8ULk4NMwBEuOxe+1zcgphUy9c2e5aR/xbEsdVXxHJ3lynw6Qiqu7OINEyHlZkiblEpaq7w==} - engines: {node: '>=20'} - p-retry@4.6.2: resolution: {integrity: sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==} engines: {node: '>=8'} @@ -8220,10 +8300,6 @@ packages: resolution: {integrity: sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==} engines: {node: '>=8'} - p-timeout@7.0.1: - resolution: {integrity: sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg==} - engines: {node: '>=20'} - package-json@6.5.0: resolution: {integrity: sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==} engines: {node: '>=8'} @@ -8274,10 +8350,6 @@ packages: path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - path-scurry@2.0.1: - resolution: {integrity: sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA==} - engines: {node: 20 || >=22} - path-to-regexp@0.1.12: resolution: {integrity: sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==} @@ -9835,7 +9907,7 @@ snapshots: '@ai-sdk/provider-utils': 3.0.12(zod@4.1.13) zod: 4.1.13 - '@anthropic-ai/claude-agent-sdk@0.1.59(zod@4.1.13)': + '@anthropic-ai/claude-agent-sdk@0.1.60(zod@4.1.13)': dependencies: zod: 4.1.13 optionalDependencies: @@ -9883,22 +9955,22 @@ snapshots: '@opentelemetry/api': 1.9.0 '@opentelemetry/core': 1.30.1(@opentelemetry/api@1.9.0) - '@arizeai/openinference-instrumentation-bedrock@0.4.3(@aws-sdk/client-bedrock-runtime@3.943.0)': + '@arizeai/openinference-instrumentation-bedrock@0.4.3(@aws-sdk/client-bedrock-runtime@3.946.0)': dependencies: '@arizeai/openinference-core': 2.0.0 '@arizeai/openinference-semantic-conventions': 2.1.2 - '@aws-sdk/client-bedrock-runtime': 3.943.0 + '@aws-sdk/client-bedrock-runtime': 3.946.0 '@opentelemetry/api': 1.9.0 '@opentelemetry/core': 1.30.1(@opentelemetry/api@1.9.0) '@opentelemetry/instrumentation': 0.46.0(@opentelemetry/api@1.9.0) transitivePeerDependencies: - supports-color - '@arizeai/openinference-instrumentation-langchain@3.4.6(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': + '@arizeai/openinference-instrumentation-langchain@3.4.6(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': dependencies: '@arizeai/openinference-core': 2.0.0 '@arizeai/openinference-semantic-conventions': 2.1.2 - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@opentelemetry/api': 1.9.0 '@opentelemetry/core': 1.30.1(@opentelemetry/api@1.9.0) '@opentelemetry/instrumentation': 0.46.0(@opentelemetry/api@1.9.0) @@ -9915,7 +9987,7 @@ snapshots: '@csstools/css-tokenizer': 3.0.4 lru-cache: 11.2.4 - '@asamuzakjp/dom-selector@6.7.5': + '@asamuzakjp/dom-selector@6.7.6': dependencies: '@asamuzakjp/nwsapi': 2.3.9 bidi-js: 1.0.3 @@ -9987,21 +10059,21 @@ snapshots: '@aws/lambda-invoke-store': 0.2.1 lodash.merge: 4.6.2 - '@aws-sdk/client-bedrock-agent-runtime@3.943.0': + '@aws-sdk/client-bedrock-agent-runtime@3.946.0': dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/core': 3.943.0 - '@aws-sdk/credential-provider-node': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/credential-provider-node': 3.946.0 '@aws-sdk/middleware-host-header': 3.936.0 '@aws-sdk/middleware-logger': 3.936.0 '@aws-sdk/middleware-recursion-detection': 3.936.0 - '@aws-sdk/middleware-user-agent': 3.943.0 + '@aws-sdk/middleware-user-agent': 3.946.0 '@aws-sdk/region-config-resolver': 3.936.0 '@aws-sdk/types': 3.936.0 '@aws-sdk/util-endpoints': 3.936.0 '@aws-sdk/util-user-agent-browser': 3.936.0 - '@aws-sdk/util-user-agent-node': 3.943.0 + '@aws-sdk/util-user-agent-node': 3.946.0 '@smithy/config-resolver': 4.4.3 '@smithy/core': 3.18.7 '@smithy/eventstream-serde-browser': 4.2.5 @@ -10034,25 +10106,25 @@ snapshots: transitivePeerDependencies: - aws-crt - '@aws-sdk/client-bedrock-runtime@3.943.0': + '@aws-sdk/client-bedrock-runtime@3.946.0': dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/core': 3.943.0 - '@aws-sdk/credential-provider-node': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/credential-provider-node': 3.946.0 '@aws-sdk/eventstream-handler-node': 3.936.0 '@aws-sdk/middleware-eventstream': 3.936.0 '@aws-sdk/middleware-host-header': 3.936.0 '@aws-sdk/middleware-logger': 3.936.0 '@aws-sdk/middleware-recursion-detection': 3.936.0 - '@aws-sdk/middleware-user-agent': 3.943.0 + '@aws-sdk/middleware-user-agent': 3.946.0 '@aws-sdk/middleware-websocket': 3.936.0 '@aws-sdk/region-config-resolver': 3.936.0 - '@aws-sdk/token-providers': 3.943.0 + '@aws-sdk/token-providers': 3.946.0 '@aws-sdk/types': 3.936.0 '@aws-sdk/util-endpoints': 3.936.0 '@aws-sdk/util-user-agent-browser': 3.936.0 - '@aws-sdk/util-user-agent-node': 3.943.0 + '@aws-sdk/util-user-agent-node': 3.946.0 '@smithy/config-resolver': 4.4.3 '@smithy/core': 3.18.7 '@smithy/eventstream-serde-browser': 4.2.5 @@ -10134,21 +10206,21 @@ snapshots: - aws-crt optional: true - '@aws-sdk/client-kendra@3.943.0': + '@aws-sdk/client-kendra@3.946.0': dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/core': 3.943.0 - '@aws-sdk/credential-provider-node': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/credential-provider-node': 3.946.0 '@aws-sdk/middleware-host-header': 3.936.0 '@aws-sdk/middleware-logger': 3.936.0 '@aws-sdk/middleware-recursion-detection': 3.936.0 - '@aws-sdk/middleware-user-agent': 3.943.0 + '@aws-sdk/middleware-user-agent': 3.946.0 '@aws-sdk/region-config-resolver': 3.936.0 '@aws-sdk/types': 3.936.0 '@aws-sdk/util-endpoints': 3.936.0 '@aws-sdk/util-user-agent-browser': 3.936.0 - '@aws-sdk/util-user-agent-node': 3.943.0 + '@aws-sdk/util-user-agent-node': 3.946.0 '@smithy/config-resolver': 4.4.3 '@smithy/core': 3.18.7 '@smithy/fetch-http-handler': 5.3.6 @@ -10222,20 +10294,20 @@ snapshots: - aws-crt optional: true - '@aws-sdk/client-sso@3.943.0': + '@aws-sdk/client-sso@3.946.0': dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/core': 3.943.0 + '@aws-sdk/core': 3.946.0 '@aws-sdk/middleware-host-header': 3.936.0 '@aws-sdk/middleware-logger': 3.936.0 '@aws-sdk/middleware-recursion-detection': 3.936.0 - '@aws-sdk/middleware-user-agent': 3.943.0 + '@aws-sdk/middleware-user-agent': 3.946.0 '@aws-sdk/region-config-resolver': 3.936.0 '@aws-sdk/types': 3.936.0 '@aws-sdk/util-endpoints': 3.936.0 '@aws-sdk/util-user-agent-browser': 3.936.0 - '@aws-sdk/util-user-agent-node': 3.943.0 + '@aws-sdk/util-user-agent-node': 3.946.0 '@smithy/config-resolver': 4.4.3 '@smithy/core': 3.18.7 '@smithy/fetch-http-handler': 5.3.6 @@ -10282,7 +10354,7 @@ snapshots: tslib: 2.8.1 optional: true - '@aws-sdk/core@3.943.0': + '@aws-sdk/core@3.946.0': dependencies: '@aws-sdk/types': 3.936.0 '@aws-sdk/xml-builder': 3.930.0 @@ -10307,9 +10379,9 @@ snapshots: tslib: 2.8.1 optional: true - '@aws-sdk/credential-provider-env@3.943.0': + '@aws-sdk/credential-provider-env@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 + '@aws-sdk/core': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/property-provider': 4.2.5 '@smithy/types': 4.9.0 @@ -10329,9 +10401,9 @@ snapshots: tslib: 2.8.1 optional: true - '@aws-sdk/credential-provider-http@3.943.0': + '@aws-sdk/credential-provider-http@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 + '@aws-sdk/core': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/fetch-http-handler': 5.3.6 '@smithy/node-http-handler': 4.4.5 @@ -10361,16 +10433,16 @@ snapshots: - aws-crt optional: true - '@aws-sdk/credential-provider-ini@3.943.0': + '@aws-sdk/credential-provider-ini@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 - '@aws-sdk/credential-provider-env': 3.943.0 - '@aws-sdk/credential-provider-http': 3.943.0 - '@aws-sdk/credential-provider-login': 3.943.0 - '@aws-sdk/credential-provider-process': 3.943.0 - '@aws-sdk/credential-provider-sso': 3.943.0 - '@aws-sdk/credential-provider-web-identity': 3.943.0 - '@aws-sdk/nested-clients': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/credential-provider-env': 3.946.0 + '@aws-sdk/credential-provider-http': 3.946.0 + '@aws-sdk/credential-provider-login': 3.946.0 + '@aws-sdk/credential-provider-process': 3.946.0 + '@aws-sdk/credential-provider-sso': 3.946.0 + '@aws-sdk/credential-provider-web-identity': 3.946.0 + '@aws-sdk/nested-clients': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/credential-provider-imds': 4.2.5 '@smithy/property-provider': 4.2.5 @@ -10380,10 +10452,10 @@ snapshots: transitivePeerDependencies: - aws-crt - '@aws-sdk/credential-provider-login@3.943.0': + '@aws-sdk/credential-provider-login@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 - '@aws-sdk/nested-clients': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/nested-clients': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/property-provider': 4.2.5 '@smithy/protocol-http': 5.3.5 @@ -10411,14 +10483,14 @@ snapshots: - aws-crt optional: true - '@aws-sdk/credential-provider-node@3.943.0': + '@aws-sdk/credential-provider-node@3.946.0': dependencies: - '@aws-sdk/credential-provider-env': 3.943.0 - '@aws-sdk/credential-provider-http': 3.943.0 - '@aws-sdk/credential-provider-ini': 3.943.0 - '@aws-sdk/credential-provider-process': 3.943.0 - '@aws-sdk/credential-provider-sso': 3.943.0 - '@aws-sdk/credential-provider-web-identity': 3.943.0 + '@aws-sdk/credential-provider-env': 3.946.0 + '@aws-sdk/credential-provider-http': 3.946.0 + '@aws-sdk/credential-provider-ini': 3.946.0 + '@aws-sdk/credential-provider-process': 3.946.0 + '@aws-sdk/credential-provider-sso': 3.946.0 + '@aws-sdk/credential-provider-web-identity': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/credential-provider-imds': 4.2.5 '@smithy/property-provider': 4.2.5 @@ -10438,9 +10510,9 @@ snapshots: tslib: 2.8.1 optional: true - '@aws-sdk/credential-provider-process@3.943.0': + '@aws-sdk/credential-provider-process@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 + '@aws-sdk/core': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/property-provider': 4.2.5 '@smithy/shared-ini-file-loader': 4.4.0 @@ -10461,11 +10533,11 @@ snapshots: - aws-crt optional: true - '@aws-sdk/credential-provider-sso@3.943.0': + '@aws-sdk/credential-provider-sso@3.946.0': dependencies: - '@aws-sdk/client-sso': 3.943.0 - '@aws-sdk/core': 3.943.0 - '@aws-sdk/token-providers': 3.943.0 + '@aws-sdk/client-sso': 3.946.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/token-providers': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/property-provider': 4.2.5 '@smithy/shared-ini-file-loader': 4.4.0 @@ -10487,10 +10559,10 @@ snapshots: - aws-crt optional: true - '@aws-sdk/credential-provider-web-identity@3.943.0': + '@aws-sdk/credential-provider-web-identity@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 - '@aws-sdk/nested-clients': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/nested-clients': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/property-provider': 4.2.5 '@smithy/shared-ini-file-loader': 4.4.0 @@ -10585,9 +10657,9 @@ snapshots: tslib: 2.8.1 optional: true - '@aws-sdk/middleware-user-agent@3.943.0': + '@aws-sdk/middleware-user-agent@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 + '@aws-sdk/core': 3.946.0 '@aws-sdk/types': 3.936.0 '@aws-sdk/util-endpoints': 3.936.0 '@smithy/core': 3.18.7 @@ -10652,20 +10724,20 @@ snapshots: - aws-crt optional: true - '@aws-sdk/nested-clients@3.943.0': + '@aws-sdk/nested-clients@3.946.0': dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/core': 3.943.0 + '@aws-sdk/core': 3.946.0 '@aws-sdk/middleware-host-header': 3.936.0 '@aws-sdk/middleware-logger': 3.936.0 '@aws-sdk/middleware-recursion-detection': 3.936.0 - '@aws-sdk/middleware-user-agent': 3.943.0 + '@aws-sdk/middleware-user-agent': 3.946.0 '@aws-sdk/region-config-resolver': 3.936.0 '@aws-sdk/types': 3.936.0 '@aws-sdk/util-endpoints': 3.936.0 '@aws-sdk/util-user-agent-browser': 3.936.0 - '@aws-sdk/util-user-agent-node': 3.943.0 + '@aws-sdk/util-user-agent-node': 3.946.0 '@smithy/config-resolver': 4.4.3 '@smithy/core': 3.18.7 '@smithy/fetch-http-handler': 5.3.6 @@ -10724,10 +10796,10 @@ snapshots: - aws-crt optional: true - '@aws-sdk/token-providers@3.943.0': + '@aws-sdk/token-providers@3.946.0': dependencies: - '@aws-sdk/core': 3.943.0 - '@aws-sdk/nested-clients': 3.943.0 + '@aws-sdk/core': 3.946.0 + '@aws-sdk/nested-clients': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/property-provider': 4.2.5 '@smithy/shared-ini-file-loader': 4.4.0 @@ -10799,9 +10871,9 @@ snapshots: tslib: 2.8.1 optional: true - '@aws-sdk/util-user-agent-node@3.943.0': + '@aws-sdk/util-user-agent-node@3.946.0': dependencies: - '@aws-sdk/middleware-user-agent': 3.943.0 + '@aws-sdk/middleware-user-agent': 3.946.0 '@aws-sdk/types': 3.936.0 '@smithy/node-config-provider': 4.3.5 '@smithy/types': 4.9.0 @@ -11315,11 +11387,10 @@ snapshots: '@eslint/core': 0.17.0 levn: 0.4.1 - '@expo/devcert@1.2.0': + '@expo/devcert@1.2.1': dependencies: '@expo/sudo-prompt': 9.3.2 debug: 3.2.7 - glob: 13.0.0 transitivePeerDependencies: - supports-color @@ -11366,9 +11437,9 @@ snapshots: '@humanwhocodes/retry@0.4.3': {} - '@ibm-cloud/watsonx-ai@1.6.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': + '@ibm-cloud/watsonx-ai@1.6.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': dependencies: - '@langchain/textsplitters': 0.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + '@langchain/textsplitters': 0.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) '@types/node': 18.19.130 extend: 3.0.2 ibm-cloud-sdk-core: 5.3.2 @@ -11722,21 +11793,21 @@ snapshots: '@kwsites/promise-deferred@1.1.1': optional: true - '@langchain/aws@1.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': + '@langchain/aws@1.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': dependencies: - '@aws-sdk/client-bedrock-agent-runtime': 3.943.0 - '@aws-sdk/client-bedrock-runtime': 3.943.0 - '@aws-sdk/client-kendra': 3.943.0 - '@aws-sdk/credential-provider-node': 3.943.0 - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@aws-sdk/client-bedrock-agent-runtime': 3.946.0 + '@aws-sdk/client-bedrock-runtime': 3.946.0 + '@aws-sdk/client-kendra': 3.946.0 + '@aws-sdk/credential-provider-node': 3.946.0 + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) transitivePeerDependencies: - aws-crt - '@langchain/classic@1.0.5(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3)': + '@langchain/classic@1.0.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3)': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) - '@langchain/openai': 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) - '@langchain/textsplitters': 1.0.1(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/openai': 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + '@langchain/textsplitters': 1.0.1(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) handlebars: 4.7.8 js-yaml: 4.1.1 jsonpointer: 5.0.1 @@ -11755,13 +11826,13 @@ snapshots: - openai - ws - '@langchain/community@1.0.7(ee9edf035d3124403fc21c2491f2a8b8)': + '@langchain/community@1.0.7(964061b1ee7e8f3b0e1fa21e45f97373)': dependencies: '@browserbasehq/stagehand': 1.14.0(@playwright/test@1.51.1)(deepmerge@4.3.1)(dotenv@17.2.3)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(zod@4.1.13) - '@ibm-cloud/watsonx-ai': 1.6.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) - '@langchain/classic': 1.0.5(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3) - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) - '@langchain/openai': 1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) + '@ibm-cloud/watsonx-ai': 1.6.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + '@langchain/classic': 1.0.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(cheerio@1.1.2)(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(ws@8.18.3) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/openai': 1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3) binary-extensions: 2.3.0 flat: 5.0.2 ibm-cloud-sdk-core: 5.3.2 @@ -11773,7 +11844,7 @@ snapshots: optionalDependencies: '@aws-crypto/sha256-js': 5.2.0 '@aws-sdk/client-dynamodb': 3.919.0 - '@aws-sdk/credential-provider-node': 3.943.0 + '@aws-sdk/credential-provider-node': 3.946.0 '@browserbasehq/sdk': 2.6.0 '@libsql/client': 0.14.0 '@mlc-ai/web-llm': 0.2.79 @@ -11800,13 +11871,16 @@ snapshots: - '@opentelemetry/sdk-trace-base' - peggy - '@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))': + '@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))': dependencies: '@cfworker/json-schema': 4.1.1 + ansi-styles: 5.2.0 + camelcase: 6.3.0 + decamelize: 1.2.0 js-tiktoken: 1.0.21 langsmith: 0.3.82(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) mustache: 4.2.0 - p-queue: 9.0.1 + p-queue: 6.6.2 uuid: 10.0.0 zod: 4.1.13 transitivePeerDependencies: @@ -11815,25 +11889,25 @@ snapshots: - '@opentelemetry/sdk-trace-base' - openai - '@langchain/langgraph-checkpoint@1.0.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': + '@langchain/langgraph-checkpoint@1.0.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) uuid: 10.0.0 - '@langchain/langgraph-sdk@1.2.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)': + '@langchain/langgraph-sdk@1.2.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)': dependencies: p-queue: 6.6.2 p-retry: 4.6.2 uuid: 9.0.1 optionalDependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) react: 19.1.0 - '@langchain/langgraph@1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13)': + '@langchain/langgraph@1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13)': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) - '@langchain/langgraph-checkpoint': 1.0.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) - '@langchain/langgraph-sdk': 1.2.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/langgraph-checkpoint': 1.0.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + '@langchain/langgraph-sdk': 1.2.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0) uuid: 10.0.0 zod: 4.1.13 optionalDependencies: @@ -11842,10 +11916,10 @@ snapshots: - react - react-dom - '@langchain/mcp-adapters@1.0.3(@cfworker/json-schema@4.1.1)(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@langchain/langgraph@1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13))': + '@langchain/mcp-adapters@1.0.3(@cfworker/json-schema@4.1.1)(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@langchain/langgraph@1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13))': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) - '@langchain/langgraph': 1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/langgraph': 1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) '@modelcontextprotocol/sdk': 1.24.3(@cfworker/json-schema@4.1.1)(zod@4.1.13) debug: 4.4.3 zod: 4.1.13 @@ -11855,30 +11929,30 @@ snapshots: - '@cfworker/json-schema' - supports-color - '@langchain/openai@1.1.3(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3)': + '@langchain/openai@1.1.3(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(ws@8.18.3)': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) js-tiktoken: 1.0.21 openai: 6.10.0(ws@8.18.3)(zod@4.1.13) zod: 4.1.13 transitivePeerDependencies: - ws - '@langchain/pinecone@1.0.1(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@pinecone-database/pinecone@6.1.3)': + '@langchain/pinecone@1.0.1(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@pinecone-database/pinecone@6.1.3)': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) '@pinecone-database/pinecone': 6.1.3 flat: 5.0.2 uuid: 10.0.0 - '@langchain/textsplitters@0.1.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': + '@langchain/textsplitters@0.1.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) js-tiktoken: 1.0.21 - '@langchain/textsplitters@1.0.1(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': + '@langchain/textsplitters@1.0.1(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))': dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) js-tiktoken: 1.0.21 '@libsql/client@0.14.0': @@ -11996,8 +12070,8 @@ snapshots: '@ai-sdk/ui-utils': 1.2.11(zod@4.1.13) '@ai-sdk/xai-v5': '@ai-sdk/xai@2.0.26(zod@4.1.13)' '@isaacs/ttlcache': 1.4.1 - '@mastra/schema-compat': 0.11.8(ai@5.0.106(zod@4.1.13))(zod@4.1.13) - '@openrouter/ai-sdk-provider-v5': '@openrouter/ai-sdk-provider@1.2.3(ai@5.0.106(zod@4.1.13))(zod@4.1.13)' + '@mastra/schema-compat': 0.11.8(ai@5.0.107(zod@4.1.13))(zod@4.1.13) + '@openrouter/ai-sdk-provider-v5': '@openrouter/ai-sdk-provider@1.2.3(ai@5.0.107(zod@4.1.13))(zod@4.1.13)' '@opentelemetry/api': 1.9.0 '@opentelemetry/auto-instrumentations-node': 0.62.2(@opentelemetry/api@1.9.0)(@opentelemetry/core@2.2.0(@opentelemetry/api@1.9.0)) '@opentelemetry/core': 2.2.0(@opentelemetry/api@1.9.0) @@ -12012,7 +12086,7 @@ snapshots: '@opentelemetry/sdk-trace-node': 2.2.0(@opentelemetry/api@1.9.0) '@opentelemetry/semantic-conventions': 1.38.0 '@sindresorhus/slugify': 2.2.1 - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) ai-v5: ai@5.0.97(zod@4.1.13) date-fns: 3.6.0 dotenv: 16.6.1 @@ -12117,9 +12191,9 @@ snapshots: '@mastra/memory@0.15.12(@mastra/core@0.24.6(openapi-types@12.1.3)(zod@4.1.13))(zod@4.1.13)': dependencies: '@mastra/core': 0.24.6(openapi-types@12.1.3)(zod@4.1.13) - '@mastra/schema-compat': 0.11.8(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@mastra/schema-compat': 0.11.8(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@upstash/redis': 1.35.7 - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) ai-v5: ai@5.0.60(zod@4.1.13) async-mutex: 0.5.0 js-tiktoken: 1.0.21 @@ -12134,9 +12208,9 @@ snapshots: transitivePeerDependencies: - pg-native - '@mastra/schema-compat@0.11.8(ai@5.0.106(zod@4.1.13))(zod@4.1.13)': + '@mastra/schema-compat@0.11.8(ai@5.0.107(zod@4.1.13))(zod@4.1.13)': dependencies: - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) json-schema: 0.4.0 zod: 4.1.13 zod-from-json-schema: 0.5.2 @@ -12408,10 +12482,10 @@ snapshots: '@octokit/webhooks-methods': 6.0.0 optional: true - '@openrouter/ai-sdk-provider@1.2.3(ai@5.0.106(zod@4.1.13))(zod@4.1.13)': + '@openrouter/ai-sdk-provider@1.2.3(ai@5.0.107(zod@4.1.13))(zod@4.1.13)': dependencies: '@openrouter/sdk': 0.1.27 - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) zod: 4.1.13 '@openrouter/sdk@0.1.27': @@ -14049,6 +14123,19 @@ snapshots: '@standard-schema/spec@1.0.0': {} + '@strands-agents/sdk@0.1.2(@cfworker/json-schema@4.1.1)(ws@8.18.3)': + dependencies: + '@aws-sdk/client-bedrock-runtime': 3.946.0 + '@modelcontextprotocol/sdk': 1.24.3(@cfworker/json-schema@4.1.1)(zod@4.1.13) + zod: 4.1.13 + optionalDependencies: + openai: 6.10.0(ws@8.18.3)(zod@4.1.13) + transitivePeerDependencies: + - '@cfworker/json-schema' + - aws-crt + - supports-color + - ws + '@stylistic/eslint-plugin@5.6.1(eslint@9.39.1(jiti@2.6.1))': dependencies: '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1(jiti@2.6.1)) @@ -14504,20 +14591,20 @@ snapshots: '@vitest/pretty-format': 4.0.15 tinyrainbow: 3.0.3 - '@voltagent/a2a-server@1.0.2(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))': + '@voltagent/a2a-server@1.0.2(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))': dependencies: '@a2a-js/sdk': 0.2.5 - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.12 zod: 3.25.76 transitivePeerDependencies: - supports-color - '@voltagent/cli@0.1.16(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@types/node@24.10.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(zod@4.1.13)': + '@voltagent/cli@0.1.16(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@types/node@24.10.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(zod@4.1.13)': dependencies: - '@voltagent/evals': 1.0.4(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(@voltagent/sdk@1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13)) + '@voltagent/evals': 1.0.4(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(@voltagent/sdk@1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13)) '@voltagent/internal': 0.0.12 - '@voltagent/sdk': 1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/sdk': 1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) boxen: 5.1.2 bundle-require: 5.1.0(esbuild@0.25.12) chalk: 4.1.2 @@ -14547,7 +14634,7 @@ snapshots: - supports-color - zod - '@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13)': + '@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13)': dependencies: '@ai-sdk/provider-utils': 3.0.18(zod@4.1.13) '@modelcontextprotocol/sdk': 1.24.3(@cfworker/json-schema@4.1.1)(zod@4.1.13) @@ -14564,7 +14651,7 @@ snapshots: '@opentelemetry/sdk-trace-node': 2.2.0(@opentelemetry/api@1.9.0) '@opentelemetry/semantic-conventions': 1.38.0 '@voltagent/internal': 0.0.12 - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) ts-pattern: 5.9.0 type-fest: 4.41.0 uuid: 9.0.1 @@ -14577,11 +14664,11 @@ snapshots: - '@cfworker/json-schema' - supports-color - '@voltagent/evals@1.0.4(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(@voltagent/sdk@1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))': + '@voltagent/evals@1.0.4(@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(ws@8.18.3)(zod@4.1.13))(@voltagent/sdk@1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))': dependencies: '@voltagent/internal': 0.0.12 - '@voltagent/scorers': 1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(ws@8.18.3)(zod@4.1.13) - '@voltagent/sdk': 1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/scorers': 1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(ws@8.18.3)(zod@4.1.13) + '@voltagent/sdk': 1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal@0.0.11': dependencies: @@ -14591,13 +14678,13 @@ snapshots: dependencies: type-fest: 4.41.0 - '@voltagent/libsql@1.0.13(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))': + '@voltagent/libsql@1.0.13(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))': dependencies: '@libsql/client': 0.15.15 - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.12 '@voltagent/logger': 1.0.4(@opentelemetry/api@1.9.0) - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) transitivePeerDependencies: - bufferutil - utf-8-validate @@ -14615,31 +14702,31 @@ snapshots: - '@opentelemetry/api' - supports-color - '@voltagent/mcp-server@1.0.3(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(zod@4.1.13)': + '@voltagent/mcp-server@1.0.3(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(zod@4.1.13)': dependencies: '@modelcontextprotocol/sdk': 1.24.3(@cfworker/json-schema@4.1.1)(zod@4.1.13) - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.12 zod: 4.1.13 transitivePeerDependencies: - '@cfworker/json-schema' - supports-color - '@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(ai@5.0.106(zod@4.1.13))(ws@8.18.3)(zod@4.1.13)': + '@voltagent/scorers@1.0.0(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(ai@5.0.107(zod@4.1.13))(ws@8.18.3)(zod@4.1.13)': dependencies: - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.11 autoevals: 0.0.131(ws@8.18.3) zod: 4.1.13 optionalDependencies: - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) transitivePeerDependencies: - encoding - ws - '@voltagent/sdk@1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13)': + '@voltagent/sdk@1.0.2(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13)': dependencies: - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.12 transitivePeerDependencies: - '@ai-sdk/provider-utils' @@ -14649,12 +14736,12 @@ snapshots: - supports-color - zod - '@voltagent/server-core@1.0.29(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(zod@4.1.13)': + '@voltagent/server-core@1.0.29(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(zod@4.1.13)': dependencies: '@modelcontextprotocol/sdk': 1.24.3(@cfworker/json-schema@4.1.1)(zod@4.1.13) - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.12 - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) jsonwebtoken: 9.0.3 ws: 8.18.3 zod: 4.1.13 @@ -14666,15 +14753,15 @@ snapshots: - supports-color - utf-8-validate - '@voltagent/server-hono@1.2.5(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(zod@4.1.13)': + '@voltagent/server-hono@1.2.5(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(zod@4.1.13)': dependencies: '@hono/node-server': 1.19.6(hono@4.10.7) '@hono/swagger-ui': 0.5.2(hono@4.10.7) - '@voltagent/a2a-server': 1.0.2(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13)) - '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13) + '@voltagent/a2a-server': 1.0.2(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13)) + '@voltagent/core': 1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13) '@voltagent/internal': 0.0.12 - '@voltagent/mcp-server': 1.0.3(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(zod@4.1.13) - '@voltagent/server-core': 1.0.29(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.106(zod@4.1.13))(zod@4.1.13))(zod@4.1.13) + '@voltagent/mcp-server': 1.0.3(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(zod@4.1.13) + '@voltagent/server-core': 1.0.29(@cfworker/json-schema@4.1.1)(@voltagent/core@1.2.15(@ai-sdk/provider-utils@3.0.18(zod@4.1.13))(@cfworker/json-schema@4.1.1)(@voltagent/logger@1.0.4(@opentelemetry/api@1.9.0))(ai@5.0.107(zod@4.1.13))(zod@4.1.13))(zod@4.1.13) fetch-to-node: 2.1.0 hono: 4.10.7 openapi3-ts: 4.5.0 @@ -14733,7 +14820,7 @@ snapshots: dependencies: humanize-ms: 1.2.1 - ai@5.0.106(zod@4.1.13): + ai@5.0.107(zod@4.1.13): dependencies: '@ai-sdk/gateway': 2.0.18(zod@4.1.13) '@ai-sdk/provider': 2.0.0 @@ -14909,7 +14996,7 @@ snapshots: dependencies: possible-typed-array-names: 1.1.0 - aws-cdk-lib@2.231.0(constructs@10.4.3): + aws-cdk-lib@2.232.1(constructs@10.4.3): dependencies: '@aws-cdk/asset-awscli-v1': 2.2.242 '@aws-cdk/asset-node-proxy-agent-v6': 2.1.0 @@ -14999,7 +15086,7 @@ snapshots: base64-js@1.5.1: {} - baseline-browser-mapping@2.9.2: {} + baseline-browser-mapping@2.9.3: {} before-after-hook@4.0.0: optional: true @@ -15084,9 +15171,9 @@ snapshots: browserslist@4.28.1: dependencies: - baseline-browser-mapping: 2.9.2 + baseline-browser-mapping: 2.9.3 caniuse-lite: 1.0.30001759 - electron-to-chromium: 1.5.265 + electron-to-chromium: 1.5.266 node-releases: 2.0.27 update-browserslist-db: 1.2.2(browserslist@4.28.1) @@ -15459,6 +15546,8 @@ snapshots: dependencies: ms: 2.1.3 + decamelize@1.2.0: {} + decimal.js@10.6.0: {} decode-named-character-reference@1.2.0: @@ -15574,7 +15663,7 @@ snapshots: ee-first@1.1.1: {} - electron-to-chromium@1.5.265: {} + electron-to-chromium@1.5.266: {} emoji-regex@10.6.0: {} @@ -15943,7 +16032,8 @@ snapshots: eventemitter3@4.0.7: {} - eventemitter3@5.0.1: {} + eventemitter3@5.0.1: + optional: true events-universal@1.0.1: dependencies: @@ -16343,12 +16433,6 @@ snapshots: dependencies: is-glob: 4.0.3 - glob@13.0.0: - dependencies: - minimatch: 10.1.1 - minipass: 7.1.2 - path-scurry: 2.0.1 - global-dirs@3.0.1: dependencies: ini: 2.0.0 @@ -16865,7 +16949,7 @@ snapshots: jsdom@27.2.0: dependencies: '@acemir/cssom': 0.9.26 - '@asamuzakjp/dom-selector': 6.7.5 + '@asamuzakjp/dom-selector': 6.7.6 cssstyle: 5.3.3 data-urls: 6.0.0 decimal.js: 10.6.0 @@ -16967,11 +17051,11 @@ snapshots: known-css-properties@0.30.0: {} - langchain@1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)): + langchain@1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)): dependencies: - '@langchain/core': 1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) - '@langchain/langgraph': 1.0.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) - '@langchain/langgraph-checkpoint': 1.0.0(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) + '@langchain/core': 1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) + '@langchain/langgraph': 1.0.4(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))(zod@4.1.13) + '@langchain/langgraph-checkpoint': 1.0.0(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))) langsmith: 0.3.82(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)) uuid: 10.0.0 zod: 4.1.13 @@ -16988,15 +17072,15 @@ snapshots: dependencies: mustache: 4.2.0 - langfuse-langchain@3.38.6(langchain@1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))): + langfuse-langchain@3.38.6(langchain@1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13))): dependencies: - langchain: 1.1.4(@langchain/core@1.1.3(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) + langchain: 1.1.5(@langchain/core@1.1.4(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13)))(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.206.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.10.0(ws@8.18.3)(zod@4.1.13))(react@19.1.0)(zod-to-json-schema@3.25.0(zod@4.1.13)) langfuse: 3.38.6 langfuse-core: 3.38.6 - langfuse-vercel@3.38.6(ai@5.0.106(zod@4.1.13)): + langfuse-vercel@3.38.6(ai@5.0.107(zod@4.1.13)): dependencies: - ai: 5.0.106(zod@4.1.13) + ai: 5.0.107(zod@4.1.13) langfuse: 3.38.6 langfuse-core: 3.38.6 @@ -17210,7 +17294,7 @@ snapshots: mastra@0.18.6(@mastra/core@0.24.6(openapi-types@12.1.3)(zod@4.1.13))(@opentelemetry/api@1.9.0)(typescript@5.9.3)(zod@4.1.13): dependencies: '@clack/prompts': 0.11.0 - '@expo/devcert': 1.2.0 + '@expo/devcert': 1.2.1 '@mastra/core': 0.24.6(openapi-types@12.1.3)(zod@4.1.13) '@mastra/deployer': 0.24.6(@mastra/core@0.24.6(openapi-types@12.1.3)(zod@4.1.13))(typescript@5.9.3)(zod@4.1.13) '@mastra/loggers': 0.10.19(@mastra/core@0.24.6(openapi-types@12.1.3)(zod@4.1.13)) @@ -17491,8 +17575,6 @@ snapshots: minipass@5.0.0: optional: true - minipass@7.1.2: {} - minizlib@2.1.2: dependencies: minipass: 3.3.6 @@ -17864,11 +17946,6 @@ snapshots: eventemitter3: 4.0.7 p-timeout: 3.2.0 - p-queue@9.0.1: - dependencies: - eventemitter3: 5.0.1 - p-timeout: 7.0.1 - p-retry@4.6.2: dependencies: '@types/retry': 0.12.0 @@ -17882,8 +17959,6 @@ snapshots: dependencies: p-finally: 1.0.0 - p-timeout@7.0.1: {} - package-json@6.5.0: dependencies: got: 14.6.5 @@ -17932,11 +18007,6 @@ snapshots: path-parse@1.0.7: {} - path-scurry@2.0.1: - dependencies: - lru-cache: 11.2.4 - minipass: 7.1.2 - path-to-regexp@0.1.12: {} path-to-regexp@8.3.0: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index a499c596..cdb73753 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -10,6 +10,7 @@ packages: - ./rag/cdk/function - ./agents/agent-mastra - ./agents/agent-sdk + - ./agents/agent-strands - ./agents/agent-voltagent - ./mcp/servers/postgresql-http - ./mcp/servers/weather diff --git a/rag/batch/package.json b/rag/batch/package.json index 14ab6d32..19c02ef3 100644 --- a/rag/batch/package.json +++ b/rag/batch/package.json @@ -17,7 +17,7 @@ "@langchain/aws": "^1.1.0", "@langchain/classic": "^1.0.5", "@langchain/community": "^1.0.7", - "@langchain/core": "^1.1.3", + "@langchain/core": "^1.1.4", "@langchain/langgraph": "^1.0.4", "@langchain/openai": "^1.1.3", "@langchain/pinecone": "^1.0.1", @@ -27,7 +27,7 @@ "dotenv": "^17.2.3", "html-to-text": "^9.0.5", "jsdom": "^27.2.0", - "langchain": "^1.1.4", + "langchain": "^1.1.5", "source-map-support": "^0.5.21" }, "devDependencies": { diff --git a/rag/cdk/package.json b/rag/cdk/package.json index f4511181..ddf86420 100644 --- a/rag/cdk/package.json +++ b/rag/cdk/package.json @@ -37,18 +37,18 @@ }, "dependencies": { "@aws-lambda-powertools/logger": "^2.29.0", - "@aws-sdk/credential-provider-node": "^3.943.0", + "@aws-sdk/credential-provider-node": "^3.946.0", "@langchain/aws": "^1.1.0", - "@langchain/core": "^1.1.3", + "@langchain/core": "^1.1.4", "@langchain/langgraph": "^1.0.4", "@langchain/openai": "^1.1.3", "@langchain/pinecone": "^1.0.1", "@llm-ts-example/common-backend": "workspace:*", "@pinecone-database/pinecone": "^6.1.3", "@smithy/eventstream-codec": "^4.2.5", - "aws-cdk-lib": "^2.231.0", + "aws-cdk-lib": "^2.232.1", "constructs": "^10.4.3", - "langchain": "^1.1.4", + "langchain": "^1.1.5", "langfuse": "^3.38.6", "langfuse-langchain": "^3.38.6", "source-map-support": "^0.5.21",