@tessl/cli 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.mjs +106 -109
- package/package.json +1 -1
package/dist/bundle.mjs
CHANGED
|
@@ -88,7 +88,7 @@ return globalThis.Object.getOwnPropertyNames(e).reduce((t,r)=>({...t,[r]:Compute
|
|
|
88
88
|
function Void(e){return CreateType({[Kind]:"Void",type:"void"},e)}var TypeBuilder=Object.freeze({__proto__:null,Any:Any$1,Argument,Array:Array$1,AsyncIterator,Awaited,BigInt:BigInt$1,Boolean:Boolean$1,Capitalize,Composite,Const,Constructor,ConstructorParameters,Date:Date$1,Enum,Exclude,Extends,Extract,Function:Function$1,Index,InstanceType,Instantiate,Integer,Intersect:Intersect$1,Iterator,KeyOf,Literal,Lowercase,Mapped,Module,Never,Not,Null,Number:Number$1,Object:Object$1,Omit,Optional,Parameters,Partial,Pick,Promise:Promise$1,Readonly,ReadonlyOptional,Record,Recursive,Ref,RegExp:RegExp$1,Required,Rest,ReturnType,String:String$1,Symbol:Symbol$1,TemplateLiteral,Transform:Transform$1,Tuple,Uint8Array:Uint8Array$1,Uncapitalize,Undefined,Union:Union$1,Unknown,Unsafe,Uppercase,Void});const Type=TypeBuilder;function _nullishCoalesce$V(e,t){return null!=e?e:t()}const ProjectConfigSchema=Type.Object({name:Type.Optional(Type.String({description:"Project name"}))
|
|
89
89
|
}),CONFIG_DIR_NAME=".tessl",AGENTS_MD_FILENAME="AGENTS.md",SYSTEM_PROMPT_FILENAME="tessl-system-prompt.md",TESSL_CONFIG_FILE_NAME="tessl-config.jsonc",TMP_DIR_NAME="tmp",DEFAULT_TESSL_DIRS={customToolDirectory:join(CONFIG_DIR_NAME,"tools"),frameworkDirectory:join(CONFIG_DIR_NAME,"framework"),tmpDirectory:join(CONFIG_DIR_NAME,TMP_DIR_NAME),testRunnerDirectory:join(CONFIG_DIR_NAME,TMP_DIR_NAME,"test-runners"),testResultsDirectory:join(CONFIG_DIR_NAME,TMP_DIR_NAME,"test-results"),sessionDataDirectory:join(CONFIG_DIR_NAME,TMP_DIR_NAME,"session-data"),toolOutputLogsDirectory:join(CONFIG_DIR_NAME,TMP_DIR_NAME,"tool-output-logs")};function getDefaultGlobalConfigDir(e,t){const r=_nullishCoalesce$V(t,()=>os$2.homedir()),n=_nullishCoalesce$V(_nullishCoalesce$V(e,()=>"production"),()=>"development");return path__default.join(r,"production"===n?".tessl":`.tessl_${n}`)}function getProvisionedEnvPath(e,t){return join$1(getDefaultGlobalConfigDir(e,t),"dotenv")}function getLocalCliEnvPath(){
|
|
90
90
|
const e=fileURLToPath(import.meta.url),t=dirname(e),r=join$1(t,"..","..","..","..");return join$1(r,".cli.env")}function loadEnvAndWatch(){loadEnv(),setupFileWatchers()}function loadEnvFile(e){fs__default.existsSync(e)&&mainExports.config({path:e,override:!0,quiet:!0})}function loadEnv(){loadEnvFile(getProvisionedEnvPath("production")),process.env.TESSL_LLM_API_KEY?process.env.ANTHROPIC_AUTH_TOKEN=process.env.TESSL_LLM_API_KEY:delete process.env.ANTHROPIC_AUTH_TOKEN,process.env.TESSL_LLM_BASE_URL?process.env.ANTHROPIC_BASE_URL=process.env.TESSL_LLM_BASE_URL:delete process.env.ANTHROPIC_BASE_URL;const e=getClaudeCodeSdkModels();process.env.ANTHROPIC_MODEL=e.DEFAULT,process.env.ANTHROPIC_SMALL_FAST_MODEL=e.SMALL_FAST}let localCliWatcher=null,provisionedEnvWatcher=null,cleanupRegistered=!1;function createFileWatcher(e,t){const r=dirname(e),n=basename(e);if(!fs__default.existsSync(r))return null;const i=watch(r,(e,r)=>{r!==n||"change"!==e&&"rename"!==e||t()});return i.on("error",()=>{}),
|
|
91
|
-
i.unref(),i}function cleanup(){localCliWatcher&&(localCliWatcher.close(),localCliWatcher=null),provisionedEnvWatcher&&(provisionedEnvWatcher.close(),provisionedEnvWatcher=null)}function setupFileWatchers(){cleanup(),localCliWatcher=createFileWatcher(getLocalCliEnvPath(),loadEnv),provisionedEnvWatcher=createFileWatcher(getProvisionedEnvPath("production"),loadEnv),cleanupRegistered||(process.on("SIGINT",cleanup),process.on("SIGTERM",cleanup),cleanupRegistered=!0)}function getTesslCmdName(){return"tessl"}process.env={...process.env,ROLLUP_BUNDLING_CLI:!0,NODE_ENV:"production",GLOBAL_CONFIG_DIR:".tessl",STAMPED_REVISION:"
|
|
91
|
+
i.unref(),i}function cleanup(){localCliWatcher&&(localCliWatcher.close(),localCliWatcher=null),provisionedEnvWatcher&&(provisionedEnvWatcher.close(),provisionedEnvWatcher=null)}function setupFileWatchers(){cleanup(),localCliWatcher=createFileWatcher(getLocalCliEnvPath(),loadEnv),provisionedEnvWatcher=createFileWatcher(getProvisionedEnvPath("production"),loadEnv),cleanupRegistered||(process.on("SIGINT",cleanup),process.on("SIGTERM",cleanup),cleanupRegistered=!0)}function getTesslCmdName(){return"tessl"}process.env={...process.env,ROLLUP_BUNDLING_CLI:!0,NODE_ENV:"production",GLOBAL_CONFIG_DIR:".tessl",STAMPED_REVISION:"515d0a25e7557543b259c4962f29ebdd5fb410ba",STAMPED_RELEASE_DATE:"2025-10-07T14:52:51.036Z",STAMPED_VERSION:"v0.26.0",TESSL_BASE_API_URL:"https://api.tessl.io",WORKOS_CLIENT_ID:"client_01HXSHDD9KV92A4892CWHZZDDR",POSTHOG_API_KEY:"phc_S8tHJaPxa5ORnP0RVyyTaJHeCcft6XMqfjx9ZlJWvkO",POSTHOG_FEEDBACK_SURVEY_ID:"0197d0d3-6704-0000-e36e-569911acb8ee",
|
|
92
92
|
POSTHOG_FEEDBACK_SURVEY_QUESTION_ID:"e34e48fc-938a-4af1-b255-3c55d6bdcbc7"},loadEnvAndWatch();var _globalThis$2="object"==typeof globalThis?globalThis:global,VERSION$a="1.9.0",re$2=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function _makeCompatibilityCheck(e){var t=new Set([e]),r=new Set,n=e.match(re$2);if(!n)return function(){return!1};var i=+n[1],s=+n[2],o=+n[3];if(null!=n[4])return function(t){return t===e};function a(e){return r.add(e),!1}function c(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(r.has(e))return!1;var n=e.match(re$2);if(!n)return a(e);var u=+n[1],l=+n[2],d=+n[3];return null!=n[4]||i!==u?a(e):0===i?s===l&&o<=d?c(e):a(e):s<=l?c(e):a(e)}}var isCompatible=_makeCompatibilityCheck(VERSION$a),major=VERSION$a.split(".")[0],GLOBAL_OPENTELEMETRY_API_KEY=Symbol.for("opentelemetry.js.api."+major),_global$1=_globalThis$2;function registerGlobal(e,t,r,n){var i;void 0===n&&(n=!1)
|
|
93
93
|
;var s=_global$1[GLOBAL_OPENTELEMETRY_API_KEY]=null!==(i=_global$1[GLOBAL_OPENTELEMETRY_API_KEY])&&void 0!==i?i:{version:VERSION$a};if(!n&&s[e]){var o=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(o.stack||o.message),!1}if(s.version!==VERSION$a){o=new Error("@opentelemetry/api: Registration of version v"+s.version+" for "+e+" does not match previously registered API v"+VERSION$a);return r.error(o.stack||o.message),!1}return s[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+VERSION$a+"."),!0}function getGlobal(e){var t,r,n=null===(t=_global$1[GLOBAL_OPENTELEMETRY_API_KEY])||void 0===t?void 0:t.version;if(n&&isCompatible(n))return null===(r=_global$1[GLOBAL_OPENTELEMETRY_API_KEY])||void 0===r?void 0:r[e]}function unregisterGlobal(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+VERSION$a+".");var r=_global$1[GLOBAL_OPENTELEMETRY_API_KEY];r&&delete r[e]}var __read$4=function(e,t){
|
|
94
94
|
var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o},__spreadArray$3=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,s=t.length;i<s;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},DiagComponentLogger=function(){function e(e){this._namespace=e.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return logProxy("debug",this._namespace,e)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return logProxy("error",this._namespace,e)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return logProxy("info",this._namespace,e)},e.prototype.warn=function(){
|
|
@@ -184,24 +184,24 @@ var e=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};va
|
|
|
184
184
|
;var n=/^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/,i={};return i.parse=function(e){if("string"!=typeof e)throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e);var t,r=(t=e,n.exec(t).slice(1));if(!r||5!==r.length)throw new TypeError("Invalid path '"+e+"'");return{root:r[1],dir:r[0].slice(0,-1),base:r[2],ext:r[4],name:r[3]}},pathParse.exports=e?r.parse:i.parse,pathParse.exports.posix=i.parse,pathParse.exports.win32=r.parse,pathParse.exports}function requireNodeModulesPaths(){if(hasRequiredNodeModulesPaths)return nodeModulesPaths;hasRequiredNodeModulesPaths=1;var e=path__default,t=e.parse||requirePathParse(),r=function(r,n){var i="/";/^([A-Za-z]:)/.test(r)?i="":/^\\\\/.test(r)&&(i="\\\\");for(var s=[r],o=t(r);o.dir!==s[s.length-1];)s.push(o.dir),o=t(o.dir);return s.reduce(function(t,r){return t.concat(n.map(function(t){return e.resolve(i,r,t)}))},[])};return nodeModulesPaths=function(e,t,n){
|
|
185
185
|
var i=t&&t.moduleDirectory?[].concat(t.moduleDirectory):["node_modules"];if(t&&"function"==typeof t.paths)return t.paths(n,e,function(){return r(e,i)},t);var s=r(e,i);return t&&t.paths?s.concat(t.paths):s},nodeModulesPaths}function requireNormalizeOptions(){return hasRequiredNormalizeOptions?normalizeOptions$3:(hasRequiredNormalizeOptions=1,normalizeOptions$3=function(e,t){return t||{}})}function requireImplementation(){if(hasRequiredImplementation)return implementation;hasRequiredImplementation=1;var e=Object.prototype.toString,t=Math.max,r=function(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var i=0;i<t.length;i+=1)r[i+e.length]=t[i];return r};return implementation=function(n){var i=this;if("function"!=typeof i||"[object Function]"!==e.apply(i))throw new TypeError("Function.prototype.bind called on incompatible "+i);for(var s,o=function(e,t){for(var r=[],n=t,i=0;n<e.length;n+=1,i+=1)r[i]=e[n];return r}(arguments,1),a=t(0,i.length-o.length),c=[],u=0;u<a;u++)c[u]="$"+u
|
|
186
186
|
;if(s=Function("binder","return function ("+function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r}(c,",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof s){var e=i.apply(this,r(o,arguments));return Object(e)===e?e:this}return i.apply(n,r(o,arguments))}),i.prototype){var l=function(){};l.prototype=i.prototype,s.prototype=new l,l.prototype=null}return s},implementation}function requireFunctionBind(){if(hasRequiredFunctionBind)return functionBind;hasRequiredFunctionBind=1;var e=requireImplementation();return functionBind=Function.prototype.bind||e}function requireHasown(){if(hasRequiredHasown)return hasown;hasRequiredHasown=1;var e=Function.prototype.call,t=Object.prototype.hasOwnProperty,r=requireFunctionBind();return hasown=r.call(e,t)}
|
|
187
|
-
var assert$5=!0,async_hooks$1=">= 8",buffer_ieee754$1=">= 0.5 && < 0.9.7",buffer$2=!0,child_process$1=!0,cluster$1=">= 0.5",console$2=!0,constants$f=!0,crypto$2=!0,_debug_agent$1=">= 1 && < 8",_debugger$1="< 8",dgram$1=!0,diagnostics_channel$1=[">= 14.17 && < 15",">= 15.1"],dns$2=!0,domain$1=">= 0.7.12",events$2=!0,freelist$1="< 6",fs$6=!0,_http_agent$1=">= 0.11.1",_http_client$1=">= 0.11.1",_http_common$1=">= 0.11.1",_http_incoming$1=">= 0.11.1",_http_outgoing$1=">= 0.11.1",_http_server$1=">= 0.11.1",http$1=!0,http2$1=">= 8.8",https$1=!0,inspector$1=">= 8",_linklist$1="< 8",module$1=!0,net$1=!0,os$1=!0,path$5=!0,perf_hooks$1=">= 8.5",process$3=">= 1",punycode$3=">= 0.5",querystring$1=!0,readline$2=!0,repl$1=!0,smalloc$1=">= 0.11.5 && < 3",_stream_duplex$2=">= 0.9.4",_stream_transform$2=">= 0.9.4",_stream_wrap$1=">= 1.4.1",_stream_passthrough$2=">= 0.9.4",_stream_readable$2=">= 0.9.4",_stream_writable$2=">= 0.9.4",stream$8=!0,string_decoder$2=!0,sys$1=[">= 0.4 && < 0.7",">= 0.8"],timers$2=!0,_tls_common$1=">= 0.11.13",_tls_legacy$1=">= 0.11.3 && < 10",_tls_wrap$1=">= 0.11.3",tls$1=!0,trace_events$1=">= 10",tty$1=!0,url$1=!0,util$
|
|
187
|
+
var assert$5=!0,async_hooks$1=">= 8",buffer_ieee754$1=">= 0.5 && < 0.9.7",buffer$2=!0,child_process$1=!0,cluster$1=">= 0.5",console$2=!0,constants$f=!0,crypto$2=!0,_debug_agent$1=">= 1 && < 8",_debugger$1="< 8",dgram$1=!0,diagnostics_channel$1=[">= 14.17 && < 15",">= 15.1"],dns$2=!0,domain$1=">= 0.7.12",events$2=!0,freelist$1="< 6",fs$6=!0,_http_agent$1=">= 0.11.1",_http_client$1=">= 0.11.1",_http_common$1=">= 0.11.1",_http_incoming$1=">= 0.11.1",_http_outgoing$1=">= 0.11.1",_http_server$1=">= 0.11.1",http$1=!0,http2$1=">= 8.8",https$1=!0,inspector$1=">= 8",_linklist$1="< 8",module$1=!0,net$1=!0,os$1=!0,path$5=!0,perf_hooks$1=">= 8.5",process$3=">= 1",punycode$3=">= 0.5",querystring$1=!0,readline$2=!0,repl$1=!0,smalloc$1=">= 0.11.5 && < 3",_stream_duplex$2=">= 0.9.4",_stream_transform$2=">= 0.9.4",_stream_wrap$1=">= 1.4.1",_stream_passthrough$2=">= 0.9.4",_stream_readable$2=">= 0.9.4",_stream_writable$2=">= 0.9.4",stream$8=!0,string_decoder$2=!0,sys$1=[">= 0.4 && < 0.7",">= 0.8"],timers$2=!0,_tls_common$1=">= 0.11.13",_tls_legacy$1=">= 0.11.3 && < 10",_tls_wrap$1=">= 0.11.3",tls$1=!0,trace_events$1=">= 10",tty$1=!0,url$1=!0,util$c=!0,v8$1=">= 1",vm$1=!0,wasi$1=[">= 13.4 && < 13.5",">= 18.17 && < 19",">= 20"],worker_threads$1=">= 11.7",zlib$1=">= 0.5",require$$1$4={
|
|
188
188
|
assert:assert$5,"node:assert":[">= 14.18 && < 15",">= 16"],"assert/strict":">= 15","node:assert/strict":">= 16",async_hooks:async_hooks$1,"node:async_hooks":[">= 14.18 && < 15",">= 16"],buffer_ieee754:buffer_ieee754$1,buffer:buffer$2,"node:buffer":[">= 14.18 && < 15",">= 16"],child_process:child_process$1,"node:child_process":[">= 14.18 && < 15",">= 16"],cluster:cluster$1,"node:cluster":[">= 14.18 && < 15",">= 16"],console:console$2,"node:console":[">= 14.18 && < 15",">= 16"],constants:constants$f,"node:constants":[">= 14.18 && < 15",">= 16"],crypto:crypto$2,"node:crypto":[">= 14.18 && < 15",">= 16"],_debug_agent:_debug_agent$1,_debugger:_debugger$1,dgram:dgram$1,"node:dgram":[">= 14.18 && < 15",">= 16"],diagnostics_channel:diagnostics_channel$1,"node:diagnostics_channel":[">= 14.18 && < 15",">= 16"],dns:dns$2,"node:dns":[">= 14.18 && < 15",">= 16"],"dns/promises":">= 15","node:dns/promises":">= 16",domain:domain$1,"node:domain":[">= 14.18 && < 15",">= 16"],events:events$2,
|
|
189
189
|
"node:events":[">= 14.18 && < 15",">= 16"],freelist:freelist$1,fs:fs$6,"node:fs":[">= 14.18 && < 15",">= 16"],"fs/promises":[">= 10 && < 10.1",">= 14"],"node:fs/promises":[">= 14.18 && < 15",">= 16"],_http_agent:_http_agent$1,"node:_http_agent":[">= 14.18 && < 15",">= 16"],_http_client:_http_client$1,"node:_http_client":[">= 14.18 && < 15",">= 16"],_http_common:_http_common$1,"node:_http_common":[">= 14.18 && < 15",">= 16"],_http_incoming:_http_incoming$1,"node:_http_incoming":[">= 14.18 && < 15",">= 16"],_http_outgoing:_http_outgoing$1,"node:_http_outgoing":[">= 14.18 && < 15",">= 16"],_http_server:_http_server$1,"node:_http_server":[">= 14.18 && < 15",">= 16"],http:http$1,"node:http":[">= 14.18 && < 15",">= 16"],http2:http2$1,"node:http2":[">= 14.18 && < 15",">= 16"],https:https$1,"node:https":[">= 14.18 && < 15",">= 16"],inspector:inspector$1,"node:inspector":[">= 14.18 && < 15",">= 16"],"inspector/promises":[">= 19"],"node:inspector/promises":[">= 19"],_linklist:_linklist$1,
|
|
190
190
|
module:module$1,"node:module":[">= 14.18 && < 15",">= 16"],net:net$1,"node:net":[">= 14.18 && < 15",">= 16"],"node-inspect/lib/_inspect":">= 7.6 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6 && < 12",os:os$1,"node:os":[">= 14.18 && < 15",">= 16"],path:path$5,"node:path":[">= 14.18 && < 15",">= 16"],"path/posix":">= 15.3","node:path/posix":">= 16","path/win32":">= 15.3","node:path/win32":">= 16",perf_hooks:perf_hooks$1,"node:perf_hooks":[">= 14.18 && < 15",">= 16"],process:process$3,"node:process":[">= 14.18 && < 15",">= 16"],punycode:punycode$3,"node:punycode":[">= 14.18 && < 15",">= 16"],querystring:querystring$1,"node:querystring":[">= 14.18 && < 15",">= 16"],readline:readline$2,"node:readline":[">= 14.18 && < 15",">= 16"],"readline/promises":">= 17","node:readline/promises":">= 17",repl:repl$1,"node:repl":[">= 14.18 && < 15",">= 16"],"node:sea":[">= 20.12 && < 21",">= 21.7"],smalloc:smalloc$1,
|
|
191
191
|
"node:sqlite":[">= 22.13 && < 23",">= 23.4"],_stream_duplex:_stream_duplex$2,"node:_stream_duplex":[">= 14.18 && < 15",">= 16"],_stream_transform:_stream_transform$2,"node:_stream_transform":[">= 14.18 && < 15",">= 16"],_stream_wrap:_stream_wrap$1,"node:_stream_wrap":[">= 14.18 && < 15",">= 16"],_stream_passthrough:_stream_passthrough$2,"node:_stream_passthrough":[">= 14.18 && < 15",">= 16"],_stream_readable:_stream_readable$2,"node:_stream_readable":[">= 14.18 && < 15",">= 16"],_stream_writable:_stream_writable$2,"node:_stream_writable":[">= 14.18 && < 15",">= 16"],stream:stream$8,"node:stream":[">= 14.18 && < 15",">= 16"],"stream/consumers":">= 16.7","node:stream/consumers":">= 16.7","stream/promises":">= 15","node:stream/promises":">= 16","stream/web":">= 16.5","node:stream/web":">= 16.5",string_decoder:string_decoder$2,"node:string_decoder":[">= 14.18 && < 15",">= 16"],sys:sys$1,"node:sys":[">= 14.18 && < 15",">= 16"],"test/reporters":">= 19.9 && < 20.2",
|
|
192
|
-
"node:test/reporters":[">= 18.17 && < 19",">= 19.9",">= 20"],"test/mock_loader":">= 22.3 && < 22.7","node:test/mock_loader":">= 22.3 && < 22.7","node:test":[">= 16.17 && < 17",">= 18"],timers:timers$2,"node:timers":[">= 14.18 && < 15",">= 16"],"timers/promises":">= 15","node:timers/promises":">= 16",_tls_common:_tls_common$1,"node:_tls_common":[">= 14.18 && < 15",">= 16"],_tls_legacy:_tls_legacy$1,_tls_wrap:_tls_wrap$1,"node:_tls_wrap":[">= 14.18 && < 15",">= 16"],tls:tls$1,"node:tls":[">= 14.18 && < 15",">= 16"],trace_events:trace_events$1,"node:trace_events":[">= 14.18 && < 15",">= 16"],tty:tty$1,"node:tty":[">= 14.18 && < 15",">= 16"],url:url$1,"node:url":[">= 14.18 && < 15",">= 16"],util:util$
|
|
192
|
+
"node:test/reporters":[">= 18.17 && < 19",">= 19.9",">= 20"],"test/mock_loader":">= 22.3 && < 22.7","node:test/mock_loader":">= 22.3 && < 22.7","node:test":[">= 16.17 && < 17",">= 18"],timers:timers$2,"node:timers":[">= 14.18 && < 15",">= 16"],"timers/promises":">= 15","node:timers/promises":">= 16",_tls_common:_tls_common$1,"node:_tls_common":[">= 14.18 && < 15",">= 16"],_tls_legacy:_tls_legacy$1,_tls_wrap:_tls_wrap$1,"node:_tls_wrap":[">= 14.18 && < 15",">= 16"],tls:tls$1,"node:tls":[">= 14.18 && < 15",">= 16"],trace_events:trace_events$1,"node:trace_events":[">= 14.18 && < 15",">= 16"],tty:tty$1,"node:tty":[">= 14.18 && < 15",">= 16"],url:url$1,"node:url":[">= 14.18 && < 15",">= 16"],util:util$c,"node:util":[">= 14.18 && < 15",">= 16"],"util/types":">= 15.3","node:util/types":">= 16","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/consarray":[">= 4.4 && < 5",">= 5.2 && < 12"],
|
|
193
193
|
"v8/tools/csvparser":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/logreader":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/profile_view":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/splaytree":[">= 4.4 && < 5",">= 5.2 && < 12"],v8:v8$1,"node:v8":[">= 14.18 && < 15",">= 16"],vm:vm$1,"node:vm":[">= 14.18 && < 15",">= 16"],wasi:wasi$1,"node:wasi":[">= 18.17 && < 19",">= 20"],worker_threads:worker_threads$1,"node:worker_threads":[">= 14.18 && < 15",">= 16"],zlib:zlib$1,"node:zlib":[">= 14.18 && < 15",">= 16"]},isCoreModule,hasRequiredIsCoreModule,async$8,hasRequiredAsync$9;function requireIsCoreModule(){if(hasRequiredIsCoreModule)return isCoreModule;hasRequiredIsCoreModule=1;var e=requireHasown();function t(e,t){for(var r=e.split("."),n=t.split(" "),i=n.length>1?n[0]:"=",s=(n.length>1?n[1]:n[0]).split("."),o=0;o<3;++o){var a=parseInt(r[o]||0,10),c=parseInt(s[o]||0,10);if(a!==c)return"<"===i?a<c:">="===i&&a>=c}return">="===i}function r(e,r){var n=r.split(/ ?&& ?/);if(0===n.length)return!1
|
|
194
194
|
;for(var i=0;i<n.length;++i)if(!t(e,n[i]))return!1;return!0}var n=require$$1$4;return isCoreModule=function(t,i){return e(n,t)&&function(e,t){if("boolean"==typeof t)return t;var n=void 0===e?process.versions&&process.versions.node:e;if("string"!=typeof n)throw new TypeError(void 0===e?"Unable to determine current node version":"If provided, a valid node version is required");if(t&&"object"==typeof t){for(var i=0;i<t.length;++i)if(r(n,t[i]))return!0;return!1}return r(n,t)}(i,n[t])},isCoreModule}function requireAsync$9(){if(hasRequiredAsync$9)return async$8;hasRequiredAsync$9=1;var e=fs$8,t=requireHomedir(),r=path__default,n=requireCaller(),i=requireNodeModulesPaths(),s=requireNormalizeOptions(),o=requireIsCoreModule(),a="win32"!==process.platform&&e.realpath&&"function"==typeof e.realpath.native?e.realpath.native:e.realpath,c=t(),u=function(t,r){e.stat(t,function(e,t){return e?"ENOENT"===e.code||"ENOTDIR"===e.code?r(null,!1):r(e):r(null,t.isFile()||t.isFIFO())})},l=function(t,r){
|
|
195
195
|
e.stat(t,function(e,t){return e?"ENOENT"===e.code||"ENOTDIR"===e.code?r(null,!1):r(e):r(null,t.isDirectory())})},d=function(e,t){a(e,function(r,n){r&&"ENOENT"!==r.code?t(r):t(null,r?e:n)})},p=function(e,t,r,n){r&&!1===r.preserveSymlinks?e(t,n):n(null,t)},h=function(e,t,r){e(t,function(e,t){if(e)r(e);else try{var n=JSON.parse(t);r(null,n)}catch(e){r(null)}})};return async$8=function(t,a,A){var f=A,g=a;if("function"==typeof a&&(f=g,g={}),"string"!=typeof t){var m=new TypeError("Path must be a string.");return process.nextTick(function(){f(m)})}var y=(g=s(t,g)).isFile||u,E=g.isDirectory||l,b=g.readFile||e.readFile,C=g.realpath||d,v=g.readPackage||h;if(g.readFile&&g.readPackage){var I=new TypeError("`readFile` and `readPackage` are mutually exclusive.");return process.nextTick(function(){f(I)})}var _=g.packageIterator,S=g.extensions||[".js"],D=!1!==g.includeCoreModules,w=g.basedir||r.dirname(n()),R=g.filename||w;g.paths=g.paths||[r.join(c,".node_modules"),r.join(c,".node_libraries")]
|
|
196
196
|
;var B,T=r.resolve(w);function x(e,r,n){e?f(e):r?f(null,r,n):k(B,function(e,r,n){if(e)f(e);else if(r)p(C,r,g,function(e,t){e?f(e):f(null,t,n)});else{var i=new Error("Cannot find module '"+t+"' from '"+R+"'");i.code="MODULE_NOT_FOUND",f(i)}})}function $(e,t,n){var i=t,s=n;"function"==typeof i&&(s=i,i=void 0),function e(t,n,i){if(0===t.length)return s(null,void 0,i);var o=n+t[0],a=i;a?c(null,a):F(r.dirname(o),c);function c(i,c,l){if(a=c,i)return s(i);if(l&&a&&g.pathFilter){var d=r.relative(l,o),p=d.slice(0,d.length-t[0].length),h=g.pathFilter(a,n,p);if(h)return e([""].concat(S.slice()),r.resolve(l,h),a)}y(o,u)}function u(r,i){return r?s(r):i?s(null,o,a):void e(t.slice(1),n,a)}}([""].concat(S),e,i)}function F(e,t){return""===e||"/"===e||"win32"===process.platform&&/^\w:[/\\]*$/.test(e)||/[/\\]node_modules[/\\]*$/.test(e)?t(null):void p(C,e,g,function(n,i){if(n)return F(r.dirname(e),t);var s=r.join(i,"package.json");y(s,function(n,i){if(!i)return F(r.dirname(e),t);v(b,s,function(r,n){
|
|
197
197
|
r&&t(r);var i=n;i&&g.packageFilter&&(i=g.packageFilter(i,s)),t(null,i,e)})})})}function k(e,t,n){var i=n,s=t;"function"==typeof s&&(i=s,s=g.package),p(C,e,g,function(t,n){if(t)return i(t);var o=r.join(n,"package.json");y(o,function(t,n){return t?i(t):n?void v(b,o,function(t,n){if(t)return i(t);var s=n;if(s&&g.packageFilter&&(s=g.packageFilter(s,o)),s&&s.main){if("string"!=typeof s.main){var a=new TypeError("package “"+s.name+"” `main` must be a string");return a.code="INVALID_PACKAGE_MAIN",i(a)}return"."!==s.main&&"./"!==s.main||(s.main="index"),void $(r.resolve(e,s.main),s,function(t,n,s){return t?i(t):n?i(null,n,s):s?void k(r.resolve(e,s.main),s,function(t,n,s){return t?i(t):n?i(null,n,s):void $(r.join(e,"index"),s,i)}):$(r.join(e,"index"),s,i)})}$(r.join(e,"/index"),s,i)}):$(r.join(e,"index"),s,i)})})}function Q(e,t){if(0===t.length)return e(null,void 0);var n=t[0];function i(t,r,i){return t?e(t):r?e(null,r,i):void k(n,g.package,s)}function s(r,n,i){
|
|
198
198
|
return r?e(r):n?e(null,n,i):void Q(e,t.slice(1))}E(r.dirname(n),function(r,s){if(r)return e(r);if(!s)return Q(e,t.slice(1));$(n,g.package,i)})}p(C,T,g,function(e,n){e?f(e):function(e){if(/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(t))B=r.resolve(e,t),"."!==t&&".."!==t&&"/"!==t.slice(-1)||(B+="/"),/\/$/.test(t)&&B===e?k(B,g.package,x):$(B,g.package,x);else{if(D&&o(t))return f(null,t);!function(e,t,n){var s=function(){return function(e,t,n){for(var s=i(t,n,e),o=0;o<s.length;o++)s[o]=r.join(s[o],e);return s}(e,t,g)};Q(n,_?_(e,t,s,g):s())}(t,e,function(e,r,n){if(e)f(e);else{if(r)return p(C,r,g,function(e,t){e?f(e):f(null,t,n)});var i=new Error("Cannot find module '"+t+"' from '"+R+"'");i.code="MODULE_NOT_FOUND",f(i)}})}}(n)})},async$8}
|
|
199
|
-
var assert$4=!0,async_hooks=">= 8",buffer_ieee754=">= 0.5 && < 0.9.7",buffer$1=!0,child_process=!0,cluster=">= 0.5",console$1=!0,constants$e=!0,crypto$1=!0,_debug_agent=">= 1 && < 8",_debugger="< 8",dgram=!0,diagnostics_channel=[">= 14.17 && < 15",">= 15.1"],dns$1=!0,domain=">= 0.7.12",events$1=!0,freelist="< 6",fs$5=!0,_http_agent=">= 0.11.1",_http_client=">= 0.11.1",_http_common=">= 0.11.1",_http_incoming=">= 0.11.1",_http_outgoing=">= 0.11.1",_http_server=">= 0.11.1",http=!0,http2=">= 8.8",https=!0,inspector=">= 8",_linklist="< 8",module=!0,net=!0,os=!0,path$4=!0,perf_hooks=">= 8.5",process$2=">= 1",punycode$2=">= 0.5",querystring=!0,readline$1=!0,repl=!0,smalloc=">= 0.11.5 && < 3",_stream_duplex$1=">= 0.9.4",_stream_transform$1=">= 0.9.4",_stream_wrap=">= 1.4.1",_stream_passthrough$1=">= 0.9.4",_stream_readable$1=">= 0.9.4",_stream_writable$1=">= 0.9.4",stream$7=!0,string_decoder$1=!0,sys=[">= 0.4 && < 0.7",">= 0.8"],timers$1=!0,_tls_common=">= 0.11.13",_tls_legacy=">= 0.11.3 && < 10",_tls_wrap=">= 0.11.3",tls=!0,trace_events=">= 10",tty=!0,url=!0,util$
|
|
199
|
+
var assert$4=!0,async_hooks=">= 8",buffer_ieee754=">= 0.5 && < 0.9.7",buffer$1=!0,child_process=!0,cluster=">= 0.5",console$1=!0,constants$e=!0,crypto$1=!0,_debug_agent=">= 1 && < 8",_debugger="< 8",dgram=!0,diagnostics_channel=[">= 14.17 && < 15",">= 15.1"],dns$1=!0,domain=">= 0.7.12",events$1=!0,freelist="< 6",fs$5=!0,_http_agent=">= 0.11.1",_http_client=">= 0.11.1",_http_common=">= 0.11.1",_http_incoming=">= 0.11.1",_http_outgoing=">= 0.11.1",_http_server=">= 0.11.1",http=!0,http2=">= 8.8",https=!0,inspector=">= 8",_linklist="< 8",module=!0,net=!0,os=!0,path$4=!0,perf_hooks=">= 8.5",process$2=">= 1",punycode$2=">= 0.5",querystring=!0,readline$1=!0,repl=!0,smalloc=">= 0.11.5 && < 3",_stream_duplex$1=">= 0.9.4",_stream_transform$1=">= 0.9.4",_stream_wrap=">= 1.4.1",_stream_passthrough$1=">= 0.9.4",_stream_readable$1=">= 0.9.4",_stream_writable$1=">= 0.9.4",stream$7=!0,string_decoder$1=!0,sys=[">= 0.4 && < 0.7",">= 0.8"],timers$1=!0,_tls_common=">= 0.11.13",_tls_legacy=">= 0.11.3 && < 10",_tls_wrap=">= 0.11.3",tls=!0,trace_events=">= 10",tty=!0,url=!0,util$b=!0,v8=">= 1",vm=!0,wasi=[">= 13.4 && < 13.5",">= 18.17 && < 19",">= 20"],worker_threads=">= 11.7",zlib=">= 0.5",require$$1$3={
|
|
200
200
|
assert:assert$4,"node:assert":[">= 14.18 && < 15",">= 16"],"assert/strict":">= 15","node:assert/strict":">= 16",async_hooks,"node:async_hooks":[">= 14.18 && < 15",">= 16"],buffer_ieee754,buffer:buffer$1,"node:buffer":[">= 14.18 && < 15",">= 16"],child_process,"node:child_process":[">= 14.18 && < 15",">= 16"],cluster,"node:cluster":[">= 14.18 && < 15",">= 16"],console:console$1,"node:console":[">= 14.18 && < 15",">= 16"],constants:constants$e,"node:constants":[">= 14.18 && < 15",">= 16"],crypto:crypto$1,"node:crypto":[">= 14.18 && < 15",">= 16"],_debug_agent,_debugger,dgram,"node:dgram":[">= 14.18 && < 15",">= 16"],diagnostics_channel,"node:diagnostics_channel":[">= 14.18 && < 15",">= 16"],dns:dns$1,"node:dns":[">= 14.18 && < 15",">= 16"],"dns/promises":">= 15","node:dns/promises":">= 16",domain,"node:domain":[">= 14.18 && < 15",">= 16"],events:events$1,"node:events":[">= 14.18 && < 15",">= 16"],freelist,fs:fs$5,"node:fs":[">= 14.18 && < 15",">= 16"],
|
|
201
201
|
"fs/promises":[">= 10 && < 10.1",">= 14"],"node:fs/promises":[">= 14.18 && < 15",">= 16"],_http_agent,"node:_http_agent":[">= 14.18 && < 15",">= 16"],_http_client,"node:_http_client":[">= 14.18 && < 15",">= 16"],_http_common,"node:_http_common":[">= 14.18 && < 15",">= 16"],_http_incoming,"node:_http_incoming":[">= 14.18 && < 15",">= 16"],_http_outgoing,"node:_http_outgoing":[">= 14.18 && < 15",">= 16"],_http_server,"node:_http_server":[">= 14.18 && < 15",">= 16"],http,"node:http":[">= 14.18 && < 15",">= 16"],http2,"node:http2":[">= 14.18 && < 15",">= 16"],https,"node:https":[">= 14.18 && < 15",">= 16"],inspector,"node:inspector":[">= 14.18 && < 15",">= 16"],"inspector/promises":[">= 19"],"node:inspector/promises":[">= 19"],_linklist,module,"node:module":[">= 14.18 && < 15",">= 16"],net,"node:net":[">= 14.18 && < 15",">= 16"],"node-inspect/lib/_inspect":">= 7.6 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6 && < 12",
|
|
202
202
|
os,"node:os":[">= 14.18 && < 15",">= 16"],path:path$4,"node:path":[">= 14.18 && < 15",">= 16"],"path/posix":">= 15.3","node:path/posix":">= 16","path/win32":">= 15.3","node:path/win32":">= 16",perf_hooks,"node:perf_hooks":[">= 14.18 && < 15",">= 16"],process:process$2,"node:process":[">= 14.18 && < 15",">= 16"],punycode:punycode$2,"node:punycode":[">= 14.18 && < 15",">= 16"],querystring,"node:querystring":[">= 14.18 && < 15",">= 16"],readline:readline$1,"node:readline":[">= 14.18 && < 15",">= 16"],"readline/promises":">= 17","node:readline/promises":">= 17",repl,"node:repl":[">= 14.18 && < 15",">= 16"],"node:sea":[">= 20.12 && < 21",">= 21.7"],smalloc,"node:sqlite":">= 23.4",_stream_duplex:_stream_duplex$1,"node:_stream_duplex":[">= 14.18 && < 15",">= 16"],_stream_transform:_stream_transform$1,"node:_stream_transform":[">= 14.18 && < 15",">= 16"],_stream_wrap,"node:_stream_wrap":[">= 14.18 && < 15",">= 16"],_stream_passthrough:_stream_passthrough$1,
|
|
203
203
|
"node:_stream_passthrough":[">= 14.18 && < 15",">= 16"],_stream_readable:_stream_readable$1,"node:_stream_readable":[">= 14.18 && < 15",">= 16"],_stream_writable:_stream_writable$1,"node:_stream_writable":[">= 14.18 && < 15",">= 16"],stream:stream$7,"node:stream":[">= 14.18 && < 15",">= 16"],"stream/consumers":">= 16.7","node:stream/consumers":">= 16.7","stream/promises":">= 15","node:stream/promises":">= 16","stream/web":">= 16.5","node:stream/web":">= 16.5",string_decoder:string_decoder$1,"node:string_decoder":[">= 14.18 && < 15",">= 16"],sys,"node:sys":[">= 14.18 && < 15",">= 16"],"test/reporters":">= 19.9 && < 20.2","node:test/reporters":[">= 18.17 && < 19",">= 19.9",">= 20"],"test/mock_loader":">= 22.3 && < 22.7","node:test/mock_loader":">= 22.3 && < 22.7","node:test":[">= 16.17 && < 17",">= 18"],timers:timers$1,"node:timers":[">= 14.18 && < 15",">= 16"],"timers/promises":">= 15","node:timers/promises":">= 16",_tls_common,"node:_tls_common":[">= 14.18 && < 15",">= 16"],
|
|
204
|
-
_tls_legacy,_tls_wrap,"node:_tls_wrap":[">= 14.18 && < 15",">= 16"],tls,"node:tls":[">= 14.18 && < 15",">= 16"],trace_events,"node:trace_events":[">= 14.18 && < 15",">= 16"],tty,"node:tty":[">= 14.18 && < 15",">= 16"],url,"node:url":[">= 14.18 && < 15",">= 16"],util:util$
|
|
204
|
+
_tls_legacy,_tls_wrap,"node:_tls_wrap":[">= 14.18 && < 15",">= 16"],tls,"node:tls":[">= 14.18 && < 15",">= 16"],trace_events,"node:trace_events":[">= 14.18 && < 15",">= 16"],tty,"node:tty":[">= 14.18 && < 15",">= 16"],url,"node:url":[">= 14.18 && < 15",">= 16"],util:util$b,"node:util":[">= 14.18 && < 15",">= 16"],"util/types":">= 15.3","node:util/types":">= 16","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/consarray":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/csvparser":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/logreader":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/profile_view":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/splaytree":[">= 4.4 && < 5",">= 5.2 && < 12"],v8,"node:v8":[">= 14.18 && < 15",">= 16"],vm,"node:vm":[">= 14.18 && < 15",">= 16"],wasi,"node:wasi":[">= 18.17 && < 19",">= 20"],worker_threads,"node:worker_threads":[">= 14.18 && < 15",">= 16"],zlib,"node:zlib":[">= 14.18 && < 15",">= 16"]
|
|
205
205
|
},core_1,hasRequiredCore,isCore,hasRequiredIsCore,sync$7,hasRequiredSync$6,resolve$1,hasRequiredResolve$1;function requireCore(){if(hasRequiredCore)return core_1;hasRequiredCore=1;var e=requireIsCoreModule(),t=require$$1$3,r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=e(n));return core_1=r}function requireIsCore(){if(hasRequiredIsCore)return isCore;hasRequiredIsCore=1;var e=requireIsCoreModule();return isCore=function(t){return e(t)}}function requireSync$6(){if(hasRequiredSync$6)return sync$7;hasRequiredSync$6=1;var e=requireIsCoreModule(),t=fs$8,r=path__default,n=requireHomedir(),i=requireCaller(),s=requireNodeModulesPaths(),o=requireNormalizeOptions(),a="win32"!==process.platform&&t.realpathSync&&"function"==typeof t.realpathSync.native?t.realpathSync.native:t.realpathSync,c=n(),u=function(e){try{var r=t.statSync(e,{throwIfNoEntry:!1})}catch(e){if(e&&("ENOENT"===e.code||"ENOTDIR"===e.code))return!1;throw e}return!!r&&(r.isFile()||r.isFIFO())},l=function(e){try{
|
|
206
206
|
var r=t.statSync(e,{throwIfNoEntry:!1})}catch(e){if(e&&("ENOENT"===e.code||"ENOTDIR"===e.code))return!1;throw e}return!!r&&r.isDirectory()},d=function(e){try{return a(e)}catch(e){if("ENOENT"!==e.code)throw e}return e},p=function(e,t,r){return r&&!1===r.preserveSymlinks?e(t):t},h=function(e,t){var r=e(t);try{return JSON.parse(r)}catch(e){}};return sync$7=function(n,a){if("string"!=typeof n)throw new TypeError("Path must be a string.");var A=o(n,a),f=A.isFile||u,g=A.readFileSync||t.readFileSync,m=A.isDirectory||l,y=A.realpathSync||d,E=A.readPackageSync||h;if(A.readFileSync&&A.readPackageSync)throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");var b=A.packageIterator,C=A.extensions||[".js"],v=!1!==A.includeCoreModules,I=A.basedir||r.dirname(i()),_=A.filename||I;A.paths=A.paths||[r.join(c,".node_modules"),r.join(c,".node_libraries")];var S=p(y,r.resolve(I),A);if(/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(n)){var D=r.resolve(S,n)
|
|
207
207
|
;"."!==n&&".."!==n&&"/"!==n.slice(-1)||(D+="/");var w=T(D)||$(D);if(w)return p(y,w,A)}else{if(v&&e(n))return n;var R=function(e,t){for(var n=function(){return function(e,t,n){for(var i=s(t,n,e),o=0;o<i.length;o++)i[o]=r.join(i[o],e);return i}(e,t,A)},i=b?b(e,t,n,A):n(),o=0;o<i.length;o++){var a=i[o];if(m(r.dirname(a))){var c=T(a);if(c)return c;var u=$(a);if(u)return u}}}(n,S);if(R)return p(y,R,A)}var B=new Error("Cannot find module '"+n+"' from '"+_+"'");throw B.code="MODULE_NOT_FOUND",B;function T(e){var t=x(r.dirname(e));if(t&&t.dir&&t.pkg&&A.pathFilter){var n=r.relative(t.dir,e),i=A.pathFilter(t.pkg,e,n);i&&(e=r.resolve(t.dir,i))}if(f(e))return e;for(var s=0;s<C.length;s++){var o=e+C[s];if(f(o))return o}}function x(e){if(""!==e&&"/"!==e&&!("win32"===process.platform&&/^\w:[/\\]*$/.test(e)||/[/\\]node_modules[/\\]*$/.test(e))){var t=r.join(p(y,e,A),"package.json");if(!f(t))return x(r.dirname(e));var n=E(g,t);return n&&A.packageFilter&&(n=A.packageFilter(n,e)),{pkg:n,dir:e}}}
|
|
@@ -315,9 +315,9 @@ t):(r.forEach(r=>{if("otlp"===r){const r=process.env.OTEL_EXPORTER_OTLP_METRICS_
|
|
|
315
315
|
})):"prometheus"===r?t.push(new d.PrometheusExporter):e.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${r}". Supported values are: otlp, console, prometheus, none.`)}),t)):t}();if(this._meterProviderConfig||o.length>0){const t=[];this._meterProviderConfig?.readers&&t.push(...this._meterProviderConfig.readers),0===t.length&&o.forEach(e=>t.push(e));const r=new p.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:t});this._meterProvider=r,e.metrics.setGlobalMeterProvider(r);for(const t of this._instrumentations)t.setMeterProvider(e.metrics.getMeterProvider())}}shutdown(){const e=[];return this._tracerProvider&&e.push(this._tracerProvider.shutdown()),this._loggerProvider&&e.push(this._loggerProvider.shutdown()),this._meterProvider&&e.push(this._meterProvider.shutdown()),Promise.all(e).then(()=>{})}configureLoggerProviderFromEnv(){const t=(0,g.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[]
|
|
316
316
|
;if(0===t.length&&(e.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),t.push("otlp")),t.includes("none"))return void e.diag.info('OTEL_LOGS_EXPORTER contains "none". Logger provider will not be initialized.');const r=[];t.forEach(t=>{if("otlp"===t){const t=((0,g.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,g.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(t){case"grpc":r.push(new o.OTLPLogExporter);break;case"http/json":r.push(new s.OTLPLogExporter);break;case"http/protobuf":case void 0:case"":r.push(new a.OTLPLogExporter);break;default:e.diag.warn(`Unsupported OTLP logs protocol: "${t}". Using http/protobuf.`),r.push(new a.OTLPLogExporter)}}else"console"===t?r.push(new i.ConsoleLogRecordExporter):e.diag.warn(`Unsupported OTEL_LOGS_EXPORTER value: "${t}". Supported values are: otlp, console, none.`)}),r.length>0&&(this._loggerProviderConfig={
|
|
317
317
|
logRecordProcessors:r.map(e=>e instanceof i.ConsoleLogRecordExporter?new i.SimpleLogRecordProcessor(e):new i.BatchLogRecordProcessor(e))})}},sdk$1}function requireSrc$2(){return hasRequiredSrc$2||(hasRequiredSrc$2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NodeSDK=e.tracing=e.resources=e.node=e.metrics=e.logs=e.core=e.contextBase=e.api=void 0,e.api=require$$0$6,e.contextBase=require$$0$6,e.core=require$$1$5,e.logs=require$$2$1,e.metrics=require$$1$b,e.node=requireSrc$6(),e.resources=require$$5$2,e.tracing=require$$6;var t=requireSdk();Object.defineProperty(e,"NodeSDK",{enumerable:!0,get:function(){return t.NodeSDK}})}(src$7)),src$7}var srcExports$3=requireSrc$2(),srcExports$2=requireSrc$6();function register$1(){if(process.env.TELEMETRY_USER){const e="https://7530.tessl.io:443";process.env.OTEL_EXPORTER_OTLP_ENDPOINT=e,process.env.OTEL_EXPORTER_OTLP_PROTOCOL="http/json",
|
|
318
|
-
process.env.OTEL_EXPORTER_OTLP_HEADERS=`Authorization=Basic ${Buffer.from(`${process.env.TELEMETRY_USER}:${process.env.TELEMETRY_PASSWORD}`).toString("base64")}`}const e=[];e.push(new srcExports$4.UndiciInstrumentation);const t=new srcExports$3.NodeSDK({resource:resourceFromAttributes({[ATTR_SERVICE_NAME]:"stepper",[ATTR_K8S_POD_NAME]:process.env.INJECTED_POD_NAME,[ATTR_K8S_NAMESPACE_NAME]:process.env.INJECTED_POD_NAMESPACE,[ATTR_K8S_POD_UID]:process.env.INJECTED_POD_UID,[ATTR_VCS_CHANGE_ID]:"
|
|
318
|
+
process.env.OTEL_EXPORTER_OTLP_HEADERS=`Authorization=Basic ${Buffer.from(`${process.env.TELEMETRY_USER}:${process.env.TELEMETRY_PASSWORD}`).toString("base64")}`}const e=[];e.push(new srcExports$4.UndiciInstrumentation);const t=new srcExports$3.NodeSDK({resource:resourceFromAttributes({[ATTR_SERVICE_NAME]:"stepper",[ATTR_K8S_POD_NAME]:process.env.INJECTED_POD_NAME,[ATTR_K8S_NAMESPACE_NAME]:process.env.INJECTED_POD_NAMESPACE,[ATTR_K8S_POD_UID]:process.env.INJECTED_POD_UID,[ATTR_VCS_CHANGE_ID]:"515d0a25e7557543b259c4962f29ebdd5fb410ba",[ATTR_VCS_REF_BASE_NAME]:"515d0a25e7557543b259c4962f29ebdd5fb410ba"}),instrumentations:e,spanProcessors:[new srcExports$2.SimpleSpanProcessor(process.env.TELEMETRY_USER?new OTLPTraceExporter$1:new srcExports$5.OTLPTraceExporter)]});return t.start(),{shutdown:async()=>{await t.shutdown()}}}"yes"===process.env.TESSL_DEBUG_MONITORING&&diag.setLogger(new DiagConsoleLogger,DiagLogLevel.INFO);const sdk=register$1();function isAbortError$3(e){
|
|
319
319
|
return"object"==typeof e&&null!==e&&"AbortError"===e.name}function someErrorIs(e,t,r=32){return!(r<=0)&&(!!t(e)||(!!(e instanceof AggregateError&&e.errors.some(e=>someErrorIs(e,t,r-1)))||!!(e instanceof Error&&"cause"in e&&someErrorIs(e.cause,t,r-1))))}const tracer$1=trace$1.getTracer("stepper/otel");let currentUser,bag;function setOtelUser(e){currentUser=e;const t=trace$1.getActiveSpan();currentUser&&t&&(t.setAttribute(ATTR_USER_ID,currentUser.id),t.setAttribute(ATTR_USER_EMAIL,currentUser.email))}async function withSpan(e,t){return tracer$1.startActiveSpan(e,async e=>{currentUser&&(e.setAttribute(ATTR_USER_ID,currentUser.id),e.setAttribute(ATTR_USER_EMAIL,currentUser.email));try{return await t(e)}catch(t){throw annotateSpanWithError(e,t),t}finally{e.end()}})}function annotateSpanWithError(e,t){let r;someErrorIs(t,e=>isAbortError$3(e))&&e.setAttribute("cancelled",!0),t instanceof Error&&(r=t.message),e.setStatus({code:SpanStatusCode.ERROR,message:r})}function execSyncFailsafe(e){try{
|
|
320
|
-
return execSync(e,{stdio:["ignore","pipe","ignore"],encoding:"utf-8",cwd:import.meta.dirname}).trim()}catch(e){return"unknown"}}function isGitDirty(){return"clean"}function initSysinfo(e={}){bag||(bag={}),bag.gitRevision="
|
|
320
|
+
return execSync(e,{stdio:["ignore","pipe","ignore"],encoding:"utf-8",cwd:import.meta.dirname}).trim()}catch(e){return"unknown"}}function isGitDirty(){return"clean"}function initSysinfo(e={}){bag||(bag={}),bag.gitRevision="515d0a25e7557543b259c4962f29ebdd5fb410ba",bag.gitDirty=isGitDirty(),bag.releaseDate="2025-10-07T14:52:51.036Z",bag.version="v0.26.0",bag.osImplementation=os$2.type(),bag.osRelease=os$2.release(),bag.argv=JSON.stringify(process.argv),bag.nodeVersion=process.version,bag.nodeExecPath=process.execPath,bag.nodeFirstPath=execSyncFailsafe("which node"),Object.assign(bag,e)}function getSysinfo(){if(!bag)throw new Error("Sysinfo not initialized");return{...bag}}const GLOBAL_DIR_NAME=".tessl",PROJECTS_DIR_NAME="projects";function getGlobalDir(){const e=process.env.TESSL_GLOBAL_DIR;if(e&&""!==e.trim())return e;let t=GLOBAL_DIR_NAME;return join(homedir$1(),t)}function getProjectCacheDir(){const e=process.env.TESSL_PROJECT_CACHE_DIR;if(e&&""!==e.trim())return e
|
|
321
321
|
;const t=getGlobalDir(),r=getProjectDir().replace(/[/\\:]/g,"-").replace(/^-+/,"");return join(t,PROJECTS_DIR_NAME,r)}function getProjectDir(e=!1){const t=process.env.TESSL_PROJECT_DIR;if(t&&""!==t.trim())return t;let r=process.cwd();for(;;){const t=join(r,CONFIG_DIR_NAME);if(existsSync(t))return r;const n=dirname$1(r);if(n===r||n===homedir$1()){if(e)throw new Error("Tessl project root not found");return process.cwd()}r=n}}const T_AND_C_FILE="terms-and-conditions",T_AND_C_URL="https://tessl.io/policies/terms",T_AND_C_QUESTION=`You'll need to review and accept our Terms of Service at ${T_AND_C_URL} before running Tessl.\n\nAccept Terms of Service? [Y/n] `;async function checkLegal(){const e=getGlobalDir(),t=join$1(e,T_AND_C_FILE);if(!existsSync$1(t)||"accepted"!==readFileSync(t,"utf-8")){const e=createInterface({input:process.stdin,output:process.stdout}),r=await new Promise(t=>{e.question(T_AND_C_QUESTION,r=>{e.close(),t(r.toLowerCase())})});if("n"!==r){const e=dirname(t)
|
|
322
322
|
;return existsSync$1(e)||mkdirSync(e,{recursive:!0}),writeFileSync(t,"accepted","utf-8"),!0}return!1}return!0}const balanced=(e,t,r)=>{const n=e instanceof RegExp?maybeMatch(e,r):e,i=t instanceof RegExp?maybeMatch(t,r):t,s=null!==n&&null!=i&&range$3(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},maybeMatch=(e,t)=>{const r=t.match(e);return r?r[0]:null},range$3=(e,t,r)=>{let n,i,s,o,a,c=r.indexOf(e),u=r.indexOf(t,c+1),l=c;if(c>=0&&u>0){if(e===t)return[c,u];for(n=[],s=r.length;l>=0&&!a;){if(l===c)n.push(l),c=r.indexOf(e,l+1);else if(1===n.length){const e=n.pop();void 0!==e&&(a=[e,u])}else i=n.pop(),void 0!==i&&i<s&&(s=i,o=u),u=r.indexOf(t,l+1);l=c<u&&c>=0?c:u}n.length&&void 0!==o&&(a=[s,o])}return a
|
|
323
323
|
},escSlash="\0SLASH"+Math.random()+"\0",escOpen="\0OPEN"+Math.random()+"\0",escClose="\0CLOSE"+Math.random()+"\0",escComma="\0COMMA"+Math.random()+"\0",escPeriod="\0PERIOD"+Math.random()+"\0",escSlashPattern=new RegExp(escSlash,"g"),escOpenPattern=new RegExp(escOpen,"g"),escClosePattern=new RegExp(escClose,"g"),escCommaPattern=new RegExp(escComma,"g"),escPeriodPattern=new RegExp(escPeriod,"g"),slashPattern=/\\\\/g,openPattern=/\\{/g,closePattern=/\\}/g,commaPattern=/\\,/g,periodPattern=/\\./g;function numeric(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function escapeBraces(e){return e.replace(slashPattern,escSlash).replace(openPattern,escOpen).replace(closePattern,escClose).replace(commaPattern,escComma).replace(periodPattern,escPeriod)}function unescapeBraces(e){return e.replace(escSlashPattern,"\\").replace(escOpenPattern,"{").replace(escClosePattern,"}").replace(escCommaPattern,",").replace(escPeriodPattern,".")}function parseCommaParts(e){if(!e)return[""]
|
|
@@ -648,7 +648,7 @@ constants$c.exports}var constantsExports=requireConstants$c();function ansiRegex
|
|
|
648
648
|
return 161===e||164===e||167===e||168===e||170===e||173===e||174===e||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||198===e||208===e||215===e||216===e||e>=222&&e<=225||230===e||e>=232&&e<=234||236===e||237===e||240===e||242===e||243===e||e>=247&&e<=250||252===e||254===e||257===e||273===e||275===e||283===e||294===e||295===e||299===e||e>=305&&e<=307||312===e||e>=319&&e<=322||324===e||e>=328&&e<=331||333===e||338===e||339===e||358===e||359===e||363===e||462===e||464===e||466===e||468===e||470===e||472===e||474===e||476===e||593===e||609===e||708===e||711===e||e>=713&&e<=715||717===e||720===e||e>=728&&e<=731||733===e||735===e||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||1025===e||e>=1040&&e<=1103||1105===e||8208===e||e>=8211&&e<=8214||8216===e||8217===e||8220===e||8221===e||e>=8224&&e<=8226||e>=8228&&e<=8231||8240===e||8242===e||8243===e||8245===e||8251===e||8254===e||8308===e||8319===e||e>=8321&&e<=8324||8364===e||8451===e||8453===e||8457===e||8467===e||8470===e||8481===e||8482===e||8486===e||8491===e||8531===e||8532===e||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||8585===e||e>=8592&&e<=8601||8632===e||8633===e||8658===e||8660===e||8679===e||8704===e||8706===e||8707===e||8711===e||8712===e||8715===e||8719===e||8721===e||8725===e||8730===e||e>=8733&&e<=8736||8739===e||8741===e||e>=8743&&e<=8748||8750===e||e>=8756&&e<=8759||8764===e||8765===e||8776===e||8780===e||8786===e||8800===e||8801===e||e>=8804&&e<=8807||8810===e||8811===e||8814===e||8815===e||8834===e||8835===e||8838===e||8839===e||8853===e||8857===e||8869===e||8895===e||8978===e||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||9632===e||9633===e||e>=9635&&e<=9641||9650===e||9651===e||9654===e||9655===e||9660===e||9661===e||9664===e||9665===e||e>=9670&&e<=9672||9675===e||e>=9678&&e<=9681||e>=9698&&e<=9701||9711===e||9733===e||9734===e||9737===e||9742===e||9743===e||9756===e||9758===e||9792===e||9794===e||9824===e||9825===e||e>=9827&&e<=9829||e>=9831&&e<=9834||9836===e||9837===e||9839===e||9886===e||9887===e||9919===e||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||9955===e||9960===e||9961===e||e>=9963&&e<=9969||9972===e||e>=9974&&e<=9977||9979===e||9980===e||9982===e||9983===e||10045===e||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||65533===e||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||127375===e||127376===e||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109
|
|
649
649
|
}function isFullWidth(e){return 12288===e||e>=65281&&e<=65376||e>=65504&&e<=65510}function isWide(e){
|
|
650
650
|
return e>=4352&&e<=4447||8986===e||8987===e||9001===e||9002===e||e>=9193&&e<=9196||9200===e||9203===e||9725===e||9726===e||9748===e||9749===e||e>=9776&&e<=9783||e>=9800&&e<=9811||9855===e||e>=9866&&e<=9871||9875===e||9889===e||9898===e||9899===e||9917===e||9918===e||9924===e||9925===e||9934===e||9940===e||9962===e||9970===e||9971===e||9973===e||9978===e||9981===e||9989===e||9994===e||9995===e||10024===e||10060===e||10062===e||e>=10067&&e<=10069||10071===e||e>=10133&&e<=10135||10160===e||10175===e||11035===e||11036===e||11088===e||11093===e||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||94192===e||94193===e||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101631&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||110589===e||110590===e||e>=110592&&e<=110882||110898===e||e>=110928&&e<=110930||110933===e||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||126980===e||127183===e||127374===e||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||127568===e||127569===e||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||127988===e||e>=127992&&e<=128062||128064===e||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||128378===e||128405===e||128406===e||128420===e||e>=128507&&e<=128591||e>=128640&&e<=128709||128716===e||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||128747===e||128748===e||e>=128756&&e<=128764||e>=128992&&e<=129003||129008===e||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129673||e>=129679&&e<=129734||e>=129742&&e<=129756||e>=129759&&e<=129769||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141
|
|
651
|
-
}function validate$
|
|
651
|
+
}function validate$4(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function eastAsianWidth(e,{ambiguousAsWide:t=!1}={}){return validate$4(e),isFullWidth(e)||isWide(e)||t&&isAmbiguous(e)?2:1}
|
|
652
652
|
var emojiRegex$6=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g
|
|
653
653
|
;const segmenter=new Intl.Segmenter,defaultIgnorableCodePointRegex=/^\p{Default_Ignorable_Code_Point}$/u;function stringWidth$2(e,t={}){if("string"!=typeof e||0===e.length)return 0;const{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=stripAnsi$2(e)),0===e.length)return 0;let i=0;const s={ambiguousAsWide:!r};for(const{segment:t}of segmenter.segment(e)){const e=t.codePointAt(0);e<=31||e>=127&&e<=159||(e>=8203&&e<=8207||65279===e||e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=55296&&e<=57343||e>=65024&&e<=65039||defaultIgnorableCodePointRegex.test(t)||(emojiRegex$6().test(t)?i+=2:i+=eastAsianWidth(e,s)))}return i}function widestLine(e){let t=0;for(const r of e.split("\n"))t=Math.max(t,stringWidth$2(r));return t}const cache$7={},measureText=e=>{if(0===e.length)return{width:0,height:0};const t=cache$7[e];if(t)return t;const r=widestLine(e),n=e.split("\n").length;return cache$7[e]={width:r,height:n},{width:r,height:n}
|
|
654
654
|
},ANSI_BACKGROUND_OFFSET=10,wrapAnsi16=(e=0)=>t=>`[${t+e}m`,wrapAnsi256=(e=0)=>t=>`[${38+e};5;${t}m`,wrapAnsi16m=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,styles$1={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],gray:[90,39],grey:[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],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}}
|
|
@@ -757,10 +757,10 @@ clear:n.clear}},getOptions=(e={})=>e instanceof Stream$2?{stdout:e,stdin:process
|
|
|
757
757
|
"[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"},nonAlphanumericKeys=[...Object.values(keyName),"backspace"],isShiftKey=e=>["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(e),isCtrlKey=e=>["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(e),parseKeypress=(e="")=>{let t
|
|
758
758
|
;Buffer$1.isBuffer(e)?e[0]>127&&void 0===e[1]?(e[0]-=128,e=""+String(e)):e=String(e):void 0!==e&&"string"!=typeof e?e=String(e):e||(e="");const r={name:"",ctrl:!1,meta:!1,shift:!1,option:!1,sequence:e,raw:e};if(r.sequence=r.sequence||e||r.name,"\r"===e)r.raw=void 0,r.name="return";else if("\n"===e)r.name="enter";else if("\t"===e)r.name="tab";else if("\b"===e||"\b"===e)r.name="backspace",r.meta=""===e.charAt(0);else if(""===e||""===e)r.name="delete",r.meta=""===e.charAt(0);else if(""===e||""===e)r.name="escape",r.meta=2===e.length;else if(" "===e||" "===e)r.name="space",r.meta=2===e.length;else if(1===e.length&&e<="")r.name=String.fromCharCode(e.charCodeAt(0)+"a".charCodeAt(0)-1),r.ctrl=!0;else if(1===e.length&&e>="0"&&e<="9")r.name="number";else if(1===e.length&&e>="a"&&e<="z")r.name=e;else if(1===e.length&&e>="A"&&e<="Z")r.name=e.toLowerCase(),r.shift=!0;else if(t=metaKeyCodeRe.exec(e))r.meta=!0,r.shift=/^[A-Z]$/.test(t[1]);else if(t=fnKeyRe.exec(e)){const n=[...e]
|
|
759
759
|
;""===n[0]&&""===n[1]&&(r.option=!0);const i=[t[1],t[2],t[4],t[6]].filter(Boolean).join(""),s=(t[3]||t[5]||1)-1;r.ctrl=!!(4&s),r.meta=!!(10&s),r.shift=!!(1&s),r.code=i,r.name=keyName[i],r.shift=isShiftKey(i)||r.shift,r.ctrl=isCtrlKey(i)||r.ctrl}return r},useStdin=()=>reactExports.useContext(StdinContext),useInput=(e,t={})=>{const{stdin:r,setRawMode:n,internal_exitOnCtrlC:i,internal_eventEmitter:s}=useStdin();reactExports.useEffect(()=>{if(!1!==t.isActive)return n(!0),()=>{n(!1)}},[t.isActive,n]),reactExports.useEffect(()=>{if(!1===t.isActive)return;const r=t=>{const r=parseKeypress(t),n={upArrow:"up"===r.name,downArrow:"down"===r.name,leftArrow:"left"===r.name,rightArrow:"right"===r.name,pageDown:"pagedown"===r.name,pageUp:"pageup"===r.name,return:"return"===r.name,escape:"escape"===r.name,ctrl:r.ctrl,shift:r.shift,tab:"tab"===r.name,backspace:"backspace"===r.name,delete:"delete"===r.name,meta:r.meta||"escape"===r.name||r.option};let s=r.ctrl?r.name:r.sequence
|
|
760
|
-
;nonAlphanumericKeys.includes(r.name)&&(s=""),s.startsWith("")&&(s=s.slice(1)),1===s.length&&"string"==typeof s[0]&&/[A-Z]/.test(s[0])&&(n.shift=!0),"c"===s&&n.ctrl&&i||reconciler.batchedUpdates(()=>{e(s,n)})};return s?.on("input",r),()=>{s?.removeListener("input",r)}},[t.isActive,r,i,e])},useApp=()=>reactExports.useContext(AppContext);function createScanner(e,t=!1){const r=e.length;let n=0,i="",s=0,o=16,a=0,c=0,u=0,l=0,d=0;function p(t,r){let i=0,s=0;for(;i<t;){let t=e.charCodeAt(n);if(t>=48&&t<=57)s=16*s+t-48;else if(t>=65&&t<=70)s=16*s+t-65+10;else{if(!(t>=97&&t<=102))break;s=16*s+t-97+10}n++,i++}return i<t&&(s=-1),s}function h(){if(i="",d=0,s=n,c=a,l=u,n>=r)return s=r,o=17;let t=e.charCodeAt(n);if(isWhiteSpace$
|
|
760
|
+
;nonAlphanumericKeys.includes(r.name)&&(s=""),s.startsWith("")&&(s=s.slice(1)),1===s.length&&"string"==typeof s[0]&&/[A-Z]/.test(s[0])&&(n.shift=!0),"c"===s&&n.ctrl&&i||reconciler.batchedUpdates(()=>{e(s,n)})};return s?.on("input",r),()=>{s?.removeListener("input",r)}},[t.isActive,r,i,e])},useApp=()=>reactExports.useContext(AppContext);function createScanner(e,t=!1){const r=e.length;let n=0,i="",s=0,o=16,a=0,c=0,u=0,l=0,d=0;function p(t,r){let i=0,s=0;for(;i<t;){let t=e.charCodeAt(n);if(t>=48&&t<=57)s=16*s+t-48;else if(t>=65&&t<=70)s=16*s+t-65+10;else{if(!(t>=97&&t<=102))break;s=16*s+t-97+10}n++,i++}return i<t&&(s=-1),s}function h(){if(i="",d=0,s=n,c=a,l=u,n>=r)return s=r,o=17;let t=e.charCodeAt(n);if(isWhiteSpace$2(t)){do{n++,i+=String.fromCharCode(t),t=e.charCodeAt(n)}while(isWhiteSpace$2(t));return o=15}if(isLineBreak(t))return n++,i+=String.fromCharCode(t),13===t&&10===e.charCodeAt(n)&&(n++,i+="\n"),a++,u=n,o=14;switch(t){case 123:return n++,o=1;case 125:return n++,o=2;case 91:
|
|
761
761
|
return n++,o=3;case 93:return n++,o=4;case 58:return n++,o=6;case 44:return n++,o=5;case 34:return n++,i=function(){let t="",i=n;for(;;){if(n>=r){t+=e.substring(i,n),d=2;break}const s=e.charCodeAt(n);if(34===s){t+=e.substring(i,n),n++;break}if(92!==s){if(s>=0&&s<=31){if(isLineBreak(s)){t+=e.substring(i,n),d=2;break}d=6}n++}else{if(t+=e.substring(i,n),n++,n>=r){d=2;break}switch(e.charCodeAt(n++)){case 34:t+='"';break;case 92:t+="\\";break;case 47:t+="/";break;case 98:t+="\b";break;case 102:t+="\f";break;case 110:t+="\n";break;case 114:t+="\r";break;case 116:t+="\t";break;case 117:const e=p(4);e>=0?t+=String.fromCharCode(e):d=4;break;default:d=5}i=n}}return t}(),o=10;case 47:const c=n-1;if(47===e.charCodeAt(n+1)){for(n+=2;n<r&&!isLineBreak(e.charCodeAt(n));)n++;return i=e.substring(c,n),o=12}if(42===e.charCodeAt(n+1)){n+=2;const t=r-1;let s=!1;for(;n<t;){const t=e.charCodeAt(n);if(42===t&&47===e.charCodeAt(n+1)){n+=2,s=!0;break}n++,isLineBreak(t)&&(13===t&&10===e.charCodeAt(n)&&n++,a++,
|
|
762
762
|
u=n)}return s||(n++,d=1),i=e.substring(c,n),o=13}return i+=String.fromCharCode(t),n++,o=16;case 45:if(i+=String.fromCharCode(t),n++,n===r||!isDigit(e.charCodeAt(n)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=function(){let t=n;if(48===e.charCodeAt(n))n++;else for(n++;n<e.length&&isDigit(e.charCodeAt(n));)n++;if(n<e.length&&46===e.charCodeAt(n)){if(n++,!(n<e.length&&isDigit(e.charCodeAt(n))))return d=3,e.substring(t,n);for(n++;n<e.length&&isDigit(e.charCodeAt(n));)n++}let r=n;if(n<e.length&&(69===e.charCodeAt(n)||101===e.charCodeAt(n)))if(n++,(n<e.length&&43===e.charCodeAt(n)||45===e.charCodeAt(n))&&n++,n<e.length&&isDigit(e.charCodeAt(n))){for(n++;n<e.length&&isDigit(e.charCodeAt(n));)n++;r=n}else d=3;return e.substring(t,r)}(),o=11;default:for(;n<r&&A(t);)n++,t=e.charCodeAt(n);if(s!==n){switch(i=e.substring(s,n),i){case"true":return o=8;case"false":return o=9;case"null":return o=7}return o=16}return i+=String.fromCharCode(t),
|
|
763
|
-
n++,o=16}}function A(e){if(isWhiteSpace$
|
|
763
|
+
n++,o=16}}function A(e){if(isWhiteSpace$2(e)||isLineBreak(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}return{setPosition:function(e){n=e,i="",s=0,o=16,d=0},getPosition:()=>n,scan:t?function(){let e;do{e=h()}while(e>=12&&e<=15);return e}:h,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>s,getTokenLength:()=>n-s,getTokenStartLine:()=>c,getTokenStartCharacter:()=>s-l,getTokenError:()=>d}}function isWhiteSpace$2(e){return 32===e||9===e}function isLineBreak(e){return 10===e||13===e}function isDigit(e){return e>=48&&e<=57}var CharacterCodes;!function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",
|
|
764
764
|
e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",
|
|
765
765
|
e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"}(CharacterCodes||(CharacterCodes={}));const cachedSpaces=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),maxCachedValues=200,cachedBreakLinesWithSpaces={" ":{"\n":new Array(maxCachedValues).fill(0).map((e,t)=>"\n"+" ".repeat(t)),"\r":new Array(maxCachedValues).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(maxCachedValues).fill(0).map((e,t)=>"\r\n"+" ".repeat(t))},"\t":{"\n":new Array(maxCachedValues).fill(0).map((e,t)=>"\n"+"\t".repeat(t)),"\r":new Array(maxCachedValues).fill(0).map((e,t)=>"\r"+"\t".repeat(t)),"\r\n":new Array(maxCachedValues).fill(0).map((e,t)=>"\r\n"+"\t".repeat(t))}},supportedEols=["\n","\r","\r\n"];function format$4(e,t,r){let n,i,s,o,a;if(t){for(o=t.offset,a=o+t.length,s=o;s>0&&!isEOL(e,s-1);)s--;let c=a;for(;c<e.length&&!isEOL(e,c);)c++;i=e.substring(s,c),n=computeIndentLevel(i,r)}else i=e,n=0,s=0,o=0,a=e.length;const c=getEOL(r,e),u=supportedEols.includes(c);let l,d=0,p=0
|
|
766
766
|
;l=r.insertSpaces?cachedSpaces[r.tabSize||4]??repeat$1(cachedSpaces[1],r.tabSize||4):"\t";const h="\t"===l?"\t":" ";let A=createScanner(i,!1),f=!1;function g(){if(d>1)return repeat$1(c,d)+repeat$1(l,n+p);const e=l.length*(n+p);return!u||e>cachedBreakLinesWithSpaces[h][c].length?c+repeat$1(l,n+p):e<=0?c:cachedBreakLinesWithSpaces[h][c][e]}function m(){let e=A.scan();for(d=0;15===e||14===e;)14===e&&r.keepLines?d+=1:14===e&&(d=1),e=A.scan();return f=16===e||0!==A.getTokenError(),e}const y=[];function E(r,n,i){f||t&&!(n<a&&i>o)||e.substring(n,i)===r||y.push({offset:n,length:i-n,content:r})}let b=m();if(r.keepLines&&d>0&&E(repeat$1(c,d),0,0),17!==b){let e=A.getTokenOffset()+s;E(l.length*n<20&&r.insertSpaces?cachedSpaces[l.length*n]:repeat$1(l,n),s,e)}for(;17!==b;){let e=A.getTokenOffset()+A.getTokenLength()+s,t=m(),n="",i=!1;for(;0===d&&(12===t||13===t);){let r=A.getTokenOffset()+s;E(cachedSpaces[1],e,r),e=A.getTokenOffset()+A.getTokenLength()+s,i=12===t,n=i?g():"",t=m()}
|
|
@@ -836,31 +836,31 @@ value:function(e){return this.transformers.reduce(function(e,t){return t.onStrin
|
|
|
836
836
|
if("initial"===e){var r=t.match(/^[^\S\n]*(?=\S)/gm),n=r&&Math.min.apply(Math,_toConsumableArray(r.map(function(e){return e.length})));if(n){var i=new RegExp("^.{"+n+"}","gm");return t.replace(i,"")}return t}if("all"===e)return t.replace(/^[^\S\n]+/gm,"");throw new Error("Unknown type: "+e)}}},replaceResultTransformer=function(e,t){return{onEndResult:function(r){if(null==e||null==t)throw new Error("replaceResultTransformer requires at least 2 arguments.");return r.replace(e,t)}}},replaceSubstitutionTransformer=function(e,t){return{onSubstitution:function(r,n){if(null==e||null==t)throw new Error("replaceSubstitutionTransformer requires at least 2 arguments.");return null==r?r:r.toString().replace(e,t)}}},defaults$1={separator:"",conjunction:"",serial:!1},inlineArrayTransformer=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:defaults$1;return{onSubstitution:function(t,r){if(Array.isArray(t)){
|
|
837
837
|
var n=t.length,i=e.separator,s=e.conjunction,o=e.serial,a=r.match(/(\n?[^\S\n]+)$/);if(t=a?t.join(i+a[1]):t.join(i+" "),s&&n>1){var c=t.lastIndexOf(i);t=t.slice(0,c)+(o?i:"")+" "+s+t.slice(c+1)}}return t}}},splitStringTransformer=function(e){return{onSubstitution:function(t,r){return"string"==typeof t&&t.includes(e)&&(t=t.split(e)),t}}},isValidValue=function(e){return null!=e&&!Number.isNaN(e)&&"boolean"!=typeof e},removeNonPrintingValuesTransformer=function(){return{onSubstitution:function(e){return Array.isArray(e)?e.filter(isValidValue):isValidValue(e)?e:""}}};new TemplateTag(inlineArrayTransformer({separator:","}),stripIndentTransformer,trimResultTransformer),new TemplateTag(inlineArrayTransformer({separator:",",conjunction:"and"}),stripIndentTransformer,trimResultTransformer),new TemplateTag(inlineArrayTransformer({separator:",",conjunction:"or"}),stripIndentTransformer,trimResultTransformer),
|
|
838
838
|
new TemplateTag(splitStringTransformer("\n"),removeNonPrintingValuesTransformer,inlineArrayTransformer,stripIndentTransformer,trimResultTransformer),new TemplateTag(splitStringTransformer("\n"),inlineArrayTransformer,stripIndentTransformer,trimResultTransformer,replaceSubstitutionTransformer(/&/g,"&"),replaceSubstitutionTransformer(/</g,"<"),replaceSubstitutionTransformer(/>/g,">"),replaceSubstitutionTransformer(/"/g,"""),replaceSubstitutionTransformer(/'/g,"'"),replaceSubstitutionTransformer(/`/g,"`")),new TemplateTag(replaceResultTransformer(/(?:\n(?:\s*))+/g," "),trimResultTransformer),new TemplateTag(replaceResultTransformer(/(?:\n\s*)/g,""),trimResultTransformer),new TemplateTag(inlineArrayTransformer({separator:","}),replaceResultTransformer(/(?:\s+)/g," "),trimResultTransformer),new TemplateTag(inlineArrayTransformer({separator:",",conjunction:"or"}),replaceResultTransformer(/(?:\s+)/g," "),trimResultTransformer),new TemplateTag(inlineArrayTransformer({
|
|
839
|
-
separator:",",conjunction:"and"}),replaceResultTransformer(/(?:\s+)/g," "),trimResultTransformer),new TemplateTag(inlineArrayTransformer,stripIndentTransformer,trimResultTransformer),new TemplateTag(inlineArrayTransformer,replaceResultTransformer(/(?:\s+)/g," "),trimResultTransformer);var stripIndent=new TemplateTag(stripIndentTransformer,trimResultTransformer),stripIndents=new TemplateTag(stripIndentTransformer("all"),trimResultTransformer),error$2,hasRequiredError$1,decode$4,hasRequiredDecode$1,constants$a,hasRequiredConstants$a,objects,hasRequiredObjects,strings,hasRequiredStrings,encode$4,hasRequiredEncode$1,helpers$2,hasRequiredHelpers$1,normalize$1,hasRequiredNormalize,lang,hasRequiredLang,validate$
|
|
839
|
+
separator:",",conjunction:"and"}),replaceResultTransformer(/(?:\s+)/g," "),trimResultTransformer),new TemplateTag(inlineArrayTransformer,stripIndentTransformer,trimResultTransformer),new TemplateTag(inlineArrayTransformer,replaceResultTransformer(/(?:\s+)/g," "),trimResultTransformer);var stripIndent=new TemplateTag(stripIndentTransformer,trimResultTransformer),stripIndents=new TemplateTag(stripIndentTransformer("all"),trimResultTransformer),error$2,hasRequiredError$1,decode$4,hasRequiredDecode$1,constants$a,hasRequiredConstants$a,objects,hasRequiredObjects,strings,hasRequiredStrings,encode$4,hasRequiredEncode$1,helpers$2,hasRequiredHelpers$1,normalize$1,hasRequiredNormalize,lang,hasRequiredLang,validate$3,hasRequiredValidate$1,purlComponent,hasRequiredPurlComponent,purlQualifierNames,hasRequiredPurlQualifierNames,purlType,hasRequiredPurlType,packageUrl,hasRequiredPackageUrl,packageurlJs,hasRequiredPackageurlJs;function requireError$1(){if(hasRequiredError$1)return error$2
|
|
840
840
|
;function e(e=""){const{length:t}=e;let r="";if(t){const n=e.charCodeAt(0);r=n>=65||n<=90?`${e[0].toLowerCase()}${e.slice(1)}`:e,t>1&&46===e.charCodeAt(t-1)&&46!==e.charCodeAt(t-2)&&(r=r.slice(0,-1))}return`Invalid purl: ${r}`}hasRequiredError$1=1;class t extends Error{constructor(t){super(e(t))}}return error$2={formatPurlErrorMessage:e,PurlError:t}}function requireDecode$1(){if(hasRequiredDecode$1)return decode$4;hasRequiredDecode$1=1;const{PurlError:e}=requireError$1(),{decodeURIComponent:t}=globalThis;return decode$4={decodePurlComponent:function(r,n){try{return t(n)}catch{}throw new e(`unable to decode "${r}" component`)}}}function requireConstants$a(){if(hasRequiredConstants$a)return constants$a;hasRequiredConstants$a=1;const e=new URLSearchParams;return constants$a={LOOP_SENTINEL:1e6,REUSED_SEARCH_PARAMS:e,REUSED_SEARCH_PARAMS_KEY:"_",REUSED_SEARCH_PARAMS_OFFSET:2}}function requireObjects(){if(hasRequiredObjects)return objects;hasRequiredObjects=1
|
|
841
841
|
;const{LOOP_SENTINEL:e}=requireConstants$a();return objects={isObject:function(e){return null!==e&&"object"==typeof e},recursiveFreeze:function(t){if(null===t||"object"!=typeof t&&"function"!=typeof t||Object.isFrozen(t))return t;const r=[t];let{length:n}=r,i=0;for(;i<n;){if(i===e)throw new Error("Detected infinite loop in object crawl of recursiveFreeze");const t=r[i++];if(Object.freeze(t),Array.isArray(t))for(let e=0,{length:i}=t;e<i;e+=1){const i=t[e];null===i||"object"!=typeof i&&"function"!=typeof i||Object.isFrozen(i)||(r[n++]=i)}else{const e=Reflect.ownKeys(t);for(let i=0,{length:s}=e;i<s;i+=1){const s=t[e[i]];null===s||"object"!=typeof s&&"function"!=typeof s||Object.isFrozen(s)||(r[n++]=s)}}}return t}},objects}function requireStrings(){if(hasRequiredStrings)return strings;hasRequiredStrings=1
|
|
842
842
|
;const{compare:e}=new Intl.Collator,t=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;return strings={isBlank:function(e){for(let t=0,{length:r}=e;t<r;t+=1){const r=e.charCodeAt(t);if(32!==r&&9!==r&&10!==r&&11!==r&&12!==r&&13!==r&&160!==r&&5760!==r&&8192!==r&&8193!==r&&8194!==r&&8195!==r&&8196!==r&&8197!==r&&8198!==r&&8199!==r&&8200!==r&&8201!==r&&8202!==r&&8232!==r&&8233!==r&&8239!==r&&8287!==r&&12288!==r&&65279!==r)return!1}return!0},isNonEmptyString:function(e){return"string"==typeof e&&e.length>0},isSemverString:function(e){return"string"==typeof e&&t.test(e)},localeCompare:e,lowerName:function(e){e.name=e.name.toLowerCase()},lowerNamespace:function(e){const{namespace:t}=e;"string"==typeof t&&(e.namespace=t.toLowerCase())},lowerVersion:function(e){const{version:t}=e;"string"==typeof t&&(e.version=t.toLowerCase())},
|
|
843
843
|
replaceDashesWithUnderscores:function(e){let t="",r=0,n=0;for(;-1!==(n=e.indexOf("-",r));)t=t+e.slice(r,n)+"_",r=n+1;return r?t+e.slice(r):e},replaceUnderscoresWithDashes:function(e){let t="",r=0,n=0;for(;-1!==(n=e.indexOf("_",r));)t=t+e.slice(r,n)+"-",r=n+1;return r?t+e.slice(r):e},trimLeadingSlashes:function(e){let t=0;for(;47===e.charCodeAt(t);)t+=1;return 0===t?e:e.slice(t)}},strings}function requireEncode$1(){if(hasRequiredEncode$1)return encode$4;hasRequiredEncode$1=1;const{REUSED_SEARCH_PARAMS:e,REUSED_SEARCH_PARAMS_KEY:t,REUSED_SEARCH_PARAMS_OFFSET:r}=requireConstants$a(),{isObject:n}=requireObjects(),{isNonEmptyString:i}=requireStrings(),{encodeURIComponent:s}=globalThis;function o(e){return e.replace(/\+/g,"%20")}return encode$4={encodeNamespace:function(e){return i(e)?s(e).replace(/%3A/g,":").replace(/%2F/g,"/"):""},encodeVersion:function(e){return i(e)?s(e).replace(/%3A/g,":").replace(/%2B/g,"+"):""},encodeQualifiers:function(e){if(n(e)){
|
|
844
844
|
const t=Object.keys(e).sort(),r=new URLSearchParams;for(let n=0,{length:i}=t;n<i;n+=1){const i=t[n];r.set(i,e[i])}return o(r.toString())}return""},encodeQualifierParam:function(n){return i(n)?(e.set(t,n),o(e.toString().slice(r))):""},encodeSubpath:function(e){return i(e)?s(e).replace(/%2F/g,"/"):""},encodeURIComponent:s},encode$4}function requireHelpers$1(){if(hasRequiredHelpers$1)return helpers$2;return hasRequiredHelpers$1=1,helpers$2={createHelpersNamespaceObject:function(e,t={}){const{comparator:r,...n}={__proto__:null,...t},i=Object.keys(e).sort(),s=[...new Set([...Object.values(e)].map(Object.keys).flat())].sort(r),o=Object.create(null);for(let t=0,{length:r}=s;t<r;t+=1){const r=s[t],a=Object.create(null);for(let t=0,{length:s}=i;t<s;t+=1){const s=i[t],o=e[s][r]??n[s];void 0!==o&&(a[s]=o)}o[r]=a}return o}},helpers$2}function requireNormalize(){if(hasRequiredNormalize)return normalize$1;hasRequiredNormalize=1;const{isObject:e}=requireObjects(),{isBlank:t}=requireStrings()
|
|
845
845
|
;function r(e,t){let r="",n=0;for(;47===e.charCodeAt(n);)n+=1;let i=e.indexOf("/",n);if(-1===i)return e.slice(n);for(;-1!==i;){const s=e.slice(n,i);for((void 0===t||t(s))&&(r=r+(0===r.length?"":"/")+s),n=i+1;47===e.charCodeAt(n);)n+=1;i=e.indexOf("/",n)}const s=e.slice(n);return 0===s.length||void 0!==t&&!t(s)||(r=r+"/"+s),r}function n(e){const{length:r}=e;return(1!==r||46!==e.charCodeAt(0))&&((2!==r||46!==e.charCodeAt(0)||46!==e.charCodeAt(1))&&!t(e))}return normalize$1={normalizeName:function(e){return"string"==typeof e?e.trim():void 0},normalizeNamespace:function(e){return"string"==typeof e?r(e):void 0},normalizePath:r,normalizeQualifiers:function(t){let r;for(const{0:n,1:i}of function(t){if(e(t))return t instanceof URLSearchParams?t.entries():Object.entries(t);return"string"==typeof t?new URLSearchParams(t).entries():Object.entries({})}(t)){const e=("string"==typeof i?i:String(i)).trim();0!==e.length&&(void 0===r&&(r={__proto__:null}),r[n.toLowerCase()]=e)}return r},
|
|
846
|
-
normalizeSubpath:function(e){return"string"==typeof e?r(e,n):void 0},normalizeType:function(e){return"string"==typeof e?e.trim().toLowerCase():void 0},normalizeVersion:function(e){return"string"==typeof e?e.trim():void 0}}}function requireLang(){if(hasRequiredLang)return lang;return hasRequiredLang=1,lang={isNullishOrEmptyString:function(e){return null==e||"string"==typeof e&&0===e.length}}}function requireValidate$1(){if(hasRequiredValidate$1)return validate$
|
|
847
|
-
const r=n.charCodeAt(0);if(r>=48&&r<=57){if(i)throw new e(`${t} "${n}" cannot start with a number`);return!1}}return!0}function o(t,r,n){if(null==r||"string"==typeof r)return!0;if(n)throw new e(`"'${t}" must be a string`);return!1}return validate$
|
|
848
|
-
return o("subpath",e,t)},validateType:function(t,r){if(!i("type",t,r)||!o("type",t,r)||!s("type",t,r))return!1;for(let n=0,{length:i}=t;n<i;n+=1){const i=t.charCodeAt(n);if(!(i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||46===i||43===i||45===i)){if(r)throw new e(`type "${t}" contains an illegal character`);return!1}}return!0},validateVersion:function(e,t){return o("version",e,t)}},validate$
|
|
846
|
+
normalizeSubpath:function(e){return"string"==typeof e?r(e,n):void 0},normalizeType:function(e){return"string"==typeof e?e.trim().toLowerCase():void 0},normalizeVersion:function(e){return"string"==typeof e?e.trim():void 0}}}function requireLang(){if(hasRequiredLang)return lang;return hasRequiredLang=1,lang={isNullishOrEmptyString:function(e){return null==e||"string"==typeof e&&0===e.length}}}function requireValidate$1(){if(hasRequiredValidate$1)return validate$3;hasRequiredValidate$1=1;const{PurlError:e}=requireError$1(),{isNullishOrEmptyString:t}=requireLang(),{isNonEmptyString:r}=requireStrings();function n(t,r){if(!s("qualifier",t,r))return!1;for(let n=0,{length:i}=t;n<i;n+=1){const i=t.charCodeAt(n);if(!(i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||46===i||45===i||95===i)){if(r)throw new e(`qualifier "${t}" contains an illegal character`);return!1}}return!0}function i(r,n,i){if(t(n)){if(i)throw new e(`"${r}" is a required component`);return!1}return!0}function s(t,n,i){if(r(n)){
|
|
847
|
+
const r=n.charCodeAt(0);if(r>=48&&r<=57){if(i)throw new e(`${t} "${n}" cannot start with a number`);return!1}}return!0}function o(t,r,n){if(null==r||"string"==typeof r)return!0;if(n)throw new e(`"'${t}" must be a string`);return!1}return validate$3={validateEmptyByType:function(r,n,i,s){if(!t(i)){if(s)throw new e(`${r} "${n}" component must be empty`);return!1}return!0},validateName:function(e,t){return i("name",e,t)&&o("name",e,t)},validateNamespace:function(e,t){return o("namespace",e,t)},validateQualifiers:function(t,r){if(null==t)return!0;if("object"!=typeof t){if(r)throw new e('"qualifiers" must be an object');return!1}const i="function"==typeof t.keys?t.keys():Object.keys(t);for(const e of i)if(!n(e,r))return!1;return!0},validateQualifierKey:n,validateRequired:i,validateRequiredByType:function(r,n,i,s){if(t(i)){if(s)throw new e(`${r} requires a "${n}" component`);return!1}return!0},validateStartsWithoutNumber:s,validateStrings:o,validateSubpath:function(e,t){
|
|
848
|
+
return o("subpath",e,t)},validateType:function(t,r){if(!i("type",t,r)||!o("type",t,r)||!s("type",t,r))return!1;for(let n=0,{length:i}=t;n<i;n+=1){const i=t.charCodeAt(n);if(!(i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||46===i||43===i||45===i)){if(r)throw new e(`type "${t}" contains an illegal character`);return!1}}return!0},validateVersion:function(e,t){return o("version",e,t)}},validate$3}function requirePurlComponent(){if(hasRequiredPurlComponent)return purlComponent;hasRequiredPurlComponent=1
|
|
849
849
|
;const{encodeNamespace:e,encodeVersion:t,encodeQualifiers:r,encodeQualifierParam:n,encodeSubpath:i,encodeURIComponent:s}=requireEncode$1(),{createHelpersNamespaceObject:o}=requireHelpers$1(),{normalizeType:a,normalizeNamespace:c,normalizeName:u,normalizeVersion:l,normalizeQualifiers:d,normalizeSubpath:p}=requireNormalize(),{localeCompare:h,isNonEmptyString:A}=requireStrings(),{validateType:f,validateNamespace:g,validateName:m,validateVersion:y,validateQualifiers:E,validateQualifierKey:b,validateSubpath:C}=requireValidate$1(),v={__proto__:null,type:0,namespace:1,name:2,version:3,qualifiers:4,qualifierKey:5,qualifierValue:6,subpath:7};function I(e){return v[e]??e}return purlComponent={PurlComponent:o({encode:{namespace:e,version:t,qualifiers:r,qualifierKey:n,qualifierValue:n,subpath:i},normalize:{type:a,namespace:c,name:u,version:l,qualifiers:d,subpath:p},validate:{type:f,namespace:g,name:m,version:y,qualifierKey:b,qualifiers:E,subpath:C}},{comparator:function(e,t){return h(I(e),I(t))},
|
|
850
850
|
encode:e=>A(e)?s(e):"",normalize:e=>"string"==typeof e?e:void 0,validate:(e,t)=>!0})}}function requirePurlQualifierNames(){return hasRequiredPurlQualifierNames?purlQualifierNames:(hasRequiredPurlQualifierNames=1,purlQualifierNames={PurlQualifierNames:{__proto__:null,RepositoryUrl:"repository_url",DownloadUrl:"download_url",VcsUrl:"vcs_url",FileName:"file_name",Checksum:"checksum"}})}function requirePurlType(){if(hasRequiredPurlType)return purlType;hasRequiredPurlType=1;const{isNullishOrEmptyString:e}=requireLang(),{createHelpersNamespaceObject:t}=requireHelpers$1(),{isSemverString:r,lowerName:n,lowerNamespace:i,lowerVersion:s,replaceDashesWithUnderscores:o,replaceUnderscoresWithDashes:a}=requireStrings(),{validateEmptyByType:c,validateRequiredByType:u}=requireValidate$1(),{PurlError:l}=requireError$1();return purlType={PurlType:t({normalize:{alpm:e=>(i(e),n(e),e),apk:e=>(i(e),n(e),e),bitbucket:e=>(i(e),n(e),e),bitnami:e=>(n(e),e),composer:e=>(i(e),n(e),e),deb:e=>(i(e),n(e),e),
|
|
851
851
|
gitlab:e=>(i(e),n(e),e),github:e=>(i(e),n(e),e),hex:e=>(i(e),n(e),e),huggingface:e=>(s(e),e),mlflow:e=>(e.qualifiers?.repository_url?.includes("databricks")&&n(e),e),npm:e=>(i(e),n(e),e),luarocks:e=>(s(e),e),oci:e=>(n(e),e),pub:e=>(n(e),e.name=o(e.name),e),pypi:e=>(i(e),n(e),e.name=a(e.name),e),qpkg:e=>(i(e),e),rpm:e=>(i(e),e)},validate:{conan(t,r){if(e(t.namespace)){if(t.qualifiers?.channel){if(r)throw new l('conan requires a "namespace" component when a "channel" qualifier is present');return!1}}else if(e(t.qualifiers)){if(r)throw new l('conan requires a "qualifiers" component when a namespace is present');return!1}return!0},cran:(e,t)=>u("cran","version",e.version,t),golang(e){const{version:t}=e;if(("string"==typeof t?t.length:0)&&118===t.charCodeAt(0)&&!r(t.slice(1))){if(throws)throw new l('golang "version" component starting with a "v" must be followed by a valid semver version');return!1}return!0},maven:(e,t)=>u("maven","namespace",e.namespace,t),
|
|
852
852
|
mlflow:(e,t)=>c("mlflow","namespace",e.namespace,t),oci:(e,t)=>c("oci","namespace",e.namespace,t),pub(e,t){const{name:r}=e;for(let e=0,{length:n}=r;e<n;e+=1){const n=r.charCodeAt(e);if(!(n>=48&&n<=57||n>=97&&n<=122||95===n)){if(t)throw new l('pub "name" component may only contain [a-z0-9_] characters');return!1}}return!0},swift:(e,t)=>u("swift","namespace",e.namespace,t)&&u("swift","version",e.version,t)}},{normalize:e=>e,validate:(e,t)=>!0})},purlType}function requirePackageUrl(){if(hasRequiredPackageUrl)return packageUrl;hasRequiredPackageUrl=1;const{decodePurlComponent:e}=requireDecode$1(),{isObject:t,recursiveFreeze:r}=requireObjects(),{isBlank:n,isNonEmptyString:i,trimLeadingSlashes:s}=requireStrings(),{PurlComponent:o}=requirePurlComponent(),{PurlQualifierNames:a}=requirePurlQualifierNames(),{PurlType:c}=requirePurlType(),{PurlError:u}=requireError$1();class l{static Component=r(o);static KnownQualifierNames=r(a);static Type=r(c);constructor(e,r,n,s,a,u){
|
|
853
853
|
const l=i(e)?o.type.normalize(e):e;o.type.validate(l,!0);const d=i(r)?o.namespace.normalize(r):r;o.namespace.validate(d,!0);const p=i(n)?o.name.normalize(n):n;o.name.validate(p,!0);const h=i(s)?o.version.normalize(s):s;o.version.validate(h,!0);const A="string"==typeof a||t(a)?o.qualifiers.normalize(a):a;o.qualifiers.validate(A,!0);const f=i(u)?o.subpath.normalize(u):u;o.subpath.validate(f,!0),this.type=l,this.name=p,this.namespace=d??void 0,this.version=h??void 0,this.qualifiers=A??void 0,this.subpath=f??void 0;const g=c[l];g&&(g.normalize(this),g.validate(this,!0))}toString(){const{namespace:e,name:t,version:r,qualifiers:n,subpath:i,type:s}=this;let a=`pkg:${o.type.encode(s)}/`;return e&&(a=`${a}${o.namespace.encode(e)}/`),a=`${a}${o.name.encode(t)}`,r&&(a=`${a}@${o.version.encode(r)}`),n&&(a=`${a}?${o.qualifiers.encode(n)}`),i&&(a=`${a}#${o.subpath.encode(i)}`),a}static fromString(e){return new l(...l.parseString(e))}static parseString(t){
|
|
854
854
|
if("string"!=typeof t)throw new Error("A purl string argument is required.");if(n(t))return[void 0,void 0,void 0,void 0,void 0,void 0];const r=t.indexOf(":");let i,o;if(-1!==r)try{const e=t.slice(0,r),n=t.slice(r+1),a=s(n);i=new URL(`${e}:${a}`),o=n.length===a.length?i:new URL(t)}catch(e){throw new u("failed to parse as URL",{cause:e})}if("pkg:"!==i?.protocol)throw new u('missing required "pkg" scheme component');if(""!==o.username||""!==o.password)throw new u('cannot contain a "user:pass@host:port"');const{pathname:a}=i,c=a.indexOf("/"),l=e("type",-1===c?a:a.slice(0,c));if(c<1)return[l,void 0,void 0,void 0,void 0,void 0];let d,p=a.lastIndexOf("@");-1!==p&&47===a.charCodeAt(p-1)&&(p=-1);const h=a.slice(l.length+1,-1===p?a.length:p);let A,f;-1!==p&&(d=e("version",a.slice(p+1)));const g=h.lastIndexOf("/");let m;-1===g?f=e("name",h):(f=e("name",h.slice(g+1)),A=e("namespace",h.slice(0,g)));const{searchParams:y}=i;let E;0!==y.size&&(y.forEach(t=>e("qualifiers",t)),m=y);const{hash:b}=i
|
|
855
|
-
;return 0!==b.length&&(E=e("subpath",b.slice(1))),[l,A,f,d,m,E]}}for(const e of["Component","KnownQualifierNames","Type"])Reflect.defineProperty(l,e,{...Reflect.getOwnPropertyDescriptor(l,e),writable:!1});return Reflect.setPrototypeOf(l.prototype,null),packageUrl={PackageURL:l,PurlComponent:o,PurlQualifierNames:a,PurlType:c}}function requirePackageurlJs(){if(hasRequiredPackageurlJs)return packageurlJs;hasRequiredPackageurlJs=1;const{PackageURL:e,PurlComponent:t,PurlQualifierNames:r,PurlType:n}=requirePackageUrl();return packageurlJs={PackageURL:e,PurlComponent:t,PurlQualifierNames:r,PurlType:n}}var packageurlJsExports=requirePackageurlJs(),util$
|
|
856
|
-
e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(util$
|
|
855
|
+
;return 0!==b.length&&(E=e("subpath",b.slice(1))),[l,A,f,d,m,E]}}for(const e of["Component","KnownQualifierNames","Type"])Reflect.defineProperty(l,e,{...Reflect.getOwnPropertyDescriptor(l,e),writable:!1});return Reflect.setPrototypeOf(l.prototype,null),packageUrl={PackageURL:l,PurlComponent:o,PurlQualifierNames:a,PurlType:c}}function requirePackageurlJs(){if(hasRequiredPackageurlJs)return packageurlJs;hasRequiredPackageurlJs=1;const{PackageURL:e,PurlComponent:t,PurlQualifierNames:r,PurlType:n}=requirePackageUrl();return packageurlJs={PackageURL:e,PurlComponent:t,PurlQualifierNames:r,PurlType:n}}var packageurlJsExports=requirePackageurlJs(),util$a,objectUtil$1;!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},
|
|
856
|
+
e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(util$a||(util$a={})),(objectUtil$1||(objectUtil$1={})).mergeShapes=(e,t)=>({...e,...t});const ZodParsedType$1=util$a.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType$1=e=>{switch(typeof e){case"undefined":return ZodParsedType$1.undefined;case"string":return ZodParsedType$1.string
|
|
857
857
|
;case"number":return Number.isNaN(e)?ZodParsedType$1.nan:ZodParsedType$1.number;case"boolean":return ZodParsedType$1.boolean;case"function":return ZodParsedType$1.function;case"bigint":return ZodParsedType$1.bigint;case"symbol":return ZodParsedType$1.symbol;case"object":return Array.isArray(e)?ZodParsedType$1.array:null===e?ZodParsedType$1.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ZodParsedType$1.promise:"undefined"!=typeof Map&&e instanceof Map?ZodParsedType$1.map:"undefined"!=typeof Set&&e instanceof Set?ZodParsedType$1.set:"undefined"!=typeof Date&&e instanceof Date?ZodParsedType$1.date:ZodParsedType$1.object;default:return ZodParsedType$1.unknown}
|
|
858
|
-
},ZodIssueCode$1=util$
|
|
859
|
-
for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){const r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util$
|
|
860
|
-
r=e.received===ZodParsedType$1.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ZodIssueCode$1.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,util$
|
|
861
|
-
"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:util$
|
|
858
|
+
},ZodIssueCode$1=util$a.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"]),quotelessJson=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");let ZodError$2=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{
|
|
859
|
+
for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){const r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util$a.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)if(n.path.length>0){const r=n.path[0];t[r]=t[r]||[],t[r].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};ZodError$2.create=e=>new ZodError$2(e);const errorMap$1=(e,t)=>{let r;switch(e.code){case ZodIssueCode$1.invalid_type:
|
|
860
|
+
r=e.received===ZodParsedType$1.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ZodIssueCode$1.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,util$a.jsonStringifyReplacer)}`;break;case ZodIssueCode$1.unrecognized_keys:r=`Unrecognized key(s) in object: ${util$a.joinValues(e.keys,", ")}`;break;case ZodIssueCode$1.invalid_union:r="Invalid input";break;case ZodIssueCode$1.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${util$a.joinValues(e.options)}`;break;case ZodIssueCode$1.invalid_enum_value:r=`Invalid enum value. Expected ${util$a.joinValues(e.options)}, received '${e.received}'`;break;case ZodIssueCode$1.invalid_arguments:r="Invalid function arguments";break;case ZodIssueCode$1.invalid_return_type:r="Invalid function return type";break;case ZodIssueCode$1.invalid_date:r="Invalid date";break;case ZodIssueCode$1.invalid_string:
|
|
861
|
+
"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:util$a.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ZodIssueCode$1.too_small:
|
|
862
862
|
r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ZodIssueCode$1.too_big:
|
|
863
|
-
r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ZodIssueCode$1.custom:r="Invalid input";break;case ZodIssueCode$1.invalid_intersection_types:r="Intersection results could not be merged";break;case ZodIssueCode$1.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ZodIssueCode$1.not_finite:r="Number must be finite";break;default:r=t.defaultError,util$
|
|
863
|
+
r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ZodIssueCode$1.custom:r="Invalid input";break;case ZodIssueCode$1.invalid_intersection_types:r="Intersection results could not be merged";break;case ZodIssueCode$1.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ZodIssueCode$1.not_finite:r="Number must be finite";break;default:r=t.defaultError,util$a.assertNever(e)}return{message:r}}
|
|
864
864
|
;let overrideErrorMap$1=errorMap$1;function setErrorMap(e){overrideErrorMap$1=e}function getErrorMap$1(){return overrideErrorMap$1}const makeIssue$1=e=>{const{data:t,path:r,errorMaps:n,issueData:i}=e,s=[...r,...i.path||[]],o={...i,path:s};if(void 0!==i.message)return{...i,path:s,message:i.message};let a="";const c=n.filter(e=>!!e).slice().reverse();for(const e of c)a=e(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}},EMPTY_PATH=[];function addIssueToContext$1(e,t){const r=getErrorMap$1(),n=makeIssue$1({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===errorMap$1?void 0:errorMap$1].filter(e=>!!e)});e.common.issues.push(n)}let ParseStatus$1=class e{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return INVALID$1;"dirty"===n.status&&e.dirty(),r.push(n.value)}
|
|
865
865
|
return{status:e.value,value:r}}static async mergeObjectAsync(t,r){const n=[];for(const e of r){const t=await e.key,r=await e.value;n.push({key:t,value:r})}return e.mergeObjectSync(t,n)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:i}=n;if("aborted"===t.status)return INVALID$1;if("aborted"===i.status)return INVALID$1;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!n.alwaysSet||(r[t.value]=i.value)}return{status:e.value,value:r}}};const INVALID$1=Object.freeze({status:"aborted"}),DIRTY$1=e=>({status:"dirty",value:e}),OK$1=e=>({status:"valid",value:e}),isAborted$1=e=>"aborted"===e.status,isDirty$1=e=>"dirty"===e.status,isValid$1=e=>"valid"===e.status,isAsync$1=e=>"undefined"!=typeof Promise&&e instanceof Promise;var errorUtil$2;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(errorUtil$2||(errorUtil$2={}));let ParseInputLazyPath$1=class{
|
|
866
866
|
constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const handleResult$2=(e,t)=>{if(isValid$1(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ZodError$2(e.common.issues);return this._error=t,this._error}}};function processCreateParams$1(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{const{message:s}=e;return"invalid_enum_value"===t.code?{message:s??i.defaultError}:void 0===i.data?{
|
|
@@ -877,33 +877,33 @@ i?addIssueToContext$1(r,{code:ZodIssueCode$1.too_big,maximum:n.value,type:"strin
|
|
|
877
877
|
validation:"nanoid",code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)cuidRegex$1.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"cuid",code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)cuid2Regex$1.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"cuid2",code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)ulidRegex$1.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"ulid",code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"url",code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty()}else if("regex"===n.kind){n.regex.lastIndex=0;n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"regex",
|
|
878
878
|
code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty())}else if("trim"===n.kind)e.data=e.data.trim();else if("includes"===n.kind)e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{code:ZodIssueCode$1.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty());else if("toLowerCase"===n.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===n.kind)e.data=e.data.toUpperCase();else if("startsWith"===n.kind)e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{code:ZodIssueCode$1.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty());else if("endsWith"===n.kind)e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{code:ZodIssueCode$1.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty());else if("datetime"===n.kind){datetimeRegex$1(n).test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{
|
|
879
879
|
code:ZodIssueCode$1.invalid_string,validation:"datetime",message:n.message}),t.dirty())}else if("date"===n.kind){dateRegex$1.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{code:ZodIssueCode$1.invalid_string,validation:"date",message:n.message}),t.dirty())}else if("time"===n.kind){timeRegex$1(n).test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{code:ZodIssueCode$1.invalid_string,validation:"time",message:n.message}),t.dirty())}else"duration"===n.kind?durationRegex$1.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"duration",code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?isValidIP$1(e.data,n.version)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"ip",code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty()):"jwt"===n.kind?isValidJWT$2(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"jwt",code:ZodIssueCode$1.invalid_string,
|
|
880
|
-
message:n.message}),t.dirty()):"cidr"===n.kind?isValidCidr$1(e.data,n.version)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"cidr",code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?base64Regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"base64",code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?base64urlRegex$1.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"base64url",code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty()):util$
|
|
880
|
+
message:n.message}),t.dirty()):"cidr"===n.kind?isValidCidr$1(e.data,n.version)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"cidr",code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?base64Regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"base64",code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?base64urlRegex$1.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{validation:"base64url",code:ZodIssueCode$1.invalid_string,message:n.message}),t.dirty()):util$a.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:ZodIssueCode$1.invalid_string,...errorUtil$2.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...errorUtil$2.errToObj(e)})}url(e){return this._addCheck({kind:"url",...errorUtil$2.errToObj(e)})}
|
|
881
881
|
emoji(e){return this._addCheck({kind:"emoji",...errorUtil$2.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...errorUtil$2.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...errorUtil$2.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...errorUtil$2.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...errorUtil$2.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...errorUtil$2.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...errorUtil$2.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...errorUtil$2.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...errorUtil$2.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...errorUtil$2.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...errorUtil$2.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",
|
|
882
882
|
precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...errorUtil$2.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...errorUtil$2.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...errorUtil$2.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...errorUtil$2.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...errorUtil$2.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...errorUtil$2.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...errorUtil$2.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...errorUtil$2.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,
|
|
883
883
|
...errorUtil$2.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...errorUtil$2.errToObj(t)})}nonempty(e){return this.min(1,errorUtil$2.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){
|
|
884
884
|
return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};function floatSafeRemainder$1(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}
|
|
885
|
-
ZodString$2.create=e=>new ZodString$2({checks:[],typeName:ZodFirstPartyTypeKind$1.ZodString,coerce:e?.coerce??!1,...processCreateParams$1(e)});let ZodNumber$1=class e extends ZodType$2{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==ZodParsedType$1.number){const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.number,received:t.parsedType}),INVALID$1}let t;const r=new ParseStatus$1;for(const n of this._def.checks)if("int"===n.kind)util$
|
|
886
|
-
inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else"multipleOf"===n.kind?0!==floatSafeRemainder$1(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.not_finite,message:n.message}),r.dirty()):util$
|
|
885
|
+
ZodString$2.create=e=>new ZodString$2({checks:[],typeName:ZodFirstPartyTypeKind$1.ZodString,coerce:e?.coerce??!1,...processCreateParams$1(e)});let ZodNumber$1=class e extends ZodType$2{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==ZodParsedType$1.number){const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.number,received:t.parsedType}),INVALID$1}let t;const r=new ParseStatus$1;for(const n of this._def.checks)if("int"===n.kind)util$a.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.too_small,minimum:n.value,type:"number",
|
|
886
|
+
inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else"multipleOf"===n.kind?0!==floatSafeRemainder$1(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.not_finite,message:n.message}),r.dirty()):util$a.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,errorUtil$2.toString(t))}gt(e,t){return this.setLimit("min",e,!1,errorUtil$2.toString(t))}lte(e,t){return this.setLimit("max",e,!0,errorUtil$2.toString(t))}lt(e,t){return this.setLimit("max",e,!1,errorUtil$2.toString(t))}
|
|
887
887
|
setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:errorUtil$2.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:errorUtil$2.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil$2.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil$2.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil$2.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil$2.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:errorUtil$2.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:errorUtil$2.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil$2.toString(e)
|
|
888
|
-
})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil$2.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&util$
|
|
889
|
-
if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ZodParsedType$1.bigint)return this._getInvalidInput(e);let t;const r=new ParseStatus$1;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):util$
|
|
888
|
+
})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil$2.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&util$a.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ZodNumber$1.create=e=>new ZodNumber$1({checks:[],typeName:ZodFirstPartyTypeKind$1.ZodNumber,coerce:e?.coerce||!1,...processCreateParams$1(e)});let ZodBigInt$1=class e extends ZodType$2{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){
|
|
889
|
+
if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ZodParsedType$1.bigint)return this._getInvalidInput(e);let t;const r=new ParseStatus$1;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),addIssueToContext$1(t,{code:ZodIssueCode$1.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):util$a.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e)
|
|
890
890
|
;return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.bigint,received:t.parsedType}),INVALID$1}gte(e,t){return this.setLimit("min",e,!0,errorUtil$2.toString(t))}gt(e,t){return this.setLimit("min",e,!1,errorUtil$2.toString(t))}lte(e,t){return this.setLimit("max",e,!0,errorUtil$2.toString(t))}lt(e,t){return this.setLimit("max",e,!1,errorUtil$2.toString(t))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:errorUtil$2.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil$2.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil$2.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil$2.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),
|
|
891
891
|
inclusive:!0,message:errorUtil$2.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:errorUtil$2.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};ZodBigInt$1.create=e=>new ZodBigInt$1({checks:[],typeName:ZodFirstPartyTypeKind$1.ZodBigInt,coerce:e?.coerce??!1,...processCreateParams$1(e)});let ZodBoolean$1=class extends ZodType$2{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==ZodParsedType$1.boolean){const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.boolean,received:t.parsedType}),INVALID$1}return OK$1(e.data)}};ZodBoolean$1.create=e=>new ZodBoolean$1({typeName:ZodFirstPartyTypeKind$1.ZodBoolean,coerce:e?.coerce||!1,...processCreateParams$1(e)})
|
|
892
|
-
;let ZodDate$1=class e extends ZodType$2{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==ZodParsedType$1.date){const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.date,received:t.parsedType}),INVALID$1}if(Number.isNaN(e.data.getTime())){return addIssueToContext$1(this._getOrReturnCtx(e),{code:ZodIssueCode$1.invalid_date}),INVALID$1}const t=new ParseStatus$1;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{code:ZodIssueCode$1.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{code:ZodIssueCode$1.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):util$
|
|
892
|
+
;let ZodDate$1=class e extends ZodType$2{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==ZodParsedType$1.date){const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.date,received:t.parsedType}),INVALID$1}if(Number.isNaN(e.data.getTime())){return addIssueToContext$1(this._getOrReturnCtx(e),{code:ZodIssueCode$1.invalid_date}),INVALID$1}const t=new ParseStatus$1;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{code:ZodIssueCode$1.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext$1(r,{code:ZodIssueCode$1.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):util$a.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){
|
|
893
893
|
return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:errorUtil$2.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:errorUtil$2.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}};ZodDate$1.create=e=>new ZodDate$1({checks:[],coerce:e?.coerce||!1,typeName:ZodFirstPartyTypeKind$1.ZodDate,...processCreateParams$1(e)});let ZodSymbol$1=class extends ZodType$2{_parse(e){if(this._getType(e)!==ZodParsedType$1.symbol){const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.symbol,received:t.parsedType}),INVALID$1}return OK$1(e.data)}};ZodSymbol$1.create=e=>new ZodSymbol$1({
|
|
894
894
|
typeName:ZodFirstPartyTypeKind$1.ZodSymbol,...processCreateParams$1(e)});let ZodUndefined$1=class extends ZodType$2{_parse(e){if(this._getType(e)!==ZodParsedType$1.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.undefined,received:t.parsedType}),INVALID$1}return OK$1(e.data)}};ZodUndefined$1.create=e=>new ZodUndefined$1({typeName:ZodFirstPartyTypeKind$1.ZodUndefined,...processCreateParams$1(e)});let ZodNull$1=class extends ZodType$2{_parse(e){if(this._getType(e)!==ZodParsedType$1.null){const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.null,received:t.parsedType}),INVALID$1}return OK$1(e.data)}};ZodNull$1.create=e=>new ZodNull$1({typeName:ZodFirstPartyTypeKind$1.ZodNull,...processCreateParams$1(e)});let ZodAny$1=class extends ZodType$2{constructor(){super(...arguments),this._any=!0}_parse(e){return OK$1(e.data)}}
|
|
895
895
|
;ZodAny$1.create=e=>new ZodAny$1({typeName:ZodFirstPartyTypeKind$1.ZodAny,...processCreateParams$1(e)});let ZodUnknown$2=class extends ZodType$2{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK$1(e.data)}};ZodUnknown$2.create=e=>new ZodUnknown$2({typeName:ZodFirstPartyTypeKind$1.ZodUnknown,...processCreateParams$1(e)});let ZodNever$2=class extends ZodType$2{_parse(e){const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.never,received:t.parsedType}),INVALID$1}};ZodNever$2.create=e=>new ZodNever$2({typeName:ZodFirstPartyTypeKind$1.ZodNever,...processCreateParams$1(e)});let ZodVoid$1=class extends ZodType$2{_parse(e){if(this._getType(e)!==ZodParsedType$1.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.void,received:t.parsedType}),INVALID$1}return OK$1(e.data)}};ZodVoid$1.create=e=>new ZodVoid$1({
|
|
896
896
|
typeName:ZodFirstPartyTypeKind$1.ZodVoid,...processCreateParams$1(e)});let ZodArray$2=class e extends ZodType$2{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==ZodParsedType$1.array)return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.array,received:t.parsedType}),INVALID$1;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(addIssueToContext$1(t,{code:e?ZodIssueCode$1.too_big:ZodIssueCode$1.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(addIssueToContext$1(t,{code:ZodIssueCode$1.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(addIssueToContext$1(t,{
|
|
897
897
|
code:ZodIssueCode$1.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new ParseInputLazyPath$1(t,e,t.path,r)))).then(e=>ParseStatus$1.mergeArray(r,e));const i=[...t.data].map((e,r)=>n.type._parseSync(new ParseInputLazyPath$1(t,e,t.path,r)));return ParseStatus$1.mergeArray(r,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:errorUtil$2.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:errorUtil$2.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:errorUtil$2.toString(r)}})}nonempty(e){return this.min(1,e)}};function deepPartialify$1(e){if(e instanceof ZodObject$2){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=ZodOptional$2.create(deepPartialify$1(n))}return new ZodObject$2({...e._def,shape:()=>t})}
|
|
898
|
-
return e instanceof ZodArray$2?new ZodArray$2({...e._def,type:deepPartialify$1(e.element)}):e instanceof ZodOptional$2?ZodOptional$2.create(deepPartialify$1(e.unwrap())):e instanceof ZodNullable$2?ZodNullable$2.create(deepPartialify$1(e.unwrap())):e instanceof ZodTuple$1?ZodTuple$1.create(e.items.map(e=>deepPartialify$1(e))):e}ZodArray$2.create=(e,t)=>new ZodArray$2({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind$1.ZodArray,...processCreateParams$1(t)});let ZodObject$2=class e extends ZodType$2{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=util$
|
|
898
|
+
return e instanceof ZodArray$2?new ZodArray$2({...e._def,type:deepPartialify$1(e.element)}):e instanceof ZodOptional$2?ZodOptional$2.create(deepPartialify$1(e.unwrap())):e instanceof ZodNullable$2?ZodNullable$2.create(deepPartialify$1(e.unwrap())):e instanceof ZodTuple$1?ZodTuple$1.create(e.items.map(e=>deepPartialify$1(e))):e}ZodArray$2.create=(e,t)=>new ZodArray$2({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind$1.ZodArray,...processCreateParams$1(t)});let ZodObject$2=class e extends ZodType$2{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=util$a.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==ZodParsedType$1.object){const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.object,
|
|
899
899
|
received:t.parsedType}),INVALID$1}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof ZodNever$2&&"strip"===this._def.unknownKeys))for(const e in r.data)i.includes(e)||s.push(e);const o=[];for(const e of i){const t=n[e],i=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new ParseInputLazyPath$1(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof ZodNever$2){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)s.length>0&&(addIssueToContext$1(r,{code:ZodIssueCode$1.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const n=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath$1(r,n,r.path,t)),alwaysSet:t in r.data
|
|
900
900
|
})}}return r.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of o){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>ParseStatus$1.mergeObjectSync(t,e)):ParseStatus$1.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return errorUtil$2.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,r)=>{const n=this._def.errorMap?.(e,r).message??r.defaultError;return"unrecognized_keys"===e.code?{message:errorUtil$2.errToObj(t).message??n}:{message:n}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ZodFirstPartyTypeKind$1.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){
|
|
901
|
-
return new e({...this._def,catchall:t})}pick(t){const r={};for(const e of util$
|
|
901
|
+
return new e({...this._def,catchall:t})}pick(t){const r={};for(const e of util$a.objectKeys(t))t[e]&&this.shape[e]&&(r[e]=this.shape[e]);return new e({...this._def,shape:()=>r})}omit(t){const r={};for(const e of util$a.objectKeys(this.shape))t[e]||(r[e]=this.shape[e]);return new e({...this._def,shape:()=>r})}deepPartial(){return deepPartialify$1(this)}partial(t){const r={};for(const e of util$a.objectKeys(this.shape)){const n=this.shape[e];t&&!t[e]?r[e]=n:r[e]=n.optional()}return new e({...this._def,shape:()=>r})}required(t){const r={};for(const e of util$a.objectKeys(this.shape))if(t&&!t[e])r[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof ZodOptional$2;)t=t._def.innerType;r[e]=t}return new e({...this._def,shape:()=>r})}keyof(){return createZodEnum$1(util$a.objectKeys(this.shape))}};ZodObject$2.create=(e,t)=>new ZodObject$2({shape:()=>e,unknownKeys:"strip",catchall:ZodNever$2.create(),typeName:ZodFirstPartyTypeKind$1.ZodObject,...processCreateParams$1(t)}),
|
|
902
902
|
ZodObject$2.strictCreate=(e,t)=>new ZodObject$2({shape:()=>e,unknownKeys:"strict",catchall:ZodNever$2.create(),typeName:ZodFirstPartyTypeKind$1.ZodObject,...processCreateParams$1(t)}),ZodObject$2.lazycreate=(e,t)=>new ZodObject$2({shape:e,unknownKeys:"strip",catchall:ZodNever$2.create(),typeName:ZodFirstPartyTypeKind$1.ZodObject,...processCreateParams$1(t)});let ZodUnion$2=class extends ZodType$2{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map(e=>new ZodError$2(e.ctx.common.issues));return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_union,unionErrors:r}),INVALID$1});{let e
|
|
903
903
|
;const n=[];for(const i of r){const r={...t,common:{...t.common,issues:[]},parent:null},s=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=n.map(e=>new ZodError$2(e));return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_union,unionErrors:i}),INVALID$1}}get options(){return this._def.options}};ZodUnion$2.create=(e,t)=>new ZodUnion$2({options:e,typeName:ZodFirstPartyTypeKind$1.ZodUnion,...processCreateParams$1(t)})
|
|
904
|
-
;const getDiscriminator$1=e=>e instanceof ZodLazy$1?getDiscriminator$1(e.schema):e instanceof ZodEffects$1?getDiscriminator$1(e.innerType()):e instanceof ZodLiteral$1?[e.value]:e instanceof ZodEnum$2?e.options:e instanceof ZodNativeEnum$1?util$
|
|
904
|
+
;const getDiscriminator$1=e=>e instanceof ZodLazy$1?getDiscriminator$1(e.schema):e instanceof ZodEffects$1?getDiscriminator$1(e.innerType()):e instanceof ZodLiteral$1?[e.value]:e instanceof ZodEnum$2?e.options:e instanceof ZodNativeEnum$1?util$a.objectValues(e.enum):e instanceof ZodDefault$2?getDiscriminator$1(e._def.innerType):e instanceof ZodUndefined$1?[void 0]:e instanceof ZodNull$1?[null]:e instanceof ZodOptional$2?[void 0,...getDiscriminator$1(e.unwrap())]:e instanceof ZodNullable$2?[null,...getDiscriminator$1(e.unwrap())]:e instanceof ZodBranded$1||e instanceof ZodReadonly$2?getDiscriminator$1(e.unwrap()):e instanceof ZodCatch$2?getDiscriminator$1(e._def.innerType):[];let ZodDiscriminatedUnion$1=class e extends ZodType$2{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType$1.object)return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.object,received:t.parsedType}),INVALID$1
|
|
905
905
|
;const r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),INVALID$1)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const i=new Map;for(const e of r){const r=getDiscriminator$1(e.shape[t]);if(!r.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const n of r){if(i.has(n))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(n)}`);i.set(n,e)}}return new e({typeName:ZodFirstPartyTypeKind$1.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...processCreateParams$1(n)})}};function mergeValues$2(e,t){
|
|
906
|
-
const r=getParsedType$1(e),n=getParsedType$1(t);if(e===t)return{valid:!0,data:e};if(r===ZodParsedType$1.object&&n===ZodParsedType$1.object){const r=util$
|
|
906
|
+
const r=getParsedType$1(e),n=getParsedType$1(t);if(e===t)return{valid:!0,data:e};if(r===ZodParsedType$1.object&&n===ZodParsedType$1.object){const r=util$a.objectKeys(t),n=util$a.objectKeys(e).filter(e=>-1!==r.indexOf(e)),i={...e,...t};for(const r of n){const n=mergeValues$2(e[r],t[r]);if(!n.valid)return{valid:!1};i[r]=n.data}return{valid:!0,data:i}}if(r===ZodParsedType$1.array&&n===ZodParsedType$1.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const i=mergeValues$2(e[n],t[n]);if(!i.valid)return{valid:!1};r.push(i.data)}return{valid:!0,data:r}}return r===ZodParsedType$1.date&&n===ZodParsedType$1.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}let ZodIntersection$2=class extends ZodType$2{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(isAborted$1(e)||isAborted$1(n))return INVALID$1;const i=mergeValues$2(e.value,n.value);return i.valid?((isDirty$1(e)||isDirty$1(n))&&t.dirty(),{status:t.value,value:i.data
|
|
907
907
|
}):(addIssueToContext$1(r,{code:ZodIssueCode$1.invalid_intersection_types}),INVALID$1)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};ZodIntersection$2.create=(e,t,r)=>new ZodIntersection$2({left:e,right:t,typeName:ZodFirstPartyTypeKind$1.ZodIntersection,...processCreateParams$1(r)});let ZodTuple$1=class e extends ZodType$2{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType$1.array)return addIssueToContext$1(r,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.array,received:r.parsedType}),INVALID$1;if(r.data.length<this._def.items.length)return addIssueToContext$1(r,{code:ZodIssueCode$1.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),
|
|
908
908
|
INVALID$1;!this._def.rest&&r.data.length>this._def.items.length&&(addIssueToContext$1(r,{code:ZodIssueCode$1.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new ParseInputLazyPath$1(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>ParseStatus$1.mergeArray(t,e)):ParseStatus$1.mergeArray(t,n)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ZodTuple$1.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple$1({items:e,typeName:ZodFirstPartyTypeKind$1.ZodTuple,rest:null,...processCreateParams$1(t)})};let ZodRecord$2=class e extends ZodType$2{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e)
|
|
909
909
|
;if(r.parsedType!==ZodParsedType$1.object)return addIssueToContext$1(r,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.object,received:r.parsedType}),INVALID$1;const n=[],i=this._def.keyType,s=this._def.valueType;for(const e in r.data)n.push({key:i._parse(new ParseInputLazyPath$1(r,e,r.path,e)),value:s._parse(new ParseInputLazyPath$1(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?ParseStatus$1.mergeObjectAsync(t,n):ParseStatus$1.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(t,r,n){return new e(r instanceof ZodType$2?{keyType:t,valueType:r,typeName:ZodFirstPartyTypeKind$1.ZodRecord,...processCreateParams$1(n)}:{keyType:ZodString$2.create(),valueType:t,typeName:ZodFirstPartyTypeKind$1.ZodRecord,...processCreateParams$1(r)})}},ZodMap$1=class extends ZodType$2{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e)
|
|
@@ -912,12 +912,12 @@ typeName:ZodFirstPartyTypeKind$1.ZodMap,...processCreateParams$1(r)});let ZodSet
|
|
|
912
912
|
const o=[...r.data.values()].map((e,t)=>i._parse(new ParseInputLazyPath$1(r,e,r.path,t)));return r.common.async?Promise.all(o).then(e=>s(e)):s(o)}min(t,r){return new e({...this._def,minSize:{value:t,message:errorUtil$2.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:errorUtil$2.toString(r)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ZodSet$1.create=(e,t)=>new ZodSet$1({valueType:e,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind$1.ZodSet,...processCreateParams$1(t)});class ZodFunction extends ZodType$2{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType$1.function)return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.function,received:t.parsedType}),INVALID$1;function r(e,r){return makeIssue$1({data:e,path:t.path,
|
|
913
913
|
errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap$1(),errorMap$1].filter(e=>!!e),issueData:{code:ZodIssueCode$1.invalid_arguments,argumentsError:r}})}function n(e,r){return makeIssue$1({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap$1(),errorMap$1].filter(e=>!!e),issueData:{code:ZodIssueCode$1.invalid_return_type,returnTypeError:r}})}const i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof ZodPromise$1){const e=this;return OK$1(async function(...t){const o=new ZodError$2([]),a=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(r(t,e)),o}),c=await Reflect.apply(s,this,a);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(n(c,e)),o})})}{const e=this;return OK$1(function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new ZodError$2([r(t,o.error)]);const a=Reflect.apply(s,this,o.data),c=e._def.returns.safeParse(a,i)
|
|
914
914
|
;if(!c.success)throw new ZodError$2([n(a,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple$1.create(e).rest(ZodUnknown$2.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ZodFunction({args:e||ZodTuple$1.create([]).rest(ZodUnknown$2.create()),returns:t||ZodUnknown$2.create(),typeName:ZodFirstPartyTypeKind$1.ZodFunction,...processCreateParams$1(r)})}}let ZodLazy$1=class extends ZodType$2{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ZodLazy$1.create=(e,t)=>new ZodLazy$1({getter:e,typeName:ZodFirstPartyTypeKind$1.ZodLazy,...processCreateParams$1(t)});let ZodLiteral$1=class extends ZodType$2{_parse(e){if(e.data!==this._def.value){
|
|
915
|
-
const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{received:t.data,code:ZodIssueCode$1.invalid_literal,expected:this._def.value}),INVALID$1}return{status:"valid",value:e.data}}get value(){return this._def.value}};function createZodEnum$1(e,t){return new ZodEnum$2({values:e,typeName:ZodFirstPartyTypeKind$1.ZodEnum,...processCreateParams$1(t)})}ZodLiteral$1.create=(e,t)=>new ZodLiteral$1({value:e,typeName:ZodFirstPartyTypeKind$1.ZodLiteral,...processCreateParams$1(t)});let ZodEnum$2=class e extends ZodType$2{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return addIssueToContext$1(t,{expected:util$
|
|
916
|
-
get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...r})}};ZodEnum$2.create=createZodEnum$1;let ZodNativeEnum$1=class extends ZodType$2{_parse(e){const t=util$
|
|
915
|
+
const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{received:t.data,code:ZodIssueCode$1.invalid_literal,expected:this._def.value}),INVALID$1}return{status:"valid",value:e.data}}get value(){return this._def.value}};function createZodEnum$1(e,t){return new ZodEnum$2({values:e,typeName:ZodFirstPartyTypeKind$1.ZodEnum,...processCreateParams$1(t)})}ZodLiteral$1.create=(e,t)=>new ZodLiteral$1({value:e,typeName:ZodFirstPartyTypeKind$1.ZodLiteral,...processCreateParams$1(t)});let ZodEnum$2=class e extends ZodType$2{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return addIssueToContext$1(t,{expected:util$a.joinValues(r),received:t.parsedType,code:ZodIssueCode$1.invalid_type}),INVALID$1}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return addIssueToContext$1(t,{received:t.data,code:ZodIssueCode$1.invalid_enum_value,options:r}),INVALID$1}return OK$1(e.data)}
|
|
916
|
+
get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...r})}};ZodEnum$2.create=createZodEnum$1;let ZodNativeEnum$1=class extends ZodType$2{_parse(e){const t=util$a.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ZodParsedType$1.string&&r.parsedType!==ZodParsedType$1.number){const e=util$a.objectValues(t);return addIssueToContext$1(r,{expected:util$a.joinValues(e),received:r.parsedType,code:ZodIssueCode$1.invalid_type}),INVALID$1}if(this._cache||(this._cache=new Set(util$a.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=util$a.objectValues(t);return addIssueToContext$1(r,{
|
|
917
917
|
received:r.data,code:ZodIssueCode$1.invalid_enum_value,options:e}),INVALID$1}return OK$1(e.data)}get enum(){return this._def.values}};ZodNativeEnum$1.create=(e,t)=>new ZodNativeEnum$1({values:e,typeName:ZodFirstPartyTypeKind$1.ZodNativeEnum,...processCreateParams$1(t)});let ZodPromise$1=class extends ZodType$2{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType$1.promise&&!1===t.common.async)return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.promise,received:t.parsedType}),INVALID$1;const r=t.parsedType===ZodParsedType$1.promise?t.data:Promise.resolve(t.data);return OK$1(r.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};ZodPromise$1.create=(e,t)=>new ZodPromise$1({type:e,typeName:ZodFirstPartyTypeKind$1.ZodPromise,...processCreateParams$1(t)});let ZodEffects$1=class extends ZodType$2{innerType(){return this._def.schema}sourceType(){
|
|
918
918
|
return this._def.schema._def.typeName===ZodFirstPartyTypeKind$1.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{addIssueToContext$1(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){const e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return INVALID$1;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?INVALID$1:"dirty"===n.status||"dirty"===t.value?DIRTY$1(n.value):n});{if("aborted"===t.value)return INVALID$1;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?INVALID$1:"dirty"===n.status||"dirty"===t.value?DIRTY$1(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t)
|
|
919
919
|
;if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?INVALID$1:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?INVALID$1:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!isValid$1(e))return INVALID$1;const s=n.transform(e.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r
|
|
920
|
-
}).then(e=>isValid$1(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):INVALID$1)}util$
|
|
920
|
+
}).then(e=>isValid$1(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):INVALID$1)}util$a.assertNever(n)}};ZodEffects$1.create=(e,t,r)=>new ZodEffects$1({schema:e,typeName:ZodFirstPartyTypeKind$1.ZodEffects,effect:t,...processCreateParams$1(r)}),ZodEffects$1.createWithPreprocess=(e,t,r)=>new ZodEffects$1({schema:t,effect:{type:"preprocess",transform:e},typeName:ZodFirstPartyTypeKind$1.ZodEffects,...processCreateParams$1(r)});let ZodOptional$2=class extends ZodType$2{_parse(e){return this._getType(e)===ZodParsedType$1.undefined?OK$1(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ZodOptional$2.create=(e,t)=>new ZodOptional$2({innerType:e,typeName:ZodFirstPartyTypeKind$1.ZodOptional,...processCreateParams$1(t)});let ZodNullable$2=class extends ZodType$2{_parse(e){return this._getType(e)===ZodParsedType$1.null?OK$1(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}
|
|
921
921
|
;ZodNullable$2.create=(e,t)=>new ZodNullable$2({innerType:e,typeName:ZodFirstPartyTypeKind$1.ZodNullable,...processCreateParams$1(t)});let ZodDefault$2=class extends ZodType$2{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===ZodParsedType$1.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ZodDefault$2.create=(e,t)=>new ZodDefault$2({innerType:e,typeName:ZodFirstPartyTypeKind$1.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...processCreateParams$1(t)});let ZodCatch$2=class extends ZodType$2{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return isAsync$1(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError$2(r.common.issues)},input:r.data})})):{
|
|
922
922
|
status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new ZodError$2(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ZodCatch$2.create=(e,t)=>new ZodCatch$2({innerType:e,typeName:ZodFirstPartyTypeKind$1.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...processCreateParams$1(t)});let ZodNaN$1=class extends ZodType$2{_parse(e){if(this._getType(e)!==ZodParsedType$1.nan){const t=this._getOrReturnCtx(e);return addIssueToContext$1(t,{code:ZodIssueCode$1.invalid_type,expected:ZodParsedType$1.nan,received:t.parsedType}),INVALID$1}return{status:"valid",value:e.data}}};ZodNaN$1.create=e=>new ZodNaN$1({typeName:ZodFirstPartyTypeKind$1.ZodNaN,...processCreateParams$1(e)});const BRAND=Symbol("zod_brand");let ZodBranded$1=class extends ZodType$2{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}
|
|
923
923
|
},ZodPipeline$1=class e extends ZodType$2{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?INVALID$1:"dirty"===e.status?(t.dirty(),DIRTY$1(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})()}{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?INVALID$1:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(t,r){return new e({in:t,out:r,typeName:ZodFirstPartyTypeKind$1.ZodPipeline})}},ZodReadonly$2=class extends ZodType$2{_parse(e){const t=this._def.innerType._parse(e),r=e=>(isValid$1(e)&&(e.value=Object.freeze(e.value)),e);return isAsync$1(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}};function cleanParams(e,t){const r="function"==typeof e?e(t):"string"==typeof e?{message:e
|
|
@@ -926,7 +926,7 @@ e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersecti
|
|
|
926
926
|
})=>custom$1(t=>t instanceof e,t),stringType$1=ZodString$2.create,numberType$1=ZodNumber$1.create,nanType=ZodNaN$1.create,bigIntType=ZodBigInt$1.create,booleanType$1=ZodBoolean$1.create,dateType=ZodDate$1.create,symbolType=ZodSymbol$1.create,undefinedType=ZodUndefined$1.create,nullType=ZodNull$1.create,anyType$1=ZodAny$1.create,unknownType$1=ZodUnknown$2.create,neverType=ZodNever$2.create,voidType=ZodVoid$1.create,arrayType$1=ZodArray$2.create,objectType$1=ZodObject$2.create,strictObjectType=ZodObject$2.strictCreate,unionType$1=ZodUnion$2.create,discriminatedUnionType$1=ZodDiscriminatedUnion$1.create,intersectionType=ZodIntersection$2.create,tupleType=ZodTuple$1.create,recordType$1=ZodRecord$2.create,mapType=ZodMap$1.create,setType=ZodSet$1.create,functionType=ZodFunction.create,lazyType=ZodLazy$1.create,literalType$1=ZodLiteral$1.create,enumType$1=ZodEnum$2.create,nativeEnumType=ZodNativeEnum$1.create,promiseType=ZodPromise$1.create,effectsType=ZodEffects$1.create,optionalType$1=ZodOptional$2.create,nullableType=ZodNullable$2.create,preprocessType=ZodEffects$1.createWithPreprocess,pipelineType=ZodPipeline$1.create,ostring=()=>stringType$1().optional(),onumber=()=>numberType$1().optional(),oboolean=()=>booleanType$1().optional(),coerce={
|
|
927
927
|
string:e=>ZodString$2.create({...e,coerce:!0}),number:e=>ZodNumber$1.create({...e,coerce:!0}),boolean:e=>ZodBoolean$1.create({...e,coerce:!0}),bigint:e=>ZodBigInt$1.create({...e,coerce:!0}),date:e=>ZodDate$1.create({...e,coerce:!0})},NEVER=INVALID$1;var z=Object.freeze({__proto__:null,BRAND,DIRTY:DIRTY$1,EMPTY_PATH,INVALID:INVALID$1,NEVER,OK:OK$1,ParseStatus:ParseStatus$1,Schema:ZodType$2,ZodAny:ZodAny$1,ZodArray:ZodArray$2,ZodBigInt:ZodBigInt$1,ZodBoolean:ZodBoolean$1,ZodBranded:ZodBranded$1,ZodCatch:ZodCatch$2,ZodDate:ZodDate$1,ZodDefault:ZodDefault$2,ZodDiscriminatedUnion:ZodDiscriminatedUnion$1,ZodEffects:ZodEffects$1,ZodEnum:ZodEnum$2,ZodError:ZodError$2,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind$1},ZodFunction,ZodIntersection:ZodIntersection$2,ZodIssueCode:ZodIssueCode$1,ZodLazy:ZodLazy$1,ZodLiteral:ZodLiteral$1,ZodMap:ZodMap$1,ZodNaN:ZodNaN$1,ZodNativeEnum:ZodNativeEnum$1,ZodNever:ZodNever$2,ZodNull:ZodNull$1,ZodNullable:ZodNullable$2,ZodNumber:ZodNumber$1,
|
|
928
928
|
ZodObject:ZodObject$2,ZodOptional:ZodOptional$2,ZodParsedType:ZodParsedType$1,ZodPipeline:ZodPipeline$1,ZodPromise:ZodPromise$1,ZodReadonly:ZodReadonly$2,ZodRecord:ZodRecord$2,ZodSchema:ZodType$2,ZodSet:ZodSet$1,ZodString:ZodString$2,ZodSymbol:ZodSymbol$1,ZodTransformer:ZodEffects$1,ZodTuple:ZodTuple$1,ZodType:ZodType$2,ZodUndefined:ZodUndefined$1,ZodUnion:ZodUnion$2,ZodUnknown:ZodUnknown$2,ZodVoid:ZodVoid$1,addIssueToContext:addIssueToContext$1,any:anyType$1,array:arrayType$1,bigint:bigIntType,boolean:booleanType$1,coerce,custom:custom$1,date:dateType,datetimeRegex:datetimeRegex$1,defaultErrorMap:errorMap$1,discriminatedUnion:discriminatedUnionType$1,effect:effectsType,enum:enumType$1,function:functionType,getErrorMap:getErrorMap$1,getParsedType:getParsedType$1,instanceof:instanceOfType,intersection:intersectionType,isAborted:isAborted$1,isAsync:isAsync$1,isDirty:isDirty$1,isValid:isValid$1,late,lazy:lazyType,literal:literalType$1,makeIssue:makeIssue$1,map:mapType,nan:nanType,
|
|
929
|
-
nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType$1,object:objectType$1,get objectUtil(){return objectUtil$1},oboolean,onumber,optional:optionalType$1,ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,quotelessJson,record:recordType$1,set:setType,setErrorMap,strictObject:strictObjectType,string:stringType$1,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType$1,unknown:unknownType$1,get util(){return util$
|
|
929
|
+
nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType$1,object:objectType$1,get objectUtil(){return objectUtil$1},oboolean,onumber,optional:optionalType$1,ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,quotelessJson,record:recordType$1,set:setType,setErrorMap,strictObject:strictObjectType,string:stringType$1,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType$1,unknown:unknownType$1,get util(){return util$a},void:voidType});function xmlish(e,t,r={}){return void 0===t?"":`<${e}${Object.entries(r).map(([e,t])=>` ${e}="${t}"`).join("")}>\n${t}\n</${e}>`}var tarStream={},fixedSize,hasRequiredFixedSize,fastFifo,hasRequiredFastFifo,b4a,hasRequiredB4a,passThroughDecoder,hasRequiredPassThroughDecoder,utf8Decoder,hasRequiredUtf8Decoder,textDecoder$1,hasRequiredTextDecoder,streamx,hasRequiredStreamx;function requireFixedSize(){return hasRequiredFixedSize||(hasRequiredFixedSize=1,
|
|
930
930
|
fixedSize=class{constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}clear(){this.top=this.btm=0,this.next=null,this.buffer.fill(void 0)}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}),fixedSize}function requireFastFifo(){if(hasRequiredFastFifo)return fastFifo;hasRequiredFastFifo=1;const e=requireFixedSize();return fastFifo=class{constructor(t){this.hwm=t||16,this.head=new e(this.hwm),this.tail=this.head,this.length=0}clear(){this.head=this.tail,this.head.clear(),this.length=0}push(t){if(this.length++,!this.head.push(t)){const r=this.head;this.head=r.next=new e(2*this.head.buffer.length),
|
|
931
931
|
this.head.push(t)}}shift(){0!==this.length&&this.length--;const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}peek(){const e=this.tail.peek();return void 0===e&&this.tail.next?this.tail.next.peek():e}isEmpty(){return 0===this.length}}}function requireB4a(){if(hasRequiredB4a)return b4a;function e(e){return Buffer.isBuffer(e)?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)}return hasRequiredB4a=1,b4a={isBuffer:function(e){return Buffer.isBuffer(e)||e instanceof Uint8Array},isEncoding:function(e){return Buffer.isEncoding(e)},alloc:function(e,t,r){return Buffer.alloc(e,t,r)},allocUnsafe:function(e){return Buffer.allocUnsafe(e)},allocUnsafeSlow:function(e){return Buffer.allocUnsafeSlow(e)},byteLength:function(e,t){return Buffer.byteLength(e,t)},compare:function(e,t){return Buffer.compare(e,t)},concat:function(e,t){return Buffer.concat(e,t)},copy:function(t,r,n,i,s){return e(t).copy(r,n,i,s)},
|
|
932
932
|
equals:function(t,r){return e(t).equals(r)},fill:function(t,r,n,i,s){return e(t).fill(r,n,i,s)},from:function(e,t,r){return Buffer.from(e,t,r)},includes:function(t,r,n,i){return e(t).includes(r,n,i)},indexOf:function(t,r,n,i){return e(t).indexOf(r,n,i)},lastIndexOf:function(t,r,n,i){return e(t).lastIndexOf(r,n,i)},swap16:function(t){return e(t).swap16()},swap32:function(t){return e(t).swap32()},swap64:function(t){return e(t).swap64()},toBuffer:e,toString:function(t,r,n,i){return e(t).toString(r,n,i)},write:function(t,r,n,i,s){return e(t).write(r,n,i,s)},writeDoubleLE:function(t,r,n){return e(t).writeDoubleLE(r,n)},writeFloatLE:function(t,r,n){return e(t).writeFloatLE(r,n)},writeUInt32LE:function(t,r,n){return e(t).writeUInt32LE(r,n)},writeInt32LE:function(t,r,n){return e(t).writeInt32LE(r,n)},readDoubleLE:function(t,r){return e(t).readDoubleLE(r)},readFloatLE:function(t,r){return e(t).readFloatLE(r)},readUInt32LE:function(t,r){return e(t).readUInt32LE(r)},readInt32LE:function(t,r){
|
|
@@ -1183,9 +1183,9 @@ return t>=e.length?-1:(e.charCodeAt(t)|TO_LOWER_BIT)===CharCodes.LOWER_X?(this.s
|
|
|
1183
1183
|
}return-1}emitNotTerminatedNamedEntity(){var e;const{result:t,decodeTree:r}=this,n=(r[t]&BinTrieFlags.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,n,this.consumed),null===(e=this.errors)||void 0===e||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,r){const{decodeTree:n}=this;return this.emitCodePoint(1===t?n[e]&~BinTrieFlags.VALUE_LENGTH:n[e+1],r),3===t&&this.emitCodePoint(n[e+2],r),r}end(){var e;switch(this.state){case EntityDecoderState.NamedEntity:return 0===this.result||this.decodeMode===DecodingMode.Attribute&&this.result!==this.treeIndex?0:this.emitNotTerminatedNamedEntity();case EntityDecoderState.NumericDecimal:return this.emitNumericEntity(0,2);case EntityDecoderState.NumericHex:return this.emitNumericEntity(0,3);case EntityDecoderState.NumericStart:return null===(e=this.errors)||void 0===e||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case EntityDecoderState.EntityStart:return 0}}}function getDecoder(e){let t=""
|
|
1184
1184
|
;const r=new EntityDecoder(e,e=>t+=fromCodePoint$1(e));return function(e,n){let i=0,s=0;for(;(s=e.indexOf("&",s))>=0;){t+=e.slice(i,s),r.startEntity(n);const o=r.write(e,s+1);if(o<0){i=s+r.end();break}i=s+o,s=0===o?i+1:i}const o=t+e.slice(i);return t="",o}}function determineBranch(e,t,r,n){const i=(t&BinTrieFlags.BRANCH_LENGTH)>>7,s=t&BinTrieFlags.JUMP_TABLE;if(0===i)return 0!==s&&n===s?r:-1;if(s){const t=n-s;return t<0||t>=i?-1:e[r+t]-1}let o=r,a=o+i-1;for(;o<=a;){const t=o+a>>>1,r=e[t];if(r<n)o=t+1;else{if(!(r>n))return e[t+i];a=t-1}}return-1}const htmlDecoder=getDecoder(htmlDecodeTree);function decodeHTML(e,t=DecodingMode.Legacy){return htmlDecoder(e,t)}function _class$1(e){return Object.prototype.toString.call(e)}function isString$2(e){return"[object String]"===_class$1(e)}getDecoder(xmlDecodeTree);const _hasOwnProperty=Object.prototype.hasOwnProperty;function has$1(e,t){return _hasOwnProperty.call(e,t)}function assign$2(e){
|
|
1185
1185
|
return Array.prototype.slice.call(arguments,1).forEach(function(t){if(t){if("object"!=typeof t)throw new TypeError(t+"must be object");Object.keys(t).forEach(function(r){e[r]=t[r]})}}),e}function arrayReplaceAt(e,t,r){return[].concat(e.slice(0,t),r,e.slice(t+1))}function isValidEntityCode(e){return!(e>=55296&&e<=57343)&&(!(e>=64976&&e<=65007)&&(!!(65535&~e&&65534!=(65535&e))&&(!(e>=0&&e<=8)&&(11!==e&&(!(e>=14&&e<=31)&&(!(e>=127&&e<=159)&&!(e>1114111)))))))}function fromCodePoint(e){if(e>65535){const t=55296+((e-=65536)>>10),r=56320+(1023&e);return String.fromCharCode(t,r)}return String.fromCharCode(e)}const UNESCAPE_MD_RE=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,ENTITY_RE=/&([a-z#][a-z0-9]{1,31});/gi,UNESCAPE_ALL_RE=new RegExp(UNESCAPE_MD_RE.source+"|"+ENTITY_RE.source,"gi"),DIGITAL_ENTITY_TEST_RE=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function replaceEntityPattern(e,t){if(35===t.charCodeAt(0)&&DIGITAL_ENTITY_TEST_RE.test(t)){
|
|
1186
|
-
const r="x"===t[1].toLowerCase()?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return isValidEntityCode(r)?fromCodePoint(r):e}const r=decodeHTML(e);return r!==e?r:e}function unescapeMd(e){return e.indexOf("\\")<0?e:e.replace(UNESCAPE_MD_RE,"$1")}function unescapeAll(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(UNESCAPE_ALL_RE,function(e,t,r){return t||replaceEntityPattern(e,r)})}const HTML_ESCAPE_TEST_RE=/[&<>"]/,HTML_ESCAPE_REPLACE_RE=/[&<>"]/g,HTML_REPLACEMENTS={"&":"&","<":"<",">":">",'"':"""};function replaceUnsafeChar(e){return HTML_REPLACEMENTS[e]}function escapeHtml$2(e){return HTML_ESCAPE_TEST_RE.test(e)?e.replace(HTML_ESCAPE_REPLACE_RE,replaceUnsafeChar):e}const REGEXP_ESCAPE_RE=/[.?*+^$[\]\\(){}|-]/g;function escapeRE$1(e){return e.replace(REGEXP_ESCAPE_RE,"\\$&")}function isSpace(e){switch(e){case 9:case 32:return!0}return!1}function isWhiteSpace(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:
|
|
1187
|
-
case 5760:case 8239:case 8287:case 12288:return!0}return!1}function isPunctChar(e){return P.test(e)||regex.test(e)}function isMdAsciiPunct(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function normalizeReference(e){return e=e.trim().replace(/\s+/g," "),"Ṿ"==="ẞ".toLowerCase()&&(e=e.replace(/ẞ/g,"ß")),e.toLowerCase().toUpperCase()}const lib$5={mdurl,ucmicro};var utils$9=Object.freeze({__proto__:null,arrayReplaceAt,assign:assign$2,escapeHtml:escapeHtml$2,escapeRE:escapeRE$1,fromCodePoint,has:has$1,isMdAsciiPunct,isPunctChar,isSpace,isString:isString$2,isValidEntityCode,isWhiteSpace,lib:lib$5,normalizeReference,unescapeAll,unescapeMd});function parseLinkLabel(e,t,r){let n,i,s,o;const a=e.posMax,c=e.pos;for(e.pos=t+1,
|
|
1188
|
-
if(s=e.src.charCodeAt(e.pos),93===s&&(n--,0===n)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),91===s)if(o===e.pos-1)n++;else if(r)return e.pos=c,-1}let u=-1;return i&&(u=e.pos),e.pos=c,u}function parseLinkDestination(e,t,r){let n,i=t;const s={ok:!1,pos:0,str:""};if(60===e.charCodeAt(i)){for(i++;i<r;){if(n=e.charCodeAt(i),10===n)return s;if(60===n)return s;if(62===n)return s.pos=i+1,s.str=unescapeAll(e.slice(t+1,i)),s.ok=!0,s;92===n&&i+1<r?i+=2:i++}return s}let o=0;for(;i<r&&(n=e.charCodeAt(i),32!==n)&&!(n<32||127===n);)if(92===n&&i+1<r){if(32===e.charCodeAt(i+1))break;i+=2}else{if(40===n&&(o++,o>32))return s;if(41===n){if(0===o)break;o--}i++}return t===i||0!==o||(s.str=unescapeAll(e.slice(t,i)),s.pos=i,s.ok=!0),s}function parseLinkTitle(e,t,r,n){let i,s=t;const o={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(n)o.str=n.str,o.marker=n.marker;else{if(s>=r)return o;let n=e.charCodeAt(s);if(34!==n&&39!==n&&40!==n)return o;t++,s++,40===n&&(n=41),o.marker=n}for(;s<r;){
|
|
1186
|
+
const r="x"===t[1].toLowerCase()?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return isValidEntityCode(r)?fromCodePoint(r):e}const r=decodeHTML(e);return r!==e?r:e}function unescapeMd(e){return e.indexOf("\\")<0?e:e.replace(UNESCAPE_MD_RE,"$1")}function unescapeAll(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(UNESCAPE_ALL_RE,function(e,t,r){return t||replaceEntityPattern(e,r)})}const HTML_ESCAPE_TEST_RE=/[&<>"]/,HTML_ESCAPE_REPLACE_RE=/[&<>"]/g,HTML_REPLACEMENTS={"&":"&","<":"<",">":">",'"':"""};function replaceUnsafeChar(e){return HTML_REPLACEMENTS[e]}function escapeHtml$2(e){return HTML_ESCAPE_TEST_RE.test(e)?e.replace(HTML_ESCAPE_REPLACE_RE,replaceUnsafeChar):e}const REGEXP_ESCAPE_RE=/[.?*+^$[\]\\(){}|-]/g;function escapeRE$1(e){return e.replace(REGEXP_ESCAPE_RE,"\\$&")}function isSpace(e){switch(e){case 9:case 32:return!0}return!1}function isWhiteSpace$1(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:
|
|
1187
|
+
case 5760:case 8239:case 8287:case 12288:return!0}return!1}function isPunctChar(e){return P.test(e)||regex.test(e)}function isMdAsciiPunct(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function normalizeReference(e){return e=e.trim().replace(/\s+/g," "),"Ṿ"==="ẞ".toLowerCase()&&(e=e.replace(/ẞ/g,"ß")),e.toLowerCase().toUpperCase()}const lib$5={mdurl,ucmicro};var utils$9=Object.freeze({__proto__:null,arrayReplaceAt,assign:assign$2,escapeHtml:escapeHtml$2,escapeRE:escapeRE$1,fromCodePoint,has:has$1,isMdAsciiPunct,isPunctChar,isSpace,isString:isString$2,isValidEntityCode,isWhiteSpace:isWhiteSpace$1,lib:lib$5,normalizeReference,unescapeAll,unescapeMd});function parseLinkLabel(e,t,r){let n,i,s,o;const a=e.posMax,c=e.pos;for(e.pos=t+1,
|
|
1188
|
+
n=1;e.pos<a;){if(s=e.src.charCodeAt(e.pos),93===s&&(n--,0===n)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),91===s)if(o===e.pos-1)n++;else if(r)return e.pos=c,-1}let u=-1;return i&&(u=e.pos),e.pos=c,u}function parseLinkDestination(e,t,r){let n,i=t;const s={ok:!1,pos:0,str:""};if(60===e.charCodeAt(i)){for(i++;i<r;){if(n=e.charCodeAt(i),10===n)return s;if(60===n)return s;if(62===n)return s.pos=i+1,s.str=unescapeAll(e.slice(t+1,i)),s.ok=!0,s;92===n&&i+1<r?i+=2:i++}return s}let o=0;for(;i<r&&(n=e.charCodeAt(i),32!==n)&&!(n<32||127===n);)if(92===n&&i+1<r){if(32===e.charCodeAt(i+1))break;i+=2}else{if(40===n&&(o++,o>32))return s;if(41===n){if(0===o)break;o--}i++}return t===i||0!==o||(s.str=unescapeAll(e.slice(t,i)),s.pos=i,s.ok=!0),s}function parseLinkTitle(e,t,r,n){let i,s=t;const o={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(n)o.str=n.str,o.marker=n.marker;else{if(s>=r)return o;let n=e.charCodeAt(s);if(34!==n&&39!==n&&40!==n)return o;t++,s++,40===n&&(n=41),o.marker=n}for(;s<r;){
|
|
1189
1189
|
if(i=e.charCodeAt(s),i===o.marker)return o.pos=s+1,o.str+=unescapeAll(e.slice(t,s)),o.ok=!0,o;if(40===i&&41===o.marker)return o;92===i&&s+1<r&&s++,s++}return o.can_continue=!0,o.str+=unescapeAll(e.slice(t,s)),o}var helpers=Object.freeze({__proto__:null,parseLinkDestination,parseLinkLabel,parseLinkTitle});const default_rules={};function Renderer(){this.rules=assign$2({},default_rules)}function Ruler(){this.__rules__=[],this.__cache__=null}function Token(e,t,r){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=r,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}function StateCore(e,t,r){this.src=e,this.env=r,this.tokens=[],this.inlineMode=!1,this.md=t}default_rules.code_inline=function(e,t,r,n,i){const s=e[t];return"<code"+i.renderAttrs(s)+">"+escapeHtml$2(s.content)+"</code>"},default_rules.code_block=function(e,t,r,n,i){const s=e[t]
|
|
1190
1190
|
;return"<pre"+i.renderAttrs(s)+"><code>"+escapeHtml$2(e[t].content)+"</code></pre>\n"},default_rules.fence=function(e,t,r,n,i){const s=e[t],o=s.info?unescapeAll(s.info).trim():"";let a,c="",u="";if(o){const e=o.split(/(\s+)/g);c=e[0],u=e.slice(2).join("")}if(a=r.highlight&&r.highlight(s.content,c,u)||escapeHtml$2(s.content),0===a.indexOf("<pre"))return a+"\n";if(o){const e=s.attrIndex("class"),t=s.attrs?s.attrs.slice():[];e<0?t.push(["class",r.langPrefix+c]):(t[e]=t[e].slice(),t[e][1]+=" "+r.langPrefix+c);const n={attrs:t};return`<pre><code${i.renderAttrs(n)}>${a}</code></pre>\n`}return`<pre><code${i.renderAttrs(s)}>${a}</code></pre>\n`},default_rules.image=function(e,t,r,n,i){const s=e[t];return s.attrs[s.attrIndex("alt")][1]=i.renderInlineAsText(s.children,r,n),i.renderToken(e,t,r)},default_rules.hardbreak=function(e,t,r){return r.xhtmlOut?"<br />\n":"<br>\n"},default_rules.softbreak=function(e,t,r){return r.breaks?r.xhtmlOut?"<br />\n":"<br>\n":"\n"},
|
|
1191
1191
|
default_rules.text=function(e,t){return escapeHtml$2(e[t].content)},default_rules.html_block=function(e,t){return e[t].content},default_rules.html_inline=function(e,t){return e[t].content},Renderer.prototype.renderAttrs=function(e){let t,r,n;if(!e.attrs)return"";for(n="",t=0,r=e.attrs.length;t<r;t++)n+=" "+escapeHtml$2(e.attrs[t][0])+'="'+escapeHtml$2(e.attrs[t][1])+'"';return n},Renderer.prototype.renderToken=function(e,t,r){const n=e[t];let i="";if(n.hidden)return"";n.block&&-1!==n.nesting&&t&&e[t-1].hidden&&(i+="\n"),i+=(-1===n.nesting?"</":"<")+n.tag,i+=this.renderAttrs(n),0===n.nesting&&r.xhtmlOut&&(i+=" /");let s=!1;if(n.block&&(s=!0,1===n.nesting&&t+1<e.length)){const r=e[t+1];("inline"===r.type||r.hidden||-1===r.nesting&&r.tag===n.tag)&&(s=!1)}return i+=s?">\n":">",i},Renderer.prototype.renderInline=function(e,t,r){let n="";const i=this.rules;for(let s=0,o=e.length;s<o;s++){const o=e[s].type;void 0!==i[o]?n+=i[o](e,s,t,r,this):n+=this.renderToken(e,s,t)}return n},
|
|
@@ -1196,7 +1196,7 @@ r.push(e)},this),this.__cache__=null,r},Ruler.prototype.enableOnly=function(e,t)
|
|
|
1196
1196
|
const o=n[s];if("link_close"!==o.type){if("html_inline"===o.type&&(isLinkOpen$1(o.content)&&i>0&&i--,isLinkClose$1(o.content)&&i++),!(i>0)&&"text"===o.type&&e.md.linkify.test(o.content)){const i=o.content;let a=e.md.linkify.match(i);const c=[];let u=o.level,l=0;a.length>0&&0===a[0].index&&s>0&&"text_special"===n[s-1].type&&(a=a.slice(1));for(let t=0;t<a.length;t++){const r=a[t].url,n=e.md.normalizeLink(r);if(!e.md.validateLink(n))continue;let s=a[t].text;s=a[t].schema?"mailto:"!==a[t].schema||/^mailto:/i.test(s)?e.md.normalizeLinkText(s):e.md.normalizeLinkText("mailto:"+s).replace(/^mailto:/,""):e.md.normalizeLinkText("http://"+s).replace(/^http:\/\//,"");const o=a[t].index;if(o>l){const t=new e.Token("text","",0);t.content=i.slice(l,o),t.level=u,c.push(t)}const d=new e.Token("link_open","a",1);d.attrs=[["href",n]],d.level=u++,d.markup="linkify",d.info="auto",c.push(d);const p=new e.Token("text","",0);p.content=s,p.level=u,c.push(p);const h=new e.Token("link_close","a",-1);h.level=--u,
|
|
1197
1197
|
h.markup="linkify",h.info="auto",c.push(h),l=a[t].lastIndex}if(l<i.length){const t=new e.Token("text","",0);t.content=i.slice(l),t.level=u,c.push(t)}t[r].children=n=arrayReplaceAt(n,s,c)}}else for(s--;n[s].level!==o.level&&"link_open"!==n[s].type;)s--}}}const RARE_RE=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,SCOPED_ABBR_TEST_RE=/\((c|tm|r)\)/i,SCOPED_ABBR_RE=/\((c|tm|r)\)/gi,SCOPED_ABBR={c:"©",r:"®",tm:"™"};function replaceFn(e,t){return SCOPED_ABBR[t.toLowerCase()]}function replace_scoped(e){let t=0;for(let r=e.length-1;r>=0;r--){const n=e[r];"text"!==n.type||t||(n.content=n.content.replace(SCOPED_ABBR_RE,replaceFn)),"link_open"===n.type&&"auto"===n.info&&t--,"link_close"===n.type&&"auto"===n.info&&t++}}function replace_rare(e){let t=0;for(let r=e.length-1;r>=0;r--){const n=e[r]
|
|
1198
1198
|
;"text"!==n.type||t||RARE_RE.test(n.content)&&(n.content=n.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1—").replace(/(^|\s)--(?=\s|$)/gm,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1–")),"link_open"===n.type&&"auto"===n.info&&t--,"link_close"===n.type&&"auto"===n.info&&t++}}function replace(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)"inline"===e.tokens[t].type&&(SCOPED_ABBR_TEST_RE.test(e.tokens[t].content)&&replace_scoped(e.tokens[t].children),RARE_RE.test(e.tokens[t].content)&&replace_rare(e.tokens[t].children))}const QUOTE_TEST_RE=/['"]/,QUOTE_RE=/['"]/g,APOSTROPHE="’";function replaceAt(e,t,r){return e.slice(0,t)+r+e.slice(t+1)}function process_inlines(e,t){let r;const n=[];for(let i=0;i<e.length;i++){const s=e[i],o=e[i].level;for(r=n.length-1;r>=0&&!(n[r].level<=o);r--);if(n.length=r+1,"text"!==s.type)continue
|
|
1199
|
-
;let a=s.content,c=0,u=a.length;e:for(;c<u;){QUOTE_RE.lastIndex=c;const l=QUOTE_RE.exec(a);if(!l)break;let d=!0,p=!0;c=l.index+1;const h="'"===l[0];let A=32;if(l.index-1>=0)A=a.charCodeAt(l.index-1);else for(r=i-1;r>=0&&("softbreak"!==e[r].type&&"hardbreak"!==e[r].type);r--)if(e[r].content){A=e[r].content.charCodeAt(e[r].content.length-1);break}let f=32;if(c<u)f=a.charCodeAt(c);else for(r=i+1;r<e.length&&("softbreak"!==e[r].type&&"hardbreak"!==e[r].type);r++)if(e[r].content){f=e[r].content.charCodeAt(0);break}const g=isMdAsciiPunct(A)||isPunctChar(String.fromCharCode(A)),m=isMdAsciiPunct(f)||isPunctChar(String.fromCharCode(f)),y=isWhiteSpace(A),E=isWhiteSpace(f);if(E?d=!1:m&&(y||g||(d=!1)),y?p=!1:g&&(E||m||(p=!1)),34===f&&'"'===l[0]&&A>=48&&A<=57&&(p=d=!1),d&&p&&(d=g,p=m),d||p){if(p)for(r=n.length-1;r>=0;r--){let d=n[r];if(n[r].level<o)break;if(d.single===h&&n[r].level===o){let o,p;d=n[r],h?(o=t.md.options.quotes[2],p=t.md.options.quotes[3]):(o=t.md.options.quotes[0],
|
|
1199
|
+
;let a=s.content,c=0,u=a.length;e:for(;c<u;){QUOTE_RE.lastIndex=c;const l=QUOTE_RE.exec(a);if(!l)break;let d=!0,p=!0;c=l.index+1;const h="'"===l[0];let A=32;if(l.index-1>=0)A=a.charCodeAt(l.index-1);else for(r=i-1;r>=0&&("softbreak"!==e[r].type&&"hardbreak"!==e[r].type);r--)if(e[r].content){A=e[r].content.charCodeAt(e[r].content.length-1);break}let f=32;if(c<u)f=a.charCodeAt(c);else for(r=i+1;r<e.length&&("softbreak"!==e[r].type&&"hardbreak"!==e[r].type);r++)if(e[r].content){f=e[r].content.charCodeAt(0);break}const g=isMdAsciiPunct(A)||isPunctChar(String.fromCharCode(A)),m=isMdAsciiPunct(f)||isPunctChar(String.fromCharCode(f)),y=isWhiteSpace$1(A),E=isWhiteSpace$1(f);if(E?d=!1:m&&(y||g||(d=!1)),y?p=!1:g&&(E||m||(p=!1)),34===f&&'"'===l[0]&&A>=48&&A<=57&&(p=d=!1),d&&p&&(d=g,p=m),d||p){if(p)for(r=n.length-1;r>=0;r--){let d=n[r];if(n[r].level<o)break;if(d.single===h&&n[r].level===o){let o,p;d=n[r],h?(o=t.md.options.quotes[2],p=t.md.options.quotes[3]):(o=t.md.options.quotes[0],
|
|
1200
1200
|
p=t.md.options.quotes[1]),s.content=replaceAt(s.content,l.index,p),e[d.token].content=replaceAt(e[d.token].content,d.pos,o),c+=p.length-1,d.token===i&&(c+=o.length-1),a=s.content,u=a.length,n.length=r;continue e}}d?n.push({token:i,pos:l.index,single:h,level:o}):p&&h&&(s.content=replaceAt(s.content,l.index,APOSTROPHE))}else h&&(s.content=replaceAt(s.content,l.index,APOSTROPHE))}}}function smartquotes(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)"inline"===e.tokens[t].type&"E_TEST_RE.test(e.tokens[t].content)&&process_inlines(e.tokens[t].children,e)}function text_join(e){let t,r;const n=e.tokens,i=n.length;for(let e=0;e<i;e++){if("inline"!==n[e].type)continue;const i=n[e].children,s=i.length;for(t=0;t<s;t++)"text_special"===i[t].type&&(i[t].type="text");for(t=r=0;t<s;t++)"text"===i[t].type&&t+1<s&&"text"===i[t+1].type?i[t+1].content=i[t].content+i[t+1].content:(t!==r&&(i[r]=i[t]),r++);t!==r&&(i.length=r)}}
|
|
1201
1201
|
const _rules$2=[["normalize",normalize],["block",block$1],["inline",inline],["linkify",linkify$1],["replacements",replace],["smartquotes",smartquotes],["text_join",text_join]];function Core(){this.ruler=new Ruler;for(let e=0;e<_rules$2.length;e++)this.ruler.push(_rules$2[e][0],_rules$2[e][1])}function StateBlock(e,t,r,n){this.src=e,this.md=t,this.env=r,this.tokens=n,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const i=this.src;for(let e=0,t=0,r=0,n=0,s=i.length,o=!1;t<s;t++){const a=i.charCodeAt(t);if(!o){if(isSpace(a)){r++,9===a?n+=4-n%4:n++;continue}o=!0}10!==a&&t!==s-1||(10!==a&&t++,this.bMarks.push(e),this.eMarks.push(t),this.tShift.push(r),this.sCount.push(n),this.bsCount.push(0),o=!1,r=0,n=0,e=t+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),
|
|
1202
1202
|
this.lineMax=this.bMarks.length-1}Core.prototype.process=function(e){const t=this.ruler.getRules("");for(let r=0,n=t.length;r<n;r++)t[r](e)},Core.prototype.State=StateCore,StateBlock.prototype.push=function(e,t,r){const n=new Token(e,t,r);return n.block=!0,r<0&&this.level--,n.level=this.level,r>0&&this.level++,this.tokens.push(n),n},StateBlock.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},StateBlock.prototype.skipEmptyLines=function(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},StateBlock.prototype.skipSpaces=function(e){for(let t=this.src.length;e<t;e++){if(!isSpace(this.src.charCodeAt(e)))break}return e},StateBlock.prototype.skipSpacesBack=function(e,t){if(e<=t)return e;for(;e>t;)if(!isSpace(this.src.charCodeAt(--e)))return e+1;return e},StateBlock.prototype.skipChars=function(e,t){for(let r=this.src.length;e<r&&this.src.charCodeAt(e)===t;e++);return e},
|
|
@@ -1219,7 +1219,7 @@ if(t+2>r)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent)return!1;if(e.sCount[i]-e
|
|
|
1219
1219
|
const _rules$1=[["table",table$1,["paragraph","reference"]],["code",code],["fence",fence,["paragraph","reference","blockquote","list"]],["blockquote",blockquote,["paragraph","reference","blockquote","list"]],["hr",hr,["paragraph","reference","blockquote","list"]],["list",list,["paragraph","reference","blockquote"]],["reference",reference],["html_block",html_block,["paragraph","reference","blockquote"]],["heading",heading,["paragraph","reference","blockquote"]],["lheading",lheading],["paragraph",paragraph]];function ParserBlock(){this.ruler=new Ruler;for(let e=0;e<_rules$1.length;e++)this.ruler.push(_rules$1[e][0],_rules$1[e][1],{alt:(_rules$1[e][2]||[]).slice()})}function StateInline(e,t,r,n){this.src=e,this.env=r,this.md=t,this.tokens=n,this.tokens_meta=Array(n.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}
|
|
1220
1220
|
function isTerminatorChar(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function text(e,t){let r=e.pos;for(;r<e.posMax&&!isTerminatorChar(e.src.charCodeAt(r));)r++;return r!==e.pos&&(t||(e.pending+=e.src.slice(e.pos,r)),e.pos=r,!0)}ParserBlock.prototype.tokenize=function(e,t,r){const n=this.ruler.getRules(""),i=n.length,s=e.md.options.maxNesting;let o=t,a=!1;for(;o<r&&(e.line=o=e.skipEmptyLines(o),!(o>=r))&&!(e.sCount[o]<e.blkIndent);){if(e.level>=s){e.line=r;break}const t=e.line;let c=!1;for(let s=0;s<i;s++)if(c=n[s](e,o,r,!1),c){if(t>=e.line)throw new Error("block rule didn't increment state.line");break}if(!c)throw new Error("none of the block rules matched");e.tight=!a,e.isEmpty(e.line-1)&&(a=!0),o=e.line,o<r&&e.isEmpty(o)&&(a=!0,o++,e.line=o)}},ParserBlock.prototype.parse=function(e,t,r,n){if(!e)return
|
|
1221
1221
|
;const i=new this.State(e,t,r,n);this.tokenize(i,i.line,i.lineMax)},ParserBlock.prototype.State=StateBlock,StateInline.prototype.pushPending=function(){const e=new Token("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e},StateInline.prototype.push=function(e,t,r){this.pending&&this.pushPending();const n=new Token(e,t,r);let i=null;return r<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),n.level=this.level,r>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(i),n},StateInline.prototype.scanDelims=function(e,t){const r=this.posMax,n=this.src.charCodeAt(e),i=e>0?this.src.charCodeAt(e-1):32;let s=e;for(;s<r&&this.src.charCodeAt(s)===n;)s++
|
|
1222
|
-
;const o=s-e,a=s<r?this.src.charCodeAt(s):32,c=isMdAsciiPunct(i)||isPunctChar(String.fromCharCode(i)),u=isMdAsciiPunct(a)||isPunctChar(String.fromCharCode(a)),l=isWhiteSpace(i),d=isWhiteSpace(a),p=!d&&(!u||l||c),h=!l&&(!c||d||u);return{can_open:p&&(t||!h||c),can_close:h&&(t||!p||u),length:o}},StateInline.prototype.Token=Token;const SCHEME_RE=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function linkify(e,t){if(!e.md.options.linkify)return!1;if(e.linkLevel>0)return!1;const r=e.pos;if(r+3>e.posMax)return!1;if(58!==e.src.charCodeAt(r))return!1;if(47!==e.src.charCodeAt(r+1))return!1;if(47!==e.src.charCodeAt(r+2))return!1;const n=e.pending.match(SCHEME_RE);if(!n)return!1;const i=n[1],s=e.md.linkify.matchAtStart(e.src.slice(r-i.length));if(!s)return!1;let o=s.url;if(o.length<=i.length)return!1;o=o.replace(/\*+$/,"");const a=e.md.normalizeLink(o);if(!e.md.validateLink(a))return!1;if(!t){e.pending=e.pending.slice(0,-i.length);const t=e.push("link_open","a",1);t.attrs=[["href",a]],
|
|
1222
|
+
;const o=s-e,a=s<r?this.src.charCodeAt(s):32,c=isMdAsciiPunct(i)||isPunctChar(String.fromCharCode(i)),u=isMdAsciiPunct(a)||isPunctChar(String.fromCharCode(a)),l=isWhiteSpace$1(i),d=isWhiteSpace$1(a),p=!d&&(!u||l||c),h=!l&&(!c||d||u);return{can_open:p&&(t||!h||c),can_close:h&&(t||!p||u),length:o}},StateInline.prototype.Token=Token;const SCHEME_RE=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function linkify(e,t){if(!e.md.options.linkify)return!1;if(e.linkLevel>0)return!1;const r=e.pos;if(r+3>e.posMax)return!1;if(58!==e.src.charCodeAt(r))return!1;if(47!==e.src.charCodeAt(r+1))return!1;if(47!==e.src.charCodeAt(r+2))return!1;const n=e.pending.match(SCHEME_RE);if(!n)return!1;const i=n[1],s=e.md.linkify.matchAtStart(e.src.slice(r-i.length));if(!s)return!1;let o=s.url;if(o.length<=i.length)return!1;o=o.replace(/\*+$/,"");const a=e.md.normalizeLink(o);if(!e.md.validateLink(a))return!1;if(!t){e.pending=e.pending.slice(0,-i.length);const t=e.push("link_open","a",1);t.attrs=[["href",a]],
|
|
1223
1223
|
t.markup="linkify",t.info="auto";e.push("text","",0).content=e.md.normalizeLinkText(o);const r=e.push("link_close","a",-1);r.markup="linkify",r.info="auto"}return e.pos+=o.length-i.length,!0}function newline(e,t){let r=e.pos;if(10!==e.src.charCodeAt(r))return!1;const n=e.pending.length-1,i=e.posMax;if(!t)if(n>=0&&32===e.pending.charCodeAt(n))if(n>=1&&32===e.pending.charCodeAt(n-1)){let t=n-1;for(;t>=1&&32===e.pending.charCodeAt(t-1);)t--;e.pending=e.pending.slice(0,t),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(r++;r<i&&isSpace(e.src.charCodeAt(r));)r++;return e.pos=r,!0}const ESCAPED=[];for(let e=0;e<256;e++)ESCAPED.push(0);function escape$1(e,t){let r=e.pos;const n=e.posMax;if(92!==e.src.charCodeAt(r))return!1;if(r++,r>=n)return!1;let i=e.src.charCodeAt(r);if(10===i){for(t||e.push("hardbreak","br",0),r++;r<n&&(i=e.src.charCodeAt(r),isSpace(i));)r++;return e.pos=r,!0}let s=e.src[r]
|
|
1224
1224
|
;if(i>=55296&&i<=56319&&r+1<n){const t=e.src.charCodeAt(r+1);t>=56320&&t<=57343&&(s+=e.src[r+1],r++)}const o="\\"+s;if(!t){const t=e.push("text_special","",0);i<256&&0!==ESCAPED[i]?t.content=s:t.content=o,t.markup=o,t.info="escape"}return e.pos=r+1,!0}function backtick(e,t){let r=e.pos;if(96!==e.src.charCodeAt(r))return!1;const n=r;r++;const i=e.posMax;for(;r<i&&96===e.src.charCodeAt(r);)r++;const s=e.src.slice(n,r),o=s.length;if(e.backticksScanned&&(e.backticks[o]||0)<=n)return t||(e.pending+=s),e.pos+=o,!0;let a,c=r;for(;-1!==(a=e.src.indexOf("`",c));){for(c=a+1;c<i&&96===e.src.charCodeAt(c);)c++;const n=c-a;if(n===o){if(!t){const t=e.push("code_inline","code",0);t.markup=s,t.content=e.src.slice(r,a).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return e.pos=c,!0}e.backticks[n]=a}return e.backticksScanned=!0,t||(e.pending+=s),e.pos+=o,!0}function strikethrough_tokenize(e,t){const r=e.pos,n=e.src.charCodeAt(r);if(t)return!1;if(126!==n)return!1;const i=e.scanDelims(e.pos,!0)
|
|
1225
1225
|
;let s=i.length;const o=String.fromCharCode(n);if(s<2)return!1;let a;s%2&&(a=e.push("text","",0),a.content=o,s--);for(let t=0;t<s;t+=2)a=e.push("text","",0),a.content=o+o,e.delimiters.push({marker:n,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function postProcess$2(e,t){let r;const n=[],i=t.length;for(let s=0;s<i;s++){const i=t[s];if(126!==i.marker)continue;if(-1===i.end)continue;const o=t[i.end];r=e.tokens[i.token],r.type="s_open",r.tag="s",r.nesting=1,r.markup="~~",r.content="",r=e.tokens[o.token],r.type="s_close",r.tag="s",r.nesting=-1,r.markup="~~",r.content="","text"===e.tokens[o.token-1].type&&"~"===e.tokens[o.token-1].content&&n.push(o.token-1)}for(;n.length;){const t=n.pop();let i=t+1;for(;i<e.tokens.length&&"s_close"===e.tokens[i].type;)i++;i--,t!==i&&(r=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=r)}}function strikethrough_postProcess(e){const t=e.tokens_meta,r=e.tokens_meta.length;postProcess$2(e,e.delimiters)
|
|
@@ -1235,11 +1235,11 @@ const _rules=[["text",text],["linkify",linkify],["newline",newline],["escape",es
|
|
|
1235
1235
|
t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|[><|]|"+t.src_ZPCc+")(?!"+(e["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|"+r+"|[()[\\]{}.,\"'?!\\-;]).|\\[(?:(?!"+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+t.src_ZCc+"|[.]|$)|"+(e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+t.src_ZCc+"|$)|;(?!"+t.src_ZCc+"|$)|\\!+(?!"+t.src_ZCc+"|[!]|$)|\\?(?!"+t.src_ZCc+"|[?]|$))+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',t.src_xn="xn--[a-z0-9\\-]{1,59}",
|
|
1236
1236
|
t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy='(^|[><|]|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",
|
|
1237
1237
|
t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}function assign$1(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(r){e[r]=t[r]})}),e}function _class(e){return Object.prototype.toString.call(e)}function isString$1(e){return"[object String]"===_class(e)}function isObject$4(e){return"[object Object]"===_class(e)}function isRegExp(e){return"[object RegExp]"===_class(e)}function isFunction$2(e){return"[object Function]"===_class(e)}function escapeRE(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}ParserInline.prototype.skipToken=function(e){const t=e.pos,r=this.ruler.getRules(""),n=r.length,i=e.md.options.maxNesting,s=e.cache;if(void 0!==s[t])return void(e.pos=s[t]);let o=!1;if(e.level<i){
|
|
1238
|
-
for(let i=0;i<n;i++)if(e.level++,o=r[i](e,!0),e.level--,o){if(t>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;o||e.pos++,s[t]=e.pos},ParserInline.prototype.tokenize=function(e){const t=this.ruler.getRules(""),r=t.length,n=e.posMax,i=e.md.options.maxNesting;for(;e.pos<n;){const s=e.pos;let o=!1;if(e.level<i)for(let n=0;n<r;n++)if(o=t[n](e,!1),o){if(s>=e.pos)throw new Error("inline rule didn't increment state.pos");break}if(o){if(e.pos>=n)break}else e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},ParserInline.prototype.parse=function(e,t,r,n){const i=new this.State(e,t,r,n);this.tokenize(i);const s=this.ruler2.getRules(""),o=s.length;for(let e=0;e<o;e++)s[e](i)},ParserInline.prototype.State=StateInline;const defaultOptions$
|
|
1238
|
+
for(let i=0;i<n;i++)if(e.level++,o=r[i](e,!0),e.level--,o){if(t>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;o||e.pos++,s[t]=e.pos},ParserInline.prototype.tokenize=function(e){const t=this.ruler.getRules(""),r=t.length,n=e.posMax,i=e.md.options.maxNesting;for(;e.pos<n;){const s=e.pos;let o=!1;if(e.level<i)for(let n=0;n<r;n++)if(o=t[n](e,!1),o){if(s>=e.pos)throw new Error("inline rule didn't increment state.pos");break}if(o){if(e.pos>=n)break}else e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},ParserInline.prototype.parse=function(e,t,r,n){const i=new this.State(e,t,r,n);this.tokenize(i);const s=this.ruler2.getRules(""),o=s.length;for(let e=0;e<o;e++)s[e](i)},ParserInline.prototype.State=StateInline;const defaultOptions$4={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function isOptionsObj(e){return Object.keys(e||{}).reduce(function(e,t){return e||defaultOptions$4.hasOwnProperty(t)},!1)}const defaultSchemas={"http:":{
|
|
1239
1239
|
validate:function(e,t,r){const n=e.slice(t);return r.re.http||(r.re.http=new RegExp("^\\/\\/"+r.re.src_auth+r.re.src_host_port_strict+r.re.src_path,"i")),r.re.http.test(n)?n.match(r.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,r){const n=e.slice(t);return r.re.no_http||(r.re.no_http=new RegExp("^"+r.re.src_auth+"(?:localhost|(?:(?:"+r.re.src_domain+")\\.)+"+r.re.src_domain_root+")"+r.re.src_port+r.re.src_host_terminator+r.re.src_path,"i")),r.re.no_http.test(n)?t>=3&&":"===e[t-3]||t>=3&&"/"===e[t-3]?0:n.match(r.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,r){const n=e.slice(t);return r.re.mailto||(r.re.mailto=new RegExp("^"+r.re.src_email_name+"@"+r.re.src_host_strict,"i")),r.re.mailto.test(n)?n.match(r.re.mailto)[0].length:0}}
|
|
1240
1240
|
},tlds_2ch_src_re="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",tlds_default="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function resetScanCache(e){e.__index__=-1,e.__text_cache__=""}function createValidator(e){return function(t,r){const n=t.slice(r);return e.test(n)?n.match(e)[0].length:0}}function createNormalizer(){return function(e,t){t.normalize(e)}}function compile$1(e){const t=e.re=reFactory(e.__opts__),r=e.__tlds__.slice();function n(e){return e.replace("%TLDS%",t.src_tlds)}e.onCompile(),e.__tlds_replaced__||r.push(tlds_2ch_src_re),r.push(t.src_xn),t.src_tlds=r.join("|"),t.email_fuzzy=RegExp(n(t.tpl_email_fuzzy),"i"),
|
|
1241
1241
|
t.link_fuzzy=RegExp(n(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(n(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(n(t.tpl_host_fuzzy_test),"i");const i=[];function s(e,t){throw new Error('(LinkifyIt) Invalid schema "'+e+'": '+t)}e.__compiled__={},Object.keys(e.__schemas__).forEach(function(t){const r=e.__schemas__[t];if(null===r)return;const n={validate:null,link:null};if(e.__compiled__[t]=n,isObject$4(r))return isRegExp(r.validate)?n.validate=createValidator(r.validate):isFunction$2(r.validate)?n.validate=r.validate:s(t,r),void(isFunction$2(r.normalize)?n.normalize=r.normalize:r.normalize?s(t,r):n.normalize=createNormalizer());isString$1(r)?i.push(t):s(t,r)}),i.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[""]={validate:null,normalize:createNormalizer()}
|
|
1242
|
-
;const o=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(escapeRE).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+o+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+o+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),resetScanCache(e)}function Match(e,t){const r=e.__index__,n=e.__last_index__,i=e.__text_cache__.slice(r,n);this.schema=e.__schema__.toLowerCase(),this.index=r+t,this.lastIndex=n+t,this.raw=i,this.text=i,this.url=i}function createMatch(e,t){const r=new Match(e,t);return e.__compiled__[r.schema].normalize(r,e),r}function LinkifyIt(e,t){if(!(this instanceof LinkifyIt))return new LinkifyIt(e,t);t||isOptionsObj(e)&&(t=e,e={}),this.__opts__=assign$1({},defaultOptions$
|
|
1242
|
+
;const o=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(escapeRE).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+o+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+o+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),resetScanCache(e)}function Match(e,t){const r=e.__index__,n=e.__last_index__,i=e.__text_cache__.slice(r,n);this.schema=e.__schema__.toLowerCase(),this.index=r+t,this.lastIndex=n+t,this.raw=i,this.text=i,this.url=i}function createMatch(e,t){const r=new Match(e,t);return e.__compiled__[r.schema].normalize(r,e),r}function LinkifyIt(e,t){if(!(this instanceof LinkifyIt))return new LinkifyIt(e,t);t||isOptionsObj(e)&&(t=e,e={}),this.__opts__=assign$1({},defaultOptions$4,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",
|
|
1243
1243
|
this.__schemas__=assign$1({},defaultSchemas,e),this.__compiled__={},this.__tlds__=tlds_default,this.__tlds_replaced__=!1,this.re={},compile$1(this)}LinkifyIt.prototype.add=function(e,t){return this.__schemas__[e]=t,compile$1(this),this},LinkifyIt.prototype.set=function(e){return this.__opts__=assign$1(this.__opts__,e),this},LinkifyIt.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let t,r,n,i,s,o,a,c,u;if(this.re.schema_test.test(e))for(a=this.re.schema_search,a.lastIndex=0;null!==(t=a.exec(e));)if(i=this.testSchemaAt(e,t[2],a.lastIndex),i){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c<this.__index__)&&null!==(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))&&(s=r.index+r[1].length,
|
|
1244
1244
|
(this.__index__<0||s<this.__index__)&&(this.__schema__="",this.__index__=s,this.__last_index__=r.index+r[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(u=e.indexOf("@"),u>=0&&null!==(n=e.match(this.re.email_fuzzy))&&(s=n.index+n[1].length,o=n.index+n[0].length,(this.__index__<0||s<this.__index__||s===this.__index__&&o>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=o))),this.__index__>=0},LinkifyIt.prototype.pretest=function(e){return this.re.pretest.test(e)},LinkifyIt.prototype.testSchemaAt=function(e,t,r){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,r,this):0},LinkifyIt.prototype.match=function(e){const t=[];let r=0;this.__index__>=0&&this.__text_cache__===e&&(t.push(createMatch(this,r)),r=this.__last_index__);let n=r?e.slice(r):e;for(;this.test(n);)t.push(createMatch(this,r)),n=n.slice(this.__last_index__),r+=this.__last_index__;return t.length?t:null},
|
|
1245
1245
|
LinkifyIt.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const t=this.re.schema_at_start.exec(e);if(!t)return null;const r=this.testSchemaAt(e,t[2],t[0].length);return r?(this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+r,createMatch(this,0)):null},LinkifyIt.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,r){return e!==r[t-1]}).reverse(),compile$1(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,compile$1(this),this)},LinkifyIt.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),"mailto:"!==e.schema||/^mailto:/i.test(e.url)||(e.url="mailto:"+e.url)},LinkifyIt.prototype.onCompile=function(){}
|
|
@@ -1748,7 +1748,7 @@ return!(!e||"object"!=typeof e)&&(isShouldRetryFlag(e)?structuredClone(e[SCRIPT_
|
|
|
1748
1748
|
;e.startsWith("```json")&&e.endsWith("```")&&(i=e.substring(7,e.length-3).trim())}try{n=JSON.parse(i)}catch(e){throw allowRetries(new AggregateError([e],"asObject: error parsing json: "+i),{withDelay:!1})}try{return[e.parse(n),i]}catch(e){throw allowRetries(new AggregateError([e],"asObject: error validating json: "+JSON.stringify(n)),{withDelay:!1})}}async function sleepInterruptable(e,t){return new Promise((r,n)=>{const i=setTimeout$1(()=>{o(),r()},e);function s(){clearTimeout(i),o(),n(new Error("aborted during nap"))}function o(){t.removeEventListener("abort",s)}t.addEventListener("abort",s),t.aborted&&s()})}async function sleepUntil(e,t){const r=Date.now();if(e<=r)return;const n=e-r;await sleepInterruptable(n,t)}function _optionalChain$R(e){let t,r=e[0],n=1;for(;n<e.length;){const i=e[n],s=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=s(r)):"call"!==i&&"optionalCall"!==i||(r=s((...e)=>r.call(t,...e)),t=void 0)}
|
|
1749
1749
|
return r}async function streamFakeTypingEvents(e,t,r,n=Date.now(),i="yes"===process.env.SLOWMO){for(const[s,o]of t)i&&await sleepUntil(n+1e3*s,r),await _optionalChain$R([e,"optionalAccess",e=>e.chunk,"call",e=>e(o)]),throwWhenAborted(r)}function capturingTyper(e,t){const r=clock$2(),n=[];return{events:n,async start(){throwWhenAborted(e),await _optionalChain$R([t,"optionalAccess",e=>e.start,"call",e=>e()])},async chunk(i){throwWhenAborted(e),n.push([Number(clock$2()-r)/1e9,i]),await _optionalChain$R([t,"optionalAccess",e=>e.chunk,"call",e=>e(i)])},async countTokens(r){throwWhenAborted(e),await _optionalChain$R([t,"optionalAccess",e=>e.countTokens,"call",e=>e(r)])},async done(){throwWhenAborted(e),await _optionalChain$R([t,"optionalAccess",e=>e.done,"call",e=>e()])}}}function _nullishCoalesce$K(e,t){return null!=e?e:t()}function _optionalChain$Q(e){let t,r=e[0],n=1;for(;n<e.length;){const i=e[n],s=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return
|
|
1750
1750
|
;"access"===i||"optionalAccess"===i?(t=r,r=s(r)):"call"!==i&&"optionalCall"!==i||(r=s((...e)=>r.call(t,...e)),t=void 0)}return r}class LLMCacheMissError extends Error{constructor(e){super(`Expected an LLM cache hit but no matching entry was found for key ${e}`)}}function serializeInput(e,t){const{indent:r}=_nullishCoalesce$K(t,()=>({})),{args:n,...i}=e;return JSON.stringify({args:sortKeys(n,{deep:!0}),...i},void 0,r)}function cacheKey(e){const t=serializeInput(e);return base32.encode(createHash$1("sha512-256").update(t).digest()).replace(/=/g,"").toLowerCase()}function cacheWrapper(e,t,r){return{cacheKey:e.cacheKey,async streamFromMessages(n,i){const s=_optionalChain$Q([i,"optionalAccess",e=>e.respondObject,"optionalAccess",e=>e.schema]);return chatStreamBuilder(s,async o=>{let a=!1;const{string:c,events:u}=await r({method:"streamFromMessages",args:{messages:n},modelInfo:e.cacheKey,retryIdx:_optionalChain$Q([i,"optionalAccess",e=>e.retryIdx])},async()=>{a=!0
|
|
1751
|
-
;const r=capturingTyper(t,o),c=await e.streamFromMessages(n,i),u=await c.asString(r);return s&&await asObject(s,()=>u),{string:u,events:JSON.stringify(r.events)}});return a||await streamFakeTypingEvents(o,JSON.parse(u),t),c})}}}async function considerFsCaching(){if(!process.env.LLM_CACHE_DIR)return;const e=resolve$2(process.env.LLM_CACHE_DIR);return await fsp.mkdir(e,{recursive:!0}),e}async function fsCache(e,t,r){const n=cacheKey(t),i=resolve$2(e,`${n}.toml`),s=await readTextIfExists(i);if(s){return tomlExports.parse(s).output}if("mock"===process.env.LLM_MODE){const r=serializeInput(t,{indent:2});throw await writeText(resolve$2(e,`${n}.input.json`),r),new LLMCacheMissError(n)}if("record"===process.env.LLM_MODE||"real"===process.env.LLM_MODE){const e=process.env.TESSL_LLM_API_KEY;if("dummy-key-replace-me"===e||"a"===e)throw new Error("LLM key is set to dummy value. Please read the
|
|
1751
|
+
;const r=capturingTyper(t,o),c=await e.streamFromMessages(n,i),u=await c.asString(r);return s&&await asObject(s,()=>u),{string:u,events:JSON.stringify(r.events)}});return a||await streamFakeTypingEvents(o,JSON.parse(u),t),c})}}}async function considerFsCaching(){if(!process.env.LLM_CACHE_DIR)return;const e=resolve$2(process.env.LLM_CACHE_DIR);return await fsp.mkdir(e,{recursive:!0}),e}async function fsCache(e,t,r){const n=cacheKey(t),i=resolve$2(e,`${n}.toml`),s=await readTextIfExists(i);if(s){return tomlExports.parse(s).output}if("mock"===process.env.LLM_MODE){const r=serializeInput(t,{indent:2});throw await writeText(resolve$2(e,`${n}.input.json`),r),new LLMCacheMissError(n)}if("record"===process.env.LLM_MODE||"real"===process.env.LLM_MODE){const e=process.env.TESSL_LLM_API_KEY;if("dummy-key-replace-me"===e||"a"===e)throw new Error("LLM key is set to dummy value. Please read the e2e test documentation and set TESSL_LLM_API_KEY to a real key when recording LLM snapshots.")}
|
|
1752
1752
|
const o=await r(),a={input:t,output:o};return await writeText(i,tomlExports.stringify(a)),o}async function redisCache(e,t,r){const n="cache:1:"+cacheKey(t);_optionalChain$Q([trace$1,"access",e=>e.getActiveSpan,"call",e=>e(),"optionalAccess",e=>e.setAttribute,"call",e=>e("cache.key",n)]);const i=await e.get(n);if(i)return _optionalChain$Q([trace$1,"access",e=>e.getActiveSpan,"call",e=>e(),"optionalAccess",e=>e.setAttribute,"call",e=>e("cache.hit",!0)]),JSON.parse(i);_optionalChain$Q([trace$1,"access",e=>e.getActiveSpan,"call",e=>e(),"optionalAccess",e=>e.setAttribute,"call",e=>e("cache.hit",!1)]);const s=await r();return await e.set(n,JSON.stringify(s),"EX",2764800),s}function __classPrivateFieldSet(e,t,r,n,i){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}function __classPrivateFieldGet(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter")
|
|
1753
1753
|
;if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}let uuid4=function(){const{crypto:e}=globalThis;if(e?.randomUUID)return uuid4=e.randomUUID.bind(e),e.randomUUID();const t=new Uint8Array(1),r=e?()=>e.getRandomValues(t)[0]:()=>255*Math.random()&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^r()&15>>+e/4).toString(16))};function isAbortError$1(e){return"object"==typeof e&&null!==e&&("name"in e&&"AbortError"===e.name||"message"in e&&String(e.message).includes("FetchRequestCanceledException"))}const castToError=e=>{if(e instanceof Error)return e;if("object"==typeof e&&null!==e){try{if("[object Error]"===Object.prototype.toString.call(e)){const t=new Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{
|
|
1754
1754
|
return new Error(JSON.stringify(e))}catch{}}return new Error(e)};class AnthropicError extends Error{}class APIError extends AnthropicError{constructor(e,t,r,n){super(`${APIError.makeMessage(e,t,r)}`),this.status=e,this.headers=n,this.requestID=n?.get("request-id"),this.error=t}static makeMessage(e,t,r){const n=t?.message?"string"==typeof t.message?t.message:JSON.stringify(t.message):t?JSON.stringify(t):r;return e&&n?`${e} ${n}`:e?`${e} status code (no body)`:n||"(no status code or body)"}static generate(e,t,r,n){if(!e||!n)return new APIConnectionError({message:r,cause:castToError(t)});const i=t;return 400===e?new BadRequestError(e,i,r,n):401===e?new AuthenticationError(e,i,r,n):403===e?new PermissionDeniedError(e,i,r,n):404===e?new NotFoundError$1(e,i,r,n):409===e?new ConflictError(e,i,r,n):422===e?new UnprocessableEntityError(e,i,r,n):429===e?new RateLimitError(e,i,r,n):e>=500?new InternalServerError(e,i,r,n):new APIError(e,i,r,n)}}class APIUserAbortError extends APIError{
|
|
@@ -1828,8 +1828,8 @@ const i=e?"error; no more retries left":"error; not retryable";loggerFor(this).i
|
|
|
1828
1828
|
calculateNonstreamingTimeout(e,t){const r=6e5;if(36e5*e/128e3>r||null!=t&&e>t)throw new AnthropicError("Streaming is strongly recommended for operations that may token longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return r}buildRequest(e,{retryCount:t=0}={}){const r={...e},{method:n,path:i,query:s,defaultBaseURL:o}=r,a=this.buildURL(i,s,o);"timeout"in r&&validatePositiveInteger("timeout",r.timeout),r.timeout=r.timeout??this.timeout;const{bodyHeaders:c,body:u}=this.buildBody({options:r});return{req:{method:n,headers:this.buildHeaders({options:e,method:n,bodyHeaders:c,retryCount:t}),...r.signal&&{signal:r.signal},...globalThis.ReadableStream&&u instanceof globalThis.ReadableStream&&{duplex:"half"},...u&&{body:u},...this.fetchOptions??{},...r.fetchOptions??{}},url:a,timeout:r.timeout}}buildHeaders({options:e,method:t,bodyHeaders:r,retryCount:n}){let i={}
|
|
1829
1829
|
;this.idempotencyHeader&&"get"!==t&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);const s=buildHeaders([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(n),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...getPlatformHeaders(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},this.authHeaders(e),this._options.defaultHeaders,r,e.headers]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};const r=buildHeaders([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||"string"==typeof e&&r.values.has("content-type")||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{
|
|
1830
1830
|
bodyHeaders:void 0,body:e}:"object"==typeof e&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&"function"==typeof e.next)?{bodyHeaders:void 0,body:ReadableStreamFrom(e)}:__classPrivateFieldGet(this,_BaseAnthropic_encoder,"f").call(this,{body:e,headers:r})}}_a=BaseAnthropic,_BaseAnthropic_encoder=new WeakMap,_BaseAnthropic_instances=new WeakSet,_BaseAnthropic_baseURLOverridden=function(){return"https://api.anthropic.com"!==this.baseURL},BaseAnthropic.Anthropic=_a,BaseAnthropic.HUMAN_PROMPT="\n\nHuman:",BaseAnthropic.AI_PROMPT="\n\nAssistant:",BaseAnthropic.DEFAULT_TIMEOUT=6e5,BaseAnthropic.AnthropicError=AnthropicError,BaseAnthropic.APIError=APIError,BaseAnthropic.APIConnectionError=APIConnectionError,BaseAnthropic.APIConnectionTimeoutError=APIConnectionTimeoutError,BaseAnthropic.APIUserAbortError=APIUserAbortError,BaseAnthropic.NotFoundError=NotFoundError$1,BaseAnthropic.ConflictError=ConflictError,BaseAnthropic.RateLimitError=RateLimitError,
|
|
1831
|
-
BaseAnthropic.BadRequestError=BadRequestError,BaseAnthropic.AuthenticationError=AuthenticationError,BaseAnthropic.InternalServerError=InternalServerError,BaseAnthropic.PermissionDeniedError=PermissionDeniedError,BaseAnthropic.UnprocessableEntityError=UnprocessableEntityError,BaseAnthropic.toFile=toFile;class Anthropic extends BaseAnthropic{constructor(){super(...arguments),this.completions=new Completions(this),this.messages=new Messages(this),this.models=new Models(this),this.beta=new Beta(this)}}Anthropic.Completions=Completions,Anthropic.Messages=Messages,Anthropic.Models=Models,Anthropic.Beta=Beta;const{HUMAN_PROMPT,AI_PROMPT}=Anthropic,ignoreOverride$1=Symbol("Let zodToJsonSchema decide on which parser to use"),defaultOptions$
|
|
1832
|
-
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"},getDefaultOptions$1=e=>"string"==typeof e?{...defaultOptions$
|
|
1831
|
+
BaseAnthropic.BadRequestError=BadRequestError,BaseAnthropic.AuthenticationError=AuthenticationError,BaseAnthropic.InternalServerError=InternalServerError,BaseAnthropic.PermissionDeniedError=PermissionDeniedError,BaseAnthropic.UnprocessableEntityError=UnprocessableEntityError,BaseAnthropic.toFile=toFile;class Anthropic extends BaseAnthropic{constructor(){super(...arguments),this.completions=new Completions(this),this.messages=new Messages(this),this.models=new Models(this),this.beta=new Beta(this)}}Anthropic.Completions=Completions,Anthropic.Messages=Messages,Anthropic.Models=Models,Anthropic.Beta=Beta;const{HUMAN_PROMPT,AI_PROMPT}=Anthropic,ignoreOverride$1=Symbol("Let zodToJsonSchema decide on which parser to use"),defaultOptions$3={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,
|
|
1832
|
+
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"},getDefaultOptions$1=e=>"string"==typeof e?{...defaultOptions$3,name:e}:{...defaultOptions$3,...e},getRefs$1=e=>{const t=getDefaultOptions$1(e),r=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function addErrorMessage$1(e,t,r,n){n?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function setResponseValueAndErrors$1(e,t,r,n,i){e[t]=r,addErrorMessage$1(e,t,n,i)}const getRelativePath$1=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);
|
|
1833
1833
|
return[(e.length-r).toString(),...t.slice(r)].join("/")};function parseAnyDef$1(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?getRelativePath$1(t,e.currentPath):t.join("/")}}function parseArrayDef$1(e,t){const r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==ZodFirstPartyTypeKind$1.ZodAny&&(r.items=parseDef$1(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&setResponseValueAndErrors$1(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&setResponseValueAndErrors$1(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(setResponseValueAndErrors$1(r,"minItems",e.exactLength.value,e.exactLength.message,t),setResponseValueAndErrors$1(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}function parseBigintDef$1(e,t){const r={type:"integer",format:"int64"};if(!e.checks)return r
|
|
1834
1834
|
;for(const n of e.checks)switch(n.kind){case"min":"jsonSchema7"===t.target?n.inclusive?setResponseValueAndErrors$1(r,"minimum",n.value,n.message,t):setResponseValueAndErrors$1(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),setResponseValueAndErrors$1(r,"minimum",n.value,n.message,t));break;case"max":"jsonSchema7"===t.target?n.inclusive?setResponseValueAndErrors$1(r,"maximum",n.value,n.message,t):setResponseValueAndErrors$1(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),setResponseValueAndErrors$1(r,"maximum",n.value,n.message,t));break;case"multipleOf":setResponseValueAndErrors$1(r,"multipleOf",n.value,n.message,t)}return r}function parseBooleanDef$1(){return{type:"boolean"}}function parseBrandedDef$1(e,t){return parseDef$1(e.type._def,t)}const parseCatchDef$1=(e,t)=>parseDef$1(e.innerType._def,t);function parseDateDef$1(e,t,r){const n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((r,n)=>parseDateDef$1(e,t,r))
|
|
1835
1835
|
};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 integerDateParser$1(e,t)}}const integerDateParser$1=(e,t)=>{const r={type:"integer",format:"unix-time"};if("openApi3"===t.target)return r;for(const n of e.checks)switch(n.kind){case"min":setResponseValueAndErrors$1(r,"minimum",n.value,n.message,t);break;case"max":setResponseValueAndErrors$1(r,"maximum",n.value,n.message,t)}return r};function parseDefaultDef$1(e,t){return{...parseDef$1(e.innerType._def,t),default:e.defaultValue()}}function parseEffectsDef$1(e,t){return"input"===t.effectStrategy?parseDef$1(e.schema._def,t):parseAnyDef$1(t)}function parseEnumDef$1(e){return{type:"string",enum:Array.from(e.values)}}const isJsonSchema7AllOfType$1=e=>(!("type"in e)||"string"!==e.type)&&"allOf"in e;function parseIntersectionDef$1(e,t){const r=[parseDef$1(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]
|
|
@@ -1854,57 +1854,52 @@ const parseReadonlyDef$1=(e,t)=>parseDef$1(e.innerType._def,t),selectParser$1=(e
|
|
|
1854
1854
|
;case ZodFirstPartyTypeKind$1.ZodDefault:return parseDefaultDef$1(e,r);case ZodFirstPartyTypeKind$1.ZodBranded:return parseBrandedDef$1(e,r);case ZodFirstPartyTypeKind$1.ZodReadonly:return parseReadonlyDef$1(e,r);case ZodFirstPartyTypeKind$1.ZodCatch:return parseCatchDef$1(e,r);case ZodFirstPartyTypeKind$1.ZodPipeline:return parsePipelineDef$1(e,r);case ZodFirstPartyTypeKind$1.ZodFunction:case ZodFirstPartyTypeKind$1.ZodVoid:case ZodFirstPartyTypeKind$1.ZodSymbol:default:return}};function parseDef$1(e,t,r=!1){const n=t.seen.get(e);if(t.override){const i=t.override?.(e,t,n,r);if(i!==ignoreOverride$1)return i}if(n&&!r){const e=get$ref$1(n,t);if(void 0!==e)return e}const i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);const s=selectParser$1(e,e.typeName,t),o="function"==typeof s?parseDef$1(s(),t):s;if(o&&addMeta$1(e,t,o),t.postProcess){const r=t.postProcess(o,e,t);return i.jsonSchema=o,r}return i.jsonSchema=o,o}const get$ref$1=(e,t)=>{switch(t.$refStrategy){case"root":
|
|
1855
1855
|
return{$ref:e.path.join("/")};case"relative":return{$ref:getRelativePath$1(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,r)=>t.currentPath[r]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),parseAnyDef$1(t)):"seen"===t.$refStrategy?parseAnyDef$1(t):void 0}},addMeta$1=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r),zodToJsonSchema$2=(e,t)=>{const r=getRefs$1(t);let n="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>({...e,[t]:parseDef$1(n._def,{...r,currentPath:[...r.basePath,r.definitionPath,t]},!0)??parseAnyDef$1(r)}),{}):void 0;const i="string"==typeof t?t:"title"===t?.nameStrategy?void 0:t?.name,s=parseDef$1(e._def,void 0===i?r:{...r,currentPath:[...r.basePath,r.definitionPath,i]
|
|
1856
1856
|
},!1)??parseAnyDef$1(r),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(s.title=o),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===r.$refStrategy?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const a=void 0===i?n?{...s,[r.definitionPath]:n}:s:{$ref:[..."relative"===r.$refStrategy?[]:r.basePath,r.definitionPath,i].join("/"),[r.definitionPath]:{...n,[i]:s}};return"jsonSchema7"===r.target?a.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==r.target&&"openAi"!==r.target||(a.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===r.target&&("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};var index$1=Object.freeze({
|
|
1857
|
-
__proto__:null,addErrorMessage:addErrorMessage$1,defaultOptions:defaultOptions$
|
|
1857
|
+
__proto__:null,addErrorMessage:addErrorMessage$1,defaultOptions:defaultOptions$3,getDefaultOptions:getDefaultOptions$1,getRefs:getRefs$1,getRelativePath:getRelativePath$1,ignoreOverride:ignoreOverride$1,parseAnyDef:parseAnyDef$1,parseArrayDef:parseArrayDef$1,parseBigintDef:parseBigintDef$1,parseBooleanDef:parseBooleanDef$1,parseBrandedDef:parseBrandedDef$1,parseCatchDef:parseCatchDef$1,parseDateDef:parseDateDef$1,parseDef:parseDef$1,parseDefaultDef:parseDefaultDef$1,parseEffectsDef:parseEffectsDef$1,parseEnumDef:parseEnumDef$1,parseIntersectionDef:parseIntersectionDef$1,parseLiteralDef:parseLiteralDef$1,parseMapDef:parseMapDef$1,parseNativeEnumDef:parseNativeEnumDef$1,parseNeverDef:parseNeverDef$1,parseNullDef:parseNullDef$1,parseNullableDef:parseNullableDef$1,parseNumberDef:parseNumberDef$1,parseObjectDef:parseObjectDef$1,parseOptionalDef:parseOptionalDef$1,parsePipelineDef:parsePipelineDef$1,parsePromiseDef:parsePromiseDef$1,parseReadonlyDef:parseReadonlyDef$1,
|
|
1858
1858
|
parseRecordDef:parseRecordDef$1,parseSetDef:parseSetDef$1,parseStringDef:parseStringDef$1,parseTupleDef:parseTupleDef$1,parseUndefinedDef:parseUndefinedDef$1,parseUnionDef:parseUnionDef$1,parseUnknownDef:parseUnknownDef$1,primitiveMappings:primitiveMappings$1,selectParser:selectParser$1,setResponseValueAndErrors:setResponseValueAndErrors$1,zodPatterns:zodPatterns$1,zodToJsonSchema:zodToJsonSchema$2});function _optionalChain$P(e){let t,r=e[0],n=1;for(;n<e.length;){const i=e[n],s=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=s(r)):"call"!==i&&"optionalCall"!==i||(r=s((...e)=>r.call(t,...e)),t=void 0)}return r}function removeThinking(e){const t=/(?<=<\/think>)([\s\S]*)/;return _optionalChain$P([e,"optionalAccess",e=>e.match,"call",e=>e(t),"optionalAccess",e=>e[0]])||""}function injectMinificationToMessages(e){
|
|
1859
1859
|
return"system"===_optionalChain$P([e,"access",e=>e[0],"optionalAccess",e=>e.role])&&(e[0].content=e[0].content+"\nEmit a minified JSON in your response, no whitespace, newlines or tabs."),e}function translateMessagesToArray(e){let t;const r=[],n=[],i=()=>{r.length&&(n.push({role:t,content:r.map(e=>({text:e,type:"text"}))}),r.length=0)};for(const n of e){const e="system"===n.role?"user":n.role;t!==e&&(i(),t=e),r.push(n.content)}return i(),n}function appendSchema(e,t){const r=zodToJsonSchema$2(t);delete r.$schema,delete r.additionalProperties,e[e.length-1].content.push({text:"Return a JSON object matching this exact schema. Your response will be serialized as JSON, so make sure all newlines are properly escaped. Do not include any other text or commentary: "+JSON.stringify(r),type:"text"})}function nonStreamedAsString(e){return async t=>(await _optionalChain$P([t,"optionalAccess",e=>e.start,"call",e=>e()]),await _optionalChain$P([t,"optionalAccess",e=>e.chunk,"call",t=>t(e)]),
|
|
1860
1860
|
await _optionalChain$P([t,"optionalAccess",e=>e.done,"call",e=>e()]),e)}function _nullishCoalesce$J(e,t){return null!=e?e:t()}function _optionalChain$O(e){let t,r=e[0],n=1;for(;n<e.length;){const i=e[n],s=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=s(r)):"call"!==i&&"optionalCall"!==i||(r=s((...e)=>r.call(t,...e)),t=void 0)}return r}function handleConfig$2(e){return{max_tokens:4096,temperature:_nullishCoalesce$J(e.modelTemperature,()=>1),model:e.modelName,...e.modelParams}}function anthropicImpl(e,t){const r=new Anthropic({}),n=handleConfig$2(t);return{cacheKey:[n.model,String(n.temperature)],streamFromMessages:async(e,t)=>withSpan("anthropicClient.streamFromMessages",async i=>{const s=translateMessagesToArray(structuredClone(e)),o=_optionalChain$O([t,"optionalAccess",e=>e.respondObject,"optionalAccess",e=>e.schema]);o&&appendSchema(s,o);const a={...n};delete a.model
|
|
1861
|
-
;const c=_optionalChain$O([t,"optionalAccess",e=>e.traceInfo,"optionalAccess",e=>e.parent,"optionalAccess",e=>e.generation,"call",e=>e({name:_optionalChain$O([t,"optionalAccess",e=>e.traceInfo,"optionalAccess",e=>e.generationName]),model:n.model,modelParameters:a,input:s})]),u={};propagation.inject(context.active(),u);const l=await r.messages.create({messages:s,...n},{headers:u});return _optionalChain$O([c,"optionalAccess",e=>e.end,"call",e=>e({output:l.content,usage:{input:_optionalChain$O([l,"access",e=>e.usage,"optionalAccess",e=>e.input_tokens]),output:_optionalChain$O([l,"access",e=>e.usage,"optionalAccess",e=>e.output_tokens])}})]),chatStreamBuilder(_optionalChain$O([t,"optionalAccess",e=>e.respondObject,"optionalAccess",e=>e.schema]),nonStreamedAsString(_optionalChain$O([l,"access",e=>e.content,"access",e=>e.map,"call",e=>e(e=>"text"===e.type?e.text:""),"optionalAccess",e=>e.join,"call",e=>e("\n")])))})}}
|
|
1862
|
-
|
|
1863
|
-
;
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
;
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
;
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
this.
|
|
1879
|
-
;if(
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
if(
|
|
1885
|
-
return
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
""===
|
|
1892
|
-
return
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
;
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
}else"role"in e&&"content"in e&&e.type===ChatMessageType.ChatMessage&&t.push({role:e.role,content:this._transformToLangchainVariables(e.content)});return t}toJSON(){return JSON.stringify({name:this.name,prompt:this.promptResponse.prompt.map(e=>{if("type"in e&&e.type===ChatMessageType.ChatMessage){const{type:t,...r}=e;return r}return e}),version:this.version,isFallback:this.isFallback,tags:this.tags,labels:this.labels,type:this.type,config:this.config})}}function assert$3(e,t){if(!e)throw new Error(t)}function removeTrailingSlash$2(e){return e?.replace(/\/+$/,"")}async function retriable$1(e,t={},r){const{retryCount:n=3,retryDelay:i=5e3,retryCheck:s=()=>!0}=t;let o=null;for(let t=0;t<n+1;t++){t>0&&(await new Promise(e=>setTimeout(e,i)),r(`Retrying ${t+1} of ${n+1}`));try{return await e()}catch(e){if(o=e,!s(e))throw e;r(`Retriable error: ${JSON.stringify(e)}`)}}throw o}function generateUUID(e){let t=(new Date).getTime(),r=e&&e.performance&&e.performance.now&&1e3*e.performance.now()||0
|
|
1904
|
-
;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let n=16*Math.random();return t>0?(n=(t+n)%16|0,t=Math.floor(t/16)):(n=(r+n)%16|0,r=Math.floor(r/16)),("x"===e?n:3&n|8).toString(16)})}function currentTimestamp(){return(new Date).getTime()}function currentISOTime$1(){return(new Date).toISOString()}function safeSetTimeout$1(e,t){const r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function getEnv$1(e){return"undefined"!=typeof process&&process.env[e]?process.env[e]:"undefined"!=typeof globalThis?globalThis[e]:void 0}function configLangfuseSDK(e,t=!0){const{publicKey:r,secretKey:n,...i}=e??{},s=r??getEnv$1("LANGFUSE_PUBLIC_KEY"),o=t?n??getEnv$1("LANGFUSE_SECRET_KEY"):void 0,a=i.baseUrl??getEnv$1("LANGFUSE_BASEURL");return{publicKey:s,...t?{secretKey:o}:void 0,...{...i,baseUrl:a}}}const encodeQueryParams=e=>{const t=new URLSearchParams;return Object.entries(e??{}).forEach(([e,r])=>{null!=r&&(r instanceof Date?t.append(e,r.toISOString()):t.append(e,r.toString()))
|
|
1905
|
-
}),t.toString()};var utils$7=Object.freeze({__proto__:null,assert:assert$3,configLangfuseSDK,currentISOTime:currentISOTime$1,currentTimestamp,encodeQueryParams,generateUUID,getEnv:getEnv$1,removeTrailingSlash:removeTrailingSlash$2,retriable:retriable$1,safeSetTimeout:safeSetTimeout$1});const common_release_envs=["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","TRIGGER_DEPLOYMENT_ID"];function getCommonReleaseEnvs(){for(const e of common_release_envs){const t=getEnv$1(e);if(t)return t}}let fs$4=null,cryptoModule=null;const dynamicImport=e=>import(e);void 0!==globalThis.Deno?Promise.all([dynamicImport("node:fs"),dynamicImport("node:crypto")]).then(([e,t])=>{fs$4=e,cryptoModule=t}).catch():"undefined"!=typeof process&&process.versions?.node?Promise.all([dynamicImport("fs"),dynamicImport("crypto")]).then(([e,t])=>{fs$4=e,cryptoModule=t
|
|
1906
|
-
}).catch():"undefined"!=typeof crypto&&(cryptoModule=crypto);class LangfuseMedia{constructor(e){const{obj:t,base64DataUri:r,contentType:n,contentBytes:i,filePath:s}=e;if(this.obj=t,this._mediaId=void 0,r){const[e,t]=this.parseBase64DataUri(r);this._contentBytes=e,this._contentType=t,this._source="base64_data_uri"}else if(i&&n)this._contentBytes=i,this._contentType=n,this._source="bytes";else if(s&&n){if(!fs$4)throw new Error("File system support is not available in this environment");if(!fs$4.existsSync(s))throw new Error(`File at path ${s} does not exist`);this._contentBytes=this.readFile(s),this._contentType=this._contentBytes?n:void 0,this._source=this._contentBytes?"file":void 0}else console.error("base64DataUri, or contentBytes and contentType, or filePath must be provided to LangfuseMedia")}readFile(e){try{if(!fs$4)throw new Error("File system support is not available in this environment");return fs$4.readFileSync(e)}catch(t){
|
|
1907
|
-
return void console.error(`Error reading file at path ${e}`,t)}}parseBase64DataUri(e){try{if(!e||"string"!=typeof e)throw new Error("Data URI is not a string");if(!e.startsWith("data:"))throw new Error("Data URI does not start with 'data:'");const[t,r]=e.slice(5).split(",",2);if(!t||!r)throw new Error("Invalid URI");const n=t.split(";");if(!n.includes("base64"))throw new Error("Data is not base64 encoded");const i=n[0];if(!i)throw new Error("Content type is empty");return[Buffer.from(r,"base64"),i]}catch(e){return console.error("Error parsing base64 data URI",e),[void 0,void 0]}}get contentLength(){return this._contentBytes?.length}get contentSha256Hash(){if(!this._contentBytes)return;if(!cryptoModule)return void console.error("Crypto support is not available in this environment");return cryptoModule.createHash("sha256").update(this._contentBytes).digest("base64")}toJSON(){
|
|
1861
|
+
;const c=_optionalChain$O([t,"optionalAccess",e=>e.traceInfo,"optionalAccess",e=>e.parent,"optionalAccess",e=>e.generation,"call",e=>e({name:_optionalChain$O([t,"optionalAccess",e=>e.traceInfo,"optionalAccess",e=>e.generationName]),model:n.model,modelParameters:a,input:s})]),u={};propagation.inject(context.active(),u);const l=await r.messages.create({messages:s,...n},{headers:u});return _optionalChain$O([c,"optionalAccess",e=>e.end,"call",e=>e({output:l.content,usage:{input:_optionalChain$O([l,"access",e=>e.usage,"optionalAccess",e=>e.input_tokens]),output:_optionalChain$O([l,"access",e=>e.usage,"optionalAccess",e=>e.output_tokens])}})]),chatStreamBuilder(_optionalChain$O([t,"optionalAccess",e=>e.respondObject,"optionalAccess",e=>e.schema]),nonStreamedAsString(_optionalChain$O([l,"access",e=>e.content,"access",e=>e.map,"call",e=>e(e=>"text"===e.type?e.text:""),"optionalAccess",e=>e.join,"call",e=>e("\n")])))})}}
|
|
1862
|
+
const nameStartChar=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",nameChar=nameStartChar+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",nameRegexp="["+nameStartChar+"]["+nameChar+"]*",regexName=new RegExp("^"+nameRegexp+"$");function getAllMatches(e,t){const r=[];let n=t.exec(e);for(;n;){const i=[];i.startIndex=t.lastIndex-n[0].length;const s=n.length;for(let e=0;e<s;e++)i.push(n[e]);r.push(i),n=t.exec(e)}return r}const isName=function(e){const t=regexName.exec(e);return!(null==t)};function isExist(e){return void 0!==e}const defaultOptions$2={allowBooleanAttributes:!1,unpairedTags:[]};function validate$2(e,t){t=Object.assign({},defaultOptions$2,t);const r=[];let n=!1,i=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let s=0;s<e.length;s++)if("<"===e[s]&&"?"===e[s+1]){if(s+=2,s=readPI(e,s),s.err)return s}else{if("<"!==e[s]){if(isWhiteSpace(e[s]))continue
|
|
1863
|
+
;return getErrorObject("InvalidChar","char '"+e[s]+"' is not expected.",getLineNumberForPosition(e,s))}{let o=s;if(s++,"!"===e[s]){s=readCommentAndCDATA(e,s);continue}{let a=!1;"/"===e[s]&&(a=!0,s++);let c="";for(;s<e.length&&">"!==e[s]&&" "!==e[s]&&"\t"!==e[s]&&"\n"!==e[s]&&"\r"!==e[s];s++)c+=e[s];if(c=c.trim(),"/"===c[c.length-1]&&(c=c.substring(0,c.length-1),s--),!validateTagName(c)){let t;return t=0===c.trim().length?"Invalid space after '<'.":"Tag '"+c+"' is an invalid name.",getErrorObject("InvalidTag",t,getLineNumberForPosition(e,s))}const u=readAttributeStr(e,s);if(!1===u)return getErrorObject("InvalidAttr","Attributes for '"+c+"' have open quote.",getLineNumberForPosition(e,s));let l=u.value;if(s=u.index,"/"===l[l.length-1]){const r=s-l.length;l=l.substring(0,l.length-1);const i=validateAttributeString(l,t);if(!0!==i)return getErrorObject(i.err.code,i.err.msg,getLineNumberForPosition(e,r+i.err.line));n=!0}else if(a){
|
|
1864
|
+
if(!u.tagClosed)return getErrorObject("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",getLineNumberForPosition(e,s));if(l.trim().length>0)return getErrorObject("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",getLineNumberForPosition(e,o));if(0===r.length)return getErrorObject("InvalidTag","Closing tag '"+c+"' has not been opened.",getLineNumberForPosition(e,o));{const t=r.pop();if(c!==t.tagName){let r=getLineNumberForPosition(e,t.tagStartPos);return getErrorObject("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+r.line+", col "+r.col+") instead of closing tag '"+c+"'.",getLineNumberForPosition(e,o))}0==r.length&&(i=!0)}}else{const a=validateAttributeString(l,t);if(!0!==a)return getErrorObject(a.err.code,a.err.msg,getLineNumberForPosition(e,s-l.length+a.err.line));if(!0===i)return getErrorObject("InvalidXml","Multiple possible root nodes found.",getLineNumberForPosition(e,s));-1!==t.unpairedTags.indexOf(c)||r.push({
|
|
1865
|
+
tagName:c,tagStartPos:o}),n=!0}for(s++;s<e.length;s++)if("<"===e[s]){if("!"===e[s+1]){s++,s=readCommentAndCDATA(e,s);continue}if("?"!==e[s+1])break;if(s=readPI(e,++s),s.err)return s}else if("&"===e[s]){const t=validateAmpersand(e,s);if(-1==t)return getErrorObject("InvalidChar","char '&' is not expected.",getLineNumberForPosition(e,s));s=t}else if(!0===i&&!isWhiteSpace(e[s]))return getErrorObject("InvalidXml","Extra text at the end",getLineNumberForPosition(e,s));"<"===e[s]&&s--}}}return n?1==r.length?getErrorObject("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",getLineNumberForPosition(e,r[0].tagStartPos)):!(r.length>0)||getErrorObject("InvalidXml","Invalid '"+JSON.stringify(r.map(e=>e.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):getErrorObject("InvalidXml","Start tag expected.",1)}function isWhiteSpace(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function readPI(e,t){const r=t;for(;t<e.length;t++)if("?"==e[t]||" "==e[t]){const n=e.substr(r,t-r)
|
|
1866
|
+
;if(t>5&&"xml"===n)return getErrorObject("InvalidXml","XML declaration allowed only at the start of the document.",getLineNumberForPosition(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}continue}return t}function readCommentAndCDATA(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t<e.length;t++)if("-"===e[t]&&"-"===e[t+1]&&">"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let r=1;for(t+=8;t<e.length;t++)if("<"===e[t])r++;else if(">"===e[t]&&(r--,0===r))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t<e.length;t++)if("]"===e[t]&&"]"===e[t+1]&&">"===e[t+2]){t+=2;break}return t}const doubleQuote='"',singleQuote="'";function readAttributeStr(e,t){let r="",n="",i=!1;for(;t<e.length;t++){if(e[t]===doubleQuote||e[t]===singleQuote)""===n?n=e[t]:n!==e[t]||(n="");else if(">"===e[t]&&""===n){i=!0;break}
|
|
1867
|
+
r+=e[t]}return""===n&&{value:r,index:t,tagClosed:i}}const validAttrStrRegxp=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function validateAttributeString(e,t){const r=getAllMatches(e,validAttrStrRegxp),n={};for(let e=0;e<r.length;e++){if(0===r[e][1].length)return getErrorObject("InvalidAttr","Attribute '"+r[e][2]+"' has no space in starting.",getPositionFromMatch(r[e]));if(void 0!==r[e][3]&&void 0===r[e][4])return getErrorObject("InvalidAttr","Attribute '"+r[e][2]+"' is without value.",getPositionFromMatch(r[e]));if(void 0===r[e][3]&&!t.allowBooleanAttributes)return getErrorObject("InvalidAttr","boolean attribute '"+r[e][2]+"' is not allowed.",getPositionFromMatch(r[e]));const i=r[e][2];if(!validateAttrName(i))return getErrorObject("InvalidAttr","Attribute '"+i+"' is an invalid name.",getPositionFromMatch(r[e]));if(n.hasOwnProperty(i))return getErrorObject("InvalidAttr","Attribute '"+i+"' is repeated.",getPositionFromMatch(r[e]));n[i]=1}return!0}
|
|
1868
|
+
function validateNumberAmpersand(e,t){let r=/\d/;for("x"===e[t]&&(t++,r=/[\da-fA-F]/);t<e.length;t++){if(";"===e[t])return t;if(!e[t].match(r))break}return-1}function validateAmpersand(e,t){if(";"===e[++t])return-1;if("#"===e[t])return validateNumberAmpersand(e,++t);let r=0;for(;t<e.length;t++,r++)if(!(e[t].match(/\w/)&&r<20)){if(";"===e[t])break;return-1}return t}function getErrorObject(e,t,r){return{err:{code:e,msg:t,line:r.line||r,col:r.col}}}function validateAttrName(e){return isName(e)}function validateTagName(e){return isName(e)}function getLineNumberForPosition(e,t){const r=e.substring(0,t).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function getPositionFromMatch(e){return e.startIndex+e[1].length}const defaultOptions$1={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{
|
|
1869
|
+
hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,r){return e},captureMetaData:!1},buildOptions=function(e){return Object.assign({},defaultOptions$1,e)};let METADATA_SYMBOL$1;METADATA_SYMBOL$1="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class XmlNode{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e,t){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),void 0!==t&&(this.child[this.child.length-1][METADATA_SYMBOL$1]={startIndex:t})}
|
|
1870
|
+
static getMetaDataSymbol(){return METADATA_SYMBOL$1}}function readDocType(e,t){const r={};if("O"!==e[t+3]||"C"!==e[t+4]||"T"!==e[t+5]||"Y"!==e[t+6]||"P"!==e[t+7]||"E"!==e[t+8])throw new Error("Invalid Tag instead of DOCTYPE");{t+=9;let n=1,i=!1,s=!1,o="";for(;t<e.length;t++)if("<"!==e[t]||s)if(">"===e[t]){if(s?"-"===e[t-1]&&"-"===e[t-2]&&(s=!1,n--):n--,0===n)break}else"["===e[t]?i=!0:o+=e[t];else{if(i&&hasSeq(e,"!ENTITY",t)){let n,i;t+=7,[n,i,t]=readEntityExp(e,t+1),-1===i.indexOf("&")&&(r[n]={regx:RegExp(`&${n};`,"g"),val:i})}else if(i&&hasSeq(e,"!ELEMENT",t)){t+=8;const{index:r}=readElementExp(e,t+1);t=r}else if(i&&hasSeq(e,"!ATTLIST",t))t+=8;else if(i&&hasSeq(e,"!NOTATION",t)){t+=9;const{index:r}=readNotationExp(e,t+1);t=r}else{if(!hasSeq(e,"!--",t))throw new Error("Invalid DOCTYPE");s=!0}n++,o=""}if(0!==n)throw new Error("Unclosed DOCTYPE")}return{entities:r,i:t}}const skipWhitespace=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function readEntityExp(e,t){
|
|
1871
|
+
t=skipWhitespace(e,t);let r="";for(;t<e.length&&!/\s/.test(e[t])&&'"'!==e[t]&&"'"!==e[t];)r+=e[t],t++;if(validateEntityName(r),t=skipWhitespace(e,t),"SYSTEM"===e.substring(t,t+6).toUpperCase())throw new Error("External entities are not supported");if("%"===e[t])throw new Error("Parameter entities are not supported");let n="";return[t,n]=readIdentifierVal(e,t,"entity"),[r,n,--t]}function readNotationExp(e,t){t=skipWhitespace(e,t);let r="";for(;t<e.length&&!/\s/.test(e[t]);)r+=e[t],t++;validateEntityName(r),t=skipWhitespace(e,t);const n=e.substring(t,t+6).toUpperCase();if("SYSTEM"!==n&&"PUBLIC"!==n)throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);t+=n.length,t=skipWhitespace(e,t);let i=null,s=null;if("PUBLIC"===n)[t,i]=readIdentifierVal(e,t,"publicIdentifier"),'"'!==e[t=skipWhitespace(e,t)]&&"'"!==e[t]||([t,s]=readIdentifierVal(e,t,"systemIdentifier"));else if("SYSTEM"===n&&([t,s]=readIdentifierVal(e,t,"systemIdentifier"),
|
|
1872
|
+
!s))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:i,systemIdentifier:s,index:--t}}function readIdentifierVal(e,t,r){let n="";const i=e[t];if('"'!==i&&"'"!==i)throw new Error(`Expected quoted string, found "${i}"`);for(t++;t<e.length&&e[t]!==i;)n+=e[t],t++;if(e[t]!==i)throw new Error(`Unterminated ${r} value`);return[++t,n]}function readElementExp(e,t){t=skipWhitespace(e,t);let r="";for(;t<e.length&&!/\s/.test(e[t]);)r+=e[t],t++;if(!validateEntityName(r))throw new Error(`Invalid element name: "${r}"`);let n="";if("E"===e[t=skipWhitespace(e,t)]&&hasSeq(e,"MPTY",t))t+=4;else if("A"===e[t]&&hasSeq(e,"NY",t))t+=2;else{if("("!==e[t])throw new Error(`Invalid Element Expression, found "${e[t]}"`);for(t++;t<e.length&&")"!==e[t];)n+=e[t],t++;if(")"!==e[t])throw new Error("Unterminated content model")}return{elementName:r,contentModel:n.trim(),index:t}}function hasSeq(e,t,r){for(let n=0;n<t.length;n++)if(t[n]!==e[r+n+1])return!1
|
|
1873
|
+
;return!0}function validateEntityName(e){if(isName(e))return e;throw new Error(`Invalid entity name ${e}`)}const hexRegex=/^[-+]?0x[a-fA-F0-9]+$/,numRegex=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,consider={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function toNumber(e,t={}){if(t=Object.assign({},consider,t),!e||"string"!=typeof e)return e;let r=e.trim();if(void 0!==t.skipLike&&t.skipLike.test(r))return e;if("0"===e)return 0;if(t.hex&&hexRegex.test(r))return parse_int(r,16);if(-1!==r.search(/.+[eE].+/))return resolveEnotation(e,r,t);{const n=numRegex.exec(r);if(n){const i=n[1]||"",s=n[2];let o=trimZeros(n[3]);const a=i?"."===e[s.length+1]:"."===e[s.length];if(!t.leadingZeros&&(s.length>1||1===s.length&&!a))return e;{const n=Number(r),a=String(n);if(0===n)return n;if(-1!==a.search(/[eE]/))return t.eNotation?n:e;if(-1!==r.indexOf("."))return"0"===a||a===o||a===`${i}${o}`?n:e;let c=s?o:r;return s?c===a||i+c===a?n:e:c===a||c===i+a?n:e}}return e}}
|
|
1874
|
+
const eNotationRegx=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function resolveEnotation(e,t,r){if(!r.eNotation)return e;const n=t.match(eNotationRegx);if(n){let i=n[1]||"";const s=-1===n[3].indexOf("e")?"E":"e",o=n[2],a=i?e[o.length+1]===s:e[o.length]===s;return o.length>1&&a?e:1!==o.length||!n[3].startsWith(`.${s}`)&&n[3][0]!==s?r.leadingZeros&&!a?(t=(n[1]||"")+n[3],Number(t)):e:Number(t)}return e}function trimZeros(e){return e&&-1!==e.indexOf(".")?("."===(e=e.replace(/0+$/,""))?e="0":"."===e[0]?e="0"+e:"."===e[e.length-1]&&(e=e.substring(0,e.length-1)),e):e}function parse_int(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function getIgnoreAttributesFn(e){return"function"==typeof e?e:Array.isArray(e)?t=>{for(const r of e){if("string"==typeof r&&t===r)return!0;if(r instanceof RegExp&&r.test(t))return!0}}:()=>!1}
|
|
1875
|
+
class OrderedObjParser{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>String.fromCodePoint(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCodePoint(Number.parseInt(t,16))}},this.addExternalEntities=addExternalEntities,this.parseXml=parseXml,this.parseTextData=parseTextData,
|
|
1876
|
+
this.resolveNameSpace=resolveNameSpace,this.buildAttributesMap=buildAttributesMap,this.isItStopNode=isItStopNode,this.replaceEntitiesValue=replaceEntitiesValue,this.readStopNodeData=readStopNodeData,this.saveTextToParentTag=saveTextToParentTag,this.addChild=addChild,this.ignoreAttributesFn=getIgnoreAttributesFn(this.options.ignoreAttributes)}}function addExternalEntities(e){const t=Object.keys(e);for(let r=0;r<t.length;r++){const n=t[r];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:e[n]}}}function parseTextData(e,t,r,n,i,s,o){if(void 0!==e&&(this.options.trimValues&&!n&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));const n=this.options.tagValueProcessor(t,e,r,i,s);if(null==n)return e;if(typeof n!=typeof e||n!==e)return n;if(this.options.trimValues)return parseValue$1(e,this.options.parseTagValue,this.options.numberParseOptions);return e.trim()===e?parseValue$1(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function resolveNameSpace(e){
|
|
1877
|
+
if(this.options.removeNSPrefix){const t=e.split(":"),r="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=r+t[1])}return e}const attrsRegx=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function buildAttributesMap(e,t,r){if(!0!==this.options.ignoreAttributes&&"string"==typeof e){const r=getAllMatches(e,attrsRegx),n=r.length,i={};for(let e=0;e<n;e++){const n=this.resolveNameSpace(r[e][1]);if(this.ignoreAttributesFn(n,t))continue;let s=r[e][4],o=this.options.attributeNamePrefix+n;if(n.length)if(this.options.transformAttributeName&&(o=this.options.transformAttributeName(o)),"__proto__"===o&&(o="#__proto__"),void 0!==s){this.options.trimValues&&(s=s.trim()),s=this.replaceEntitiesValue(s);const e=this.options.attributeValueProcessor(n,s,t);i[o]=null==e?s:typeof e!=typeof s||e!==s?e:parseValue$1(s,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[o]=!0)}if(!Object.keys(i).length)return
|
|
1878
|
+
;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=i,e}return i}}const parseXml=function(e){e=e.replace(/\r\n?/g,"\n");const t=new XmlNode("!xml");let r=t,n="",i="";for(let s=0;s<e.length;s++){if("<"===e[s])if("/"===e[s+1]){const t=findClosingIndex(e,">",s,"Closing Tag is not closed.");let o=e.substring(s+2,t).trim();if(this.options.removeNSPrefix){const e=o.indexOf(":");-1!==e&&(o=o.substr(e+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),r&&(n=this.saveTextToParentTag(n,r,i));const a=i.substring(i.lastIndexOf(".")+1);if(o&&-1!==this.options.unpairedTags.indexOf(o))throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);let c=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(c=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=i.lastIndexOf("."),i=i.substring(0,c),r=this.tagsNodeStack.pop(),n="",s=t}else if("?"===e[s+1]){let t=readTagExp(e,s,!1,"?>")
|
|
1879
|
+
;if(!t)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,i),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new XmlNode(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,i,t.tagName)),this.addChild(r,e,i,s)}s=t.closeIndex+1}else if("!--"===e.substr(s+1,3)){const t=findClosingIndex(e,"--\x3e",s+4,"Comment is not closed.");if(this.options.commentPropName){const o=e.substring(s+4,t-2);n=this.saveTextToParentTag(n,r,i),r.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}s=t}else if("!D"===e.substr(s+1,2)){const t=readDocType(e,s);this.docTypeEntities=t.entities,s=t.i}else if("!["===e.substr(s+1,2)){const t=findClosingIndex(e,"]]>",s,"CDATA is not closed.")-2,o=e.substring(s+9,t);n=this.saveTextToParentTag(n,r,i);let a=this.parseTextData(o,r.tagname,i,!0,!1,!0,!0);null==a&&(a=""),
|
|
1880
|
+
this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):r.add(this.options.textNodeName,a),s=t+2}else{let o=readTagExp(e,s,this.options.removeNSPrefix),a=o.tagName;const c=o.rawTagName;let u=o.tagExp,l=o.attrExpPresent,d=o.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),r&&n&&"!xml"!==r.tagname&&(n=this.saveTextToParentTag(n,r,i,!1));const p=r;p&&-1!==this.options.unpairedTags.indexOf(p.tagname)&&(r=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),a!==t.tagname&&(i+=i?"."+a:a);const h=s;if(this.isItStopNode(this.options.stopNodes,i,a)){let t="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)"/"===a[a.length-1]?(a=a.substr(0,a.length-1),i=i.substr(0,i.length-1),u=a):u=u.substr(0,u.length-1),s=o.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))s=o.closeIndex;else{const r=this.readStopNodeData(e,c,d+1);if(!r)throw new Error(`Unexpected end of ${c}`);s=r.i,t=r.tagContent}const n=new XmlNode(a)
|
|
1881
|
+
;a!==u&&l&&(n[":@"]=this.buildAttributesMap(u,i,a)),t&&(t=this.parseTextData(t,a,i,!0,l,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),n.add(this.options.textNodeName,t),this.addChild(r,n,i,h)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),i=i.substr(0,i.length-1),u=a):u=u.substr(0,u.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const e=new XmlNode(a);a!==u&&l&&(e[":@"]=this.buildAttributesMap(u,i,a)),this.addChild(r,e,i,h),i=i.substr(0,i.lastIndexOf("."))}else{const e=new XmlNode(a);this.tagsNodeStack.push(r),a!==u&&l&&(e[":@"]=this.buildAttributesMap(u,i,a)),this.addChild(r,e,i,h),r=e}n="",s=d}}else n+=e[s]}return t.child};function addChild(e,t,r,n){this.options.captureMetaData||(n=void 0);const i=this.options.updateTag(t.tagname,r,t[":@"]);!1===i||("string"==typeof i?(t.tagname=i,e.addChild(t,n)):e.addChild(t,n))}const replaceEntitiesValue=function(e){if(this.options.processEntities){
|
|
1882
|
+
for(let t in this.docTypeEntities){const r=this.docTypeEntities[t];e=e.replace(r.regx,r.val)}for(let t in this.lastEntities){const r=this.lastEntities[t];e=e.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const r=this.htmlEntities[t];e=e.replace(r.regex,r.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function saveTextToParentTag(e,t,r,n){return e&&(void 0===n&&(n=0===t.child.length),void 0!==(e=this.parseTextData(e,t.tagname,r,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,n))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function isItStopNode(e,t,r){const n="*."+r;for(const r in e){const i=e[r];if(n===i||t===i)return!0}return!1}function tagExpWithClosingIndex(e,t,r=">"){let n,i="";for(let s=t;s<e.length;s++){let t=e[s];if(n)t===n&&(n="");else if('"'===t||"'"===t)n=t;else if(t===r[0]){if(!r[1])return{data:i,index:s};if(e[s+1]===r[1])return{data:i,index:s}}else"\t"===t&&(t=" ");i+=t}}function findClosingIndex(e,t,r,n){
|
|
1883
|
+
const i=e.indexOf(t,r);if(-1===i)throw new Error(n);return i+t.length-1}function readTagExp(e,t,r,n=">"){const i=tagExpWithClosingIndex(e,t+1,n);if(!i)return;let s=i.data;const o=i.index,a=s.search(/\s/);let c=s,u=!0;-1!==a&&(c=s.substring(0,a),s=s.substring(a+1).trimStart());const l=c;if(r){const e=c.indexOf(":");-1!==e&&(c=c.substr(e+1),u=c!==i.data.substr(e+1))}return{tagName:c,tagExp:s,closeIndex:o,attrExpPresent:u,rawTagName:l}}function readStopNodeData(e,t,r){const n=r;let i=1;for(;r<e.length;r++)if("<"===e[r])if("/"===e[r+1]){const s=findClosingIndex(e,">",r,`${t} is not closed`);if(e.substring(r+2,s).trim()===t&&(i--,0===i))return{tagContent:e.substring(n,r),i:s};r=s}else if("?"===e[r+1]){r=findClosingIndex(e,"?>",r+1,"StopNode is not closed.")}else if("!--"===e.substr(r+1,3)){r=findClosingIndex(e,"--\x3e",r+3,"StopNode is not closed.")}else if("!["===e.substr(r+1,2)){r=findClosingIndex(e,"]]>",r,"StopNode is not closed.")-2}else{const n=readTagExp(e,r,">");if(n){
|
|
1884
|
+
(n&&n.tagName)===t&&"/"!==n.tagExp[n.tagExp.length-1]&&i++,r=n.closeIndex}}}function parseValue$1(e,t,r){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&toNumber(e,r)}return isExist(e)?e:""}const METADATA_SYMBOL=XmlNode.getMetaDataSymbol();function prettify(e,t){return compress(e,t)}function compress(e,t,r){let n;const i={};for(let s=0;s<e.length;s++){const o=e[s],a=propName(o);let c="";if(c=void 0===r?a:r+"."+a,a===t.textNodeName)void 0===n?n=o[a]:n+=""+o[a];else{if(void 0===a)continue;if(o[a]){let e=compress(o[a],t,c);const r=isLeafTag(e,t);void 0!==o[METADATA_SYMBOL]&&(e[METADATA_SYMBOL]=o[METADATA_SYMBOL]),o[":@"]?assignAttributes(e,o[":@"],c,t):1!==Object.keys(e).length||void 0===e[t.textNodeName]||t.alwaysCreateTextNode?0===Object.keys(e).length&&(t.alwaysCreateTextNode?e[t.textNodeName]="":e=""):e=e[t.textNodeName],void 0!==i[a]&&i.hasOwnProperty(a)?(Array.isArray(i[a])||(i[a]=[i[a]]),i[a].push(e)):t.isArray(a,c,r)?i[a]=[e]:i[a]=e}}}
|
|
1885
|
+
return"string"==typeof n?n.length>0&&(i[t.textNodeName]=n):void 0!==n&&(i[t.textNodeName]=n),i}function propName(e){const t=Object.keys(e);for(let e=0;e<t.length;e++){const r=t[e];if(":@"!==r)return r}}function assignAttributes(e,t,r,n){if(t){const i=Object.keys(t),s=i.length;for(let o=0;o<s;o++){const s=i[o];n.isArray(s,r+"."+s,!0,!0)?e[s]=[t[s]]:e[s]=t[s]}}}function isLeafTag(e,t){const{textNodeName:r}=t,n=Object.keys(e).length;return 0===n||!(1!==n||!e[r]&&"boolean"!=typeof e[r]&&0!==e[r])}class XMLParser{constructor(e){this.externalEntities={},this.options=buildOptions(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const r=validate$2(e,t);if(!0!==r)throw Error(`${r.err.msg}:${r.err.line}:${r.err.col}`)}const r=new OrderedObjParser(this.options);r.addExternalEntities(this.externalEntities);const n=r.parseXml(e)
|
|
1886
|
+
;return this.options.preserveOrder||void 0===n?n:prettify(n,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}static getMetaDataSymbol(){return XmlNode.getMetaDataSymbol()}}var objectToString$2=Object.prototype.toString,isArray$1=Array.isArray||function(e){return"[object Array]"===objectToString$2.call(e)};function isFunction$1(e){return"function"==typeof e}function typeStr(e){return isArray$1(e)?"array":typeof e}function escapeRegExp(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function hasProperty(e,t){return null!=e&&"object"==typeof e&&t in e}function primitiveHasOwnProperty(e,t){return null!=e&&"object"!=typeof e&&e.hasOwnProperty&&e.hasOwnProperty(t)}var regExpTest=RegExp.prototype.test
|
|
1887
|
+
;function testRegExp(e,t){return regExpTest.call(e,t)}var nonSpaceRe=/\S/;function isWhitespace(e){return!testRegExp(nonSpaceRe,e)}var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function escapeHtml$1(e){return String(e).replace(/[&<>"'`=\/]/g,function(e){return entityMap[e]})}var whiteRe=/\s*/,spaceRe=/\s+/,equalsRe=/\s*=/,curlyRe=/\s*\}/,tagRe=/#|\^|\/|>|\{|&|=|!/;function parseTemplate$1(e,t){if(!e)return[];var r,n,i,s=!1,o=[],a=[],c=[],u=!1,l=!1,d="",p=0;function h(){if(u&&!l)for(;c.length;)delete a[c.pop()];else c=[];u=!1,l=!1}function A(e){if("string"==typeof e&&(e=e.split(spaceRe,2)),!isArray$1(e)||2!==e.length)throw new Error("Invalid tags: "+e);r=new RegExp(escapeRegExp(e[0])+"\\s*"),n=new RegExp("\\s*"+escapeRegExp(e[1])),i=new RegExp("\\s*"+escapeRegExp("}"+e[1]))}A(t||mustache.tags);for(var f,g,m,y,E,b,C=new Scanner(e);!C.eos();){if(f=C.pos,
|
|
1888
|
+
m=C.scanUntil(r))for(var v=0,I=m.length;v<I;++v)isWhitespace(y=m.charAt(v))?(c.push(a.length),d+=y):(l=!0,s=!0,d+=" "),a.push(["text",y,f,f+1]),f+=1,"\n"===y&&(h(),d="",p=0,s=!1);if(!C.scan(r))break;if(u=!0,g=C.scan(tagRe)||"name",C.scan(whiteRe),"="===g?(m=C.scanUntil(equalsRe),C.scan(equalsRe),C.scanUntil(n)):"{"===g?(m=C.scanUntil(i),C.scan(curlyRe),C.scanUntil(n),g="&"):m=C.scanUntil(n),!C.scan(n))throw new Error("Unclosed tag at "+C.pos);if(E=">"==g?[g,m,f,C.pos,d,p,s]:[g,m,f,C.pos],p++,a.push(E),"#"===g||"^"===g)o.push(E);else if("/"===g){if(!(b=o.pop()))throw new Error('Unopened section "'+m+'" at '+f);if(b[1]!==m)throw new Error('Unclosed section "'+b[1]+'" at '+f)}else"name"===g||"{"===g||"&"===g?l=!0:"="===g&&A(m)}if(h(),b=o.pop())throw new Error('Unclosed section "'+b[1]+'" at '+C.pos);return nestTokens(squashTokens(a))}function squashTokens(e){for(var t,r,n=[],i=0,s=e.length;i<s;++i)(t=e[i])&&("text"===t[0]&&r&&"text"===r[0]?(r[1]+=t[1],r[3]=t[3]):(n.push(t),r=t));return n}
|
|
1889
|
+
function nestTokens(e){for(var t,r=[],n=r,i=[],s=0,o=e.length;s<o;++s)switch((t=e[s])[0]){case"#":case"^":n.push(t),i.push(t),n=t[4]=[];break;case"/":i.pop()[5]=t[2],n=i.length>0?i[i.length-1][4]:r;break;default:n.push(t)}return r}function Scanner(e){this.string=e,this.tail=e,this.pos=0}function Context(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function Writer(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}Scanner.prototype.eos=function(){return""===this.tail},Scanner.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var r=t[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r},Scanner.prototype.scanUntil=function(e){var t,r=this.tail.search(e);switch(r){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,r),this.tail=this.tail.substring(r)}return this.pos+=t.length,t},
|
|
1890
|
+
Context.prototype.push=function(e){return new Context(e,this)},Context.prototype.lookup=function(e){var t,r=this.cache;if(r.hasOwnProperty(e))t=r[e];else{for(var n,i,s,o=this,a=!1;o;){if(e.indexOf(".")>0)for(n=o.view,i=e.split("."),s=0;null!=n&&s<i.length;)s===i.length-1&&(a=hasProperty(n,i[s])||primitiveHasOwnProperty(n,i[s])),n=n[i[s++]];else n=o.view[e],a=hasProperty(o.view,e);if(a){t=n;break}o=o.parent}r[e]=t}return isFunction$1(t)&&(t=t.call(this.view)),t},Writer.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},Writer.prototype.parse=function(e,t){var r=this.templateCache,n=e+":"+(t||mustache.tags).join(":"),i=void 0!==r,s=i?r.get(n):void 0;return null==s&&(s=parseTemplate$1(e,t),i&&r.set(n,s)),s},Writer.prototype.render=function(e,t,r,n){var i=this.getConfigTags(n),s=this.parse(e,i),o=t instanceof Context?t:new Context(t,void 0);return this.renderTokens(s,o,r,e,n)},Writer.prototype.renderTokens=function(e,t,r,n,i){
|
|
1891
|
+
for(var s,o,a,c="",u=0,l=e.length;u<l;++u)a=void 0,"#"===(o=(s=e[u])[0])?a=this.renderSection(s,t,r,n,i):"^"===o?a=this.renderInverted(s,t,r,n,i):">"===o?a=this.renderPartial(s,t,r,i):"&"===o?a=this.unescapedValue(s,t):"name"===o?a=this.escapedValue(s,t,i):"text"===o&&(a=this.rawValue(s)),void 0!==a&&(c+=a);return c},Writer.prototype.renderSection=function(e,t,r,n,i){var s=this,o="",a=t.lookup(e[1]);if(a){if(isArray$1(a))for(var c=0,u=a.length;c<u;++c)o+=this.renderTokens(e[4],t.push(a[c]),r,n,i);else if("object"==typeof a||"string"==typeof a||"number"==typeof a)o+=this.renderTokens(e[4],t.push(a),r,n,i);else if(isFunction$1(a)){if("string"!=typeof n)throw new Error("Cannot use higher-order sections without the original template");a=a.call(t.view,n.slice(e[3],e[5]),function(e){return s.render(e,t,r,i)}),null!=a&&(o+=a)}else o+=this.renderTokens(e[4],t,r,n,i);return o}},Writer.prototype.renderInverted=function(e,t,r,n,i){var s=t.lookup(e[1])
|
|
1892
|
+
;if(!s||isArray$1(s)&&0===s.length)return this.renderTokens(e[4],t,r,n,i)},Writer.prototype.indentPartial=function(e,t,r){for(var n=t.replace(/[^ \t]/g,""),i=e.split("\n"),s=0;s<i.length;s++)i[s].length&&(s>0||!r)&&(i[s]=n+i[s]);return i.join("\n")},Writer.prototype.renderPartial=function(e,t,r,n){if(r){var i=this.getConfigTags(n),s=isFunction$1(r)?r(e[1]):r[e[1]];if(null!=s){var o=e[6],a=e[5],c=e[4],u=s;0==a&&c&&(u=this.indentPartial(s,c,o));var l=this.parse(u,i);return this.renderTokens(l,t,r,u,n)}}},Writer.prototype.unescapedValue=function(e,t){var r=t.lookup(e[1]);if(null!=r)return r},Writer.prototype.escapedValue=function(e,t,r){var n=this.getConfigEscape(r)||mustache.escape,i=t.lookup(e[1]);if(null!=i)return"number"==typeof i&&n===mustache.escape?String(i):n(i)},Writer.prototype.rawValue=function(e){return e[1]},Writer.prototype.getConfigTags=function(e){return isArray$1(e)?e:e&&"object"==typeof e?e.tags:void 0},Writer.prototype.getConfigEscape=function(e){
|
|
1893
|
+
return e&&"object"==typeof e&&!isArray$1(e)?e.escape:void 0};var mustache={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){defaultWriter.templateCache=e},get templateCache(){return defaultWriter.templateCache}},defaultWriter=new Writer;mustache.clearCache=function(){return defaultWriter.clearCache()},mustache.parse=function(e,t){return defaultWriter.parse(e,t)},mustache.render=function(e,t,r,n){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+typeStr(e)+'" was given as the first argument for mustache#render(template, view, partials)');return defaultWriter.render(e,t,r,n)},mustache.escape=escapeHtml$1,mustache.Scanner=Scanner,mustache.Context=Context,mustache.Writer=Writer;let SimpleEventEmitter$1=class{constructor(){this.events={},this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),
|
|
1894
|
+
this.events[e].push(t),()=>{this.events[e]=this.events[e].filter(e=>e!==t)}}emit(e,t){for(const r of this.events[e]||[])r(t);for(const r of this.events["*"]||[])r(e,t)}};const DEFAULT_PROMPT_CACHE_TTL_SECONDS=60;class LangfusePromptCacheItem{constructor(e,t){this.value=e,this._expiry=Date.now()+1e3*t}get isExpired(){return Date.now()>this._expiry}}class LangfusePromptCache{constructor(){this._cache=new Map,this._defaultTtlSeconds=DEFAULT_PROMPT_CACHE_TTL_SECONDS,this._refreshingKeys=new Map}getIncludingExpired(e){return this._cache.get(e)??null}set(e,t,r){const n=r??this._defaultTtlSeconds;this._cache.set(e,new LangfusePromptCacheItem(t,n))}addRefreshingPromise(e,t){this._refreshingKeys.set(e,t),t.then(()=>{this._refreshingKeys.delete(e)}).catch(()=>{this._refreshingKeys.delete(e)})}isRefreshing(e){return this._refreshingKeys.has(e)}invalidate(e){console.log("invalidating",e,this._cache.keys());for(const t of this._cache.keys())t.startsWith(e)&&this._cache.delete(t)}}
|
|
1895
|
+
var LangfusePersistedProperty,ChatMessageType;!function(e){e.Props="props",e.Queue="queue",e.OptedOut="opted_out"}(LangfusePersistedProperty||(LangfusePersistedProperty={})),function(e){e.ChatMessage="chatmessage",e.Placeholder="placeholder"}(ChatMessageType||(ChatMessageType={})),mustache.escape=function(e){return e};class BasePromptClient{constructor(e,t=!1,r){this.name=e.name,this.version=e.version,this.config=e.config,this.labels=e.labels,this.tags=e.tags,this.isFallback=t,this.type=r,this.commitMessage=e.commitMessage}_transformToLangchainVariables(e){return this.escapeJsonForLangchain(e).replace(/\{\{(\w+)\}\}/g,"{$1}")}escapeJsonForLangchain(e){const t=[],r=[];let n=0;const i=e.length;for(;n<i;){const s=e[n];if("{"===s){if(n+1<i&&"{"===e[n+1]){t.push("{{"),n+=2;continue}let s=n+1;for(;s<i&&/\s/.test(e[s]);)s++;const o=s<i&&("'"===e[s]||'"'===e[s]);t.push(o?"{{":"{"),r.push(o),n+=1;continue}if("}"===s){if(n+1<i&&"}"===e[n+1]){t.push("}}"),n+=2;continue}const s=r.pop()??!1
|
|
1896
|
+
;t.push(s?"}}":"}"),n+=1;continue}t.push(s),n+=1}return t.join("")}}class TextPromptClient extends BasePromptClient{constructor(e,t=!1){super(e,t,"text"),this.promptResponse=e,this.prompt=e.prompt}compile(e,t){return mustache.render(this.promptResponse.prompt,e??{})}getLangchainPrompt(e){return this._transformToLangchainVariables(this.prompt)}toJSON(){return JSON.stringify({name:this.name,prompt:this.prompt,version:this.version,isFallback:this.isFallback,tags:this.tags,labels:this.labels,type:this.type,config:this.config})}}class ChatPromptClient extends BasePromptClient{constructor(e,t=!1){const r=ChatPromptClient.normalizePrompt(e.prompt),n={...e,prompt:r};super(n,t,"chat"),this.promptResponse=n,this.prompt=r}static normalizePrompt(e){return e.map(e=>"type"in e?e:{type:ChatMessageType.ChatMessage,...e})}compile(e,t){const r=[],n=t??{};for(const e of this.prompt)if("type"in e&&e.type===ChatMessageType.Placeholder){const t=n[e.name]
|
|
1897
|
+
;Array.isArray(t)&&t.length>0&&t.every(e=>"object"==typeof e&&"role"in e&&"content"in e)?r.push(...t):Array.isArray(t)&&0===t.length||(void 0!==t?r.push(JSON.stringify(t)):r.push(e))}else"role"in e&&"content"in e&&e.type===ChatMessageType.ChatMessage&&r.push({role:e.role,content:e.content});return r.map(t=>"object"==typeof t&&null!==t&&"role"in t&&"content"in t?{...t,content:mustache.render(t.content,e??{})}:t)}getLangchainPrompt(e){const t=[],r=e?.placeholders??{};for(const e of this.prompt)if("type"in e&&e.type===ChatMessageType.Placeholder){const n=r[e.name];Array.isArray(n)&&n.length>0&&n.every(e=>"object"==typeof e&&"role"in e&&"content"in e)?t.push(...n.map(e=>({role:e.role,content:this._transformToLangchainVariables(e.content)}))):Array.isArray(n)&&0===n.length||(void 0!==n?t.push(JSON.stringify(n)):t.push({variableName:e.name,optional:!1}))}else"role"in e&&"content"in e&&e.type===ChatMessageType.ChatMessage&&t.push({role:e.role,
|
|
1898
|
+
content:this._transformToLangchainVariables(e.content)});return t}toJSON(){return JSON.stringify({name:this.name,prompt:this.promptResponse.prompt.map(e=>{if("type"in e&&e.type===ChatMessageType.ChatMessage){const{type:t,...r}=e;return r}return e}),version:this.version,isFallback:this.isFallback,tags:this.tags,labels:this.labels,type:this.type,config:this.config})}}function assert$3(e,t){if(!e)throw new Error(t)}function removeTrailingSlash$2(e){return e?.replace(/\/+$/,"")}async function retriable$1(e,t={},r){const{retryCount:n=3,retryDelay:i=5e3,retryCheck:s=()=>!0}=t;let o=null;for(let t=0;t<n+1;t++){t>0&&(await new Promise(e=>setTimeout(e,i)),r(`Retrying ${t+1} of ${n+1}`));try{return await e()}catch(e){if(o=e,!s(e))throw e;r(`Retriable error: ${JSON.stringify(e)}`)}}throw o}function generateUUID(e){let t=(new Date).getTime(),r=e&&e.performance&&e.performance.now&&1e3*e.performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){
|
|
1899
|
+
let n=16*Math.random();return t>0?(n=(t+n)%16|0,t=Math.floor(t/16)):(n=(r+n)%16|0,r=Math.floor(r/16)),("x"===e?n:3&n|8).toString(16)})}function currentTimestamp(){return(new Date).getTime()}function currentISOTime$1(){return(new Date).toISOString()}function safeSetTimeout$1(e,t){const r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function getEnv$1(e){return"undefined"!=typeof process&&process.env[e]?process.env[e]:"undefined"!=typeof globalThis?globalThis[e]:void 0}function configLangfuseSDK(e,t=!0){const{publicKey:r,secretKey:n,...i}=e??{},s=r??getEnv$1("LANGFUSE_PUBLIC_KEY"),o=t?n??getEnv$1("LANGFUSE_SECRET_KEY"):void 0,a=i.baseUrl??getEnv$1("LANGFUSE_BASEURL");return{publicKey:s,...t?{secretKey:o}:void 0,...{...i,baseUrl:a}}}const encodeQueryParams=e=>{const t=new URLSearchParams;return Object.entries(e??{}).forEach(([e,r])=>{null!=r&&(r instanceof Date?t.append(e,r.toISOString()):t.append(e,r.toString()))}),t.toString()};var utils$7=Object.freeze({__proto__:null,assert:assert$3,
|
|
1900
|
+
configLangfuseSDK,currentISOTime:currentISOTime$1,currentTimestamp,encodeQueryParams,generateUUID,getEnv:getEnv$1,removeTrailingSlash:removeTrailingSlash$2,retriable:retriable$1,safeSetTimeout:safeSetTimeout$1});const common_release_envs=["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","TRIGGER_DEPLOYMENT_ID"];function getCommonReleaseEnvs(){for(const e of common_release_envs){const t=getEnv$1(e);if(t)return t}}let fs$4=null,cryptoModule=null;const dynamicImport=e=>import(e);void 0!==globalThis.Deno?Promise.all([dynamicImport("node:fs"),dynamicImport("node:crypto")]).then(([e,t])=>{fs$4=e,cryptoModule=t}).catch():"undefined"!=typeof process&&process.versions?.node?Promise.all([dynamicImport("fs"),dynamicImport("crypto")]).then(([e,t])=>{fs$4=e,cryptoModule=t}).catch():"undefined"!=typeof crypto&&(cryptoModule=crypto);class LangfuseMedia{constructor(e){
|
|
1901
|
+
const{obj:t,base64DataUri:r,contentType:n,contentBytes:i,filePath:s}=e;if(this.obj=t,this._mediaId=void 0,r){const[e,t]=this.parseBase64DataUri(r);this._contentBytes=e,this._contentType=t,this._source="base64_data_uri"}else if(i&&n)this._contentBytes=i,this._contentType=n,this._source="bytes";else if(s&&n){if(!fs$4)throw new Error("File system support is not available in this environment");if(!fs$4.existsSync(s))throw new Error(`File at path ${s} does not exist`);this._contentBytes=this.readFile(s),this._contentType=this._contentBytes?n:void 0,this._source=this._contentBytes?"file":void 0}else console.error("base64DataUri, or contentBytes and contentType, or filePath must be provided to LangfuseMedia")}readFile(e){try{if(!fs$4)throw new Error("File system support is not available in this environment");return fs$4.readFileSync(e)}catch(t){return void console.error(`Error reading file at path ${e}`,t)}}parseBase64DataUri(e){try{
|
|
1902
|
+
if(!e||"string"!=typeof e)throw new Error("Data URI is not a string");if(!e.startsWith("data:"))throw new Error("Data URI does not start with 'data:'");const[t,r]=e.slice(5).split(",",2);if(!t||!r)throw new Error("Invalid URI");const n=t.split(";");if(!n.includes("base64"))throw new Error("Data is not base64 encoded");const i=n[0];if(!i)throw new Error("Content type is empty");return[Buffer.from(r,"base64"),i]}catch(e){return console.error("Error parsing base64 data URI",e),[void 0,void 0]}}get contentLength(){return this._contentBytes?.length}get contentSha256Hash(){if(!this._contentBytes)return;if(!cryptoModule)return void console.error("Crypto support is not available in this environment");return cryptoModule.createHash("sha256").update(this._contentBytes).digest("base64")}toJSON(){
|
|
1908
1903
|
return this._contentType&&this._source&&this._mediaId?`@@@langfuseMedia:type=${this._contentType}|id=${this._mediaId}|source=${this._source}@@@`:`<Upload handling failed for LangfuseMedia of type ${this._contentType}>`}static parseReferenceString(e){const t="@@@langfuseMedia:";if(!e.startsWith(t))throw new Error("Reference string does not start with '@@@langfuseMedia:type='");if(!e.endsWith("@@@"))throw new Error("Reference string does not end with '@@@'");const r=e.slice(17,-3).split("|"),n={};for(const e of r){const[t,r]=e.split("=",2);n[t]=r}if(!("type"in n&&"id"in n&&"source"in n))throw new Error("Missing required fields in reference string");return{mediaId:n.id,source:n.source,contentType:n.type}}static async resolveMediaReferences(e){const{obj:t,langfuseClient:r,maxDepth:n=10}=e;return async function e(t,i){if(i>n)return t;if("string"==typeof t){const e=/@@@langfuseMedia:.+?@@@/g,n=t.match(e);if(!n)return t;let i=t;const s=new Map;await Promise.all(n.map(async e=>{try{
|
|
1909
1904
|
const t=LangfuseMedia.parseReferenceString(e),n=await r.fetchMedia(t.mediaId),i=await r.fetch(n.url,{method:"GET",headers:{}});if(200!==i.status)throw new Error("Failed to fetch media content");const o=Buffer.from(await i.arrayBuffer()).toString("base64"),a=`data:${n.contentType};base64,${o}`;s.set(e,a)}catch(t){console.warn("Error fetching media content for reference string",e,t)}}));for(const[e,t]of s.entries())i=i.replaceAll(e,t);return i}return Array.isArray(t)?Promise.all(t.map(async t=>await e(t,i+1))):"object"==typeof t&&null!==t?Object.fromEntries(await Promise.all(Object.entries(t).map(async([t,r])=>[t,await e(r,i+1)]))):t}(t,0)}}function isInSample(e,t){return void 0===t||0!==t&&(t<0||t>1||isNaN(t)?(console.warn("Sample rate must be between 0 and 1. Ignoring setting."),!0):simpleHash(e)<t)}function simpleHash(e){let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)>>>0;return t=73244475*(t>>>16^t),t=73244475*(t>>>16^t),t^=t>>>16,Math.abs(t)/2147483647}
|
|
1910
1905
|
const MAX_EVENT_SIZE_BYTES=getEnv$1("LANGFUSE_MAX_EVENT_SIZE_BYTES")?Number(getEnv$1("LANGFUSE_MAX_EVENT_SIZE_BYTES")):1e6,MAX_BATCH_SIZE_BYTES=getEnv$1("LANGFUSE_MAX_BATCH_SIZE_BYTES")?Number(getEnv$1("LANGFUSE_MAX_BATCH_SIZE_BYTES")):25e5,ENVIRONMENT_PATTERN=/^(?!langfuse)[a-z0-9_-]+$/,WHITELISTED_LANGFUSE_INTERNAL_ENVIRONMENTS=["langfuse-prompt-experiment"];class LangfuseFetchHttpError extends Error{constructor(e,t){super("HTTP error while fetching Langfuse: "+e.status+" and body: "+t),this.response=e,this.name="LangfuseFetchHttpError"}}class LangfuseFetchNetworkError extends Error{constructor(e){super("Network error while fetching Langfuse",e instanceof Error?{cause:e}:{}),this.error=e,this.name="LangfuseFetchNetworkError"}}function isLangfuseFetchHttpError(e){return"object"==typeof e&&"LangfuseFetchHttpError"===e.name}function isLangfuseFetchNetworkError(e){return"object"==typeof e&&"LangfuseFetchNetworkError"===e.name}function isLangfuseFetchError(e){
|
|
@@ -2422,10 +2417,10 @@ this.#or=createLocalJWKSet(this.#ar.jwks)))}pendingFetch(){return!!this.#nr}cool
|
|
|
2422
2417
|
get:()=>r.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>r.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>r.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>r.jwks(),enumerable:!0,configurable:!1,writable:!1}}),n}async function initialiseDeviceAuthFlow(e){const t=await fetch("https://api.workos.com/user_management/authorize/device",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:e})}),r=await t.json();return{deviceCode:r.device_code,userCode:r.user_code,verificationUri:r.verification_uri,verificationUriComplete:r.verification_uri_complete,expiresIn:r.expires_in,interval:r.interval}}async function pollForTokens({authClientId:e,deviceCode:t,expiresIn:r,interval:n,signal:i}){const s=AbortSignal.timeout(r);for(;;){i&&throwWhenAborted(i);const r=await _fetchTokens({authClientId:e,deviceCode:t,timeoutSignal:s});if("access_token"in r)return{accessToken:r.access_token,
|
|
2423
2418
|
refreshToken:r.refresh_token};if(!("error"in r))return{error:"Authorization failed"};switch(r.error){case"authorization_pending":await sleepWithAbort(n,i);break;case"slow_down":n+=1e3,await sleepWithAbort(n,i);break;case"access_denied":return{error:"Access denied"};case"expired_token":return{error:"Expired token"};default:return{error:"Authorization failed"}}}}async function _fetchTokens(e){try{const t=await fetch("https://api.workos.com/user_management/authenticate",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e.deviceCode,client_id:e.authClientId}),signal:e.timeoutSignal});return await t.json()}catch(e){if(e instanceof Error&&"TimeoutError"===e.name)return{error:"Authorization timed out"};throw e}}async function authenticateWithRefreshToken(e,t){const r=await fetch("https://api.workos.com/user_management/authenticate",{method:"POST",headers:{
|
|
2424
2419
|
"Content-Type":"application/json"},body:JSON.stringify({grant_type:"refresh_token",client_id:e,refresh_token:t,user_agent:"tessl.cli"})}),n=await r.json();if(r.ok){const e=n;return{user:{id:e.user.id,email:e.user.email,firstName:e.user.first_name,lastName:e.user.last_name},accessToken:e.access_token,refreshToken:e.refresh_token}}return{error:getErrorFromResponseBody(n)||"Failed to authenticate with refresh token"}}function getAuthClientId(){const e="client_01HXSHDD9KV92A4892CWHZZDDR";if(!e.startsWith("client_"))throw new Error("Auth client id not set to appropriate value - please check `WORKOS_CLIENT_ID` env var");return e}function getErrorFromResponseBody(e){if("object"==typeof e&&e){if("error_description"in e&&"string"==typeof e.error_description)return e.error_description;if("error"in e&&"string"==typeof e.error)return e.error}}async function validateAccessTokenWithJWKS(e,t){const r=createRemoteJWKSet(new URL(`https://api.workos.com/sso/jwks/${t}`)),{payload:n}=await jwtVerify(e,r,{
|
|
2425
|
-
issuer:"https://api.workos.com"});return n}function _optionalChain$w(e){let t,r=e[0],n=1;for(;n<e.length;){const i=e[n],s=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=s(r)):"call"!==i&&"optionalCall"!==i||(r=s((...e)=>r.call(t,...e)),t=void 0)}return r}async function createDotenvFile(e,t,r,n){e.debug({},"provisioning dotenv file");const i=getTesslClient(t,n),s=await i.GET("/experimental/cli-env");if("error"in s)throw e.error({err:s.error},"Failed to fetch dotenv data"),new Error("Failed to setup environment file: please try again");const o=_optionalChain$w([s,"access",e=>e.data,"optionalAccess",e=>e.data,"optionalAccess",e=>e.attributes,"optionalAccess",e=>e.envVars]);if(!o||"object"!=typeof o)throw e.warn({},"No environment variables received from API"),new Error("Failed to setup environment file: please try again")
|
|
2426
|
-
;
|
|
2427
|
-
;return t.debug({path:n},"writing auth"),await writeText(n,JSON.stringify(e),AUTH_PERMISSIONS),e},updateAuth=async(e,t,r=DEFAULT_TESSL_PATHS.globalConfigDir)=>{const n=resolve$3(r,AUTH_FILENAME),i={...await readAuth(r),...e};return t.debug({path:n},"updating auth"),await writeText(n,JSON.stringify(i),AUTH_PERMISSIONS),i},getCreds=async(e,t,r=DEFAULT_TESSL_PATHS.globalConfigDir)=>{if(process.env.TESSL_SIMULATE_LOGOUT)return null;if(process.env.TESSL_TOKEN)return{accessToken:process.env.TESSL_TOKEN,refreshToken:"",user:{id:"token-user",email:"token@example.com"}};try{const n=await readAuth(r);return await refreshSessionIfNeeded(e,t,n,r)}catch(t){e.error({err:t},"error getting credentials");try{await clearAuth(e,r)}catch(t){e.debug({err:t},"failed to clear auth file")}return null}},isAuthed=async(e,t,r)=>null!==await getCreds(e,t,r),clearAuth=async(e,t=DEFAULT_TESSL_PATHS.globalConfigDir)=>{const r=resolve$3(t,AUTH_FILENAME);e.debug({path:r
|
|
2428
|
-
existsSync$1(r)?await unlink(r):e.debug({path:r},"auth file does not exist, nothing to clear")};async function refreshSessionIfNeeded(e,t,r,n=DEFAULT_TESSL_PATHS.globalConfigDir){const{accessToken:i,refreshToken:s}=r,o=t.WORKOS_CLIENT_ID;if(!o)throw new Error("no auth client id configured");try{e.debug({},"Validating access token with JWKS");const t=(await validateAccessTokenWithJWKS(i,o)).exp;if(t){if(!(Math.floor(Date.now()/1e3)>=t-5))return e.debug({},"Access token valid, not expired"),r;e.debug({},"Access token expired, will refresh")}else e.debug({},"No expiry claim in token payload, will refresh")}catch(t){e.debug({err:t},"JWKS validation failed, will refresh token")}const a=await authenticateWithRefreshToken(o,s);if("error"in a)throw e.error({response:a},"error authenticating with refresh token"),new Error("error while authenticating with refresh token");const{accessToken:c,refreshToken:u}=a,l=await updateAuth({accessToken:c,refreshToken:u},e,n)
|
|
2420
|
+
issuer:"https://api.workos.com"});return n}function _optionalChain$w(e){let t,r=e[0],n=1;for(;n<e.length;){const i=e[n],s=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=s(r)):"call"!==i&&"optionalCall"!==i||(r=s((...e)=>r.call(t,...e)),t=void 0)}return r}async function createDotenvFile(e,t,r,n){e.debug({},"provisioning dotenv file");const i=getTesslClient(t,n),s=await i.GET("/experimental/cli-env");if("error"in s)throw e.error({err:s.error},"Failed to fetch dotenv data"),new Error("Failed to setup environment file: please try again");const o=_optionalChain$w([s,"access",e=>e.data,"optionalAccess",e=>e.data,"optionalAccess",e=>e.attributes,"optionalAccess",e=>e.envVars]);if(!o||"object"!=typeof o)throw e.warn({},"No environment variables received from API"),new Error("Failed to setup environment file: please try again");const a=`# Generated on ${(new Date).toISOString()} from ${t.TESSL_BASE_API_URL}`;let c=o
|
|
2421
|
+
;"development"===t.NODE_ENV&&(c=Object.fromEntries(Object.entries(c).filter(([e])=>"LANGFUSE_PROXY_TOKEN"!==e)));const u=Object.entries(c).map(([e,t])=>`${e}="${t}"`).join("\n"),l=u?`${a}\n${u}`:a,d=join(r,"dotenv");await mkdir(dirname$1(d),{recursive:!0}),await writeFile(d,l,"utf-8"),await chmod(d,384),e.debug({path:d},"Created dotenv file")}const DEFAULT_TESSL_PATHS={globalConfigDir:getDefaultGlobalConfigDir(),projDir:process.cwd()},CredsSchema=Type.Object({accessToken:Type.String(),refreshToken:Type.String(),user:Type.Object({id:Type.String(),email:Type.String(),firstName:Type.Optional(Type.String()),lastName:Type.Optional(Type.String()),username:Type.Optional(Type.String())})}),AUTH_FILENAME="api-credentials.json",AUTH_PERMISSIONS=384,readAuth=async(e=DEFAULT_TESSL_PATHS.globalConfigDir)=>{const t=resolve$3(e,AUTH_FILENAME),r=await readFile$2(t),n=JSON.parse(r.toString());return strictCheck(CredsSchema,n),n},writeAuth=async(e,t,r=DEFAULT_TESSL_PATHS.globalConfigDir)=>{
|
|
2422
|
+
const n=resolve$3(r,AUTH_FILENAME);return t.debug({path:n},"writing auth"),await writeText(n,JSON.stringify(e),AUTH_PERMISSIONS),e},updateAuth=async(e,t,r=DEFAULT_TESSL_PATHS.globalConfigDir)=>{const n=resolve$3(r,AUTH_FILENAME),i={...await readAuth(r),...e};return t.debug({path:n},"updating auth"),await writeText(n,JSON.stringify(i),AUTH_PERMISSIONS),i},getCreds=async(e,t,r=DEFAULT_TESSL_PATHS.globalConfigDir)=>{if(process.env.TESSL_SIMULATE_LOGOUT)return null;if(process.env.TESSL_TOKEN)return{accessToken:process.env.TESSL_TOKEN,refreshToken:"",user:{id:"token-user",email:"token@example.com"}};try{const n=await readAuth(r);return await refreshSessionIfNeeded(e,t,n,r)}catch(t){e.error({err:t},"error getting credentials");try{await clearAuth(e,r)}catch(t){e.debug({err:t},"failed to clear auth file")}return null}},isAuthed=async(e,t,r)=>null!==await getCreds(e,t,r),clearAuth=async(e,t=DEFAULT_TESSL_PATHS.globalConfigDir)=>{const r=resolve$3(t,AUTH_FILENAME);e.debug({path:r
|
|
2423
|
+
},"clearing auth"),existsSync$1(r)?await unlink(r):e.debug({path:r},"auth file does not exist, nothing to clear")};async function refreshSessionIfNeeded(e,t,r,n=DEFAULT_TESSL_PATHS.globalConfigDir){const{accessToken:i,refreshToken:s}=r,o=t.WORKOS_CLIENT_ID;if(!o)throw new Error("no auth client id configured");try{e.debug({},"Validating access token with JWKS");const t=(await validateAccessTokenWithJWKS(i,o)).exp;if(t){if(!(Math.floor(Date.now()/1e3)>=t-5))return e.debug({},"Access token valid, not expired"),r;e.debug({},"Access token expired, will refresh")}else e.debug({},"No expiry claim in token payload, will refresh")}catch(t){e.debug({err:t},"JWKS validation failed, will refresh token")}const a=await authenticateWithRefreshToken(o,s);if("error"in a)throw e.error({response:a},"error authenticating with refresh token"),new Error("error while authenticating with refresh token");const{accessToken:c,refreshToken:u}=a,l=await updateAuth({accessToken:c,refreshToken:u},e,n)
|
|
2429
2424
|
;return await createDotenvFile(e,t,n||DEFAULT_TESSL_PATHS.globalConfigDir,c),e.debug({},"Token refreshed successfully"),l}function _nullishCoalesce$p(e,t){return null!=e?e:t()}function _optionalChain$v(e){let t,r=e[0],n=1;for(;n<e.length;){const i=e[n],s=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=s(r)):"call"!==i&&"optionalCall"!==i||(r=s((...e)=>r.call(t,...e)),t=void 0)}return r}const SPINNER_OPTIONS={hideCursor:!1,discardStdin:!1},loginCommand=new Command$1({name:"login",summary:"Login to Tessl; requires a Tessl account. See https://www.tessl.io/ to request access.",flags:{},requiresConfig:!1,handler:async({monitoring:{logger:e},env:t,tesslClient:r})=>{const n=arg(flagToSpec(GlobalFlags),{permissive:!0})["--global-config-dir"]||DEFAULT_TESSL_PATHS.globalConfigDir;if(await handleTokenLogin(e,t,n))return SUCCESS;return await login({logger:e,env:t,globalConfigDir:n,tesslClient:r})}})
|
|
2430
2425
|
;async function login({logger:e,env:t,globalConfigDir:r=DEFAULT_TESSL_PATHS.globalConfigDir,tesslClient:n}){const i=ora({text:"Initializing login flow",...SPINNER_OPTIONS}).start(),s=getAuthClientId();let o;try{o=await initialiseDeviceAuthFlow(s)}catch(t){return e.error({err:t},"Failed to initialize device auth flow"),i.fail("Failed to initialize device auth flow"),FAILURE}i.stop();let a=!1;try{await open(o.verificationUriComplete),a=!0}catch(e){}const c=stripIndent`
|
|
2431
2426
|
If you have access to the full Tessl framework, you can log in at the following URL. (To request access, go to https://www.tessl.io/)
|
|
@@ -2475,9 +2470,11 @@ ansiEscapes$1.exports}var ansiEscapesExports=requireAnsiEscapes(),ansiEscapes=ge
|
|
|
2475
2470
|
;if(-1===e)throw new ValidationError$1("[select prompt] No selectable choices. All choices are disabled.");return{first:e,last:t}},[l]),p=useMemo(()=>"default"in e?l.findIndex(t=>isSelectable(t)&&t.value===e.default):-1,[e.default,l]),[h,A]=useState(-1===p?d.first:p),f=l[h];useKeypress((e,n)=>{if(clearTimeout(u.current),isEnterKey(e))a("done"),t(f.value);else if(isUpKey(e)||isDownKey(e)){if(n.clearLine(0),r||isUpKey(e)&&h!==d.first||isDownKey(e)&&h!==d.last){const t=isUpKey(e)?-1:1;let r=h;do{r=(r+t+l.length)%l.length}while(!isSelectable(l[r]));A(r)}}else if(isNumberKey(e)&&!Number.isNaN(Number(n.line))){const e=Number(n.line)-1;let t=-1;const r=l.findIndex(r=>!Separator.isSeparator(r)&&(t++,t===e)),i=l[r];null!=i&&isSelectable(i)&&A(r),u.current=setTimeout(()=>{n.clearLine(0)},700)}else if(isBackspaceKey(e))n.clearLine(0);else{const e=n.line.toLowerCase(),t=l.findIndex(t=>!(Separator.isSeparator(t)||!isSelectable(t))&&t.name.toLowerCase().startsWith(e));-1!==t&&A(t),
|
|
2476
2471
|
u.current=setTimeout(()=>{n.clearLine(0)},700)}}),useEffect(()=>()=>{clearTimeout(u.current)},[]);const g=s.style.message(e.message,o);let m="",y="";("always"===s.helpMode||"auto"===s.helpMode&&i.current)&&(i.current=!1,l.length>n?y=`\n${s.style.help(`(${e.instructions?.pager??"Use arrow keys to reveal more choices"})`)}`:m=s.style.help(`(${e.instructions?.navigation??"Use arrow keys"})`));const E=usePagination({items:l,active:h,renderItem({item:e,isActive:t,index:r}){if(Separator.isSeparator(e))return` ${e.separator}`;const n="number"===s.indexMode?`${r+1}. `:"";if(e.disabled){const t="string"==typeof e.disabled?e.disabled:"(disabled)";return s.style.disabled(`${n}${e.name} ${t}`)}return(t?s.style.highlight:e=>e)(`${t?s.icon.cursor:" "} ${n}${e.name}`)},pageSize:n,loop:r});if("done"===o)return`${c} ${g} ${s.style.answer(f.short)}`;const b=f.description?`\n${s.style.description(f.description)}`:"";return`${[c,g,m].filter(Boolean).join(" ")}\n${E}${y}${b}${ansiEscapes.cursorHide}`})
|
|
2477
2472
|
;function getMCPConfig(e){return{mcpServers:{tessl:{type:"stdio",command:"tessl",args:["mcp",...e?["--config-dir","."]:[]]}}}}function createOrAppendMcpConfig(e){mkdirSync$1(dirname$1(e),{recursive:!0});if(!existsSync(e))return writeFileSync$1(e,JSON.stringify(getMCPConfig(e.includes("cursor")),null,2)),relative$1(process.cwd(),e);const t=readFileSync$1(e,"utf-8"),r=JSON.parse(t);if(!("mcpServers"in r)){const t={...r,...getMCPConfig(e.includes("cursor"))};return writeFileSync$1(e,JSON.stringify(t,null,2)+"\n"),relative$1(process.cwd(),e)}if("object"!=typeof r.mcpServers||null===r.mcpServers)throw new Error(`Expected "mcpServers" to be an object in ${e}`);if("tessl"in r.mcpServers)return;const n={...r,mcpServers:{...r.mcpServers,...getMCPConfig(e.includes("cursor")).mcpServers}};return writeFileSync$1(e,JSON.stringify(n,null,2)+"\n"),relative$1(process.cwd(),e)}function addCursorMcpConfig(e=process.cwd()){return createOrAppendMcpConfig(join(e,".cursor","mcp.json"))}
|
|
2478
|
-
function addGeminiMcpConfig(e=process.cwd()){return createOrAppendMcpConfig(join(e,".gemini","settings.json"))}function addCodexMcpConfig(){const e=join(homedir$1(),".codex","config.toml");mkdirSync$1(dirname$1(e),{recursive:!0});const t={tessl:{command:"tessl",args:["mcp"]}};if(!existsSync(e)){const r={mcp_servers:t};return writeFileSync$1(e,tomlExports.stringify(r)),relative$1(process.cwd(),e)}const r=readFileSync$1(e,"utf-8"),n=tomlExports.parse(r);if(!("mcp_servers"in n)){const r={...n,mcp_servers:t};return writeFileSync$1(e,tomlExports.stringify(r)),relative$1(process.cwd(),e)}if("object"!=typeof n.mcp_servers||null===n.mcp_servers)throw new Error(`Expected "mcp_servers" to be an object in ${e}`);if("tessl"in n.mcp_servers)return;const i={...n,mcp_servers:{...n.mcp_servers,...t}};return writeFileSync$1(e,tomlExports.stringify(i)),relative$1(process.cwd(),e)}function addClaudeMcpConfig(e=process.cwd()){return createOrAppendMcpConfig(join(e,".mcp.json"))}
|
|
2479
|
-
|
|
2480
|
-
|
|
2473
|
+
function addGeminiMcpConfig(e=process.cwd()){return createOrAppendMcpConfig(join(e,".gemini","settings.json"))}function addCodexMcpConfig(){const e=join(homedir$1(),".codex","config.toml");mkdirSync$1(dirname$1(e),{recursive:!0});const t={tessl:{command:"tessl",args:["mcp"]}};if(!existsSync(e)){const r={mcp_servers:t};return writeFileSync$1(e,tomlExports.stringify(r)),relative$1(process.cwd(),e)}const r=readFileSync$1(e,"utf-8"),n=tomlExports.parse(r);if(!("mcp_servers"in n)){const r={...n,mcp_servers:t};return writeFileSync$1(e,tomlExports.stringify(r)),relative$1(process.cwd(),e)}if("object"!=typeof n.mcp_servers||null===n.mcp_servers)throw new Error(`Expected "mcp_servers" to be an object in ${e}`);if("tessl"in n.mcp_servers)return;const i={...n,mcp_servers:{...n.mcp_servers,...t}};return writeFileSync$1(e,tomlExports.stringify(i)),relative$1(process.cwd(),e)}function addClaudeMcpConfig(e=process.cwd()){return createOrAppendMcpConfig(join(e,".mcp.json"))}
|
|
2474
|
+
const TESSL_RULES_DIR=".cursor/rules/tessl/framework",FRAMEWORK_RULES={"agents.mdc":{content:FRAMEWORK_FILES["agents.md"],description:"Tessl framework",alwaysApply:!0},"bootstrap.mdc":{content:FRAMEWORK_FILES["bootstrap.md"],description:"Configuring a project"},"plan-files.mdc":{content:FRAMEWORK_FILES["plan-files.md"],description:"Planning"},"docs/spec-driven-development.mdc":{content:FRAMEWORK_FILES["docs/spec-driven-development.md"],description:"Spec driven development",alwaysApply:!0},"docs/spec-format.mdc":{content:FRAMEWORK_FILES["docs/spec-format.md"],description:"Spec format"}},KNOWLEDGE_ONLY_RULES={"usage-specs.mdc":{content:KNOWLEDGE_ONLY_FILES["usage-specs.md"],description:"Working with external dependencies",alwaysApply:!0}};function installCursorFiles(e){const t=[],r=path__default.join(e,TESSL_RULES_DIR);if(fs$8.existsSync(r)&&fs$8.rmSync(r,{recursive:!0}),fs$8.mkdirSync(r,{recursive:!0}),
|
|
2475
|
+
"full"===getExistingFrameworkType(e))for(const[n,i]of Object.entries(FRAMEWORK_RULES)){const s=writeMdcContent(r,n,i);t.push(path__default.relative(e,s))}else for(const[n,i]of Object.entries(KNOWLEDGE_ONLY_RULES)){const s=writeMdcContent(r,n,i);t.push(path__default.relative(e,s))}return t}function writeMdcContent(e,t,r){const n=toMdcContent(r),i=path__default.join(e,t);return fs$8.existsSync(path__default.dirname(i))||fs$8.mkdirSync(path__default.dirname(i),{recursive:!0}),fs$8.writeFileSync(i,n),i}function toMdcContent(e){return`---\n${[`description: ${e.description}`,"alwaysApply"in e?`alwaysApply: ${e.alwaysApply}`:"","globs"in e?`globs: ${e.globs}`:""].filter(Boolean).join("\n")}\n---\n${e.content.replaceAll(/((?:\[[^\]]*\]\([^)]*?)|@docs\/[^\s)]+)\.md\b/g,"$1.mdc")}`}const AGENT_INFO={amp:{label:"Amp",configFile:"AGENTS.md",addMcpConfig:void 0,level:"experimental"},"claude-code":{label:"Claude Code",configFile:"CLAUDE.md",addMcpConfig:addClaudeMcpConfig,level:"core"},cline:{
|
|
2476
|
+
label:"Cline",configFile:"AGENTS.md",addMcpConfig:void 0,level:"experimental"},codex:{label:"Codex",configFile:"AGENTS.md",addMcpConfig:addCodexMcpConfig,level:"alpha"},cursor:{label:"Cursor",configFile:"AGENTS.md",addMcpConfig:addCursorMcpConfig,installCustomFiles:installCursorFiles,level:"alpha"},"gemini-cli":{label:"Gemini CLI",configFile:"GEMINI.md",addMcpConfig:addGeminiMcpConfig,level:"alpha"},"github-copilot":{label:"GitHub Copilot",configFile:"AGENTS.md",addMcpConfig:void 0,level:"experimental"},goose:{label:"Goose",configFile:"AGENTS.md",addMcpConfig:void 0,level:"experimental"},opencode:{label:"opencode",configFile:"AGENTS.md",addMcpConfig:void 0,level:"experimental"},windsurf:{label:"Windsurf",configFile:"AGENTS.md",addMcpConfig:void 0,level:"experimental"},zed:{label:"Zed",configFile:"AGENTS.md",addMcpConfig:void 0,level:"experimental"}},RECOGNIZED_AGENTS=Object.keys(AGENT_INFO);function ensureAgentFiles(e,t){if(0===e.length)return[]
|
|
2477
|
+
;const r=[],n=path__default.join(t,AGENTS_MD_FILENAME);if(!fs$8.existsSync(n))throw new RequiresInitError;const i=path__default.join(t,"TESSL.md");for(const s of e){const e=AGENT_INFO[s].configFile,o=path__default.join(t,e);if(fs$8.existsSync(o)){if(o===n)continue;try{if(fs$8.lstatSync(o).isSymbolicLink()){const e=fs$8.readlinkSync(o);if(path__default.resolve(e)===path__default.resolve(n))continue;path__default.resolve(e)===path__default.resolve(i)&&fs$8.unlinkSync(o)}}catch(t){throw new AggregateError([t],`Failed to process existing file ${e}`)}}fs$8.existsSync(o)||(fs$8.writeFileSync(o,""),r.push({path:e,type:"file",description:"Created agent file"}));const a=`@${AGENTS_MD_FILENAME}`;fs$8.readFileSync(o,"utf-8").includes(a)||fs$8.appendFileSync(o,`\n${a}\n`)}for(const n of e){const e=AGENT_INFO[n];if("installCustomFiles"in e){const n=e.installCustomFiles(t);r.push(...n.map(e=>({path:e,type:"file",description:"Created custom agent file"})))}}return r}const AGENT_CHOICES=(()=>{
|
|
2481
2478
|
const e=Object.entries(AGENT_INFO).filter(([,e])=>"experimental"!==e.level).map(([e,{label:t,level:r}])=>({name:"core"===r?t:`${t} (Alpha)`,value:e})),t=Object.entries(AGENT_INFO).filter(([,e])=>"experimental"===e.level).map(([e,{label:t}])=>({name:chalk.dim(t),value:e}));return[...e,new Separator("-- Experimental support --"),...t]})();async function promptForAgentSelection(e){if(e&&!RECOGNIZED_AGENTS.includes(e))throw new ExpectedError(`Unsupported agent: ${e}`);let t=e;return t||(t=await select({message:"Which agent would you like to set up?",choices:AGENT_CHOICES,loop:!1})),t}async function promptForMcpSetup(e,t,r){const{addMcpConfig:n,label:i}=AGENT_INFO[e];let s=!1;if(void 0!==n&&!r)try{s=t||await confirm({message:`Would you like to auto-configure Tessl's MCP integration for ${i}?`,default:!0})}catch(e){if(!(e instanceof Error&&"ExitPromptError"===e.name))throw e}return s}async function promptForAgentSetup(e,t,r){try{const n=await promptForAgentSelection(e);return{
|
|
2482
2479
|
selectedAgent:n,shouldSetupMcp:await promptForMcpSetup(n,t,r),agentLevel:AGENT_INFO[n].level}}catch(e){if(!(e instanceof Error&&"ExitPromptError"===e.name))throw e;return}}function performAgentSetup(e,t,r){const{selectedAgent:n,shouldSetupMcp:i}=e,{addMcpConfig:s}=AGENT_INFO[n],o=ensureAgentFiles([n],t),a=[];let c=!1;if(i&&s){const e=s(t);e&&a.push(e),c=!0}return r.agentSetup({agent:n}),c&&r.mcpSetup({client:n}),{agentFiles:o,mcpFiles:a,didSetupMcp:c}}const DEFAULT_KNOWLEDGE_MD_CONTENT="# Knowledge Index\n\n";function ensureKnowledgeMd(e){const t=path__default.resolve(e,KNOWLEDGE_MD_FILENAME$1);if(!fs$8.existsSync(t)){fs$8.writeFileSync(t,DEFAULT_KNOWLEDGE_MD_CONTENT);return[path__default.relative(e,t)]}return[]}class Initializer{#cr;constructor(e){this.#cr=e}addTesslFiles(e){const t=[],r=process.cwd(),n=ensureTesslJsonSync(r,{name:path__default.basename(r)});n&&t.push(n);const i=path__default.resolve(r,CONFIG_DIR_NAME);fs__default.mkdirSync(i,{recursive:!0})
|
|
2483
2480
|
;const s=path__default.resolve(i,".gitignore"),o=path__default.relative(i,DEFAULT_TESSL_DIRS.tmpDirectory);fs__default.writeFileSync(s,`${o}/${EOL}${USAGE_SPEC_DIR_NAME}/${EOL}`),t.push(`${CONFIG_DIR_NAME}/.gitignore`);const a=ensureAgentsMd(r);t.push(...a);const c=setupFramework(e,r);t.push(...c);const u=ensureKnowledgeMd(r);return t.push(...u),[...new Set(t)]}initializeProject(e,t,r){let n=!0;try{return{filesCreated:this.addTesslFiles(t)}}catch(e){throw n=!1,e}finally{this.#cr.init({success:n,isReinitializing:e,type:t,...r?{previousType:r}:{}})}}}function FilesCreated({base:e,filepaths:t}){return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:t.map(t=>jsxRuntimeExports.jsxs(Text,{children:[jsxRuntimeExports.jsx(Text,{color:"green",children:"+"})," ",e&&jsxRuntimeExports.jsxs(Text,{dimColor:!0,children:["/"!==e?e:"","/"]}),t]},t))})}function BigTessl(){return jsxRuntimeExports.jsx(Text,{
|
|
@@ -3257,8 +3254,8 @@ const r=Math.floor(Math.random()*t.length),n=t[r];return e[n]}}),cliSpinners=e}v
|
|
|
3257
3254
|
children:[jsxRuntimeExports.jsx(Dimdent,{}),r,jsxRuntimeExports.jsx(Text,{color:"green",children:t.message.replace("{progress}",_nullishCoalesce$l(_optionalChain$p([t,"access",e=>e.progress,"optionalAccess",e=>e.toString,"call",e=>e()]),()=>"")).replace("{total}",_nullishCoalesce$l(_optionalChain$p([t,"access",e=>e.total,"optionalAccess",e=>e.toString,"call",e=>e()]),()=>""))})]})}function _nullishCoalesce$k(e,t){return null!=e?e:t()}function _optionalChain$o(e){let t,r=e[0],n=1;for(;n<e.length;){const i=e[n],s=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=s(r)):"call"!==i&&"optionalCall"!==i||(r=s((...e)=>r.call(t,...e)),t=void 0)}return r}function ActivityItem({activity:e}){return e.end?null:void 0===e.total?jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Text,{color:"yellow",children:[jsxRuntimeExports.jsx(NonBlockingSpinner,{})," ",e.message]})
|
|
3258
3255
|
}):e.children?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[e.children.map(e=>jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(Action,{message:{content:{result:"running",message:e.message}}})},e.id)),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(ProgressBar,{message:{content:{message:e.message,progress:e.progress,total:e.total}}})})]}):null}const TypingIndicator=React.memo(function({totalTokens:e}){return void 0===e?null:jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Text,{color:"cyan",children:[jsxRuntimeExports.jsx(NonBlockingSpinner,{})," Generating…",e>0&&` (${e} tokens)`]})})}),Activities=React.memo(function({activities:e,activeTypers:t}){const r=reactExports.useMemo(()=>{if(t&&0!==t.size)return Math.ceil(Array.from(t.values()).map(e=>e.characterCount).reduce((e,t)=>e+t,0)/4)},[t]),n=(()=>{const t=new Map,r=[],n=e.filter(e=>!e.end);return n.forEach(e=>{t.set(e.id,{...e,children:[]})}),n.forEach(e=>{const n=t.get(e.id);if(e.parentId){
|
|
3259
3256
|
const i=t.get(e.parentId);i?i.children.push(n):r.push(n)}else r.push(n)}),r})();return 0===n.length&&0===_nullishCoalesce$k(_optionalChain$o([t,"optionalAccess",e=>e.size]),()=>0)?null:jsxRuntimeExports.jsxs(Box,{flexDirection:"column",marginBottom:1,children:[n.map(e=>jsxRuntimeExports.jsx(ActivityItem,{activity:e},e.id)),0===n.length&&jsxRuntimeExports.jsx(TypingIndicator,{totalTokens:r})]})});function Alert$1({message:e}){const t={info:void 0,warning:"yellow",error:"red",success:"green"}[e.content.severity];return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Dimdent,{}),jsxRuntimeExports.jsxs(Text,{color:t,children:[e.content.message," "]})]})}function Heading$1({message:e}){return jsxRuntimeExports.jsxs(Box,{marginTop:1,gap:1,children:[jsxRuntimeExports.jsx(Text,{dimColor:!0,children:figures.lozenge}),jsxRuntimeExports.jsx(Text,{bold:!0,children:e.content})]})}function _nullishCoalesce$j(e,t){return null!=e?e:t()}function List({message:e}){
|
|
3260
|
-
return jsxRuntimeExports.jsxs(Text,{children:[e.content.title&&`${e.content.title}: \n`,e.content.items.map(t=>`${_nullishCoalesce$j(e.content.bullet,()=>"-")} ${t}`).join("\n")]})}var cjs,hasRequiredCjs;function requireCjs(){if(hasRequiredCjs)return cjs;hasRequiredCjs=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var r=Object.prototype.toString.call(e);return"[object RegExp]"===r||"[object Date]"===r||function(e){return e.$$typeof===t}(e)}(e)};var t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a(
|
|
3261
|
-
|
|
3257
|
+
return jsxRuntimeExports.jsxs(Text,{children:[e.content.title&&`${e.content.title}: \n`,e.content.items.map(t=>`${_nullishCoalesce$j(e.content.bullet,()=>"-")} ${t}`).join("\n")]})}var cjs,hasRequiredCjs;function requireCjs(){if(hasRequiredCjs)return cjs;hasRequiredCjs=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var r=Object.prototype.toString.call(e);return"[object RegExp]"===r||"[object Date]"===r||function(e){return e.$$typeof===t}(e)}(e)};var t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function n(e,t,n){return e.concat(t).map(function(e){return r(e,n)})}function i(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function s(e,t){try{return t in e}catch(e){return!1}}
|
|
3258
|
+
function o(e,t,n){var o={};return n.isMergeableObject(e)&&i(e).forEach(function(t){o[t]=r(e[t],n)}),i(t).forEach(function(i){(function(e,t){return s(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(s(e,i)&&n.isMergeableObject(t[i])?o[i]=function(e,t){if(!t.customMerge)return a;var r=t.customMerge(e);return"function"==typeof r?r:a}(i,n)(e[i],t[i],n):o[i]=r(t[i],n))}),o}function a(t,i,s){(s=s||{}).arrayMerge=s.arrayMerge||n,s.isMergeableObject=s.isMergeableObject||e,s.cloneUnlessOtherwiseSpecified=r;var a=Array.isArray(i);return a===Array.isArray(t)?a?s.arrayMerge(t,i,s):o(t,i,s):r(i,s)}return a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,r){return a(e,r,t)},{})},cjs=a}requireCjs();const colorByVariant$1={info:"blue",success:"green",error:"red",warning:"yellow"},theme$c={styles:{container:({variant:e})=>({flexGrow:1,borderStyle:"round",borderColor:colorByVariant$1[e],gap:1,
|
|
3262
3259
|
paddingX:1}),iconContainer:()=>({flexShrink:0}),icon:({variant:e})=>({color:colorByVariant$1[e]}),content:()=>({flexShrink:1,flexGrow:1,minWidth:0,flexDirection:"column",gap:1}),title:()=>({bold:!0}),message:()=>({})},config({variant:e}){let t;return"info"===e&&(t=figures.info),"success"===e&&(t=figures.tick),"error"===e&&(t=figures.cross),"warning"===e&&(t=figures.warning),{icon:t}}},theme$b={styles:{container:({color:e})=>({backgroundColor:e}),label:()=>({color:"black"})}},theme$a={styles:{input:({isFocused:e})=>({dimColor:!e})}},theme$9={styles:{container:()=>({flexDirection:"column"}),option:({isFocused:e})=>({gap:1,paddingLeft:e?0:2}),selectedIndicator:()=>({color:"green"}),focusIndicator:()=>({color:"blue"}),label({isFocused:e,isSelected:t}){let r;return t&&(r="green"),e&&(r="blue"),{color:r}},highlightedText:()=>({bold:!0})}},theme$8={styles:{list:()=>({flexDirection:"column"}),listItem:()=>({gap:1}),marker:()=>({dimColor:!0}),content:()=>({flexDirection:"column"})}},theme$7={
|
|
3263
3260
|
styles:{container:()=>({flexGrow:1,minWidth:0}),completed:()=>({color:"magenta"}),remaining:()=>({dimColor:!0})},config:()=>({completedCharacter:figures.square,remainingCharacter:figures.squareLightShade})},theme$6={styles:{container:()=>({flexDirection:"column"}),option:({isFocused:e})=>({gap:1,paddingLeft:e?0:2}),selectedIndicator:()=>({color:"green"}),focusIndicator:()=>({color:"blue"}),label({isFocused:e,isSelected:t}){let r;return t&&(r="green"),e&&(r="blue"),{color:r}},highlightedText:()=>({bold:!0})}},theme$5={styles:{container:()=>({gap:1}),frame:()=>({color:"blue"}),label:()=>({})}},colorByVariant={success:"green",error:"red",warning:"yellow",info:"blue"},iconByVariant={success:figures.tick,error:figures.cross,warning:figures.warning,info:figures.info},theme$4={styles:{container:()=>({gap:1}),iconContainer:()=>({flexShrink:0}),icon:({variant:e})=>({color:colorByVariant[e]}),message:()=>({})},config:({variant:e})=>({icon:iconByVariant[e]})},theme$3={styles:{list:()=>({
|
|
3264
3261
|
flexDirection:"column"}),listItem:()=>({gap:1}),marker:()=>({dimColor:!0}),content:()=>({flexDirection:"column"})},config:()=>({marker:figures.line})},theme$2={styles:{value:()=>({})}},theme$1={styles:{value:()=>({})}},theme={styles:{value:()=>({})}},defaultTheme={components:{Alert:theme$c,Badge:theme$b,ConfirmInput:theme$a,MultiSelect:theme$9,OrderedList:theme$8,ProgressBar:theme$7,Select:theme$6,Spinner:theme$5,StatusMessage:theme$4,UnorderedList:theme$3,TextInput:theme$2,EmailInput:theme$1,PasswordInput:theme}},ThemeContext=reactExports.createContext(defaultTheme),useComponentTheme=e=>reactExports.useContext(ThemeContext).components[e],defaultMarker=figures.line;function Alert({children:e,variant:t,title:r}){const{styles:n,config:i}=useComponentTheme("Alert");return React.createElement(Box,{...n.container({variant:t})},React.createElement(Box,{...n.iconContainer()},React.createElement(Text,{...n.icon({variant:t})},i({variant:t}).icon)),React.createElement(Box,{...n.content()
|
|
@@ -3398,8 +3395,8 @@ Y("braces");const e={type:"brace",value:q,output:"(",outputIndex:P.output.length
|
|
|
3398
3395
|
value:q,output:""});continue}const s=P.braces>0&&("comma"===t.type||"brace"===t.type),o=O.length&&("pipe"===t.type||"paren"===t.type);if(!n&&"paren"!==t.type&&!s&&!o){K({type:"star",value:q,output:""});continue}for(;"/**"===e.slice(0,3);){const t=l[P.index+4];if(t&&"/"!==t)break;e=e.slice(3),W("/**",3)}if("bos"===t.type&&j()){U.type="globstar",U.value+=q,U.output=F(p),P.output=U.output,P.globstar=!0,W(q);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!i&&j()){P.output=P.output.slice(0,-(t.output+U.output).length),t.output=`(?:${t.output}`,U.type="globstar",U.output=F(p)+(p.strictSlashes?")":"|$)"),U.value+=q,P.globstar=!0,P.output+=t.output+U.output,W(q);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const r=void 0!==e[1]?"|$":"";P.output=P.output.slice(0,-(t.output+U.output).length),t.output=`(?:${t.output}`,U.type="globstar",U.output=`${F(p)}${I}|${I}${r})`,U.value+=q,P.output+=t.output+U.output,P.globstar=!0,W(q+H()),K({type:"slash",value:"/",output:""});continue
|
|
3399
3396
|
}if("bos"===t.type&&"/"===e[0]){U.type="globstar",U.value+=q,U.output=`(?:^|${I}|${F(p)}${I})`,P.output=U.output,P.globstar=!0,W(q+H()),K({type:"slash",value:"/",output:""});continue}P.output=P.output.slice(0,-U.output.length),U.type="globstar",U.output=F(p),U.value+=q,P.output+=U.output,P.globstar=!0,W(q);continue}const r={type:"star",value:q,output:N};!0!==p.bash?!U||"bracket"!==U.type&&"paren"!==U.type||!0!==p.regex?(P.index!==P.start&&"slash"!==U.type&&"dot"!==U.type||("dot"===U.type?(P.output+=w,U.output+=w):!0===p.dot?(P.output+=R,U.output+=R):(P.output+=k,U.output+=k),"*"!==G()&&(P.output+=_,U.output+=_)),K(r)):(r.output=q,K(r)):(r.output=".*?","bos"!==U.type&&"slash"!==U.type||(r.output=k+r.output),K(r))}for(;P.brackets>0;){if(!0===p.strictBrackets)throw new SyntaxError(c("closing","]"));P.output=t.escapeLast(P.output,"["),J("brackets")}for(;P.parens>0;){if(!0===p.strictBrackets)throw new SyntaxError(c("closing",")"));P.output=t.escapeLast(P.output,"("),J("parens")}
|
|
3400
3397
|
for(;P.braces>0;){if(!0===p.strictBrackets)throw new SyntaxError(c("closing","}"));P.output=t.escapeLast(P.output,"{"),J("braces")}if(!0===p.strictSlashes||"star"!==U.type&&"bracket"!==U.type||K({type:"maybe_slash",value:"",output:`${I}?`}),!0===P.backtrack){P.output="";for(const e of P.tokens)P.output+=null!=e.output?e.output:e.value,e.suffix&&(P.output+=e.suffix)}return P};return u.fastpaths=(n,i)=>{const s={...i},a="number"==typeof s.maxLength?Math.min(r,s.maxLength):r,c=n.length;if(c>a)throw new SyntaxError(`Input length: ${c}, exceeds maximum allowed length: ${a}`);n=o[n]||n;const u=t.isWindows(i),{DOT_LITERAL:l,SLASH_LITERAL:d,ONE_CHAR:p,DOTS_SLASH:h,NO_DOT:A,NO_DOTS:f,NO_DOTS_SLASH:g,STAR:m,START_ANCHOR:y}=e.globChars(u),E=s.dot?f:A,b=s.dot?g:A,C=s.capture?"":"?:";let v=!0===s.bash?".*?":m;s.capture&&(v=`(${v})`);const I=e=>!0===e.noglobstar?v:`(${C}(?:(?!${y}${e.dot?h:l}).)*?)`,_=e=>{switch(e){case"*":return`${E}${p}${v}`;case".*":return`${l}${p}${v}`;case"*.*":
|
|
3401
|
-
return`${E}${v}${l}${p}${v}`;case"*/*":return`${E}${v}${d}${p}${b}${v}`;case"**":return E+I(s);case"**/*":return`(?:${E}${I(s)}${d})?${b}${p}${v}`;case"**/*.*":return`(?:${E}${I(s)}${d})?${b}${v}${l}${p}${v}`;case"**/.*":return`(?:${E}${I(s)}${d})?${l}${p}${v}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const r=_(t[1]);if(!r)return;return r+l+t[2]}}},S=t.removePrefix(n,{negated:!1,prefix:""});let D=_(S);return D&&!0!==s.strictSlashes&&(D+=`${d}?`),D},parse_1$2=u}function requirePicomatch$1(){if(hasRequiredPicomatch$1)return picomatch_1;hasRequiredPicomatch$1=1;const e=path__default,t=requireScan(),r=requireParse$3(),n=requireUtils$3(),i=requireConstants$7(),s=(e,t,r=!1)=>{if(Array.isArray(e)){const n=e.map(e=>s(e,t,r)),i=e=>{for(const t of n){const r=t(e);if(r)return r}return!1};return i}const i=(e
|
|
3402
|
-
;const
|
|
3398
|
+
return`${E}${v}${l}${p}${v}`;case"*/*":return`${E}${v}${d}${p}${b}${v}`;case"**":return E+I(s);case"**/*":return`(?:${E}${I(s)}${d})?${b}${p}${v}`;case"**/*.*":return`(?:${E}${I(s)}${d})?${b}${v}${l}${p}${v}`;case"**/.*":return`(?:${E}${I(s)}${d})?${l}${p}${v}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const r=_(t[1]);if(!r)return;return r+l+t[2]}}},S=t.removePrefix(n,{negated:!1,prefix:""});let D=_(S);return D&&!0!==s.strictSlashes&&(D+=`${d}?`),D},parse_1$2=u}function requirePicomatch$1(){if(hasRequiredPicomatch$1)return picomatch_1;hasRequiredPicomatch$1=1;const e=path__default,t=requireScan(),r=requireParse$3(),n=requireUtils$3(),i=requireConstants$7(),s=(e,t,r=!1)=>{if(Array.isArray(e)){const n=e.map(e=>s(e,t,r)),i=e=>{for(const t of n){const r=t(e);if(r)return r}return!1};return i}const i=(o=e)&&"object"==typeof o&&!Array.isArray(o)&&e.tokens&&e.input;var o;if(""===e||"string"!=typeof e&&!i)throw new TypeError("Expected pattern to be a non-empty string")
|
|
3399
|
+
;const a=t||{},c=n.isWindows(t),u=i?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=u.state;delete u.state;let d=()=>!1;if(a.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};d=s(a.ignore,e,r)}const p=(r,n=!1)=>{const{isMatch:i,match:o,output:p}=s.test(r,u,t,{glob:e,posix:c}),h={glob:e,state:l,regex:u,posix:c,input:r,output:p,match:o,isMatch:i};return"function"==typeof a.onResult&&a.onResult(h),!1===i?(h.isMatch=!1,!!n&&h):d(r)?("function"==typeof a.onIgnore&&a.onIgnore(h),h.isMatch=!1,!!n&&h):("function"==typeof a.onMatch&&a.onMatch(h),!n||h)};return r&&(p.state=l),p};return s.test=(e,t,r,{glob:i,posix:o}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const a=r||{},c=a.format||(o?n.toPosixSlashes:null);let u=e===i,l=u&&c?c(e):e;return!1===u&&(l=c?c(e):e,u=l===i),!1!==u&&!0!==a.capture||(u=!0===a.matchBase||!0===a.basename?s.matchBase(e,t,r,o):t.exec(l)),{isMatch:Boolean(u),match:u,output:l}},
|
|
3403
3400
|
s.matchBase=(t,r,i,o=n.isWindows(i))=>(r instanceof RegExp?r:s.makeRe(r,i)).test(e.basename(t)),s.isMatch=(e,t,r)=>s(t,r)(e),s.parse=(e,t)=>Array.isArray(e)?e.map(e=>s.parse(e,t)):r(e,{...t,fastpaths:!1}),s.scan=(e,r)=>t(e,r),s.compileRe=(e,t,r=!1,n=!1)=>{if(!0===r)return e.output;const i=t||{},o=i.contains?"":"^",a=i.contains?"":"$";let c=`${o}(?:${e.output})${a}`;e&&!0===e.negated&&(c=`^(?!${c}).*$`);const u=s.toRegex(c,t);return!0===n&&(u.state=e),u},s.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(o.output=r.fastpaths(e,t)),o.output||(o=r(e,t)),s.compileRe(o,t,n,i)},s.toRegex=(e,t)=>{try{const r=t||{};return new RegExp(e,r.flags||(r.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},s.constants=i,picomatch_1=s}function requirePicomatch(){return hasRequiredPicomatch?picomatch:(hasRequiredPicomatch=1,picomatch=requirePicomatch$1())}
|
|
3404
3401
|
function requireMicromatch(){if(hasRequiredMicromatch)return micromatch_1;hasRequiredMicromatch=1;const e=require$$1__default,t=requireBraces(),r=requirePicomatch(),n=requireUtils$3(),i=e=>""===e||"./"===e,s=e=>{const t=e.indexOf("{");return t>-1&&e.indexOf("}",t)>-1},o=(e,t,n)=>{t=[].concat(t),e=[].concat(e);let i=new Set,s=new Set,o=new Set,a=0,c=e=>{o.add(e.output),n&&n.onResult&&n.onResult(e)};for(let o=0;o<t.length;o++){let u=r(String(t[o]),{...n,onResult:c},!0),l=u.state.negated||u.state.negatedExtglob;l&&a++;for(let t of e){let e=u(t,!0);(l?!e.isMatch:e.isMatch)&&(l?i.add(e.output):(i.delete(e.output),s.add(e.output)))}}let u=(a===t.length?[...o]:[...s]).filter(e=>!i.has(e));if(n&&0===u.length){if(!0===n.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===n.nonull||!0===n.nullglob)return n.unescape?t.map(e=>e.replace(/\\/g,"")):t}return u};return o.match=o,o.matcher=(e,t)=>r(e,t),o.isMatch=(e,t,n)=>r(t,n)(e),o.any=o.isMatch,o.not=(e,t,r={})=>{
|
|
3405
3402
|
t=[].concat(t).map(String);let n=new Set,i=[],s=new Set(o(e,t,{...r,onResult:e=>{r.onResult&&r.onResult(e),i.push(e.output)}}));for(let e of i)s.has(e)||n.add(e);return[...n]},o.contains=(t,r,n)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(r))return r.some(e=>o.contains(t,e,n));if("string"==typeof r){if(i(t)||i(r))return!1;if(t.includes(r)||t.startsWith("./")&&t.slice(2).includes(r))return!0}return o.isMatch(t,r,{...n,contains:!0})},o.matchKeys=(e,t,r)=>{if(!n.isObject(e))throw new TypeError("Expected the first argument to be an object");let i=o(Object.keys(e),t,r),s={};for(let t of i)s[t]=e[t];return s},o.some=(e,t,n)=>{let i=[].concat(e);for(let e of[].concat(t)){let t=r(String(e),n);if(i.some(e=>t(e)))return!0}return!1},o.every=(e,t,n)=>{let i=[].concat(e);for(let e of[].concat(t)){let t=r(String(e),n);if(!i.every(e=>t(e)))return!1}return!0},o.all=(t,n,i)=>{
|
|
@@ -3521,7 +3518,7 @@ parseSetupPy(e){if(!e.trim()||e.includes("invalid-format"))return[];const t=e.ma
|
|
|
3521
3518
|
displayName:`${e}@${r}`,name:e,version:r,packageType:"pypi"})}return n}extractVersionFromSpec(e){const t=e.match(/[><=~^]*([0-9.]+)/);return t?t[1]:e}}async function _asyncNullishCoalesce$2(e,t){return null!=e?e:await t()}function _optionalChain$l(e){let t,r=e[0],n=1;for(;n<e.length;){const i=e[n],s=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=s(r)):"call"!==i&&"optionalCall"!==i||(r=s((...e)=>r.call(t,...e)),t=void 0)}return r}class JavaDetector{constructor(e,t){this.fsd=e,this.logger=t}async detect(){try{_optionalChain$l([this,"access",e=>e.logger,"optionalAccess",e=>e.debug,"call",e=>e({},"Checking for Java package manager files")]);const e=await this.fsd.exists("pom.xml"),t=await this.fsd.exists("build.gradle"),r=await this.fsd.exists("build.gradle.kts");return e||t||r}catch(e){throw new AggregateError([e],"Failed to detect Java package managers")}}async getDependencies(){const e=[],t=[];try{
|
|
3522
3519
|
if(await this.fsd.exists("pom.xml")){const e=await this.getMavenDependencies();t.push({packageManager:"maven",manifestPath:"pom.xml",detected:!0,dependencies:e})}else t.push({packageManager:"maven",manifestPath:"pom.xml",detected:!1,dependencies:[]})}catch(t){e.push(t)}try{const e=await this.fsd.exists("build.gradle"),r=await this.fsd.exists("build.gradle.kts"),n=e?"build.gradle":r?"build.gradle.kts":"build.gradle";if(e||r){const e=await this.getGradleDependencies();t.push({packageManager:"gradle",manifestPath:n,detected:!0,dependencies:e})}else t.push({packageManager:"gradle",manifestPath:n,detected:!1,dependencies:[]})}catch(t){e.push(t)}if(e.length>0)throw new AggregateError(e,"Failed to extract Java dependencies");return t}async getMavenDependencies(){try{const e=await this.fsd.exists("./mvnw")?"./mvnw":"mvn",{stdout:t,error:r,code:n}=await exec({cmd:`${e} dependency:list -DexcludeTransitive=true`,cwd:this.fsd.root,timeoutSecs:30})
|
|
3523
3520
|
;if(r||0!==n)throw r||new Error(`mvn exited with code ${n}`);return this.parseMavenCommandOutput(t)}catch(e){return this.parsePomXml()}}async getGradleDependencies(){try{const{stdout:e,error:t,code:r}=await exec({cmd:"gradle dependencies --configuration=runtimeClasspath --quiet",cwd:this.fsd.root,timeoutSecs:30});if(t||0!==r)throw t||new Error(`gradle exited with code ${r}`);return this.parseGradleCommandOutput(e)}catch(e){return this.parseGradleFiles()}}parseMavenCommandOutput(e){const t=/^\[INFO\]\s+(?<namespace>[^:\s]+):(?<name>[^:\s]+):(?<type>[^:\s]+):(?:(?<classifier>[^:\s]+):)?(?<version>[^:\s]+):/,r=[],n=new Set;for(const i of e.split(/\r?\n/)){const e=t.exec(i);if(!e||!e.groups)continue;const{namespace:s,name:o,version:a}=e.groups,c=`${s}:${o}:${a}`;n.has(c)||(n.add(c),r.push({displayName:`${s}:${o}@${a}`,namespace:s,name:o,version:a,packageType:"maven"}))}return r}parseGradleCommandOutput(e){const t=[];for(const r of e.split("\n")){
|
|
3524
|
-
const e=r.match(/^\+---\s+([^:]+):([^:]+):([^\s]+)/);e&&t.push({displayName:`${e[1]}:${e[2]}@${e[3]}`,namespace:e[1],name:e[2],version:e[3],packageType:"maven"})}return t}async parsePomXml(){try{const e=await this.fsd.readText("pom.xml");if(!e)return[];const t=(new
|
|
3521
|
+
const e=r.match(/^\+---\s+([^:]+):([^:]+):([^\s]+)/);e&&t.push({displayName:`${e[1]}:${e[2]}@${e[3]}`,namespace:e[1],name:e[2],version:e[3],packageType:"maven"})}return t}async parsePomXml(){try{const e=await this.fsd.readText("pom.xml");if(!e)return[];const t=(new XMLParser).parse(e),r=[],n=_optionalChain$l([t,"access",e=>e.project,"optionalAccess",e=>e.dependencies,"optionalAccess",e=>e.dependency]);if(n){const e=Array.isArray(n)?n:[n];for(const t of e)t.groupId&&t.artifactId&&t.version&&r.push({displayName:`${t.groupId}:${t.artifactId}@${t.version}`,namespace:t.groupId,name:t.artifactId,version:t.version,packageType:"maven"})}return r}catch(e){return[]}}async parseGradleFiles(){try{let e=await _asyncNullishCoalesce$2(await this.fsd.readText("build.gradle"),async()=>await this.fsd.readText("build.gradle.kts"));if(!e)return[];const t=[],r=/(?:implementation|compile|api|runtimeOnly)\s+['"]([^:]+):([^:]+):([^'"]+)['"]/g;let n;for(;n=r.exec(e);)t.push({
|
|
3525
3522
|
displayName:`${n[1]}:${n[2]}@${n[3]}`,namespace:n[1],name:n[2],version:n[3],packageType:"maven"});return t}catch(e){return[]}}}class DepList{constructor(e,t){this.detectors=[new NpmDetector(e,t),new PythonDetector(e,t),new JavaDetector(e,t)]}async scan(){const e=[],t=[];for(const r of this.detectors)try{const t=await r.getDependencies();e.push(...t)}catch(e){t.push(e instanceof Error?e:new Error(String(e)))}if(t.length>0)throw new AggregateError(t,"Failed to scan for dependencies");return{results:e}}getSupportedPackageManagers(){return["npm","yarn","pnpm","pip","poetry","maven","gradle"]}}const cyan=e=>styleText("cyan",e.toString()),syncCommand=new Command$1({name:"registry-sync",summary:"Check for newer versions of tiles and install them into your project",allowArbitraryFlags:!1,requiresLogin:!1,requiresConfig:!1,flags:{yes:{type:Boolean,description:"Automatically accept all installations and updates",short:"y"}},
|
|
3526
3523
|
handler:async({monitoring:e,projectDir:t,isInteractive:r,tesslClient:n,isAuthenticated:i,args:s})=>{if(!r)throw new ExpectedError('"sync" does not support non-interactive mode');const{logger:o,analytics:a}=e,c={scanned:[],dependenciesWithoutTiles:[],tilesInstalled:[]},u=createSpinner("Scanning project dependencies..."),l=openFsd(t),d=await gatherDependencies({fsd:l,logger:o,analytics:a,trackingData:c});if(0===d.results.flatMap(e=>e.dependencies).length)return u.succeed('No dependencies found. Use "tessl registry search" to find and install usage specs.'),a.registrySync(c),SUCCESS;u.start("Finding candidates...");const p=await findCandidates({scanResult:d,tesslClient:n});u.stop();const h=p.some(e=>e.dependenciesWithCandidates.some(e=>null!==e.candidate));if(!h)return u.succeed("No suitable tiles found"),c.dependenciesWithoutTiles=d.results.flatMap(e=>e.dependencies.map(e=>({displayName:e.displayName,packageType:e.packageType}))),a.registrySync(c),SUCCESS
|
|
3527
3524
|
;const{isInitialized:A}=await ensureInit({targetDir:t,isAuthenticated:i,isInteractive:r,monitoring:e,args:{"no-mcp":!0}},"Tiles require Tessl to be initialized. Would you like to initialize Tessl now?");if(!A)return c.refusedInit=!0,a.registrySync(c),SUCCESS;const f=await loadTesslManifest(l);for(const e of p){const t=analyzeDependencyGroup(e,f.dependencies||{});if(c.dependenciesWithoutTiles.push(...t.dependenciesWithoutTiles.map(e=>({displayName:e.displayName,packageType:e.packageType}))),0===t.tilesToInstall.length&&0===t.tilesToUpdate.length){u.succeed(`All tiles are up to date for ${cyan(t.packageManager)} manifest ${cyan(t.manifestPath)}`);continue}const r=await selectTiles({analysis:t,args:s,spinner:u,logger:o});if("cancelled"in r)return c.cancelled=!0,a.registrySync(c),SUCCESS;if(!(await installTiles({chosen:r.chosen,analysis:t,fsd:l,tesslClient:n,spinner:u,analytics:a,logger:o})).success)return a.registrySync(c),FAILURE;c.tilesInstalled.push(...r.chosen)}
|
|
@@ -4826,9 +4823,9 @@ platform:this.platformInfo,arch:this.archInfo,timestamp:(new Date).toISOString()
|
|
|
4826
4823
|
getProjectId(){return this.projectId}runTool(e,t,r){const n=String(e);this.captureEvent("cli:run",{commandName:"tool",toolName:n,params:t,...r})}toolStart(e){const t=`${e.toolName}:${this.runId}`;this.toolSessionMap.set(t,this.sessionId),this.captureEvent("cli:tool:start",e)}toolEnd(e){const t=`${e.toolName}:${this.runId}`,r=this.toolSessionMap.get(t);if(r){const n={...e,originalSessionId:r};this.captureEventBase("cli:tool:end",{source:"cli",runId:this.runId,sessionId:r,...n,timestamp:(new Date).toISOString()}),this.toolSessionMap.delete(t)}else this.captureEvent("cli:tool:end",e)}cliEnd(e){this.captureEvent("cli:end",e),this.runId=null}cliError(e){this.captureEvent("cli:error",e)}runHelp(e){this.captureEvent("cli:run",{commandName:"help",...e})}tileSearch(e){this.captureEvent("cli:tile:search",e)}tileInstall(e){this.captureEvent("cli:tile:install",e)}registrySync(e){this.captureEvent("cli:registry:sync",e)}runVersion(e){this.captureEvent("cli:run",{commandName:"version",...e})}
|
|
4827
4824
|
init(e){this.captureEvent("cli:project:init",e)}agentSetup(e){this.captureEvent("cli:agent:setup",e)}frameworkSetup(e){this.captureEvent("cli:framework:setup",e)}mcpSetup(e){this.captureEvent("cli:mcp:setup",e)}trackProjectGroup(e){this.shareUsageData&&this.posthog.groupIdentify({groupType:CLI_PROJECT_GROUP_TYPE,groupKey:e.projectId,properties:{isInitialized:e.isInitialized,$group_set_once:{firstSeenAt:e.firstSeenAt},lastEditedAt:(new Date).toISOString(),nodeVersion:this.nodeVersion,platform:this.platformInfo,arch:this.archInfo,cliVersion:this.cliVersion,osType:this.osType,osRelease:this.osRelease}})}projectMetadata(e){this.captureEventBase("cli:project:metadata",e)}trackProject(e){const t={projectId:this.projectId,distinctId:this.distinctId,...e,nodeVersion:this.nodeVersion,platform:this.platformInfo,arch:this.archInfo,cliVersion:this.cliVersion,osType:this.osType,osRelease:this.osRelease,firstSeenAt:(new Date).toISOString(),lastEditedAt:(new Date).toISOString()}
|
|
4828
4825
|
;this.trackProjectGroup(t),this.projectMetadata(t)}}async function createPosthogAnalytics(e,t,r,n){return PosthogAnalytics.create(e,t,r,n)}async function _asyncNullishCoalesce(e,t){return null!=e?e:await t()}function _optionalChain(e){let t,r=e[0],n=1;for(;n<e.length;){const i=e[n],s=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=s(r)):"call"!==i&&"optionalCall"!==i||(r=s((...e)=>r.call(t,...e)),t=void 0)}return r}async function startMonitoring(e){const t=getProvisionedEnvPath("production");if(fs__default.existsSync(t))try{validateEnv(cliMonitoringSchema,process.env)}catch(e){e instanceof Error?console.error(formatValidationError(e)):console.error("Failed to validate environment variables: please review the install instructions."),process.exit(FAILURE)}
|
|
4829
|
-
const r=getDefaultGlobalConfigDir(),n=new ConfigManager(join(r,GLOBAL_CONFIG_FILE_NAME),GlobalConfigSchema),{logger:i,logBus:s}=await constructLogger("cli",n),o=await _asyncNullishCoalesce(await n.get("shareUsageData"),async()=>!0);let a,c;try{a=(await readAuth(r)).user}catch(e){i.debug({err:e},"failed to read auth")}if(o&&process.env.LANGFUSE_PROXY_TOKEN){const[e,t]=process.env.LANGFUSE_PROXY_TOKEN.split(":");c=quietLangfuse({publicKey:e,secretKey:t,baseUrl:"https://42957.tessl.io/",flushAt:1,flushInterval:0})}else c=quietLangfuse();const u=new PostHog("phc_S8tHJaPxa5ORnP0RVyyTaJHeCcft6XMqfjx9ZlJWvkO",{host:process.env.POSTHOG_HOST||"https://app.posthog.com"});"yes"===process.env.TESSL_DEBUG_MONITORING&&u.debug(!0);const l=userIdentifier(a);setOtelUser(a),u.identify({distinctId:l,properties:{...o?getSysinfo():{},email:a?a.email:void 0}}),a&&u.alias({distinctId:a.id,alias:loggedOutUserIdentifier()});const d=await createPosthogAnalytics(u,l,o,e);return{
|
|
4830
|
-
user:a?{id:a.id,email:a.email}:void 0,langfuse:c,logger:i,logBus:s,reporter:new ReportEmitter,posthogCapture:(e,t)=>{(o||_optionalChain([t,"optionalAccess",e=>e.bypassOptOut]))&&u.capture({distinctId:l,event:e.event,properties:e.properties})},analytics:d,shutdown:async()=>{i.debug({},"Shutting down monitoring services");const e=async()=>new Promise((e,t)=>setTimeout(()=>t(new Error("Monitoring shutdown timed out")),2e3));try{await Promise.race([u.flush(),e()])}catch(e){i.error({err:e},"Failed to flush PostHog events")}try{await Promise.race([c.flushAsync(),e()]),i.debug({},"Successfully flushed Langfuse events")}catch(e){i.error({err:e},"Failed to flush Langfuse events")}try{await flushLogger(i.originalLogger),i.debug({},"Successfully flushed logger")}catch(e){}}},globalConfig:n}}async function entry(){if(!await checkLegal())return 145;initSysinfo();const e=await checkDeprecationStatusWithCache();if(e)return console.error(e.message),
|
|
4831
|
-
;const t=sessionData(),r=projectCache(),{monitoring:n,globalConfig:i}=await startMonitoring(r);try{return await withSpan("cli.entry",async()=>main(n,i,t,r))}catch(e){return n.logger.error({err:e},"critical error during startup"),n.analytics.cliError({command:process.argv.slice(2).join(" "),message:e instanceof Error?e.message:String(e),stack:e instanceof Error&&e.stack||"",expected:e instanceof ExpectedError}),144}finally{await n.shutdown(),await sdk.shutdown(),showCursor()}}entry().then(e=>{process.exit(e)}).catch(e=>{console.error("Error occurred during exit:",e),process.exit(1)});const execAsync=require$$1$7.promisify(require$$0$8.exec);async function getMachineId$4(){try{const e=(await execAsync('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split("\n").find(e=>e.includes("IOPlatformUUID"));if(!e)return;const t=e.split('" = "');if(2===t.length)return t[1].slice(0,-1)}catch(e){diag.debug(`error reading machine id: ${e}`)}}
|
|
4832
|
-
getMachineId:getMachineId$4});async function getMachineId$3(){const e=["/etc/machine-id","/var/lib/dbus/machine-id"];for(const t of e)try{return(await promises.readFile(t,{encoding:"utf8"})).trim()}catch(e){diag.debug(`error reading machine id: ${e}`)}}var getMachineIdLinux=Object.freeze({__proto__:null,getMachineId:getMachineId$3});async function getMachineId$2(){try{return(await promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(e){diag.debug(`error reading machine id: ${e}`)}try{return(await execAsync("kenv -q smbios.system.uuid")).stdout.trim()}catch(e){diag.debug(`error reading machine id: ${e}`)}}var getMachineIdBsd=Object.freeze({__proto__:null,getMachineId:getMachineId$2});async function getMachineId$1(){let e="%windir%\\System32\\REG.exe";"ia32"===process$4.arch&&"PROCESSOR_ARCHITEW6432"in process$4.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{
|
|
4826
|
+
const r=getDefaultGlobalConfigDir(),n=new ConfigManager(join(r,GLOBAL_CONFIG_FILE_NAME),GlobalConfigSchema),{logger:i,logBus:s}=await constructLogger("cli",n),o=await _asyncNullishCoalesce(await n.get("shareUsageData"),async()=>!0);let a,c;try{a=(await readAuth(r)).user}catch(e){i.debug({err:e},"failed to read auth")}if(o&&process.env.LANGFUSE_PROXY_TOKEN){const[e,t]=process.env.LANGFUSE_PROXY_TOKEN.split(":");c=quietLangfuse({publicKey:e,secretKey:t,baseUrl:process.env.LANGFUSE_BASE_URL||"https://42957.tessl.io/",flushAt:1,flushInterval:0})}else c=quietLangfuse();const u=new PostHog("phc_S8tHJaPxa5ORnP0RVyyTaJHeCcft6XMqfjx9ZlJWvkO",{host:process.env.POSTHOG_HOST||"https://app.posthog.com"});"yes"===process.env.TESSL_DEBUG_MONITORING&&u.debug(!0);const l=userIdentifier(a);setOtelUser(a),u.identify({distinctId:l,properties:{...o?getSysinfo():{},email:a?a.email:void 0}}),a&&u.alias({distinctId:a.id,alias:loggedOutUserIdentifier()});const d=await createPosthogAnalytics(u,l,o,e);return{
|
|
4827
|
+
monitoring:{shareUsageData:o,user:a?{id:a.id,email:a.email}:void 0,langfuse:c,logger:i,logBus:s,reporter:new ReportEmitter,posthogCapture:(e,t)=>{(o||_optionalChain([t,"optionalAccess",e=>e.bypassOptOut]))&&u.capture({distinctId:l,event:e.event,properties:e.properties})},analytics:d,shutdown:async()=>{i.debug({},"Shutting down monitoring services");const e=async()=>new Promise((e,t)=>setTimeout(()=>t(new Error("Monitoring shutdown timed out")),2e3));try{await Promise.race([u.flush(),e()])}catch(e){i.error({err:e},"Failed to flush PostHog events")}try{await Promise.race([c.flushAsync(),e()]),i.debug({},"Successfully flushed Langfuse events")}catch(e){i.error({err:e},"Failed to flush Langfuse events")}try{await flushLogger(i.originalLogger),i.debug({},"Successfully flushed logger")}catch(e){}}},globalConfig:n}}async function entry(){if(!await checkLegal())return 145;initSysinfo();const e=await checkDeprecationStatusWithCache();if(e)return console.error(e.message),
|
|
4828
|
+
console.error(e.installUrl),DEPRECATED_EXIT_CODE;const t=sessionData(),r=projectCache(),{monitoring:n,globalConfig:i}=await startMonitoring(r);try{return await withSpan("cli.entry",async()=>main(n,i,t,r))}catch(e){return n.logger.error({err:e},"critical error during startup"),n.analytics.cliError({command:process.argv.slice(2).join(" "),message:e instanceof Error?e.message:String(e),stack:e instanceof Error&&e.stack||"",expected:e instanceof ExpectedError}),144}finally{await n.shutdown(),await sdk.shutdown(),showCursor()}}entry().then(e=>{process.exit(e)}).catch(e=>{console.error("Error occurred during exit:",e),process.exit(1)});const execAsync=require$$1$7.promisify(require$$0$8.exec);async function getMachineId$4(){try{const e=(await execAsync('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split("\n").find(e=>e.includes("IOPlatformUUID"));if(!e)return;const t=e.split('" = "');if(2===t.length)return t[1].slice(0,-1)}catch(e){diag.debug(`error reading machine id: ${e}`)}}
|
|
4829
|
+
var getMachineIdDarwin=Object.freeze({__proto__:null,getMachineId:getMachineId$4});async function getMachineId$3(){const e=["/etc/machine-id","/var/lib/dbus/machine-id"];for(const t of e)try{return(await promises.readFile(t,{encoding:"utf8"})).trim()}catch(e){diag.debug(`error reading machine id: ${e}`)}}var getMachineIdLinux=Object.freeze({__proto__:null,getMachineId:getMachineId$3});async function getMachineId$2(){try{return(await promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(e){diag.debug(`error reading machine id: ${e}`)}try{return(await execAsync("kenv -q smbios.system.uuid")).stdout.trim()}catch(e){diag.debug(`error reading machine id: ${e}`)}}var getMachineIdBsd=Object.freeze({__proto__:null,getMachineId:getMachineId$2});async function getMachineId$1(){let e="%windir%\\System32\\REG.exe";"ia32"===process$4.arch&&"PROCESSOR_ARCHITEW6432"in process$4.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{
|
|
4833
4830
|
const t=(await execAsync(`${e} QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`)).stdout.split("REG_SZ");if(2===t.length)return t[1].trim()}catch(e){diag.debug(`error reading machine id: ${e}`)}}var getMachineIdWin=Object.freeze({__proto__:null,getMachineId:getMachineId$1});async function getMachineId(){diag.debug("could not read machine-id: unsupported platform")}var getMachineIdUnsupported=Object.freeze({__proto__:null,getMachineId});const getToJsonSchemaFn$4=async()=>e=>e.toJsonSchema();var arktypeCGObzDh=Object.freeze({__proto__:null,getToJsonSchemaFn:getToJsonSchemaFn$4});const getToJsonSchemaFn$3=async()=>{const{JSONSchema:e}=await tryImport(import("effect"),"effect");return t=>e.make(t)};var effect_Zg3C1LQ=Object.freeze({__proto__:null,getToJsonSchemaFn:getToJsonSchemaFn$3});const getToJsonSchemaFn$2=async()=>{const{toJSONSchema:e}=await tryImport(import("sury"),"sury");return t=>e(t)};var suryS6AklOc=Object.freeze({__proto__:null,
|
|
4834
4831
|
getToJsonSchemaFn:getToJsonSchemaFn$2});const getToJsonSchemaFn$1=async()=>{const{toJsonSchema:e}=await tryImport(import("@valibot/to-json-schema"),"@valibot/to-json-schema");return t=>e(t)};var valibotDBCeetIe=Object.freeze({__proto__:null,getToJsonSchemaFn:getToJsonSchemaFn$1});const getToJsonSchemaFn=async()=>{let e=e=>{throw new Error(`xsschema: Missing zod v4 dependencies "zod". see ${missingDependenciesUrl}`)},t=e=>{throw new Error(`xsschema: Missing zod v3 dependencies "zod-to-json-schema". see ${missingDependenciesUrl}`)};try{const{toJSONSchema:t}=await Promise.resolve().then(function(){return index});e=t}catch(e){e instanceof Error&&console.error(e.message)}try{const{zodToJsonSchema:e}=await Promise.resolve().then(function(){return index$1});t=e}catch(e){e instanceof Error&&console.error(e.message)}return async r=>"_zod"in r?e(r):t(r)};var zodBw_60DVU=Object.freeze({__proto__:null,getToJsonSchemaFn});export{entry};
|