algolia-uploader 0.0.5 → 0.0.9
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/README.md +19 -11
- package/dist/index.cjs +27 -27
- package/dist/index.mjs +27 -27
- package/package.json +17 -14
package/dist/index.cjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";const citty=require("citty"),require$$0$1=require("fs"),require$$0$2=require("path"),require$$0$3=require("tty"),require$$2=require("os"),require$$3=require("crypto"),require$$1=require("node:crypto"),require$$0$4=require("child_process"),esToolkit=require("es-toolkit"),algoliasearch=require("algoliasearch");function _interopDefaultCompat(e){return e&&typeof e=="object"&&"default"in e?e.default:e}const require$$0__default=_interopDefaultCompat(require$$0$1),require$$0__default$1=_interopDefaultCompat(require$$0$2),require$$0__default$2=_interopDefaultCompat(require$$0$3),require$$2__default=_interopDefaultCompat(require$$2),require$$3__default=_interopDefaultCompat(require$$3),require$$1__default=_interopDefaultCompat(require$$1),require$$0__default$3=_interopDefaultCompat(require$$0$4),name$2="algolia-uploader",version$2="0.0.5",description$2="command-line util to upload Algolia source";function readAllJsonFiles(e){return require$$0__default.readdirSync(e).filter(r=>r.endsWith(".json")).map(r=>{const u=require$$0__default.readFileSync(require$$0__default$1.join(e,r),"utf8");return JSON.parse(u)})}function getAugmentedNamespace(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var u=function c(){return this instanceof c?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};u.prototype=r.prototype}else u={};return Object.defineProperty(u,"__esModule",{value:!0}),Object.keys(e).forEach(function(c){var p=Object.getOwnPropertyDescriptor(e,c);Object.defineProperty(u,c,p.get?p:{enumerable:!0,get:function(){return e[c]}})}),u}var config$1={};const version$1="1.38.4",name$1="@dotenvx/dotenvx",description$1="a better dotenv\u2013from the creator of `dotenv`",author="@motdotla",keywords$1=["dotenv","env"],homepage="https://github.com/dotenvx/dotenvx",repository$1={type:"git",url:"git+https://github.com/dotenvx/dotenvx.git"},license$1="BSD-3-Clause",files=["src/**/*","CHANGELOG.md"],main$3="src/lib/main.js",types$2="src/lib/main.d.ts",exports$2={".":{types:"./src/lib/main.d.ts",require:"./src/lib/main.js",default:"./src/lib/main.js"},"./config":"./src/lib/config.js","./config.js":"./src/lib/config.js","./package.json":"./package.json"},bin={dotenvx:"./src/cli/dotenvx.js","git-dotenvx":"./src/cli/dotenvx.js"},scripts$1={standard:"standard","standard:fix":"standard --fix",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test-coverage":"tap run --show-full-coverage --timeout=60000",testshell:"bash shellspec",prerelease:"npm test && npm run testshell",release:"standard-version"},funding$1="https://dotenvx.com",dependencies={commander:"^11.1.0",dotenv:"^16.4.5",eciesjs:"^0.4.10",execa:"^5.1.1",fdir:"^6.2.0",ignore:"^5.3.0","object-treeify":"1.1.33",picomatch:"^4.0.2",which:"^4.0.0"},devDependencies$1={"@yao-pkg/pkg":"^5.14.2","capture-console":"^1.0.2",esbuild:"^0.24.0",proxyquire:"^2.1.3",sinon:"^14.0.1",standard:"^17.1.0","standard-version":"^9.5.0",tap:"^21.0.1"},publishConfig={access:"public",provenance:!0},_package$2={version:version$1,name:name$1,description:description$1,author,keywords:keywords$1,homepage,repository:repository$1,license:license$1,files,main:main$3,types:types$2,exports:exports$2,bin,scripts:scripts$1,funding:funding$1,dependencies,devDependencies:devDependencies$1,publishConfig},_package$3={__proto__:null,author,bin,default:_package$2,dependencies,description:description$1,devDependencies:devDependencies$1,exports:exports$2,files,funding:funding$1,homepage,keywords:keywords$1,license:license$1,main:main$3,name:name$1,publishConfig,repository:repository$1,scripts:scripts$1,types:types$2,version:version$1},require$$0=getAugmentedNamespace(_package$3);var packageJson,hasRequiredPackageJson;function requirePackageJson(){if(hasRequiredPackageJson)return packageJson;hasRequiredPackageJson=1;const{name:e,version:r,description:u}=require$$0;return packageJson={name:e,version:r,description:u},packageJson}var colorDepth,hasRequiredColorDepth;function requireColorDepth(){if(hasRequiredColorDepth)return colorDepth;hasRequiredColorDepth=1;const{WriteStream:e}=require$$0__default$2;return colorDepth={getColorDepth:()=>{try{return e.prototype.getColorDepth()}catch{const c=process.env.TERM;return c&&(c.includes("256color")||c.includes("xterm"))?8:4}}},colorDepth}var colors,hasRequiredColors;function requireColors(){if(hasRequiredColors)return colors;hasRequiredColors=1;const e=requireColorDepth(),r=new Map([["blue",34],["gray",37],["green",32],["olive",33],["orangered",31],["plum",35],["red",31],["electricblue",36],["dodgerblue",36]]),u=new Map([["blue",21],["gray",244],["green",34],["olive",142],["orangered",202],["plum",182],["red",196],["electricblue",45],["dodgerblue",33]]);function c(s){const t=e.getColorDepth();if(!u.has(s))throw new Error(`Invalid color ${s}`);if(t>=8){const o=u.get(s);return h=>`\x1B[38;5;${o}m${h}\x1B[39m`}if(t>=4){const o=r.get(s);return h=>`\x1B[${o}m${h}\x1B[39m`}return o=>o}function p(s){return e.getColorDepth()>=4?`\x1B[1m${s}\x1B[22m`:s}return colors={getColor:c,bold:p},colors}var logger_1,hasRequiredLogger;function requireLogger(){if(hasRequiredLogger)return logger_1;hasRequiredLogger=1;const e=requirePackageJson(),{getColor:r,bold:u}=requireColors(),c={error:0,errorv:0,errornocolor:0,warn:1,success:2,successv:2,info:2,help:2,blank:2,verbose:4,debug:5,silly:6},p=g=>u(r("red")(g)),s=r("orangered"),t=r("green"),o=r("olive"),h=r("dodgerblue"),b=r("plum"),y=r("plum");let m=c.info;function f(g,w){if(c[g]===void 0)throw new Error(`MISSING_LOG_LEVEL: '${g}'. implement in logger.`);if(c[g]<=m){const B=R(g,w);console.log(B)}}function R(g,w){const B=typeof w=="object"?JSON.stringify(w):w;switch(g.toLowerCase()){case"error":return p(B);case"errorv":return p(`[dotenvx@${e.version}] ${B}`);case"errornocolor":return B;case"warn":return s(B);case"success":return t(B);case"successv":return o(`[dotenvx@${e.version}] ${B}`);case"info":return B;case"help":return h(B);case"verbose":return b(B);case"debug":return y(B);case"blank":return B}}const S={level:"info",error:g=>f("error",g),errorv:g=>f("errorv",g),errornocolor:g=>f("errornocolor",g),warn:g=>f("warn",g),success:g=>f("success",g),successv:g=>f("successv",g),info:g=>f("info",g),help:g=>f("help",g),verbose:g=>f("verbose",g),debug:g=>f("debug",g),blank:g=>f("blank",g),setLevel:g=>{c[g]!==void 0&&(m=c[g],S.level=g)}};function F(g){const w=g.debug?"debug":g.verbose?"verbose":g.quiet?"error":g.logLevel;w&&(S.setLevel(w),(!g.quiet||g.quiet&&w!=="error")&&S.debug(`Setting log level to ${w}`))}return logger_1={logger:S,getColor:r,setLogLevel:F,levels:c},logger_1}var dist$1={},builder={},apiBuilder={},async={},walker={},utils$5={},hasRequiredUtils$5;function requireUtils$5(){if(hasRequiredUtils$5)return utils$5;hasRequiredUtils$5=1,Object.defineProperty(utils$5,"__esModule",{value:!0}),utils$5.normalizePath=utils$5.convertSlashes=utils$5.cleanPath=void 0;const e=require$$0__default$1;function r(s){let t=(0,e.normalize)(s);return t.length>1&&t[t.length-1]===e.sep&&(t=t.substring(0,t.length-1)),t}utils$5.cleanPath=r;const u=/[\\/]/g;function c(s,t){return s.replace(u,t)}utils$5.convertSlashes=c;function p(s,t){const{resolvePaths:o,normalizePath:h,pathSeparator:b}=t,y=process.platform==="win32"&&s.includes("/")||s.startsWith(".");if(o&&(s=(0,e.resolve)(s)),(h||y)&&(s=r(s)),s===".")return"";const m=s[s.length-1]!==b;return c(m?s+b:s,b)}return utils$5.normalizePath=p,utils$5}var joinPath={},hasRequiredJoinPath;function requireJoinPath(){if(hasRequiredJoinPath)return joinPath;hasRequiredJoinPath=1,Object.defineProperty(joinPath,"__esModule",{value:!0}),joinPath.build=joinPath.joinDirectoryPath=joinPath.joinPathWithBasePath=void 0;const e=require$$0__default$1,r=requireUtils$5();function u(o,h){return h+o}joinPath.joinPathWithBasePath=u;function c(o,h){return function(b,y){return y.startsWith(o)?y.replace(o,"")+b:(0,r.convertSlashes)((0,e.relative)(o,y),h.pathSeparator)+h.pathSeparator+b}}function p(o){return o}function s(o,h,b){return h+o+b}joinPath.joinDirectoryPath=s;function t(o,h){const{relativePaths:b,includeBasePath:y}=h;return b&&o?c(o,h):y?u:p}return joinPath.build=t,joinPath}var pushDirectory={},hasRequiredPushDirectory;function requirePushDirectory(){if(hasRequiredPushDirectory)return pushDirectory;hasRequiredPushDirectory=1,Object.defineProperty(pushDirectory,"__esModule",{value:!0}),pushDirectory.build=void 0;function e(t){return function(o,h){h.push(o.substring(t.length)||".")}}function r(t){return function(o,h,b){const y=o.substring(t.length)||".";b.every(m=>m(y,!0))&&h.push(y)}}const u=(t,o)=>{o.push(t||".")},c=(t,o,h)=>{const b=t||".";h.every(y=>y(b,!0))&&o.push(b)},p=()=>{};function s(t,o){const{includeDirs:h,filters:b,relativePaths:y}=o;return h?y?b&&b.length?r(t):e(t):b&&b.length?c:u:p}return pushDirectory.build=s,pushDirectory}var pushFile={},hasRequiredPushFile;function requirePushFile(){if(hasRequiredPushFile)return pushFile;hasRequiredPushFile=1,Object.defineProperty(pushFile,"__esModule",{value:!0}),pushFile.build=void 0;const e=(t,o,h,b)=>{b.every(y=>y(t,!1))&&h.files++},r=(t,o,h,b)=>{b.every(y=>y(t,!1))&&o.push(t)},u=(t,o,h,b)=>{h.files++},c=(t,o)=>{o.push(t)},p=()=>{};function s(t){const{excludeFiles:o,filters:h,onlyCounts:b}=t;return o?p:h&&h.length?b?e:r:b?u:c}return pushFile.build=s,pushFile}var getArray={},hasRequiredGetArray;function requireGetArray(){if(hasRequiredGetArray)return getArray;hasRequiredGetArray=1,Object.defineProperty(getArray,"__esModule",{value:!0}),getArray.build=void 0;const e=c=>c,r=()=>[""].slice(0,0);function u(c){return c.group?r:e}return getArray.build=u,getArray}var groupFiles={},hasRequiredGroupFiles;function requireGroupFiles(){if(hasRequiredGroupFiles)return groupFiles;hasRequiredGroupFiles=1,Object.defineProperty(groupFiles,"__esModule",{value:!0}),groupFiles.build=void 0;const e=(c,p,s)=>{c.push({directory:p,files:s,dir:p})},r=()=>{};function u(c){return c.group?e:r}return groupFiles.build=u,groupFiles}var resolveSymlink={},hasRequiredResolveSymlink;function requireResolveSymlink(){if(hasRequiredResolveSymlink)return resolveSymlink;hasRequiredResolveSymlink=1;var e=resolveSymlink&&resolveSymlink.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(resolveSymlink,"__esModule",{value:!0}),resolveSymlink.build=void 0;const r=e(require$$0__default),u=require$$0__default$1,c=function(h,b,y){const{queue:m,options:{suppressErrors:f}}=b;m.enqueue(),r.default.realpath(h,(R,S)=>{if(R)return m.dequeue(f?null:R,b);r.default.stat(S,(F,g)=>{if(F)return m.dequeue(f?null:F,b);if(g.isDirectory()&&t(h,S,b))return m.dequeue(null,b);y(g,S),m.dequeue(null,b)})})},p=function(h,b,y){const{queue:m,options:{suppressErrors:f}}=b;m.enqueue();try{const R=r.default.realpathSync(h),S=r.default.statSync(R);if(S.isDirectory()&&t(h,R,b))return;y(S,R)}catch(R){if(!f)throw R}};function s(h,b){return!h.resolveSymlinks||h.excludeSymlinks?null:b?p:c}resolveSymlink.build=s;function t(h,b,y){if(y.options.useRealPaths)return o(b,y);let m=(0,u.dirname)(h),f=1;for(;m!==y.root&&f<2;){const R=y.symlinks.get(m);!!R&&(R===b||R.startsWith(b)||b.startsWith(R))?f++:m=(0,u.dirname)(m)}return y.symlinks.set(h,b),f>1}function o(h,b){return b.visited.includes(h+b.options.pathSeparator)}return resolveSymlink}var invokeCallback={},hasRequiredInvokeCallback;function requireInvokeCallback(){if(hasRequiredInvokeCallback)return invokeCallback;hasRequiredInvokeCallback=1,Object.defineProperty(invokeCallback,"__esModule",{value:!0}),invokeCallback.build=void 0;const e=y=>y.counts,r=y=>y.groups,u=y=>y.paths,c=y=>y.paths.slice(0,y.options.maxFiles),p=(y,m,f)=>(h(m,f,y.counts,y.options.suppressErrors),null),s=(y,m,f)=>(h(m,f,y.paths,y.options.suppressErrors),null),t=(y,m,f)=>(h(m,f,y.paths.slice(0,y.options.maxFiles),y.options.suppressErrors),null),o=(y,m,f)=>(h(m,f,y.groups,y.options.suppressErrors),null);function h(y,m,f,R){m(y&&!R?y:null,f)}function b(y,m){const{onlyCounts:f,group:R,maxFiles:S}=y;return f?m?e:p:R?m?r:o:S?m?c:t:m?u:s}return invokeCallback.build=b,invokeCallback}var walkDirectory={},hasRequiredWalkDirectory;function requireWalkDirectory(){if(hasRequiredWalkDirectory)return walkDirectory;hasRequiredWalkDirectory=1;var e=walkDirectory&&walkDirectory.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(walkDirectory,"__esModule",{value:!0}),walkDirectory.build=void 0;const r=e(require$$0__default),u={withFileTypes:!0},c=(t,o,h,b,y)=>{if(b<0)return t.queue.dequeue(null,t);t.visited.push(o),t.counts.directories++,t.queue.enqueue(),r.default.readdir(o||".",u,(m,f=[])=>{y(f,h,b),t.queue.dequeue(t.options.suppressErrors?null:m,t)})},p=(t,o,h,b,y)=>{if(b<0)return;t.visited.push(o),t.counts.directories++;let m=[];try{m=r.default.readdirSync(o||".",u)}catch(f){if(!t.options.suppressErrors)throw f}y(m,h,b)};function s(t){return t?p:c}return walkDirectory.build=s,walkDirectory}var queue={},hasRequiredQueue;function requireQueue(){if(hasRequiredQueue)return queue;hasRequiredQueue=1,Object.defineProperty(queue,"__esModule",{value:!0}),queue.Queue=void 0;class e{onQueueEmpty;count=0;constructor(u){this.onQueueEmpty=u}enqueue(){this.count++}dequeue(u,c){(--this.count<=0||u)&&this.onQueueEmpty(u,c)}}return queue.Queue=e,queue}var counter={},hasRequiredCounter;function requireCounter(){if(hasRequiredCounter)return counter;hasRequiredCounter=1,Object.defineProperty(counter,"__esModule",{value:!0}),counter.Counter=void 0;class e{_files=0;_directories=0;set files(u){this._files=u}get files(){return this._files}set directories(u){this._directories=u}get directories(){return this._directories}get dirs(){return this._directories}}return counter.Counter=e,counter}var hasRequiredWalker;function requireWalker(){if(hasRequiredWalker)return walker;hasRequiredWalker=1;var e=walker&&walker.__createBinding||(Object.create?function(g,w,B,N){N===void 0&&(N=B);var d=Object.getOwnPropertyDescriptor(w,B);(!d||("get"in d?!w.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return w[B]}}),Object.defineProperty(g,N,d)}:function(g,w,B,N){N===void 0&&(N=B),g[N]=w[B]}),r=walker&&walker.__setModuleDefault||(Object.create?function(g,w){Object.defineProperty(g,"default",{enumerable:!0,value:w})}:function(g,w){g.default=w}),u=walker&&walker.__importStar||function(g){if(g&&g.__esModule)return g;var w={};if(g!=null)for(var B in g)B!=="default"&&Object.prototype.hasOwnProperty.call(g,B)&&e(w,g,B);return r(w,g),w};Object.defineProperty(walker,"__esModule",{value:!0}),walker.Walker=void 0;const c=require$$0__default$1,p=requireUtils$5(),s=u(requireJoinPath()),t=u(requirePushDirectory()),o=u(requirePushFile()),h=u(requireGetArray()),b=u(requireGroupFiles()),y=u(requireResolveSymlink()),m=u(requireInvokeCallback()),f=u(requireWalkDirectory()),R=requireQueue(),S=requireCounter();class F{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(w,B,N){this.isSynchronous=!N,this.callbackInvoker=m.build(B,this.isSynchronous),this.root=(0,p.normalizePath)(w,B),this.state={root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new S.Counter,options:B,queue:new R.Queue((d,v)=>this.callbackInvoker(v,d,N)),symlinks:new Map,visited:[""].slice(0,0)},this.joinPath=s.build(this.root,B),this.pushDirectory=t.build(this.root,B),this.pushFile=o.build(B),this.getArray=h.build(B),this.groupFiles=b.build(B),this.resolveSymlink=y.build(B,this.isSynchronous),this.walkDirectory=f.build(this.isSynchronous)}start(){return this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(w,B,N)=>{const{paths:d,options:{filters:v,resolveSymlinks:a,excludeSymlinks:j,exclude:K,maxFiles:q,signal:k,useRealPaths:_,pathSeparator:C}}=this.state;if(k&&k.aborted||q&&d.length>q)return;this.pushDirectory(B,d,v);const M=this.getArray(this.state.paths);for(let l=0;l<w.length;++l){const $=w[l];if($.isFile()||$.isSymbolicLink()&&!a&&!j){const E=this.joinPath($.name,B);this.pushFile(E,M,this.state.counts,v)}else if($.isDirectory()){let E=s.joinDirectoryPath($.name,B,this.state.options.pathSeparator);if(K&&K($.name,E))continue;this.walkDirectory(this.state,E,E,N-1,this.walk)}else if($.isSymbolicLink()&&this.resolveSymlink){let E=s.joinPathWithBasePath($.name,B);this.resolveSymlink(E,this.state,(O,L)=>{if(O.isDirectory()){if(L=(0,p.normalizePath)(L,this.state.options),K&&K($.name,_?L:E+C))return;this.walkDirectory(this.state,L,_?L:E+C,N-1,this.walk)}else{L=_?L:E;const D=(0,c.basename)(L),i=(0,p.normalizePath)((0,c.dirname)(L),this.state.options);L=this.joinPath(D,i),this.pushFile(L,M,this.state.counts,v)}})}}this.groupFiles(this.state.groups,B,M)}}return walker.Walker=F,walker}var hasRequiredAsync;function requireAsync(){if(hasRequiredAsync)return async;hasRequiredAsync=1,Object.defineProperty(async,"__esModule",{value:!0}),async.callback=async.promise=void 0;const e=requireWalker();function r(c,p){return new Promise((s,t)=>{u(c,p,(o,h)=>{if(o)return t(o);s(h)})})}async.promise=r;function u(c,p,s){new e.Walker(c,p,s).start()}return async.callback=u,async}var sync={},hasRequiredSync;function requireSync(){if(hasRequiredSync)return sync;hasRequiredSync=1,Object.defineProperty(sync,"__esModule",{value:!0}),sync.sync=void 0;const e=requireWalker();function r(u,c){return new e.Walker(u,c).start()}return sync.sync=r,sync}var hasRequiredApiBuilder;function requireApiBuilder(){if(hasRequiredApiBuilder)return apiBuilder;hasRequiredApiBuilder=1,Object.defineProperty(apiBuilder,"__esModule",{value:!0}),apiBuilder.APIBuilder=void 0;const e=requireAsync(),r=requireSync();class u{root;options;constructor(p,s){this.root=p,this.options=s}withPromise(){return(0,e.promise)(this.root,this.options)}withCallback(p){(0,e.callback)(this.root,this.options,p)}sync(){return(0,r.sync)(this.root,this.options)}}return apiBuilder.APIBuilder=u,apiBuilder}var utils$4={},constants,hasRequiredConstants;function requireConstants(){if(hasRequiredConstants)return constants;hasRequiredConstants=1;const e="\\\\/",r=`[^${e}]`,u="\\.",c="\\+",p="\\?",s="\\/",t="(?=.)",o="[^/]",h=`(?:${s}|$)`,b=`(?:^|${s})`,y=`${u}{1,2}${h}`,m=`(?!${u})`,f=`(?!${b}${y})`,R=`(?!${u}{0,1}${h})`,S=`(?!${y})`,F=`[^.${s}]`,g=`${o}*?`,B={DOT_LITERAL:u,PLUS_LITERAL:c,QMARK_LITERAL:p,SLASH_LITERAL:s,ONE_CHAR:t,QMARK:o,END_ANCHOR:h,DOTS_SLASH:y,NO_DOT:m,NO_DOTS:f,NO_DOT_SLASH:R,NO_DOTS_SLASH:S,QMARK_NO_DOT:F,STAR:g,START_ANCHOR:b,SEP:"/"},N={...B,SLASH_LITERAL:`[${e}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${u}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${u})`,NO_DOTS:`(?!(?:^|[${e}])${u}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${u}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${u}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`,SEP:"\\"},d={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return constants={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:d,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(v){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${v.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(v){return v===!0?N:B}},constants}var hasRequiredUtils$4;function requireUtils$4(){return hasRequiredUtils$4||(hasRequiredUtils$4=1,function(e){const{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:u,REGEX_SPECIAL_CHARS:c,REGEX_SPECIAL_CHARS_GLOBAL:p}=requireConstants();e.isObject=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),e.hasRegexChars=s=>c.test(s),e.isRegexChar=s=>s.length===1&&e.hasRegexChars(s),e.escapeRegex=s=>s.replace(p,"\\$1"),e.toPosixSlashes=s=>s.replace(r,"/"),e.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const s=navigator.platform.toLowerCase();return s==="win32"||s==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1},e.removeBackslashes=s=>s.replace(u,t=>t==="\\"?"":t),e.escapeLast=(s,t,o)=>{const h=s.lastIndexOf(t,o);return h===-1?s:s[h-1]==="\\"?e.escapeLast(s,t,h-1):`${s.slice(0,h)}\\${s.slice(h)}`},e.removePrefix=(s,t={})=>{let o=s;return o.startsWith("./")&&(o=o.slice(2),t.prefix="./"),o},e.wrapOutput=(s,t={},o={})=>{const h=o.contains?"":"^",b=o.contains?"":"$";let y=`${h}(?:${s})${b}`;return t.negated===!0&&(y=`(?:^(?!${y}).*$)`),y},e.basename=(s,{windows:t}={})=>{const o=s.split(t?/[\\/]/:"/"),h=o[o.length-1];return h===""?o[o.length-2]:h}}(utils$4)),utils$4}var scan_1,hasRequiredScan;function requireScan(){if(hasRequiredScan)return scan_1;hasRequiredScan=1;const e=requireUtils$4(),{CHAR_ASTERISK:r,CHAR_AT:u,CHAR_BACKWARD_SLASH:c,CHAR_COMMA:p,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:t,CHAR_FORWARD_SLASH:o,CHAR_LEFT_CURLY_BRACE:h,CHAR_LEFT_PARENTHESES:b,CHAR_LEFT_SQUARE_BRACKET:y,CHAR_PLUS:m,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:R,CHAR_RIGHT_PARENTHESES:S,CHAR_RIGHT_SQUARE_BRACKET:F}=requireConstants(),g=N=>N===o||N===c,w=N=>{N.isPrefix!==!0&&(N.depth=N.isGlobstar?1/0:1)};return scan_1=(N,d)=>{const v=d||{},a=N.length-1,j=v.parts===!0||v.scanToEnd===!0,K=[],q=[],k=[];let _=N,C=-1,M=0,l=0,$=!1,E=!1,O=!1,L=!1,D=!1,i=!1,x=!1,T=!1,W=!1,A=!1,H=0,re,U,P={value:"",depth:0,isGlob:!1};const V=()=>C>=a,X=()=>_.charCodeAt(C+1),z=()=>(re=U,_.charCodeAt(++C));for(;C<a;){U=z();let Q;if(U===c){x=P.backslashes=!0,U=z(),U===h&&(i=!0);continue}if(i===!0||U===h){for(H++;V()!==!0&&(U=z());){if(U===c){x=P.backslashes=!0,z();continue}if(U===h){H++;continue}if(i!==!0&&U===s&&(U=z())===s){if($=P.isBrace=!0,O=P.isGlob=!0,A=!0,j===!0)continue;break}if(i!==!0&&U===p){if($=P.isBrace=!0,O=P.isGlob=!0,A=!0,j===!0)continue;break}if(U===R&&(H--,H===0)){i=!1,$=P.isBrace=!0,A=!0;break}}if(j===!0)continue;break}if(U===o){if(K.push(C),q.push(P),P={value:"",depth:0,isGlob:!1},A===!0)continue;if(re===s&&C===M+1){M+=2;continue}l=C+1;continue}if(v.noext!==!0&&(U===m||U===u||U===r||U===f||U===t)===!0&&X()===b){if(O=P.isGlob=!0,L=P.isExtglob=!0,A=!0,U===t&&C===M&&(W=!0),j===!0){for(;V()!==!0&&(U=z());){if(U===c){x=P.backslashes=!0,U=z();continue}if(U===S){O=P.isGlob=!0,A=!0;break}}continue}break}if(U===r){if(re===r&&(D=P.isGlobstar=!0),O=P.isGlob=!0,A=!0,j===!0)continue;break}if(U===f){if(O=P.isGlob=!0,A=!0,j===!0)continue;break}if(U===y){for(;V()!==!0&&(Q=z());){if(Q===c){x=P.backslashes=!0,z();continue}if(Q===F){E=P.isBracket=!0,O=P.isGlob=!0,A=!0;break}}if(j===!0)continue;break}if(v.nonegate!==!0&&U===t&&C===M){T=P.negated=!0,M++;continue}if(v.noparen!==!0&&U===b){if(O=P.isGlob=!0,j===!0){for(;V()!==!0&&(U=z());){if(U===b){x=P.backslashes=!0,U=z();continue}if(U===S){A=!0;break}}continue}break}if(O===!0){if(A=!0,j===!0)continue;break}}v.noext===!0&&(L=!1,O=!1);let te=_,ee="",G="";M>0&&(ee=_.slice(0,M),_=_.slice(M),l-=M),te&&O===!0&&l>0?(te=_.slice(0,l),G=_.slice(l)):O===!0?(te="",G=_):te=_,te&&te!==""&&te!=="/"&&te!==_&&g(te.charCodeAt(te.length-1))&&(te=te.slice(0,-1)),v.unescape===!0&&(G&&(G=e.removeBackslashes(G)),te&&x===!0&&(te=e.removeBackslashes(te)));const Y={prefix:ee,input:N,start:M,base:te,glob:G,isBrace:$,isBracket:E,isGlob:O,isExtglob:L,isGlobstar:D,negated:T,negatedExtglob:W};if(v.tokens===!0&&(Y.maxDepth=0,g(U)||q.push(P),Y.tokens=q),v.parts===!0||v.tokens===!0){let Q;for(let ne=0;ne<K.length;ne++){const Z=Q?Q+1:M,oe=K[ne],J=N.slice(Z,oe);v.tokens&&(ne===0&&M!==0?(q[ne].isPrefix=!0,q[ne].value=ee):q[ne].value=J,w(q[ne]),Y.maxDepth+=q[ne].depth),(ne!==0||J!=="")&&k.push(J),Q=oe}if(Q&&Q+1<N.length){const ne=N.slice(Q+1);k.push(ne),v.tokens&&(q[q.length-1].value=ne,w(q[q.length-1]),Y.maxDepth+=q[q.length-1].depth)}Y.slashes=K,Y.parts=k}return Y},scan_1}var parse_1,hasRequiredParse$1;function requireParse$1(){if(hasRequiredParse$1)return parse_1;hasRequiredParse$1=1;const e=requireConstants(),r=requireUtils$4(),{MAX_LENGTH:u,POSIX_REGEX_SOURCE:c,REGEX_NON_SPECIAL_CHARS:p,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:t}=e,o=(y,m)=>{if(typeof m.expandRange=="function")return m.expandRange(...y,m);y.sort();const f=`[${y.join("-")}]`;try{new RegExp(f)}catch{return y.map(S=>r.escapeRegex(S)).join("..")}return f},h=(y,m)=>`Missing ${y}: "${m}" - use "\\\\${m}" to match literal characters`,b=(y,m)=>{if(typeof y!="string")throw new TypeError("Expected a string");y=t[y]||y;const f={...m},R=typeof f.maxLength=="number"?Math.min(u,f.maxLength):u;let S=y.length;if(S>R)throw new SyntaxError(`Input length: ${S}, exceeds maximum allowed length: ${R}`);const F={type:"bos",value:"",output:f.prepend||""},g=[F],w=f.capture?"":"?:",B=e.globChars(f.windows),N=e.extglobChars(B),{DOT_LITERAL:d,PLUS_LITERAL:v,SLASH_LITERAL:a,ONE_CHAR:j,DOTS_SLASH:K,NO_DOT:q,NO_DOT_SLASH:k,NO_DOTS_SLASH:_,QMARK:C,QMARK_NO_DOT:M,STAR:l,START_ANCHOR:$}=B,E=Z=>`(${w}(?:(?!${$}${Z.dot?K:d}).)*?)`,O=f.dot?"":q,L=f.dot?C:M;let D=f.bash===!0?E(f):l;f.capture&&(D=`(${D})`),typeof f.noext=="boolean"&&(f.noextglob=f.noext);const i={input:y,index:-1,start:0,dot:f.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:g};y=r.removePrefix(y,i),S=y.length;const x=[],T=[],W=[];let A=F,H;const re=()=>i.index===S-1,U=i.peek=(Z=1)=>y[i.index+Z],P=i.advance=()=>y[++i.index]||"",V=()=>y.slice(i.index+1),X=(Z="",oe=0)=>{i.consumed+=Z,i.index+=oe},z=Z=>{i.output+=Z.output!=null?Z.output:Z.value,X(Z.value)},te=()=>{let Z=1;for(;U()==="!"&&(U(2)!=="("||U(3)==="?");)P(),i.start++,Z++;return Z%2===0?!1:(i.negated=!0,i.start++,!0)},ee=Z=>{i[Z]++,W.push(Z)},G=Z=>{i[Z]--,W.pop()},Y=Z=>{if(A.type==="globstar"){const oe=i.braces>0&&(Z.type==="comma"||Z.type==="brace"),J=Z.extglob===!0||x.length&&(Z.type==="pipe"||Z.type==="paren");Z.type!=="slash"&&Z.type!=="paren"&&!oe&&!J&&(i.output=i.output.slice(0,-A.output.length),A.type="star",A.value="*",A.output=D,i.output+=A.output)}if(x.length&&Z.type!=="paren"&&(x[x.length-1].inner+=Z.value),(Z.value||Z.output)&&z(Z),A&&A.type==="text"&&Z.type==="text"){A.output=(A.output||A.value)+Z.value,A.value+=Z.value;return}Z.prev=A,g.push(Z),A=Z},Q=(Z,oe)=>{const J={...N[oe],conditions:1,inner:""};J.prev=A,J.parens=i.parens,J.output=i.output;const se=(f.capture?"(":"")+J.open;ee("parens"),Y({type:Z,value:oe,output:i.output?"":j}),Y({type:"paren",extglob:!0,value:P(),output:se}),x.push(J)},ne=Z=>{let oe=Z.close+(f.capture?")":""),J;if(Z.type==="negate"){let se=D;if(Z.inner&&Z.inner.length>1&&Z.inner.includes("/")&&(se=E(f)),(se!==D||re()||/^\)+$/.test(V()))&&(oe=Z.close=`)$))${se}`),Z.inner.includes("*")&&(J=V())&&/^\.[^\\/.]+$/.test(J)){const ie=b(J,{...m,fastpaths:!1}).output;oe=Z.close=`)${ie})${se})`}Z.prev.type==="bos"&&(i.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:H,output:oe}),G("parens")};if(f.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(y)){let Z=!1,oe=y.replace(s,(J,se,ie,ce,ae,le)=>ce==="\\"?(Z=!0,J):ce==="?"?se?se+ce+(ae?C.repeat(ae.length):""):le===0?L+(ae?C.repeat(ae.length):""):C.repeat(ie.length):ce==="."?d.repeat(ie.length):ce==="*"?se?se+ce+(ae?D:""):D:se?J:`\\${J}`);return Z===!0&&(f.unescape===!0?oe=oe.replace(/\\/g,""):oe=oe.replace(/\\+/g,J=>J.length%2===0?"\\\\":J?"\\":"")),oe===y&&f.contains===!0?(i.output=y,i):(i.output=r.wrapOutput(oe,i,m),i)}for(;!re();){if(H=P(),H==="\0")continue;if(H==="\\"){const J=U();if(J==="/"&&f.bash!==!0||J==="."||J===";")continue;if(!J){H+="\\",Y({type:"text",value:H});continue}const se=/^\\+/.exec(V());let ie=0;if(se&&se[0].length>2&&(ie=se[0].length,i.index+=ie,ie%2!==0&&(H+="\\")),f.unescape===!0?H=P():H+=P(),i.brackets===0){Y({type:"text",value:H});continue}}if(i.brackets>0&&(H!=="]"||A.value==="["||A.value==="[^")){if(f.posix!==!1&&H===":"){const J=A.value.slice(1);if(J.includes("[")&&(A.posix=!0,J.includes(":"))){const se=A.value.lastIndexOf("["),ie=A.value.slice(0,se),ce=A.value.slice(se+2),ae=c[ce];if(ae){A.value=ie+ae,i.backtrack=!0,P(),!F.output&&g.indexOf(A)===1&&(F.output=j);continue}}}(H==="["&&U()!==":"||H==="-"&&U()==="]")&&(H=`\\${H}`),H==="]"&&(A.value==="["||A.value==="[^")&&(H=`\\${H}`),f.posix===!0&&H==="!"&&A.value==="["&&(H="^"),A.value+=H,z({value:H});continue}if(i.quotes===1&&H!=='"'){H=r.escapeRegex(H),A.value+=H,z({value:H});continue}if(H==='"'){i.quotes=i.quotes===1?0:1,f.keepQuotes===!0&&Y({type:"text",value:H});continue}if(H==="("){ee("parens"),Y({type:"paren",value:H});continue}if(H===")"){if(i.parens===0&&f.strictBrackets===!0)throw new SyntaxError(h("opening","("));const J=x[x.length-1];if(J&&i.parens===J.parens+1){ne(x.pop());continue}Y({type:"paren",value:H,output:i.parens?")":"\\)"}),G("parens");continue}if(H==="["){if(f.nobracket===!0||!V().includes("]")){if(f.nobracket!==!0&&f.strictBrackets===!0)throw new SyntaxError(h("closing","]"));H=`\\${H}`}else ee("brackets");Y({type:"bracket",value:H});continue}if(H==="]"){if(f.nobracket===!0||A&&A.type==="bracket"&&A.value.length===1){Y({type:"text",value:H,output:`\\${H}`});continue}if(i.brackets===0){if(f.strictBrackets===!0)throw new SyntaxError(h("opening","["));Y({type:"text",value:H,output:`\\${H}`});continue}G("brackets");const J=A.value.slice(1);if(A.posix!==!0&&J[0]==="^"&&!J.includes("/")&&(H=`/${H}`),A.value+=H,z({value:H}),f.literalBrackets===!1||r.hasRegexChars(J))continue;const se=r.escapeRegex(A.value);if(i.output=i.output.slice(0,-A.value.length),f.literalBrackets===!0){i.output+=se,A.value=se;continue}A.value=`(${w}${se}|${A.value})`,i.output+=A.value;continue}if(H==="{"&&f.nobrace!==!0){ee("braces");const J={type:"brace",value:H,output:"(",outputIndex:i.output.length,tokensIndex:i.tokens.length};T.push(J),Y(J);continue}if(H==="}"){const J=T[T.length-1];if(f.nobrace===!0||!J){Y({type:"text",value:H,output:H});continue}let se=")";if(J.dots===!0){const ie=g.slice(),ce=[];for(let ae=ie.length-1;ae>=0&&(g.pop(),ie[ae].type!=="brace");ae--)ie[ae].type!=="dots"&&ce.unshift(ie[ae].value);se=o(ce,f),i.backtrack=!0}if(J.comma!==!0&&J.dots!==!0){const ie=i.output.slice(0,J.outputIndex),ce=i.tokens.slice(J.tokensIndex);J.value=J.output="\\{",H=se="\\}",i.output=ie;for(const ae of ce)i.output+=ae.output||ae.value}Y({type:"brace",value:H,output:se}),G("braces"),T.pop();continue}if(H==="|"){x.length>0&&x[x.length-1].conditions++,Y({type:"text",value:H});continue}if(H===","){let J=H;const se=T[T.length-1];se&&W[W.length-1]==="braces"&&(se.comma=!0,J="|"),Y({type:"comma",value:H,output:J});continue}if(H==="/"){if(A.type==="dot"&&i.index===i.start+1){i.start=i.index+1,i.consumed="",i.output="",g.pop(),A=F;continue}Y({type:"slash",value:H,output:a});continue}if(H==="."){if(i.braces>0&&A.type==="dot"){A.value==="."&&(A.output=d);const J=T[T.length-1];A.type="dots",A.output+=H,A.value+=H,J.dots=!0;continue}if(i.braces+i.parens===0&&A.type!=="bos"&&A.type!=="slash"){Y({type:"text",value:H,output:d});continue}Y({type:"dot",value:H,output:d});continue}if(H==="?"){if(!(A&&A.value==="(")&&f.noextglob!==!0&&U()==="("&&U(2)!=="?"){Q("qmark",H);continue}if(A&&A.type==="paren"){const se=U();let ie=H;(A.value==="("&&!/[!=<:]/.test(se)||se==="<"&&!/<([!=]|\w+>)/.test(V()))&&(ie=`\\${H}`),Y({type:"text",value:H,output:ie});continue}if(f.dot!==!0&&(A.type==="slash"||A.type==="bos")){Y({type:"qmark",value:H,output:M});continue}Y({type:"qmark",value:H,output:C});continue}if(H==="!"){if(f.noextglob!==!0&&U()==="("&&(U(2)!=="?"||!/[!=<:]/.test(U(3)))){Q("negate",H);continue}if(f.nonegate!==!0&&i.index===0){te();continue}}if(H==="+"){if(f.noextglob!==!0&&U()==="("&&U(2)!=="?"){Q("plus",H);continue}if(A&&A.value==="("||f.regex===!1){Y({type:"plus",value:H,output:v});continue}if(A&&(A.type==="bracket"||A.type==="paren"||A.type==="brace")||i.parens>0){Y({type:"plus",value:H});continue}Y({type:"plus",value:v});continue}if(H==="@"){if(f.noextglob!==!0&&U()==="("&&U(2)!=="?"){Y({type:"at",extglob:!0,value:H,output:""});continue}Y({type:"text",value:H});continue}if(H!=="*"){(H==="$"||H==="^")&&(H=`\\${H}`);const J=p.exec(V());J&&(H+=J[0],i.index+=J[0].length),Y({type:"text",value:H});continue}if(A&&(A.type==="globstar"||A.star===!0)){A.type="star",A.star=!0,A.value+=H,A.output=D,i.backtrack=!0,i.globstar=!0,X(H);continue}let Z=V();if(f.noextglob!==!0&&/^\([^?]/.test(Z)){Q("star",H);continue}if(A.type==="star"){if(f.noglobstar===!0){X(H);continue}const J=A.prev,se=J.prev,ie=J.type==="slash"||J.type==="bos",ce=se&&(se.type==="star"||se.type==="globstar");if(f.bash===!0&&(!ie||Z[0]&&Z[0]!=="/")){Y({type:"star",value:H,output:""});continue}const ae=i.braces>0&&(J.type==="comma"||J.type==="brace"),le=x.length&&(J.type==="pipe"||J.type==="paren");if(!ie&&J.type!=="paren"&&!ae&&!le){Y({type:"star",value:H,output:""});continue}for(;Z.slice(0,3)==="/**";){const ue=y[i.index+4];if(ue&&ue!=="/")break;Z=Z.slice(3),X("/**",3)}if(J.type==="bos"&&re()){A.type="globstar",A.value+=H,A.output=E(f),i.output=A.output,i.globstar=!0,X(H);continue}if(J.type==="slash"&&J.prev.type!=="bos"&&!ce&&re()){i.output=i.output.slice(0,-(J.output+A.output).length),J.output=`(?:${J.output}`,A.type="globstar",A.output=E(f)+(f.strictSlashes?")":"|$)"),A.value+=H,i.globstar=!0,i.output+=J.output+A.output,X(H);continue}if(J.type==="slash"&&J.prev.type!=="bos"&&Z[0]==="/"){const ue=Z[1]!==void 0?"|$":"";i.output=i.output.slice(0,-(J.output+A.output).length),J.output=`(?:${J.output}`,A.type="globstar",A.output=`${E(f)}${a}|${a}${ue})`,A.value+=H,i.output+=J.output+A.output,i.globstar=!0,X(H+P()),Y({type:"slash",value:"/",output:""});continue}if(J.type==="bos"&&Z[0]==="/"){A.type="globstar",A.value+=H,A.output=`(?:^|${a}|${E(f)}${a})`,i.output=A.output,i.globstar=!0,X(H+P()),Y({type:"slash",value:"/",output:""});continue}i.output=i.output.slice(0,-A.output.length),A.type="globstar",A.output=E(f),A.value+=H,i.output+=A.output,i.globstar=!0,X(H);continue}const oe={type:"star",value:H,output:D};if(f.bash===!0){oe.output=".*?",(A.type==="bos"||A.type==="slash")&&(oe.output=O+oe.output),Y(oe);continue}if(A&&(A.type==="bracket"||A.type==="paren")&&f.regex===!0){oe.output=H,Y(oe);continue}(i.index===i.start||A.type==="slash"||A.type==="dot")&&(A.type==="dot"?(i.output+=k,A.output+=k):f.dot===!0?(i.output+=_,A.output+=_):(i.output+=O,A.output+=O),U()!=="*"&&(i.output+=j,A.output+=j)),Y(oe)}for(;i.brackets>0;){if(f.strictBrackets===!0)throw new SyntaxError(h("closing","]"));i.output=r.escapeLast(i.output,"["),G("brackets")}for(;i.parens>0;){if(f.strictBrackets===!0)throw new SyntaxError(h("closing",")"));i.output=r.escapeLast(i.output,"("),G("parens")}for(;i.braces>0;){if(f.strictBrackets===!0)throw new SyntaxError(h("closing","}"));i.output=r.escapeLast(i.output,"{"),G("braces")}if(f.strictSlashes!==!0&&(A.type==="star"||A.type==="bracket")&&Y({type:"maybe_slash",value:"",output:`${a}?`}),i.backtrack===!0){i.output="";for(const Z of i.tokens)i.output+=Z.output!=null?Z.output:Z.value,Z.suffix&&(i.output+=Z.suffix)}return i};return b.fastpaths=(y,m)=>{const f={...m},R=typeof f.maxLength=="number"?Math.min(u,f.maxLength):u,S=y.length;if(S>R)throw new SyntaxError(`Input length: ${S}, exceeds maximum allowed length: ${R}`);y=t[y]||y;const{DOT_LITERAL:F,SLASH_LITERAL:g,ONE_CHAR:w,DOTS_SLASH:B,NO_DOT:N,NO_DOTS:d,NO_DOTS_SLASH:v,STAR:a,START_ANCHOR:j}=e.globChars(f.windows),K=f.dot?d:N,q=f.dot?v:N,k=f.capture?"":"?:",_={negated:!1,prefix:""};let C=f.bash===!0?".*?":a;f.capture&&(C=`(${C})`);const M=O=>O.noglobstar===!0?C:`(${k}(?:(?!${j}${O.dot?B:F}).)*?)`,l=O=>{switch(O){case"*":return`${K}${w}${C}`;case".*":return`${F}${w}${C}`;case"*.*":return`${K}${C}${F}${w}${C}`;case"*/*":return`${K}${C}${g}${w}${q}${C}`;case"**":return K+M(f);case"**/*":return`(?:${K}${M(f)}${g})?${q}${w}${C}`;case"**/*.*":return`(?:${K}${M(f)}${g})?${q}${C}${F}${w}${C}`;case"**/.*":return`(?:${K}${M(f)}${g})?${F}${w}${C}`;default:{const L=/^(.*?)\.(\w+)$/.exec(O);if(!L)return;const D=l(L[1]);return D?D+F+L[2]:void 0}}},$=r.removePrefix(y,_);let E=l($);return E&&f.strictSlashes!==!0&&(E+=`${g}?`),E},parse_1=b,parse_1}var picomatch_1$1,hasRequiredPicomatch$1;function requirePicomatch$1(){if(hasRequiredPicomatch$1)return picomatch_1$1;hasRequiredPicomatch$1=1;const e=requireScan(),r=requireParse$1(),u=requireUtils$4(),c=requireConstants(),p=t=>t&&typeof t=="object"&&!Array.isArray(t),s=(t,o,h=!1)=>{if(Array.isArray(t)){const g=t.map(B=>s(B,o,h));return B=>{for(const N of g){const d=N(B);if(d)return d}return!1}}const b=p(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!b)throw new TypeError("Expected pattern to be a non-empty string");const y=o||{},m=y.windows,f=b?s.compileRe(t,o):s.makeRe(t,o,!1,!0),R=f.state;delete f.state;let S=()=>!1;if(y.ignore){const g={...o,ignore:null,onMatch:null,onResult:null};S=s(y.ignore,g,h)}const F=(g,w=!1)=>{const{isMatch:B,match:N,output:d}=s.test(g,f,o,{glob:t,posix:m}),v={glob:t,state:R,regex:f,posix:m,input:g,output:d,match:N,isMatch:B};return typeof y.onResult=="function"&&y.onResult(v),B===!1?(v.isMatch=!1,w?v:!1):S(g)?(typeof y.onIgnore=="function"&&y.onIgnore(v),v.isMatch=!1,w?v:!1):(typeof y.onMatch=="function"&&y.onMatch(v),w?v:!0)};return h&&(F.state=R),F};return s.test=(t,o,h,{glob:b,posix:y}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};const m=h||{},f=m.format||(y?u.toPosixSlashes:null);let R=t===b,S=R&&f?f(t):t;return R===!1&&(S=f?f(t):t,R=S===b),(R===!1||m.capture===!0)&&(m.matchBase===!0||m.basename===!0?R=s.matchBase(t,o,h,y):R=o.exec(S)),{isMatch:!!R,match:R,output:S}},s.matchBase=(t,o,h)=>(o instanceof RegExp?o:s.makeRe(o,h)).test(u.basename(t)),s.isMatch=(t,o,h)=>s(o,h)(t),s.parse=(t,o)=>Array.isArray(t)?t.map(h=>s.parse(h,o)):r(t,{...o,fastpaths:!1}),s.scan=(t,o)=>e(t,o),s.compileRe=(t,o,h=!1,b=!1)=>{if(h===!0)return t.output;const y=o||{},m=y.contains?"":"^",f=y.contains?"":"$";let R=`${m}(?:${t.output})${f}`;t&&t.negated===!0&&(R=`^(?!${R}).*$`);const S=s.toRegex(R,o);return b===!0&&(S.state=t),S},s.makeRe=(t,o={},h=!1,b=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let y={negated:!1,fastpaths:!0};return o.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(y.output=r.fastpaths(t,o)),y.output||(y=r(t,o)),s.compileRe(y,o,h,b)},s.toRegex=(t,o)=>{try{const h=o||{};return new RegExp(t,h.flags||(h.nocase?"i":""))}catch(h){if(o&&o.debug===!0)throw h;return/$^/}},s.constants=c,picomatch_1$1=s,picomatch_1$1}var picomatch_1,hasRequiredPicomatch;function requirePicomatch(){if(hasRequiredPicomatch)return picomatch_1;hasRequiredPicomatch=1;const e=requirePicomatch$1(),r=requireUtils$4();function u(c,p,s=!1){return p&&(p.windows===null||p.windows===void 0)&&(p={...p,windows:r.isWindows()}),e(c,p,s)}return Object.assign(u,e),picomatch_1=u,picomatch_1}var hasRequiredBuilder;function requireBuilder(){if(hasRequiredBuilder)return builder;hasRequiredBuilder=1,Object.defineProperty(builder,"__esModule",{value:!0}),builder.Builder=void 0;const e=require$$0__default$1,r=requireApiBuilder();var u=null;try{require.resolve("picomatch"),u=requirePicomatch()}catch{}class c{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:e.sep,filters:[]};globFunction;constructor(s){this.options={...this.options,...s},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(s){return this.options.pathSeparator=s,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(s){return this.options.maxDepth=s,this}withMaxFiles(s){return this.options.maxFiles=s,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:s=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=s,this.withFullPaths()}withAbortSignal(s){return this.options.signal=s,this}normalize(){return this.options.normalizePath=!0,this}filter(s){return this.options.filters.push(s),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(s){return this.options.exclude=s,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(s){return new r.APIBuilder(s||".",this.options)}withGlobFunction(s){return this.globFunction=s,this}crawlWithOptions(s,t){return this.options={...this.options,...t},new r.APIBuilder(s||".",this.options)}glob(...s){return this.globFunction?this.globWithOptions(s):this.globWithOptions(s,{dot:!0})}globWithOptions(s,...t){const o=this.globFunction||u;if(!o)throw new Error("Please specify a glob function to use glob matching.");var h=this.globCache[s.join("\0")];return h||(h=o(s,...t),this.globCache[s.join("\0")]=h),this.options.filters.push(b=>h(b)),this}}return builder.Builder=c,builder}var types$1={},hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,Object.defineProperty(types$1,"__esModule",{value:!0})),types$1}var hasRequiredDist$1;function requireDist$1(){return hasRequiredDist$1||(hasRequiredDist$1=1,function(e){var r=dist$1&&dist$1.__createBinding||(Object.create?function(p,s,t,o){o===void 0&&(o=t);var h=Object.getOwnPropertyDescriptor(s,t);(!h||("get"in h?!s.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return s[t]}}),Object.defineProperty(p,o,h)}:function(p,s,t,o){o===void 0&&(o=t),p[o]=s[t]}),u=dist$1&&dist$1.__exportStar||function(p,s){for(var t in p)t!=="default"&&!Object.prototype.hasOwnProperty.call(s,t)&&r(s,p,t)};Object.defineProperty(e,"__esModule",{value:!0}),e.fdir=void 0;const c=requireBuilder();Object.defineProperty(e,"fdir",{enumerable:!0,get:function(){return c.Builder}}),u(requireTypes(),e)}(dist$1)),dist$1}var ls,hasRequiredLs;function requireLs(){if(hasRequiredLs)return ls;hasRequiredLs=1;const{fdir:e}=requireDist$1(),r=require$$0__default$1,u=requirePicomatch();class c{constructor(s="./",t=[".env*"],o=[]){this.ignore=["node_modules/**",".git/**"],this.cwd=r.resolve(s),this.envFile=t,this.excludeEnvFile=o}run(){return this._filepaths()}_filepaths(){const s=u(this._exclude()),t=u(this._patterns(),{ignore:this._exclude()});return new e().withRelativePaths().exclude((o,h)=>s(h)).filter(o=>t(o)).crawl(this.cwd).sync()}_patterns(){return Array.isArray(this.envFile)?this.envFile.map(s=>`**/${s}`):[`**/${this.envFile}`]}_excludePatterns(){return Array.isArray(this.excludeEnvFile)?this.excludeEnvFile.map(s=>`**/${s}`):[`**/${this.excludeEnvFile}`]}_exclude(){return this._excludePatterns().length>0?this.ignore.concat(this._excludePatterns()):this.ignore}}return ls=c,ls}var fsx_1,hasRequiredFsx;function requireFsx(){if(hasRequiredFsx)return fsx_1;hasRequiredFsx=1;const e=require$$0__default,r="utf8";function u(s,t=null){return t||(t=r),e.readFileSync(s,t)}function c(s,t){return e.writeFileSync(s,t,r)}return fsx_1={chmodSync:e.chmodSync,existsSync:e.existsSync,readdirSync:e.readdirSync,readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,readFileX:u,writeFileX:c},fsx_1}var main$2={exports:{}};const name="dotenv",version="16.4.7",description="Loads environment variables from .env file",main$1="lib/main.js",types="lib/main.d.ts",exports$1={".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts={"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository={type:"git",url:"git://github.com/motdotla/dotenv.git"},funding="https://dotenvx.com",keywords=["dotenv","env",".env","environment","variables","config","settings"],readmeFilename="README.md",license="BSD-2-Clause",devDependencies={"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines={node:">=12"},browser={fs:!1},_package={name,version,description,main:main$1,types,exports:exports$1,scripts,repository,funding,keywords,readmeFilename,license,devDependencies,engines,browser},_package$1={__proto__:null,browser,default:_package,description,devDependencies,engines,exports:exports$1,funding,keywords,license,main:main$1,name,readmeFilename,repository,scripts,types,version},require$$4=getAugmentedNamespace(_package$1);var hasRequiredMain$1;function requireMain$1(){if(hasRequiredMain$1)return main$2.exports;hasRequiredMain$1=1;const e=require$$0__default,r=require$$0__default$1,u=require$$2__default,c=require$$3__default,s=require$$4.version,t=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function o(a){const j={};let K=a.toString();K=K.replace(/\r\n?/mg,`
|
|
3
|
-
`);let
|
|
4
|
-
`),_=_.replace(/\\r/g,"\r")),j[k]=_}return j}function h(a){const j=S(a),K=v.configDotenv({path:j});if(!K.parsed){const C=new Error(`MISSING_DATA: Cannot parse ${j} for an unknown reason`);throw C.code="MISSING_DATA",C}const q=f(a).split(","),k=q.length;let _;for(let C=0;C<k;C++)try{const M=q[C].trim(),l=R(K,M);_=v.decrypt(l.ciphertext,l.key);break}catch(M){if(C+1>=k)throw M}return v.parse(_)}function b(a){console.log(`[dotenv@${s}][INFO] ${a}`)}function y(a){console.log(`[dotenv@${s}][WARN] ${a}`)}function m(a){console.log(`[dotenv@${s}][DEBUG] ${a}`)}function f(a){return a&&a.DOTENV_KEY&&a.DOTENV_KEY.length>0?a.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function R(a,j){let K;try{K=new URL(j)}catch(M){if(M.code==="ERR_INVALID_URL"){const l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw M}const q=K.password;if(!q){const M=new Error("INVALID_DOTENV_KEY: Missing key part");throw M.code="INVALID_DOTENV_KEY",M}const k=K.searchParams.get("environment");if(!k){const M=new Error("INVALID_DOTENV_KEY: Missing environment part");throw M.code="INVALID_DOTENV_KEY",M}const _=`DOTENV_VAULT_${k.toUpperCase()}`,C=a.parsed[_];if(!C){const M=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${_} in your .env.vault file.`);throw M.code="NOT_FOUND_DOTENV_ENVIRONMENT",M}return{ciphertext:C,key:q}}function S(a){let j=null;if(a&&a.path&&a.path.length>0)if(Array.isArray(a.path))for(const K of a.path)e.existsSync(K)&&(j=K.endsWith(".vault")?K:`${K}.vault`);else j=a.path.endsWith(".vault")?a.path:`${a.path}.vault`;else j=r.resolve(process.cwd(),".env.vault");return e.existsSync(j)?j:null}function F(a){return a[0]==="~"?r.join(u.homedir(),a.slice(1)):a}function g(a){b("Loading env from encrypted .env.vault");const j=v._parseVault(a);let K=process.env;return a&&a.processEnv!=null&&(K=a.processEnv),v.populate(K,j,a),{parsed:j}}function w(a){const j=r.resolve(process.cwd(),".env");let K="utf8";const q=!!(a&&a.debug);a&&a.encoding?K=a.encoding:q&&m("No encoding is specified. UTF-8 is used by default");let k=[j];if(a&&a.path)if(!Array.isArray(a.path))k=[F(a.path)];else{k=[];for(const l of a.path)k.push(F(l))}let _;const C={};for(const l of k)try{const $=v.parse(e.readFileSync(l,{encoding:K}));v.populate(C,$,a)}catch($){q&&m(`Failed to load ${l} ${$.message}`),_=$}let M=process.env;return a&&a.processEnv!=null&&(M=a.processEnv),v.populate(M,C,a),_?{parsed:C,error:_}:{parsed:C}}function B(a){if(f(a).length===0)return v.configDotenv(a);const j=S(a);return j?v._configVault(a):(y(`You set DOTENV_KEY but you are missing a .env.vault file at ${j}. Did you forget to build it?`),v.configDotenv(a))}function N(a,j){const K=Buffer.from(j.slice(-64),"hex");let q=Buffer.from(a,"base64");const k=q.subarray(0,12),_=q.subarray(-16);q=q.subarray(12,-16);try{const C=c.createDecipheriv("aes-256-gcm",K,k);return C.setAuthTag(_),`${C.update(q)}${C.final()}`}catch(C){const M=C instanceof RangeError,l=C.message==="Invalid key length",$=C.message==="Unsupported state or unable to authenticate data";if(M||l){const E=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw E.code="INVALID_DOTENV_KEY",E}else if($){const E=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw E.code="DECRYPTION_FAILED",E}else throw C}}function d(a,j,K={}){const q=!!(K&&K.debug),k=!!(K&&K.override);if(typeof j!="object"){const _=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw _.code="OBJECT_REQUIRED",_}for(const _ of Object.keys(j))Object.prototype.hasOwnProperty.call(a,_)?(k===!0&&(a[_]=j[_]),q&&m(k===!0?`"${_}" is already defined and WAS overwritten`:`"${_}" is already defined and was NOT overwritten`)):a[_]=j[_]}const v={configDotenv:w,_configVault:g,_parseVault:h,config:B,decrypt:N,parse:o,populate:d};return main$2.exports.configDotenv=v.configDotenv,main$2.exports._configVault=v._configVault,main$2.exports._parseVault=v._parseVault,main$2.exports.config=v.config,main$2.exports.decrypt=v.decrypt,main$2.exports.parse=v.parse,main$2.exports.populate=v.populate,main$2.exports=v,main$2.exports}var parseEncryptionKeyFromDotenvKey_1,hasRequiredParseEncryptionKeyFromDotenvKey;function requireParseEncryptionKeyFromDotenvKey(){if(hasRequiredParseEncryptionKeyFromDotenvKey)return parseEncryptionKeyFromDotenvKey_1;hasRequiredParseEncryptionKeyFromDotenvKey=1;function e(r){let u;try{u=new URL(r)}catch{throw new Error("INVALID_DOTENV_KEY: Incomplete format. It should be a dotenv uri. (dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development)")}const c=u.password;if(!c)throw new Error("INVALID_DOTENV_KEY: Missing key part");return Buffer.from(c.slice(-64),"hex")}return parseEncryptionKeyFromDotenvKey_1=e,parseEncryptionKeyFromDotenvKey_1}var decrypt_1,hasRequiredDecrypt;function requireDecrypt(){if(hasRequiredDecrypt)return decrypt_1;hasRequiredDecrypt=1;const e=requireMain$1(),r=requireParseEncryptionKeyFromDotenvKey();function u(c,p){const s=r(p);try{return e.decrypt(c,s)}catch(t){if(t.code==="DECRYPTION_FAILED"){const o=new Error("[DECRYPTION_FAILED] Unable to decrypt .env.vault with DOTENV_KEY.");throw o.code="DECRYPTION_FAILED",o.help="[DECRYPTION_FAILED] Run with debug flag [dotenvx run --debug -- yourcommand] or manually run [echo $DOTENV_KEY] to compare it to the one in .env.keys.",o.debug=`[DECRYPTION_FAILED] DOTENV_KEY is ${p}`,o}if(t.code==="ERR_CRYPTO_INVALID_AUTH_TAG"){const o=new Error("[INVALID_CIPHERTEXT] Unable to decrypt what appears to be invalid ciphertext.");throw o.code="INVALID_CIPHERTEXT",o.help="[INVALID_CIPHERTEXT] Run with debug flag [dotenvx run --debug -- yourcommand] or manually check .env.vault.",o.debug=`[INVALID_CIPHERTEXT] ciphertext is '${c}'`,o}throw t}}return decrypt_1=u,decrypt_1}var dist={},utils$3={},_assert$1={},hasRequired_assert$1;function require_assert$1(){if(hasRequired_assert$1)return _assert$1;hasRequired_assert$1=1,Object.defineProperty(_assert$1,"__esModule",{value:!0}),_assert$1.abool=t,_assert$1.abytes=u,_assert$1.aexists=p,_assert$1.ahash=c,_assert$1.anumber=e,_assert$1.aoutput=s,_assert$1.isBytes=r;function e(o){if(!Number.isSafeInteger(o)||o<0)throw new Error("positive integer expected, got "+o)}function r(o){return o instanceof Uint8Array||ArrayBuffer.isView(o)&&o.constructor.name==="Uint8Array"}function u(o,...h){if(!r(o))throw new Error("Uint8Array expected");if(h.length>0&&!h.includes(o.length))throw new Error("Uint8Array expected of length "+h+", got length="+o.length)}function c(o){if(typeof o!="function"||typeof o.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");e(o.outputLen),e(o.blockLen)}function p(o,h=!0){if(o.destroyed)throw new Error("Hash instance has been destroyed");if(h&&o.finished)throw new Error("Hash#digest() has already been called")}function s(o,h){u(o);const b=h.outputLen;if(o.length<b)throw new Error("digestInto() expects output buffer of length at least "+b)}function t(o){if(typeof o!="boolean")throw new Error(`boolean expected, not ${o}`)}return _assert$1}var hasRequiredUtils$3;function requireUtils$3(){return hasRequiredUtils$3||(hasRequiredUtils$3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=e.createView=e.u32=e.u8=void 0,e.bytesToHex=t,e.hexToBytes=b,e.hexToNumber=y,e.bytesToNumberBE=m,e.numberToBytesBE=f,e.utf8ToBytes=S,e.bytesToUtf8=F,e.toBytes=g,e.overlapBytes=w,e.complexOverlapBytes=B,e.concatBytes=N,e.checkOpts=d,e.equalBytes=v,e.getOutput=K,e.setBigUint64=q,e.u64Lengths=k,e.isAligned32=_,e.copyBytes=C,e.clean=M;/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */const r=require_assert$1(),u=l=>new Uint8Array(l.buffer,l.byteOffset,l.byteLength);e.u8=u;const c=l=>new Uint32Array(l.buffer,l.byteOffset,Math.floor(l.byteLength/4));e.u32=c;const p=l=>new DataView(l.buffer,l.byteOffset,l.byteLength);if(e.createView=p,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!e.isLE)throw new Error("Non little-endian hardware is not supported");const s=Array.from({length:256},(l,$)=>$.toString(16).padStart(2,"0"));function t(l){(0,r.abytes)(l);let $="";for(let E=0;E<l.length;E++)$+=s[l[E]];return $}const o={_0:48,_9:57,A:65,F:70,a:97,f:102};function h(l){if(l>=o._0&&l<=o._9)return l-o._0;if(l>=o.A&&l<=o.F)return l-(o.A-10);if(l>=o.a&&l<=o.f)return l-(o.a-10)}function b(l){if(typeof l!="string")throw new Error("hex string expected, got "+typeof l);const $=l.length,E=$/2;if($%2)throw new Error("hex string expected, got unpadded hex of length "+$);const O=new Uint8Array(E);for(let L=0,D=0;L<E;L++,D+=2){const i=h(l.charCodeAt(D)),x=h(l.charCodeAt(D+1));if(i===void 0||x===void 0){const T=l[D]+l[D+1];throw new Error('hex string expected, got non-hex character "'+T+'" at index '+D)}O[L]=i*16+x}return O}function y(l){if(typeof l!="string")throw new Error("hex string expected, got "+typeof l);return BigInt(l===""?"0":"0x"+l)}function m(l){return y(t(l))}function f(l,$){return b(l.toString(16).padStart($*2,"0"))}const R=async()=>{};e.nextTick=R;function S(l){if(typeof l!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(l))}function F(l){return new TextDecoder().decode(l)}function g(l){if(typeof l=="string")l=S(l);else if((0,r.isBytes)(l))l=C(l);else throw new Error("Uint8Array expected, got "+typeof l);return l}function w(l,$){return l.buffer===$.buffer&&l.byteOffset<$.byteOffset+$.byteLength&&$.byteOffset<l.byteOffset+l.byteLength}function B(l,$){if(w(l,$)&&l.byteOffset<$.byteOffset)throw new Error("complex overlap of input and output is not supported")}function N(...l){let $=0;for(let O=0;O<l.length;O++){const L=l[O];(0,r.abytes)(L),$+=L.length}const E=new Uint8Array($);for(let O=0,L=0;O<l.length;O++){const D=l[O];E.set(D,L),L+=D.length}return E}function d(l,$){if($==null||typeof $!="object")throw new Error("options must be defined");return Object.assign(l,$)}function v(l,$){if(l.length!==$.length)return!1;let E=0;for(let O=0;O<l.length;O++)E|=l[O]^$[O];return E===0}class a{}e.Hash=a;const j=(l,$)=>{function E(O,...L){if((0,r.abytes)(O),l.nonceLength!==void 0){const A=L[0];if(!A)throw new Error("nonce / iv required");l.varSizeNonce?(0,r.abytes)(A):(0,r.abytes)(A,l.nonceLength)}const D=l.tagLength;D&&L[1]!==void 0&&(0,r.abytes)(L[1]);const i=$(O,...L),x=(A,H)=>{if(H!==void 0){if(A!==2)throw new Error("cipher output not supported");(0,r.abytes)(H)}};let T=!1;return{encrypt(A,H){if(T)throw new Error("cannot encrypt() twice with same key + nonce");return T=!0,(0,r.abytes)(A),x(i.encrypt.length,H),i.encrypt(A,H)},decrypt(A,H){if((0,r.abytes)(A),D&&A.length<D)throw new Error("invalid ciphertext length: smaller than tagLength="+D);return x(i.decrypt.length,H),i.decrypt(A,H)}}}return Object.assign(E,l),E};e.wrapCipher=j;function K(l,$,E=!0){if($===void 0)return new Uint8Array(l);if($.length!==l)throw new Error("invalid output length, expected "+l+", got: "+$.length);if(E&&!_($))throw new Error("invalid output, must be aligned");return $}function q(l,$,E,O){if(typeof l.setBigUint64=="function")return l.setBigUint64($,E,O);const L=BigInt(32),D=BigInt(4294967295),i=Number(E>>L&D),x=Number(E&D),T=O?4:0,W=O?0:4;l.setUint32($+T,i,O),l.setUint32($+W,x,O)}function k(l,$){const E=new Uint8Array(16),O=(0,e.createView)(E);return q(O,0,BigInt($?$.length:0),!0),q(O,8,BigInt(l.length),!0),E}function _(l){return l.byteOffset%4===0}function C(l){return Uint8Array.from(l)}function M(...l){for(let $=0;$<l.length;$++)l[$].fill(0)}}(utils$3)),utils$3}var config={},consts={},hasRequiredConsts;function requireConsts(){return hasRequiredConsts||(hasRequiredConsts=1,Object.defineProperty(consts,"__esModule",{value:!0}),consts.AEAD_TAG_LENGTH=consts.XCHACHA20_NONCE_LENGTH=consts.CURVE25519_PUBLIC_KEY_SIZE=consts.ETH_PUBLIC_KEY_SIZE=consts.UNCOMPRESSED_PUBLIC_KEY_SIZE=consts.COMPRESSED_PUBLIC_KEY_SIZE=consts.SECRET_KEY_LENGTH=void 0,consts.SECRET_KEY_LENGTH=32,consts.COMPRESSED_PUBLIC_KEY_SIZE=33,consts.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,consts.ETH_PUBLIC_KEY_SIZE=64,consts.CURVE25519_PUBLIC_KEY_SIZE=32,consts.XCHACHA20_NONCE_LENGTH=24,consts.AEAD_TAG_LENGTH=16),consts}var hasRequiredConfig$1;function requireConfig$1(){return hasRequiredConfig$1||(hasRequiredConfig$1=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ephemeralKeySize=e.symmetricNonceLength=e.symmetricAlgorithm=e.isHkdfKeyCompressed=e.isEphemeralKeyCompressed=e.ellipticCurve=e.ECIES_CONFIG=void 0;var r=requireConsts(),u=function(){function b(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return b}();e.ECIES_CONFIG=new u;var c=function(){return e.ECIES_CONFIG.ellipticCurve};e.ellipticCurve=c;var p=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed};e.isEphemeralKeyCompressed=p;var s=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed};e.isHkdfKeyCompressed=s;var t=function(){return e.ECIES_CONFIG.symmetricAlgorithm};e.symmetricAlgorithm=t;var o=function(){return e.ECIES_CONFIG.symmetricNonceLength};e.symmetricNonceLength=o;var h=function(){var b={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?r.COMPRESSED_PUBLIC_KEY_SIZE:r.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:r.CURVE25519_PUBLIC_KEY_SIZE,ed25519:r.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in b)return b[e.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};e.ephemeralKeySize=h}(config)),config}var keys={},PrivateKey={},utils$2={},elliptic={},webcrypto={},crypto$1={},hasRequiredCrypto$1;function requireCrypto$1(){return hasRequiredCrypto$1||(hasRequiredCrypto$1=1,Object.defineProperty(crypto$1,"__esModule",{value:!0}),crypto$1.crypto=void 0,crypto$1.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),crypto$1}var hasRequiredWebcrypto;function requireWebcrypto(){return hasRequiredWebcrypto||(hasRequiredWebcrypto=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=p,e.getWebcryptoSubtle=s,e.managedNonce=t;const r=requireCrypto$1(),u=require_assert$1(),c=requireUtils$3();function p(y=32){if(r.crypto&&typeof r.crypto.getRandomValues=="function")return r.crypto.getRandomValues(new Uint8Array(y));if(r.crypto&&typeof r.crypto.randomBytes=="function")return r.crypto.randomBytes(y);throw new Error("crypto.getRandomValues must be defined")}function s(){if(r.crypto&&typeof r.crypto.subtle=="object"&&r.crypto.subtle!=null)return r.crypto.subtle;throw new Error("crypto.subtle must be defined")}function t(y){const{nonceLength:m}=y;return(0,u.anumber)(m),(f,...R)=>({encrypt(S,...F){const g=p(m),w=y(f,g,...R).encrypt(S,...F),B=(0,c.concatBytes)(g,w);return w.fill(0),B},decrypt(S,...F){const g=S.subarray(0,m),w=S.subarray(m);return y(f,g,...R).decrypt(w,...F)}})}e.utils={async encrypt(y,m,f,R){const S=s(),F=await S.importKey("raw",y,m,!0,["encrypt"]),g=await S.encrypt(f,F,R);return new Uint8Array(g)},async decrypt(y,m,f,R){const S=s(),F=await S.importKey("raw",y,m,!0,["decrypt"]),g=await S.decrypt(f,F,R);return new Uint8Array(g)}};const o={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function h(y,m,f){if(y===o.CBC)return{name:o.CBC,iv:m};if(y===o.CTR)return{name:o.CTR,counter:m,length:64};if(y===o.GCM)return f?{name:o.GCM,iv:m,additionalData:f}:{name:o.GCM,iv:m};throw new Error("unknown aes block mode")}function b(y){return(m,f,R)=>{(0,u.abytes)(m),(0,u.abytes)(f);const S={name:y,length:m.length*8},F=h(y,f,R);let g=!1;return{encrypt(w){if((0,u.abytes)(w),g)throw new Error("Cannot encrypt() twice with same key / nonce");return g=!0,e.utils.encrypt(m,S,F,w)},decrypt(w){return(0,u.abytes)(w),e.utils.decrypt(m,S,F,w)}}}}e.cbc=b(o.CBC),e.ctr=b(o.CTR),e.gcm=b(o.GCM)}(webcrypto)),webcrypto}var ed25519={},sha512={},_md={},_assert={},hasRequired_assert;function require_assert(){if(hasRequired_assert)return _assert;hasRequired_assert=1,Object.defineProperty(_assert,"__esModule",{value:!0}),_assert.anumber=e,_assert.abytes=u,_assert.ahash=c,_assert.aexists=p,_assert.aoutput=s;function e(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function r(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function u(t,...o){if(!r(t))throw new Error("Uint8Array expected");if(o.length>0&&!o.includes(t.length))throw new Error("Uint8Array expected of length "+o+", got length="+t.length)}function c(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");e(t.outputLen),e(t.blockLen)}function p(t,o=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(o&&t.finished)throw new Error("Hash#digest() has already been called")}function s(t,o){u(t);const h=o.outputLen;if(t.length<h)throw new Error("digestInto() expects output buffer of length at least "+h)}return _assert}var utils$1={},crypto={},hasRequiredCrypto;function requireCrypto(){return hasRequiredCrypto||(hasRequiredCrypto=1,Object.defineProperty(crypto,"__esModule",{value:!0}),crypto.crypto=void 0,crypto.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),crypto}var hasRequiredUtils$2;function requireUtils$2(){return hasRequiredUtils$2||(hasRequiredUtils$2=1,function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.nextTick=e.byteSwapIfBE=e.isLE=void 0,e.isBytes=c,e.u8=p,e.u32=s,e.createView=t,e.rotr=o,e.rotl=h,e.byteSwap=b,e.byteSwap32=y,e.bytesToHex=f,e.hexToBytes=F,e.asyncLoop=w,e.utf8ToBytes=B,e.toBytes=N,e.concatBytes=d,e.checkOpts=a,e.wrapConstructor=j,e.wrapConstructorWithOpts=K,e.wrapXOFConstructorWithOpts=q,e.randomBytes=k;const r=requireCrypto(),u=require_assert();function c(_){return _ instanceof Uint8Array||ArrayBuffer.isView(_)&&_.constructor.name==="Uint8Array"}function p(_){return new Uint8Array(_.buffer,_.byteOffset,_.byteLength)}function s(_){return new Uint32Array(_.buffer,_.byteOffset,Math.floor(_.byteLength/4))}function t(_){return new DataView(_.buffer,_.byteOffset,_.byteLength)}function o(_,C){return _<<32-C|_>>>C}function h(_,C){return _<<C|_>>>32-C>>>0}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function b(_){return _<<24&4278190080|_<<8&16711680|_>>>8&65280|_>>>24&255}e.byteSwapIfBE=e.isLE?_=>_:_=>b(_);function y(_){for(let C=0;C<_.length;C++)_[C]=b(_[C])}const m=Array.from({length:256},(_,C)=>C.toString(16).padStart(2,"0"));function f(_){(0,u.abytes)(_);let C="";for(let M=0;M<_.length;M++)C+=m[_[M]];return C}const R={_0:48,_9:57,A:65,F:70,a:97,f:102};function S(_){if(_>=R._0&&_<=R._9)return _-R._0;if(_>=R.A&&_<=R.F)return _-(R.A-10);if(_>=R.a&&_<=R.f)return _-(R.a-10)}function F(_){if(typeof _!="string")throw new Error("hex string expected, got "+typeof _);const C=_.length,M=C/2;if(C%2)throw new Error("hex string expected, got unpadded hex of length "+C);const l=new Uint8Array(M);for(let $=0,E=0;$<M;$++,E+=2){const O=S(_.charCodeAt(E)),L=S(_.charCodeAt(E+1));if(O===void 0||L===void 0){const D=_[E]+_[E+1];throw new Error('hex string expected, got non-hex character "'+D+'" at index '+E)}l[$]=O*16+L}return l}const g=async()=>{};e.nextTick=g;async function w(_,C,M){let l=Date.now();for(let $=0;$<_;$++){M($);const E=Date.now()-l;E>=0&&E<C||(await(0,e.nextTick)(),l+=E)}}function B(_){if(typeof _!="string")throw new Error("utf8ToBytes expected string, got "+typeof _);return new Uint8Array(new TextEncoder().encode(_))}function N(_){return typeof _=="string"&&(_=B(_)),(0,u.abytes)(_),_}function d(..._){let C=0;for(let l=0;l<_.length;l++){const $=_[l];(0,u.abytes)($),C+=$.length}const M=new Uint8Array(C);for(let l=0,$=0;l<_.length;l++){const E=_[l];M.set(E,$),$+=E.length}return M}class v{clone(){return this._cloneInto()}}e.Hash=v;function a(_,C){if(C!==void 0&&{}.toString.call(C)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(_,C)}function j(_){const C=l=>_().update(N(l)).digest(),M=_();return C.outputLen=M.outputLen,C.blockLen=M.blockLen,C.create=()=>_(),C}function K(_){const C=(l,$)=>_($).update(N(l)).digest(),M=_({});return C.outputLen=M.outputLen,C.blockLen=M.blockLen,C.create=l=>_(l),C}function q(_){const C=(l,$)=>_($).update(N(l)).digest(),M=_({});return C.outputLen=M.outputLen,C.blockLen=M.blockLen,C.create=l=>_(l),C}function k(_=32){if(r.crypto&&typeof r.crypto.getRandomValues=="function")return r.crypto.getRandomValues(new Uint8Array(_));if(r.crypto&&typeof r.crypto.randomBytes=="function")return r.crypto.randomBytes(_);throw new Error("crypto.getRandomValues must be defined")}}(utils$1)),utils$1}var hasRequired_md;function require_md(){if(hasRequired_md)return _md;hasRequired_md=1,Object.defineProperty(_md,"__esModule",{value:!0}),_md.HashMD=void 0,_md.setBigUint64=u,_md.Chi=c,_md.Maj=p;const e=require_assert(),r=requireUtils$2();function u(t,o,h,b){if(typeof t.setBigUint64=="function")return t.setBigUint64(o,h,b);const y=BigInt(32),m=BigInt(4294967295),f=Number(h>>y&m),R=Number(h&m),S=b?4:0,F=b?0:4;t.setUint32(o+S,f,b),t.setUint32(o+F,R,b)}function c(t,o,h){return t&o^~t&h}function p(t,o,h){return t&o^t&h^o&h}class s extends r.Hash{constructor(o,h,b,y){super(),this.blockLen=o,this.outputLen=h,this.padOffset=b,this.isLE=y,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(o),this.view=(0,r.createView)(this.buffer)}update(o){(0,e.aexists)(this);const{view:h,buffer:b,blockLen:y}=this;o=(0,r.toBytes)(o);const m=o.length;for(let f=0;f<m;){const R=Math.min(y-this.pos,m-f);if(R===y){const S=(0,r.createView)(o);for(;y<=m-f;f+=y)this.process(S,f);continue}b.set(o.subarray(f,f+R),this.pos),this.pos+=R,f+=R,this.pos===y&&(this.process(h,0),this.pos=0)}return this.length+=o.length,this.roundClean(),this}digestInto(o){(0,e.aexists)(this),(0,e.aoutput)(o,this),this.finished=!0;const{buffer:h,view:b,blockLen:y,isLE:m}=this;let{pos:f}=this;h[f++]=128,this.buffer.subarray(f).fill(0),this.padOffset>y-f&&(this.process(b,0),f=0);for(let w=f;w<y;w++)h[w]=0;u(b,y-8,BigInt(this.length*8),m),this.process(b,0);const R=(0,r.createView)(o),S=this.outputLen;if(S%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const F=S/4,g=this.get();if(F>g.length)throw new Error("_sha2: outputLen bigger than state");for(let w=0;w<F;w++)R.setUint32(4*w,g[w],m)}digest(){const{buffer:o,outputLen:h}=this;this.digestInto(o);const b=o.slice(0,h);return this.destroy(),b}_cloneInto(o){o||(o=new this.constructor),o.set(...this.get());const{blockLen:h,buffer:b,length:y,finished:m,destroyed:f,pos:R}=this;return o.length=y,o.pos=R,o.finished=m,o.destroyed=f,y%h&&o.buffer.set(b),o}}return _md.HashMD=s,_md}var _u64={},hasRequired_u64;function require_u64(){if(hasRequired_u64)return _u64;hasRequired_u64=1,Object.defineProperty(_u64,"__esModule",{value:!0}),_u64.add5L=_u64.add5H=_u64.add4H=_u64.add4L=_u64.add3H=_u64.add3L=_u64.rotlBL=_u64.rotlBH=_u64.rotlSL=_u64.rotlSH=_u64.rotr32L=_u64.rotr32H=_u64.rotrBL=_u64.rotrBH=_u64.rotrSL=_u64.rotrSH=_u64.shrSL=_u64.shrSH=_u64.toBig=void 0,_u64.fromBig=u,_u64.split=c,_u64.add=w;const e=BigInt(2**32-1),r=BigInt(32);function u(q,k=!1){return k?{h:Number(q&e),l:Number(q>>r&e)}:{h:Number(q>>r&e)|0,l:Number(q&e)|0}}function c(q,k=!1){let _=new Uint32Array(q.length),C=new Uint32Array(q.length);for(let M=0;M<q.length;M++){const{h:l,l:$}=u(q[M],k);[_[M],C[M]]=[l,$]}return[_,C]}const p=(q,k)=>BigInt(q>>>0)<<r|BigInt(k>>>0);_u64.toBig=p;const s=(q,k,_)=>q>>>_;_u64.shrSH=s;const t=(q,k,_)=>q<<32-_|k>>>_;_u64.shrSL=t;const o=(q,k,_)=>q>>>_|k<<32-_;_u64.rotrSH=o;const h=(q,k,_)=>q<<32-_|k>>>_;_u64.rotrSL=h;const b=(q,k,_)=>q<<64-_|k>>>_-32;_u64.rotrBH=b;const y=(q,k,_)=>q>>>_-32|k<<64-_;_u64.rotrBL=y;const m=(q,k)=>k;_u64.rotr32H=m;const f=(q,k)=>q;_u64.rotr32L=f;const R=(q,k,_)=>q<<_|k>>>32-_;_u64.rotlSH=R;const S=(q,k,_)=>k<<_|q>>>32-_;_u64.rotlSL=S;const F=(q,k,_)=>k<<_-32|q>>>64-_;_u64.rotlBH=F;const g=(q,k,_)=>q<<_-32|k>>>64-_;_u64.rotlBL=g;function w(q,k,_,C){const M=(k>>>0)+(C>>>0);return{h:q+_+(M/2**32|0)|0,l:M|0}}const B=(q,k,_)=>(q>>>0)+(k>>>0)+(_>>>0);_u64.add3L=B;const N=(q,k,_,C)=>k+_+C+(q/2**32|0)|0;_u64.add3H=N;const d=(q,k,_,C)=>(q>>>0)+(k>>>0)+(_>>>0)+(C>>>0);_u64.add4L=d;const v=(q,k,_,C,M)=>k+_+C+M+(q/2**32|0)|0;_u64.add4H=v;const a=(q,k,_,C,M)=>(q>>>0)+(k>>>0)+(_>>>0)+(C>>>0)+(M>>>0);_u64.add5L=a;const j=(q,k,_,C,M,l)=>k+_+C+M+l+(q/2**32|0)|0;_u64.add5H=j;const K={fromBig:u,split:c,toBig:p,shrSH:s,shrSL:t,rotrSH:o,rotrSL:h,rotrBH:b,rotrBL:y,rotr32H:m,rotr32L:f,rotlSH:R,rotlSL:S,rotlBH:F,rotlBL:g,add:w,add3L:B,add3H:N,add4L:d,add4H:v,add5H:j,add5L:a};return _u64.default=K,_u64}var hasRequiredSha512;function requireSha512(){if(hasRequiredSha512)return sha512;hasRequiredSha512=1,Object.defineProperty(sha512,"__esModule",{value:!0}),sha512.sha384=sha512.sha512_256=sha512.sha512_224=sha512.sha512=sha512.SHA384=sha512.SHA512_256=sha512.SHA512_224=sha512.SHA512=void 0;const e=require_md(),r=require_u64(),u=requireUtils$2(),[c,p]=r.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(m=>BigInt(m))),s=new Uint32Array(80),t=new Uint32Array(80);class o extends e.HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:f,Al:R,Bh:S,Bl:F,Ch:g,Cl:w,Dh:B,Dl:N,Eh:d,El:v,Fh:a,Fl:j,Gh:K,Gl:q,Hh:k,Hl:_}=this;return[f,R,S,F,g,w,B,N,d,v,a,j,K,q,k,_]}set(f,R,S,F,g,w,B,N,d,v,a,j,K,q,k,_){this.Ah=f|0,this.Al=R|0,this.Bh=S|0,this.Bl=F|0,this.Ch=g|0,this.Cl=w|0,this.Dh=B|0,this.Dl=N|0,this.Eh=d|0,this.El=v|0,this.Fh=a|0,this.Fl=j|0,this.Gh=K|0,this.Gl=q|0,this.Hh=k|0,this.Hl=_|0}process(f,R){for(let l=0;l<16;l++,R+=4)s[l]=f.getUint32(R),t[l]=f.getUint32(R+=4);for(let l=16;l<80;l++){const $=s[l-15]|0,E=t[l-15]|0,O=r.default.rotrSH($,E,1)^r.default.rotrSH($,E,8)^r.default.shrSH($,E,7),L=r.default.rotrSL($,E,1)^r.default.rotrSL($,E,8)^r.default.shrSL($,E,7),D=s[l-2]|0,i=t[l-2]|0,x=r.default.rotrSH(D,i,19)^r.default.rotrBH(D,i,61)^r.default.shrSH(D,i,6),T=r.default.rotrSL(D,i,19)^r.default.rotrBL(D,i,61)^r.default.shrSL(D,i,6),W=r.default.add4L(L,T,t[l-7],t[l-16]),A=r.default.add4H(W,O,x,s[l-7],s[l-16]);s[l]=A|0,t[l]=W|0}let{Ah:S,Al:F,Bh:g,Bl:w,Ch:B,Cl:N,Dh:d,Dl:v,Eh:a,El:j,Fh:K,Fl:q,Gh:k,Gl:_,Hh:C,Hl:M}=this;for(let l=0;l<80;l++){const $=r.default.rotrSH(a,j,14)^r.default.rotrSH(a,j,18)^r.default.rotrBH(a,j,41),E=r.default.rotrSL(a,j,14)^r.default.rotrSL(a,j,18)^r.default.rotrBL(a,j,41),O=a&K^~a&k,L=j&q^~j&_,D=r.default.add5L(M,E,L,p[l],t[l]),i=r.default.add5H(D,C,$,O,c[l],s[l]),x=D|0,T=r.default.rotrSH(S,F,28)^r.default.rotrBH(S,F,34)^r.default.rotrBH(S,F,39),W=r.default.rotrSL(S,F,28)^r.default.rotrBL(S,F,34)^r.default.rotrBL(S,F,39),A=S&g^S&B^g&B,H=F&w^F&N^w&N;C=k|0,M=_|0,k=K|0,_=q|0,K=a|0,q=j|0,{h:a,l:j}=r.default.add(d|0,v|0,i|0,x|0),d=B|0,v=N|0,B=g|0,N=w|0,g=S|0,w=F|0;const re=r.default.add3L(x,W,H);S=r.default.add3H(re,i,T,A),F=re|0}({h:S,l:F}=r.default.add(this.Ah|0,this.Al|0,S|0,F|0)),{h:g,l:w}=r.default.add(this.Bh|0,this.Bl|0,g|0,w|0),{h:B,l:N}=r.default.add(this.Ch|0,this.Cl|0,B|0,N|0),{h:d,l:v}=r.default.add(this.Dh|0,this.Dl|0,d|0,v|0),{h:a,l:j}=r.default.add(this.Eh|0,this.El|0,a|0,j|0),{h:K,l:q}=r.default.add(this.Fh|0,this.Fl|0,K|0,q|0),{h:k,l:_}=r.default.add(this.Gh|0,this.Gl|0,k|0,_|0),{h:C,l:M}=r.default.add(this.Hh|0,this.Hl|0,C|0,M|0),this.set(S,F,g,w,B,N,d,v,a,j,K,q,k,_,C,M)}roundClean(){s.fill(0),t.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}sha512.SHA512=o;class h extends o{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}sha512.SHA512_224=h;class b extends o{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}sha512.SHA512_256=b;class y extends o{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}return sha512.SHA384=y,sha512.sha512=(0,u.wrapConstructor)(()=>new o),sha512.sha512_224=(0,u.wrapConstructor)(()=>new h),sha512.sha512_256=(0,u.wrapConstructor)(()=>new b),sha512.sha384=(0,u.wrapConstructor)(()=>new y),sha512}var curve={},modular={},utils={},hasRequiredUtils$1;function requireUtils$1(){if(hasRequiredUtils$1)return utils;hasRequiredUtils$1=1;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(utils,"__esModule",{value:!0}),utils.notImplemented=utils.bitMask=void 0,utils.isBytes=c,utils.abytes=p,utils.abool=s,utils.bytesToHex=o,utils.numberToHexUnpadded=h,utils.hexToNumber=b,utils.hexToBytes=f,utils.bytesToNumberBE=R,utils.bytesToNumberLE=S,utils.numberToBytesBE=F,utils.numberToBytesLE=g,utils.numberToVarBytesBE=w,utils.ensureBytes=B,utils.concatBytes=N,utils.equalBytes=d,utils.utf8ToBytes=v,utils.inRange=j,utils.aInRange=K,utils.bitLen=q,utils.bitGet=k,utils.bitSet=_,utils.createHmacDrbg=$,utils.validateObject=O,utils.memoized=D;const e=BigInt(0),r=BigInt(1),u=BigInt(2);function c(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function p(i){if(!c(i))throw new Error("Uint8Array expected")}function s(i,x){if(typeof x!="boolean")throw new Error(i+" boolean expected, got "+x)}const t=Array.from({length:256},(i,x)=>x.toString(16).padStart(2,"0"));function o(i){p(i);let x="";for(let T=0;T<i.length;T++)x+=t[i[T]];return x}function h(i){const x=i.toString(16);return x.length&1?"0"+x:x}function b(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);return i===""?e:BigInt("0x"+i)}const y={_0:48,_9:57,A:65,F:70,a:97,f:102};function m(i){if(i>=y._0&&i<=y._9)return i-y._0;if(i>=y.A&&i<=y.F)return i-(y.A-10);if(i>=y.a&&i<=y.f)return i-(y.a-10)}function f(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);const x=i.length,T=x/2;if(x%2)throw new Error("hex string expected, got unpadded hex of length "+x);const W=new Uint8Array(T);for(let A=0,H=0;A<T;A++,H+=2){const re=m(i.charCodeAt(H)),U=m(i.charCodeAt(H+1));if(re===void 0||U===void 0){const P=i[H]+i[H+1];throw new Error('hex string expected, got non-hex character "'+P+'" at index '+H)}W[A]=re*16+U}return W}function R(i){return b(o(i))}function S(i){return p(i),b(o(Uint8Array.from(i).reverse()))}function F(i,x){return f(i.toString(16).padStart(x*2,"0"))}function g(i,x){return F(i,x).reverse()}function w(i){return f(h(i))}function B(i,x,T){let W;if(typeof x=="string")try{W=f(x)}catch(H){throw new Error(i+" must be hex string or Uint8Array, cause: "+H)}else if(c(x))W=Uint8Array.from(x);else throw new Error(i+" must be hex string or Uint8Array");const A=W.length;if(typeof T=="number"&&A!==T)throw new Error(i+" of length "+T+" expected, got "+A);return W}function N(...i){let x=0;for(let W=0;W<i.length;W++){const A=i[W];p(A),x+=A.length}const T=new Uint8Array(x);for(let W=0,A=0;W<i.length;W++){const H=i[W];T.set(H,A),A+=H.length}return T}function d(i,x){if(i.length!==x.length)return!1;let T=0;for(let W=0;W<i.length;W++)T|=i[W]^x[W];return T===0}function v(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}const a=i=>typeof i=="bigint"&&e<=i;function j(i,x,T){return a(i)&&a(x)&&a(T)&&x<=i&&i<T}function K(i,x,T,W){if(!j(x,T,W))throw new Error("expected valid "+i+": "+T+" <= n < "+W+", got "+x)}function q(i){let x;for(x=0;i>e;i>>=r,x+=1);return x}function k(i,x){return i>>BigInt(x)&r}function _(i,x,T){return i|(T?r:e)<<BigInt(x)}const C=i=>(u<<BigInt(i-1))-r;utils.bitMask=C;const M=i=>new Uint8Array(i),l=i=>Uint8Array.from(i);function $(i,x,T){if(typeof i!="number"||i<2)throw new Error("hashLen must be a number");if(typeof x!="number"||x<2)throw new Error("qByteLen must be a number");if(typeof T!="function")throw new Error("hmacFn must be a function");let W=M(i),A=M(i),H=0;const re=()=>{W.fill(1),A.fill(0),H=0},U=(...z)=>T(A,W,...z),P=(z=M())=>{A=U(l([0]),z),W=U(),z.length!==0&&(A=U(l([1]),z),W=U())},V=()=>{if(H++>=1e3)throw new Error("drbg: tried 1000 values");let z=0;const te=[];for(;z<x;){W=U();const ee=W.slice();te.push(ee),z+=W.length}return N(...te)};return(z,te)=>{re(),P(z);let ee;for(;!(ee=te(V()));)P();return re(),ee}}const E={bigint:i=>typeof i=="bigint",function:i=>typeof i=="function",boolean:i=>typeof i=="boolean",string:i=>typeof i=="string",stringOrUint8Array:i=>typeof i=="string"||c(i),isSafeInteger:i=>Number.isSafeInteger(i),array:i=>Array.isArray(i),field:(i,x)=>x.Fp.isValid(i),hash:i=>typeof i=="function"&&Number.isSafeInteger(i.outputLen)};function O(i,x,T={}){const W=(A,H,re)=>{const U=E[H];if(typeof U!="function")throw new Error("invalid validator function");const P=i[A];if(!(re&&P===void 0)&&!U(P,i))throw new Error("param "+String(A)+" is invalid. Expected "+H+", got "+P)};for(const[A,H]of Object.entries(x))W(A,H,!1);for(const[A,H]of Object.entries(T))W(A,H,!0);return i}const L=()=>{throw new Error("not implemented")};utils.notImplemented=L;function D(i){const x=new WeakMap;return(T,...W)=>{const A=x.get(T);if(A!==void 0)return A;const H=i(T,...W);return x.set(T,H),H}}return utils}var hasRequiredModular;function requireModular(){if(hasRequiredModular)return modular;hasRequiredModular=1,Object.defineProperty(modular,"__esModule",{value:!0}),modular.isNegativeLE=void 0,modular.mod=h,modular.pow=b,modular.pow2=y,modular.invert=m,modular.tonelliShanks=f,modular.FpSqrt=R,modular.validateField=g,modular.FpPow=w,modular.FpInvertBatch=B,modular.FpDiv=N,modular.FpLegendre=d,modular.FpIsSquare=v,modular.nLength=a,modular.Field=j,modular.FpSqrtOdd=K,modular.FpSqrtEven=q,modular.hashToPrivateScalar=k,modular.getFieldBytesLength=_,modular.getMinHashLength=C,modular.mapHashToField=M;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireUtils$1(),r=BigInt(0),u=BigInt(1),c=BigInt(2),p=BigInt(3),s=BigInt(4),t=BigInt(5),o=BigInt(8);function h(l,$){const E=l%$;return E>=r?E:$+E}function b(l,$,E){if($<r)throw new Error("invalid exponent, negatives unsupported");if(E<=r)throw new Error("invalid modulus");if(E===u)return r;let O=u;for(;$>r;)$&u&&(O=O*l%E),l=l*l%E,$>>=u;return O}function y(l,$,E){let O=l;for(;$-- >r;)O*=O,O%=E;return O}function m(l,$){if(l===r)throw new Error("invert: expected non-zero number");if($<=r)throw new Error("invert: expected positive modulus, got "+$);let E=h(l,$),O=$,L=r,D=u;for(;E!==r;){const x=O/E,T=O%E,W=L-D*x;O=E,E=T,L=D,D=W}if(O!==u)throw new Error("invert: does not exist");return h(L,$)}function f(l){const $=(l-u)/c;let E,O,L;for(E=l-u,O=0;E%c===r;E/=c,O++);for(L=c;L<l&&b(L,$,l)!==l-u;L++)if(L>1e3)throw new Error("Cannot find square root: likely non-prime P");if(O===1){const i=(l+u)/s;return function(T,W){const A=T.pow(W,i);if(!T.eql(T.sqr(A),W))throw new Error("Cannot find square root");return A}}const D=(E+u)/c;return function(x,T){if(x.pow(T,$)===x.neg(x.ONE))throw new Error("Cannot find square root");let W=O,A=x.pow(x.mul(x.ONE,L),E),H=x.pow(T,D),re=x.pow(T,E);for(;!x.eql(re,x.ONE);){if(x.eql(re,x.ZERO))return x.ZERO;let U=1;for(let V=x.sqr(re);U<W&&!x.eql(V,x.ONE);U++)V=x.sqr(V);const P=x.pow(A,u<<BigInt(W-U-1));A=x.sqr(P),H=x.mul(H,P),re=x.mul(re,A),W=U}return H}}function R(l){if(l%s===p){const $=(l+u)/s;return function(O,L){const D=O.pow(L,$);if(!O.eql(O.sqr(D),L))throw new Error("Cannot find square root");return D}}if(l%o===t){const $=(l-t)/o;return function(O,L){const D=O.mul(L,c),i=O.pow(D,$),x=O.mul(L,i),T=O.mul(O.mul(x,c),i),W=O.mul(x,O.sub(T,O.ONE));if(!O.eql(O.sqr(W),L))throw new Error("Cannot find square root");return W}}return f(l)}const S=(l,$)=>(h(l,$)&u)===u;modular.isNegativeLE=S;const F=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function g(l){const $={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},E=F.reduce((O,L)=>(O[L]="function",O),$);return(0,e.validateObject)(l,E)}function w(l,$,E){if(E<r)throw new Error("invalid exponent, negatives unsupported");if(E===r)return l.ONE;if(E===u)return $;let O=l.ONE,L=$;for(;E>r;)E&u&&(O=l.mul(O,L)),L=l.sqr(L),E>>=u;return O}function B(l,$){const E=new Array($.length),O=$.reduce((D,i,x)=>l.is0(i)?D:(E[x]=D,l.mul(D,i)),l.ONE),L=l.inv(O);return $.reduceRight((D,i,x)=>l.is0(i)?D:(E[x]=l.mul(D,E[x]),l.mul(D,i)),L),E}function N(l,$,E){return l.mul($,typeof E=="bigint"?m(E,l.ORDER):l.inv(E))}function d(l){const $=(l-u)/c;return(E,O)=>E.pow(O,$)}function v(l){const $=d(l.ORDER);return E=>{const O=$(l,E);return l.eql(O,l.ZERO)||l.eql(O,l.ONE)}}function a(l,$){const E=$!==void 0?$:l.toString(2).length,O=Math.ceil(E/8);return{nBitLength:E,nByteLength:O}}function j(l,$,E=!1,O={}){if(l<=r)throw new Error("invalid field: expected ORDER > 0, got "+l);const{nBitLength:L,nByteLength:D}=a(l,$);if(D>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i;const x=Object.freeze({ORDER:l,isLE:E,BITS:L,BYTES:D,MASK:(0,e.bitMask)(L),ZERO:r,ONE:u,create:T=>h(T,l),isValid:T=>{if(typeof T!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof T);return r<=T&&T<l},is0:T=>T===r,isOdd:T=>(T&u)===u,neg:T=>h(-T,l),eql:(T,W)=>T===W,sqr:T=>h(T*T,l),add:(T,W)=>h(T+W,l),sub:(T,W)=>h(T-W,l),mul:(T,W)=>h(T*W,l),pow:(T,W)=>w(x,T,W),div:(T,W)=>h(T*m(W,l),l),sqrN:T=>T*T,addN:(T,W)=>T+W,subN:(T,W)=>T-W,mulN:(T,W)=>T*W,inv:T=>m(T,l),sqrt:O.sqrt||(T=>(i||(i=R(l)),i(x,T))),invertBatch:T=>B(x,T),cmov:(T,W,A)=>A?W:T,toBytes:T=>E?(0,e.numberToBytesLE)(T,D):(0,e.numberToBytesBE)(T,D),fromBytes:T=>{if(T.length!==D)throw new Error("Field.fromBytes: expected "+D+" bytes, got "+T.length);return E?(0,e.bytesToNumberLE)(T):(0,e.bytesToNumberBE)(T)}});return Object.freeze(x)}function K(l,$){if(!l.isOdd)throw new Error("Field doesn't have isOdd");const E=l.sqrt($);return l.isOdd(E)?E:l.neg(E)}function q(l,$){if(!l.isOdd)throw new Error("Field doesn't have isOdd");const E=l.sqrt($);return l.isOdd(E)?l.neg(E):E}function k(l,$,E=!1){l=(0,e.ensureBytes)("privateHash",l);const O=l.length,L=a($).nByteLength+8;if(L<24||O<L||O>1024)throw new Error("hashToPrivateScalar: expected "+L+"-1024 bytes of input, got "+O);const D=E?(0,e.bytesToNumberLE)(l):(0,e.bytesToNumberBE)(l);return h(D,$-u)+u}function _(l){if(typeof l!="bigint")throw new Error("field order must be bigint");const $=l.toString(2).length;return Math.ceil($/8)}function C(l){const $=_(l);return $+Math.ceil($/2)}function M(l,$,E=!1){const O=l.length,L=_($),D=C($);if(O<16||O<D||O>1024)throw new Error("expected "+D+"-1024 bytes of input, got "+O);const i=E?(0,e.bytesToNumberLE)(l):(0,e.bytesToNumberBE)(l),x=h(i,$-u)+u;return E?(0,e.numberToBytesLE)(x,L):(0,e.numberToBytesBE)(x,L)}return modular}var hasRequiredCurve;function requireCurve(){if(hasRequiredCurve)return curve;hasRequiredCurve=1,Object.defineProperty(curve,"__esModule",{value:!0}),curve.wNAF=f,curve.pippenger=R,curve.precomputeMSMUnsafe=S,curve.validateBasic=F;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireModular(),r=requireUtils$1(),u=BigInt(0),c=BigInt(1);function p(g,w){const B=w.negate();return g?B:w}function s(g,w){if(!Number.isSafeInteger(g)||g<=0||g>w)throw new Error("invalid window size, expected [1.."+w+"], got W="+g)}function t(g,w){s(g,w);const B=Math.ceil(w/g)+1,N=2**(g-1);return{windows:B,windowSize:N}}function o(g,w){if(!Array.isArray(g))throw new Error("array expected");g.forEach((B,N)=>{if(!(B instanceof w))throw new Error("invalid point at index "+N)})}function h(g,w){if(!Array.isArray(g))throw new Error("array of scalars expected");g.forEach((B,N)=>{if(!w.isValid(B))throw new Error("invalid scalar at index "+N)})}const b=new WeakMap,y=new WeakMap;function m(g){return y.get(g)||1}function f(g,w){return{constTimeNegate:p,hasPrecomputes(B){return m(B)!==1},unsafeLadder(B,N,d=g.ZERO){let v=B;for(;N>u;)N&c&&(d=d.add(v)),v=v.double(),N>>=c;return d},precomputeWindow(B,N){const{windows:d,windowSize:v}=t(N,w),a=[];let j=B,K=j;for(let q=0;q<d;q++){K=j,a.push(K);for(let k=1;k<v;k++)K=K.add(j),a.push(K);j=K.double()}return a},wNAF(B,N,d){const{windows:v,windowSize:a}=t(B,w);let j=g.ZERO,K=g.BASE;const q=BigInt(2**B-1),k=2**B,_=BigInt(B);for(let C=0;C<v;C++){const M=C*a;let l=Number(d&q);d>>=_,l>a&&(l-=k,d+=c);const $=M,E=M+Math.abs(l)-1,O=C%2!==0,L=l<0;l===0?K=K.add(p(O,N[$])):j=j.add(p(L,N[E]))}return{p:j,f:K}},wNAFUnsafe(B,N,d,v=g.ZERO){const{windows:a,windowSize:j}=t(B,w),K=BigInt(2**B-1),q=2**B,k=BigInt(B);for(let _=0;_<a;_++){const C=_*j;if(d===u)break;let M=Number(d&K);if(d>>=k,M>j&&(M-=q,d+=c),M===0)continue;let l=N[C+Math.abs(M)-1];M<0&&(l=l.negate()),v=v.add(l)}return v},getPrecomputes(B,N,d){let v=b.get(N);return v||(v=this.precomputeWindow(N,B),B!==1&&b.set(N,d(v))),v},wNAFCached(B,N,d){const v=m(B);return this.wNAF(v,this.getPrecomputes(v,B,d),N)},wNAFCachedUnsafe(B,N,d,v){const a=m(B);return a===1?this.unsafeLadder(B,N,v):this.wNAFUnsafe(a,this.getPrecomputes(a,B,d),N,v)},setWindowSize(B,N){s(N,w),y.set(B,N),b.delete(B)}}}function R(g,w,B,N){if(o(B,g),h(N,w),B.length!==N.length)throw new Error("arrays of points and scalars must have equal length");const d=g.ZERO,v=(0,r.bitLen)(BigInt(B.length)),a=v>12?v-3:v>4?v-2:v?2:1,j=(1<<a)-1,K=new Array(j+1).fill(d),q=Math.floor((w.BITS-1)/a)*a;let k=d;for(let _=q;_>=0;_-=a){K.fill(d);for(let M=0;M<N.length;M++){const l=N[M],$=Number(l>>BigInt(_)&BigInt(j));K[$]=K[$].add(B[M])}let C=d;for(let M=K.length-1,l=d;M>0;M--)l=l.add(K[M]),C=C.add(l);if(k=k.add(C),_!==0)for(let M=0;M<a;M++)k=k.double()}return k}function S(g,w,B,N){s(N,w.BITS),o(B,g);const d=g.ZERO,v=2**N-1,a=Math.ceil(w.BITS/N),j=BigInt((1<<N)-1),K=B.map(q=>{const k=[];for(let _=0,C=q;_<v;_++)k.push(C),C=C.add(q);return k});return q=>{if(h(q,w),q.length>B.length)throw new Error("array of scalars must be smaller than array of points");let k=d;for(let _=0;_<a;_++){if(k!==d)for(let M=0;M<N;M++)k=k.double();const C=BigInt(a*N-(_+1)*N);for(let M=0;M<q.length;M++){const l=q[M],$=Number(l>>C&j);$&&(k=k.add(K[M][$-1]))}}return k}}function F(g){return(0,e.validateField)(g.Fp),(0,r.validateObject)(g,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,e.nLength)(g.n,g.nBitLength),...g,p:g.Fp.ORDER})}return curve}var edwards={},hasRequiredEdwards;function requireEdwards(){if(hasRequiredEdwards)return edwards;hasRequiredEdwards=1,Object.defineProperty(edwards,"__esModule",{value:!0}),edwards.twistedEdwards=y;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireCurve(),r=requireModular(),u=requireUtils$1(),c=requireUtils$1(),p=BigInt(0),s=BigInt(1),t=BigInt(2),o=BigInt(8),h={zip215:!0};function b(m){const f=(0,e.validateBasic)(m);return u.validateObject(m,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...f})}function y(m){const f=b(m),{Fp:R,n:S,prehash:F,hash:g,randomBytes:w,nByteLength:B,h:N}=f,d=t<<BigInt(B*8)-s,v=R.create,a=(0,r.Field)(f.n,f.nBitLength),j=f.uvRatio||((U,P)=>{try{return{isValid:!0,value:R.sqrt(U*R.inv(P))}}catch{return{isValid:!1,value:p}}}),K=f.adjustScalarBytes||(U=>U),q=f.domain||((U,P,V)=>{if((0,c.abool)("phflag",V),P.length||V)throw new Error("Contexts/pre-hash are not supported");return U});function k(U,P){u.aInRange("coordinate "+U,P,p,d)}function _(U){if(!(U instanceof l))throw new Error("ExtendedPoint expected")}const C=(0,c.memoized)((U,P)=>{const{ex:V,ey:X,ez:z}=U,te=U.is0();P==null&&(P=te?o:R.inv(z));const ee=v(V*P),G=v(X*P),Y=v(z*P);if(te)return{x:p,y:s};if(Y!==s)throw new Error("invZ was invalid");return{x:ee,y:G}}),M=(0,c.memoized)(U=>{const{a:P,d:V}=f;if(U.is0())throw new Error("bad point: ZERO");const{ex:X,ey:z,ez:te,et:ee}=U,G=v(X*X),Y=v(z*z),Q=v(te*te),ne=v(Q*Q),Z=v(G*P),oe=v(Q*v(Z+Y)),J=v(ne+v(V*v(G*Y)));if(oe!==J)throw new Error("bad point: equation left != right (1)");const se=v(X*z),ie=v(te*ee);if(se!==ie)throw new Error("bad point: equation left != right (2)");return!0});class l{constructor(P,V,X,z){this.ex=P,this.ey=V,this.ez=X,this.et=z,k("x",P),k("y",V),k("z",X),k("t",z),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(P){if(P instanceof l)throw new Error("extended point not allowed");const{x:V,y:X}=P||{};return k("x",V),k("y",X),new l(V,X,s,v(V*X))}static normalizeZ(P){const V=R.invertBatch(P.map(X=>X.ez));return P.map((X,z)=>X.toAffine(V[z])).map(l.fromAffine)}static msm(P,V){return(0,e.pippenger)(l,a,P,V)}_setWindowSize(P){O.setWindowSize(this,P)}assertValidity(){M(this)}equals(P){_(P);const{ex:V,ey:X,ez:z}=this,{ex:te,ey:ee,ez:G}=P,Y=v(V*G),Q=v(te*z),ne=v(X*G),Z=v(ee*z);return Y===Q&&ne===Z}is0(){return this.equals(l.ZERO)}negate(){return new l(v(-this.ex),this.ey,this.ez,v(-this.et))}double(){const{a:P}=f,{ex:V,ey:X,ez:z}=this,te=v(V*V),ee=v(X*X),G=v(t*v(z*z)),Y=v(P*te),Q=V+X,ne=v(v(Q*Q)-te-ee),Z=Y+ee,oe=Z-G,J=Y-ee,se=v(ne*oe),ie=v(Z*J),ce=v(ne*J),ae=v(oe*Z);return new l(se,ie,ae,ce)}add(P){_(P);const{a:V,d:X}=f,{ex:z,ey:te,ez:ee,et:G}=this,{ex:Y,ey:Q,ez:ne,et:Z}=P;if(V===BigInt(-1)){const ye=v((te-z)*(Q+Y)),ve=v((te+z)*(Q-Y)),ge=v(ve-ye);if(ge===p)return this.double();const me=v(ee*t*Z),be=v(G*t*ne),Ee=be+me,_e=ve+ye,we=be-me,xe=v(Ee*ge),Ae=v(_e*we),Se=v(Ee*we),Re=v(ge*_e);return new l(xe,Ae,Re,Se)}const oe=v(z*Y),J=v(te*Q),se=v(G*X*Z),ie=v(ee*ne),ce=v((z+te)*(Y+Q)-oe-J),ae=ie-se,le=ie+se,ue=v(J-V*oe),de=v(ce*ae),fe=v(le*ue),pe=v(ce*ue),he=v(ae*le);return new l(de,fe,he,pe)}subtract(P){return this.add(P.negate())}wNAF(P){return O.wNAFCached(this,P,l.normalizeZ)}multiply(P){const V=P;u.aInRange("scalar",V,s,S);const{p:X,f:z}=this.wNAF(V);return l.normalizeZ([X,z])[0]}multiplyUnsafe(P,V=l.ZERO){const X=P;return u.aInRange("scalar",X,p,S),X===p?E:this.is0()||X===s?this:O.wNAFCachedUnsafe(this,X,l.normalizeZ,V)}isSmallOrder(){return this.multiplyUnsafe(N).is0()}isTorsionFree(){return O.unsafeLadder(this,S).is0()}toAffine(P){return C(this,P)}clearCofactor(){const{h:P}=f;return P===s?this:this.multiplyUnsafe(P)}static fromHex(P,V=!1){const{d:X,a:z}=f,te=R.BYTES;P=(0,c.ensureBytes)("pointHex",P,te),(0,c.abool)("zip215",V);const ee=P.slice(),G=P[te-1];ee[te-1]=G&-129;const Y=u.bytesToNumberLE(ee),Q=V?d:R.ORDER;u.aInRange("pointHex.y",Y,p,Q);const ne=v(Y*Y),Z=v(ne-s),oe=v(X*ne-z);let{isValid:J,value:se}=j(Z,oe);if(!J)throw new Error("Point.fromHex: invalid y coordinate");const ie=(se&s)===s,ce=(G&128)!==0;if(!V&&se===p&&ce)throw new Error("Point.fromHex: x=0 and x_0=1");return ce!==ie&&(se=v(-se)),l.fromAffine({x:se,y:Y})}static fromPrivateKey(P){return i(P).point}toRawBytes(){const{x:P,y:V}=this.toAffine(),X=u.numberToBytesLE(V,R.BYTES);return X[X.length-1]|=P&s?128:0,X}toHex(){return u.bytesToHex(this.toRawBytes())}}l.BASE=new l(f.Gx,f.Gy,s,v(f.Gx*f.Gy)),l.ZERO=new l(p,s,s,p);const{BASE:$,ZERO:E}=l,O=(0,e.wNAF)(l,B*8);function L(U){return(0,r.mod)(U,S)}function D(U){return L(u.bytesToNumberLE(U))}function i(U){const P=R.BYTES;U=(0,c.ensureBytes)("private key",U,P);const V=(0,c.ensureBytes)("hashed private key",g(U),2*P),X=K(V.slice(0,P)),z=V.slice(P,2*P),te=D(X),ee=$.multiply(te),G=ee.toRawBytes();return{head:X,prefix:z,scalar:te,point:ee,pointBytes:G}}function x(U){return i(U).pointBytes}function T(U=new Uint8Array,...P){const V=u.concatBytes(...P);return D(g(q(V,(0,c.ensureBytes)("context",U),!!F)))}function W(U,P,V={}){U=(0,c.ensureBytes)("message",U),F&&(U=F(U));const{prefix:X,scalar:z,pointBytes:te}=i(P),ee=T(V.context,X,U),G=$.multiply(ee).toRawBytes(),Y=T(V.context,G,te,U),Q=L(ee+Y*z);u.aInRange("signature.s",Q,p,S);const ne=u.concatBytes(G,u.numberToBytesLE(Q,R.BYTES));return(0,c.ensureBytes)("result",ne,R.BYTES*2)}const A=h;function H(U,P,V,X=A){const{context:z,zip215:te}=X,ee=R.BYTES;U=(0,c.ensureBytes)("signature",U,2*ee),P=(0,c.ensureBytes)("message",P),V=(0,c.ensureBytes)("publicKey",V,ee),te!==void 0&&(0,c.abool)("zip215",te),F&&(P=F(P));const G=u.bytesToNumberLE(U.slice(ee,2*ee));let Y,Q,ne;try{Y=l.fromHex(V,te),Q=l.fromHex(U.slice(0,ee),te),ne=$.multiplyUnsafe(G)}catch{return!1}if(!te&&Y.isSmallOrder())return!1;const Z=T(z,Q.toRawBytes(),Y.toRawBytes(),P);return Q.add(Y.multiplyUnsafe(Z)).subtract(ne).clearCofactor().equals(l.ZERO)}return $._setWindowSize(8),{CURVE:f,getPublicKey:x,sign:W,verify:H,ExtendedPoint:l,utils:{getExtendedPublicKey:i,randomPrivateKey:()=>w(R.BYTES),precompute(U=8,P=l.BASE){return P._setWindowSize(U),P.multiply(BigInt(3)),P}}}}return edwards}var hashToCurve={},hasRequiredHashToCurve;function requireHashToCurve(){if(hasRequiredHashToCurve)return hashToCurve;hasRequiredHashToCurve=1,Object.defineProperty(hashToCurve,"__esModule",{value:!0}),hashToCurve.expand_message_xmd=t,hashToCurve.expand_message_xof=o,hashToCurve.hash_to_field=h,hashToCurve.isogenyMap=b,hashToCurve.createHasher=y;const e=requireModular(),r=requireUtils$1(),u=r.bytesToNumberBE;function c(m,f){if(s(m),s(f),m<0||m>=1<<8*f)throw new Error("invalid I2OSP input: "+m);const R=Array.from({length:f}).fill(0);for(let S=f-1;S>=0;S--)R[S]=m&255,m>>>=8;return new Uint8Array(R)}function p(m,f){const R=new Uint8Array(m.length);for(let S=0;S<m.length;S++)R[S]=m[S]^f[S];return R}function s(m){if(!Number.isSafeInteger(m))throw new Error("number expected")}function t(m,f,R,S){(0,r.abytes)(m),(0,r.abytes)(f),s(R),f.length>255&&(f=S((0,r.concatBytes)((0,r.utf8ToBytes)("H2C-OVERSIZE-DST-"),f)));const{outputLen:F,blockLen:g}=S,w=Math.ceil(R/F);if(R>65535||w>255)throw new Error("expand_message_xmd: invalid lenInBytes");const B=(0,r.concatBytes)(f,c(f.length,1)),N=c(0,g),d=c(R,2),v=new Array(w),a=S((0,r.concatBytes)(N,m,d,c(0,1),B));v[0]=S((0,r.concatBytes)(a,c(1,1),B));for(let K=1;K<=w;K++){const q=[p(a,v[K-1]),c(K+1,1),B];v[K]=S((0,r.concatBytes)(...q))}return(0,r.concatBytes)(...v).slice(0,R)}function o(m,f,R,S,F){if((0,r.abytes)(m),(0,r.abytes)(f),s(R),f.length>255){const g=Math.ceil(2*S/8);f=F.create({dkLen:g}).update((0,r.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(f).digest()}if(R>65535||f.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return F.create({dkLen:R}).update(m).update(c(R,2)).update(f).update(c(f.length,1)).digest()}function h(m,f,R){(0,r.validateObject)(R,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:S,k:F,m:g,hash:w,expand:B,DST:N}=R;(0,r.abytes)(m),s(f);const d=typeof N=="string"?(0,r.utf8ToBytes)(N):N,v=S.toString(2).length,a=Math.ceil((v+F)/8),j=f*g*a;let K;if(B==="xmd")K=t(m,d,j,w);else if(B==="xof")K=o(m,d,j,F,w);else if(B==="_internal_pass")K=m;else throw new Error('expand must be "xmd" or "xof"');const q=new Array(f);for(let k=0;k<f;k++){const _=new Array(g);for(let C=0;C<g;C++){const M=a*(C+k*g),l=K.subarray(M,M+a);_[C]=(0,e.mod)(u(l),S)}q[k]=_}return q}function b(m,f){const R=f.map(S=>Array.from(S).reverse());return(S,F)=>{const[g,w,B,N]=R.map(d=>d.reduce((v,a)=>m.add(m.mul(v,S),a)));return S=m.div(g,w),F=m.mul(F,m.div(B,N)),{x:S,y:F}}}function y(m,f,R){if(typeof f!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(S,F){const g=h(S,2,{...R,DST:R.DST,...F}),w=m.fromAffine(f(g[0])),B=m.fromAffine(f(g[1])),N=w.add(B).clearCofactor();return N.assertValidity(),N},encodeToCurve(S,F){const g=h(S,1,{...R,DST:R.encodeDST,...F}),w=m.fromAffine(f(g[0])).clearCofactor();return w.assertValidity(),w},mapToCurve(S){if(!Array.isArray(S))throw new Error("mapToCurve: expected array of bigints");for(const g of S)if(typeof g!="bigint")throw new Error("mapToCurve: expected array of bigints");const F=m.fromAffine(f(S)).clearCofactor();return F.assertValidity(),F}}}return hashToCurve}var montgomery={},hasRequiredMontgomery;function requireMontgomery(){if(hasRequiredMontgomery)return montgomery;hasRequiredMontgomery=1,Object.defineProperty(montgomery,"__esModule",{value:!0}),montgomery.montgomery=s;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireModular(),r=requireUtils$1(),u=BigInt(0),c=BigInt(1);function p(t){return(0,r.validateObject)(t,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...t})}function s(t){const o=p(t),{P:h}=o,b=K=>(0,e.mod)(K,h),y=o.montgomeryBits,m=Math.ceil(y/8),f=o.nByteLength,R=o.adjustScalarBytes||(K=>K),S=o.powPminus2||(K=>(0,e.pow)(K,h-BigInt(2),h));function F(K,q,k){const _=b(K*(q-k));return q=b(q-_),k=b(k+_),[q,k]}const g=(o.a-BigInt(2))/BigInt(4);function w(K,q){(0,r.aInRange)("u",K,u,h),(0,r.aInRange)("scalar",q,u,h);const k=q,_=K;let C=c,M=u,l=K,$=c,E=u,O;for(let D=BigInt(y-1);D>=u;D--){const i=k>>D&c;E^=i,O=F(E,C,l),C=O[0],l=O[1],O=F(E,M,$),M=O[0],$=O[1],E=i;const x=C+M,T=b(x*x),W=C-M,A=b(W*W),H=T-A,re=l+$,U=l-$,P=b(U*x),V=b(re*W),X=P+V,z=P-V;l=b(X*X),$=b(_*b(z*z)),C=b(T*A),M=b(H*(T+b(g*H)))}O=F(E,C,l),C=O[0],l=O[1],O=F(E,M,$),M=O[0],$=O[1];const L=S(M);return b(C*L)}function B(K){return(0,r.numberToBytesLE)(b(K),m)}function N(K){const q=(0,r.ensureBytes)("u coordinate",K,m);return f===32&&(q[31]&=127),(0,r.bytesToNumberLE)(q)}function d(K){const q=(0,r.ensureBytes)("scalar",K),k=q.length;if(k!==m&&k!==f){let _=""+m+" or "+f;throw new Error("invalid scalar, expected "+_+" bytes, got "+k)}return(0,r.bytesToNumberLE)(R(q))}function v(K,q){const k=N(q),_=d(K),C=w(k,_);if(C===u)throw new Error("invalid private or public key received");return B(C)}const a=B(o.Gu);function j(K){return v(K,a)}return{scalarMult:v,scalarMultBase:j,getSharedSecret:(K,q)=>v(K,q),getPublicKey:K=>j(K),utils:{randomPrivateKey:()=>o.randomBytes(o.nByteLength)},GuBytes:a}}return montgomery}var hasRequiredEd25519;function requireEd25519(){return hasRequiredEd25519||(hasRequiredEd25519=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hash_to_ristretto255=e.hashToRistretto255=e.RistrettoPoint=e.encodeToCurve=e.hashToCurve=e.edwardsToMontgomery=e.x25519=e.ed25519ph=e.ed25519ctx=e.ed25519=e.ED25519_TORSION_SUBGROUP=void 0,e.edwardsToMontgomeryPub=j,e.edwardsToMontgomeryPriv=K;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=requireSha512(),u=requireUtils$2(),c=requireCurve(),p=requireEdwards(),s=requireHashToCurve(),t=requireModular(),o=requireMontgomery(),h=requireUtils$1(),b=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),y=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),m=BigInt(0),f=BigInt(1),R=BigInt(2),S=BigInt(3),F=BigInt(5),g=BigInt(8);function w(P){const V=BigInt(10),X=BigInt(20),z=BigInt(40),te=BigInt(80),ee=b,Y=P*P%ee*P%ee,Q=(0,t.pow2)(Y,R,ee)*Y%ee,ne=(0,t.pow2)(Q,f,ee)*P%ee,Z=(0,t.pow2)(ne,F,ee)*ne%ee,oe=(0,t.pow2)(Z,V,ee)*Z%ee,J=(0,t.pow2)(oe,X,ee)*oe%ee,se=(0,t.pow2)(J,z,ee)*J%ee,ie=(0,t.pow2)(se,te,ee)*se%ee,ce=(0,t.pow2)(ie,te,ee)*se%ee,ae=(0,t.pow2)(ce,V,ee)*Z%ee;return{pow_p_5_8:(0,t.pow2)(ae,R,ee)*P%ee,b2:Y}}function B(P){return P[0]&=248,P[31]&=127,P[31]|=64,P}function N(P,V){const X=b,z=(0,t.mod)(V*V*V,X),te=(0,t.mod)(z*z*V,X),ee=w(P*te).pow_p_5_8;let G=(0,t.mod)(P*z*ee,X);const Y=(0,t.mod)(V*G*G,X),Q=G,ne=(0,t.mod)(G*y,X),Z=Y===P,oe=Y===(0,t.mod)(-P,X),J=Y===(0,t.mod)(-P*y,X);return Z&&(G=Q),(oe||J)&&(G=ne),(0,t.isNegativeLE)(G,X)&&(G=(0,t.mod)(-G,X)),{isValid:Z||oe,value:G}}e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];const d=(0,t.Field)(b,void 0,!0),v={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:d,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:g,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:r.sha512,randomBytes:u.randomBytes,adjustScalarBytes:B,uvRatio:N};e.ed25519=(0,p.twistedEdwards)(v);function a(P,V,X){if(V.length>255)throw new Error("Context is too big");return(0,u.concatBytes)((0,u.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([X?1:0,V.length]),V,P)}e.ed25519ctx=(0,p.twistedEdwards)({...v,domain:a}),e.ed25519ph=(0,p.twistedEdwards)(Object.assign({},v,{domain:a,prehash:r.sha512})),e.x25519=(0,o.montgomery)({P:b,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:P=>{const V=b,{pow_p_5_8:X,b2:z}=w(P);return(0,t.mod)((0,t.pow2)(X,S,V)*z,V)},adjustScalarBytes:B,randomBytes:u.randomBytes});function j(P){const{y:V}=e.ed25519.ExtendedPoint.fromHex(P),X=BigInt(1);return d.toBytes(d.create((X+V)*d.inv(X-V)))}e.edwardsToMontgomery=j;function K(P){const V=v.hash(P.subarray(0,32));return v.adjustScalarBytes(V).subarray(0,32)}const q=(d.ORDER+S)/g,k=d.pow(R,q),_=d.sqrt(d.neg(d.ONE));function C(P){const V=(d.ORDER-F)/g,X=BigInt(486662);let z=d.sqr(P);z=d.mul(z,R);let te=d.add(z,d.ONE),ee=d.neg(X),G=d.sqr(te),Y=d.mul(G,te),Q=d.mul(z,X);Q=d.mul(Q,ee),Q=d.add(Q,G),Q=d.mul(Q,ee);let ne=d.sqr(Y);G=d.sqr(ne),ne=d.mul(ne,Y),ne=d.mul(ne,Q),G=d.mul(G,ne);let Z=d.pow(G,V);Z=d.mul(Z,ne);let oe=d.mul(Z,_);G=d.sqr(Z),G=d.mul(G,Y);let J=d.eql(G,Q),se=d.cmov(oe,Z,J),ie=d.mul(ee,z),ce=d.mul(Z,P);ce=d.mul(ce,k);let ae=d.mul(ce,_),le=d.mul(Q,z);G=d.sqr(ce),G=d.mul(G,Y);let ue=d.eql(G,le),de=d.cmov(ae,ce,ue);G=d.sqr(se),G=d.mul(G,Y);let fe=d.eql(G,Q),pe=d.cmov(ie,ee,fe),he=d.cmov(de,se,fe),ye=d.isOdd(he);return he=d.cmov(he,d.neg(he),fe!==ye),{xMn:pe,xMd:te,yMn:he,yMd:f}}const M=(0,t.FpSqrtEven)(d,d.neg(BigInt(486664)));function l(P){const{xMn:V,xMd:X,yMn:z,yMd:te}=C(P);let ee=d.mul(V,te);ee=d.mul(ee,M);let G=d.mul(X,z),Y=d.sub(V,X),Q=d.add(V,X),ne=d.mul(G,Q),Z=d.eql(ne,d.ZERO);ee=d.cmov(ee,d.ZERO,Z),G=d.cmov(G,d.ONE,Z),Y=d.cmov(Y,d.ONE,Z),Q=d.cmov(Q,d.ONE,Z);const oe=d.invertBatch([G,Q]);return{x:d.mul(ee,oe[0]),y:d.mul(Y,oe[1])}}const $=(0,s.createHasher)(e.ed25519.ExtendedPoint,P=>l(P[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:d.ORDER,m:1,k:128,expand:"xmd",hash:r.sha512});e.hashToCurve=$.hashToCurve,e.encodeToCurve=$.encodeToCurve;function E(P){if(!(P instanceof re))throw new Error("RistrettoPoint expected")}const O=y,L=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),D=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),i=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),x=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),T=P=>N(f,P),W=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),A=P=>e.ed25519.CURVE.Fp.create((0,h.bytesToNumberLE)(P)&W);function H(P){const{d:V}=e.ed25519.CURVE,X=e.ed25519.CURVE.Fp.ORDER,z=e.ed25519.CURVE.Fp.create,te=z(O*P*P),ee=z((te+f)*i);let G=BigInt(-1);const Y=z((G-V*te)*z(te+V));let{isValid:Q,value:ne}=N(ee,Y),Z=z(ne*P);(0,t.isNegativeLE)(Z,X)||(Z=z(-Z)),Q||(ne=Z),Q||(G=te);const oe=z(G*(te-f)*x-Y),J=ne*ne,se=z((ne+ne)*Y),ie=z(oe*L),ce=z(f-J),ae=z(f+J);return new e.ed25519.ExtendedPoint(z(se*ae),z(ce*ie),z(ie*ae),z(se*ce))}class re{constructor(V){this.ep=V}static fromAffine(V){return new re(e.ed25519.ExtendedPoint.fromAffine(V))}static hashToCurve(V){V=(0,h.ensureBytes)("ristrettoHash",V,64);const X=A(V.slice(0,32)),z=H(X),te=A(V.slice(32,64)),ee=H(te);return new re(z.add(ee))}static fromHex(V){V=(0,h.ensureBytes)("ristrettoHex",V,32);const{a:X,d:z}=e.ed25519.CURVE,te=e.ed25519.CURVE.Fp.ORDER,ee=e.ed25519.CURVE.Fp.create,G="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",Y=A(V);if(!(0,h.equalBytes)((0,h.numberToBytesLE)(Y,32),V)||(0,t.isNegativeLE)(Y,te))throw new Error(G);const Q=ee(Y*Y),ne=ee(f+X*Q),Z=ee(f-X*Q),oe=ee(ne*ne),J=ee(Z*Z),se=ee(X*z*oe-J),{isValid:ie,value:ce}=T(ee(se*J)),ae=ee(ce*Z),le=ee(ce*ae*se);let ue=ee((Y+Y)*ae);(0,t.isNegativeLE)(ue,te)&&(ue=ee(-ue));const de=ee(ne*le),fe=ee(ue*de);if(!ie||(0,t.isNegativeLE)(fe,te)||de===m)throw new Error(G);return new re(new e.ed25519.ExtendedPoint(ue,de,f,fe))}static msm(V,X){const z=(0,t.Field)(e.ed25519.CURVE.n,e.ed25519.CURVE.nBitLength);return(0,c.pippenger)(re,z,V,X)}toRawBytes(){let{ex:V,ey:X,ez:z,et:te}=this.ep;const ee=e.ed25519.CURVE.Fp.ORDER,G=e.ed25519.CURVE.Fp.create,Y=G(G(z+X)*G(z-X)),Q=G(V*X),ne=G(Q*Q),{value:Z}=T(G(Y*ne)),oe=G(Z*Y),J=G(Z*Q),se=G(oe*J*te);let ie;if((0,t.isNegativeLE)(te*se,ee)){let ae=G(X*O),le=G(V*O);V=ae,X=le,ie=G(oe*D)}else ie=J;(0,t.isNegativeLE)(V*se,ee)&&(X=G(-X));let ce=G((z-X)*ie);return(0,t.isNegativeLE)(ce,ee)&&(ce=G(-ce)),(0,h.numberToBytesLE)(ce,32)}toHex(){return(0,h.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(V){E(V);const{ex:X,ey:z}=this.ep,{ex:te,ey:ee}=V.ep,G=e.ed25519.CURVE.Fp.create,Y=G(X*ee)===G(z*te),Q=G(z*ee)===G(X*te);return Y||Q}add(V){return E(V),new re(this.ep.add(V.ep))}subtract(V){return E(V),new re(this.ep.subtract(V.ep))}multiply(V){return new re(this.ep.multiply(V))}multiplyUnsafe(V){return new re(this.ep.multiplyUnsafe(V))}double(){return new re(this.ep.double())}negate(){return new re(this.ep.negate())}}e.RistrettoPoint=(re.BASE||(re.BASE=new re(e.ed25519.ExtendedPoint.BASE)),re.ZERO||(re.ZERO=new re(e.ed25519.ExtendedPoint.ZERO)),re);const U=(P,V)=>{const X=V.DST,z=typeof X=="string"?(0,u.utf8ToBytes)(X):X,te=(0,s.expand_message_xmd)(P,z,64,r.sha512);return re.hashToCurve(te)};e.hashToRistretto255=U,e.hash_to_ristretto255=e.hashToRistretto255}(ed25519)),ed25519}var secp256k1={},sha256={},hasRequiredSha256;function requireSha256(){if(hasRequiredSha256)return sha256;hasRequiredSha256=1,Object.defineProperty(sha256,"__esModule",{value:!0}),sha256.sha224=sha256.sha256=sha256.SHA256=void 0;const e=require_md(),r=requireUtils$2(),u=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),c=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),p=new Uint32Array(64);class s extends e.HashMD{constructor(){super(64,32,8,!1),this.A=c[0]|0,this.B=c[1]|0,this.C=c[2]|0,this.D=c[3]|0,this.E=c[4]|0,this.F=c[5]|0,this.G=c[6]|0,this.H=c[7]|0}get(){const{A:h,B:b,C:y,D:m,E:f,F:R,G:S,H:F}=this;return[h,b,y,m,f,R,S,F]}set(h,b,y,m,f,R,S,F){this.A=h|0,this.B=b|0,this.C=y|0,this.D=m|0,this.E=f|0,this.F=R|0,this.G=S|0,this.H=F|0}process(h,b){for(let B=0;B<16;B++,b+=4)p[B]=h.getUint32(b,!1);for(let B=16;B<64;B++){const N=p[B-15],d=p[B-2],v=(0,r.rotr)(N,7)^(0,r.rotr)(N,18)^N>>>3,a=(0,r.rotr)(d,17)^(0,r.rotr)(d,19)^d>>>10;p[B]=a+p[B-7]+v+p[B-16]|0}let{A:y,B:m,C:f,D:R,E:S,F,G:g,H:w}=this;for(let B=0;B<64;B++){const N=(0,r.rotr)(S,6)^(0,r.rotr)(S,11)^(0,r.rotr)(S,25),d=w+N+(0,e.Chi)(S,F,g)+u[B]+p[B]|0,a=((0,r.rotr)(y,2)^(0,r.rotr)(y,13)^(0,r.rotr)(y,22))+(0,e.Maj)(y,m,f)|0;w=g,g=F,F=S,S=R+d|0,R=f,f=m,m=y,y=d+a|0}y=y+this.A|0,m=m+this.B|0,f=f+this.C|0,R=R+this.D|0,S=S+this.E|0,F=F+this.F|0,g=g+this.G|0,w=w+this.H|0,this.set(y,m,f,R,S,F,g,w)}roundClean(){p.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}sha256.SHA256=s;class t extends s{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}return sha256.sha256=(0,r.wrapConstructor)(()=>new s),sha256.sha224=(0,r.wrapConstructor)(()=>new t),sha256}var _shortw_utils={},hmac={},hasRequiredHmac;function requireHmac(){return hasRequiredHmac||(hasRequiredHmac=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const r=require_assert(),u=requireUtils$2();class c extends u.Hash{constructor(t,o){super(),this.finished=!1,this.destroyed=!1,(0,r.ahash)(t);const h=(0,u.toBytes)(o);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const b=this.blockLen,y=new Uint8Array(b);y.set(h.length>b?t.create().update(h).digest():h);for(let m=0;m<y.length;m++)y[m]^=54;this.iHash.update(y),this.oHash=t.create();for(let m=0;m<y.length;m++)y[m]^=106;this.oHash.update(y),y.fill(0)}update(t){return(0,r.aexists)(this),this.iHash.update(t),this}digestInto(t){(0,r.aexists)(this),(0,r.abytes)(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:o,iHash:h,finished:b,destroyed:y,blockLen:m,outputLen:f}=this;return t=t,t.finished=b,t.destroyed=y,t.blockLen=m,t.outputLen=f,t.oHash=o._cloneInto(t.oHash),t.iHash=h._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=c;const p=(s,t,o)=>new c(s,t).update(o).digest();e.hmac=p,e.hmac.create=(s,t)=>new c(s,t)}(hmac)),hmac}var weierstrass={},hasRequiredWeierstrass;function requireWeierstrass(){return hasRequiredWeierstrass||(hasRequiredWeierstrass=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=e.DERErr=void 0,e.weierstrassPoints=F,e.weierstrass=w,e.SWUFpSqrtRatio=B,e.mapToCurveSimpleSWU=N;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=requireCurve(),u=requireModular(),c=requireUtils$1(),p=requireUtils$1();function s(d){d.lowS!==void 0&&(0,p.abool)("lowS",d.lowS),d.prehash!==void 0&&(0,p.abool)("prehash",d.prehash)}function t(d){const v=(0,r.validateBasic)(d);c.validateObject(v,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:a,Fp:j,a:K}=v;if(a){if(!j.eql(K,j.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof a!="object"||typeof a.beta!="bigint"||typeof a.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...v})}const{bytesToNumberBE:o,hexToBytes:h}=c;class b extends Error{constructor(v=""){super(v)}}e.DERErr=b,e.DER={Err:b,_tlv:{encode:(d,v)=>{const{Err:a}=e.DER;if(d<0||d>256)throw new a("tlv.encode: wrong tag");if(v.length&1)throw new a("tlv.encode: unpadded data");const j=v.length/2,K=c.numberToHexUnpadded(j);if(K.length/2&128)throw new a("tlv.encode: long form length too big");const q=j>127?c.numberToHexUnpadded(K.length/2|128):"";return c.numberToHexUnpadded(d)+q+K+v},decode(d,v){const{Err:a}=e.DER;let j=0;if(d<0||d>256)throw new a("tlv.encode: wrong tag");if(v.length<2||v[j++]!==d)throw new a("tlv.decode: wrong tlv");const K=v[j++],q=!!(K&128);let k=0;if(!q)k=K;else{const C=K&127;if(!C)throw new a("tlv.decode(long): indefinite length not supported");if(C>4)throw new a("tlv.decode(long): byte length is too big");const M=v.subarray(j,j+C);if(M.length!==C)throw new a("tlv.decode: length bytes not complete");if(M[0]===0)throw new a("tlv.decode(long): zero leftmost byte");for(const l of M)k=k<<8|l;if(j+=C,k<128)throw new a("tlv.decode(long): not minimal encoding")}const _=v.subarray(j,j+k);if(_.length!==k)throw new a("tlv.decode: wrong value length");return{v:_,l:v.subarray(j+k)}}},_int:{encode(d){const{Err:v}=e.DER;if(d<y)throw new v("integer: negative integers are not allowed");let a=c.numberToHexUnpadded(d);if(Number.parseInt(a[0],16)&8&&(a="00"+a),a.length&1)throw new v("unexpected DER parsing assertion: unpadded hex");return a},decode(d){const{Err:v}=e.DER;if(d[0]&128)throw new v("invalid signature integer: negative");if(d[0]===0&&!(d[1]&128))throw new v("invalid signature integer: unnecessary leading zero");return o(d)}},toSig(d){const{Err:v,_int:a,_tlv:j}=e.DER,K=typeof d=="string"?h(d):d;c.abytes(K);const{v:q,l:k}=j.decode(48,K);if(k.length)throw new v("invalid signature: left bytes after parsing");const{v:_,l:C}=j.decode(2,q),{v:M,l}=j.decode(2,C);if(l.length)throw new v("invalid signature: left bytes after parsing");return{r:a.decode(_),s:a.decode(M)}},hexFromSig(d){const{_tlv:v,_int:a}=e.DER,j=v.encode(2,a.encode(d.r)),K=v.encode(2,a.encode(d.s)),q=j+K;return v.encode(48,q)}};const y=BigInt(0),m=BigInt(1),f=BigInt(2),R=BigInt(3),S=BigInt(4);function F(d){const v=t(d),{Fp:a}=v,j=(0,u.Field)(v.n,v.nBitLength),K=v.toBytes||((D,i,x)=>{const T=i.toAffine();return c.concatBytes(Uint8Array.from([4]),a.toBytes(T.x),a.toBytes(T.y))}),q=v.fromBytes||(D=>{const i=D.subarray(1),x=a.fromBytes(i.subarray(0,a.BYTES)),T=a.fromBytes(i.subarray(a.BYTES,2*a.BYTES));return{x,y:T}});function k(D){const{a:i,b:x}=v,T=a.sqr(D),W=a.mul(T,D);return a.add(a.add(W,a.mul(D,i)),x)}if(!a.eql(a.sqr(v.Gy),k(v.Gx)))throw new Error("bad generator point: equation left != right");function _(D){return c.inRange(D,m,v.n)}function C(D){const{allowedPrivateKeyLengths:i,nByteLength:x,wrapPrivateKey:T,n:W}=v;if(i&&typeof D!="bigint"){if(c.isBytes(D)&&(D=c.bytesToHex(D)),typeof D!="string"||!i.includes(D.length))throw new Error("invalid private key");D=D.padStart(x*2,"0")}let A;try{A=typeof D=="bigint"?D:c.bytesToNumberBE((0,p.ensureBytes)("private key",D,x))}catch{throw new Error("invalid private key, expected hex or "+x+" bytes, got "+typeof D)}return T&&(A=(0,u.mod)(A,W)),c.aInRange("private key",A,m,W),A}function M(D){if(!(D instanceof E))throw new Error("ProjectivePoint expected")}const l=(0,p.memoized)((D,i)=>{const{px:x,py:T,pz:W}=D;if(a.eql(W,a.ONE))return{x,y:T};const A=D.is0();i==null&&(i=A?a.ONE:a.inv(W));const H=a.mul(x,i),re=a.mul(T,i),U=a.mul(W,i);if(A)return{x:a.ZERO,y:a.ZERO};if(!a.eql(U,a.ONE))throw new Error("invZ was invalid");return{x:H,y:re}}),$=(0,p.memoized)(D=>{if(D.is0()){if(v.allowInfinityPoint&&!a.is0(D.py))return;throw new Error("bad point: ZERO")}const{x:i,y:x}=D.toAffine();if(!a.isValid(i)||!a.isValid(x))throw new Error("bad point: x or y not FE");const T=a.sqr(x),W=k(i);if(!a.eql(T,W))throw new Error("bad point: equation left != right");if(!D.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class E{constructor(i,x,T){if(this.px=i,this.py=x,this.pz=T,i==null||!a.isValid(i))throw new Error("x required");if(x==null||!a.isValid(x))throw new Error("y required");if(T==null||!a.isValid(T))throw new Error("z required");Object.freeze(this)}static fromAffine(i){const{x,y:T}=i||{};if(!i||!a.isValid(x)||!a.isValid(T))throw new Error("invalid affine point");if(i instanceof E)throw new Error("projective point not allowed");const W=A=>a.eql(A,a.ZERO);return W(x)&&W(T)?E.ZERO:new E(x,T,a.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(i){const x=a.invertBatch(i.map(T=>T.pz));return i.map((T,W)=>T.toAffine(x[W])).map(E.fromAffine)}static fromHex(i){const x=E.fromAffine(q((0,p.ensureBytes)("pointHex",i)));return x.assertValidity(),x}static fromPrivateKey(i){return E.BASE.multiply(C(i))}static msm(i,x){return(0,r.pippenger)(E,j,i,x)}_setWindowSize(i){L.setWindowSize(this,i)}assertValidity(){$(this)}hasEvenY(){const{y:i}=this.toAffine();if(a.isOdd)return!a.isOdd(i);throw new Error("Field doesn't support isOdd")}equals(i){M(i);const{px:x,py:T,pz:W}=this,{px:A,py:H,pz:re}=i,U=a.eql(a.mul(x,re),a.mul(A,W)),P=a.eql(a.mul(T,re),a.mul(H,W));return U&&P}negate(){return new E(this.px,a.neg(this.py),this.pz)}double(){const{a:i,b:x}=v,T=a.mul(x,R),{px:W,py:A,pz:H}=this;let re=a.ZERO,U=a.ZERO,P=a.ZERO,V=a.mul(W,W),X=a.mul(A,A),z=a.mul(H,H),te=a.mul(W,A);return te=a.add(te,te),P=a.mul(W,H),P=a.add(P,P),re=a.mul(i,P),U=a.mul(T,z),U=a.add(re,U),re=a.sub(X,U),U=a.add(X,U),U=a.mul(re,U),re=a.mul(te,re),P=a.mul(T,P),z=a.mul(i,z),te=a.sub(V,z),te=a.mul(i,te),te=a.add(te,P),P=a.add(V,V),V=a.add(P,V),V=a.add(V,z),V=a.mul(V,te),U=a.add(U,V),z=a.mul(A,H),z=a.add(z,z),V=a.mul(z,te),re=a.sub(re,V),P=a.mul(z,X),P=a.add(P,P),P=a.add(P,P),new E(re,U,P)}add(i){M(i);const{px:x,py:T,pz:W}=this,{px:A,py:H,pz:re}=i;let U=a.ZERO,P=a.ZERO,V=a.ZERO;const X=v.a,z=a.mul(v.b,R);let te=a.mul(x,A),ee=a.mul(T,H),G=a.mul(W,re),Y=a.add(x,T),Q=a.add(A,H);Y=a.mul(Y,Q),Q=a.add(te,ee),Y=a.sub(Y,Q),Q=a.add(x,W);let ne=a.add(A,re);return Q=a.mul(Q,ne),ne=a.add(te,G),Q=a.sub(Q,ne),ne=a.add(T,W),U=a.add(H,re),ne=a.mul(ne,U),U=a.add(ee,G),ne=a.sub(ne,U),V=a.mul(X,Q),U=a.mul(z,G),V=a.add(U,V),U=a.sub(ee,V),V=a.add(ee,V),P=a.mul(U,V),ee=a.add(te,te),ee=a.add(ee,te),G=a.mul(X,G),Q=a.mul(z,Q),ee=a.add(ee,G),G=a.sub(te,G),G=a.mul(X,G),Q=a.add(Q,G),te=a.mul(ee,Q),P=a.add(P,te),te=a.mul(ne,Q),U=a.mul(Y,U),U=a.sub(U,te),te=a.mul(Y,ee),V=a.mul(ne,V),V=a.add(V,te),new E(U,P,V)}subtract(i){return this.add(i.negate())}is0(){return this.equals(E.ZERO)}wNAF(i){return L.wNAFCached(this,i,E.normalizeZ)}multiplyUnsafe(i){const{endo:x,n:T}=v;c.aInRange("scalar",i,y,T);const W=E.ZERO;if(i===y)return W;if(this.is0()||i===m)return this;if(!x||L.hasPrecomputes(this))return L.wNAFCachedUnsafe(this,i,E.normalizeZ);let{k1neg:A,k1:H,k2neg:re,k2:U}=x.splitScalar(i),P=W,V=W,X=this;for(;H>y||U>y;)H&m&&(P=P.add(X)),U&m&&(V=V.add(X)),X=X.double(),H>>=m,U>>=m;return A&&(P=P.negate()),re&&(V=V.negate()),V=new E(a.mul(V.px,x.beta),V.py,V.pz),P.add(V)}multiply(i){const{endo:x,n:T}=v;c.aInRange("scalar",i,m,T);let W,A;if(x){const{k1neg:H,k1:re,k2neg:U,k2:P}=x.splitScalar(i);let{p:V,f:X}=this.wNAF(re),{p:z,f:te}=this.wNAF(P);V=L.constTimeNegate(H,V),z=L.constTimeNegate(U,z),z=new E(a.mul(z.px,x.beta),z.py,z.pz),W=V.add(z),A=X.add(te)}else{const{p:H,f:re}=this.wNAF(i);W=H,A=re}return E.normalizeZ([W,A])[0]}multiplyAndAddUnsafe(i,x,T){const W=E.BASE,A=(re,U)=>U===y||U===m||!re.equals(W)?re.multiplyUnsafe(U):re.multiply(U),H=A(this,x).add(A(i,T));return H.is0()?void 0:H}toAffine(i){return l(this,i)}isTorsionFree(){const{h:i,isTorsionFree:x}=v;if(i===m)return!0;if(x)return x(E,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:i,clearCofactor:x}=v;return i===m?this:x?x(E,this):this.multiplyUnsafe(v.h)}toRawBytes(i=!0){return(0,p.abool)("isCompressed",i),this.assertValidity(),K(E,this,i)}toHex(i=!0){return(0,p.abool)("isCompressed",i),c.bytesToHex(this.toRawBytes(i))}}E.BASE=new E(v.Gx,v.Gy,a.ONE),E.ZERO=new E(a.ZERO,a.ONE,a.ZERO);const O=v.nBitLength,L=(0,r.wNAF)(E,v.endo?Math.ceil(O/2):O);return{CURVE:v,ProjectivePoint:E,normPrivateKeyToScalar:C,weierstrassEquation:k,isWithinCurveOrder:_}}function g(d){const v=(0,r.validateBasic)(d);return c.validateObject(v,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...v})}function w(d){const v=g(d),{Fp:a,n:j}=v,K=a.BYTES+1,q=2*a.BYTES+1;function k(G){return(0,u.mod)(G,j)}function _(G){return(0,u.invert)(G,j)}const{ProjectivePoint:C,normPrivateKeyToScalar:M,weierstrassEquation:l,isWithinCurveOrder:$}=F({...v,toBytes(G,Y,Q){const ne=Y.toAffine(),Z=a.toBytes(ne.x),oe=c.concatBytes;return(0,p.abool)("isCompressed",Q),Q?oe(Uint8Array.from([Y.hasEvenY()?2:3]),Z):oe(Uint8Array.from([4]),Z,a.toBytes(ne.y))},fromBytes(G){const Y=G.length,Q=G[0],ne=G.subarray(1);if(Y===K&&(Q===2||Q===3)){const Z=c.bytesToNumberBE(ne);if(!c.inRange(Z,m,a.ORDER))throw new Error("Point is not on curve");const oe=l(Z);let J;try{J=a.sqrt(oe)}catch(ce){const ae=ce instanceof Error?": "+ce.message:"";throw new Error("Point is not on curve"+ae)}const se=(J&m)===m;return(Q&1)===1!==se&&(J=a.neg(J)),{x:Z,y:J}}else if(Y===q&&Q===4){const Z=a.fromBytes(ne.subarray(0,a.BYTES)),oe=a.fromBytes(ne.subarray(a.BYTES,2*a.BYTES));return{x:Z,y:oe}}else{const Z=K,oe=q;throw new Error("invalid Point, expected length of "+Z+", or uncompressed "+oe+", got "+Y)}}}),E=G=>c.bytesToHex(c.numberToBytesBE(G,v.nByteLength));function O(G){const Y=j>>m;return G>Y}function L(G){return O(G)?k(-G):G}const D=(G,Y,Q)=>c.bytesToNumberBE(G.slice(Y,Q));class i{constructor(Y,Q,ne){this.r=Y,this.s=Q,this.recovery=ne,this.assertValidity()}static fromCompact(Y){const Q=v.nByteLength;return Y=(0,p.ensureBytes)("compactSignature",Y,Q*2),new i(D(Y,0,Q),D(Y,Q,2*Q))}static fromDER(Y){const{r:Q,s:ne}=e.DER.toSig((0,p.ensureBytes)("DER",Y));return new i(Q,ne)}assertValidity(){c.aInRange("r",this.r,m,j),c.aInRange("s",this.s,m,j)}addRecoveryBit(Y){return new i(this.r,this.s,Y)}recoverPublicKey(Y){const{r:Q,s:ne,recovery:Z}=this,oe=re((0,p.ensureBytes)("msgHash",Y));if(Z==null||![0,1,2,3].includes(Z))throw new Error("recovery id invalid");const J=Z===2||Z===3?Q+v.n:Q;if(J>=a.ORDER)throw new Error("recovery id 2 or 3 invalid");const se=(Z&1)===0?"02":"03",ie=C.fromHex(se+E(J)),ce=_(J),ae=k(-oe*ce),le=k(ne*ce),ue=C.BASE.multiplyAndAddUnsafe(ie,ae,le);if(!ue)throw new Error("point at infinify");return ue.assertValidity(),ue}hasHighS(){return O(this.s)}normalizeS(){return this.hasHighS()?new i(this.r,k(-this.s),this.recovery):this}toDERRawBytes(){return c.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return c.hexToBytes(this.toCompactHex())}toCompactHex(){return E(this.r)+E(this.s)}}const x={isValidPrivateKey(G){try{return M(G),!0}catch{return!1}},normPrivateKeyToScalar:M,randomPrivateKey:()=>{const G=(0,u.getMinHashLength)(v.n);return(0,u.mapHashToField)(v.randomBytes(G),v.n)},precompute(G=8,Y=C.BASE){return Y._setWindowSize(G),Y.multiply(BigInt(3)),Y}};function T(G,Y=!0){return C.fromPrivateKey(G).toRawBytes(Y)}function W(G){const Y=c.isBytes(G),Q=typeof G=="string",ne=(Y||Q)&&G.length;return Y?ne===K||ne===q:Q?ne===2*K||ne===2*q:G instanceof C}function A(G,Y,Q=!0){if(W(G))throw new Error("first arg must be private key");if(!W(Y))throw new Error("second arg must be public key");return C.fromHex(Y).multiply(M(G)).toRawBytes(Q)}const H=v.bits2int||function(G){if(G.length>8192)throw new Error("input is too large");const Y=c.bytesToNumberBE(G),Q=G.length*8-v.nBitLength;return Q>0?Y>>BigInt(Q):Y},re=v.bits2int_modN||function(G){return k(H(G))},U=c.bitMask(v.nBitLength);function P(G){return c.aInRange("num < 2^"+v.nBitLength,G,y,U),c.numberToBytesBE(G,v.nByteLength)}function V(G,Y,Q=X){if(["recovered","canonical"].some(fe=>fe in Q))throw new Error("sign() legacy options not supported");const{hash:ne,randomBytes:Z}=v;let{lowS:oe,prehash:J,extraEntropy:se}=Q;oe==null&&(oe=!0),G=(0,p.ensureBytes)("msgHash",G),s(Q),J&&(G=(0,p.ensureBytes)("prehashed msgHash",ne(G)));const ie=re(G),ce=M(Y),ae=[P(ce),P(ie)];if(se!=null&&se!==!1){const fe=se===!0?Z(a.BYTES):se;ae.push((0,p.ensureBytes)("extraEntropy",fe))}const le=c.concatBytes(...ae),ue=ie;function de(fe){const pe=H(fe);if(!$(pe))return;const he=_(pe),ye=C.BASE.multiply(pe).toAffine(),ve=k(ye.x);if(ve===y)return;const ge=k(he*k(ue+ve*ce));if(ge===y)return;let me=(ye.x===ve?0:2)|Number(ye.y&m),be=ge;return oe&&O(ge)&&(be=L(ge),me^=1),new i(ve,be,me)}return{seed:le,k2sig:de}}const X={lowS:v.lowS,prehash:!1},z={lowS:v.lowS,prehash:!1};function te(G,Y,Q=X){const{seed:ne,k2sig:Z}=V(G,Y,Q),oe=v;return c.createHmacDrbg(oe.hash.outputLen,oe.nByteLength,oe.hmac)(ne,Z)}C.BASE._setWindowSize(8);function ee(G,Y,Q,ne=z){const Z=G;Y=(0,p.ensureBytes)("msgHash",Y),Q=(0,p.ensureBytes)("publicKey",Q);const{lowS:oe,prehash:J,format:se}=ne;if(s(ne),"strict"in ne)throw new Error("options.strict was renamed to lowS");if(se!==void 0&&se!=="compact"&&se!=="der")throw new Error("format must be compact or der");const ie=typeof Z=="string"||c.isBytes(Z),ce=!ie&&!se&&typeof Z=="object"&&Z!==null&&typeof Z.r=="bigint"&&typeof Z.s=="bigint";if(!ie&&!ce)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let ae,le;try{if(ce&&(ae=new i(Z.r,Z.s)),ie){try{se!=="compact"&&(ae=i.fromDER(Z))}catch(me){if(!(me instanceof e.DER.Err))throw me}!ae&&se!=="der"&&(ae=i.fromCompact(Z))}le=C.fromHex(Q)}catch{return!1}if(!ae||oe&&ae.hasHighS())return!1;J&&(Y=v.hash(Y));const{r:ue,s:de}=ae,fe=re(Y),pe=_(de),he=k(fe*pe),ye=k(ue*pe),ve=C.BASE.multiplyAndAddUnsafe(le,he,ye)?.toAffine();return ve?k(ve.x)===ue:!1}return{CURVE:v,getPublicKey:T,getSharedSecret:A,sign:te,verify:ee,ProjectivePoint:C,Signature:i,utils:x}}function B(d,v){const a=d.ORDER;let j=y;for(let L=a-m;L%f===y;L/=f)j+=m;const K=j,q=f<<K-m-m,k=q*f,_=(a-m)/k,C=(_-m)/f,M=k-m,l=q,$=d.pow(v,_),E=d.pow(v,(_+m)/f);let O=(L,D)=>{let i=$,x=d.pow(D,M),T=d.sqr(x);T=d.mul(T,D);let W=d.mul(L,T);W=d.pow(W,C),W=d.mul(W,x),x=d.mul(W,D),T=d.mul(W,L);let A=d.mul(T,x);W=d.pow(A,l);let H=d.eql(W,d.ONE);x=d.mul(T,E),W=d.mul(A,i),T=d.cmov(x,T,H),A=d.cmov(W,A,H);for(let re=K;re>m;re--){let U=re-f;U=f<<U-m;let P=d.pow(A,U);const V=d.eql(P,d.ONE);x=d.mul(T,i),i=d.mul(i,i),P=d.mul(A,i),T=d.cmov(x,T,V),A=d.cmov(P,A,V)}return{isValid:H,value:T}};if(d.ORDER%S===R){const L=(d.ORDER-R)/S,D=d.sqrt(d.neg(v));O=(i,x)=>{let T=d.sqr(x);const W=d.mul(i,x);T=d.mul(T,W);let A=d.pow(T,L);A=d.mul(A,W);const H=d.mul(A,D),re=d.mul(d.sqr(A),x),U=d.eql(re,i);let P=d.cmov(H,A,U);return{isValid:U,value:P}}}return O}function N(d,v){if((0,u.validateField)(d),!d.isValid(v.A)||!d.isValid(v.B)||!d.isValid(v.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const a=B(d,v.Z);if(!d.isOdd)throw new Error("Fp.isOdd is not implemented!");return j=>{let K,q,k,_,C,M,l,$;K=d.sqr(j),K=d.mul(K,v.Z),q=d.sqr(K),q=d.add(q,K),k=d.add(q,d.ONE),k=d.mul(k,v.B),_=d.cmov(v.Z,d.neg(q),!d.eql(q,d.ZERO)),_=d.mul(_,v.A),q=d.sqr(k),M=d.sqr(_),C=d.mul(M,v.A),q=d.add(q,C),q=d.mul(q,k),M=d.mul(M,_),C=d.mul(M,v.B),q=d.add(q,C),l=d.mul(K,k);const{isValid:E,value:O}=a(q,M);$=d.mul(K,j),$=d.mul($,O),l=d.cmov(l,k,E),$=d.cmov($,O,E);const L=d.isOdd(j)===d.isOdd($);return $=d.cmov(d.neg($),$,L),l=d.div(l,_),{x:l,y:$}}}}(weierstrass)),weierstrass}var hasRequired_shortw_utils;function require_shortw_utils(){if(hasRequired_shortw_utils)return _shortw_utils;hasRequired_shortw_utils=1,Object.defineProperty(_shortw_utils,"__esModule",{value:!0}),_shortw_utils.getHash=c,_shortw_utils.createCurve=p;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireHmac(),r=requireUtils$2(),u=requireWeierstrass();function c(s){return{hash:s,hmac:(t,...o)=>(0,e.hmac)(s,t,(0,r.concatBytes)(...o)),randomBytes:r.randomBytes}}function p(s,t){const o=h=>(0,u.weierstrass)({...s,...c(h)});return{...o(t),create:o}}return _shortw_utils}var hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1||(hasRequiredSecp256k1=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=requireSha256(),u=requireUtils$2(),c=require_shortw_utils(),p=requireHashToCurve(),s=requireModular(),t=requireUtils$1(),o=requireWeierstrass(),h=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),b=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),y=BigInt(1),m=BigInt(2),f=(L,D)=>(L+D/m)/D;function R(L){const D=h,i=BigInt(3),x=BigInt(6),T=BigInt(11),W=BigInt(22),A=BigInt(23),H=BigInt(44),re=BigInt(88),U=L*L*L%D,P=U*U*L%D,V=(0,s.pow2)(P,i,D)*P%D,X=(0,s.pow2)(V,i,D)*P%D,z=(0,s.pow2)(X,m,D)*U%D,te=(0,s.pow2)(z,T,D)*z%D,ee=(0,s.pow2)(te,W,D)*te%D,G=(0,s.pow2)(ee,H,D)*ee%D,Y=(0,s.pow2)(G,re,D)*G%D,Q=(0,s.pow2)(Y,H,D)*ee%D,ne=(0,s.pow2)(Q,i,D)*P%D,Z=(0,s.pow2)(ne,A,D)*te%D,oe=(0,s.pow2)(Z,x,D)*U%D,J=(0,s.pow2)(oe,m,D);if(!S.eql(S.sqr(J),L))throw new Error("Cannot find square root");return J}const S=(0,s.Field)(h,void 0,void 0,{sqrt:R});e.secp256k1=(0,c.createCurve)({a:BigInt(0),b:BigInt(7),Fp:S,n:b,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:L=>{const D=b,i=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),x=-y*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),T=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),W=i,A=BigInt("0x100000000000000000000000000000000"),H=f(W*L,D),re=f(-x*L,D);let U=(0,s.mod)(L-H*i-re*T,D),P=(0,s.mod)(-H*x-re*W,D);const V=U>A,X=P>A;if(V&&(U=D-U),X&&(P=D-P),U>A||P>A)throw new Error("splitScalar: Endomorphism failed, k="+L);return{k1neg:V,k1:U,k2neg:X,k2:P}}}},r.sha256);const F=BigInt(0),g={};function w(L,...D){let i=g[L];if(i===void 0){const x=(0,r.sha256)(Uint8Array.from(L,T=>T.charCodeAt(0)));i=(0,t.concatBytes)(x,x),g[L]=i}return(0,r.sha256)((0,t.concatBytes)(i,...D))}const B=L=>L.toRawBytes(!0).slice(1),N=L=>(0,t.numberToBytesBE)(L,32),d=L=>(0,s.mod)(L,h),v=L=>(0,s.mod)(L,b),a=e.secp256k1.ProjectivePoint,j=(L,D,i)=>a.BASE.multiplyAndAddUnsafe(L,D,i);function K(L){let D=e.secp256k1.utils.normPrivateKeyToScalar(L),i=a.fromPrivateKey(D);return{scalar:i.hasEvenY()?D:v(-D),bytes:B(i)}}function q(L){(0,t.aInRange)("x",L,y,h);const D=d(L*L),i=d(D*L+BigInt(7));let x=R(i);x%m!==F&&(x=d(-x));const T=new a(L,x,y);return T.assertValidity(),T}const k=t.bytesToNumberBE;function _(...L){return v(k(w("BIP0340/challenge",...L)))}function C(L){return K(L).bytes}function M(L,D,i=(0,u.randomBytes)(32)){const x=(0,t.ensureBytes)("message",L),{bytes:T,scalar:W}=K(D),A=(0,t.ensureBytes)("auxRand",i,32),H=N(W^k(w("BIP0340/aux",A))),re=w("BIP0340/nonce",H,T,x),U=v(k(re));if(U===F)throw new Error("sign failed: k is zero");const{bytes:P,scalar:V}=K(U),X=_(P,T,x),z=new Uint8Array(64);if(z.set(P,0),z.set(N(v(V+X*W)),32),!l(z,x,T))throw new Error("sign: Invalid signature produced");return z}function l(L,D,i){const x=(0,t.ensureBytes)("signature",L,64),T=(0,t.ensureBytes)("message",D),W=(0,t.ensureBytes)("publicKey",i,32);try{const A=q(k(W)),H=k(x.subarray(0,32));if(!(0,t.inRange)(H,y,h))return!1;const re=k(x.subarray(32,64));if(!(0,t.inRange)(re,y,b))return!1;const U=_(N(H),B(A),T),P=j(A,re,v(-U));return!(!P||!P.hasEvenY()||P.toAffine().x!==H)}catch{return!1}}e.schnorr={getPublicKey:C,sign:M,verify:l,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:q,pointToBytes:B,numberToBytesBE:t.numberToBytesBE,bytesToNumberBE:t.bytesToNumberBE,taggedHash:w,mod:s.mod}};const $=(0,p.isogenyMap)(S,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(L=>L.map(D=>BigInt(D)))),E=(0,o.mapToCurveSimpleSWU)(S,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:S.create(BigInt("-11"))}),O=(0,p.createHasher)(e.secp256k1.ProjectivePoint,L=>{const{x:D,y:i}=E(S.create(L[0]));return $(D,i)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:S.ORDER,m:1,k:128,expand:"xmd",hash:r.sha256});e.hashToCurve=O.hashToCurve,e.encodeToCurve=O.encodeToCurve}(secp256k1)),secp256k1}var hex={},hasRequiredHex;function requireHex(){return hasRequiredHex||(hasRequiredHex=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0;var r=requireUtils$3(),u=function(p){return p.startsWith("0x")||p.startsWith("0X")?p.slice(2):p};e.remove0x=u;var c=function(p){return(0,r.hexToBytes)((0,e.remove0x)(p))};e.decodeHex=c}(hex)),hex}var hasRequiredElliptic;function requireElliptic(){return hasRequiredElliptic||(hasRequiredElliptic=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0;var r=requireWebcrypto(),u=requireEd25519(),c=requireSecp256k1(),p=requireConfig$1(),s=requireConsts(),t=requireHex(),o=function(){var g;do g=(0,r.randomBytes)(s.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(g));return g};e.getValidSecret=o;var h=function(g){return R((0,p.ellipticCurve)(),function(w){return w.utils.isValidPrivateKey(g)},function(){return!0},function(){return!0})};e.isValidPrivateKey=h;var b=function(g){return R((0,p.ellipticCurve)(),function(w){return w.getPublicKey(g)},function(w){return w.getPublicKey(g)},function(w){return w.getPublicKey(g)})};e.getPublicKey=b;var y=function(g,w,B){return R((0,p.ellipticCurve)(),function(N){return N.getSharedSecret(g,w,B)},function(N){return N.getSharedSecret(g,w)},function(N){return F(N,g,w)})};e.getSharedPoint=y;var m=function(g,w){return R((0,p.ellipticCurve)(),function(B){return B.getSharedSecret(BigInt(1),g,w)},function(){return g},function(){return g})};e.convertPublicKeyFormat=m;var f=function(g){var w=(0,t.decodeHex)(g);return R((0,p.ellipticCurve)(),function(){return S(w)},function(){return w},function(){return w})};e.hexToPublicKey=f;function R(g,w,B,N){if(g==="secp256k1")return w(c.secp256k1);if(g==="x25519")return B(u.x25519);if(g==="ed25519")return N(u.ed25519);throw new Error("Not implemented")}var S=function(g){if(g.length===s.ETH_PUBLIC_KEY_SIZE){var w=new Uint8Array(1+g.length);return w.set([4]),w.set(g,1),w}return g},F=function(g,w,B){var N=g.utils.getExtendedPublicKey(w).scalar,d=g.ExtendedPoint.fromHex(B).multiply(N);return d.toRawBytes()}}(elliptic)),elliptic}var hash={},hkdf={},hasRequiredHkdf;function requireHkdf(){if(hasRequiredHkdf)return hkdf;hasRequiredHkdf=1,Object.defineProperty(hkdf,"__esModule",{value:!0}),hkdf.hkdf=void 0,hkdf.extract=c,hkdf.expand=t;const e=require_assert(),r=requireHmac(),u=requireUtils$2();function c(h,b,y){return(0,e.ahash)(h),y===void 0&&(y=new Uint8Array(h.outputLen)),(0,r.hmac)(h,(0,u.toBytes)(y),(0,u.toBytes)(b))}const p=new Uint8Array([0]),s=new Uint8Array;function t(h,b,y,m=32){if((0,e.ahash)(h),(0,e.anumber)(m),m>255*h.outputLen)throw new Error("Length should be <= 255*HashLen");const f=Math.ceil(m/h.outputLen);y===void 0&&(y=s);const R=new Uint8Array(f*h.outputLen),S=r.hmac.create(h,b),F=S._cloneInto(),g=new Uint8Array(S.outputLen);for(let w=0;w<f;w++)p[0]=w+1,F.update(w===0?s:g).update(y).update(p).digestInto(g),R.set(g,h.outputLen*w),S._cloneInto(F);return S.destroy(),F.destroy(),g.fill(0),p.fill(0),R.slice(0,m)}const o=(h,b,y,m,f)=>t(h,c(h,b,y),m,f);return hkdf.hkdf=o,hkdf}var hasRequiredHash;function requireHash(){return hasRequiredHash||(hasRequiredHash=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0;var r=requireUtils$3(),u=requireHkdf(),c=requireSha256(),p=function(t,o,h){return(0,u.hkdf)(c.sha256,t,o,h,32)};e.deriveKey=p;var s=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return(0,e.deriveKey)(r.concatBytes.apply(void 0,t))};e.getSharedKey=s}(hash)),hash}var symmetric={},node$1={},compat={},hasRequiredCompat;function requireCompat(){if(hasRequiredCompat)return compat;hasRequiredCompat=1,Object.defineProperty(compat,"__esModule",{value:!0}),compat._compat=void 0;var e=requireUtils$3(),r=require$$1__default,u=16,c=globalThis.Deno!==void 0,p=function(s,t,o,h){var b=s==="aes-256-gcm"||s==="chacha20-poly1305",y=b?u:0,m=b?{authTagLength:y}:void 0,f=function(S){var F=(0,r.createCipheriv)(s,t,o,m);b&&h!==void 0&&F.setAAD(h);var g=F.update(S),w=F.final(),B=b?F.getAuthTag():new Uint8Array(0);return(0,e.concatBytes)(g,w,B)},R=function(S){var F=S.subarray(0,S.length-y),g=S.subarray(S.length-y),w=(0,r.createDecipheriv)(s,t,o,m);b&&(h!==void 0&&w.setAAD(h),w.setAuthTag(g)),!b&&c&&w.setAutoPadding(!1);var B=w.update(F),N=w.final();return(0,e.concatBytes)(B,N)};return{encrypt:f,decrypt:R}};return compat._compat=p,compat}var hasRequiredNode$1;function requireNode$1(){if(hasRequiredNode$1)return node$1;hasRequiredNode$1=1,Object.defineProperty(node$1,"__esModule",{value:!0}),node$1.aes256cbc=node$1.aes256gcm=void 0;var e=requireCompat(),r=function(c,p,s){return(0,e._compat)("aes-256-gcm",c,p,s)};node$1.aes256gcm=r;var u=function(c,p,s){return(0,e._compat)("aes-256-cbc",c,p)};return node$1.aes256cbc=u,node$1}var node={},hchacha={},hasRequiredHchacha;function requireHchacha(){if(hasRequiredHchacha)return hchacha;hasRequiredHchacha=1,Object.defineProperty(hchacha,"__esModule",{value:!0}),hchacha._hchacha20=void 0;var e=function(u,c,p,s){for(var t=u[0],o=u[1],h=u[2],b=u[3],y=c[0],m=c[1],f=c[2],R=c[3],S=c[4],F=c[5],g=c[6],w=c[7],B=p[0],N=p[1],d=p[2],v=p[3],a=0;a<20;a+=2)t=t+y|0,B=r(B^t,16),S=S+B|0,y=r(y^S,12),t=t+y|0,B=r(B^t,8),S=S+B|0,y=r(y^S,7),o=o+m|0,N=r(N^o,16),F=F+N|0,m=r(m^F,12),o=o+m|0,N=r(N^o,8),F=F+N|0,m=r(m^F,7),h=h+f|0,d=r(d^h,16),g=g+d|0,f=r(f^g,12),h=h+f|0,d=r(d^h,8),g=g+d|0,f=r(f^g,7),b=b+R|0,v=r(v^b,16),w=w+v|0,R=r(R^w,12),b=b+R|0,v=r(v^b,8),w=w+v|0,R=r(R^w,7),t=t+m|0,v=r(v^t,16),g=g+v|0,m=r(m^g,12),t=t+m|0,v=r(v^t,8),g=g+v|0,m=r(m^g,7),o=o+f|0,B=r(B^o,16),w=w+B|0,f=r(f^w,12),o=o+f|0,B=r(B^o,8),w=w+B|0,f=r(f^w,7),h=h+R|0,N=r(N^h,16),S=S+N|0,R=r(R^S,12),h=h+R|0,N=r(N^h,8),S=S+N|0,R=r(R^S,7),b=b+y|0,d=r(d^b,16),F=F+d|0,y=r(y^F,12),b=b+y|0,d=r(d^b,8),F=F+d|0,y=r(y^F,7);var j=0;s[j++]=t,s[j++]=o,s[j++]=h,s[j++]=b,s[j++]=B,s[j++]=N,s[j++]=d,s[j++]=v};hchacha._hchacha20=e;var r=function(u,c){return u<<c|u>>>32-c};return hchacha}var hasRequiredNode;function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1,Object.defineProperty(node,"__esModule",{value:!0}),node.chacha20=node.xchacha20=void 0;var e=requireUtils$3(),r=requireCompat(),u=requireHchacha(),c=function(s,t,o){if(t.length!==24)throw new Error("xchacha20's nonce must be 24 bytes");var h=new Uint32Array([1634760805,857760878,2036477234,1797285236]),b=new Uint32Array(8);(0,u._hchacha20)(h,(0,e.u32)(s),(0,e.u32)(t.subarray(0,16)),b);var y=new Uint8Array(12);return y.set([0,0,0,0]),y.set(t.subarray(16),4),(0,r._compat)("chacha20-poly1305",(0,e.u8)(b),y,o)};node.xchacha20=c;var p=function(s,t,o){if(t.length!==12)throw new Error("chacha20's nonce must be 12 bytes");return(0,r._compat)("chacha20-poly1305",s,t,o)};return node.chacha20=p,node}var hasRequiredSymmetric;function requireSymmetric(){return hasRequiredSymmetric||(hasRequiredSymmetric=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var r=requireUtils$3(),u=requireWebcrypto(),c=requireNode$1(),p=requireNode(),s=requireConfig$1(),t=requireConsts(),o=function(f,R,S){return b(y,f,R,S)};e.symEncrypt=o;var h=function(f,R,S){return b(m,f,R,S)};e.symDecrypt=h,e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt;function b(f,R,S,F){var g=(0,s.symmetricAlgorithm)();if(g==="aes-256-gcm")return f(c.aes256gcm,R,S,(0,s.symmetricNonceLength)(),t.AEAD_TAG_LENGTH,F);if(g==="xchacha20")return f(p.xchacha20,R,S,t.XCHACHA20_NONCE_LENGTH,t.AEAD_TAG_LENGTH,F);if(g==="aes-256-cbc")return f(c.aes256cbc,R,S,16,0);throw new Error("Not implemented")}function y(f,R,S,F,g,w){var B=(0,u.randomBytes)(F),N=f(R,B,w),d=N.encrypt(S);if(g===0)return(0,r.concatBytes)(B,d);var v=d.length-g,a=d.subarray(0,v),j=d.subarray(v);return(0,r.concatBytes)(B,j,a)}function m(f,R,S,F,g,w){var B=S.subarray(0,F),N=f(R,Uint8Array.from(B),w),d=S.subarray(F);if(g===0)return N.decrypt(d);var v=d.subarray(0,g),a=d.subarray(g);return N.decrypt((0,r.concatBytes)(a,v))}}(symmetric)),symmetric}var hasRequiredUtils;function requireUtils(){return hasRequiredUtils||(hasRequiredUtils=1,function(e){var r=utils$2&&utils$2.__createBinding||(Object.create?function(c,p,s,t){t===void 0&&(t=s);var o=Object.getOwnPropertyDescriptor(p,s);(!o||("get"in o?!p.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return p[s]}}),Object.defineProperty(c,t,o)}:function(c,p,s,t){t===void 0&&(t=s),c[t]=p[s]}),u=utils$2&&utils$2.__exportStar||function(c,p){for(var s in c)s!=="default"&&!Object.prototype.hasOwnProperty.call(p,s)&&r(p,c,s)};Object.defineProperty(e,"__esModule",{value:!0}),u(requireElliptic(),e),u(requireHash(),e),u(requireHex(),e),u(requireSymmetric(),e)}(utils$2)),utils$2}var PublicKey={},hasRequiredPublicKey;function requirePublicKey(){if(hasRequiredPublicKey)return PublicKey;hasRequiredPublicKey=1,Object.defineProperty(PublicKey,"__esModule",{value:!0}),PublicKey.PublicKey=void 0;var e=requireUtils$3(),r=requireUtils(),u=function(){function c(p){var s=(0,r.convertPublicKeyFormat)(p,!0),t=(0,r.convertPublicKeyFormat)(p,!1);this.data=s,this.dataUncompressed=s.length!==t.length?t:null}return c.fromHex=function(p){return new c((0,r.hexToPublicKey)(p))},Object.defineProperty(c.prototype,"_uncompressed",{get:function(){return this.dataUncompressed!==null?this.dataUncompressed:this.data},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"uncompressed",{get:function(){return Buffer.from(this._uncompressed)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"compressed",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),c.prototype.toBytes=function(p){return p===void 0&&(p=!0),p?this.data:this._uncompressed},c.prototype.toHex=function(p){return p===void 0&&(p=!0),(0,e.bytesToHex)(this.toBytes(p))},c.prototype.decapsulate=function(p,s){s===void 0&&(s=!1);var t=this.toBytes(s),o=p.multiply(this,s);return(0,r.getSharedKey)(t,o)},c.prototype.equals=function(p){return(0,e.equalBytes)(this.data,p.data)},c}();return PublicKey.PublicKey=u,PublicKey}var hasRequiredPrivateKey;function requirePrivateKey(){if(hasRequiredPrivateKey)return PrivateKey;hasRequiredPrivateKey=1,Object.defineProperty(PrivateKey,"__esModule",{value:!0}),PrivateKey.PrivateKey=void 0;var e=requireUtils$3(),r=requireUtils(),u=requirePublicKey(),c=function(){function p(s){if(s===void 0)this.data=(0,r.getValidSecret)();else if((0,r.isValidPrivateKey)(s))this.data=s;else throw new Error("Invalid private key");this.publicKey=new u.PublicKey((0,r.getPublicKey)(this.data))}return p.fromHex=function(s){return new p((0,r.decodeHex)(s))},Object.defineProperty(p.prototype,"secret",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),p.prototype.toHex=function(){return(0,e.bytesToHex)(this.data)},p.prototype.encapsulate=function(s,t){t===void 0&&(t=!1);var o=this.publicKey.toBytes(t),h=this.multiply(s,t);return(0,r.getSharedKey)(o,h)},p.prototype.multiply=function(s,t){return t===void 0&&(t=!1),(0,r.getSharedPoint)(this.data,s.toBytes(!0),t)},p.prototype.equals=function(s){return(0,e.equalBytes)(this.data,s.data)},p}();return PrivateKey.PrivateKey=c,PrivateKey}var hasRequiredKeys;function requireKeys(){return hasRequiredKeys||(hasRequiredKeys=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var r=requirePrivateKey();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return r.PrivateKey}});var u=requirePublicKey();Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return u.PublicKey}})}(keys)),keys}var hasRequiredDist;function requireDist(){return hasRequiredDist||(hasRequiredDist=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=s,e.decrypt=o;var r=requireUtils$3(),u=requireConfig$1(),c=requireKeys(),p=requireUtils();function s(m,f){return Buffer.from(t(m,f))}function t(m,f){var R=new c.PrivateKey,S=m instanceof Uint8Array?new c.PublicKey(m):c.PublicKey.fromHex(m),F=R.encapsulate(S,(0,u.isHkdfKeyCompressed)()),g=R.publicKey.toBytes((0,u.isEphemeralKeyCompressed)()),w=(0,p.symEncrypt)(F,f);return(0,r.concatBytes)(g,w)}function o(m,f){return Buffer.from(h(m,f))}function h(m,f){var R=m instanceof Uint8Array?new c.PrivateKey(m):c.PrivateKey.fromHex(m),S=(0,u.ephemeralKeySize)(),F=new c.PublicKey(f.subarray(0,S)),g=f.subarray(S),w=F.decapsulate(R,(0,u.isHkdfKeyCompressed)());return(0,p.symDecrypt)(w,g)}var b=requireConfig$1();Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return b.ECIES_CONFIG}});var y=requireKeys();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return y.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return y.PublicKey}}),e.utils={aesEncrypt:p.aesEncrypt,aesDecrypt:p.aesDecrypt,symEncrypt:p.symEncrypt,symDecrypt:p.symDecrypt,decodeHex:p.decodeHex,getValidSecret:p.getValidSecret,remove0x:p.remove0x}}(dist)),dist}var truncate_1,hasRequiredTruncate;function requireTruncate(){if(hasRequiredTruncate)return truncate_1;hasRequiredTruncate=1;function e(r,u=7){return r&&r.length>0?r.slice(0,u)+"\u2026":""}return truncate_1=e,truncate_1}var errors,hasRequiredErrors;function requireErrors(){if(hasRequiredErrors)return errors;hasRequiredErrors=1;const e=requireTruncate();class r{constructor(c={}){this.filepath=c.filepath,this.envFilepath=c.envFilepath,this.key=c.key,this.privateKey=c.privateKey,this.privateKeyName=c.privateKeyName,this.command=c.command,this.message=c.message}missingEnvFile(){const c="MISSING_ENV_FILE",p=`[${c}] missing ${this.envFilepath} file (${this.filepath})`,s=`[${c}] https://github.com/dotenvx/dotenvx/issues/484`,t=new Error(p);return t.code=c,t.help=s,t}missingKey(){const c="MISSING_KEY",p=`[${c}] missing ${this.key} key`,s=new Error(p);return s.code=c,s}missingPrivateKey(){const c="MISSING_PRIVATE_KEY",p=`[${c}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,s=`[${c}] https://github.com/dotenvx/dotenvx/issues/464`,t=new Error(p);return t.code=c,t.help=s,t}invalidPrivateKey(){const c="INVALID_PRIVATE_KEY",p=`[${c}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,s=`[${c}] https://github.com/dotenvx/dotenvx/issues/465`,t=new Error(p);return t.code=c,t.help=s,t}looksWrongPrivateKey(){const c="WRONG_PRIVATE_KEY",p=`[${c}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,s=`[${c}] https://github.com/dotenvx/dotenvx/issues/466`,t=new Error(p);return t.code=c,t.help=s,t}malformedEncryptedData(){const c="MALFORMED_ENCRYPTED_DATA",p=`[${c}] could not decrypt ${this.key} because encrypted data appears malformed`,s=`[${c}] https://github.com/dotenvx/dotenvx/issues/467`,t=new Error(p);return t.code=c,t.help=s,t}decryptionFailed(){const c="DECRYPTION_FAILED",p=this.message,s=new Error(p);return s.code=c,s}commandSubstitutionFailed(){const c="COMMAND_SUBSTITUTION_FAILED",p=`[${c}] could not eval ${this.key} containing command '${this.command}': ${this.message}`,s=`[${c}] https://github.com/dotenvx/dotenvx/issues/532`,t=new Error(p);return t.code=c,t.help=s,t}}return errors=r,errors}var decryptKeyValue_1,hasRequiredDecryptKeyValue;function requireDecryptKeyValue(){if(hasRequiredDecryptKeyValue)return decryptKeyValue_1;hasRequiredDecryptKeyValue=1;const{decrypt:e}=requireDist(),r=requireErrors(),u="encrypted:";function c(p,s,t,o){let h,b;if(!s.startsWith(u))return s;if(o=o||"",o.length<=0)b=new r({key:p,privateKeyName:t,privateKey:o}).missingPrivateKey();else{const y=o.split(",");for(const m of y){const f=Buffer.from(m,"hex"),R=s.substring(u.length),S=Buffer.from(R,"base64");try{h=e(f,S).toString(),b=null;break}catch(F){F.message==="Invalid private key"?b=new r({key:p,privateKeyName:t,privateKey:o}).invalidPrivateKey():F.message==="Unsupported state or unable to authenticate data"?b=new r({key:p,privateKeyName:t,privateKey:o}).looksWrongPrivateKey():F.message==="Point of length 65 was invalid. Expected 33 compressed bytes or 65 uncompressed bytes"?b=new r({key:p,privateKeyName:t,privateKey:o}).malformedEncryptedData():b=new r({key:p,privateKeyName:t,privateKey:o,message:F.message}).decryptionFailed()}}}if(b)throw b;return h}return decryptKeyValue_1=c,decryptKeyValue_1}var chomp_1,hasRequiredChomp;function requireChomp(){if(hasRequiredChomp)return chomp_1;hasRequiredChomp=1;function e(r){return r.replace(/[\r\n]+$/,"")}return chomp_1=e,chomp_1}var evalKeyValue_1,hasRequiredEvalKeyValue;function requireEvalKeyValue(){if(hasRequiredEvalKeyValue)return evalKeyValue_1;hasRequiredEvalKeyValue=1;const{execSync:e}=require$$0__default$3,r=requireChomp(),u=requireErrors();function c(p,s,t,o){return(s.match(/\$\(([^)]+(?:\)[^(]*)*)\)/g)||[]).reduce((b,y)=>{const m=y.slice(2,-1);let f;try{f=e(m,{env:{...t,...o}}).toString()}catch(R){throw new u({key:p,command:m,message:R.message.trim()}).commandSubstitutionFailed()}return f=r(f),b.replace(y,f)},s)}return evalKeyValue_1=c,evalKeyValue_1}var resolveEscapeSequences_1,hasRequiredResolveEscapeSequences;function requireResolveEscapeSequences(){if(hasRequiredResolveEscapeSequences)return resolveEscapeSequences_1;hasRequiredResolveEscapeSequences=1;function e(r){return r.replace(/\\\$/g,"$")}return resolveEscapeSequences_1=e,resolveEscapeSequences_1}var parse,hasRequiredParse;function requireParse(){if(hasRequiredParse)return parse;hasRequiredParse=1;const e=requireDecryptKeyValue(),r=requireEvalKeyValue(),u=requireResolveEscapeSequences();class c{static LINE=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;constructor(s,t=null,o=process.env,h=!1,b=null){this.src=s,this.privateKey=t,this.privateKeyName=b,this.processEnv=o,this.overload=h,this.parsed={},this.preExisted={},this.injected={},this.errors=[],this.runningParsed={},this.literals={}}run(){const s=this.getLines();let t;for(;(t=c.LINE.exec(s))!==null;){const o=t[1],h=t[2],b=this.quote(h);this.parsed[o]=this.clean(h,b),!this.overload&&this.inProcessEnv(o)&&(this.parsed[o]=this.processEnv[o]);try{this.parsed[o]=this.decrypt(o,this.parsed[o])}catch(m){this.errors.push(m)}let y=!1;if(b!=="'"&&(!this.inProcessEnv(o)||this.processEnv[o]===this.parsed[o])){const m=this.parsed[o];try{this.parsed[o]=this.eval(o,m)}catch(f){this.errors.push(f)}m!==this.parsed[o]&&(y=!0)}!y&&b!=="'"&&(!this.processEnv[o]||this.overload)&&(this.parsed[o]=u(this.expand(this.parsed[o]))),b==="'"&&(this.literals[o]=this.parsed[o]),this.runningParsed[o]=this.parsed[o],Object.prototype.hasOwnProperty.call(this.processEnv,o)&&!this.overload?this.preExisted[o]=this.processEnv[o]:this.injected[o]=this.parsed[o]}return{parsed:this.parsed,processEnv:this.processEnv,injected:this.injected,preExisted:this.preExisted,errors:this.errors}}trimmer(s){return(s||"").trim()}quote(s){const o=this.trimmer(s)[0];let h="";switch(o){case"'":h="'";break;case'"':h='"';break;case"`":h="`";break;default:h=""}return h}clean(s,t){let o=this.trimmer(s);return o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),t==='"'&&(o=o.replace(/\\n/g,`
|
|
5
|
-
`),
|
|
6
|
-
`)}}return parse=
|
|
7
|
-
`));let
|
|
8
|
-
`),b=b.replace(/\\r/g,"\r"),b=b.replace(/\\t/g," ")),s[h]=b}return s}return dotenvParse_1=r,dotenvParse_1}var parseEnvironmentFromDotenvKey_1,hasRequiredParseEnvironmentFromDotenvKey;function requireParseEnvironmentFromDotenvKey(){if(hasRequiredParseEnvironmentFromDotenvKey)return parseEnvironmentFromDotenvKey_1;hasRequiredParseEnvironmentFromDotenvKey=1;function e(r){let u;try{u=new URL(r)}catch(p){throw new Error(`INVALID_DOTENV_KEY: ${p.message}`)}const c=u.searchParams.get("environment");if(!c)throw new Error("INVALID_DOTENV_KEY: Missing environment part");return c}return parseEnvironmentFromDotenvKey_1=e,parseEnvironmentFromDotenvKey_1}var detectEncoding_1,hasRequiredDetectEncoding;function requireDetectEncoding(){if(hasRequiredDetectEncoding)return detectEncoding_1;hasRequiredDetectEncoding=1;const e=require$$0__default;function r(u){const c=e.readFileSync(u);return c.length>=2&&c[0]===255&&c[1]===254?"utf16le":(c.length>=3&&c[0]===239&&c[1]===187&&c[2]===191,"utf8")}return detectEncoding_1=r,detectEncoding_1}var guessEnvironment_1,hasRequiredGuessEnvironment;function requireGuessEnvironment(){if(hasRequiredGuessEnvironment)return guessEnvironment_1;hasRequiredGuessEnvironment=1;const e=require$$0__default$1;function r(u){const c=e.basename(u),s=[...c.split(".").slice(2)];return s.length===0?c.replace(".env","development"):s.length===1?s[0]:s.length===2?s.join("_"):s.slice(0,2).join("_")}return guessEnvironment_1=r,guessEnvironment_1}var guessPrivateKeyName_1,hasRequiredGuessPrivateKeyName;function requireGuessPrivateKeyName(){if(hasRequiredGuessPrivateKeyName)return guessPrivateKeyName_1;hasRequiredGuessPrivateKeyName=1;const e=require$$0__default$1,r=requireGuessEnvironment();function u(c){const p=e.basename(c).toLowerCase();return p===".env"?"DOTENV_PRIVATE_KEY":`DOTENV_PRIVATE_KEY_${r(p).toUpperCase()}`}return guessPrivateKeyName_1=u,guessPrivateKeyName_1}function commonjsRequire(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var guessPublicKeyName_1,hasRequiredGuessPublicKeyName;function requireGuessPublicKeyName(){if(hasRequiredGuessPublicKeyName)return guessPublicKeyName_1;hasRequiredGuessPublicKeyName=1;const e=require$$0__default$1,r=requireGuessEnvironment();function u(c){const p=e.basename(c).toLowerCase();return p===".env"?"DOTENV_PUBLIC_KEY":`DOTENV_PUBLIC_KEY_${r(p).toUpperCase()}`}return guessPublicKeyName_1=u,guessPublicKeyName_1}var proKeypair,hasRequiredProKeypair;function requireProKeypair(){if(hasRequiredProKeypair)return proKeypair;hasRequiredProKeypair=1;const e=require$$0__default$1,r=require$$0__default$3,u=requireGuessPrivateKeyName(),c=requireGuessPublicKeyName();class p{constructor(t){this.envFilepath=t}run(){let t={};try{const o=e.resolve(process.cwd()),h=require.resolve("@dotenvx/dotenvx-pro",{paths:[o]}),{keypair:b}=commonjsRequire(h);t=b(this.envFilepath)}catch{try{const h=r.execSync(`dotenvx-pro keypair -f ${this.envFilepath}`,{stdio:["pipe","pipe","ignore"]}).toString().trim();t=JSON.parse(h)}catch{const b=u(this.envFilepath),y=c(this.envFilepath);t[b]=null,t[y]=null}}return t}}return proKeypair=p,proKeypair}var smartDotenvPublicKey_1,hasRequiredSmartDotenvPublicKey;function requireSmartDotenvPublicKey(){if(hasRequiredSmartDotenvPublicKey)return smartDotenvPublicKey_1;hasRequiredSmartDotenvPublicKey=1;const e=requireFsx(),r=requireDotenvParse(),u=requireGuessPublicKeyName();function c(t){if(process.env[t]&&process.env[t].length>0)return process.env[t]}function p(t,o){if(e.existsSync(o)){const h=e.readFileX(o),b=r(h);if(b[t]&&b[t].length>0)return b[t]}}function s(t){let o=null;const h=u(t);return o=c(h),o||(o=p(h,t),o)?o:null}return smartDotenvPublicKey_1=s,smartDotenvPublicKey_1}var smartDotenvPrivateKey_1,hasRequiredSmartDotenvPrivateKey;function requireSmartDotenvPrivateKey(){if(hasRequiredSmartDotenvPrivateKey)return smartDotenvPrivateKey_1;hasRequiredSmartDotenvPrivateKey=1;const e=requireFsx(),r=require$$0__default$1,u="DOTENV_PUBLIC_KEY",c="DOTENV_PRIVATE_KEY",p=requireDotenvParse(),s=requireGuessPrivateKeyName();function t(y){if(process.env[y]&&process.env[y].length>0)return process.env[y]}function o(y,m,f=null){let R=r.resolve(r.dirname(m),".env.keys");if(f&&(R=r.resolve(f)),e.existsSync(R)){const S=e.readFileX(R),F=p(S);if(F[y]&&F[y].length>0)return F[y]}}function h(y){if(!e.existsSync(y))return null;const m=e.readFileX(y),f=p(m);let R;for(const S of Object.keys(f))(S===u||S.startsWith(u))&&(R=S);return R?R.replace(u,c):null}function b(y,m=null){let f=null,R=s(y);return f=t(R),f||(f=o(R,y,m),f)||(R=h(y),R&&(f=t(R),f||(f=o(R,y,m),f)))?f:null}return smartDotenvPrivateKey_1=b,smartDotenvPrivateKey_1}var keypair,hasRequiredKeypair$1;function requireKeypair$1(){if(hasRequiredKeypair$1)return keypair;hasRequiredKeypair$1=1;const e=requireGuessPublicKeyName(),r=requireSmartDotenvPublicKey(),u=requireGuessPrivateKeyName(),c=requireSmartDotenvPrivateKey();class p{constructor(t=".env",o=null){this.envFile=t,this.envKeysFilepath=o}run(){const t={},o=this._envFilepaths();for(const h of o){const b=e(h),y=r(h);t[b]=y;const m=u(h),f=c(h,this.envKeysFilepath);t[m]=f}return t}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return keypair=p,keypair}var findPrivateKey_1,hasRequiredFindPrivateKey;function requireFindPrivateKey(){if(hasRequiredFindPrivateKey)return findPrivateKey_1;hasRequiredFindPrivateKey=1;const e=requireGuessPrivateKeyName(),r=requireProKeypair(),u=requireKeypair$1();function c(p,s=null){const t=e(p),o=new r(p).run(),h=new u(p,s).run();return o[t]||h[t]}return findPrivateKey_1=c,findPrivateKey_1}var dotenvPrivateKeyNames_1,hasRequiredDotenvPrivateKeyNames;function requireDotenvPrivateKeyNames(){if(hasRequiredDotenvPrivateKeyNames)return dotenvPrivateKeyNames_1;hasRequiredDotenvPrivateKeyNames=1;const e="DOTENV_PRIVATE_KEY";function r(u){return Object.keys(u).filter(c=>c.startsWith(e))}return dotenvPrivateKeyNames_1=r,dotenvPrivateKeyNames_1}var guessPrivateKeyFilename_1,hasRequiredGuessPrivateKeyFilename;function requireGuessPrivateKeyFilename(){if(hasRequiredGuessPrivateKeyFilename)return guessPrivateKeyFilename_1;hasRequiredGuessPrivateKeyFilename=1;const e="DOTENV_PRIVATE_KEY";function r(u){return u===e?".env":`.env.${u.substring(`${e}_`.length).split("_").join(".").toLowerCase()}`}return guessPrivateKeyFilename_1=r,guessPrivateKeyFilename_1}var determineEnvs_1,hasRequiredDetermineEnvs;function requireDetermineEnvs(){if(hasRequiredDetermineEnvs)return determineEnvs_1;hasRequiredDetermineEnvs=1;const e=requireDotenvPrivateKeyNames(),r=requireGuessPrivateKeyFilename(),u="envFile",c="envVaultFile",p=[{type:u,value:".env"}],s=[{type:c,value:".env.vault"}];function t(h){const b=[];for(const y of h){const m=r(y);b.push({type:u,value:m})}return b}function o(h=[],b,y=""){const m=e(b);if(!h||h.length<=0)return m.length>0?t(m):y.length>0?s:p;{let f=!1;for(const R of h)y.length>0&&R.type===c&&(f=!0),y.length<=0&&R.type===u&&(f=!0);return f?h:y.length>0?[...s,...h]:[...p,...h]}}return determineEnvs_1=o,determineEnvs_1}var run,hasRequiredRun;function requireRun(){if(hasRequiredRun)return run;hasRequiredRun=1;const e=requireFsx(),r=require$$0__default$1,u="env",c="envFile",p="envVaultFile",s=requireDecrypt(),t=requireParse(),o=requireErrors(),h=requireDotenvParse(),b=requireParseEnvironmentFromDotenvKey(),y=requireDetectEncoding(),m=requireFindPrivateKey(),f=requireGuessPrivateKeyName(),R=requireDetermineEnvs();class S{constructor(g=[],w=!1,B="",N=process.env,d=null){this.envs=R(g,N,B),this.overload=w,this.DOTENV_KEY=B,this.processEnv=N,this.envKeysFilepath=d,this.processedEnvs=[],this.readableFilepaths=new Set,this.readableStrings=new Set,this.uniqueInjectedKeys=new Set}run(){for(const g of this.envs)g.type===p?this._injectEnvVaultFile(g.value):g.type===c?this._injectEnvFile(g.value):g.type===u&&this._injectEnv(g.value);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys]}}_injectEnv(g){const w={};w.type=u,w.string=g;try{const{parsed:B,errors:N,injected:d,preExisted:v}=new t(g,null,this.processEnv,this.overload).run();w.parsed=B,w.errors=N,w.injected=d,w.preExisted=v,this.inject(w.parsed),this.readableStrings.add(g);for(const a of Object.keys(d))this.uniqueInjectedKeys.add(a)}catch(B){w.errors=[B]}this.processedEnvs.push(w)}_injectEnvFile(g){const w={};w.type=c,w.filepath=g;const B=r.resolve(g);try{const N=y(B),d=e.readFileX(B,{encoding:N});this.readableFilepaths.add(g);const v=m(g,this.envKeysFilepath),a=f(g),{parsed:j,errors:K,injected:q,preExisted:k}=new t(d,v,this.processEnv,this.overload,a).run();w.parsed=j,w.errors=K,w.injected=q,w.preExisted=k,this.inject(w.parsed);for(const _ of Object.keys(q))this.uniqueInjectedKeys.add(_)}catch(N){N.code==="ENOENT"||N.code==="EISDIR"?w.errors=[new o({envFilepath:g,filepath:B}).missingEnvFile()]:w.errors=[N]}this.processedEnvs.push(w)}_injectEnvVaultFile(g){const w={};w.type=p,w.filepath=g;const B=r.resolve(g);if(this.readableFilepaths.add(g),!e.existsSync(B)){const a="MISSING_ENV_VAULT_FILE",j=`you set DOTENV_KEY but your .env.vault file is missing: ${B}`,K=new Error(j);throw K.code=a,K}if(this.DOTENV_KEY.length<1){const a="MISSING_DOTENV_KEY",j=`your DOTENV_KEY appears to be blank: '${this.DOTENV_KEY}'`,K=new Error(j);throw K.code=a,K}let N;const d=this._dotenvKeys(),v=this._parsedVault(B);for(let a=0;a<d.length;a++)try{const j=d[a].trim();N=this._decrypted(j,v);break}catch(j){if(a+1>=d.length)throw j}try{const{parsed:a,errors:j,injected:K,preExisted:q}=new t(N,null,this.processEnv,this.overload).run();w.parsed=a,w.errors=j,w.injected=K,w.preExisted=q,this.inject(w.parsed);for(const k of Object.keys(K))this.uniqueInjectedKeys.add(k)}catch(a){w.errors=[a]}this.processedEnvs.push(w)}inject(g){for(const w of Object.keys(g))this.processEnv[w]=g[w]}_dotenvKeys(){return this.DOTENV_KEY.split(",")}_parsedVault(g){const w=e.readFileX(g);return h(w)}_decrypted(g,w){const N=`DOTENV_VAULT_${b(g).toUpperCase()}`,d=w[N];if(!d){const v=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: cannot locate environment ${N} in your .env.vault file`);throw v.code="NOT_FOUND_DOTENV_ENVIRONMENT",v}return s(d,g)}}return run=S,run}var encryptValue_1,hasRequiredEncryptValue;function requireEncryptValue(){if(hasRequiredEncryptValue)return encryptValue_1;hasRequiredEncryptValue=1;const{encrypt:e}=requireDist(),r="encrypted:";function u(c,p){const s=e(p,Buffer.from(c)),t=Buffer.from(s,"hex").toString("base64");return`${r}${t}`}return encryptValue_1=u,encryptValue_1}var quotes_1,hasRequiredQuotes;function requireQuotes(){if(hasRequiredQuotes)return quotes_1;hasRequiredQuotes=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function r(u){const c={};let p=u.toString();p=p.replace(/\r\n?/mg,`
|
|
9
|
-
`);let
|
|
2
|
+
"use strict";const citty=require("citty"),require$$0$1=require("fs"),require$$0$2=require("path"),require$$0$3=require("tty"),require$$2=require("os"),require$$3=require("crypto"),node_module=require("node:module"),require$$1=require("child_process"),esToolkit=require("es-toolkit"),algoliasearch=require("algoliasearch");var _documentCurrentScript=typeof document<"u"?document.currentScript:null;function _interopDefaultCompat(e){return e&&typeof e=="object"&&"default"in e?e.default:e}const require$$0__default=_interopDefaultCompat(require$$0$1),require$$0__default$1=_interopDefaultCompat(require$$0$2),require$$0__default$2=_interopDefaultCompat(require$$0$3),require$$2__default=_interopDefaultCompat(require$$2),require$$3__default=_interopDefaultCompat(require$$3),require$$1__default=_interopDefaultCompat(require$$1),name$2="algolia-uploader",version$2="0.0.9",description$2="command-line util to upload Algolia source";function readAllJsonFiles(e){return require$$0__default.readdirSync(e).filter(r=>r.endsWith(".json")).map(r=>{const v=require$$0__default.readFileSync(require$$0__default$1.join(e,r),"utf8");return JSON.parse(v)})}function getAugmentedNamespace(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var v=function a(){var f=!1;try{f=this instanceof a}catch{}return f?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};v.prototype=r.prototype}else v={};return Object.defineProperty(v,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var f=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(v,a,f.get?f:{enumerable:!0,get:function(){return e[a]}})}),v}var config$1={};const version$1="1.51.0",name$1="@dotenvx/dotenvx",description$1="a secure dotenv\u2013from the creator of `dotenv`",author="@motdotla",keywords$1=["dotenv","env"],homepage$1="https://github.com/dotenvx/dotenvx",repository$1={type:"git",url:"git+https://github.com/dotenvx/dotenvx.git"},license$1="BSD-3-Clause",files=["src/**/*","CHANGELOG.md"],main$3="src/lib/main.js",types$1="src/lib/main.d.ts",exports$2={".":{types:"./src/lib/main.d.ts",require:"./src/lib/main.js",default:"./src/lib/main.js"},"./config":"./src/lib/config.js","./config.js":"./src/lib/config.js","./package.json":"./package.json"},bin={dotenvx:"./src/cli/dotenvx.js"},scripts$1={standard:"standard","standard:fix":"standard --fix",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test-coverage":"tap run --show-full-coverage --timeout=60000",testshell:"bash shellspec",prerelease:"npm test && npm run testshell",release:"standard-version"},funding$1="https://dotenvx.com",dependencies={commander:"^11.1.0",dotenv:"^17.2.1",eciesjs:"^0.4.10",execa:"^5.1.1",fdir:"^6.2.0",ignore:"^5.3.0","object-treeify":"1.1.33",picomatch:"^4.0.2",which:"^4.0.0"},devDependencies$1={"@yao-pkg/pkg":"^5.14.2","capture-console":"^1.0.2",esbuild:"^0.25.8",proxyquire:"^2.1.3",sinon:"^14.0.1",standard:"^17.1.0","standard-version":"^9.5.0",tap:"^21.0.1"},publishConfig={access:"public",provenance:!0},_package$2={version:version$1,name:name$1,description:description$1,author,keywords:keywords$1,homepage:homepage$1,repository:repository$1,license:license$1,files,main:main$3,types:types$1,exports:exports$2,bin,scripts:scripts$1,funding:funding$1,dependencies,devDependencies:devDependencies$1,publishConfig},_package$3={__proto__:null,author,bin,default:_package$2,dependencies,description:description$1,devDependencies:devDependencies$1,exports:exports$2,files,funding:funding$1,homepage:homepage$1,keywords:keywords$1,license:license$1,main:main$3,name:name$1,publishConfig,repository:repository$1,scripts:scripts$1,types:types$1,version:version$1},require$$0=getAugmentedNamespace(_package$3);var packageJson,hasRequiredPackageJson;function requirePackageJson(){if(hasRequiredPackageJson)return packageJson;hasRequiredPackageJson=1;const{name:e,version:r,description:v}=require$$0;return packageJson={name:e,version:r,description:v},packageJson}var colorDepth,hasRequiredColorDepth;function requireColorDepth(){if(hasRequiredColorDepth)return colorDepth;hasRequiredColorDepth=1;const{WriteStream:e}=require$$0__default$2;return colorDepth={getColorDepth:()=>{try{return e.prototype.getColorDepth()}catch{const a=process.env.TERM;return a&&(a.includes("256color")||a.includes("xterm"))?8:4}}},colorDepth}var colors,hasRequiredColors;function requireColors(){if(hasRequiredColors)return colors;hasRequiredColors=1;const e=requireColorDepth(),r=new Map([["blue",34],["gray",37],["green",32],["olive",33],["orangered",31],["plum",35],["red",31],["electricblue",36],["dodgerblue",36]]),v=new Map([["blue",21],["gray",244],["green",34],["olive",142],["orangered",202],["plum",182],["red",196],["electricblue",45],["dodgerblue",33]]);function a(c){const s=e.getColorDepth();if(!v.has(c))throw new Error(`Invalid color ${c}`);if(s>=8){const d=v.get(c);return b=>`\x1B[38;5;${d}m${b}\x1B[39m`}if(s>=4){const d=r.get(c);return b=>`\x1B[${d}m${b}\x1B[39m`}return d=>d}function f(c){return e.getColorDepth()>=4?`\x1B[1m${c}\x1B[22m`:c}return colors={getColor:a,bold:f},colors}var logger_1,hasRequiredLogger;function requireLogger(){if(hasRequiredLogger)return logger_1;hasRequiredLogger=1;const e=requirePackageJson(),{getColor:r,bold:v}=requireColors(),a={error:0,warn:1,success:2,successv:2,info:2,help:2,verbose:4,debug:5,silly:6},f=_=>v(r("red")(_)),c=r("orangered"),s=r("green"),d=r("olive"),b=r("dodgerblue"),T=r("plum"),R=r("plum");let q=a.info,A="dotenvx",L=e.version;function w(_,O){const H=x(_,O);console.error(H)}function B(_,O){if(a[_]===void 0)throw new Error(`MISSING_LOG_LEVEL: '${_}'. implement in logger.`);if(a[_]<=q){const H=x(_,O);console.log(H)}}function x(_,O){const H=typeof O=="object"?JSON.stringify(O):O;switch(_.toLowerCase()){case"error":return f(H);case"warn":return c(H);case"success":return s(H);case"successv":return d(`[${A}@${L}] ${H}`);case"info":return H;case"help":return b(H);case"verbose":return T(H);case"debug":return R(H)}}const N={level:"info",error:_=>w("error",_),warn:_=>B("warn",_),success:_=>B("success",_),successv:_=>B("successv",_),info:_=>B("info",_),help:_=>B("help",_),verbose:_=>B("verbose",_),debug:_=>B("debug",_),setLevel:_=>{a[_]!==void 0&&(q=a[_],N.level=_)},setName:_=>{A=_,N.name=_},setVersion:_=>{L=_,N.version=_}};function M(_){const O=_.debug?"debug":_.verbose?"verbose":_.quiet?"error":_.logLevel;O&&(N.setLevel(O),(!_.quiet||_.quiet&&O!=="error")&&N.debug(`Setting log level to ${O}`))}function K(_){const O=_.logName;O&&N.setName(O)}function j(_){const O=_.logVersion;O&&N.setVersion(O)}return logger_1={logger:N,getColor:r,setLogLevel:M,setLogName:K,setLogVersion:j,levels:a},logger_1}var dist$1={},utils$4={},constants,hasRequiredConstants;function requireConstants(){if(hasRequiredConstants)return constants;hasRequiredConstants=1;const e="\\\\/",r=`[^${e}]`,v="\\.",a="\\+",f="\\?",c="\\/",s="(?=.)",d="[^/]",b=`(?:${c}|$)`,T=`(?:^|${c})`,R=`${v}{1,2}${b}`,q=`(?!${v})`,A=`(?!${T}${R})`,L=`(?!${v}{0,1}${b})`,w=`(?!${R})`,B=`[^.${c}]`,x=`${d}*?`,M={DOT_LITERAL:v,PLUS_LITERAL:a,QMARK_LITERAL:f,SLASH_LITERAL:c,ONE_CHAR:s,QMARK:d,END_ANCHOR:b,DOTS_SLASH:R,NO_DOT:q,NO_DOTS:A,NO_DOT_SLASH:L,NO_DOTS_SLASH:w,QMARK_NO_DOT:B,STAR:x,START_ANCHOR:T,SEP:"/"},K={...M,SLASH_LITERAL:`[${e}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${v}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${v})`,NO_DOTS:`(?!(?:^|[${e}])${v}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${v}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${v}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`,SEP:"\\"},j={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return constants={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:j,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(_){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${_.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(_){return _===!0?K:M}},constants}var hasRequiredUtils$4;function requireUtils$4(){return hasRequiredUtils$4||(hasRequiredUtils$4=1,(function(e){const{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:v,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:f}=requireConstants();e.isObject=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),e.hasRegexChars=c=>a.test(c),e.isRegexChar=c=>c.length===1&&e.hasRegexChars(c),e.escapeRegex=c=>c.replace(f,"\\$1"),e.toPosixSlashes=c=>c.replace(r,"/"),e.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const c=navigator.platform.toLowerCase();return c==="win32"||c==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1},e.removeBackslashes=c=>c.replace(v,s=>s==="\\"?"":s),e.escapeLast=(c,s,d)=>{const b=c.lastIndexOf(s,d);return b===-1?c:c[b-1]==="\\"?e.escapeLast(c,s,b-1):`${c.slice(0,b)}\\${c.slice(b)}`},e.removePrefix=(c,s={})=>{let d=c;return d.startsWith("./")&&(d=d.slice(2),s.prefix="./"),d},e.wrapOutput=(c,s={},d={})=>{const b=d.contains?"":"^",T=d.contains?"":"$";let R=`${b}(?:${c})${T}`;return s.negated===!0&&(R=`(?:^(?!${R}).*$)`),R},e.basename=(c,{windows:s}={})=>{const d=c.split(s?/[\\/]/:"/"),b=d[d.length-1];return b===""?d[d.length-2]:b}})(utils$4)),utils$4}var scan_1,hasRequiredScan;function requireScan(){if(hasRequiredScan)return scan_1;hasRequiredScan=1;const e=requireUtils$4(),{CHAR_ASTERISK:r,CHAR_AT:v,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:f,CHAR_DOT:c,CHAR_EXCLAMATION_MARK:s,CHAR_FORWARD_SLASH:d,CHAR_LEFT_CURLY_BRACE:b,CHAR_LEFT_PARENTHESES:T,CHAR_LEFT_SQUARE_BRACKET:R,CHAR_PLUS:q,CHAR_QUESTION_MARK:A,CHAR_RIGHT_CURLY_BRACE:L,CHAR_RIGHT_PARENTHESES:w,CHAR_RIGHT_SQUARE_BRACKET:B}=requireConstants(),x=K=>K===d||K===a,N=K=>{K.isPrefix!==!0&&(K.depth=K.isGlobstar?1/0:1)};return scan_1=(K,j)=>{const _=j||{},O=K.length-1,H=_.parts===!0||_.scanToEnd===!0,Z=[],k=[],$=[];let S=K,F=-1,D=0,V=0,u=!1,h=!1,o=!1,i=!1,p=!1,l=!1,t=!1,g=!1,E=!1,y=!1,m=0,ee,Y,C={value:"",depth:0,isGlob:!1};const G=()=>F>=O,z=()=>S.charCodeAt(F+1),J=()=>(ee=Y,S.charCodeAt(++F));for(;F<O;){Y=J();let ue;if(Y===a){t=C.backslashes=!0,Y=J(),Y===b&&(l=!0);continue}if(l===!0||Y===b){for(m++;G()!==!0&&(Y=J());){if(Y===a){t=C.backslashes=!0,J();continue}if(Y===b){m++;continue}if(l!==!0&&Y===c&&(Y=J())===c){if(u=C.isBrace=!0,o=C.isGlob=!0,y=!0,H===!0)continue;break}if(l!==!0&&Y===f){if(u=C.isBrace=!0,o=C.isGlob=!0,y=!0,H===!0)continue;break}if(Y===L&&(m--,m===0)){l=!1,u=C.isBrace=!0,y=!0;break}}if(H===!0)continue;break}if(Y===d){if(Z.push(F),k.push(C),C={value:"",depth:0,isGlob:!1},y===!0)continue;if(ee===c&&F===D+1){D+=2;continue}V=F+1;continue}if(_.noext!==!0&&(Y===q||Y===v||Y===r||Y===A||Y===s)===!0&&z()===T){if(o=C.isGlob=!0,i=C.isExtglob=!0,y=!0,Y===s&&F===D&&(E=!0),H===!0){for(;G()!==!0&&(Y=J());){if(Y===a){t=C.backslashes=!0,Y=J();continue}if(Y===w){o=C.isGlob=!0,y=!0;break}}continue}break}if(Y===r){if(ee===r&&(p=C.isGlobstar=!0),o=C.isGlob=!0,y=!0,H===!0)continue;break}if(Y===A){if(o=C.isGlob=!0,y=!0,H===!0)continue;break}if(Y===R){for(;G()!==!0&&(ue=J());){if(ue===a){t=C.backslashes=!0,J();continue}if(ue===B){h=C.isBracket=!0,o=C.isGlob=!0,y=!0;break}}if(H===!0)continue;break}if(_.nonegate!==!0&&Y===s&&F===D){g=C.negated=!0,D++;continue}if(_.noparen!==!0&&Y===T){if(o=C.isGlob=!0,H===!0){for(;G()!==!0&&(Y=J());){if(Y===T){t=C.backslashes=!0,Y=J();continue}if(Y===w){y=!0;break}}continue}break}if(o===!0){if(y=!0,H===!0)continue;break}}_.noext===!0&&(i=!1,o=!1);let ne=S,U="",W="";D>0&&(U=S.slice(0,D),S=S.slice(D),V-=D),ne&&o===!0&&V>0?(ne=S.slice(0,V),W=S.slice(V)):o===!0?(ne="",W=S):ne=S,ne&&ne!==""&&ne!=="/"&&ne!==S&&x(ne.charCodeAt(ne.length-1))&&(ne=ne.slice(0,-1)),_.unescape===!0&&(W&&(W=e.removeBackslashes(W)),ne&&t===!0&&(ne=e.removeBackslashes(ne)));const re={prefix:U,input:K,start:D,base:ne,glob:W,isBrace:u,isBracket:h,isGlob:o,isExtglob:i,isGlobstar:p,negated:g,negatedExtglob:E};if(_.tokens===!0&&(re.maxDepth=0,x(Y)||k.push(C),re.tokens=k),_.parts===!0||_.tokens===!0){let ue;for(let de=0;de<Z.length;de++){const se=ue?ue+1:D,pe=Z[de],Q=K.slice(se,pe);_.tokens&&(de===0&&D!==0?(k[de].isPrefix=!0,k[de].value=U):k[de].value=Q,N(k[de]),re.maxDepth+=k[de].depth),(de!==0||Q!=="")&&$.push(Q),ue=pe}if(ue&&ue+1<K.length){const de=K.slice(ue+1);$.push(de),_.tokens&&(k[k.length-1].value=de,N(k[k.length-1]),re.maxDepth+=k[k.length-1].depth)}re.slashes=Z,re.parts=$}return re},scan_1}var parse_1,hasRequiredParse$1;function requireParse$1(){if(hasRequiredParse$1)return parse_1;hasRequiredParse$1=1;const e=requireConstants(),r=requireUtils$4(),{MAX_LENGTH:v,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:f,REGEX_SPECIAL_CHARS_BACKREF:c,REPLACEMENTS:s}=e,d=(R,q)=>{if(typeof q.expandRange=="function")return q.expandRange(...R,q);R.sort();const A=`[${R.join("-")}]`;try{new RegExp(A)}catch{return R.map(w=>r.escapeRegex(w)).join("..")}return A},b=(R,q)=>`Missing ${R}: "${q}" - use "\\\\${q}" to match literal characters`,T=(R,q)=>{if(typeof R!="string")throw new TypeError("Expected a string");R=s[R]||R;const A={...q},L=typeof A.maxLength=="number"?Math.min(v,A.maxLength):v;let w=R.length;if(w>L)throw new SyntaxError(`Input length: ${w}, exceeds maximum allowed length: ${L}`);const B={type:"bos",value:"",output:A.prepend||""},x=[B],N=A.capture?"":"?:",M=e.globChars(A.windows),K=e.extglobChars(M),{DOT_LITERAL:j,PLUS_LITERAL:_,SLASH_LITERAL:O,ONE_CHAR:H,DOTS_SLASH:Z,NO_DOT:k,NO_DOT_SLASH:$,NO_DOTS_SLASH:S,QMARK:F,QMARK_NO_DOT:D,STAR:V,START_ANCHOR:u}=M,h=se=>`(${N}(?:(?!${u}${se.dot?Z:j}).)*?)`,o=A.dot?"":k,i=A.dot?F:D;let p=A.bash===!0?h(A):V;A.capture&&(p=`(${p})`),typeof A.noext=="boolean"&&(A.noextglob=A.noext);const l={input:R,index:-1,start:0,dot:A.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:x};R=r.removePrefix(R,l),w=R.length;const t=[],g=[],E=[];let y=B,m;const ee=()=>l.index===w-1,Y=l.peek=(se=1)=>R[l.index+se],C=l.advance=()=>R[++l.index]||"",G=()=>R.slice(l.index+1),z=(se="",pe=0)=>{l.consumed+=se,l.index+=pe},J=se=>{l.output+=se.output!=null?se.output:se.value,z(se.value)},ne=()=>{let se=1;for(;Y()==="!"&&(Y(2)!=="("||Y(3)==="?");)C(),l.start++,se++;return se%2===0?!1:(l.negated=!0,l.start++,!0)},U=se=>{l[se]++,E.push(se)},W=se=>{l[se]--,E.pop()},re=se=>{if(y.type==="globstar"){const pe=l.braces>0&&(se.type==="comma"||se.type==="brace"),Q=se.extglob===!0||t.length&&(se.type==="pipe"||se.type==="paren");se.type!=="slash"&&se.type!=="paren"&&!pe&&!Q&&(l.output=l.output.slice(0,-y.output.length),y.type="star",y.value="*",y.output=p,l.output+=y.output)}if(t.length&&se.type!=="paren"&&(t[t.length-1].inner+=se.value),(se.value||se.output)&&J(se),y&&y.type==="text"&&se.type==="text"){y.output=(y.output||y.value)+se.value,y.value+=se.value;return}se.prev=y,x.push(se),y=se},ue=(se,pe)=>{const Q={...K[pe],conditions:1,inner:""};Q.prev=y,Q.parens=l.parens,Q.output=l.output;const ve=(A.capture?"(":"")+Q.open;U("parens"),re({type:se,value:pe,output:l.output?"":H}),re({type:"paren",extglob:!0,value:C(),output:ve}),t.push(Q)},de=se=>{let pe=se.close+(A.capture?")":""),Q;if(se.type==="negate"){let ve=p;if(se.inner&&se.inner.length>1&&se.inner.includes("/")&&(ve=h(A)),(ve!==p||ee()||/^\)+$/.test(G()))&&(pe=se.close=`)$))${ve}`),se.inner.includes("*")&&(Q=G())&&/^\.[^\\/.]+$/.test(Q)){const Ee=T(Q,{...q,fastpaths:!1}).output;pe=se.close=`)${Ee})${ve})`}se.prev.type==="bos"&&(l.negatedExtglob=!0)}re({type:"paren",extglob:!0,value:m,output:pe}),W("parens")};if(A.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(R)){let se=!1,pe=R.replace(c,(Q,ve,Ee,he,te,ie)=>he==="\\"?(se=!0,Q):he==="?"?ve?ve+he+(te?F.repeat(te.length):""):ie===0?i+(te?F.repeat(te.length):""):F.repeat(Ee.length):he==="."?j.repeat(Ee.length):he==="*"?ve?ve+he+(te?p:""):p:ve?Q:`\\${Q}`);return se===!0&&(A.unescape===!0?pe=pe.replace(/\\/g,""):pe=pe.replace(/\\+/g,Q=>Q.length%2===0?"\\\\":Q?"\\":"")),pe===R&&A.contains===!0?(l.output=R,l):(l.output=r.wrapOutput(pe,l,q),l)}for(;!ee();){if(m=C(),m==="\0")continue;if(m==="\\"){const Q=Y();if(Q==="/"&&A.bash!==!0||Q==="."||Q===";")continue;if(!Q){m+="\\",re({type:"text",value:m});continue}const ve=/^\\+/.exec(G());let Ee=0;if(ve&&ve[0].length>2&&(Ee=ve[0].length,l.index+=Ee,Ee%2!==0&&(m+="\\")),A.unescape===!0?m=C():m+=C(),l.brackets===0){re({type:"text",value:m});continue}}if(l.brackets>0&&(m!=="]"||y.value==="["||y.value==="[^")){if(A.posix!==!1&&m===":"){const Q=y.value.slice(1);if(Q.includes("[")&&(y.posix=!0,Q.includes(":"))){const ve=y.value.lastIndexOf("["),Ee=y.value.slice(0,ve),he=y.value.slice(ve+2),te=a[he];if(te){y.value=Ee+te,l.backtrack=!0,C(),!B.output&&x.indexOf(y)===1&&(B.output=H);continue}}}(m==="["&&Y()!==":"||m==="-"&&Y()==="]")&&(m=`\\${m}`),m==="]"&&(y.value==="["||y.value==="[^")&&(m=`\\${m}`),A.posix===!0&&m==="!"&&y.value==="["&&(m="^"),y.value+=m,J({value:m});continue}if(l.quotes===1&&m!=='"'){m=r.escapeRegex(m),y.value+=m,J({value:m});continue}if(m==='"'){l.quotes=l.quotes===1?0:1,A.keepQuotes===!0&&re({type:"text",value:m});continue}if(m==="("){U("parens"),re({type:"paren",value:m});continue}if(m===")"){if(l.parens===0&&A.strictBrackets===!0)throw new SyntaxError(b("opening","("));const Q=t[t.length-1];if(Q&&l.parens===Q.parens+1){de(t.pop());continue}re({type:"paren",value:m,output:l.parens?")":"\\)"}),W("parens");continue}if(m==="["){if(A.nobracket===!0||!G().includes("]")){if(A.nobracket!==!0&&A.strictBrackets===!0)throw new SyntaxError(b("closing","]"));m=`\\${m}`}else U("brackets");re({type:"bracket",value:m});continue}if(m==="]"){if(A.nobracket===!0||y&&y.type==="bracket"&&y.value.length===1){re({type:"text",value:m,output:`\\${m}`});continue}if(l.brackets===0){if(A.strictBrackets===!0)throw new SyntaxError(b("opening","["));re({type:"text",value:m,output:`\\${m}`});continue}W("brackets");const Q=y.value.slice(1);if(y.posix!==!0&&Q[0]==="^"&&!Q.includes("/")&&(m=`/${m}`),y.value+=m,J({value:m}),A.literalBrackets===!1||r.hasRegexChars(Q))continue;const ve=r.escapeRegex(y.value);if(l.output=l.output.slice(0,-y.value.length),A.literalBrackets===!0){l.output+=ve,y.value=ve;continue}y.value=`(${N}${ve}|${y.value})`,l.output+=y.value;continue}if(m==="{"&&A.nobrace!==!0){U("braces");const Q={type:"brace",value:m,output:"(",outputIndex:l.output.length,tokensIndex:l.tokens.length};g.push(Q),re(Q);continue}if(m==="}"){const Q=g[g.length-1];if(A.nobrace===!0||!Q){re({type:"text",value:m,output:m});continue}let ve=")";if(Q.dots===!0){const Ee=x.slice(),he=[];for(let te=Ee.length-1;te>=0&&(x.pop(),Ee[te].type!=="brace");te--)Ee[te].type!=="dots"&&he.unshift(Ee[te].value);ve=d(he,A),l.backtrack=!0}if(Q.comma!==!0&&Q.dots!==!0){const Ee=l.output.slice(0,Q.outputIndex),he=l.tokens.slice(Q.tokensIndex);Q.value=Q.output="\\{",m=ve="\\}",l.output=Ee;for(const te of he)l.output+=te.output||te.value}re({type:"brace",value:m,output:ve}),W("braces"),g.pop();continue}if(m==="|"){t.length>0&&t[t.length-1].conditions++,re({type:"text",value:m});continue}if(m===","){let Q=m;const ve=g[g.length-1];ve&&E[E.length-1]==="braces"&&(ve.comma=!0,Q="|"),re({type:"comma",value:m,output:Q});continue}if(m==="/"){if(y.type==="dot"&&l.index===l.start+1){l.start=l.index+1,l.consumed="",l.output="",x.pop(),y=B;continue}re({type:"slash",value:m,output:O});continue}if(m==="."){if(l.braces>0&&y.type==="dot"){y.value==="."&&(y.output=j);const Q=g[g.length-1];y.type="dots",y.output+=m,y.value+=m,Q.dots=!0;continue}if(l.braces+l.parens===0&&y.type!=="bos"&&y.type!=="slash"){re({type:"text",value:m,output:j});continue}re({type:"dot",value:m,output:j});continue}if(m==="?"){if(!(y&&y.value==="(")&&A.noextglob!==!0&&Y()==="("&&Y(2)!=="?"){ue("qmark",m);continue}if(y&&y.type==="paren"){const ve=Y();let Ee=m;(y.value==="("&&!/[!=<:]/.test(ve)||ve==="<"&&!/<([!=]|\w+>)/.test(G()))&&(Ee=`\\${m}`),re({type:"text",value:m,output:Ee});continue}if(A.dot!==!0&&(y.type==="slash"||y.type==="bos")){re({type:"qmark",value:m,output:D});continue}re({type:"qmark",value:m,output:F});continue}if(m==="!"){if(A.noextglob!==!0&&Y()==="("&&(Y(2)!=="?"||!/[!=<:]/.test(Y(3)))){ue("negate",m);continue}if(A.nonegate!==!0&&l.index===0){ne();continue}}if(m==="+"){if(A.noextglob!==!0&&Y()==="("&&Y(2)!=="?"){ue("plus",m);continue}if(y&&y.value==="("||A.regex===!1){re({type:"plus",value:m,output:_});continue}if(y&&(y.type==="bracket"||y.type==="paren"||y.type==="brace")||l.parens>0){re({type:"plus",value:m});continue}re({type:"plus",value:_});continue}if(m==="@"){if(A.noextglob!==!0&&Y()==="("&&Y(2)!=="?"){re({type:"at",extglob:!0,value:m,output:""});continue}re({type:"text",value:m});continue}if(m!=="*"){(m==="$"||m==="^")&&(m=`\\${m}`);const Q=f.exec(G());Q&&(m+=Q[0],l.index+=Q[0].length),re({type:"text",value:m});continue}if(y&&(y.type==="globstar"||y.star===!0)){y.type="star",y.star=!0,y.value+=m,y.output=p,l.backtrack=!0,l.globstar=!0,z(m);continue}let se=G();if(A.noextglob!==!0&&/^\([^?]/.test(se)){ue("star",m);continue}if(y.type==="star"){if(A.noglobstar===!0){z(m);continue}const Q=y.prev,ve=Q.prev,Ee=Q.type==="slash"||Q.type==="bos",he=ve&&(ve.type==="star"||ve.type==="globstar");if(A.bash===!0&&(!Ee||se[0]&&se[0]!=="/")){re({type:"star",value:m,output:""});continue}const te=l.braces>0&&(Q.type==="comma"||Q.type==="brace"),ie=t.length&&(Q.type==="pipe"||Q.type==="paren");if(!Ee&&Q.type!=="paren"&&!te&&!ie){re({type:"star",value:m,output:""});continue}for(;se.slice(0,3)==="/**";){const oe=R[l.index+4];if(oe&&oe!=="/")break;se=se.slice(3),z("/**",3)}if(Q.type==="bos"&&ee()){y.type="globstar",y.value+=m,y.output=h(A),l.output=y.output,l.globstar=!0,z(m);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&!he&&ee()){l.output=l.output.slice(0,-(Q.output+y.output).length),Q.output=`(?:${Q.output}`,y.type="globstar",y.output=h(A)+(A.strictSlashes?")":"|$)"),y.value+=m,l.globstar=!0,l.output+=Q.output+y.output,z(m);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&se[0]==="/"){const oe=se[1]!==void 0?"|$":"";l.output=l.output.slice(0,-(Q.output+y.output).length),Q.output=`(?:${Q.output}`,y.type="globstar",y.output=`${h(A)}${O}|${O}${oe})`,y.value+=m,l.output+=Q.output+y.output,l.globstar=!0,z(m+C()),re({type:"slash",value:"/",output:""});continue}if(Q.type==="bos"&&se[0]==="/"){y.type="globstar",y.value+=m,y.output=`(?:^|${O}|${h(A)}${O})`,l.output=y.output,l.globstar=!0,z(m+C()),re({type:"slash",value:"/",output:""});continue}l.output=l.output.slice(0,-y.output.length),y.type="globstar",y.output=h(A),y.value+=m,l.output+=y.output,l.globstar=!0,z(m);continue}const pe={type:"star",value:m,output:p};if(A.bash===!0){pe.output=".*?",(y.type==="bos"||y.type==="slash")&&(pe.output=o+pe.output),re(pe);continue}if(y&&(y.type==="bracket"||y.type==="paren")&&A.regex===!0){pe.output=m,re(pe);continue}(l.index===l.start||y.type==="slash"||y.type==="dot")&&(y.type==="dot"?(l.output+=$,y.output+=$):A.dot===!0?(l.output+=S,y.output+=S):(l.output+=o,y.output+=o),Y()!=="*"&&(l.output+=H,y.output+=H)),re(pe)}for(;l.brackets>0;){if(A.strictBrackets===!0)throw new SyntaxError(b("closing","]"));l.output=r.escapeLast(l.output,"["),W("brackets")}for(;l.parens>0;){if(A.strictBrackets===!0)throw new SyntaxError(b("closing",")"));l.output=r.escapeLast(l.output,"("),W("parens")}for(;l.braces>0;){if(A.strictBrackets===!0)throw new SyntaxError(b("closing","}"));l.output=r.escapeLast(l.output,"{"),W("braces")}if(A.strictSlashes!==!0&&(y.type==="star"||y.type==="bracket")&&re({type:"maybe_slash",value:"",output:`${O}?`}),l.backtrack===!0){l.output="";for(const se of l.tokens)l.output+=se.output!=null?se.output:se.value,se.suffix&&(l.output+=se.suffix)}return l};return T.fastpaths=(R,q)=>{const A={...q},L=typeof A.maxLength=="number"?Math.min(v,A.maxLength):v,w=R.length;if(w>L)throw new SyntaxError(`Input length: ${w}, exceeds maximum allowed length: ${L}`);R=s[R]||R;const{DOT_LITERAL:B,SLASH_LITERAL:x,ONE_CHAR:N,DOTS_SLASH:M,NO_DOT:K,NO_DOTS:j,NO_DOTS_SLASH:_,STAR:O,START_ANCHOR:H}=e.globChars(A.windows),Z=A.dot?j:K,k=A.dot?_:K,$=A.capture?"":"?:",S={negated:!1,prefix:""};let F=A.bash===!0?".*?":O;A.capture&&(F=`(${F})`);const D=o=>o.noglobstar===!0?F:`(${$}(?:(?!${H}${o.dot?M:B}).)*?)`,V=o=>{switch(o){case"*":return`${Z}${N}${F}`;case".*":return`${B}${N}${F}`;case"*.*":return`${Z}${F}${B}${N}${F}`;case"*/*":return`${Z}${F}${x}${N}${k}${F}`;case"**":return Z+D(A);case"**/*":return`(?:${Z}${D(A)}${x})?${k}${N}${F}`;case"**/*.*":return`(?:${Z}${D(A)}${x})?${k}${F}${B}${N}${F}`;case"**/.*":return`(?:${Z}${D(A)}${x})?${B}${N}${F}`;default:{const i=/^(.*?)\.(\w+)$/.exec(o);if(!i)return;const p=V(i[1]);return p?p+B+i[2]:void 0}}},u=r.removePrefix(R,S);let h=V(u);return h&&A.strictSlashes!==!0&&(h+=`${x}?`),h},parse_1=T,parse_1}var picomatch_1$1,hasRequiredPicomatch$1;function requirePicomatch$1(){if(hasRequiredPicomatch$1)return picomatch_1$1;hasRequiredPicomatch$1=1;const e=requireScan(),r=requireParse$1(),v=requireUtils$4(),a=requireConstants(),f=s=>s&&typeof s=="object"&&!Array.isArray(s),c=(s,d,b=!1)=>{if(Array.isArray(s)){const x=s.map(M=>c(M,d,b));return M=>{for(const K of x){const j=K(M);if(j)return j}return!1}}const T=f(s)&&s.tokens&&s.input;if(s===""||typeof s!="string"&&!T)throw new TypeError("Expected pattern to be a non-empty string");const R=d||{},q=R.windows,A=T?c.compileRe(s,d):c.makeRe(s,d,!1,!0),L=A.state;delete A.state;let w=()=>!1;if(R.ignore){const x={...d,ignore:null,onMatch:null,onResult:null};w=c(R.ignore,x,b)}const B=(x,N=!1)=>{const{isMatch:M,match:K,output:j}=c.test(x,A,d,{glob:s,posix:q}),_={glob:s,state:L,regex:A,posix:q,input:x,output:j,match:K,isMatch:M};return typeof R.onResult=="function"&&R.onResult(_),M===!1?(_.isMatch=!1,N?_:!1):w(x)?(typeof R.onIgnore=="function"&&R.onIgnore(_),_.isMatch=!1,N?_:!1):(typeof R.onMatch=="function"&&R.onMatch(_),N?_:!0)};return b&&(B.state=L),B};return c.test=(s,d,b,{glob:T,posix:R}={})=>{if(typeof s!="string")throw new TypeError("Expected input to be a string");if(s==="")return{isMatch:!1,output:""};const q=b||{},A=q.format||(R?v.toPosixSlashes:null);let L=s===T,w=L&&A?A(s):s;return L===!1&&(w=A?A(s):s,L=w===T),(L===!1||q.capture===!0)&&(q.matchBase===!0||q.basename===!0?L=c.matchBase(s,d,b,R):L=d.exec(w)),{isMatch:!!L,match:L,output:w}},c.matchBase=(s,d,b)=>(d instanceof RegExp?d:c.makeRe(d,b)).test(v.basename(s)),c.isMatch=(s,d,b)=>c(d,b)(s),c.parse=(s,d)=>Array.isArray(s)?s.map(b=>c.parse(b,d)):r(s,{...d,fastpaths:!1}),c.scan=(s,d)=>e(s,d),c.compileRe=(s,d,b=!1,T=!1)=>{if(b===!0)return s.output;const R=d||{},q=R.contains?"":"^",A=R.contains?"":"$";let L=`${q}(?:${s.output})${A}`;s&&s.negated===!0&&(L=`^(?!${L}).*$`);const w=c.toRegex(L,d);return T===!0&&(w.state=s),w},c.makeRe=(s,d={},b=!1,T=!1)=>{if(!s||typeof s!="string")throw new TypeError("Expected a non-empty string");let R={negated:!1,fastpaths:!0};return d.fastpaths!==!1&&(s[0]==="."||s[0]==="*")&&(R.output=r.fastpaths(s,d)),R.output||(R=r(s,d)),c.compileRe(R,d,b,T)},c.toRegex=(s,d)=>{try{const b=d||{};return new RegExp(s,b.flags||(b.nocase?"i":""))}catch(b){if(d&&d.debug===!0)throw b;return/$^/}},c.constants=a,picomatch_1$1=c,picomatch_1$1}var picomatch_1,hasRequiredPicomatch;function requirePicomatch(){if(hasRequiredPicomatch)return picomatch_1;hasRequiredPicomatch=1;const e=requirePicomatch$1(),r=requireUtils$4();function v(a,f,c=!1){return f&&(f.windows===null||f.windows===void 0)&&(f={...f,windows:r.isWindows()}),e(a,f,c)}return Object.assign(v,e),picomatch_1=v,picomatch_1}var hasRequiredDist$1;function requireDist$1(){if(hasRequiredDist$1)return dist$1;hasRequiredDist$1=1;var e=Object.create,r=Object.defineProperty,v=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,f=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,s=(P,X,ce,ae)=>{if(X&&typeof X=="object"||typeof X=="function")for(var le=a(X),_e=0,we=le.length,Se;_e<we;_e++)Se=le[_e],!c.call(P,Se)&&Se!==ce&&r(P,Se,{get:(Ae=>X[Ae]).bind(null,Se),enumerable:!(ae=v(X,Se))||ae.enumerable});return P},d=(P,X,ce)=>(ce=P!=null?e(f(P)):{},s(!P||!P.__esModule?r(ce,"default",{value:P,enumerable:!0}):ce,P));const b=d(require$$0__default$1),T=d(require$$0__default);function R(P){let X=(0,b.normalize)(P);return X.length>1&&X[X.length-1]===b.sep&&(X=X.substring(0,X.length-1)),X}const q=/[\\/]/g;function A(P,X){return P.replace(q,X)}const L=/^[a-z]:[\\/]$/i;function w(P){return P==="/"||L.test(P)}function B(P,X){const{resolvePaths:ce,normalizePath:ae,pathSeparator:le}=X,_e=process.platform==="win32"&&P.includes("/")||P.startsWith(".");if(ce&&(P=(0,b.resolve)(P)),(ae||_e)&&(P=R(P)),P===".")return"";const we=P[P.length-1]!==le;return A(we?P+le:P,le)}function x(P,X){return X+P}function N(P,X){return function(ce,ae){return ae.startsWith(P)?ae.slice(P.length)+ce:A((0,b.relative)(P,ae),X.pathSeparator)+X.pathSeparator+ce}}function M(P){return P}function K(P,X,ce){return X+P+ce}function j(P,X){const{relativePaths:ce,includeBasePath:ae}=X;return ce&&P?N(P,X):ae?x:M}function _(P){return function(X,ce){ce.push(X.substring(P.length)||".")}}function O(P){return function(X,ce,ae){const le=X.substring(P.length)||".";ae.every(_e=>_e(le,!0))&&ce.push(le)}}const H=(P,X)=>{X.push(P||".")},Z=(P,X,ce)=>{const ae=P||".";ce.every(le=>le(ae,!0))&&X.push(ae)},k=()=>{};function $(P,X){const{includeDirs:ce,filters:ae,relativePaths:le}=X;return ce?le?ae&&ae.length?O(P):_(P):ae&&ae.length?Z:H:k}const S=(P,X,ce,ae)=>{ae.every(le=>le(P,!1))&&ce.files++},F=(P,X,ce,ae)=>{ae.every(le=>le(P,!1))&&X.push(P)},D=(P,X,ce,ae)=>{ce.files++},V=(P,X)=>{X.push(P)},u=()=>{};function h(P){const{excludeFiles:X,filters:ce,onlyCounts:ae}=P;return X?u:ce&&ce.length?ae?S:F:ae?D:V}const o=P=>P,i=()=>[""].slice(0,0);function p(P){return P.group?i:o}const l=(P,X,ce)=>{P.push({directory:X,files:ce,dir:X})},t=()=>{};function g(P){return P.group?l:t}const E=function(P,X,ce){const{queue:ae,fs:le,options:{suppressErrors:_e}}=X;ae.enqueue(),le.realpath(P,(we,Se)=>{if(we)return ae.dequeue(_e?null:we,X);le.stat(Se,(Ae,xe)=>{if(Ae)return ae.dequeue(_e?null:Ae,X);if(xe.isDirectory()&&ee(P,Se,X))return ae.dequeue(null,X);ce(xe,Se),ae.dequeue(null,X)})})},y=function(P,X,ce){const{queue:ae,fs:le,options:{suppressErrors:_e}}=X;ae.enqueue();try{const we=le.realpathSync(P),Se=le.statSync(we);if(Se.isDirectory()&&ee(P,we,X))return;ce(Se,we)}catch(we){if(!_e)throw we}};function m(P,X){return!P.resolveSymlinks||P.excludeSymlinks?null:X?y:E}function ee(P,X,ce){if(ce.options.useRealPaths)return Y(X,ce);let ae=(0,b.dirname)(P),le=1;for(;ae!==ce.root&&le<2;){const _e=ce.symlinks.get(ae);!!_e&&(_e===X||_e.startsWith(X)||X.startsWith(_e))?le++:ae=(0,b.dirname)(ae)}return ce.symlinks.set(P,X),le>1}function Y(P,X){return X.visited.includes(P+X.options.pathSeparator)}const C=P=>P.counts,G=P=>P.groups,z=P=>P.paths,J=P=>P.paths.slice(0,P.options.maxFiles),ne=(P,X,ce)=>(ue(X,ce,P.counts,P.options.suppressErrors),null),U=(P,X,ce)=>(ue(X,ce,P.paths,P.options.suppressErrors),null),W=(P,X,ce)=>(ue(X,ce,P.paths.slice(0,P.options.maxFiles),P.options.suppressErrors),null),re=(P,X,ce)=>(ue(X,ce,P.groups,P.options.suppressErrors),null);function ue(P,X,ce,ae){X(P&&!ae?P:null,ce)}function de(P,X){const{onlyCounts:ce,group:ae,maxFiles:le}=P;return ce?X?C:ne:ae?X?G:re:le?X?J:W:X?z:U}const se={withFileTypes:!0},pe=(P,X,ce,ae,le)=>{if(P.queue.enqueue(),ae<0)return P.queue.dequeue(null,P);const{fs:_e}=P;P.visited.push(X),P.counts.directories++,_e.readdir(X||".",se,(we,Se=[])=>{le(Se,ce,ae),P.queue.dequeue(P.options.suppressErrors?null:we,P)})},Q=(P,X,ce,ae,le)=>{const{fs:_e}=P;if(ae<0)return;P.visited.push(X),P.counts.directories++;let we=[];try{we=_e.readdirSync(X||".",se)}catch(Se){if(!P.options.suppressErrors)throw Se}le(we,ce,ae)};function ve(P){return P?Q:pe}var Ee=class{count=0;constructor(P){this.onQueueEmpty=P}enqueue(){return this.count++,this.count}dequeue(P,X){this.onQueueEmpty&&(--this.count<=0||P)&&(this.onQueueEmpty(P,X),P&&(X.controller.abort(),this.onQueueEmpty=void 0))}},he=class{_files=0;_directories=0;set files(P){this._files=P}get files(){return this._files}set directories(P){this._directories=P}get directories(){return this._directories}get dirs(){return this._directories}},te=class{aborted=!1;abort(){this.aborted=!0}},ie=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(P,X,ce){this.isSynchronous=!ce,this.callbackInvoker=de(X,this.isSynchronous),this.root=B(P,X),this.state={root:w(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new he,options:X,queue:new Ee((ae,le)=>this.callbackInvoker(le,ae,ce)),symlinks:new Map,visited:[""].slice(0,0),controller:new te,fs:X.fs||T},this.joinPath=j(this.root,X),this.pushDirectory=$(this.root,X),this.pushFile=h(X),this.getArray=p(X),this.groupFiles=g(X),this.resolveSymlink=m(X,this.isSynchronous),this.walkDirectory=ve(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(P,X,ce)=>{const{paths:ae,options:{filters:le,resolveSymlinks:_e,excludeSymlinks:we,exclude:Se,maxFiles:Ae,signal:xe,useRealPaths:Oe,pathSeparator:Ne},controller:Te}=this.state;if(Te.aborted||xe&&xe.aborted||Ae&&ae.length>Ae)return;const Ce=this.getArray(this.state.paths);for(let Pe=0;Pe<P.length;++Pe){const Ie=P[Pe];if(Ie.isFile()||Ie.isSymbolicLink()&&!_e&&!we){const Be=this.joinPath(Ie.name,X);this.pushFile(Be,Ce,this.state.counts,le)}else if(Ie.isDirectory()){let Be=K(Ie.name,X,this.state.options.pathSeparator);if(Se&&Se(Ie.name,Be))continue;this.pushDirectory(Be,ae,le),this.walkDirectory(this.state,Be,Be,ce-1,this.walk)}else if(this.resolveSymlink&&Ie.isSymbolicLink()){let Be=x(Ie.name,X);this.resolveSymlink(Be,this.state,($e,Re)=>{if($e.isDirectory()){if(Re=B(Re,this.state.options),Se&&Se(Ie.name,Oe?Re:Be+Ne))return;this.walkDirectory(this.state,Re,Oe?Re:Be+Ne,ce-1,this.walk)}else{Re=Oe?Re:Be;const Le=(0,b.basename)(Re),He=B((0,b.dirname)(Re),this.state.options);Re=this.joinPath(Le,He),this.pushFile(Re,Ce,this.state.counts,le)}})}}this.groupFiles(this.state.groups,X,Ce)}};function oe(P,X){return new Promise((ce,ae)=>{fe(P,X,(le,_e)=>{if(le)return ae(le);ce(_e)})})}function fe(P,X,ce){new ie(P,X,ce).start()}function ye(P,X){return new ie(P,X).start()}var be=class{constructor(P,X){this.root=P,this.options=X}withPromise(){return oe(this.root,this.options)}withCallback(P){fe(this.root,this.options,P)}sync(){return ye(this.root,this.options)}};let ge=null;try{require.resolve("picomatch"),ge=requirePicomatch()}catch{}var me=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:b.sep,filters:[]};globFunction;constructor(P){this.options={...this.options,...P},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(P){return this.options.pathSeparator=P,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(P){return this.options.maxDepth=P,this}withMaxFiles(P){return this.options.maxFiles=P,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:P=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=P,this.withFullPaths()}withAbortSignal(P){return this.options.signal=P,this}normalize(){return this.options.normalizePath=!0,this}filter(P){return this.options.filters.push(P),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(P){return this.options.exclude=P,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(P){return new be(P||".",this.options)}withGlobFunction(P){return this.globFunction=P,this}crawlWithOptions(P,X){return this.options={...this.options,...X},new be(P||".",this.options)}glob(...P){return this.globFunction?this.globWithOptions(P):this.globWithOptions(P,{dot:!0})}globWithOptions(P,...X){const ce=this.globFunction||ge;if(!ce)throw new Error("Please specify a glob function to use glob matching.");var ae=this.globCache[P.join("\0")];return ae||(ae=ce(P,...X),this.globCache[P.join("\0")]=ae),this.options.filters.push(le=>ae(le)),this}};return dist$1.fdir=me,dist$1}var ls,hasRequiredLs;function requireLs(){if(hasRequiredLs)return ls;hasRequiredLs=1;const{fdir:e}=requireDist$1(),r=require$$0__default$1,v=requirePicomatch();class a{constructor(c="./",s=[".env*"],d=[]){this.ignore=["node_modules/**",".git/**"],this.cwd=r.resolve(c),this.envFile=s,this.excludeEnvFile=d}run(){return this._filepaths()}_filepaths(){const c=v(this._exclude()),s=v(this._patterns(),{ignore:this._exclude()});return new e().withRelativePaths().exclude((d,b)=>c(b)).filter(d=>s(d)).crawl(this.cwd).sync()}_patterns(){return Array.isArray(this.envFile)?this.envFile.map(c=>`**/${c}`):[`**/${this.envFile}`]}_excludePatterns(){return Array.isArray(this.excludeEnvFile)?this.excludeEnvFile.map(c=>`**/${c}`):[`**/${this.excludeEnvFile}`]}_exclude(){return this._excludePatterns().length>0?this.ignore.concat(this._excludePatterns()):this.ignore}}return ls=a,ls}var fsx_1,hasRequiredFsx;function requireFsx(){if(hasRequiredFsx)return fsx_1;hasRequiredFsx=1;const e=require$$0__default,r="utf8";function v(c,s=null){return s||(s=r),e.readFileSync(c,s)}function a(c,s){return e.writeFileSync(c,s,r)}return fsx_1={chmodSync:e.chmodSync,existsSync:e.existsSync,readdirSync:e.readdirSync,readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,readFileX:v,writeFileX:a},fsx_1}var main$2={exports:{}};const name="dotenv",version="17.2.3",description="Loads environment variables from .env file",main$1="lib/main.js",types="lib/main.d.ts",exports$1={".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts={"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository={type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage="https://github.com/motdotla/dotenv#readme",funding="https://dotenvx.com",keywords=["dotenv","env",".env","environment","variables","config","settings"],readmeFilename="README.md",license="BSD-2-Clause",devDependencies={"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines={node:">=12"},browser={fs:!1},_package={name,version,description,main:main$1,types,exports:exports$1,scripts,repository,homepage,funding,keywords,readmeFilename,license,devDependencies,engines,browser},_package$1={__proto__:null,browser,default:_package,description,devDependencies,engines,exports:exports$1,funding,homepage,keywords,license,main:main$1,name,readmeFilename,repository,scripts,types,version},require$$4=getAugmentedNamespace(_package$1);var hasRequiredMain$1;function requireMain$1(){if(hasRequiredMain$1)return main$2.exports;hasRequiredMain$1=1;const e=require$$0__default,r=require$$0__default$1,v=require$$2__default,a=require$$3__default,c=require$$4.version,s=["\u{1F510} encrypt with Dotenvx: https://dotenvx.com","\u{1F510} prevent committing .env to code: https://dotenvx.com/precommit","\u{1F510} prevent building .env in docker: https://dotenvx.com/prebuild","\u{1F4E1} add observability to secrets: https://dotenvx.com/ops","\u{1F465} sync secrets across teammates & machines: https://dotenvx.com/ops","\u{1F5C2}\uFE0F backup and recover secrets: https://dotenvx.com/ops","\u2705 audit secrets and track compliance: https://dotenvx.com/ops","\u{1F504} add secrets lifecycle management: https://dotenvx.com/ops","\u{1F511} add access controls to secrets: https://dotenvx.com/ops","\u{1F6E0}\uFE0F run anywhere with `dotenvx run -- yourcommand`","\u2699\uFE0F specify custom .env file path with { path: '/custom/path/.env' }","\u2699\uFE0F enable debug logging with { debug: true }","\u2699\uFE0F override existing env vars with { override: true }","\u2699\uFE0F suppress all logs with { quiet: true }","\u2699\uFE0F write to custom object with { processEnv: myObject }","\u2699\uFE0F load multiple .env files with { path: ['.env.local', '.env'] }"];function d(){return s[Math.floor(Math.random()*s.length)]}function b(S){return typeof S=="string"?!["false","0","no","off",""].includes(S.toLowerCase()):!!S}function T(){return process.stdout.isTTY}function R(S){return T()?`\x1B[2m${S}\x1B[0m`:S}const q=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function A(S){const F={};let D=S.toString();D=D.replace(/\r\n?/mg,`
|
|
3
|
+
`);let V;for(;(V=q.exec(D))!=null;){const u=V[1];let h=V[2]||"";h=h.trim();const o=h[0];h=h.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),o==='"'&&(h=h.replace(/\\n/g,`
|
|
4
|
+
`),h=h.replace(/\\r/g,"\r")),F[u]=h}return F}function L(S){S=S||{};const F=K(S);S.path=F;const D=$.configDotenv(S);if(!D.parsed){const o=new Error(`MISSING_DATA: Cannot parse ${F} for an unknown reason`);throw o.code="MISSING_DATA",o}const V=N(S).split(","),u=V.length;let h;for(let o=0;o<u;o++)try{const i=V[o].trim(),p=M(D,i);h=$.decrypt(p.ciphertext,p.key);break}catch(i){if(o+1>=u)throw i}return $.parse(h)}function w(S){console.error(`[dotenv@${c}][WARN] ${S}`)}function B(S){console.log(`[dotenv@${c}][DEBUG] ${S}`)}function x(S){console.log(`[dotenv@${c}] ${S}`)}function N(S){return S&&S.DOTENV_KEY&&S.DOTENV_KEY.length>0?S.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function M(S,F){let D;try{D=new URL(F)}catch(i){if(i.code==="ERR_INVALID_URL"){const p=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw p.code="INVALID_DOTENV_KEY",p}throw i}const V=D.password;if(!V){const i=new Error("INVALID_DOTENV_KEY: Missing key part");throw i.code="INVALID_DOTENV_KEY",i}const u=D.searchParams.get("environment");if(!u){const i=new Error("INVALID_DOTENV_KEY: Missing environment part");throw i.code="INVALID_DOTENV_KEY",i}const h=`DOTENV_VAULT_${u.toUpperCase()}`,o=S.parsed[h];if(!o){const i=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${h} in your .env.vault file.`);throw i.code="NOT_FOUND_DOTENV_ENVIRONMENT",i}return{ciphertext:o,key:V}}function K(S){let F=null;if(S&&S.path&&S.path.length>0)if(Array.isArray(S.path))for(const D of S.path)e.existsSync(D)&&(F=D.endsWith(".vault")?D:`${D}.vault`);else F=S.path.endsWith(".vault")?S.path:`${S.path}.vault`;else F=r.resolve(process.cwd(),".env.vault");return e.existsSync(F)?F:null}function j(S){return S[0]==="~"?r.join(v.homedir(),S.slice(1)):S}function _(S){const F=b(process.env.DOTENV_CONFIG_DEBUG||S&&S.debug),D=b(process.env.DOTENV_CONFIG_QUIET||S&&S.quiet);(F||!D)&&x("Loading env from encrypted .env.vault");const V=$._parseVault(S);let u=process.env;return S&&S.processEnv!=null&&(u=S.processEnv),$.populate(u,V,S),{parsed:V}}function O(S){const F=r.resolve(process.cwd(),".env");let D="utf8",V=process.env;S&&S.processEnv!=null&&(V=S.processEnv);let u=b(V.DOTENV_CONFIG_DEBUG||S&&S.debug),h=b(V.DOTENV_CONFIG_QUIET||S&&S.quiet);S&&S.encoding?D=S.encoding:u&&B("No encoding is specified. UTF-8 is used by default");let o=[F];if(S&&S.path)if(!Array.isArray(S.path))o=[j(S.path)];else{o=[];for(const t of S.path)o.push(j(t))}let i;const p={};for(const t of o)try{const g=$.parse(e.readFileSync(t,{encoding:D}));$.populate(p,g,S)}catch(g){u&&B(`Failed to load ${t} ${g.message}`),i=g}const l=$.populate(V,p,S);if(u=b(V.DOTENV_CONFIG_DEBUG||u),h=b(V.DOTENV_CONFIG_QUIET||h),u||!h){const t=Object.keys(l).length,g=[];for(const E of o)try{const y=r.relative(process.cwd(),E);g.push(y)}catch(y){u&&B(`Failed to load ${E} ${y.message}`),i=y}x(`injecting env (${t}) from ${g.join(",")} ${R(`-- tip: ${d()}`)}`)}return i?{parsed:p,error:i}:{parsed:p}}function H(S){if(N(S).length===0)return $.configDotenv(S);const F=K(S);return F?$._configVault(S):(w(`You set DOTENV_KEY but you are missing a .env.vault file at ${F}. Did you forget to build it?`),$.configDotenv(S))}function Z(S,F){const D=Buffer.from(F.slice(-64),"hex");let V=Buffer.from(S,"base64");const u=V.subarray(0,12),h=V.subarray(-16);V=V.subarray(12,-16);try{const o=a.createDecipheriv("aes-256-gcm",D,u);return o.setAuthTag(h),`${o.update(V)}${o.final()}`}catch(o){const i=o instanceof RangeError,p=o.message==="Invalid key length",l=o.message==="Unsupported state or unable to authenticate data";if(i||p){const t=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw t.code="INVALID_DOTENV_KEY",t}else if(l){const t=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw t.code="DECRYPTION_FAILED",t}else throw o}}function k(S,F,D={}){const V=!!(D&&D.debug),u=!!(D&&D.override),h={};if(typeof F!="object"){const o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(const o of Object.keys(F))Object.prototype.hasOwnProperty.call(S,o)?(u===!0&&(S[o]=F[o],h[o]=F[o]),V&&B(u===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):(S[o]=F[o],h[o]=F[o]);return h}const $={configDotenv:O,_configVault:_,_parseVault:L,config:H,decrypt:Z,parse:A,populate:k};return main$2.exports.configDotenv=$.configDotenv,main$2.exports._configVault=$._configVault,main$2.exports._parseVault=$._parseVault,main$2.exports.config=$.config,main$2.exports.decrypt=$.decrypt,main$2.exports.parse=$.parse,main$2.exports.populate=$.populate,main$2.exports=$,main$2.exports}var parseEncryptionKeyFromDotenvKey_1,hasRequiredParseEncryptionKeyFromDotenvKey;function requireParseEncryptionKeyFromDotenvKey(){if(hasRequiredParseEncryptionKeyFromDotenvKey)return parseEncryptionKeyFromDotenvKey_1;hasRequiredParseEncryptionKeyFromDotenvKey=1;function e(r){let v;try{v=new URL(r)}catch{throw new Error("INVALID_DOTENV_KEY: Incomplete format. It should be a dotenv uri. (dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development)")}const a=v.password;if(!a)throw new Error("INVALID_DOTENV_KEY: Missing key part");return Buffer.from(a.slice(-64),"hex")}return parseEncryptionKeyFromDotenvKey_1=e,parseEncryptionKeyFromDotenvKey_1}var decrypt_1,hasRequiredDecrypt;function requireDecrypt(){if(hasRequiredDecrypt)return decrypt_1;hasRequiredDecrypt=1;const e=requireMain$1(),r=requireParseEncryptionKeyFromDotenvKey();function v(a,f){const c=r(f);try{return e.decrypt(a,c)}catch(s){if(s.code==="DECRYPTION_FAILED"){const d=new Error("[DECRYPTION_FAILED] Unable to decrypt .env.vault with DOTENV_KEY.");throw d.code="DECRYPTION_FAILED",d.help="[DECRYPTION_FAILED] Run with debug flag [dotenvx run --debug -- yourcommand] or manually run [echo $DOTENV_KEY] to compare it to the one in .env.keys.",d.debug=`[DECRYPTION_FAILED] DOTENV_KEY is ${f}`,d}if(s.code==="ERR_CRYPTO_INVALID_AUTH_TAG"){const d=new Error("[INVALID_CIPHERTEXT] Unable to decrypt what appears to be invalid ciphertext.");throw d.code="INVALID_CIPHERTEXT",d.help="[INVALID_CIPHERTEXT] Run with debug flag [dotenvx run --debug -- yourcommand] or manually check .env.vault.",d.debug=`[INVALID_CIPHERTEXT] ciphertext is '${a}'`,d}throw s}}return decrypt_1=v,decrypt_1}var dist={},utils$3={},hasRequiredUtils$3;function requireUtils$3(){return hasRequiredUtils$3||(hasRequiredUtils$3=1,(function(e){/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=void 0,e.isBytes=r,e.abool=v,e.anumber=a,e.abytes=f,e.ahash=c,e.aexists=s,e.aoutput=d,e.u8=b,e.u32=T,e.clean=R,e.createView=q,e.bytesToHex=w,e.hexToBytes=N,e.hexToNumber=M,e.bytesToNumberBE=K,e.numberToBytesBE=j,e.utf8ToBytes=O,e.bytesToUtf8=H,e.toBytes=Z,e.overlapBytes=k,e.complexOverlapBytes=$,e.concatBytes=S,e.checkOpts=F,e.equalBytes=D,e.getOutput=h,e.setBigUint64=o,e.u64Lengths=i,e.isAligned32=p,e.copyBytes=l;function r(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function v(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function a(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function f(t,...g){if(!r(t))throw new Error("Uint8Array expected");if(g.length>0&&!g.includes(t.length))throw new Error("Uint8Array expected of length "+g+", got length="+t.length)}function c(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");a(t.outputLen),a(t.blockLen)}function s(t,g=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(g&&t.finished)throw new Error("Hash#digest() has already been called")}function d(t,g){f(t);const E=g.outputLen;if(t.length<E)throw new Error("digestInto() expects output buffer of length at least "+E)}function b(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function T(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function R(...t){for(let g=0;g<t.length;g++)t[g].fill(0)}function q(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const A=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",L=Array.from({length:256},(t,g)=>g.toString(16).padStart(2,"0"));function w(t){if(f(t),A)return t.toHex();let g="";for(let E=0;E<t.length;E++)g+=L[t[E]];return g}const B={_0:48,_9:57,A:65,F:70,a:97,f:102};function x(t){if(t>=B._0&&t<=B._9)return t-B._0;if(t>=B.A&&t<=B.F)return t-(B.A-10);if(t>=B.a&&t<=B.f)return t-(B.a-10)}function N(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(A)return Uint8Array.fromHex(t);const g=t.length,E=g/2;if(g%2)throw new Error("hex string expected, got unpadded hex of length "+g);const y=new Uint8Array(E);for(let m=0,ee=0;m<E;m++,ee+=2){const Y=x(t.charCodeAt(ee)),C=x(t.charCodeAt(ee+1));if(Y===void 0||C===void 0){const G=t[ee]+t[ee+1];throw new Error('hex string expected, got non-hex character "'+G+'" at index '+ee)}y[m]=Y*16+C}return y}function M(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":"0x"+t)}function K(t){return M(w(t))}function j(t,g){return N(t.toString(16).padStart(g*2,"0"))}const _=async()=>{};e.nextTick=_;function O(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function H(t){return new TextDecoder().decode(t)}function Z(t){if(typeof t=="string")t=O(t);else if(r(t))t=l(t);else throw new Error("Uint8Array expected, got "+typeof t);return t}function k(t,g){return t.buffer===g.buffer&&t.byteOffset<g.byteOffset+g.byteLength&&g.byteOffset<t.byteOffset+t.byteLength}function $(t,g){if(k(t,g)&&t.byteOffset<g.byteOffset)throw new Error("complex overlap of input and output is not supported")}function S(...t){let g=0;for(let y=0;y<t.length;y++){const m=t[y];f(m),g+=m.length}const E=new Uint8Array(g);for(let y=0,m=0;y<t.length;y++){const ee=t[y];E.set(ee,m),m+=ee.length}return E}function F(t,g){if(g==null||typeof g!="object")throw new Error("options must be defined");return Object.assign(t,g)}function D(t,g){if(t.length!==g.length)return!1;let E=0;for(let y=0;y<t.length;y++)E|=t[y]^g[y];return E===0}class V{}e.Hash=V;const u=(t,g)=>{function E(y,...m){if(f(y),!e.isLE)throw new Error("Non little-endian hardware is not yet supported");if(t.nonceLength!==void 0){const J=m[0];if(!J)throw new Error("nonce / iv required");t.varSizeNonce?f(J):f(J,t.nonceLength)}const ee=t.tagLength;ee&&m[1]!==void 0&&f(m[1]);const Y=g(y,...m),C=(J,ne)=>{if(ne!==void 0){if(J!==2)throw new Error("cipher output not supported");f(ne)}};let G=!1;return{encrypt(J,ne){if(G)throw new Error("cannot encrypt() twice with same key + nonce");return G=!0,f(J),C(Y.encrypt.length,ne),Y.encrypt(J,ne)},decrypt(J,ne){if(f(J),ee&&J.length<ee)throw new Error("invalid ciphertext length: smaller than tagLength="+ee);return C(Y.decrypt.length,ne),Y.decrypt(J,ne)}}}return Object.assign(E,t),E};e.wrapCipher=u;function h(t,g,E=!0){if(g===void 0)return new Uint8Array(t);if(g.length!==t)throw new Error("invalid output length, expected "+t+", got: "+g.length);if(E&&!p(g))throw new Error("invalid output, must be aligned");return g}function o(t,g,E,y){if(typeof t.setBigUint64=="function")return t.setBigUint64(g,E,y);const m=BigInt(32),ee=BigInt(4294967295),Y=Number(E>>m&ee),C=Number(E&ee),G=y?4:0,z=y?0:4;t.setUint32(g+G,Y,y),t.setUint32(g+z,C,y)}function i(t,g,E){v(E);const y=new Uint8Array(16),m=q(y);return o(m,0,BigInt(g),E),o(m,8,BigInt(t),E),y}function p(t){return t.byteOffset%4===0}function l(t){return Uint8Array.from(t)}})(utils$3)),utils$3}var config={},consts={},hasRequiredConsts;function requireConsts(){return hasRequiredConsts||(hasRequiredConsts=1,Object.defineProperty(consts,"__esModule",{value:!0}),consts.AEAD_TAG_LENGTH=consts.XCHACHA20_NONCE_LENGTH=consts.CURVE25519_PUBLIC_KEY_SIZE=consts.ETH_PUBLIC_KEY_SIZE=consts.UNCOMPRESSED_PUBLIC_KEY_SIZE=consts.COMPRESSED_PUBLIC_KEY_SIZE=consts.SECRET_KEY_LENGTH=void 0,consts.SECRET_KEY_LENGTH=32,consts.COMPRESSED_PUBLIC_KEY_SIZE=33,consts.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,consts.ETH_PUBLIC_KEY_SIZE=64,consts.CURVE25519_PUBLIC_KEY_SIZE=32,consts.XCHACHA20_NONCE_LENGTH=24,consts.AEAD_TAG_LENGTH=16),consts}var hasRequiredConfig$1;function requireConfig$1(){return hasRequiredConfig$1||(hasRequiredConfig$1=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ephemeralKeySize=e.symmetricNonceLength=e.symmetricAlgorithm=e.isHkdfKeyCompressed=e.isEphemeralKeyCompressed=e.ellipticCurve=e.ECIES_CONFIG=void 0;var r=requireConsts(),v=(function(){function T(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return T})();e.ECIES_CONFIG=new v;var a=function(){return e.ECIES_CONFIG.ellipticCurve};e.ellipticCurve=a;var f=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed};e.isEphemeralKeyCompressed=f;var c=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed};e.isHkdfKeyCompressed=c;var s=function(){return e.ECIES_CONFIG.symmetricAlgorithm};e.symmetricAlgorithm=s;var d=function(){return e.ECIES_CONFIG.symmetricNonceLength};e.symmetricNonceLength=d;var b=function(){var T={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?r.COMPRESSED_PUBLIC_KEY_SIZE:r.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:r.CURVE25519_PUBLIC_KEY_SIZE,ed25519:r.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in T)return T[e.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};e.ephemeralKeySize=b})(config)),config}var keys={},PrivateKey={},utils$2={},elliptic={},webcrypto={},crypto$1={},hasRequiredCrypto$1;function requireCrypto$1(){return hasRequiredCrypto$1||(hasRequiredCrypto$1=1,Object.defineProperty(crypto$1,"__esModule",{value:!0}),crypto$1.crypto=void 0,crypto$1.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),crypto$1}var hasRequiredWebcrypto;function requireWebcrypto(){return hasRequiredWebcrypto||(hasRequiredWebcrypto=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=a,e.getWebcryptoSubtle=f,e.managedNonce=c;const r=requireCrypto$1(),v=requireUtils$3();function a(T=32){if(r.crypto&&typeof r.crypto.getRandomValues=="function")return r.crypto.getRandomValues(new Uint8Array(T));if(r.crypto&&typeof r.crypto.randomBytes=="function")return Uint8Array.from(r.crypto.randomBytes(T));throw new Error("crypto.getRandomValues must be defined")}function f(){if(r.crypto&&typeof r.crypto.subtle=="object"&&r.crypto.subtle!=null)return r.crypto.subtle;throw new Error("crypto.subtle must be defined")}function c(T){const{nonceLength:R}=T;return(0,v.anumber)(R),((q,...A)=>({encrypt(L,...w){const B=a(R),x=T(q,B,...A).encrypt(L,...w),N=(0,v.concatBytes)(B,x);return x.fill(0),N},decrypt(L,...w){const B=L.subarray(0,R),x=L.subarray(R);return T(q,B,...A).decrypt(x,...w)}}))}e.utils={async encrypt(T,R,q,A){const L=f(),w=await L.importKey("raw",T,R,!0,["encrypt"]),B=await L.encrypt(q,w,A);return new Uint8Array(B)},async decrypt(T,R,q,A){const L=f(),w=await L.importKey("raw",T,R,!0,["decrypt"]),B=await L.decrypt(q,w,A);return new Uint8Array(B)}};const s={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function d(T,R,q){if(T===s.CBC)return{name:s.CBC,iv:R};if(T===s.CTR)return{name:s.CTR,counter:R,length:64};if(T===s.GCM)return q?{name:s.GCM,iv:R,additionalData:q}:{name:s.GCM,iv:R};throw new Error("unknown aes block mode")}function b(T){return(R,q,A)=>{(0,v.abytes)(R),(0,v.abytes)(q);const L={name:T,length:R.length*8},w=d(T,q,A);let B=!1;return{encrypt(x){if((0,v.abytes)(x),B)throw new Error("Cannot encrypt() twice with same key / nonce");return B=!0,e.utils.encrypt(R,L,w,x)},decrypt(x){return(0,v.abytes)(x),e.utils.decrypt(R,L,w,x)}}}}e.cbc=b(s.CBC),e.ctr=b(s.CTR),e.gcm=b(s.GCM)})(webcrypto)),webcrypto}var ed25519={},sha2={},_md={},utils$1={},crypto={},hasRequiredCrypto;function requireCrypto(){return hasRequiredCrypto||(hasRequiredCrypto=1,Object.defineProperty(crypto,"__esModule",{value:!0}),crypto.crypto=void 0,crypto.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),crypto}var hasRequiredUtils$2;function requireUtils$2(){return hasRequiredUtils$2||(hasRequiredUtils$2=1,(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.Hash=e.nextTick=e.swap32IfBE=e.byteSwapIfBE=e.swap8IfBE=e.isLE=void 0,e.isBytes=v,e.anumber=a,e.abytes=f,e.ahash=c,e.aexists=s,e.aoutput=d,e.u8=b,e.u32=T,e.clean=R,e.createView=q,e.rotr=A,e.rotl=L,e.byteSwap=w,e.byteSwap32=B,e.bytesToHex=M,e.hexToBytes=_,e.asyncLoop=H,e.utf8ToBytes=Z,e.bytesToUtf8=k,e.toBytes=$,e.kdfInputToBytes=S,e.concatBytes=F,e.checkOpts=D,e.createHasher=u,e.createOptHasher=h,e.createXOFer=o,e.randomBytes=i;const r=requireCrypto();function v(p){return p instanceof Uint8Array||ArrayBuffer.isView(p)&&p.constructor.name==="Uint8Array"}function a(p){if(!Number.isSafeInteger(p)||p<0)throw new Error("positive integer expected, got "+p)}function f(p,...l){if(!v(p))throw new Error("Uint8Array expected");if(l.length>0&&!l.includes(p.length))throw new Error("Uint8Array expected of length "+l+", got length="+p.length)}function c(p){if(typeof p!="function"||typeof p.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");a(p.outputLen),a(p.blockLen)}function s(p,l=!0){if(p.destroyed)throw new Error("Hash instance has been destroyed");if(l&&p.finished)throw new Error("Hash#digest() has already been called")}function d(p,l){f(p);const t=l.outputLen;if(p.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}function b(p){return new Uint8Array(p.buffer,p.byteOffset,p.byteLength)}function T(p){return new Uint32Array(p.buffer,p.byteOffset,Math.floor(p.byteLength/4))}function R(...p){for(let l=0;l<p.length;l++)p[l].fill(0)}function q(p){return new DataView(p.buffer,p.byteOffset,p.byteLength)}function A(p,l){return p<<32-l|p>>>l}function L(p,l){return p<<l|p>>>32-l>>>0}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function w(p){return p<<24&4278190080|p<<8&16711680|p>>>8&65280|p>>>24&255}e.swap8IfBE=e.isLE?p=>p:p=>w(p),e.byteSwapIfBE=e.swap8IfBE;function B(p){for(let l=0;l<p.length;l++)p[l]=w(p[l]);return p}e.swap32IfBE=e.isLE?p=>p:B;const x=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",N=Array.from({length:256},(p,l)=>l.toString(16).padStart(2,"0"));function M(p){if(f(p),x)return p.toHex();let l="";for(let t=0;t<p.length;t++)l+=N[p[t]];return l}const K={_0:48,_9:57,A:65,F:70,a:97,f:102};function j(p){if(p>=K._0&&p<=K._9)return p-K._0;if(p>=K.A&&p<=K.F)return p-(K.A-10);if(p>=K.a&&p<=K.f)return p-(K.a-10)}function _(p){if(typeof p!="string")throw new Error("hex string expected, got "+typeof p);if(x)return Uint8Array.fromHex(p);const l=p.length,t=l/2;if(l%2)throw new Error("hex string expected, got unpadded hex of length "+l);const g=new Uint8Array(t);for(let E=0,y=0;E<t;E++,y+=2){const m=j(p.charCodeAt(y)),ee=j(p.charCodeAt(y+1));if(m===void 0||ee===void 0){const Y=p[y]+p[y+1];throw new Error('hex string expected, got non-hex character "'+Y+'" at index '+y)}g[E]=m*16+ee}return g}const O=async()=>{};e.nextTick=O;async function H(p,l,t){let g=Date.now();for(let E=0;E<p;E++){t(E);const y=Date.now()-g;y>=0&&y<l||(await(0,e.nextTick)(),g+=y)}}function Z(p){if(typeof p!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(p))}function k(p){return new TextDecoder().decode(p)}function $(p){return typeof p=="string"&&(p=Z(p)),f(p),p}function S(p){return typeof p=="string"&&(p=Z(p)),f(p),p}function F(...p){let l=0;for(let g=0;g<p.length;g++){const E=p[g];f(E),l+=E.length}const t=new Uint8Array(l);for(let g=0,E=0;g<p.length;g++){const y=p[g];t.set(y,E),E+=y.length}return t}function D(p,l){if(l!==void 0&&{}.toString.call(l)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(p,l)}class V{}e.Hash=V;function u(p){const l=g=>p().update($(g)).digest(),t=p();return l.outputLen=t.outputLen,l.blockLen=t.blockLen,l.create=()=>p(),l}function h(p){const l=(g,E)=>p(E).update($(g)).digest(),t=p({});return l.outputLen=t.outputLen,l.blockLen=t.blockLen,l.create=g=>p(g),l}function o(p){const l=(g,E)=>p(E).update($(g)).digest(),t=p({});return l.outputLen=t.outputLen,l.blockLen=t.blockLen,l.create=g=>p(g),l}e.wrapConstructor=u,e.wrapConstructorWithOpts=h,e.wrapXOFConstructorWithOpts=o;function i(p=32){if(r.crypto&&typeof r.crypto.getRandomValues=="function")return r.crypto.getRandomValues(new Uint8Array(p));if(r.crypto&&typeof r.crypto.randomBytes=="function")return Uint8Array.from(r.crypto.randomBytes(p));throw new Error("crypto.getRandomValues must be defined")}})(utils$1)),utils$1}var hasRequired_md;function require_md(){if(hasRequired_md)return _md;hasRequired_md=1,Object.defineProperty(_md,"__esModule",{value:!0}),_md.SHA512_IV=_md.SHA384_IV=_md.SHA224_IV=_md.SHA256_IV=_md.HashMD=void 0,_md.setBigUint64=r,_md.Chi=v,_md.Maj=a;const e=requireUtils$2();function r(c,s,d,b){if(typeof c.setBigUint64=="function")return c.setBigUint64(s,d,b);const T=BigInt(32),R=BigInt(4294967295),q=Number(d>>T&R),A=Number(d&R),L=b?4:0,w=b?0:4;c.setUint32(s+L,q,b),c.setUint32(s+w,A,b)}function v(c,s,d){return c&s^~c&d}function a(c,s,d){return c&s^c&d^s&d}class f extends e.Hash{constructor(s,d,b,T){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=s,this.outputLen=d,this.padOffset=b,this.isLE=T,this.buffer=new Uint8Array(s),this.view=(0,e.createView)(this.buffer)}update(s){(0,e.aexists)(this),s=(0,e.toBytes)(s),(0,e.abytes)(s);const{view:d,buffer:b,blockLen:T}=this,R=s.length;for(let q=0;q<R;){const A=Math.min(T-this.pos,R-q);if(A===T){const L=(0,e.createView)(s);for(;T<=R-q;q+=T)this.process(L,q);continue}b.set(s.subarray(q,q+A),this.pos),this.pos+=A,q+=A,this.pos===T&&(this.process(d,0),this.pos=0)}return this.length+=s.length,this.roundClean(),this}digestInto(s){(0,e.aexists)(this),(0,e.aoutput)(s,this),this.finished=!0;const{buffer:d,view:b,blockLen:T,isLE:R}=this;let{pos:q}=this;d[q++]=128,(0,e.clean)(this.buffer.subarray(q)),this.padOffset>T-q&&(this.process(b,0),q=0);for(let x=q;x<T;x++)d[x]=0;r(b,T-8,BigInt(this.length*8),R),this.process(b,0);const A=(0,e.createView)(s),L=this.outputLen;if(L%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const w=L/4,B=this.get();if(w>B.length)throw new Error("_sha2: outputLen bigger than state");for(let x=0;x<w;x++)A.setUint32(4*x,B[x],R)}digest(){const{buffer:s,outputLen:d}=this;this.digestInto(s);const b=s.slice(0,d);return this.destroy(),b}_cloneInto(s){s||(s=new this.constructor),s.set(...this.get());const{blockLen:d,buffer:b,length:T,finished:R,destroyed:q,pos:A}=this;return s.destroyed=q,s.finished=R,s.length=T,s.pos=A,T%d&&s.buffer.set(b),s}clone(){return this._cloneInto()}}return _md.HashMD=f,_md.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),_md.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),_md.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),_md.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),_md}var _u64={},hasRequired_u64;function require_u64(){if(hasRequired_u64)return _u64;hasRequired_u64=1,Object.defineProperty(_u64,"__esModule",{value:!0}),_u64.toBig=_u64.shrSL=_u64.shrSH=_u64.rotrSL=_u64.rotrSH=_u64.rotrBL=_u64.rotrBH=_u64.rotr32L=_u64.rotr32H=_u64.rotlSL=_u64.rotlSH=_u64.rotlBL=_u64.rotlBH=_u64.add5L=_u64.add5H=_u64.add4L=_u64.add4H=_u64.add3L=_u64.add3H=void 0,_u64.add=N,_u64.fromBig=v,_u64.split=a;const e=BigInt(2**32-1),r=BigInt(32);function v(k,$=!1){return $?{h:Number(k&e),l:Number(k>>r&e)}:{h:Number(k>>r&e)|0,l:Number(k&e)|0}}function a(k,$=!1){const S=k.length;let F=new Uint32Array(S),D=new Uint32Array(S);for(let V=0;V<S;V++){const{h:u,l:h}=v(k[V],$);[F[V],D[V]]=[u,h]}return[F,D]}const f=(k,$)=>BigInt(k>>>0)<<r|BigInt($>>>0);_u64.toBig=f;const c=(k,$,S)=>k>>>S;_u64.shrSH=c;const s=(k,$,S)=>k<<32-S|$>>>S;_u64.shrSL=s;const d=(k,$,S)=>k>>>S|$<<32-S;_u64.rotrSH=d;const b=(k,$,S)=>k<<32-S|$>>>S;_u64.rotrSL=b;const T=(k,$,S)=>k<<64-S|$>>>S-32;_u64.rotrBH=T;const R=(k,$,S)=>k>>>S-32|$<<64-S;_u64.rotrBL=R;const q=(k,$)=>$;_u64.rotr32H=q;const A=(k,$)=>k;_u64.rotr32L=A;const L=(k,$,S)=>k<<S|$>>>32-S;_u64.rotlSH=L;const w=(k,$,S)=>$<<S|k>>>32-S;_u64.rotlSL=w;const B=(k,$,S)=>$<<S-32|k>>>64-S;_u64.rotlBH=B;const x=(k,$,S)=>k<<S-32|$>>>64-S;_u64.rotlBL=x;function N(k,$,S,F){const D=($>>>0)+(F>>>0);return{h:k+S+(D/2**32|0)|0,l:D|0}}const M=(k,$,S)=>(k>>>0)+($>>>0)+(S>>>0);_u64.add3L=M;const K=(k,$,S,F)=>$+S+F+(k/2**32|0)|0;_u64.add3H=K;const j=(k,$,S,F)=>(k>>>0)+($>>>0)+(S>>>0)+(F>>>0);_u64.add4L=j;const _=(k,$,S,F,D)=>$+S+F+D+(k/2**32|0)|0;_u64.add4H=_;const O=(k,$,S,F,D)=>(k>>>0)+($>>>0)+(S>>>0)+(F>>>0)+(D>>>0);_u64.add5L=O;const H=(k,$,S,F,D,V)=>$+S+F+D+V+(k/2**32|0)|0;_u64.add5H=H;const Z={fromBig:v,split:a,toBig:f,shrSH:c,shrSL:s,rotrSH:d,rotrSL:b,rotrBH:T,rotrBL:R,rotr32H:q,rotr32L:A,rotlSH:L,rotlSL:w,rotlBH:B,rotlBL:x,add:N,add3L:M,add3H:K,add4L:j,add4H:_,add5H:H,add5L:O};return _u64.default=Z,_u64}var hasRequiredSha2;function requireSha2(){if(hasRequiredSha2)return sha2;hasRequiredSha2=1,Object.defineProperty(sha2,"__esModule",{value:!0}),sha2.sha512_224=sha2.sha512_256=sha2.sha384=sha2.sha512=sha2.sha224=sha2.sha256=sha2.SHA512_256=sha2.SHA512_224=sha2.SHA384=sha2.SHA512=sha2.SHA224=sha2.SHA256=void 0;const e=require_md(),r=require_u64(),v=requireUtils$2(),a=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),f=new Uint32Array(64);class c extends e.HashMD{constructor(K=32){super(64,K,8,!1),this.A=e.SHA256_IV[0]|0,this.B=e.SHA256_IV[1]|0,this.C=e.SHA256_IV[2]|0,this.D=e.SHA256_IV[3]|0,this.E=e.SHA256_IV[4]|0,this.F=e.SHA256_IV[5]|0,this.G=e.SHA256_IV[6]|0,this.H=e.SHA256_IV[7]|0}get(){const{A:K,B:j,C:_,D:O,E:H,F:Z,G:k,H:$}=this;return[K,j,_,O,H,Z,k,$]}set(K,j,_,O,H,Z,k,$){this.A=K|0,this.B=j|0,this.C=_|0,this.D=O|0,this.E=H|0,this.F=Z|0,this.G=k|0,this.H=$|0}process(K,j){for(let D=0;D<16;D++,j+=4)f[D]=K.getUint32(j,!1);for(let D=16;D<64;D++){const V=f[D-15],u=f[D-2],h=(0,v.rotr)(V,7)^(0,v.rotr)(V,18)^V>>>3,o=(0,v.rotr)(u,17)^(0,v.rotr)(u,19)^u>>>10;f[D]=o+f[D-7]+h+f[D-16]|0}let{A:_,B:O,C:H,D:Z,E:k,F:$,G:S,H:F}=this;for(let D=0;D<64;D++){const V=(0,v.rotr)(k,6)^(0,v.rotr)(k,11)^(0,v.rotr)(k,25),u=F+V+(0,e.Chi)(k,$,S)+a[D]+f[D]|0,o=((0,v.rotr)(_,2)^(0,v.rotr)(_,13)^(0,v.rotr)(_,22))+(0,e.Maj)(_,O,H)|0;F=S,S=$,$=k,k=Z+u|0,Z=H,H=O,O=_,_=u+o|0}_=_+this.A|0,O=O+this.B|0,H=H+this.C|0,Z=Z+this.D|0,k=k+this.E|0,$=$+this.F|0,S=S+this.G|0,F=F+this.H|0,this.set(_,O,H,Z,k,$,S,F)}roundClean(){(0,v.clean)(f)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,v.clean)(this.buffer)}}sha2.SHA256=c;class s extends c{constructor(){super(28),this.A=e.SHA224_IV[0]|0,this.B=e.SHA224_IV[1]|0,this.C=e.SHA224_IV[2]|0,this.D=e.SHA224_IV[3]|0,this.E=e.SHA224_IV[4]|0,this.F=e.SHA224_IV[5]|0,this.G=e.SHA224_IV[6]|0,this.H=e.SHA224_IV[7]|0}}sha2.SHA224=s;const d=r.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(M=>BigInt(M))),b=d[0],T=d[1],R=new Uint32Array(80),q=new Uint32Array(80);class A extends e.HashMD{constructor(K=64){super(128,K,16,!1),this.Ah=e.SHA512_IV[0]|0,this.Al=e.SHA512_IV[1]|0,this.Bh=e.SHA512_IV[2]|0,this.Bl=e.SHA512_IV[3]|0,this.Ch=e.SHA512_IV[4]|0,this.Cl=e.SHA512_IV[5]|0,this.Dh=e.SHA512_IV[6]|0,this.Dl=e.SHA512_IV[7]|0,this.Eh=e.SHA512_IV[8]|0,this.El=e.SHA512_IV[9]|0,this.Fh=e.SHA512_IV[10]|0,this.Fl=e.SHA512_IV[11]|0,this.Gh=e.SHA512_IV[12]|0,this.Gl=e.SHA512_IV[13]|0,this.Hh=e.SHA512_IV[14]|0,this.Hl=e.SHA512_IV[15]|0}get(){const{Ah:K,Al:j,Bh:_,Bl:O,Ch:H,Cl:Z,Dh:k,Dl:$,Eh:S,El:F,Fh:D,Fl:V,Gh:u,Gl:h,Hh:o,Hl:i}=this;return[K,j,_,O,H,Z,k,$,S,F,D,V,u,h,o,i]}set(K,j,_,O,H,Z,k,$,S,F,D,V,u,h,o,i){this.Ah=K|0,this.Al=j|0,this.Bh=_|0,this.Bl=O|0,this.Ch=H|0,this.Cl=Z|0,this.Dh=k|0,this.Dl=$|0,this.Eh=S|0,this.El=F|0,this.Fh=D|0,this.Fl=V|0,this.Gh=u|0,this.Gl=h|0,this.Hh=o|0,this.Hl=i|0}process(K,j){for(let t=0;t<16;t++,j+=4)R[t]=K.getUint32(j),q[t]=K.getUint32(j+=4);for(let t=16;t<80;t++){const g=R[t-15]|0,E=q[t-15]|0,y=r.rotrSH(g,E,1)^r.rotrSH(g,E,8)^r.shrSH(g,E,7),m=r.rotrSL(g,E,1)^r.rotrSL(g,E,8)^r.shrSL(g,E,7),ee=R[t-2]|0,Y=q[t-2]|0,C=r.rotrSH(ee,Y,19)^r.rotrBH(ee,Y,61)^r.shrSH(ee,Y,6),G=r.rotrSL(ee,Y,19)^r.rotrBL(ee,Y,61)^r.shrSL(ee,Y,6),z=r.add4L(m,G,q[t-7],q[t-16]),J=r.add4H(z,y,C,R[t-7],R[t-16]);R[t]=J|0,q[t]=z|0}let{Ah:_,Al:O,Bh:H,Bl:Z,Ch:k,Cl:$,Dh:S,Dl:F,Eh:D,El:V,Fh:u,Fl:h,Gh:o,Gl:i,Hh:p,Hl:l}=this;for(let t=0;t<80;t++){const g=r.rotrSH(D,V,14)^r.rotrSH(D,V,18)^r.rotrBH(D,V,41),E=r.rotrSL(D,V,14)^r.rotrSL(D,V,18)^r.rotrBL(D,V,41),y=D&u^~D&o,m=V&h^~V&i,ee=r.add5L(l,E,m,T[t],q[t]),Y=r.add5H(ee,p,g,y,b[t],R[t]),C=ee|0,G=r.rotrSH(_,O,28)^r.rotrBH(_,O,34)^r.rotrBH(_,O,39),z=r.rotrSL(_,O,28)^r.rotrBL(_,O,34)^r.rotrBL(_,O,39),J=_&H^_&k^H&k,ne=O&Z^O&$^Z&$;p=o|0,l=i|0,o=u|0,i=h|0,u=D|0,h=V|0,{h:D,l:V}=r.add(S|0,F|0,Y|0,C|0),S=k|0,F=$|0,k=H|0,$=Z|0,H=_|0,Z=O|0;const U=r.add3L(C,z,ne);_=r.add3H(U,Y,G,J),O=U|0}({h:_,l:O}=r.add(this.Ah|0,this.Al|0,_|0,O|0)),{h:H,l:Z}=r.add(this.Bh|0,this.Bl|0,H|0,Z|0),{h:k,l:$}=r.add(this.Ch|0,this.Cl|0,k|0,$|0),{h:S,l:F}=r.add(this.Dh|0,this.Dl|0,S|0,F|0),{h:D,l:V}=r.add(this.Eh|0,this.El|0,D|0,V|0),{h:u,l:h}=r.add(this.Fh|0,this.Fl|0,u|0,h|0),{h:o,l:i}=r.add(this.Gh|0,this.Gl|0,o|0,i|0),{h:p,l}=r.add(this.Hh|0,this.Hl|0,p|0,l|0),this.set(_,O,H,Z,k,$,S,F,D,V,u,h,o,i,p,l)}roundClean(){(0,v.clean)(R,q)}destroy(){(0,v.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}sha2.SHA512=A;class L extends A{constructor(){super(48),this.Ah=e.SHA384_IV[0]|0,this.Al=e.SHA384_IV[1]|0,this.Bh=e.SHA384_IV[2]|0,this.Bl=e.SHA384_IV[3]|0,this.Ch=e.SHA384_IV[4]|0,this.Cl=e.SHA384_IV[5]|0,this.Dh=e.SHA384_IV[6]|0,this.Dl=e.SHA384_IV[7]|0,this.Eh=e.SHA384_IV[8]|0,this.El=e.SHA384_IV[9]|0,this.Fh=e.SHA384_IV[10]|0,this.Fl=e.SHA384_IV[11]|0,this.Gh=e.SHA384_IV[12]|0,this.Gl=e.SHA384_IV[13]|0,this.Hh=e.SHA384_IV[14]|0,this.Hl=e.SHA384_IV[15]|0}}sha2.SHA384=L;const w=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),B=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class x extends A{constructor(){super(28),this.Ah=w[0]|0,this.Al=w[1]|0,this.Bh=w[2]|0,this.Bl=w[3]|0,this.Ch=w[4]|0,this.Cl=w[5]|0,this.Dh=w[6]|0,this.Dl=w[7]|0,this.Eh=w[8]|0,this.El=w[9]|0,this.Fh=w[10]|0,this.Fl=w[11]|0,this.Gh=w[12]|0,this.Gl=w[13]|0,this.Hh=w[14]|0,this.Hl=w[15]|0}}sha2.SHA512_224=x;class N extends A{constructor(){super(32),this.Ah=B[0]|0,this.Al=B[1]|0,this.Bh=B[2]|0,this.Bl=B[3]|0,this.Ch=B[4]|0,this.Cl=B[5]|0,this.Dh=B[6]|0,this.Dl=B[7]|0,this.Eh=B[8]|0,this.El=B[9]|0,this.Fh=B[10]|0,this.Fl=B[11]|0,this.Gh=B[12]|0,this.Gl=B[13]|0,this.Hh=B[14]|0,this.Hl=B[15]|0}}return sha2.SHA512_256=N,sha2.sha256=(0,v.createHasher)(()=>new c),sha2.sha224=(0,v.createHasher)(()=>new s),sha2.sha512=(0,v.createHasher)(()=>new A),sha2.sha384=(0,v.createHasher)(()=>new L),sha2.sha512_256=(0,v.createHasher)(()=>new N),sha2.sha512_224=(0,v.createHasher)(()=>new x),sha2}var curve={},utils={},hasRequiredUtils$1;function requireUtils$1(){return hasRequiredUtils$1||(hasRequiredUtils$1=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.notImplemented=e.bitMask=e.utf8ToBytes=e.randomBytes=e.isBytes=e.hexToBytes=e.concatBytes=e.bytesToUtf8=e.bytesToHex=e.anumber=e.abytes=void 0,e.abool=c,e._abool2=s,e._abytes2=d,e.numberToHexUnpadded=b,e.hexToNumber=T,e.bytesToNumberBE=R,e.bytesToNumberLE=q,e.numberToBytesBE=A,e.numberToBytesLE=L,e.numberToVarBytesBE=w,e.ensureBytes=B,e.equalBytes=x,e.copyBytes=N,e.asciiToBytes=M,e.inRange=j,e.aInRange=_,e.bitLen=O,e.bitGet=H,e.bitSet=Z,e.createHmacDrbg=$,e.validateObject=F,e.isHash=D,e._validateObject=V,e.memoized=h;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=requireUtils$2();var v=requireUtils$2();Object.defineProperty(e,"abytes",{enumerable:!0,get:function(){return v.abytes}}),Object.defineProperty(e,"anumber",{enumerable:!0,get:function(){return v.anumber}}),Object.defineProperty(e,"bytesToHex",{enumerable:!0,get:function(){return v.bytesToHex}}),Object.defineProperty(e,"bytesToUtf8",{enumerable:!0,get:function(){return v.bytesToUtf8}}),Object.defineProperty(e,"concatBytes",{enumerable:!0,get:function(){return v.concatBytes}}),Object.defineProperty(e,"hexToBytes",{enumerable:!0,get:function(){return v.hexToBytes}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return v.isBytes}}),Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return v.randomBytes}}),Object.defineProperty(e,"utf8ToBytes",{enumerable:!0,get:function(){return v.utf8ToBytes}});const a=BigInt(0),f=BigInt(1);function c(o,i){if(typeof i!="boolean")throw new Error(o+" boolean expected, got "+i)}function s(o,i=""){if(typeof o!="boolean"){const p=i&&`"${i}"`;throw new Error(p+"expected boolean, got type="+typeof o)}return o}function d(o,i,p=""){const l=(0,r.isBytes)(o),t=o?.length,g=i!==void 0;if(!l||g&&t!==i){const E=p&&`"${p}" `,y=g?` of length ${i}`:"",m=l?`length=${t}`:`type=${typeof o}`;throw new Error(E+"expected Uint8Array"+y+", got "+m)}return o}function b(o){const i=o.toString(16);return i.length&1?"0"+i:i}function T(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);return o===""?a:BigInt("0x"+o)}function R(o){return T((0,r.bytesToHex)(o))}function q(o){return(0,r.abytes)(o),T((0,r.bytesToHex)(Uint8Array.from(o).reverse()))}function A(o,i){return(0,r.hexToBytes)(o.toString(16).padStart(i*2,"0"))}function L(o,i){return A(o,i).reverse()}function w(o){return(0,r.hexToBytes)(b(o))}function B(o,i,p){let l;if(typeof i=="string")try{l=(0,r.hexToBytes)(i)}catch(g){throw new Error(o+" must be hex string or Uint8Array, cause: "+g)}else if((0,r.isBytes)(i))l=Uint8Array.from(i);else throw new Error(o+" must be hex string or Uint8Array");const t=l.length;if(typeof p=="number"&&t!==p)throw new Error(o+" of length "+p+" expected, got "+t);return l}function x(o,i){if(o.length!==i.length)return!1;let p=0;for(let l=0;l<o.length;l++)p|=o[l]^i[l];return p===0}function N(o){return Uint8Array.from(o)}function M(o){return Uint8Array.from(o,(i,p)=>{const l=i.charCodeAt(0);if(i.length!==1||l>127)throw new Error(`string contains non-ASCII character "${o[p]}" with code ${l} at position ${p}`);return l})}const K=o=>typeof o=="bigint"&&a<=o;function j(o,i,p){return K(o)&&K(i)&&K(p)&&i<=o&&o<p}function _(o,i,p,l){if(!j(i,p,l))throw new Error("expected valid "+o+": "+p+" <= n < "+l+", got "+i)}function O(o){let i;for(i=0;o>a;o>>=f,i+=1);return i}function H(o,i){return o>>BigInt(i)&f}function Z(o,i,p){return o|(p?f:a)<<BigInt(i)}const k=o=>(f<<BigInt(o))-f;e.bitMask=k;function $(o,i,p){if(typeof o!="number"||o<2)throw new Error("hashLen must be a number");if(typeof i!="number"||i<2)throw new Error("qByteLen must be a number");if(typeof p!="function")throw new Error("hmacFn must be a function");const l=z=>new Uint8Array(z),t=z=>Uint8Array.of(z);let g=l(o),E=l(o),y=0;const m=()=>{g.fill(1),E.fill(0),y=0},ee=(...z)=>p(E,g,...z),Y=(z=l(0))=>{E=ee(t(0),z),g=ee(),z.length!==0&&(E=ee(t(1),z),g=ee())},C=()=>{if(y++>=1e3)throw new Error("drbg: tried 1000 values");let z=0;const J=[];for(;z<i;){g=ee();const ne=g.slice();J.push(ne),z+=g.length}return(0,r.concatBytes)(...J)};return(z,J)=>{m(),Y(z);let ne;for(;!(ne=J(C()));)Y();return m(),ne}}const S={bigint:o=>typeof o=="bigint",function:o=>typeof o=="function",boolean:o=>typeof o=="boolean",string:o=>typeof o=="string",stringOrUint8Array:o=>typeof o=="string"||(0,r.isBytes)(o),isSafeInteger:o=>Number.isSafeInteger(o),array:o=>Array.isArray(o),field:(o,i)=>i.Fp.isValid(o),hash:o=>typeof o=="function"&&Number.isSafeInteger(o.outputLen)};function F(o,i,p={}){const l=(t,g,E)=>{const y=S[g];if(typeof y!="function")throw new Error("invalid validator function");const m=o[t];if(!(E&&m===void 0)&&!y(m,o))throw new Error("param "+String(t)+" is invalid. Expected "+g+", got "+m)};for(const[t,g]of Object.entries(i))l(t,g,!1);for(const[t,g]of Object.entries(p))l(t,g,!0);return o}function D(o){return typeof o=="function"&&Number.isSafeInteger(o.outputLen)}function V(o,i,p={}){if(!o||typeof o!="object")throw new Error("expected valid options object");function l(t,g,E){const y=o[t];if(E&&y===void 0)return;const m=typeof y;if(m!==g||y===null)throw new Error(`param "${t}" is invalid: expected ${g}, got ${m}`)}Object.entries(i).forEach(([t,g])=>l(t,g,!1)),Object.entries(p).forEach(([t,g])=>l(t,g,!0))}const u=()=>{throw new Error("not implemented")};e.notImplemented=u;function h(o){const i=new WeakMap;return(p,...l)=>{const t=i.get(p);if(t!==void 0)return t;const g=o(p,...l);return i.set(p,g),g}}})(utils)),utils}var modular={},hasRequiredModular;function requireModular(){if(hasRequiredModular)return modular;hasRequiredModular=1,Object.defineProperty(modular,"__esModule",{value:!0}),modular.isNegativeLE=void 0,modular.mod=q,modular.pow=A,modular.pow2=L,modular.invert=w,modular.tonelliShanks=K,modular.FpSqrt=j,modular.validateField=H,modular.FpPow=Z,modular.FpInvertBatch=k,modular.FpDiv=$,modular.FpLegendre=S,modular.FpIsSquare=F,modular.nLength=D,modular.Field=V,modular.FpSqrtOdd=u,modular.FpSqrtEven=h,modular.hashToPrivateScalar=o,modular.getFieldBytesLength=i,modular.getMinHashLength=p,modular.mapHashToField=l;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireUtils$1(),r=BigInt(0),v=BigInt(1),a=BigInt(2),f=BigInt(3),c=BigInt(4),s=BigInt(5),d=BigInt(7),b=BigInt(8),T=BigInt(9),R=BigInt(16);function q(t,g){const E=t%g;return E>=r?E:g+E}function A(t,g,E){return Z(V(E),t,g)}function L(t,g,E){let y=t;for(;g-- >r;)y*=y,y%=E;return y}function w(t,g){if(t===r)throw new Error("invert: expected non-zero number");if(g<=r)throw new Error("invert: expected positive modulus, got "+g);let E=q(t,g),y=g,m=r,ee=v;for(;E!==r;){const C=y/E,G=y%E,z=m-ee*C;y=E,E=G,m=ee,ee=z}if(y!==v)throw new Error("invert: does not exist");return q(m,g)}function B(t,g,E){if(!t.eql(t.sqr(g),E))throw new Error("Cannot find square root")}function x(t,g){const E=(t.ORDER+v)/c,y=t.pow(g,E);return B(t,y,g),y}function N(t,g){const E=(t.ORDER-s)/b,y=t.mul(g,a),m=t.pow(y,E),ee=t.mul(g,m),Y=t.mul(t.mul(ee,a),m),C=t.mul(ee,t.sub(Y,t.ONE));return B(t,C,g),C}function M(t){const g=V(t),E=K(t),y=E(g,g.neg(g.ONE)),m=E(g,y),ee=E(g,g.neg(y)),Y=(t+d)/R;return(C,G)=>{let z=C.pow(G,Y),J=C.mul(z,y);const ne=C.mul(z,m),U=C.mul(z,ee),W=C.eql(C.sqr(J),G),re=C.eql(C.sqr(ne),G);z=C.cmov(z,J,W),J=C.cmov(U,ne,re);const ue=C.eql(C.sqr(J),G),de=C.cmov(z,J,ue);return B(C,de,G),de}}function K(t){if(t<f)throw new Error("sqrt is not defined for small field");let g=t-v,E=0;for(;g%a===r;)g/=a,E++;let y=a;const m=V(t);for(;S(m,y)===1;)if(y++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(E===1)return x;let ee=m.pow(y,g);const Y=(g+v)/a;return function(G,z){if(G.is0(z))return z;if(S(G,z)!==1)throw new Error("Cannot find square root");let J=E,ne=G.mul(G.ONE,ee),U=G.pow(z,g),W=G.pow(z,Y);for(;!G.eql(U,G.ONE);){if(G.is0(U))return G.ZERO;let re=1,ue=G.sqr(U);for(;!G.eql(ue,G.ONE);)if(re++,ue=G.sqr(ue),re===J)throw new Error("Cannot find square root");const de=v<<BigInt(J-re-1),se=G.pow(ne,de);J=re,ne=G.sqr(se),U=G.mul(U,ne),W=G.mul(W,se)}return W}}function j(t){return t%c===f?x:t%b===s?N:t%R===T?M(t):K(t)}const _=(t,g)=>(q(t,g)&v)===v;modular.isNegativeLE=_;const O=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function H(t){const g={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},E=O.reduce((y,m)=>(y[m]="function",y),g);return(0,e._validateObject)(t,E),t}function Z(t,g,E){if(E<r)throw new Error("invalid exponent, negatives unsupported");if(E===r)return t.ONE;if(E===v)return g;let y=t.ONE,m=g;for(;E>r;)E&v&&(y=t.mul(y,m)),m=t.sqr(m),E>>=v;return y}function k(t,g,E=!1){const y=new Array(g.length).fill(E?t.ZERO:void 0),m=g.reduce((Y,C,G)=>t.is0(C)?Y:(y[G]=Y,t.mul(Y,C)),t.ONE),ee=t.inv(m);return g.reduceRight((Y,C,G)=>t.is0(C)?Y:(y[G]=t.mul(Y,y[G]),t.mul(Y,C)),ee),y}function $(t,g,E){return t.mul(g,typeof E=="bigint"?w(E,t.ORDER):t.inv(E))}function S(t,g){const E=(t.ORDER-v)/a,y=t.pow(g,E),m=t.eql(y,t.ONE),ee=t.eql(y,t.ZERO),Y=t.eql(y,t.neg(t.ONE));if(!m&&!ee&&!Y)throw new Error("invalid Legendre symbol result");return m?1:ee?0:-1}function F(t,g){return S(t,g)===1}function D(t,g){g!==void 0&&(0,e.anumber)(g);const E=g!==void 0?g:t.toString(2).length,y=Math.ceil(E/8);return{nBitLength:E,nByteLength:y}}function V(t,g,E=!1,y={}){if(t<=r)throw new Error("invalid field: expected ORDER > 0, got "+t);let m,ee,Y=!1,C;if(typeof g=="object"&&g!=null){if(y.sqrt||E)throw new Error("cannot specify opts in two arguments");const U=g;U.BITS&&(m=U.BITS),U.sqrt&&(ee=U.sqrt),typeof U.isLE=="boolean"&&(E=U.isLE),typeof U.modFromBytes=="boolean"&&(Y=U.modFromBytes),C=U.allowedLengths}else typeof g=="number"&&(m=g),y.sqrt&&(ee=y.sqrt);const{nBitLength:G,nByteLength:z}=D(t,m);if(z>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let J;const ne=Object.freeze({ORDER:t,isLE:E,BITS:G,BYTES:z,MASK:(0,e.bitMask)(G),ZERO:r,ONE:v,allowedLengths:C,create:U=>q(U,t),isValid:U=>{if(typeof U!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof U);return r<=U&&U<t},is0:U=>U===r,isValidNot0:U=>!ne.is0(U)&&ne.isValid(U),isOdd:U=>(U&v)===v,neg:U=>q(-U,t),eql:(U,W)=>U===W,sqr:U=>q(U*U,t),add:(U,W)=>q(U+W,t),sub:(U,W)=>q(U-W,t),mul:(U,W)=>q(U*W,t),pow:(U,W)=>Z(ne,U,W),div:(U,W)=>q(U*w(W,t),t),sqrN:U=>U*U,addN:(U,W)=>U+W,subN:(U,W)=>U-W,mulN:(U,W)=>U*W,inv:U=>w(U,t),sqrt:ee||(U=>(J||(J=j(t)),J(ne,U))),toBytes:U=>E?(0,e.numberToBytesLE)(U,z):(0,e.numberToBytesBE)(U,z),fromBytes:(U,W=!0)=>{if(C){if(!C.includes(U.length)||U.length>z)throw new Error("Field.fromBytes: expected "+C+" bytes, got "+U.length);const ue=new Uint8Array(z);ue.set(U,E?0:ue.length-U.length),U=ue}if(U.length!==z)throw new Error("Field.fromBytes: expected "+z+" bytes, got "+U.length);let re=E?(0,e.bytesToNumberLE)(U):(0,e.bytesToNumberBE)(U);if(Y&&(re=q(re,t)),!W&&!ne.isValid(re))throw new Error("invalid field element: outside of range 0..ORDER");return re},invertBatch:U=>k(ne,U),cmov:(U,W,re)=>re?W:U});return Object.freeze(ne)}function u(t,g){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const E=t.sqrt(g);return t.isOdd(E)?E:t.neg(E)}function h(t,g){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const E=t.sqrt(g);return t.isOdd(E)?t.neg(E):E}function o(t,g,E=!1){t=(0,e.ensureBytes)("privateHash",t);const y=t.length,m=D(g).nByteLength+8;if(m<24||y<m||y>1024)throw new Error("hashToPrivateScalar: expected "+m+"-1024 bytes of input, got "+y);const ee=E?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t);return q(ee,g-v)+v}function i(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const g=t.toString(2).length;return Math.ceil(g/8)}function p(t){const g=i(t);return g+Math.ceil(g/2)}function l(t,g,E=!1){const y=t.length,m=i(g),ee=p(g);if(y<16||y<ee||y>1024)throw new Error("expected "+ee+"-1024 bytes of input, got "+y);const Y=E?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t),C=q(Y,g-v)+v;return E?(0,e.numberToBytesLE)(C,m):(0,e.numberToBytesBE)(C,m)}return modular}var hasRequiredCurve;function requireCurve(){if(hasRequiredCurve)return curve;hasRequiredCurve=1,Object.defineProperty(curve,"__esModule",{value:!0}),curve.wNAF=void 0,curve.negateCt=f,curve.normalizeZ=c,curve.mulEndoUnsafe=x,curve.pippenger=N,curve.precomputeMSMUnsafe=M,curve.validateBasic=K,curve._createCurveFields=_;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireUtils$1(),r=requireModular(),v=BigInt(0),a=BigInt(1);function f(O,H){const Z=H.negate();return O?Z:H}function c(O,H){const Z=(0,r.FpInvertBatch)(O.Fp,H.map(k=>k.Z));return H.map((k,$)=>O.fromAffine(k.toAffine(Z[$])))}function s(O,H){if(!Number.isSafeInteger(O)||O<=0||O>H)throw new Error("invalid window size, expected [1.."+H+"], got W="+O)}function d(O,H){s(O,H);const Z=Math.ceil(H/O)+1,k=2**(O-1),$=2**O,S=(0,e.bitMask)(O),F=BigInt(O);return{windows:Z,windowSize:k,mask:S,maxNumber:$,shiftBy:F}}function b(O,H,Z){const{windowSize:k,mask:$,maxNumber:S,shiftBy:F}=Z;let D=Number(O&$),V=O>>F;D>k&&(D-=S,V+=a);const u=H*k,h=u+Math.abs(D)-1,o=D===0,i=D<0,p=H%2!==0;return{nextN:V,offset:h,isZero:o,isNeg:i,isNegF:p,offsetF:u}}function T(O,H){if(!Array.isArray(O))throw new Error("array expected");O.forEach((Z,k)=>{if(!(Z instanceof H))throw new Error("invalid point at index "+k)})}function R(O,H){if(!Array.isArray(O))throw new Error("array of scalars expected");O.forEach((Z,k)=>{if(!H.isValid(Z))throw new Error("invalid scalar at index "+k)})}const q=new WeakMap,A=new WeakMap;function L(O){return A.get(O)||1}function w(O){if(O!==v)throw new Error("invalid wNAF")}class B{constructor(H,Z){this.BASE=H.BASE,this.ZERO=H.ZERO,this.Fn=H.Fn,this.bits=Z}_unsafeLadder(H,Z,k=this.ZERO){let $=H;for(;Z>v;)Z&a&&(k=k.add($)),$=$.double(),Z>>=a;return k}precomputeWindow(H,Z){const{windows:k,windowSize:$}=d(Z,this.bits),S=[];let F=H,D=F;for(let V=0;V<k;V++){D=F,S.push(D);for(let u=1;u<$;u++)D=D.add(F),S.push(D);F=D.double()}return S}wNAF(H,Z,k){if(!this.Fn.isValid(k))throw new Error("invalid scalar");let $=this.ZERO,S=this.BASE;const F=d(H,this.bits);for(let D=0;D<F.windows;D++){const{nextN:V,offset:u,isZero:h,isNeg:o,isNegF:i,offsetF:p}=b(k,D,F);k=V,h?S=S.add(f(i,Z[p])):$=$.add(f(o,Z[u]))}return w(k),{p:$,f:S}}wNAFUnsafe(H,Z,k,$=this.ZERO){const S=d(H,this.bits);for(let F=0;F<S.windows&&k!==v;F++){const{nextN:D,offset:V,isZero:u,isNeg:h}=b(k,F,S);if(k=D,!u){const o=Z[V];$=$.add(h?o.negate():o)}}return w(k),$}getPrecomputes(H,Z,k){let $=q.get(Z);return $||($=this.precomputeWindow(Z,H),H!==1&&(typeof k=="function"&&($=k($)),q.set(Z,$))),$}cached(H,Z,k){const $=L(H);return this.wNAF($,this.getPrecomputes($,H,k),Z)}unsafe(H,Z,k,$){const S=L(H);return S===1?this._unsafeLadder(H,Z,$):this.wNAFUnsafe(S,this.getPrecomputes(S,H,k),Z,$)}createCache(H,Z){s(Z,this.bits),A.set(H,Z),q.delete(H)}hasCache(H){return L(H)!==1}}curve.wNAF=B;function x(O,H,Z,k){let $=H,S=O.ZERO,F=O.ZERO;for(;Z>v||k>v;)Z&a&&(S=S.add($)),k&a&&(F=F.add($)),$=$.double(),Z>>=a,k>>=a;return{p1:S,p2:F}}function N(O,H,Z,k){T(Z,O),R(k,H);const $=Z.length,S=k.length;if($!==S)throw new Error("arrays of points and scalars must have equal length");const F=O.ZERO,D=(0,e.bitLen)(BigInt($));let V=1;D>12?V=D-3:D>4?V=D-2:D>0&&(V=2);const u=(0,e.bitMask)(V),h=new Array(Number(u)+1).fill(F),o=Math.floor((H.BITS-1)/V)*V;let i=F;for(let p=o;p>=0;p-=V){h.fill(F);for(let t=0;t<S;t++){const g=k[t],E=Number(g>>BigInt(p)&u);h[E]=h[E].add(Z[t])}let l=F;for(let t=h.length-1,g=F;t>0;t--)g=g.add(h[t]),l=l.add(g);if(i=i.add(l),p!==0)for(let t=0;t<V;t++)i=i.double()}return i}function M(O,H,Z,k){s(k,H.BITS),T(Z,O);const $=O.ZERO,S=2**k-1,F=Math.ceil(H.BITS/k),D=(0,e.bitMask)(k),V=Z.map(u=>{const h=[];for(let o=0,i=u;o<S;o++)h.push(i),i=i.add(u);return h});return u=>{if(R(u,H),u.length>Z.length)throw new Error("array of scalars must be smaller than array of points");let h=$;for(let o=0;o<F;o++){if(h!==$)for(let p=0;p<k;p++)h=h.double();const i=BigInt(F*k-(o+1)*k);for(let p=0;p<u.length;p++){const l=u[p],t=Number(l>>i&D);t&&(h=h.add(V[p][t-1]))}}return h}}function K(O){return(0,r.validateField)(O.Fp),(0,e.validateObject)(O,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,r.nLength)(O.n,O.nBitLength),...O,p:O.Fp.ORDER})}function j(O,H,Z){if(H){if(H.ORDER!==O)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return(0,r.validateField)(H),H}else return(0,r.Field)(O,{isLE:Z})}function _(O,H,Z={},k){if(k===void 0&&(k=O==="edwards"),!H||typeof H!="object")throw new Error(`expected valid ${O} CURVE object`);for(const V of["p","n","h"]){const u=H[V];if(!(typeof u=="bigint"&&u>v))throw new Error(`CURVE.${V} must be positive bigint`)}const $=j(H.p,Z.Fp,k),S=j(H.n,Z.Fn,k),D=["Gx","Gy","a",O==="weierstrass"?"b":"d"];for(const V of D)if(!$.isValid(H[V]))throw new Error(`CURVE.${V} must be valid field element of CURVE.Fp`);return H=Object.freeze(Object.assign({},H)),{CURVE:H,Fp:$,Fn:S}}return curve}var edwards={},hasRequiredEdwards;function requireEdwards(){if(hasRequiredEdwards)return edwards;hasRequiredEdwards=1,Object.defineProperty(edwards,"__esModule",{value:!0}),edwards.PrimeEdwardsPoint=void 0,edwards.edwards=b,edwards.eddsa=R,edwards.twistedEdwards=L;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireUtils$1(),r=requireCurve(),v=requireModular(),a=BigInt(0),f=BigInt(1),c=BigInt(2),s=BigInt(8);function d(w,B,x,N){const M=w.sqr(x),K=w.sqr(N),j=w.add(w.mul(B.a,M),K),_=w.add(w.ONE,w.mul(B.d,w.mul(M,K)));return w.eql(j,_)}function b(w,B={}){const x=(0,r._createCurveFields)("edwards",w,B,B.FpFnLE),{Fp:N,Fn:M}=x;let K=x.CURVE;const{h:j}=K;(0,e._validateObject)(B,{},{uvRatio:"function"});const _=c<<BigInt(M.BYTES*8)-f,O=V=>N.create(V),H=B.uvRatio||((V,u)=>{try{return{isValid:!0,value:N.sqrt(N.div(V,u))}}catch{return{isValid:!1,value:a}}});if(!d(N,K,K.Gx,K.Gy))throw new Error("bad curve params: generator point");function Z(V,u,h=!1){const o=h?f:a;return(0,e.aInRange)("coordinate "+V,u,o,_),u}function k(V){if(!(V instanceof F))throw new Error("ExtendedPoint expected")}const $=(0,e.memoized)((V,u)=>{const{X:h,Y:o,Z:i}=V,p=V.is0();u==null&&(u=p?s:N.inv(i));const l=O(h*u),t=O(o*u),g=N.mul(i,u);if(p)return{x:a,y:f};if(g!==f)throw new Error("invZ was invalid");return{x:l,y:t}}),S=(0,e.memoized)(V=>{const{a:u,d:h}=K;if(V.is0())throw new Error("bad point: ZERO");const{X:o,Y:i,Z:p,T:l}=V,t=O(o*o),g=O(i*i),E=O(p*p),y=O(E*E),m=O(t*u),ee=O(E*O(m+g)),Y=O(y+O(h*O(t*g)));if(ee!==Y)throw new Error("bad point: equation left != right (1)");const C=O(o*i),G=O(p*l);if(C!==G)throw new Error("bad point: equation left != right (2)");return!0});class F{constructor(u,h,o,i){this.X=Z("x",u),this.Y=Z("y",h),this.Z=Z("z",o,!0),this.T=Z("t",i),Object.freeze(this)}static CURVE(){return K}static fromAffine(u){if(u instanceof F)throw new Error("extended point not allowed");const{x:h,y:o}=u||{};return Z("x",h),Z("y",o),new F(h,o,f,O(h*o))}static fromBytes(u,h=!1){const o=N.BYTES,{a:i,d:p}=K;u=(0,e.copyBytes)((0,e._abytes2)(u,o,"point")),(0,e._abool2)(h,"zip215");const l=(0,e.copyBytes)(u),t=u[o-1];l[o-1]=t&-129;const g=(0,e.bytesToNumberLE)(l),E=h?_:N.ORDER;(0,e.aInRange)("point.y",g,a,E);const y=O(g*g),m=O(y-f),ee=O(p*y-i);let{isValid:Y,value:C}=H(m,ee);if(!Y)throw new Error("bad point: invalid y coordinate");const G=(C&f)===f,z=(t&128)!==0;if(!h&&C===a&&z)throw new Error("bad point: x=0 and x_0=1");return z!==G&&(C=O(-C)),F.fromAffine({x:C,y:g})}static fromHex(u,h=!1){return F.fromBytes((0,e.ensureBytes)("point",u),h)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(u=8,h=!0){return D.createCache(this,u),h||this.multiply(c),this}assertValidity(){S(this)}equals(u){k(u);const{X:h,Y:o,Z:i}=this,{X:p,Y:l,Z:t}=u,g=O(h*t),E=O(p*i),y=O(o*t),m=O(l*i);return g===E&&y===m}is0(){return this.equals(F.ZERO)}negate(){return new F(O(-this.X),this.Y,this.Z,O(-this.T))}double(){const{a:u}=K,{X:h,Y:o,Z:i}=this,p=O(h*h),l=O(o*o),t=O(c*O(i*i)),g=O(u*p),E=h+o,y=O(O(E*E)-p-l),m=g+l,ee=m-t,Y=g-l,C=O(y*ee),G=O(m*Y),z=O(y*Y),J=O(ee*m);return new F(C,G,J,z)}add(u){k(u);const{a:h,d:o}=K,{X:i,Y:p,Z:l,T:t}=this,{X:g,Y:E,Z:y,T:m}=u,ee=O(i*g),Y=O(p*E),C=O(t*o*m),G=O(l*y),z=O((i+p)*(g+E)-ee-Y),J=G-C,ne=G+C,U=O(Y-h*ee),W=O(z*J),re=O(ne*U),ue=O(z*U),de=O(J*ne);return new F(W,re,de,ue)}subtract(u){return this.add(u.negate())}multiply(u){if(!M.isValidNot0(u))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:h,f:o}=D.cached(this,u,i=>(0,r.normalizeZ)(F,i));return(0,r.normalizeZ)(F,[h,o])[0]}multiplyUnsafe(u,h=F.ZERO){if(!M.isValid(u))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return u===a?F.ZERO:this.is0()||u===f?this:D.unsafe(this,u,o=>(0,r.normalizeZ)(F,o),h)}isSmallOrder(){return this.multiplyUnsafe(j).is0()}isTorsionFree(){return D.unsafe(this,K.n).is0()}toAffine(u){return $(this,u)}clearCofactor(){return j===f?this:this.multiplyUnsafe(j)}toBytes(){const{x:u,y:h}=this.toAffine(),o=N.toBytes(h);return o[o.length-1]|=u&f?128:0,o}toHex(){return(0,e.bytesToHex)(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(u){return(0,r.normalizeZ)(F,u)}static msm(u,h){return(0,r.pippenger)(F,M,u,h)}_setWindowSize(u){this.precompute(u)}toRawBytes(){return this.toBytes()}}F.BASE=new F(K.Gx,K.Gy,f,O(K.Gx*K.Gy)),F.ZERO=new F(a,f,f,a),F.Fp=N,F.Fn=M;const D=new r.wNAF(F,M.BITS);return F.BASE.precompute(8),F}class T{constructor(B){this.ep=B}static fromBytes(B){(0,e.notImplemented)()}static fromHex(B){(0,e.notImplemented)()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(B){return this.ep.toAffine(B)}toHex(){return(0,e.bytesToHex)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(B){return this.assertSame(B),this.init(this.ep.add(B.ep))}subtract(B){return this.assertSame(B),this.init(this.ep.subtract(B.ep))}multiply(B){return this.init(this.ep.multiply(B))}multiplyUnsafe(B){return this.init(this.ep.multiplyUnsafe(B))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(B,x){return this.init(this.ep.precompute(B,x))}toRawBytes(){return this.toBytes()}}edwards.PrimeEdwardsPoint=T;function R(w,B,x={}){if(typeof B!="function")throw new Error('"hash" function param is required');(0,e._validateObject)(x,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:N}=x,{BASE:M,Fp:K,Fn:j}=w,_=x.randomBytes||e.randomBytes,O=x.adjustScalarBytes||(E=>E),H=x.domain||((E,y,m)=>{if((0,e._abool2)(m,"phflag"),y.length||m)throw new Error("Contexts/pre-hash are not supported");return E});function Z(E){return j.create((0,e.bytesToNumberLE)(E))}function k(E){const y=o.secretKey;E=(0,e.ensureBytes)("private key",E,y);const m=(0,e.ensureBytes)("hashed private key",B(E),2*y),ee=O(m.slice(0,y)),Y=m.slice(y,2*y),C=Z(ee);return{head:ee,prefix:Y,scalar:C}}function $(E){const{head:y,prefix:m,scalar:ee}=k(E),Y=M.multiply(ee),C=Y.toBytes();return{head:y,prefix:m,scalar:ee,point:Y,pointBytes:C}}function S(E){return $(E).pointBytes}function F(E=Uint8Array.of(),...y){const m=(0,e.concatBytes)(...y);return Z(B(H(m,(0,e.ensureBytes)("context",E),!!N)))}function D(E,y,m={}){E=(0,e.ensureBytes)("message",E),N&&(E=N(E));const{prefix:ee,scalar:Y,pointBytes:C}=$(y),G=F(m.context,ee,E),z=M.multiply(G).toBytes(),J=F(m.context,z,C,E),ne=j.create(G+J*Y);if(!j.isValid(ne))throw new Error("sign failed: invalid s");const U=(0,e.concatBytes)(z,j.toBytes(ne));return(0,e._abytes2)(U,o.signature,"result")}const V={zip215:!0};function u(E,y,m,ee=V){const{context:Y,zip215:C}=ee,G=o.signature;E=(0,e.ensureBytes)("signature",E,G),y=(0,e.ensureBytes)("message",y),m=(0,e.ensureBytes)("publicKey",m,o.publicKey),C!==void 0&&(0,e._abool2)(C,"zip215"),N&&(y=N(y));const z=G/2,J=E.subarray(0,z),ne=(0,e.bytesToNumberLE)(E.subarray(z,G));let U,W,re;try{U=w.fromBytes(m,C),W=w.fromBytes(J,C),re=M.multiplyUnsafe(ne)}catch{return!1}if(!C&&U.isSmallOrder())return!1;const ue=F(Y,W.toBytes(),U.toBytes(),y);return W.add(U.multiplyUnsafe(ue)).subtract(re).clearCofactor().is0()}const h=K.BYTES,o={secretKey:h,publicKey:h,signature:2*h,seed:h};function i(E=_(o.seed)){return(0,e._abytes2)(E,o.seed,"seed")}function p(E){const y=g.randomSecretKey(E);return{secretKey:y,publicKey:S(y)}}function l(E){return(0,e.isBytes)(E)&&E.length===j.BYTES}function t(E,y){try{return!!w.fromBytes(E,y)}catch{return!1}}const g={getExtendedPublicKey:$,randomSecretKey:i,isValidSecretKey:l,isValidPublicKey:t,toMontgomery(E){const{y}=w.fromBytes(E),m=o.publicKey,ee=m===32;if(!ee&&m!==57)throw new Error("only defined for 25519 and 448");const Y=ee?K.div(f+y,f-y):K.div(y-f,y+f);return K.toBytes(Y)},toMontgomerySecret(E){const y=o.secretKey;(0,e._abytes2)(E,y);const m=B(E.subarray(0,y));return O(m).subarray(0,y)},randomPrivateKey:i,precompute(E=8,y=w.BASE){return y.precompute(E,!1)}};return Object.freeze({keygen:p,getPublicKey:S,sign:D,verify:u,utils:g,Point:w,lengths:o})}function q(w){const B={a:w.a,d:w.d,p:w.Fp.ORDER,n:w.n,h:w.h,Gx:w.Gx,Gy:w.Gy},x=w.Fp,N=(0,v.Field)(B.n,w.nBitLength,!0),M={Fp:x,Fn:N,uvRatio:w.uvRatio},K={randomBytes:w.randomBytes,adjustScalarBytes:w.adjustScalarBytes,domain:w.domain,prehash:w.prehash,mapToCurve:w.mapToCurve};return{CURVE:B,curveOpts:M,hash:w.hash,eddsaOpts:K}}function A(w,B){const x=B.Point;return Object.assign({},B,{ExtendedPoint:x,CURVE:w,nBitLength:x.Fn.BITS,nByteLength:x.Fn.BYTES})}function L(w){const{CURVE:B,curveOpts:x,hash:N,eddsaOpts:M}=q(w),K=b(B,x),j=R(K,N,M);return A(w,j)}return edwards}var hashToCurve={},hasRequiredHashToCurve;function requireHashToCurve(){return hasRequiredHashToCurve||(hasRequiredHashToCurve=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._DST_scalar=void 0,e.expand_message_xmd=b,e.expand_message_xof=T,e.hash_to_field=R,e.isogenyMap=q,e.createHasher=A;const r=requireUtils$1(),v=requireModular(),a=r.bytesToNumberBE;function f(L,w){if(s(L),s(w),L<0||L>=1<<8*w)throw new Error("invalid I2OSP input: "+L);const B=Array.from({length:w}).fill(0);for(let x=w-1;x>=0;x--)B[x]=L&255,L>>>=8;return new Uint8Array(B)}function c(L,w){const B=new Uint8Array(L.length);for(let x=0;x<L.length;x++)B[x]=L[x]^w[x];return B}function s(L){if(!Number.isSafeInteger(L))throw new Error("number expected")}function d(L){if(!(0,r.isBytes)(L)&&typeof L!="string")throw new Error("DST must be Uint8Array or string");return typeof L=="string"?(0,r.utf8ToBytes)(L):L}function b(L,w,B,x){(0,r.abytes)(L),s(B),w=d(w),w.length>255&&(w=x((0,r.concatBytes)((0,r.utf8ToBytes)("H2C-OVERSIZE-DST-"),w)));const{outputLen:N,blockLen:M}=x,K=Math.ceil(B/N);if(B>65535||K>255)throw new Error("expand_message_xmd: invalid lenInBytes");const j=(0,r.concatBytes)(w,f(w.length,1)),_=f(0,M),O=f(B,2),H=new Array(K),Z=x((0,r.concatBytes)(_,L,O,f(0,1),j));H[0]=x((0,r.concatBytes)(Z,f(1,1),j));for(let $=1;$<=K;$++){const S=[c(Z,H[$-1]),f($+1,1),j];H[$]=x((0,r.concatBytes)(...S))}return(0,r.concatBytes)(...H).slice(0,B)}function T(L,w,B,x,N){if((0,r.abytes)(L),s(B),w=d(w),w.length>255){const M=Math.ceil(2*x/8);w=N.create({dkLen:M}).update((0,r.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(w).digest()}if(B>65535||w.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return N.create({dkLen:B}).update(L).update(f(B,2)).update(w).update(f(w.length,1)).digest()}function R(L,w,B){(0,r._validateObject)(B,{p:"bigint",m:"number",k:"number",hash:"function"});const{p:x,k:N,m:M,hash:K,expand:j,DST:_}=B;if(!(0,r.isHash)(B.hash))throw new Error("expected valid hash");(0,r.abytes)(L),s(w);const O=x.toString(2).length,H=Math.ceil((O+N)/8),Z=w*M*H;let k;if(j==="xmd")k=b(L,_,Z,K);else if(j==="xof")k=T(L,_,Z,N,K);else if(j==="_internal_pass")k=L;else throw new Error('expand must be "xmd" or "xof"');const $=new Array(w);for(let S=0;S<w;S++){const F=new Array(M);for(let D=0;D<M;D++){const V=H*(D+S*M),u=k.subarray(V,V+H);F[D]=(0,v.mod)(a(u),x)}$[S]=F}return $}function q(L,w){const B=w.map(x=>Array.from(x).reverse());return(x,N)=>{const[M,K,j,_]=B.map(Z=>Z.reduce((k,$)=>L.add(L.mul(k,x),$))),[O,H]=(0,v.FpInvertBatch)(L,[K,_],!0);return x=L.mul(M,O),N=L.mul(N,L.mul(j,H)),{x,y:N}}}e._DST_scalar=(0,r.utf8ToBytes)("HashToScalar-");function A(L,w,B){if(typeof w!="function")throw new Error("mapToCurve() must be defined");function x(M){return L.fromAffine(w(M))}function N(M){const K=M.clearCofactor();return K.equals(L.ZERO)?L.ZERO:(K.assertValidity(),K)}return{defaults:B,hashToCurve(M,K){const j=Object.assign({},B,K),_=R(M,2,j),O=x(_[0]),H=x(_[1]);return N(O.add(H))},encodeToCurve(M,K){const j=B.encodeDST?{DST:B.encodeDST}:{},_=Object.assign({},B,j,K),O=R(M,1,_),H=x(O[0]);return N(H)},mapToCurve(M){if(!Array.isArray(M))throw new Error("expected array of bigints");for(const K of M)if(typeof K!="bigint")throw new Error("expected array of bigints");return N(x(M))},hashToScalar(M,K){const j=L.Fn.ORDER,_=Object.assign({},B,{p:j,m:1,DST:e._DST_scalar},K);return R(M,1,_)[0][0]}}}})(hashToCurve)),hashToCurve}var montgomery={},hasRequiredMontgomery;function requireMontgomery(){if(hasRequiredMontgomery)return montgomery;hasRequiredMontgomery=1,Object.defineProperty(montgomery,"__esModule",{value:!0}),montgomery.montgomery=s;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireUtils$1(),r=requireModular(),v=BigInt(0),a=BigInt(1),f=BigInt(2);function c(d){return(0,e._validateObject)(d,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...d})}function s(d){const b=c(d),{P:T,type:R,adjustScalarBytes:q,powPminus2:A,randomBytes:L}=b,w=R==="x25519";if(!w&&R!=="x448")throw new Error("invalid type");const B=L||e.randomBytes,x=w?255:448,N=w?32:56,M=BigInt(w?9:5),K=BigInt(w?121665:39081),j=w?f**BigInt(254):f**BigInt(447),_=w?BigInt(8)*f**BigInt(251)-a:BigInt(4)*f**BigInt(445)-a,O=j+_+a,H=l=>(0,r.mod)(l,T),Z=k(M);function k(l){return(0,e.numberToBytesLE)(H(l),N)}function $(l){const t=(0,e.ensureBytes)("u coordinate",l,N);return w&&(t[31]&=127),H((0,e.bytesToNumberLE)(t))}function S(l){return(0,e.bytesToNumberLE)(q((0,e.ensureBytes)("scalar",l,N)))}function F(l,t){const g=u($(t),S(l));if(g===v)throw new Error("invalid private or public key received");return k(g)}function D(l){return F(l,Z)}function V(l,t,g){const E=H(l*(t-g));return t=H(t-E),g=H(g+E),{x_2:t,x_3:g}}function u(l,t){(0,e.aInRange)("u",l,v,T),(0,e.aInRange)("scalar",t,j,O);const g=t,E=l;let y=a,m=v,ee=l,Y=a,C=v;for(let z=BigInt(x-1);z>=v;z--){const J=g>>z&a;C^=J,{x_2:y,x_3:ee}=V(C,y,ee),{x_2:m,x_3:Y}=V(C,m,Y),C=J;const ne=y+m,U=H(ne*ne),W=y-m,re=H(W*W),ue=U-re,de=ee+Y,se=ee-Y,pe=H(se*ne),Q=H(de*W),ve=pe+Q,Ee=pe-Q;ee=H(ve*ve),Y=H(E*H(Ee*Ee)),y=H(U*re),m=H(ue*(U+H(K*ue)))}({x_2:y,x_3:ee}=V(C,y,ee)),{x_2:m,x_3:Y}=V(C,m,Y);const G=A(m);return H(y*G)}const h={secretKey:N,publicKey:N,seed:N},o=(l=B(N))=>((0,e.abytes)(l,h.seed),l);function i(l){const t=o(l);return{secretKey:t,publicKey:D(t)}}return{keygen:i,getSharedSecret:(l,t)=>F(l,t),getPublicKey:l=>D(l),scalarMult:F,scalarMultBase:D,utils:{randomSecretKey:o,randomPrivateKey:o},GuBytes:Z.slice(),lengths:h}}return montgomery}var hasRequiredEd25519;function requireEd25519(){return hasRequiredEd25519||(hasRequiredEd25519=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hash_to_ristretto255=e.hashToRistretto255=e.encodeToCurve=e.hashToCurve=e.RistrettoPoint=e.edwardsToMontgomery=e.ED25519_TORSION_SUBGROUP=e.ristretto255_hasher=e.ristretto255=e.ed25519_hasher=e.x25519=e.ed25519ph=e.ed25519ctx=e.ed25519=void 0,e.edwardsToMontgomeryPub=ee,e.edwardsToMontgomeryPriv=Y;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=requireSha2(),v=requireUtils$2(),a=requireCurve(),f=requireEdwards(),c=requireHashToCurve(),s=requireModular(),d=requireMontgomery(),b=requireUtils$1(),T=BigInt(0),R=BigInt(1),q=BigInt(2),A=BigInt(3),L=BigInt(5),w=BigInt(8),B=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),x={p:B,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:w,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function N(C){const G=BigInt(10),z=BigInt(20),J=BigInt(40),ne=BigInt(80),U=B,re=C*C%U*C%U,ue=(0,s.pow2)(re,q,U)*re%U,de=(0,s.pow2)(ue,R,U)*C%U,se=(0,s.pow2)(de,L,U)*de%U,pe=(0,s.pow2)(se,G,U)*se%U,Q=(0,s.pow2)(pe,z,U)*pe%U,ve=(0,s.pow2)(Q,J,U)*Q%U,Ee=(0,s.pow2)(ve,ne,U)*ve%U,he=(0,s.pow2)(Ee,ne,U)*ve%U,te=(0,s.pow2)(he,G,U)*se%U;return{pow_p_5_8:(0,s.pow2)(te,q,U)*C%U,b2:re}}function M(C){return C[0]&=248,C[31]&=127,C[31]|=64,C}const K=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function j(C,G){const z=B,J=(0,s.mod)(G*G*G,z),ne=(0,s.mod)(J*J*G,z),U=N(C*ne).pow_p_5_8;let W=(0,s.mod)(C*J*U,z);const re=(0,s.mod)(G*W*W,z),ue=W,de=(0,s.mod)(W*K,z),se=re===C,pe=re===(0,s.mod)(-C,z),Q=re===(0,s.mod)(-C*K,z);return se&&(W=ue),(pe||Q)&&(W=de),(0,s.isNegativeLE)(W,z)&&(W=(0,s.mod)(-W,z)),{isValid:se||pe,value:W}}const _=(0,s.Field)(x.p,{isLE:!0}),O=(0,s.Field)(x.n,{isLE:!0}),H={...x,Fp:_,hash:r.sha512,adjustScalarBytes:M,uvRatio:j};e.ed25519=(0,f.twistedEdwards)(H);function Z(C,G,z){if(G.length>255)throw new Error("Context is too big");return(0,v.concatBytes)((0,v.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([z?1:0,G.length]),G,C)}e.ed25519ctx=(0,f.twistedEdwards)({...H,domain:Z}),e.ed25519ph=(0,f.twistedEdwards)(Object.assign({},H,{domain:Z,prehash:r.sha512})),e.x25519=(()=>{const C=_.ORDER;return(0,d.montgomery)({P:C,type:"x25519",powPminus2:G=>{const{pow_p_5_8:z,b2:J}=N(G);return(0,s.mod)((0,s.pow2)(z,A,C)*J,C)},adjustScalarBytes:M})})();const k=(B+A)/w,$=_.pow(q,k),S=_.sqrt(_.neg(_.ONE));function F(C){const G=(B-L)/w,z=BigInt(486662);let J=_.sqr(C);J=_.mul(J,q);let ne=_.add(J,_.ONE),U=_.neg(z),W=_.sqr(ne),re=_.mul(W,ne),ue=_.mul(J,z);ue=_.mul(ue,U),ue=_.add(ue,W),ue=_.mul(ue,U);let de=_.sqr(re);W=_.sqr(de),de=_.mul(de,re),de=_.mul(de,ue),W=_.mul(W,de);let se=_.pow(W,G);se=_.mul(se,de);let pe=_.mul(se,S);W=_.sqr(se),W=_.mul(W,re);let Q=_.eql(W,ue),ve=_.cmov(pe,se,Q),Ee=_.mul(U,J),he=_.mul(se,C);he=_.mul(he,$);let te=_.mul(he,S),ie=_.mul(ue,J);W=_.sqr(he),W=_.mul(W,re);let oe=_.eql(W,ie),fe=_.cmov(te,he,oe);W=_.sqr(ve),W=_.mul(W,re);let ye=_.eql(W,ue),be=_.cmov(Ee,U,ye),ge=_.cmov(fe,ve,ye),me=_.isOdd(ge);return ge=_.cmov(ge,_.neg(ge),ye!==me),{xMn:be,xMd:ne,yMn:ge,yMd:R}}const D=(0,s.FpSqrtEven)(_,_.neg(BigInt(486664)));function V(C){const{xMn:G,xMd:z,yMn:J,yMd:ne}=F(C);let U=_.mul(G,ne);U=_.mul(U,D);let W=_.mul(z,J),re=_.sub(G,z),ue=_.add(G,z),de=_.mul(W,ue),se=_.eql(de,_.ZERO);U=_.cmov(U,_.ZERO,se),W=_.cmov(W,_.ONE,se),re=_.cmov(re,_.ONE,se),ue=_.cmov(ue,_.ONE,se);const[pe,Q]=(0,s.FpInvertBatch)(_,[W,ue],!0);return{x:_.mul(U,pe),y:_.mul(re,Q)}}e.ed25519_hasher=(0,c.createHasher)(e.ed25519.Point,C=>V(C[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:B,m:1,k:128,expand:"xmd",hash:r.sha512});const u=K,h=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),o=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),i=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),p=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),l=C=>j(R,C),t=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),g=C=>e.ed25519.Point.Fp.create((0,b.bytesToNumberLE)(C)&t);function E(C){const{d:G}=x,z=B,J=ie=>_.create(ie),ne=J(u*C*C),U=J((ne+R)*i);let W=BigInt(-1);const re=J((W-G*ne)*J(ne+G));let{isValid:ue,value:de}=j(U,re),se=J(de*C);(0,s.isNegativeLE)(se,z)||(se=J(-se)),ue||(de=se),ue||(W=ne);const pe=J(W*(ne-R)*p-re),Q=de*de,ve=J((de+de)*re),Ee=J(pe*h),he=J(R-Q),te=J(R+Q);return new e.ed25519.Point(J(ve*te),J(he*Ee),J(Ee*te),J(ve*he))}function y(C){(0,v.abytes)(C,64);const G=g(C.subarray(0,32)),z=E(G),J=g(C.subarray(32,64)),ne=E(J);return new m(z.add(ne))}class m extends f.PrimeEdwardsPoint{constructor(G){super(G)}static fromAffine(G){return new m(e.ed25519.Point.fromAffine(G))}assertSame(G){if(!(G instanceof m))throw new Error("RistrettoPoint expected")}init(G){return new m(G)}static hashToCurve(G){return y((0,b.ensureBytes)("ristrettoHash",G,64))}static fromBytes(G){(0,v.abytes)(G,32);const{a:z,d:J}=x,ne=B,U=ye=>_.create(ye),W=g(G);if(!(0,b.equalBytes)(_.toBytes(W),G)||(0,s.isNegativeLE)(W,ne))throw new Error("invalid ristretto255 encoding 1");const re=U(W*W),ue=U(R+z*re),de=U(R-z*re),se=U(ue*ue),pe=U(de*de),Q=U(z*J*se-pe),{isValid:ve,value:Ee}=l(U(Q*pe)),he=U(Ee*de),te=U(Ee*he*Q);let ie=U((W+W)*he);(0,s.isNegativeLE)(ie,ne)&&(ie=U(-ie));const oe=U(ue*te),fe=U(ie*oe);if(!ve||(0,s.isNegativeLE)(fe,ne)||oe===T)throw new Error("invalid ristretto255 encoding 2");return new m(new e.ed25519.Point(ie,oe,R,fe))}static fromHex(G){return m.fromBytes((0,b.ensureBytes)("ristrettoHex",G,32))}static msm(G,z){return(0,a.pippenger)(m,e.ed25519.Point.Fn,G,z)}toBytes(){let{X:G,Y:z,Z:J,T:ne}=this.ep;const U=B,W=te=>_.create(te),re=W(W(J+z)*W(J-z)),ue=W(G*z),de=W(ue*ue),{value:se}=l(W(re*de)),pe=W(se*re),Q=W(se*ue),ve=W(pe*Q*ne);let Ee;if((0,s.isNegativeLE)(ne*ve,U)){let te=W(z*u),ie=W(G*u);G=te,z=ie,Ee=W(pe*o)}else Ee=Q;(0,s.isNegativeLE)(G*ve,U)&&(z=W(-z));let he=W((J-z)*Ee);return(0,s.isNegativeLE)(he,U)&&(he=W(-he)),_.toBytes(he)}equals(G){this.assertSame(G);const{X:z,Y:J}=this.ep,{X:ne,Y:U}=G.ep,W=de=>_.create(de),re=W(z*U)===W(J*ne),ue=W(J*U)===W(z*ne);return re||ue}is0(){return this.equals(m.ZERO)}}m.BASE=new m(e.ed25519.Point.BASE),m.ZERO=new m(e.ed25519.Point.ZERO),m.Fp=_,m.Fn=O,e.ristretto255={Point:m},e.ristretto255_hasher={hashToCurve(C,G){const z=G?.DST||"ristretto255_XMD:SHA-512_R255MAP_RO_",J=(0,c.expand_message_xmd)(C,z,64,r.sha512);return y(J)},hashToScalar(C,G={DST:c._DST_scalar}){const z=(0,c.expand_message_xmd)(C,G.DST,64,r.sha512);return O.create((0,b.bytesToNumberLE)(z))}},e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];function ee(C){return e.ed25519.utils.toMontgomery((0,b.ensureBytes)("pub",C))}e.edwardsToMontgomery=ee;function Y(C){return e.ed25519.utils.toMontgomerySecret((0,b.ensureBytes)("pub",C))}e.RistrettoPoint=m,e.hashToCurve=e.ed25519_hasher.hashToCurve,e.encodeToCurve=e.ed25519_hasher.encodeToCurve,e.hashToRistretto255=e.ristretto255_hasher.hashToCurve,e.hash_to_ristretto255=e.ristretto255_hasher.hashToCurve})(ed25519)),ed25519}var secp256k1={},_shortw_utils={},weierstrass={},hmac={},hasRequiredHmac;function requireHmac(){return hasRequiredHmac||(hasRequiredHmac=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const r=requireUtils$2();class v extends r.Hash{constructor(c,s){super(),this.finished=!1,this.destroyed=!1,(0,r.ahash)(c);const d=(0,r.toBytes)(s);if(this.iHash=c.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const b=this.blockLen,T=new Uint8Array(b);T.set(d.length>b?c.create().update(d).digest():d);for(let R=0;R<T.length;R++)T[R]^=54;this.iHash.update(T),this.oHash=c.create();for(let R=0;R<T.length;R++)T[R]^=106;this.oHash.update(T),(0,r.clean)(T)}update(c){return(0,r.aexists)(this),this.iHash.update(c),this}digestInto(c){(0,r.aexists)(this),(0,r.abytes)(c,this.outputLen),this.finished=!0,this.iHash.digestInto(c),this.oHash.update(c),this.oHash.digestInto(c),this.destroy()}digest(){const c=new Uint8Array(this.oHash.outputLen);return this.digestInto(c),c}_cloneInto(c){c||(c=Object.create(Object.getPrototypeOf(this),{}));const{oHash:s,iHash:d,finished:b,destroyed:T,blockLen:R,outputLen:q}=this;return c=c,c.finished=b,c.destroyed=T,c.blockLen=R,c.outputLen=q,c.oHash=s._cloneInto(c.oHash),c.iHash=d._cloneInto(c.iHash),c}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=v;const a=(f,c,s)=>new v(f,c).update(s).digest();e.hmac=a,e.hmac.create=(f,c)=>new v(f,c)})(hmac)),hmac}var hasRequiredWeierstrass;function requireWeierstrass(){return hasRequiredWeierstrass||(hasRequiredWeierstrass=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=e.DERErr=void 0,e._splitEndoScalar=d,e._normFnElement=x,e.weierstrassN=N,e.SWUFpSqrtRatio=K,e.mapToCurveSimpleSWU=j,e.ecdh=O,e.ecdsa=H,e.weierstrassPoints=Z,e._legacyHelperEquat=S,e.weierstrass=V;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=requireHmac(),v=requireUtils$2(),a=requireUtils$1(),f=requireCurve(),c=requireModular(),s=(u,h)=>(u+(u>=0?h:-h)/L)/h;function d(u,h,o){const[[i,p],[l,t]]=h,g=s(t*u,o),E=s(-p*u,o);let y=u-g*i-E*l,m=-g*p-E*t;const ee=y<q,Y=m<q;ee&&(y=-y),Y&&(m=-m);const C=(0,a.bitMask)(Math.ceil((0,a.bitLen)(o)/2))+A;if(y<q||y>=C||m<q||m>=C)throw new Error("splitScalar (endomorphism): failed, k="+u);return{k1neg:ee,k1:y,k2neg:Y,k2:m}}function b(u){if(!["compact","recovered","der"].includes(u))throw new Error('Signature format must be "compact", "recovered", or "der"');return u}function T(u,h){const o={};for(let i of Object.keys(h))o[i]=u[i]===void 0?h[i]:u[i];return(0,a._abool2)(o.lowS,"lowS"),(0,a._abool2)(o.prehash,"prehash"),o.format!==void 0&&b(o.format),o}class R extends Error{constructor(h=""){super(h)}}e.DERErr=R,e.DER={Err:R,_tlv:{encode:(u,h)=>{const{Err:o}=e.DER;if(u<0||u>256)throw new o("tlv.encode: wrong tag");if(h.length&1)throw new o("tlv.encode: unpadded data");const i=h.length/2,p=(0,a.numberToHexUnpadded)(i);if(p.length/2&128)throw new o("tlv.encode: long form length too big");const l=i>127?(0,a.numberToHexUnpadded)(p.length/2|128):"";return(0,a.numberToHexUnpadded)(u)+l+p+h},decode(u,h){const{Err:o}=e.DER;let i=0;if(u<0||u>256)throw new o("tlv.encode: wrong tag");if(h.length<2||h[i++]!==u)throw new o("tlv.decode: wrong tlv");const p=h[i++],l=!!(p&128);let t=0;if(!l)t=p;else{const E=p&127;if(!E)throw new o("tlv.decode(long): indefinite length not supported");if(E>4)throw new o("tlv.decode(long): byte length is too big");const y=h.subarray(i,i+E);if(y.length!==E)throw new o("tlv.decode: length bytes not complete");if(y[0]===0)throw new o("tlv.decode(long): zero leftmost byte");for(const m of y)t=t<<8|m;if(i+=E,t<128)throw new o("tlv.decode(long): not minimal encoding")}const g=h.subarray(i,i+t);if(g.length!==t)throw new o("tlv.decode: wrong value length");return{v:g,l:h.subarray(i+t)}}},_int:{encode(u){const{Err:h}=e.DER;if(u<q)throw new h("integer: negative integers are not allowed");let o=(0,a.numberToHexUnpadded)(u);if(Number.parseInt(o[0],16)&8&&(o="00"+o),o.length&1)throw new h("unexpected DER parsing assertion: unpadded hex");return o},decode(u){const{Err:h}=e.DER;if(u[0]&128)throw new h("invalid signature integer: negative");if(u[0]===0&&!(u[1]&128))throw new h("invalid signature integer: unnecessary leading zero");return(0,a.bytesToNumberBE)(u)}},toSig(u){const{Err:h,_int:o,_tlv:i}=e.DER,p=(0,a.ensureBytes)("signature",u),{v:l,l:t}=i.decode(48,p);if(t.length)throw new h("invalid signature: left bytes after parsing");const{v:g,l:E}=i.decode(2,l),{v:y,l:m}=i.decode(2,E);if(m.length)throw new h("invalid signature: left bytes after parsing");return{r:o.decode(g),s:o.decode(y)}},hexFromSig(u){const{_tlv:h,_int:o}=e.DER,i=h.encode(2,o.encode(u.r)),p=h.encode(2,o.encode(u.s)),l=i+p;return h.encode(48,l)}};const q=BigInt(0),A=BigInt(1),L=BigInt(2),w=BigInt(3),B=BigInt(4);function x(u,h){const{BYTES:o}=u;let i;if(typeof h=="bigint")i=h;else{let p=(0,a.ensureBytes)("private key",h);try{i=u.fromBytes(p)}catch{throw new Error(`invalid private key: expected ui8a of size ${o}, got ${typeof h}`)}}if(!u.isValidNot0(i))throw new Error("invalid private key: out of range [1..N-1]");return i}function N(u,h={}){const o=(0,f._createCurveFields)("weierstrass",u,h),{Fp:i,Fn:p}=o;let l=o.CURVE;const{h:t,n:g}=l;(0,a._validateObject)(h,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:E}=h;if(E&&(!i.is0(l.a)||typeof E.beta!="bigint"||!Array.isArray(E.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const y=_(i,p);function m(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function ee(he,te,ie){const{x:oe,y:fe}=te.toAffine(),ye=i.toBytes(oe);if((0,a._abool2)(ie,"isCompressed"),ie){m();const be=!i.isOdd(fe);return(0,a.concatBytes)(M(be),ye)}else return(0,a.concatBytes)(Uint8Array.of(4),ye,i.toBytes(fe))}function Y(he){(0,a._abytes2)(he,void 0,"Point");const{publicKey:te,publicKeyUncompressed:ie}=y,oe=he.length,fe=he[0],ye=he.subarray(1);if(oe===te&&(fe===2||fe===3)){const be=i.fromBytes(ye);if(!i.isValid(be))throw new Error("bad point: is not on curve, wrong x");const ge=z(be);let me;try{me=i.sqrt(ge)}catch(ce){const ae=ce instanceof Error?": "+ce.message:"";throw new Error("bad point: is not on curve, sqrt error"+ae)}m();const P=i.isOdd(me);return(fe&1)===1!==P&&(me=i.neg(me)),{x:be,y:me}}else if(oe===ie&&fe===4){const be=i.BYTES,ge=i.fromBytes(ye.subarray(0,be)),me=i.fromBytes(ye.subarray(be,be*2));if(!J(ge,me))throw new Error("bad point: is not on curve");return{x:ge,y:me}}else throw new Error(`bad point: got length ${oe}, expected compressed=${te} or uncompressed=${ie}`)}const C=h.toBytes||ee,G=h.fromBytes||Y;function z(he){const te=i.sqr(he),ie=i.mul(te,he);return i.add(i.add(ie,i.mul(he,l.a)),l.b)}function J(he,te){const ie=i.sqr(te),oe=z(he);return i.eql(ie,oe)}if(!J(l.Gx,l.Gy))throw new Error("bad curve params: generator point");const ne=i.mul(i.pow(l.a,w),B),U=i.mul(i.sqr(l.b),BigInt(27));if(i.is0(i.add(ne,U)))throw new Error("bad curve params: a or b");function W(he,te,ie=!1){if(!i.isValid(te)||ie&&i.is0(te))throw new Error(`bad point coordinate ${he}`);return te}function re(he){if(!(he instanceof Q))throw new Error("ProjectivePoint expected")}function ue(he){if(!E||!E.basises)throw new Error("no endo");return d(he,E.basises,p.ORDER)}const de=(0,a.memoized)((he,te)=>{const{X:ie,Y:oe,Z:fe}=he;if(i.eql(fe,i.ONE))return{x:ie,y:oe};const ye=he.is0();te==null&&(te=ye?i.ONE:i.inv(fe));const be=i.mul(ie,te),ge=i.mul(oe,te),me=i.mul(fe,te);if(ye)return{x:i.ZERO,y:i.ZERO};if(!i.eql(me,i.ONE))throw new Error("invZ was invalid");return{x:be,y:ge}}),se=(0,a.memoized)(he=>{if(he.is0()){if(h.allowInfinityPoint&&!i.is0(he.Y))return;throw new Error("bad point: ZERO")}const{x:te,y:ie}=he.toAffine();if(!i.isValid(te)||!i.isValid(ie))throw new Error("bad point: x or y not field elements");if(!J(te,ie))throw new Error("bad point: equation left != right");if(!he.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function pe(he,te,ie,oe,fe){return ie=new Q(i.mul(ie.X,he),ie.Y,ie.Z),te=(0,f.negateCt)(oe,te),ie=(0,f.negateCt)(fe,ie),te.add(ie)}class Q{constructor(te,ie,oe){this.X=W("x",te),this.Y=W("y",ie,!0),this.Z=W("z",oe),Object.freeze(this)}static CURVE(){return l}static fromAffine(te){const{x:ie,y:oe}=te||{};if(!te||!i.isValid(ie)||!i.isValid(oe))throw new Error("invalid affine point");if(te instanceof Q)throw new Error("projective point not allowed");return i.is0(ie)&&i.is0(oe)?Q.ZERO:new Q(ie,oe,i.ONE)}static fromBytes(te){const ie=Q.fromAffine(G((0,a._abytes2)(te,void 0,"point")));return ie.assertValidity(),ie}static fromHex(te){return Q.fromBytes((0,a.ensureBytes)("pointHex",te))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(te=8,ie=!0){return Ee.createCache(this,te),ie||this.multiply(w),this}assertValidity(){se(this)}hasEvenY(){const{y:te}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(te)}equals(te){re(te);const{X:ie,Y:oe,Z:fe}=this,{X:ye,Y:be,Z:ge}=te,me=i.eql(i.mul(ie,ge),i.mul(ye,fe)),P=i.eql(i.mul(oe,ge),i.mul(be,fe));return me&&P}negate(){return new Q(this.X,i.neg(this.Y),this.Z)}double(){const{a:te,b:ie}=l,oe=i.mul(ie,w),{X:fe,Y:ye,Z:be}=this;let ge=i.ZERO,me=i.ZERO,P=i.ZERO,X=i.mul(fe,fe),ce=i.mul(ye,ye),ae=i.mul(be,be),le=i.mul(fe,ye);return le=i.add(le,le),P=i.mul(fe,be),P=i.add(P,P),ge=i.mul(te,P),me=i.mul(oe,ae),me=i.add(ge,me),ge=i.sub(ce,me),me=i.add(ce,me),me=i.mul(ge,me),ge=i.mul(le,ge),P=i.mul(oe,P),ae=i.mul(te,ae),le=i.sub(X,ae),le=i.mul(te,le),le=i.add(le,P),P=i.add(X,X),X=i.add(P,X),X=i.add(X,ae),X=i.mul(X,le),me=i.add(me,X),ae=i.mul(ye,be),ae=i.add(ae,ae),X=i.mul(ae,le),ge=i.sub(ge,X),P=i.mul(ae,ce),P=i.add(P,P),P=i.add(P,P),new Q(ge,me,P)}add(te){re(te);const{X:ie,Y:oe,Z:fe}=this,{X:ye,Y:be,Z:ge}=te;let me=i.ZERO,P=i.ZERO,X=i.ZERO;const ce=l.a,ae=i.mul(l.b,w);let le=i.mul(ie,ye),_e=i.mul(oe,be),we=i.mul(fe,ge),Se=i.add(ie,oe),Ae=i.add(ye,be);Se=i.mul(Se,Ae),Ae=i.add(le,_e),Se=i.sub(Se,Ae),Ae=i.add(ie,fe);let xe=i.add(ye,ge);return Ae=i.mul(Ae,xe),xe=i.add(le,we),Ae=i.sub(Ae,xe),xe=i.add(oe,fe),me=i.add(be,ge),xe=i.mul(xe,me),me=i.add(_e,we),xe=i.sub(xe,me),X=i.mul(ce,Ae),me=i.mul(ae,we),X=i.add(me,X),me=i.sub(_e,X),X=i.add(_e,X),P=i.mul(me,X),_e=i.add(le,le),_e=i.add(_e,le),we=i.mul(ce,we),Ae=i.mul(ae,Ae),_e=i.add(_e,we),we=i.sub(le,we),we=i.mul(ce,we),Ae=i.add(Ae,we),le=i.mul(_e,Ae),P=i.add(P,le),le=i.mul(xe,Ae),me=i.mul(Se,me),me=i.sub(me,le),le=i.mul(Se,_e),X=i.mul(xe,X),X=i.add(X,le),new Q(me,P,X)}subtract(te){return this.add(te.negate())}is0(){return this.equals(Q.ZERO)}multiply(te){const{endo:ie}=h;if(!p.isValidNot0(te))throw new Error("invalid scalar: out of range");let oe,fe;const ye=be=>Ee.cached(this,be,ge=>(0,f.normalizeZ)(Q,ge));if(ie){const{k1neg:be,k1:ge,k2neg:me,k2:P}=ue(te),{p:X,f:ce}=ye(ge),{p:ae,f:le}=ye(P);fe=ce.add(le),oe=pe(ie.beta,X,ae,be,me)}else{const{p:be,f:ge}=ye(te);oe=be,fe=ge}return(0,f.normalizeZ)(Q,[oe,fe])[0]}multiplyUnsafe(te){const{endo:ie}=h,oe=this;if(!p.isValid(te))throw new Error("invalid scalar: out of range");if(te===q||oe.is0())return Q.ZERO;if(te===A)return oe;if(Ee.hasCache(this))return this.multiply(te);if(ie){const{k1neg:fe,k1:ye,k2neg:be,k2:ge}=ue(te),{p1:me,p2:P}=(0,f.mulEndoUnsafe)(Q,oe,ye,ge);return pe(ie.beta,me,P,fe,be)}else return Ee.unsafe(oe,te)}multiplyAndAddUnsafe(te,ie,oe){const fe=this.multiplyUnsafe(ie).add(te.multiplyUnsafe(oe));return fe.is0()?void 0:fe}toAffine(te){return de(this,te)}isTorsionFree(){const{isTorsionFree:te}=h;return t===A?!0:te?te(Q,this):Ee.unsafe(this,g).is0()}clearCofactor(){const{clearCofactor:te}=h;return t===A?this:te?te(Q,this):this.multiplyUnsafe(t)}isSmallOrder(){return this.multiplyUnsafe(t).is0()}toBytes(te=!0){return(0,a._abool2)(te,"isCompressed"),this.assertValidity(),C(Q,this,te)}toHex(te=!0){return(0,a.bytesToHex)(this.toBytes(te))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(te=!0){return this.toBytes(te)}_setWindowSize(te){this.precompute(te)}static normalizeZ(te){return(0,f.normalizeZ)(Q,te)}static msm(te,ie){return(0,f.pippenger)(Q,p,te,ie)}static fromPrivateKey(te){return Q.BASE.multiply(x(p,te))}}Q.BASE=new Q(l.Gx,l.Gy,i.ONE),Q.ZERO=new Q(i.ZERO,i.ONE,i.ZERO),Q.Fp=i,Q.Fn=p;const ve=p.BITS,Ee=new f.wNAF(Q,h.endo?Math.ceil(ve/2):ve);return Q.BASE.precompute(8),Q}function M(u){return Uint8Array.of(u?2:3)}function K(u,h){const o=u.ORDER;let i=q;for(let G=o-A;G%L===q;G/=L)i+=A;const p=i,l=L<<p-A-A,t=l*L,g=(o-A)/t,E=(g-A)/L,y=t-A,m=l,ee=u.pow(h,g),Y=u.pow(h,(g+A)/L);let C=(G,z)=>{let J=ee,ne=u.pow(z,y),U=u.sqr(ne);U=u.mul(U,z);let W=u.mul(G,U);W=u.pow(W,E),W=u.mul(W,ne),ne=u.mul(W,z),U=u.mul(W,G);let re=u.mul(U,ne);W=u.pow(re,m);let ue=u.eql(W,u.ONE);ne=u.mul(U,Y),W=u.mul(re,J),U=u.cmov(ne,U,ue),re=u.cmov(W,re,ue);for(let de=p;de>A;de--){let se=de-L;se=L<<se-A;let pe=u.pow(re,se);const Q=u.eql(pe,u.ONE);ne=u.mul(U,J),J=u.mul(J,J),pe=u.mul(re,J),U=u.cmov(ne,U,Q),re=u.cmov(pe,re,Q)}return{isValid:ue,value:U}};if(u.ORDER%B===w){const G=(u.ORDER-w)/B,z=u.sqrt(u.neg(h));C=(J,ne)=>{let U=u.sqr(ne);const W=u.mul(J,ne);U=u.mul(U,W);let re=u.pow(U,G);re=u.mul(re,W);const ue=u.mul(re,z),de=u.mul(u.sqr(re),ne),se=u.eql(de,J);let pe=u.cmov(ue,re,se);return{isValid:se,value:pe}}}return C}function j(u,h){(0,c.validateField)(u);const{A:o,B:i,Z:p}=h;if(!u.isValid(o)||!u.isValid(i)||!u.isValid(p))throw new Error("mapToCurveSimpleSWU: invalid opts");const l=K(u,p);if(!u.isOdd)throw new Error("Field does not have .isOdd()");return t=>{let g,E,y,m,ee,Y,C,G;g=u.sqr(t),g=u.mul(g,p),E=u.sqr(g),E=u.add(E,g),y=u.add(E,u.ONE),y=u.mul(y,i),m=u.cmov(p,u.neg(E),!u.eql(E,u.ZERO)),m=u.mul(m,o),E=u.sqr(y),Y=u.sqr(m),ee=u.mul(Y,o),E=u.add(E,ee),E=u.mul(E,y),Y=u.mul(Y,m),ee=u.mul(Y,i),E=u.add(E,ee),C=u.mul(g,y);const{isValid:z,value:J}=l(E,Y);G=u.mul(g,t),G=u.mul(G,J),C=u.cmov(C,y,z),G=u.cmov(G,J,z);const ne=u.isOdd(t)===u.isOdd(G);G=u.cmov(u.neg(G),G,ne);const U=(0,c.FpInvertBatch)(u,[m],!0)[0];return C=u.mul(C,U),{x:C,y:G}}}function _(u,h){return{secretKey:h.BYTES,publicKey:1+u.BYTES,publicKeyUncompressed:1+2*u.BYTES,publicKeyHasPrefix:!0,signature:2*h.BYTES}}function O(u,h={}){const{Fn:o}=u,i=h.randomBytes||a.randomBytes,p=Object.assign(_(u.Fp,o),{seed:(0,c.getMinHashLength)(o.ORDER)});function l(C){try{return!!x(o,C)}catch{return!1}}function t(C,G){const{publicKey:z,publicKeyUncompressed:J}=p;try{const ne=C.length;return G===!0&&ne!==z||G===!1&&ne!==J?!1:!!u.fromBytes(C)}catch{return!1}}function g(C=i(p.seed)){return(0,c.mapHashToField)((0,a._abytes2)(C,p.seed,"seed"),o.ORDER)}function E(C,G=!0){return u.BASE.multiply(x(o,C)).toBytes(G)}function y(C){const G=g(C);return{secretKey:G,publicKey:E(G)}}function m(C){if(typeof C=="bigint")return!1;if(C instanceof u)return!0;const{secretKey:G,publicKey:z,publicKeyUncompressed:J}=p;if(o.allowedLengths||G===z)return;const ne=(0,a.ensureBytes)("key",C).length;return ne===z||ne===J}function ee(C,G,z=!0){if(m(C)===!0)throw new Error("first arg must be private key");if(m(G)===!1)throw new Error("second arg must be public key");const J=x(o,C);return u.fromHex(G).multiply(J).toBytes(z)}return Object.freeze({getPublicKey:E,getSharedSecret:ee,keygen:y,Point:u,utils:{isValidSecretKey:l,isValidPublicKey:t,randomSecretKey:g,isValidPrivateKey:l,randomPrivateKey:g,normPrivateKeyToScalar:C=>x(o,C),precompute(C=8,G=u.BASE){return G.precompute(C,!1)}},lengths:p})}function H(u,h,o={}){(0,v.ahash)(h),(0,a._validateObject)(o,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const i=o.randomBytes||a.randomBytes,p=o.hmac||((ie,...oe)=>(0,r.hmac)(h,ie,(0,a.concatBytes)(...oe))),{Fp:l,Fn:t}=u,{ORDER:g,BITS:E}=t,{keygen:y,getPublicKey:m,getSharedSecret:ee,utils:Y,lengths:C}=O(u,o),G={prehash:!1,lowS:typeof o.lowS=="boolean"?o.lowS:!1,format:void 0,extraEntropy:!1},z="compact";function J(ie){const oe=g>>A;return ie>oe}function ne(ie,oe){if(!t.isValidNot0(oe))throw new Error(`invalid signature ${ie}: out of range 1..Point.Fn.ORDER`);return oe}function U(ie,oe){b(oe);const fe=C.signature,ye=oe==="compact"?fe:oe==="recovered"?fe+1:void 0;return(0,a._abytes2)(ie,ye,`${oe} signature`)}class W{constructor(oe,fe,ye){this.r=ne("r",oe),this.s=ne("s",fe),ye!=null&&(this.recovery=ye),Object.freeze(this)}static fromBytes(oe,fe=z){U(oe,fe);let ye;if(fe==="der"){const{r:P,s:X}=e.DER.toSig((0,a._abytes2)(oe));return new W(P,X)}fe==="recovered"&&(ye=oe[0],fe="compact",oe=oe.subarray(1));const be=t.BYTES,ge=oe.subarray(0,be),me=oe.subarray(be,be*2);return new W(t.fromBytes(ge),t.fromBytes(me),ye)}static fromHex(oe,fe){return this.fromBytes((0,a.hexToBytes)(oe),fe)}addRecoveryBit(oe){return new W(this.r,this.s,oe)}recoverPublicKey(oe){const fe=l.ORDER,{r:ye,s:be,recovery:ge}=this;if(ge==null||![0,1,2,3].includes(ge))throw new Error("recovery id invalid");if(g*L<fe&&ge>1)throw new Error("recovery id is ambiguous for h>1 curve");const P=ge===2||ge===3?ye+g:ye;if(!l.isValid(P))throw new Error("recovery id 2 or 3 invalid");const X=l.toBytes(P),ce=u.fromBytes((0,a.concatBytes)(M((ge&1)===0),X)),ae=t.inv(P),le=ue((0,a.ensureBytes)("msgHash",oe)),_e=t.create(-le*ae),we=t.create(be*ae),Se=u.BASE.multiplyUnsafe(_e).add(ce.multiplyUnsafe(we));if(Se.is0())throw new Error("point at infinify");return Se.assertValidity(),Se}hasHighS(){return J(this.s)}toBytes(oe=z){if(b(oe),oe==="der")return(0,a.hexToBytes)(e.DER.hexFromSig(this));const fe=t.toBytes(this.r),ye=t.toBytes(this.s);if(oe==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return(0,a.concatBytes)(Uint8Array.of(this.recovery),fe,ye)}return(0,a.concatBytes)(fe,ye)}toHex(oe){return(0,a.bytesToHex)(this.toBytes(oe))}assertValidity(){}static fromCompact(oe){return W.fromBytes((0,a.ensureBytes)("sig",oe),"compact")}static fromDER(oe){return W.fromBytes((0,a.ensureBytes)("sig",oe),"der")}normalizeS(){return this.hasHighS()?new W(this.r,t.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,a.bytesToHex)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,a.bytesToHex)(this.toBytes("compact"))}}const re=o.bits2int||function(oe){if(oe.length>8192)throw new Error("input is too large");const fe=(0,a.bytesToNumberBE)(oe),ye=oe.length*8-E;return ye>0?fe>>BigInt(ye):fe},ue=o.bits2int_modN||function(oe){return t.create(re(oe))},de=(0,a.bitMask)(E);function se(ie){return(0,a.aInRange)("num < 2^"+E,ie,q,de),t.toBytes(ie)}function pe(ie,oe){return(0,a._abytes2)(ie,void 0,"message"),oe?(0,a._abytes2)(h(ie),void 0,"prehashed message"):ie}function Q(ie,oe,fe){if(["recovered","canonical"].some(_e=>_e in fe))throw new Error("sign() legacy options not supported");const{lowS:ye,prehash:be,extraEntropy:ge}=T(fe,G);ie=pe(ie,be);const me=ue(ie),P=x(t,oe),X=[se(P),se(me)];if(ge!=null&&ge!==!1){const _e=ge===!0?i(C.secretKey):ge;X.push((0,a.ensureBytes)("extraEntropy",_e))}const ce=(0,a.concatBytes)(...X),ae=me;function le(_e){const we=re(_e);if(!t.isValidNot0(we))return;const Se=t.inv(we),Ae=u.BASE.multiply(we).toAffine(),xe=t.create(Ae.x);if(xe===q)return;const Oe=t.create(Se*t.create(ae+xe*P));if(Oe===q)return;let Ne=(Ae.x===xe?0:2)|Number(Ae.y&A),Te=Oe;return ye&&J(Oe)&&(Te=t.neg(Oe),Ne^=1),new W(xe,Te,Ne)}return{seed:ce,k2sig:le}}function ve(ie,oe,fe={}){ie=(0,a.ensureBytes)("message",ie);const{seed:ye,k2sig:be}=Q(ie,oe,fe);return(0,a.createHmacDrbg)(h.outputLen,t.BYTES,p)(ye,be)}function Ee(ie){let oe;const fe=typeof ie=="string"||(0,a.isBytes)(ie),ye=!fe&&ie!==null&&typeof ie=="object"&&typeof ie.r=="bigint"&&typeof ie.s=="bigint";if(!fe&&!ye)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(ye)oe=new W(ie.r,ie.s);else if(fe){try{oe=W.fromBytes((0,a.ensureBytes)("sig",ie),"der")}catch(be){if(!(be instanceof e.DER.Err))throw be}if(!oe)try{oe=W.fromBytes((0,a.ensureBytes)("sig",ie),"compact")}catch{return!1}}return oe||!1}function he(ie,oe,fe,ye={}){const{lowS:be,prehash:ge,format:me}=T(ye,G);if(fe=(0,a.ensureBytes)("publicKey",fe),oe=pe((0,a.ensureBytes)("message",oe),ge),"strict"in ye)throw new Error("options.strict was renamed to lowS");const P=me===void 0?Ee(ie):W.fromBytes((0,a.ensureBytes)("sig",ie),me);if(P===!1)return!1;try{const X=u.fromBytes(fe);if(be&&P.hasHighS())return!1;const{r:ce,s:ae}=P,le=ue(oe),_e=t.inv(ae),we=t.create(le*_e),Se=t.create(ce*_e),Ae=u.BASE.multiplyUnsafe(we).add(X.multiplyUnsafe(Se));return Ae.is0()?!1:t.create(Ae.x)===ce}catch{return!1}}function te(ie,oe,fe={}){const{prehash:ye}=T(fe,G);return oe=pe(oe,ye),W.fromBytes(ie,"recovered").recoverPublicKey(oe).toBytes()}return Object.freeze({keygen:y,getPublicKey:m,getSharedSecret:ee,utils:Y,lengths:C,Point:u,sign:ve,verify:he,recoverPublicKey:te,Signature:W,hash:h})}function Z(u){const{CURVE:h,curveOpts:o}=k(u),i=N(h,o);return F(u,i)}function k(u){const h={a:u.a,b:u.b,p:u.Fp.ORDER,n:u.n,h:u.h,Gx:u.Gx,Gy:u.Gy},o=u.Fp;let i=u.allowedPrivateKeyLengths?Array.from(new Set(u.allowedPrivateKeyLengths.map(t=>Math.ceil(t/2)))):void 0;const p=(0,c.Field)(h.n,{BITS:u.nBitLength,allowedLengths:i,modFromBytes:u.wrapPrivateKey}),l={Fp:o,Fn:p,allowInfinityPoint:u.allowInfinityPoint,endo:u.endo,isTorsionFree:u.isTorsionFree,clearCofactor:u.clearCofactor,fromBytes:u.fromBytes,toBytes:u.toBytes};return{CURVE:h,curveOpts:l}}function $(u){const{CURVE:h,curveOpts:o}=k(u),i={hmac:u.hmac,randomBytes:u.randomBytes,lowS:u.lowS,bits2int:u.bits2int,bits2int_modN:u.bits2int_modN};return{CURVE:h,curveOpts:o,hash:u.hash,ecdsaOpts:i}}function S(u,h,o){function i(p){const l=u.sqr(p),t=u.mul(l,p);return u.add(u.add(t,u.mul(p,h)),o)}return i}function F(u,h){const{Fp:o,Fn:i}=h;function p(t){return(0,a.inRange)(t,A,i.ORDER)}const l=S(o,u.a,u.b);return Object.assign({},{CURVE:u,Point:h,ProjectivePoint:h,normPrivateKeyToScalar:t=>x(i,t),weierstrassEquation:l,isWithinCurveOrder:p})}function D(u,h){const o=h.Point;return Object.assign({},h,{ProjectivePoint:o,CURVE:Object.assign({},u,(0,c.nLength)(o.Fn.ORDER,o.Fn.BITS))})}function V(u){const{CURVE:h,curveOpts:o,hash:i,ecdsaOpts:p}=$(u),l=N(h,o),t=H(l,i,p);return D(u,t)}})(weierstrass)),weierstrass}var hasRequired_shortw_utils;function require_shortw_utils(){if(hasRequired_shortw_utils)return _shortw_utils;hasRequired_shortw_utils=1,Object.defineProperty(_shortw_utils,"__esModule",{value:!0}),_shortw_utils.getHash=r,_shortw_utils.createCurve=v;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireWeierstrass();function r(a){return{hash:a}}function v(a,f){const c=s=>(0,e.weierstrass)({...a,hash:s});return{...c(f),create:c}}return _shortw_utils}var hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1||(hasRequiredSecp256k1=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.secp256k1_hasher=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=requireSha2(),v=requireUtils$2(),a=require_shortw_utils(),f=requireHashToCurve(),c=requireModular(),s=requireWeierstrass(),d=requireUtils$1(),b={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},T={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},R=BigInt(0),q=BigInt(1),A=BigInt(2);function L(D){const V=b.p,u=BigInt(3),h=BigInt(6),o=BigInt(11),i=BigInt(22),p=BigInt(23),l=BigInt(44),t=BigInt(88),g=D*D*D%V,E=g*g*D%V,y=(0,c.pow2)(E,u,V)*E%V,m=(0,c.pow2)(y,u,V)*E%V,ee=(0,c.pow2)(m,A,V)*g%V,Y=(0,c.pow2)(ee,o,V)*ee%V,C=(0,c.pow2)(Y,i,V)*Y%V,G=(0,c.pow2)(C,l,V)*C%V,z=(0,c.pow2)(G,t,V)*G%V,J=(0,c.pow2)(z,l,V)*C%V,ne=(0,c.pow2)(J,u,V)*E%V,U=(0,c.pow2)(ne,p,V)*Y%V,W=(0,c.pow2)(U,h,V)*g%V,re=(0,c.pow2)(W,A,V);if(!w.eql(w.sqr(re),D))throw new Error("Cannot find square root");return re}const w=(0,c.Field)(b.p,{sqrt:L});e.secp256k1=(0,a.createCurve)({...b,Fp:w,lowS:!0,endo:T},r.sha256);const B={};function x(D,...V){let u=B[D];if(u===void 0){const h=(0,r.sha256)((0,d.utf8ToBytes)(D));u=(0,d.concatBytes)(h,h),B[D]=u}return(0,r.sha256)((0,d.concatBytes)(u,...V))}const N=D=>D.toBytes(!0).slice(1),M=e.secp256k1.Point,K=D=>D%A===R;function j(D){const{Fn:V,BASE:u}=M,h=(0,s._normFnElement)(V,D),o=u.multiply(h);return{scalar:K(o.y)?h:V.neg(h),bytes:N(o)}}function _(D){const V=w;if(!V.isValidNot0(D))throw new Error("invalid x: Fail if x \u2265 p");const u=V.create(D*D),h=V.create(u*D+BigInt(7));let o=V.sqrt(h);K(o)||(o=V.neg(o));const i=M.fromAffine({x:D,y:o});return i.assertValidity(),i}const O=d.bytesToNumberBE;function H(...D){return M.Fn.create(O(x("BIP0340/challenge",...D)))}function Z(D){return j(D).bytes}function k(D,V,u=(0,v.randomBytes)(32)){const{Fn:h}=M,o=(0,d.ensureBytes)("message",D),{bytes:i,scalar:p}=j(V),l=(0,d.ensureBytes)("auxRand",u,32),t=h.toBytes(p^O(x("BIP0340/aux",l))),g=x("BIP0340/nonce",t,i,o),{bytes:E,scalar:y}=j(g),m=H(E,i,o),ee=new Uint8Array(64);if(ee.set(E,0),ee.set(h.toBytes(h.create(y+m*p)),32),!$(ee,o,i))throw new Error("sign: Invalid signature produced");return ee}function $(D,V,u){const{Fn:h,BASE:o}=M,i=(0,d.ensureBytes)("signature",D,64),p=(0,d.ensureBytes)("message",V),l=(0,d.ensureBytes)("publicKey",u,32);try{const t=_(O(l)),g=O(i.subarray(0,32));if(!(0,d.inRange)(g,q,b.p))return!1;const E=O(i.subarray(32,64));if(!(0,d.inRange)(E,q,b.n))return!1;const y=H(h.toBytes(g),N(t),p),m=o.multiplyUnsafe(E).add(t.multiplyUnsafe(h.neg(y))),{x:ee,y:Y}=m.toAffine();return!(m.is0()||!K(Y)||ee!==g)}catch{return!1}}e.schnorr=(()=>{const u=(o=(0,v.randomBytes)(48))=>(0,c.mapHashToField)(o,b.n);e.secp256k1.utils.randomSecretKey;function h(o){const i=u(o);return{secretKey:i,publicKey:Z(i)}}return{keygen:h,getPublicKey:Z,sign:k,verify:$,Point:M,utils:{randomSecretKey:u,randomPrivateKey:u,taggedHash:x,lift_x:_,pointToBytes:N,numberToBytesBE:d.numberToBytesBE,bytesToNumberBE:d.bytesToNumberBE,mod:c.mod},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})();const S=(0,f.isogenyMap)(w,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(D=>D.map(V=>BigInt(V)))),F=(0,s.mapToCurveSimpleSWU)(w,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:w.create(BigInt("-11"))});e.secp256k1_hasher=(0,f.createHasher)(e.secp256k1.Point,D=>{const{x:V,y:u}=F(w.create(D[0]));return S(V,u)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:w.ORDER,m:1,k:128,expand:"xmd",hash:r.sha256}),e.hashToCurve=e.secp256k1_hasher.hashToCurve,e.encodeToCurve=e.secp256k1_hasher.encodeToCurve})(secp256k1)),secp256k1}var hex={},hasRequiredHex;function requireHex(){return hasRequiredHex||(hasRequiredHex=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0;var r=requireUtils$3(),v=function(f){return f.startsWith("0x")||f.startsWith("0X")?f.slice(2):f};e.remove0x=v;var a=function(f){return(0,r.hexToBytes)((0,e.remove0x)(f))};e.decodeHex=a})(hex)),hex}var hasRequiredElliptic;function requireElliptic(){return hasRequiredElliptic||(hasRequiredElliptic=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0;var r=requireWebcrypto(),v=requireEd25519(),a=requireSecp256k1(),f=requireConfig$1(),c=requireConsts(),s=requireHex(),d=function(x){var N;do N=(0,r.randomBytes)(c.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(N,x));return N};e.getValidSecret=d;var b=function(x,N){return L(N,function(M){return M.utils.isValidSecretKey(x)},function(){return!0},function(){return!0})};e.isValidPrivateKey=b;var T=function(x,N){return L(N,function(M){return M.getPublicKey(x)},function(M){return M.getPublicKey(x)},function(M){return M.getPublicKey(x)})};e.getPublicKey=T;var R=function(x,N,M,K){return L(K,function(j){return j.getSharedSecret(x,N,M)},function(j){return j.getSharedSecret(x,N)},function(j){return B(j,x,N)})};e.getSharedPoint=R;var q=function(x,N,M){return L(M,function(K){return K.getSharedSecret(Uint8Array.from(Array(31).fill(0).concat([1])),x,N)},function(){return x},function(){return x})};e.convertPublicKeyFormat=q;var A=function(x,N){var M=(0,s.decodeHex)(x);return L(N,function(){return w(M)},function(){return M},function(){return M})};e.hexToPublicKey=A;function L(x,N,M,K){var j=x||(0,f.ellipticCurve)();if(j==="secp256k1")return N(a.secp256k1);if(j==="x25519")return M(v.x25519);if(j==="ed25519")return K(v.ed25519);throw new Error("Not implemented")}var w=function(x){if(x.length===c.ETH_PUBLIC_KEY_SIZE){var N=new Uint8Array(1+x.length);return N.set([4]),N.set(x,1),N}return x},B=function(x,N,M){var K=x.utils.getExtendedPublicKey(N).scalar,j=x.Point.fromBytes(M).multiply(K);return j.toBytes()}})(elliptic)),elliptic}var hash={},hkdf={},hasRequiredHkdf;function requireHkdf(){if(hasRequiredHkdf)return hkdf;hasRequiredHkdf=1,Object.defineProperty(hkdf,"__esModule",{value:!0}),hkdf.hkdf=void 0,hkdf.extract=v,hkdf.expand=c;const e=requireHmac(),r=requireUtils$2();function v(d,b,T){return(0,r.ahash)(d),T===void 0&&(T=new Uint8Array(d.outputLen)),(0,e.hmac)(d,(0,r.toBytes)(T),(0,r.toBytes)(b))}const a=Uint8Array.from([0]),f=Uint8Array.of();function c(d,b,T,R=32){(0,r.ahash)(d),(0,r.anumber)(R);const q=d.outputLen;if(R>255*q)throw new Error("Length should be <= 255*HashLen");const A=Math.ceil(R/q);T===void 0&&(T=f);const L=new Uint8Array(A*q),w=e.hmac.create(d,b),B=w._cloneInto(),x=new Uint8Array(w.outputLen);for(let N=0;N<A;N++)a[0]=N+1,B.update(N===0?f:x).update(T).update(a).digestInto(x),L.set(x,q*N),w._cloneInto(B);return w.destroy(),B.destroy(),(0,r.clean)(x,a),L.slice(0,R)}const s=(d,b,T,R,q)=>c(d,v(d,b,T),R,q);return hkdf.hkdf=s,hkdf}var hasRequiredHash;function requireHash(){return hasRequiredHash||(hasRequiredHash=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0;var r=requireUtils$3(),v=requireHkdf(),a=requireSha2(),f=function(s,d,b){return(0,v.hkdf)(a.sha256,s,d,b,32)};e.deriveKey=f;var c=function(){for(var s=[],d=0;d<arguments.length;d++)s[d]=arguments[d];return(0,e.deriveKey)(r.concatBytes.apply(void 0,s))};e.getSharedKey=c})(hash)),hash}var symmetric={},node$1={},compat={};const require$1=node_module.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("index.cjs",document.baseURI).href);function __require(){return require$1("node:crypto")}var hasRequiredCompat;function requireCompat(){if(hasRequiredCompat)return compat;hasRequiredCompat=1,Object.defineProperty(compat,"__esModule",{value:!0}),compat._compat=void 0;var e=requireUtils$3(),r=__require(),v=16,a=globalThis.Deno!==void 0,f=function(c,s,d,b){var T=c==="aes-256-gcm"||c==="chacha20-poly1305",R=T?v:0,q=T?{authTagLength:R}:void 0,A=function(w){var B=(0,r.createCipheriv)(c,s,d,q);T&&b!==void 0&&B.setAAD(b);var x=B.update(w),N=B.final(),M=T?B.getAuthTag():new Uint8Array(0);return(0,e.concatBytes)(x,N,M)},L=function(w){var B=w.subarray(0,w.length-R),x=w.subarray(w.length-R),N=(0,r.createDecipheriv)(c,s,d,q);T&&(b!==void 0&&N.setAAD(b),N.setAuthTag(x)),!T&&a&&N.setAutoPadding(!1);var M=N.update(B),K=N.final();return(0,e.concatBytes)(M,K)};return{encrypt:A,decrypt:L}};return compat._compat=f,compat}var hasRequiredNode$1;function requireNode$1(){if(hasRequiredNode$1)return node$1;hasRequiredNode$1=1,Object.defineProperty(node$1,"__esModule",{value:!0}),node$1.aes256cbc=node$1.aes256gcm=void 0;var e=requireCompat(),r=function(a,f,c){return(0,e._compat)("aes-256-gcm",a,f,c)};node$1.aes256gcm=r;var v=function(a,f,c){return(0,e._compat)("aes-256-cbc",a,f)};return node$1.aes256cbc=v,node$1}var node={},hchacha={},hasRequiredHchacha;function requireHchacha(){if(hasRequiredHchacha)return hchacha;hasRequiredHchacha=1,Object.defineProperty(hchacha,"__esModule",{value:!0}),hchacha._hchacha20=void 0;var e=function(v,a,f,c){for(var s=v[0],d=v[1],b=v[2],T=v[3],R=a[0],q=a[1],A=a[2],L=a[3],w=a[4],B=a[5],x=a[6],N=a[7],M=f[0],K=f[1],j=f[2],_=f[3],O=0;O<20;O+=2)s=s+R|0,M=r(M^s,16),w=w+M|0,R=r(R^w,12),s=s+R|0,M=r(M^s,8),w=w+M|0,R=r(R^w,7),d=d+q|0,K=r(K^d,16),B=B+K|0,q=r(q^B,12),d=d+q|0,K=r(K^d,8),B=B+K|0,q=r(q^B,7),b=b+A|0,j=r(j^b,16),x=x+j|0,A=r(A^x,12),b=b+A|0,j=r(j^b,8),x=x+j|0,A=r(A^x,7),T=T+L|0,_=r(_^T,16),N=N+_|0,L=r(L^N,12),T=T+L|0,_=r(_^T,8),N=N+_|0,L=r(L^N,7),s=s+q|0,_=r(_^s,16),x=x+_|0,q=r(q^x,12),s=s+q|0,_=r(_^s,8),x=x+_|0,q=r(q^x,7),d=d+A|0,M=r(M^d,16),N=N+M|0,A=r(A^N,12),d=d+A|0,M=r(M^d,8),N=N+M|0,A=r(A^N,7),b=b+L|0,K=r(K^b,16),w=w+K|0,L=r(L^w,12),b=b+L|0,K=r(K^b,8),w=w+K|0,L=r(L^w,7),T=T+R|0,j=r(j^T,16),B=B+j|0,R=r(R^B,12),T=T+R|0,j=r(j^T,8),B=B+j|0,R=r(R^B,7);var H=0;c[H++]=s,c[H++]=d,c[H++]=b,c[H++]=T,c[H++]=M,c[H++]=K,c[H++]=j,c[H++]=_};hchacha._hchacha20=e;var r=function(v,a){return v<<a|v>>>32-a};return hchacha}var hasRequiredNode;function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1,Object.defineProperty(node,"__esModule",{value:!0}),node.chacha20=node.xchacha20=void 0;var e=requireUtils$3(),r=requireCompat(),v=requireHchacha(),a=function(c,s,d){if(s.length!==24)throw new Error("xchacha20's nonce must be 24 bytes");var b=new Uint32Array([1634760805,857760878,2036477234,1797285236]),T=new Uint32Array(8);(0,v._hchacha20)(b,(0,e.u32)(c),(0,e.u32)(s.subarray(0,16)),T);var R=new Uint8Array(12);return R.set([0,0,0,0]),R.set(s.subarray(16),4),(0,r._compat)("chacha20-poly1305",(0,e.u8)(T),R,d)};node.xchacha20=a;var f=function(c,s,d){if(s.length!==12)throw new Error("chacha20's nonce must be 12 bytes");return(0,r._compat)("chacha20-poly1305",c,s,d)};return node.chacha20=f,node}var hasRequiredSymmetric;function requireSymmetric(){return hasRequiredSymmetric||(hasRequiredSymmetric=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var r=requireNode$1(),v=requireNode(),a=requireUtils$3(),f=requireWebcrypto(),c=requireConfig$1(),s=requireConsts(),d=function(A,L,w){return T(R,A,L,w)};e.symEncrypt=d;var b=function(A,L,w){return T(q,A,L,w)};e.symDecrypt=b,e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt;function T(A,L,w,B){var x=(0,c.symmetricAlgorithm)();if(x==="aes-256-gcm")return A(r.aes256gcm,L,w,(0,c.symmetricNonceLength)(),s.AEAD_TAG_LENGTH,B);if(x==="xchacha20")return A(v.xchacha20,L,w,s.XCHACHA20_NONCE_LENGTH,s.AEAD_TAG_LENGTH,B);if(x==="aes-256-cbc")return A(r.aes256cbc,L,w,16,0);throw new Error("Not implemented")}function R(A,L,w,B,x,N){var M=(0,f.randomBytes)(B),K=A(L,M,N),j=K.encrypt(w);if(x===0)return(0,a.concatBytes)(M,j);var _=j.length-x,O=j.subarray(0,_),H=j.subarray(_);return(0,a.concatBytes)(M,H,O)}function q(A,L,w,B,x,N){var M=w.subarray(0,B),K=A(L,Uint8Array.from(M),N),j=w.subarray(B);if(x===0)return K.decrypt(j);var _=j.subarray(0,x),O=j.subarray(x);return K.decrypt((0,a.concatBytes)(O,_))}})(symmetric)),symmetric}var hasRequiredUtils;function requireUtils(){return hasRequiredUtils||(hasRequiredUtils=1,(function(e){var r=utils$2&&utils$2.__createBinding||(Object.create?(function(a,f,c,s){s===void 0&&(s=c);var d=Object.getOwnPropertyDescriptor(f,c);(!d||("get"in d?!f.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return f[c]}}),Object.defineProperty(a,s,d)}):(function(a,f,c,s){s===void 0&&(s=c),a[s]=f[c]})),v=utils$2&&utils$2.__exportStar||function(a,f){for(var c in a)c!=="default"&&!Object.prototype.hasOwnProperty.call(f,c)&&r(f,a,c)};Object.defineProperty(e,"__esModule",{value:!0}),v(requireElliptic(),e),v(requireHash(),e),v(requireHex(),e),v(requireSymmetric(),e)})(utils$2)),utils$2}var PublicKey={},hasRequiredPublicKey;function requirePublicKey(){if(hasRequiredPublicKey)return PublicKey;hasRequiredPublicKey=1,Object.defineProperty(PublicKey,"__esModule",{value:!0}),PublicKey.PublicKey=void 0;var e=requireUtils$3(),r=requireUtils(),v=(function(){function a(f,c){var s=(0,r.convertPublicKeyFormat)(f,!0,c),d=(0,r.convertPublicKeyFormat)(f,!1,c);this.data=s,this.dataUncompressed=s.length!==d.length?d:null}return a.fromHex=function(f,c){return new a((0,r.hexToPublicKey)(f,c),c)},Object.defineProperty(a.prototype,"_uncompressed",{get:function(){return this.dataUncompressed!==null?this.dataUncompressed:this.data},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"uncompressed",{get:function(){return Buffer.from(this._uncompressed)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"compressed",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),a.prototype.toBytes=function(f){return f===void 0&&(f=!0),f?this.data:this._uncompressed},a.prototype.toHex=function(f){return f===void 0&&(f=!0),(0,e.bytesToHex)(this.toBytes(f))},a.prototype.decapsulate=function(f,c){c===void 0&&(c=!1);var s=this.toBytes(c),d=f.multiply(this,c);return(0,r.getSharedKey)(s,d)},a.prototype.equals=function(f){return(0,e.equalBytes)(this.data,f.data)},a})();return PublicKey.PublicKey=v,PublicKey}var hasRequiredPrivateKey;function requirePrivateKey(){if(hasRequiredPrivateKey)return PrivateKey;hasRequiredPrivateKey=1,Object.defineProperty(PrivateKey,"__esModule",{value:!0}),PrivateKey.PrivateKey=void 0;var e=requireUtils$3(),r=requireUtils(),v=requirePublicKey(),a=(function(){function f(c,s){if(this.curve=s,c===void 0)this.data=(0,r.getValidSecret)(s);else if((0,r.isValidPrivateKey)(c,s))this.data=c;else throw new Error("Invalid private key");this.publicKey=new v.PublicKey((0,r.getPublicKey)(this.data,s),s)}return f.fromHex=function(c,s){return new f((0,r.decodeHex)(c),s)},Object.defineProperty(f.prototype,"secret",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),f.prototype.toHex=function(){return(0,e.bytesToHex)(this.data)},f.prototype.encapsulate=function(c,s){s===void 0&&(s=!1);var d=this.publicKey.toBytes(s),b=this.multiply(c,s);return(0,r.getSharedKey)(d,b)},f.prototype.multiply=function(c,s){return s===void 0&&(s=!1),(0,r.getSharedPoint)(this.data,c.toBytes(!0),s,this.curve)},f.prototype.equals=function(c){return(0,e.equalBytes)(this.data,c.data)},f})();return PrivateKey.PrivateKey=a,PrivateKey}var hasRequiredKeys;function requireKeys(){return hasRequiredKeys||(hasRequiredKeys=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var r=requirePrivateKey();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return r.PrivateKey}});var v=requirePublicKey();Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return v.PublicKey}})})(keys)),keys}var hasRequiredDist;function requireDist(){return hasRequiredDist||(hasRequiredDist=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=c,e.decrypt=d;var r=requireUtils$3(),v=requireConfig$1(),a=requireKeys(),f=requireUtils();function c(q,A){return Buffer.from(s(q,A))}function s(q,A){var L=(0,v.ellipticCurve)(),w=new a.PrivateKey(void 0,L),B=q instanceof Uint8Array?new a.PublicKey(q,L):a.PublicKey.fromHex(q,L),x=w.encapsulate(B,(0,v.isHkdfKeyCompressed)()),N=w.publicKey.toBytes((0,v.isEphemeralKeyCompressed)()),M=(0,f.symEncrypt)(x,A);return(0,r.concatBytes)(N,M)}function d(q,A){return Buffer.from(b(q,A))}function b(q,A){var L=(0,v.ellipticCurve)(),w=q instanceof Uint8Array?new a.PrivateKey(q,L):a.PrivateKey.fromHex(q,L),B=(0,v.ephemeralKeySize)(),x=new a.PublicKey(A.subarray(0,B),L),N=A.subarray(B),M=x.decapsulate(w,(0,v.isHkdfKeyCompressed)());return(0,f.symDecrypt)(M,N)}var T=requireConfig$1();Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return T.ECIES_CONFIG}});var R=requireKeys();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return R.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return R.PublicKey}}),e.utils={aesEncrypt:f.aesEncrypt,aesDecrypt:f.aesDecrypt,symEncrypt:f.symEncrypt,symDecrypt:f.symDecrypt,decodeHex:f.decodeHex,getValidSecret:f.getValidSecret,remove0x:f.remove0x}})(dist)),dist}var truncate_1,hasRequiredTruncate;function requireTruncate(){if(hasRequiredTruncate)return truncate_1;hasRequiredTruncate=1;function e(r,v=7){return r&&r.length>0?r.slice(0,v)+"\u2026":""}return truncate_1=e,truncate_1}var errors,hasRequiredErrors;function requireErrors(){if(hasRequiredErrors)return errors;hasRequiredErrors=1;const e=requireTruncate();class r{constructor(a={}){this.filepath=a.filepath,this.envFilepath=a.envFilepath,this.key=a.key,this.privateKey=a.privateKey,this.privateKeyName=a.privateKeyName,this.command=a.command,this.message=a.message}missingEnvFile(){const a="MISSING_ENV_FILE",f=`[${a}] missing ${this.envFilepath} file (${this.filepath})`,c=`[${a}] https://github.com/dotenvx/dotenvx/issues/484`,s=new Error(f);return s.code=a,s.help=c,s}missingKey(){const a="MISSING_KEY",f=`[${a}] missing ${this.key} key`,c=new Error(f);return c.code=a,c}missingPrivateKey(){const a="MISSING_PRIVATE_KEY",f=`[${a}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,c=`[${a}] https://github.com/dotenvx/dotenvx/issues/464`,s=new Error(f);return s.code=a,s.help=c,s}invalidPrivateKey(){const a="INVALID_PRIVATE_KEY",f=`[${a}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,c=`[${a}] https://github.com/dotenvx/dotenvx/issues/465`,s=new Error(f);return s.code=a,s.help=c,s}looksWrongPrivateKey(){const a="WRONG_PRIVATE_KEY",f=`[${a}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,c=`[${a}] https://github.com/dotenvx/dotenvx/issues/466`,s=new Error(f);return s.code=a,s.help=c,s}malformedEncryptedData(){const a="MALFORMED_ENCRYPTED_DATA",f=`[${a}] could not decrypt ${this.key} because encrypted data appears malformed`,c=`[${a}] https://github.com/dotenvx/dotenvx/issues/467`,s=new Error(f);return s.code=a,s.help=c,s}decryptionFailed(){const a="DECRYPTION_FAILED",f=this.message,c=new Error(f);return c.code=a,c}commandSubstitutionFailed(){const a="COMMAND_SUBSTITUTION_FAILED",f=`[${a}] could not eval ${this.key} containing command '${this.command}': ${this.message}`,c=`[${a}] https://github.com/dotenvx/dotenvx/issues/532`,s=new Error(f);return s.code=a,s.help=c,s}dangerousDependencyHoist(){const a="DANGEROUS_DEPENDENCY_HOIST",f=`[${a}] your environment has hoisted an incompatible version of a dotenvx dependency: ${this.message}`,c=`[${a}] https://github.com/dotenvx/dotenvx/issues/622`,s=new Error(f);return s.code=a,s.help=c,s}}return errors=r,errors}var decryptKeyValue_1,hasRequiredDecryptKeyValue;function requireDecryptKeyValue(){if(hasRequiredDecryptKeyValue)return decryptKeyValue_1;hasRequiredDecryptKeyValue=1;const{decrypt:e}=requireDist(),r=requireErrors(),v="encrypted:";function a(f,c,s,d){let b,T;if(!c.startsWith(v))return c;if(d=d||"",d.length<=0)T=new r({key:f,privateKeyName:s,privateKey:d}).missingPrivateKey();else{const R=d.split(",");for(const q of R){const A=Buffer.from(q,"hex"),L=c.substring(v.length),w=Buffer.from(L,"base64");try{b=e(A,w).toString(),T=null;break}catch(B){B.message==="Invalid private key"?T=new r({key:f,privateKeyName:s,privateKey:d}).invalidPrivateKey():B.message==="Unsupported state or unable to authenticate data"?T=new r({key:f,privateKeyName:s,privateKey:d}).looksWrongPrivateKey():B.message==="Point of length 65 was invalid. Expected 33 compressed bytes or 65 uncompressed bytes"?T=new r({key:f,privateKeyName:s,privateKey:d}).malformedEncryptedData():T=new r({key:f,privateKeyName:s,privateKey:d,message:B.message}).decryptionFailed()}}}if(T)throw T;return b}return decryptKeyValue_1=a,decryptKeyValue_1}var chomp_1,hasRequiredChomp;function requireChomp(){if(hasRequiredChomp)return chomp_1;hasRequiredChomp=1;function e(r){return r.replace(/[\r\n]+$/,"")}return chomp_1=e,chomp_1}var evalKeyValue_1,hasRequiredEvalKeyValue;function requireEvalKeyValue(){if(hasRequiredEvalKeyValue)return evalKeyValue_1;hasRequiredEvalKeyValue=1;const{execSync:e}=require$$1__default,r=requireChomp(),v=requireErrors();function a(f,c,s,d){return(c.match(/\$\(([^)]+(?:\)[^(]*)*)\)/g)||[]).reduce((T,R)=>{const q=R.slice(2,-1);let A;try{A=e(q,{env:{...s,...d}}).toString()}catch(L){throw new v({key:f,command:q,message:L.message.trim()}).commandSubstitutionFailed()}return A=r(A),T.replace(R,A)},c)}return evalKeyValue_1=a,evalKeyValue_1}var resolveEscapeSequences_1,hasRequiredResolveEscapeSequences;function requireResolveEscapeSequences(){if(hasRequiredResolveEscapeSequences)return resolveEscapeSequences_1;hasRequiredResolveEscapeSequences=1;function e(r){return r.replace(/\\\$/g,"$")}return resolveEscapeSequences_1=e,resolveEscapeSequences_1}var parse,hasRequiredParse;function requireParse(){if(hasRequiredParse)return parse;hasRequiredParse=1;const e=requireDecryptKeyValue(),r=requireEvalKeyValue(),v=requireResolveEscapeSequences();class a{static LINE=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;constructor(c,s=null,d=process.env,b=!1,T=null){this.src=c,this.privateKey=s,this.privateKeyName=T,this.processEnv=d,this.overload=b,this.parsed={},this.preExisted={},this.injected={},this.errors=[],this.runningParsed={},this.literals={}}run(){const c=this.getLines();let s;for(;(s=a.LINE.exec(c))!==null;){const d=s[1],b=s[2],T=this.quote(b);this.parsed[d]=this.clean(b,T),!this.overload&&this.inProcessEnv(d)&&(this.parsed[d]=this.processEnv[d]);try{this.parsed[d]=this.decrypt(d,this.parsed[d])}catch(q){this.errors.push(q)}let R=!1;if(T!=="'"&&(!this.inProcessEnv(d)||this.processEnv[d]===this.parsed[d])){const q=this.parsed[d];try{this.parsed[d]=this.eval(d,q)}catch(A){this.errors.push(A)}q!==this.parsed[d]&&(R=!0)}!R&&T!=="'"&&(!this.processEnv[d]||this.overload)&&(this.parsed[d]=v(this.expand(this.parsed[d]))),T==="'"&&(this.literals[d]=this.parsed[d]),this.runningParsed[d]=this.parsed[d],Object.prototype.hasOwnProperty.call(this.processEnv,d)&&!this.overload?this.preExisted[d]=this.processEnv[d]:this.injected[d]=this.parsed[d]}return{parsed:this.parsed,processEnv:this.processEnv,injected:this.injected,preExisted:this.preExisted,errors:this.errors}}trimmer(c){return(c||"").trim()}quote(c){const d=this.trimmer(c)[0];let b="";switch(d){case"'":b="'";break;case'"':b='"';break;case"`":b="`";break;default:b=""}return b}clean(c,s){let d=this.trimmer(c);return d=d.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),s==='"'&&(d=d.replace(/\\n/g,`
|
|
5
|
+
`),d=d.replace(/\\r/g,"\r"),d=d.replace(/\\t/g," ")),d}decrypt(c,s){return e(c,s,this.privateKeyName,this.privateKey)}eval(c,s){return r(c,s,this.processEnv,this.runningParsed)}expand(c){let s={...this.runningParsed,...this.processEnv};this.overload&&(s={...this.processEnv,...this.runningParsed});const d=/(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g;let b=c,T;for(;(T=d.exec(b))!==null;){const[R,q,A]=T,L=q||A,w=/(:\+|\+|:-|-)/,B=L.match(w),x=B?B[0]:null,N=L.split(x);let M,K;const j=N.shift();if([":+","+"].includes(x)?(M=s[j]?N.join(x):"",K=null):(M=N.join(x),K=s[j]),K?b=b.replace(R,K):b=b.replace(R,M),b===s[j]||this.literals[j]&&/\$\{[^}]+\}|\$[A-Za-z_][A-Za-z0-9_]*/.test(this.literals[j]))break;d.lastIndex=0}return b}inProcessEnv(c){return Object.prototype.hasOwnProperty.call(this.processEnv,c)}getLines(){return(this.src||"").toString().replace(/\r\n?/mg,`
|
|
6
|
+
`)}}return parse=a,parse}var dotenvParse_1,hasRequiredDotenvParse;function requireDotenvParse(){if(hasRequiredDotenvParse)return dotenvParse_1;hasRequiredDotenvParse=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function r(v,a=!1,f=!1,c=!1){const s={};let d=v.toString();f||(d=d.replace(/\r\n?/mg,`
|
|
7
|
+
`));let b;for(;(b=e.exec(d))!=null;){const T=b[1];let R=b[2]||"";R=R.trim();const q=R[0];R=R.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),q==='"'&&!a&&(R=R.replace(/\\n/g,`
|
|
8
|
+
`),R=R.replace(/\\r/g,"\r"),R=R.replace(/\\t/g," ")),c?(s[T]=s[T]||[],s[T].push(R)):s[T]=R}return s}return dotenvParse_1=r,dotenvParse_1}var parseEnvironmentFromDotenvKey_1,hasRequiredParseEnvironmentFromDotenvKey;function requireParseEnvironmentFromDotenvKey(){if(hasRequiredParseEnvironmentFromDotenvKey)return parseEnvironmentFromDotenvKey_1;hasRequiredParseEnvironmentFromDotenvKey=1;function e(r){let v;try{v=new URL(r)}catch(f){throw new Error(`INVALID_DOTENV_KEY: ${f.message}`)}const a=v.searchParams.get("environment");if(!a)throw new Error("INVALID_DOTENV_KEY: Missing environment part");return a}return parseEnvironmentFromDotenvKey_1=e,parseEnvironmentFromDotenvKey_1}var detectEncoding_1,hasRequiredDetectEncoding;function requireDetectEncoding(){if(hasRequiredDetectEncoding)return detectEncoding_1;hasRequiredDetectEncoding=1;const e=require$$0__default;function r(v){const a=e.readFileSync(v);return a.length>=2&&a[0]===255&&a[1]===254?"utf16le":(a.length>=3&&a[0]===239&&a[1]===187&&a[2]===191,"utf8")}return detectEncoding_1=r,detectEncoding_1}var guessEnvironment_1,hasRequiredGuessEnvironment;function requireGuessEnvironment(){if(hasRequiredGuessEnvironment)return guessEnvironment_1;hasRequiredGuessEnvironment=1;const e=require$$0__default$1;function r(v){const a=e.basename(v),c=[...a.split(".").slice(2)];return c.length===0?a.replace(".env","development"):c.length===1?c[0]:c.length===2?c.join("_"):c.slice(0,2).join("_")}return guessEnvironment_1=r,guessEnvironment_1}var guessPrivateKeyName_1,hasRequiredGuessPrivateKeyName;function requireGuessPrivateKeyName(){if(hasRequiredGuessPrivateKeyName)return guessPrivateKeyName_1;hasRequiredGuessPrivateKeyName=1;const e=require$$0__default$1,r=requireGuessEnvironment();function v(a){const f=e.basename(a).toLowerCase();return f===".env"?"DOTENV_PRIVATE_KEY":`DOTENV_PRIVATE_KEY_${r(f).toUpperCase()}`}return guessPrivateKeyName_1=v,guessPrivateKeyName_1}var guessPublicKeyName_1,hasRequiredGuessPublicKeyName;function requireGuessPublicKeyName(){if(hasRequiredGuessPublicKeyName)return guessPublicKeyName_1;hasRequiredGuessPublicKeyName=1;const e=require$$0__default$1,r=requireGuessEnvironment();function v(a){const f=e.basename(a).toLowerCase();return f===".env"?"DOTENV_PUBLIC_KEY":`DOTENV_PUBLIC_KEY_${r(f).toUpperCase()}`}return guessPublicKeyName_1=v,guessPublicKeyName_1}var proKeypair,hasRequiredProKeypair;function requireProKeypair(){if(hasRequiredProKeypair)return proKeypair;hasRequiredProKeypair=1;const e=require$$0__default$1,r=require$$1__default,v=requireGuessPrivateKeyName(),a=requireGuessPublicKeyName();class f{constructor(s){this.envFilepath=s}run(){let s={};try{const d=e.resolve(process.cwd(),"node_modules/.bin/dotenvx-pro"),b=r.execSync(`${d} keypair -f ${this.envFilepath}`,{stdio:["pipe","pipe","ignore"]}).toString().trim();s=JSON.parse(b)}catch{try{const b=r.execSync(`dotenvx-pro keypair -f ${this.envFilepath}`,{stdio:["pipe","pipe","ignore"]}).toString().trim();s=JSON.parse(b)}catch{const T=v(this.envFilepath),R=a(this.envFilepath);s[T]=null,s[R]=null}}return s}}return proKeypair=f,proKeypair}var smartDotenvPublicKey_1,hasRequiredSmartDotenvPublicKey;function requireSmartDotenvPublicKey(){if(hasRequiredSmartDotenvPublicKey)return smartDotenvPublicKey_1;hasRequiredSmartDotenvPublicKey=1;const e=requireFsx(),r=requireDotenvParse(),v=requireGuessPublicKeyName();function a(s){if(process.env[s]&&process.env[s].length>0)return process.env[s]}function f(s,d){if(e.existsSync(d)){const b=e.readFileX(d),T=r(b);if(T[s]&&T[s].length>0)return T[s]}}function c(s){let d=null;const b=v(s);return d=a(b),d||(d=f(b,s),d)?d:null}return smartDotenvPublicKey_1=c,smartDotenvPublicKey_1}var smartDotenvPrivateKey_1,hasRequiredSmartDotenvPrivateKey;function requireSmartDotenvPrivateKey(){if(hasRequiredSmartDotenvPrivateKey)return smartDotenvPrivateKey_1;hasRequiredSmartDotenvPrivateKey=1;const e=requireFsx(),r=require$$0__default$1,v="DOTENV_PUBLIC_KEY",a="DOTENV_PRIVATE_KEY",f=requireDotenvParse(),c=requireGuessPrivateKeyName();function s(R){if(process.env[R]&&process.env[R].length>0)return process.env[R]}function d(R,q,A=null){let L=r.resolve(r.dirname(q),".env.keys");if(A&&(L=r.resolve(A)),e.existsSync(L)){const w=e.readFileX(L),B=f(w);if(B[R]&&B[R].length>0)return B[R]}}function b(R){if(!e.existsSync(R))return null;const q=e.readFileX(R),A=f(q);let L;for(const w of Object.keys(A))(w===v||w.startsWith(v))&&(L=w);return L?L.replace(v,a):null}function T(R,q=null){let A=null,L=c(R);return A=s(L),A||(A=d(L,R,q),A)||(L=b(R),L&&(A=s(L),A||(A=d(L,R,q),A)))?A:null}return smartDotenvPrivateKey_1=T,smartDotenvPrivateKey_1}var keypair,hasRequiredKeypair$1;function requireKeypair$1(){if(hasRequiredKeypair$1)return keypair;hasRequiredKeypair$1=1;const e=requireGuessPublicKeyName(),r=requireSmartDotenvPublicKey(),v=requireGuessPrivateKeyName(),a=requireSmartDotenvPrivateKey();class f{constructor(s=".env",d=null){this.envFile=s,this.envKeysFilepath=d}run(){const s={},d=this._envFilepaths();for(const b of d){const T=e(b),R=r(b);s[T]=R;const q=v(b),A=a(b,this.envKeysFilepath);s[q]=A}return s}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return keypair=f,keypair}var findPrivateKey_1,hasRequiredFindPrivateKey;function requireFindPrivateKey(){if(hasRequiredFindPrivateKey)return findPrivateKey_1;hasRequiredFindPrivateKey=1;const e=requireGuessPrivateKeyName(),r=requireProKeypair(),v=requireKeypair$1();function a(f,c=null,s=!0){const d=e(f);let b={};s&&(b=new r(f).run());const T=new v(f,c).run();return b[d]||T[d]}return findPrivateKey_1={findPrivateKey:a},findPrivateKey_1}var dotenvPrivateKeyNames_1,hasRequiredDotenvPrivateKeyNames;function requireDotenvPrivateKeyNames(){if(hasRequiredDotenvPrivateKeyNames)return dotenvPrivateKeyNames_1;hasRequiredDotenvPrivateKeyNames=1;const e="DOTENV_PRIVATE_KEY";function r(v){return Object.keys(v).filter(a=>a.startsWith(e))}return dotenvPrivateKeyNames_1=r,dotenvPrivateKeyNames_1}var guessPrivateKeyFilename_1,hasRequiredGuessPrivateKeyFilename;function requireGuessPrivateKeyFilename(){if(hasRequiredGuessPrivateKeyFilename)return guessPrivateKeyFilename_1;hasRequiredGuessPrivateKeyFilename=1;const e="DOTENV_PRIVATE_KEY";function r(v){return v===e?".env":`.env.${v.substring(`${e}_`.length).split("_").join(".").toLowerCase()}`}return guessPrivateKeyFilename_1=r,guessPrivateKeyFilename_1}var determineEnvs_1,hasRequiredDetermineEnvs;function requireDetermineEnvs(){if(hasRequiredDetermineEnvs)return determineEnvs_1;hasRequiredDetermineEnvs=1;const e=requireDotenvPrivateKeyNames(),r=requireGuessPrivateKeyFilename(),v="envFile",a="envVaultFile",f=[{type:v,value:".env"}],c=[{type:a,value:".env.vault"}];function s(b){const T=[];for(const R of b){const q=r(R);T.push({type:v,value:q})}return T}function d(b=[],T,R=""){const q=e(T);if(!b||b.length<=0)return q.length>0?s(q):R.length>0?c:f;{let A=!1;for(const L of b)R.length>0&&L.type===a&&(A=!0),R.length<=0&&L.type===v&&(A=!0);return A?b:R.length>0?[...c,...b]:[...f,...b]}}return determineEnvs_1=d,determineEnvs_1}var run,hasRequiredRun;function requireRun(){if(hasRequiredRun)return run;hasRequiredRun=1;const e=requireFsx(),r=require$$0__default$1,v="env",a="envFile",f="envVaultFile",c=requireDecrypt(),s=requireParse(),d=requireErrors(),b=requireDotenvParse(),T=requireParseEnvironmentFromDotenvKey(),R=requireDetectEncoding(),{findPrivateKey:q}=requireFindPrivateKey(),A=requireGuessPrivateKeyName(),L=requireDetermineEnvs();class w{constructor(x=[],N=!1,M="",K=process.env,j=null,_=!0){this.envs=L(x,K,M),this.overload=N,this.DOTENV_KEY=M,this.processEnv=K,this.envKeysFilepath=j,this.opsOn=_,this.processedEnvs=[],this.readableFilepaths=new Set,this.readableStrings=new Set,this.uniqueInjectedKeys=new Set,this.beforeEnv={...this.processEnv}}run(){for(const x of this.envs)x.type===f?this._injectEnvVaultFile(x.value):x.type===a?this._injectEnvFile(x.value):x.type===v&&this._injectEnv(x.value);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys],beforeEnv:this.beforeEnv,afterEnv:{...this.processEnv}}}_injectEnv(x){const N={};N.type=v,N.string=x;try{const{parsed:M,errors:K,injected:j,preExisted:_}=new s(x,null,this.processEnv,this.overload).run();N.parsed=M,N.errors=K,N.injected=j,N.preExisted=_,this.inject(N.parsed),this.readableStrings.add(x);for(const O of Object.keys(j))this.uniqueInjectedKeys.add(O)}catch(M){N.errors=[M]}this.processedEnvs.push(N)}_injectEnvFile(x){const N={};N.type=a,N.filepath=x;const M=r.resolve(x);try{const K=R(M),j=e.readFileX(M,{encoding:K});this.readableFilepaths.add(x);const _=q(x,this.envKeysFilepath,this.opsOn),O=A(x),{parsed:H,errors:Z,injected:k,preExisted:$}=new s(j,_,this.processEnv,this.overload,O).run();N.privateKeyName=O,N.privateKey=_,N.src=j,N.parsed=H,N.errors=Z,N.injected=k,N.preExisted=$,this.inject(N.parsed);for(const S of Object.keys(k))this.uniqueInjectedKeys.add(S)}catch(K){K.code==="ENOENT"||K.code==="EISDIR"?N.errors=[new d({envFilepath:x,filepath:M}).missingEnvFile()]:N.errors=[K]}this.processedEnvs.push(N)}_injectEnvVaultFile(x){const N={};N.type=f,N.filepath=x;const M=r.resolve(x);if(this.readableFilepaths.add(x),!e.existsSync(M)){const O="MISSING_ENV_VAULT_FILE",H=`you set DOTENV_KEY but your .env.vault file is missing: ${M}`,Z=new Error(H);throw Z.code=O,Z}if(this.DOTENV_KEY.length<1){const O="MISSING_DOTENV_KEY",H=`your DOTENV_KEY appears to be blank: '${this.DOTENV_KEY}'`,Z=new Error(H);throw Z.code=O,Z}let K;const j=this._dotenvKeys(),_=this._parsedVault(M);for(let O=0;O<j.length;O++)try{const H=j[O].trim();K=this._decrypted(H,_);break}catch(H){if(O+1>=j.length)throw H}try{const{parsed:O,errors:H,injected:Z,preExisted:k}=new s(K,null,this.processEnv,this.overload).run();N.parsed=O,N.errors=H,N.injected=Z,N.preExisted=k,this.inject(N.parsed);for(const $ of Object.keys(Z))this.uniqueInjectedKeys.add($)}catch(O){N.errors=[O]}this.processedEnvs.push(N)}inject(x){for(const N of Object.keys(x))this.processEnv[N]=x[N]}_dotenvKeys(){return this.DOTENV_KEY.split(",")}_parsedVault(x){const N=e.readFileX(x);return b(N)}_decrypted(x,N){const K=`DOTENV_VAULT_${T(x).toUpperCase()}`,j=N[K];if(!j){const _=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: cannot locate environment ${K} in your .env.vault file`);throw _.code="NOT_FOUND_DOTENV_ENVIRONMENT",_}return c(j,x)}}return run=w,run}var encryptValue_1,hasRequiredEncryptValue;function requireEncryptValue(){if(hasRequiredEncryptValue)return encryptValue_1;hasRequiredEncryptValue=1;const{encrypt:e}=requireDist(),r="encrypted:";function v(a,f){const c=e(f,Buffer.from(a)),s=Buffer.from(c,"hex").toString("base64");return`${r}${s}`}return encryptValue_1=v,encryptValue_1}var quotes_1,hasRequiredQuotes;function requireQuotes(){if(hasRequiredQuotes)return quotes_1;hasRequiredQuotes=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function r(v){const a={};let f=v.toString();f=f.replace(/\r\n?/mg,`
|
|
9
|
+
`);let c;for(;(c=e.exec(f))!=null;){const s=c[1];let d=c[2]||"";d=d.trim();const b=d[0];d=d.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),b===d[0]?a[s]="":a[s]=b}return a}return quotes_1=r,quotes_1}var escapeForRegex_1,hasRequiredEscapeForRegex;function requireEscapeForRegex(){if(hasRequiredEscapeForRegex)return escapeForRegex_1;hasRequiredEscapeForRegex=1;function e(r){return r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}return escapeForRegex_1=e,escapeForRegex_1}var escapeDollarSigns_1,hasRequiredEscapeDollarSigns;function requireEscapeDollarSigns(){if(hasRequiredEscapeDollarSigns)return escapeDollarSigns_1;hasRequiredEscapeDollarSigns=1;function e(r){return r.replace(/\$/g,"$$$$")}return escapeDollarSigns_1=e,escapeDollarSigns_1}var replace_1,hasRequiredReplace;function requireReplace(){if(hasRequiredReplace)return replace_1;hasRequiredReplace=1;const e=requireQuotes(),r=requireDotenvParse(),v=requireEscapeForRegex(),a=requireEscapeDollarSigns();function f(c,s,d){let b,T="";const R=r(c,!0,!0),q=e(c);if(Object.prototype.hasOwnProperty.call(R,s)){const A=q[s];T+=`${s}=${A}${d}${A}`;const L=R[s],w=v(L);let B="";if(w===""){B="$";const M=c.match(new RegExp(`${s}\\s*=\\s*
|
|
10
10
|
|
|
11
|
-
`,"m"));if(
|
|
12
|
-
`}}const
|
|
13
|
-
`)?
|
|
14
|
-
`:
|
|
15
|
-
`+b
|
|
16
|
-
${
|
|
17
|
-
`),
|
|
18
|
-
`);
|
|
19
|
-
${
|
|
20
|
-
`,
|
|
21
|
-
${
|
|
22
|
-
`)}_preserveShebang(
|
|
23
|
-
`);let
|
|
24
|
-
`,
|
|
25
|
-
`)),{firstLinePreserved:
|
|
26
|
-
`;for(const
|
|
27
|
-
${
|
|
28
|
-
`,b.add(F),m[F]="")}else for(const S of[...h])b.add(S),m[S]="";return{envExampleFile:R,envFile:this.envFile,exampleFilepath:this.exampleFilepath,addedKeys:[...b],injected:m,preExisted:f}}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return genexample=t,genexample}var conventions_1,hasRequiredConventions;function requireConventions(){if(hasRequiredConventions)return conventions_1;hasRequiredConventions=1;function e(r){if(r==="nextjs"){const u=process.env.NODE_ENV||"development",c=["development","test","production"].includes(u)&&u;return[c&&{type:"envFile",value:`.env.${c}.local`},c!=="test"&&{type:"envFile",value:".env.local"},c&&{type:"envFile",value:`.env.${c}`},{type:"envFile",value:".env"}].filter(Boolean)}else throw new Error(`INVALID_CONVENTION: '${r}'. permitted conventions: ['nextjs']`)}return conventions_1=e,conventions_1}var resolveHome_1,hasRequiredResolveHome;function requireResolveHome(){if(hasRequiredResolveHome)return resolveHome_1;hasRequiredResolveHome=1;const e=require$$2__default,r=require$$0__default$1;function u(c){return c[0]==="~"?r.join(e.homedir(),c.slice(1)):c}return resolveHome_1=u,resolveHome_1}var dotenvOptionPaths_1,hasRequiredDotenvOptionPaths;function requireDotenvOptionPaths(){if(hasRequiredDotenvOptionPaths)return dotenvOptionPaths_1;hasRequiredDotenvOptionPaths=1;const e=requireResolveHome();function r(u){let c=[];if(u&&u.path)if(!Array.isArray(u.path))c=[e(u.path)];else{c=[];for(const p of u.path)c.push(e(p))}return c}return dotenvOptionPaths_1=r,dotenvOptionPaths_1}var deprecationNotice,hasRequiredDeprecationNotice;function requireDeprecationNotice(){if(hasRequiredDeprecationNotice)return deprecationNotice;hasRequiredDeprecationNotice=1;const{logger:e}=requireLogger();class r{constructor(c={}){this.DOTENV_KEY=c.DOTENV_KEY||process.env.DOTENV_KEY}dotenvKey(){this.DOTENV_KEY&&(e.warn("[DEPRECATION NOTICE] Setting DOTENV_KEY with .env.vault is deprecated."),e.warn("[DEPRECATION NOTICE] Run [dotenvx ext vault migrate] for instructions on converting your .env.vault file to encrypted .env files (using public key encryption algorithm secp256k1)"),e.warn("[DEPRECATION NOTICE] Read more at [https://github.com/dotenvx/dotenvx/blob/main/CHANGELOG.md#0380]"))}}return deprecationNotice=r,deprecationNotice}var buildEnvs_1,hasRequiredBuildEnvs;function requireBuildEnvs(){if(hasRequiredBuildEnvs)return buildEnvs_1;hasRequiredBuildEnvs=1;const e=require$$0__default$1,r=requireConventions(),u=requireDotenvOptionPaths(),c=requireDeprecationNotice();function p(s,t=void 0){const o=u(s);let h=[];s.convention&&(h=r(s.convention).concat(h)),new c({DOTENV_KEY:t}).dotenvKey();for(const b of o)t?h.push({type:"envVaultFile",value:e.join(e.dirname(b),".env.vault")}):h.push({type:"envFile",value:b});return h}return buildEnvs_1=p,buildEnvs_1}var ignore,hasRequiredIgnore;function requireIgnore(){if(hasRequiredIgnore)return ignore;hasRequiredIgnore=1;function e(E){return Array.isArray(E)?E:[E]}const r="",u=" ",c="\\",p=/^\s+$/,s=/(?:[^\\]|^)\\$/,t=/^\\!/,o=/^\\#/,h=/\r?\n/g,b=/^\.*\/|^\.+$/,y="/";let m="node-ignore";typeof Symbol<"u"&&(m=Symbol.for("node-ignore"));const f=m,R=(E,O,L)=>Object.defineProperty(E,O,{value:L}),S=/([0-z])-([0-z])/g,F=()=>!1,g=E=>E.replace(S,(O,L,D)=>L.charCodeAt(0)<=D.charCodeAt(0)?O:r),w=E=>{const{length:O}=E;return E.slice(0,O-O%2)},B=[[/^\uFEFF/,()=>r],[/((?:\\\\)*?)(\\?\s+)$/,(E,O,L)=>O+(L.indexOf("\\")===0?u:r)],[/(\\+?)\s/g,(E,O)=>{const{length:L}=O;return O.slice(0,L-L%2)+u}],[/[\\$.|*+(){^]/g,E=>`\\${E}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(E,O,L)=>O+6<L.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(E,O,L)=>{const D=L.replace(/\\\*/g,"[^\\/]*");return O+D}],[/\\\\\\(?=[$.|*+(){^])/g,()=>c],[/\\\\/g,()=>c],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(E,O,L,D,i)=>O===c?`\\[${L}${w(D)}${i}`:i==="]"&&D.length%2===0?`[${g(L)}${D}]`:"[]"],[/(?:[^*])$/,E=>/\/$/.test(E)?`${E}$`:`${E}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(E,O)=>`${O?`${O}[^/]+`:"[^/]*"}(?=$|\\/$)`]],N=Object.create(null),d=(E,O)=>{let L=N[E];return L||(L=B.reduce((D,[i,x])=>D.replace(i,x.bind(E)),E),N[E]=L),O?new RegExp(L,"i"):new RegExp(L)},v=E=>typeof E=="string",a=E=>E&&v(E)&&!p.test(E)&&!s.test(E)&&E.indexOf("#")!==0,j=E=>E.split(h);class K{constructor(O,L,D,i){this.origin=O,this.pattern=L,this.negative=D,this.regex=i}}const q=(E,O)=>{const L=E;let D=!1;E.indexOf("!")===0&&(D=!0,E=E.substr(1)),E=E.replace(t,"!").replace(o,"#");const i=d(E,O);return new K(L,E,D,i)},k=(E,O)=>{throw new O(E)},_=(E,O,L)=>v(E)?E?_.isNotRelative(E)?L(`path should be a \`path.relative()\`d string, but got "${O}"`,RangeError):!0:L("path must not be empty",TypeError):L(`path must be a string, but got \`${O}\``,TypeError),C=E=>b.test(E);_.isNotRelative=C,_.convert=E=>E;class M{constructor({ignorecase:O=!0,ignoreCase:L=O,allowRelativePaths:D=!1}={}){R(this,f,!0),this._rules=[],this._ignoreCase=L,this._allowRelativePaths=D,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(O){if(O&&O[f]){this._rules=this._rules.concat(O._rules),this._added=!0;return}if(a(O)){const L=q(O,this._ignoreCase);this._added=!0,this._rules.push(L)}}add(O){return this._added=!1,e(v(O)?j(O):O).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(O){return this.add(O)}_testOne(O,L){let D=!1,i=!1;return this._rules.forEach(x=>{const{negative:T}=x;if(i===T&&D!==i||T&&!D&&!i&&!L)return;x.regex.test(O)&&(D=!T,i=T)}),{ignored:D,unignored:i}}_test(O,L,D,i){const x=O&&_.convert(O);return _(x,O,this._allowRelativePaths?F:k),this._t(x,L,D,i)}_t(O,L,D,i){if(O in L)return L[O];if(i||(i=O.split(y)),i.pop(),!i.length)return L[O]=this._testOne(O,D);const x=this._t(i.join(y)+y,L,D,i);return L[O]=x.ignored?x:this._testOne(O,D)}ignores(O){return this._test(O,this._ignoreCache,!1).ignored}createFilter(){return O=>!this.ignores(O)}filter(O){return e(O).filter(this.createFilter())}test(O){return this._test(O,this._testCache,!0)}}const l=E=>new M(E),$=E=>_(E&&_.convert(E),E,F);if(l.isPathValid=$,l.default=l,ignore=l,typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){const E=L=>/^\\\\\?\\/.test(L)||/["<>|\u0000-\u001F]+/u.test(L)?L:L.replace(/\\/g,"/");_.convert=E;const O=/^[a-z]:\//i;_.isNotRelative=L=>O.test(L)||C(L)}return ignore}var isIgnoringDotenvKeys_1,hasRequiredIsIgnoringDotenvKeys;function requireIsIgnoringDotenvKeys(){if(hasRequiredIsIgnoringDotenvKeys)return isIgnoringDotenvKeys_1;hasRequiredIsIgnoringDotenvKeys=1;const e=requireFsx(),r=requireIgnore();function u(){if(!e.existsSync(".gitignore"))return!1;const c=e.readFileX(".gitignore");return!!r(c).add(c).ignores(".env.keys")}return isIgnoringDotenvKeys_1=u,isIgnoringDotenvKeys_1}var main,hasRequiredMain;function requireMain(){if(hasRequiredMain)return main;hasRequiredMain=1;const e=require$$0__default$1,{setLogLevel:r,logger:u}=requireLogger(),{getColor:c,bold:p}=requireColors(),s=requireLs(),t=requireRun(),o=requireSets(),h=requireGet(),b=requireKeypair$1(),y=requireGenexample(),m=requireBuildEnvs(),f=requireParse(),R=requireFsx(),S=requireIsIgnoringDotenvKeys();return main={config:function(a={}){let j=process.env;a&&a.processEnv!=null&&(j=a.processEnv);const K=a.overload||a.override,q=a.ignore||[],k=a.strict,_=a.envKeysFile;let C=process.env.DOTENV_KEY;a&&a.DOTENV_KEY&&(C=a.DOTENV_KEY),a&&r(a);try{const M=m(a,C),{processedEnvs:l,readableFilepaths:$,uniqueInjectedKeys:E}=new t(M,K,C,j,_).run();let O;const L={};for(const i of l){i.type==="envVaultFile"&&(u.verbose(`loading env from encrypted ${i.filepath} (${e.resolve(i.filepath)})`),u.debug(`decrypting encrypted env from ${i.filepath} (${e.resolve(i.filepath)})`)),i.type==="envFile"&&u.verbose(`loading env from ${i.filepath} (${e.resolve(i.filepath)})`);for(const x of i.errors||[]){if(q.includes(x.code)){u.verbose(`ignored: ${x.message}`);continue}if(k)throw x;O=x,x.code==="MISSING_ENV_FILE"&&a.convention||(console.error(x.message),x.help&&console.error(x.help))}Object.assign(L,i.injected||{}),Object.assign(L,i.preExisted||{}),u.debug(i.parsed);for(const[x,T]of Object.entries(i.injected||{}))u.verbose(`${x} set`),u.debug(`${x} set to ${T}`);for(const[x,T]of Object.entries(i.preExisted||{}))u.verbose(`${x} pre-exists (protip: use --overload to override)`),u.debug(`${x} pre-exists as ${T} (protip: use --overload to override)`)}let D=`injecting env (${E.length})`;return $.length>0&&(D+=` from ${$.join(", ")}`),u.successv(D),O?{parsed:L,error:O}:{parsed:L}}catch(M){if(k)throw M;return u.error(M.message),M.help&&u.help(M.help),{parsed:{},error:M}}},parse:function(a,j={}){let K=process.env;j&&j.processEnv!=null&&(K=j.processEnv);const q=j.privateKey||null,k=j.overload||j.override,{parsed:_,errors:C}=new f(a,q,K,k).run();for(const M of C)console.error(M.message),M.help&&console.error(M.help);return _},set:function(a,j,K={}){let q=!0;(K.plain||K.encrypt===!1)&&(q=!1);const k=m(K),_=K.envKeysFile,{processedEnvs:C,changedFilepaths:M,unchangedFilepaths:l}=new o(a,j,k,q,_).run();let $="";q&&($=" with encryption");for(const E of C)u.verbose(`setting for ${E.envFilepath}`),E.error?E.error.code==="MISSING_ENV_FILE"?(u.warn(E.error.message),u.help(`? add one with [echo "HELLO=World" > ${E.envFilepath}] and re-run [dotenvx set]`)):(u.warn(E.error.message),E.error.help&&u.help(E.error.help)):(R.writeFileX(E.filepath,E.envSrc),u.verbose(`${E.key} set${$} (${E.envFilepath})`),u.debug(`${E.key} set${$} to ${E.value} (${E.envFilepath})`));M.length>0?u.success(`\u2714 set ${a}${$} (${M.join(",")})`):l.length>0&&u.info(`no changes (${l})`);for(const E of C)E.privateKeyAdded&&(u.success(`\u2714 key added to ${E.envKeysFilepath} (${E.privateKeyName})`),S()||u.help("\u2B95 next run [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys"),u.help(`\u2B95 next run [${E.privateKeyName}='${E.privateKey}' dotenvx get ${a}] to test decryption locally`));return{processedEnvs:C,changedFilepaths:M,unchangedFilepaths:l}},get:function(a,j={}){const K=m(j),q=j.ignore||[],{parsed:k,errors:_}=new h(a,K,j.overload,process.env.DOTENV_KEY,j.all,j.envKeysFile).run();for(const C of _||[])if(!q.includes(C.code)){if(j.strict)throw C;console.error(C.message),C.help&&console.error(C.help)}if(a){const C=k[a];return C===void 0?void 0:C}else if(j.format==="eval"){let C="";for(const[M,l]of Object.entries(k))C+=`${M}=${escape(l)}
|
|
29
|
-
`;return
|
|
11
|
+
`,"m"));if(A===""&&M){const K=M[0].match(/\n/g).length-1;for(let j=0;j<K;j++)T+=`
|
|
12
|
+
`}}const x=new RegExp("^(\\s*)?(export\\s+)?"+s+"\\s*=\\s*[\"'`]?"+w+"[\"'`]?"+B,"gm"),N=a(T);b=c.replace(x,`$1$2${N}`)}else T+=`${s}="${d}"`,c.endsWith(`
|
|
13
|
+
`)?T=T+`
|
|
14
|
+
`:T=`
|
|
15
|
+
`+T,b=c+T;return b}return replace_1=f,replace_1}var findPublicKey_1,hasRequiredFindPublicKey;function requireFindPublicKey(){if(hasRequiredFindPublicKey)return findPublicKey_1;hasRequiredFindPublicKey=1;const e=requireGuessPublicKeyName(),r=requireProKeypair(),v=requireKeypair$1();function a(f,c=!0){const s=e(f);let d={};c&&(d=new r(f).run());const b=new v(f).run();return d[s]||b[s]}return findPublicKey_1=a,findPublicKey_1}var keypair_1,hasRequiredKeypair;function requireKeypair(){if(hasRequiredKeypair)return keypair_1;hasRequiredKeypair=1;const{PrivateKey:e}=requireDist();function r(v){let a;v?a=new e(Buffer.from(v,"hex")):a=new e;const f=a.publicKey.toHex(),c=a.secret.toString("hex");return{publicKey:f,privateKey:c}}return keypair_1=r,keypair_1}var isEncrypted_1,hasRequiredIsEncrypted;function requireIsEncrypted(){if(hasRequiredIsEncrypted)return isEncrypted_1;hasRequiredIsEncrypted=1;const e=/^encrypted:.+/;function r(v){return e.test(v)}return isEncrypted_1=r,isEncrypted_1}var sets,hasRequiredSets;function requireSets(){if(hasRequiredSets)return sets;hasRequiredSets=1;const e=requireFsx(),r=require$$0__default$1,v="envFile",a=requireErrors(),f=requireGuessPrivateKeyName(),c=requireGuessPublicKeyName(),s=requireEncryptValue(),d=requireDecryptKeyValue(),b=requireReplace(),T=requireDotenvParse(),R=requireDetectEncoding(),q=requireDetermineEnvs(),{findPrivateKey:A}=requireFindPrivateKey(),L=requireFindPublicKey(),w=requireKeypair(),B=requireTruncate(),x=requireIsEncrypted();class N{constructor(K,j,_=[],O=!0,H=null){this.envs=q(_,process.env),this.key=K,this.value=j,this.encrypt=O,this.envKeysFilepath=H,this.processedEnvs=[],this.changedFilepaths=new Set,this.unchangedFilepaths=new Set,this.readableFilepaths=new Set}run(){for(const K of this.envs)K.type===v&&this._setEnvFile(K.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}_setEnvFile(K){const j={};j.key=this.key||null,j.value=this.value||null,j.type=v;const _=r.basename(K),O=r.resolve(K);j.filepath=O,j.envFilepath=K,j.changed=!1;try{const H=this._detectEncoding(O);let Z=e.readFileX(O,{encoding:H});const k=T(Z);j.originalValue=k[j.key]||null;const $=!x(j.originalValue);if(this.readableFilepaths.add(K),this.encrypt){let D,V;const u=c(K),h=f(K),o=A(K,this.envKeysFilepath),i=L(K);let p=r.join(r.dirname(O),".env.keys");this.envKeysFilepath&&(p=r.resolve(this.envKeysFilepath));const l=r.relative(r.dirname(O),p);if(o){const t=w(o);if(D=t.publicKey,V=t.privateKey,j.originalValue&&(j.originalValue=d(j.key,j.originalValue,h,V)),i&&i!==D){const g=new Error(`derived public key (${B(D)}) does not match the existing public key (${B(i)})`);throw g.code="INVALID_DOTENV_PRIVATE_KEY",g.help=`debug info: ${h}=${B(o)} (derived ${u}=${B(D)} vs existing ${u}=${B(i)})`,g}if(!i){const g=this._preserveShebang(Z),E=g.firstLinePreserved;Z=g.envSrc;const y=this._prependPublicKey(u,D,_,l);Z=`${E}${y}
|
|
16
|
+
${Z}`}}else if(i)D=i;else{let t="";e.existsSync(p)&&(t=e.readFileX(p));const g=this._preserveShebang(Z),E=g.firstLinePreserved;Z=g.envSrc;const y=w();D=y.publicKey,V=y.privateKey;const m=this._prependPublicKey(u,D,_,l),ee=["#/------------------!DOTENV_PRIVATE_KEYS!-------------------/","#/ private decryption keys. DO NOT commit to source control /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/"].join(`
|
|
17
|
+
`),Y=[`# ${_}`,`${h}=${V}`,""].join(`
|
|
18
|
+
`);Z=`${E}${m}
|
|
19
|
+
${Z}`,t=t.length>1?t:`${ee}
|
|
20
|
+
`,t=`${t}
|
|
21
|
+
${Y}`,e.writeFileX(p,t),j.privateKeyAdded=!0,j.envKeysFilepath=this.envKeysFilepath||r.join(r.dirname(K),r.basename(p))}j.publicKey=D,j.privateKey=V,j.encryptedValue=s(this.value,D),j.privateKeyName=h}const S=$&&this.encrypt,F=this.value!==j.originalValue;S||F?(j.envSrc=b(Z,this.key,j.encryptedValue||this.value),this.changedFilepaths.add(K),j.changed=!0):(j.envSrc=Z,this.unchangedFilepaths.add(K),j.changed=!1)}catch(H){H.code==="ENOENT"?j.error=new a({envFilepath:K,filepath:O}).missingEnvFile():j.error=H}this.processedEnvs.push(j)}_detectEncoding(K){return R(K)}_prependPublicKey(K,j,_,O=".env.keys"){const H=O===".env.keys"?"":` # -fk ${O}`;return["#/-------------------[DOTENV_PUBLIC_KEY]--------------------/","#/ public-key encryption for .env files /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/",`${K}="${j}"${H}`,"",`# ${_}`].join(`
|
|
22
|
+
`)}_preserveShebang(K){const[j,..._]=K.split(`
|
|
23
|
+
`);let O="";return j.startsWith("#!")&&(O=j+`
|
|
24
|
+
`,K=_.join(`
|
|
25
|
+
`)),{firstLinePreserved:O,envSrc:K}}}return sets=N,sets}var get,hasRequiredGet;function requireGet(){if(hasRequiredGet)return get;hasRequiredGet=1;const e=requireRun(),r=requireErrors();class v{constructor(f,c=[],s=!1,d="",b=!1,T=null){this.key=f,this.envs=c,this.overload=s,this.DOTENV_KEY=d,this.all=b,this.envKeysFilepath=T}run(){const f={...process.env},{processedEnvs:c}=new e(this.envs,this.overload,this.DOTENV_KEY,f,this.envKeysFilepath).run(),s=[];for(const d of c)for(const b of d.errors)s.push(b);if(this.key){const d={},b=f[this.key];return d[this.key]=b,b===void 0&&s.push(new r({key:this.key}).missingKey()),{parsed:d,errors:s}}else{if(this.all)return{parsed:f,errors:s};const d={};for(const b of c)if(b.parsed)for(const T of Object.keys(b.parsed))d[T]=f[T];return{parsed:d,errors:s}}}}return get=v,get}var findEnvFiles_1,hasRequiredFindEnvFiles;function requireFindEnvFiles(){if(hasRequiredFindEnvFiles)return findEnvFiles_1;hasRequiredFindEnvFiles=1;const e=requireFsx(),r=[".env.vault",".env.project",".env.keys",".env.me",".env.x",".env.example"];function v(a){try{return e.readdirSync(a).filter(s=>s.startsWith(".env")&&!s.endsWith(".previous")&&!r.includes(s))}catch(f){if(f.code==="ENOENT"){const c=new Error(`missing directory (${a})`);throw c.code="MISSING_DIRECTORY",c}else throw f}}return findEnvFiles_1=v,findEnvFiles_1}var genexample,hasRequiredGenexample;function requireGenexample(){if(hasRequiredGenexample)return genexample;hasRequiredGenexample=1;const e=requireFsx(),r=require$$0__default$1,v=requireErrors(),a=requireFindEnvFiles(),f=requireReplace(),c=requireDotenvParse();class s{constructor(b=".",T){this.directory=b,this.envFile=T||a(b),this.exampleFilename=".env.example",this.exampleFilepath=r.resolve(this.directory,this.exampleFilename)}run(){if(this.envFile.length<1){const w="MISSING_ENV_FILES",B="no .env* files found",x='? add one with [echo "HELLO=World" > .env] and then run [dotenvx genexample]',N=new Error(B);throw N.code=w,N.help=x,N}const b=new Set,T=new Set,R=this._envFilepaths(),q={},A={};let L=`# ${this.exampleFilename} - generated with dotenvx
|
|
26
|
+
`;for(const w of R){const B=r.resolve(this.directory,w);if(!e.existsSync(B)){const M=new v({envFilepath:w,filepath:B}).missingEnvFile();throw M.help=`? add it with [echo "HELLO=World" > ${w}] and then run [dotenvx genexample]`,M}let x=e.readFileX(B);const N=c(x);for(const M in N)b.add(M),x=f(x,M,"");L+=`
|
|
27
|
+
${x}`}if(e.existsSync(this.exampleFilepath)){L=e.readFileX(this.exampleFilepath);const w=c(L);for(const B of[...b])B in w?A[B]=w[B]:(L+=`${B}=''
|
|
28
|
+
`,T.add(B),q[B]="")}else for(const w of[...b])T.add(w),q[w]="";return{envExampleFile:L,envFile:this.envFile,exampleFilepath:this.exampleFilepath,addedKeys:[...T],injected:q,preExisted:A}}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return genexample=s,genexample}var radar,hasRequiredRadar;function requireRadar(){if(hasRequiredRadar)return radar;hasRequiredRadar=1;const e=require$$0__default$1,r=require$$1__default,{logger:v}=requireLogger();class a{constructor(){this.radarLib=null;try{this.radarLib=this._radarNpm(),v.warn("[DEPRECATION NOTICE] dotenvx-radar is renamed dotenv-ops. [See https://dotenvx.com/docs/ops]"),v.successv(`\u{1F4E1} radar: ${this.radarLib.status}`)}catch{try{this.radarLib=this._radarCli(),v.warn("[DEPRECATION NOTICE] dotenvx-radar is renamed dotenv-ops. [See https://dotenvx.com/docs/ops]"),v.successv(`\u{1F4E1} radar: ${this.radarLib.status}`)}catch{}}}observe(c){if(this.radarLib&&this.radarLib.status!=="off"){const s=this.encode(c);this.radarLib.observe(s)}}encode(c){return Buffer.from(JSON.stringify(c)).toString("base64")}_radarNpm(){const c=e.resolve(process.cwd(),"node_modules/.bin/dotenvx-radar");return{status:r.execSync(`${c} status`,{stdio:["pipe","pipe","ignore"]}).toString().trim(),observe:d=>{try{r.spawn(c,["observe",d],{stdio:"ignore",detached:!0}).unref()}catch{}}}}_radarCli(){return{status:r.execSync("dotenvx-radar status",{stdio:["pipe","pipe","ignore"]}).toString().trim(),observe:s=>{try{r.spawn("dotenvx-radar",["observe",s],{stdio:"ignore",detached:!0}).unref()}catch{}}}}}return radar=a,radar}var ops,hasRequiredOps;function requireOps(){if(hasRequiredOps)return ops;hasRequiredOps=1;const e=require$$0__default$1,r=require$$1__default,{logger:v}=requireLogger();class a{constructor(){this.opsLib=null;try{this.opsLib=this._opsNpm(),v.successv(`\u{1F4E1} radar: ${this.opsLib.status}`)}catch{try{this.opsLib=this._opsCli(),v.successv(`\u{1F4E1} radar: ${this.opsLib.status}`)}catch{}}}observe(c){if(this.opsLib&&this.opsLib.status!=="off"){const s=this.encode(c);this.opsLib.observe(s)}}encode(c){return Buffer.from(JSON.stringify(c)).toString("base64")}_opsNpm(){const c=e.resolve(process.cwd(),"node_modules/.bin/dotenvx-ops");return{status:r.execSync(`${c} status`,{stdio:["pipe","pipe","ignore"]}).toString().trim(),observe:d=>{try{r.spawn(c,["observe",d],{stdio:"ignore",detached:!0}).unref()}catch{}}}}_opsCli(){return{status:r.execSync("dotenvx-ops status",{stdio:["pipe","pipe","ignore"]}).toString().trim(),observe:s=>{try{r.spawn("dotenvx-ops",["observe",s],{stdio:"ignore",detached:!0}).unref()}catch{}}}}}return ops=a,ops}var conventions_1,hasRequiredConventions;function requireConventions(){if(hasRequiredConventions)return conventions_1;hasRequiredConventions=1;function e(r){const v=process.env.DOTENV_ENV||process.env.NODE_ENV||"development";if(r==="nextjs"){const a=["development","test","production"].includes(v)&&v;return[a&&{type:"envFile",value:`.env.${a}.local`},a!=="test"&&{type:"envFile",value:".env.local"},a&&{type:"envFile",value:`.env.${a}`},{type:"envFile",value:".env"}].filter(Boolean)}else{if(r==="flow")return[{type:"envFile",value:`.env.${v}.local`},{type:"envFile",value:`.env.${v}`},{type:"envFile",value:".env.local"},{type:"envFile",value:".env"},{type:"envFile",value:".env.defaults"}];throw new Error(`INVALID_CONVENTION: '${r}'. permitted conventions: ['nextjs', 'flow']`)}}return conventions_1=e,conventions_1}var resolveHome_1,hasRequiredResolveHome;function requireResolveHome(){if(hasRequiredResolveHome)return resolveHome_1;hasRequiredResolveHome=1;const e=require$$2__default,r=require$$0__default$1;function v(a){return a[0]==="~"?r.join(e.homedir(),a.slice(1)):a}return resolveHome_1=v,resolveHome_1}var dotenvOptionPaths_1,hasRequiredDotenvOptionPaths;function requireDotenvOptionPaths(){if(hasRequiredDotenvOptionPaths)return dotenvOptionPaths_1;hasRequiredDotenvOptionPaths=1;const e=requireResolveHome();function r(v){let a=[];if(v&&v.path)if(!Array.isArray(v.path))a=[e(v.path)];else{a=[];for(const f of v.path)a.push(e(f))}return a}return dotenvOptionPaths_1=r,dotenvOptionPaths_1}var deprecationNotice,hasRequiredDeprecationNotice;function requireDeprecationNotice(){if(hasRequiredDeprecationNotice)return deprecationNotice;hasRequiredDeprecationNotice=1;const{logger:e}=requireLogger();class r{constructor(a={}){this.DOTENV_KEY=a.DOTENV_KEY||process.env.DOTENV_KEY}dotenvKey(){this.DOTENV_KEY&&(e.warn("[DEPRECATION NOTICE] Setting DOTENV_KEY with .env.vault is deprecated."),e.warn("[DEPRECATION NOTICE] Run [dotenvx ext vault migrate] for instructions on converting your .env.vault file to encrypted .env files (using public key encryption algorithm secp256k1)"),e.warn("[DEPRECATION NOTICE] Read more at [https://github.com/dotenvx/dotenvx/blob/main/CHANGELOG.md#0380]"))}}return deprecationNotice=r,deprecationNotice}var buildEnvs_1,hasRequiredBuildEnvs;function requireBuildEnvs(){if(hasRequiredBuildEnvs)return buildEnvs_1;hasRequiredBuildEnvs=1;const e=require$$0__default$1,r=requireConventions(),v=requireDotenvOptionPaths(),a=requireDeprecationNotice();function f(c,s=void 0){const d=v(c);let b=[];c.convention&&(b=r(c.convention).concat(b)),new a({DOTENV_KEY:s}).dotenvKey();for(const T of d)s?b.push({type:"envVaultFile",value:e.join(e.dirname(T),".env.vault")}):b.push({type:"envFile",value:T});return b}return buildEnvs_1=f,buildEnvs_1}var ignore,hasRequiredIgnore;function requireIgnore(){if(hasRequiredIgnore)return ignore;hasRequiredIgnore=1;function e(h){return Array.isArray(h)?h:[h]}const r="",v=" ",a="\\",f=/^\s+$/,c=/(?:[^\\]|^)\\$/,s=/^\\!/,d=/^\\#/,b=/\r?\n/g,T=/^\.*\/|^\.+$/,R="/";let q="node-ignore";typeof Symbol<"u"&&(q=Symbol.for("node-ignore"));const A=q,L=(h,o,i)=>Object.defineProperty(h,o,{value:i}),w=/([0-z])-([0-z])/g,B=()=>!1,x=h=>h.replace(w,(o,i,p)=>i.charCodeAt(0)<=p.charCodeAt(0)?o:r),N=h=>{const{length:o}=h;return h.slice(0,o-o%2)},M=[[/^\uFEFF/,()=>r],[/((?:\\\\)*?)(\\?\s+)$/,(h,o,i)=>o+(i.indexOf("\\")===0?v:r)],[/(\\+?)\s/g,(h,o)=>{const{length:i}=o;return o.slice(0,i-i%2)+v}],[/[\\$.|*+(){^]/g,h=>`\\${h}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(h,o,i)=>o+6<i.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(h,o,i)=>{const p=i.replace(/\\\*/g,"[^\\/]*");return o+p}],[/\\\\\\(?=[$.|*+(){^])/g,()=>a],[/\\\\/g,()=>a],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(h,o,i,p,l)=>o===a?`\\[${i}${N(p)}${l}`:l==="]"&&p.length%2===0?`[${x(i)}${p}]`:"[]"],[/(?:[^*])$/,h=>/\/$/.test(h)?`${h}$`:`${h}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(h,o)=>`${o?`${o}[^/]+`:"[^/]*"}(?=$|\\/$)`]],K=Object.create(null),j=(h,o)=>{let i=K[h];return i||(i=M.reduce((p,[l,t])=>p.replace(l,t.bind(h)),h),K[h]=i),o?new RegExp(i,"i"):new RegExp(i)},_=h=>typeof h=="string",O=h=>h&&_(h)&&!f.test(h)&&!c.test(h)&&h.indexOf("#")!==0,H=h=>h.split(b);class Z{constructor(o,i,p,l){this.origin=o,this.pattern=i,this.negative=p,this.regex=l}}const k=(h,o)=>{const i=h;let p=!1;h.indexOf("!")===0&&(p=!0,h=h.substr(1)),h=h.replace(s,"!").replace(d,"#");const l=j(h,o);return new Z(i,h,p,l)},$=(h,o)=>{throw new o(h)},S=(h,o,i)=>_(h)?h?S.isNotRelative(h)?i(`path should be a \`path.relative()\`d string, but got "${o}"`,RangeError):!0:i("path must not be empty",TypeError):i(`path must be a string, but got \`${o}\``,TypeError),F=h=>T.test(h);S.isNotRelative=F,S.convert=h=>h;class D{constructor({ignorecase:o=!0,ignoreCase:i=o,allowRelativePaths:p=!1}={}){L(this,A,!0),this._rules=[],this._ignoreCase=i,this._allowRelativePaths=p,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(o){if(o&&o[A]){this._rules=this._rules.concat(o._rules),this._added=!0;return}if(O(o)){const i=k(o,this._ignoreCase);this._added=!0,this._rules.push(i)}}add(o){return this._added=!1,e(_(o)?H(o):o).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(o){return this.add(o)}_testOne(o,i){let p=!1,l=!1;return this._rules.forEach(t=>{const{negative:g}=t;if(l===g&&p!==l||g&&!p&&!l&&!i)return;t.regex.test(o)&&(p=!g,l=g)}),{ignored:p,unignored:l}}_test(o,i,p,l){const t=o&&S.convert(o);return S(t,o,this._allowRelativePaths?B:$),this._t(t,i,p,l)}_t(o,i,p,l){if(o in i)return i[o];if(l||(l=o.split(R)),l.pop(),!l.length)return i[o]=this._testOne(o,p);const t=this._t(l.join(R)+R,i,p,l);return i[o]=t.ignored?t:this._testOne(o,p)}ignores(o){return this._test(o,this._ignoreCache,!1).ignored}createFilter(){return o=>!this.ignores(o)}filter(o){return e(o).filter(this.createFilter())}test(o){return this._test(o,this._testCache,!0)}}const V=h=>new D(h),u=h=>S(h&&S.convert(h),h,B);if(V.isPathValid=u,V.default=V,ignore=V,typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){const h=i=>/^\\\\\?\\/.test(i)||/["<>|\u0000-\u001F]+/u.test(i)?i:i.replace(/\\/g,"/");S.convert=h;const o=/^[a-z]:\//i;S.isNotRelative=i=>o.test(i)||F(i)}return ignore}var isIgnoringDotenvKeys_1,hasRequiredIsIgnoringDotenvKeys;function requireIsIgnoringDotenvKeys(){if(hasRequiredIsIgnoringDotenvKeys)return isIgnoringDotenvKeys_1;hasRequiredIsIgnoringDotenvKeys=1;const e=requireFsx(),r=requireIgnore();function v(){if(!e.existsSync(".gitignore"))return!1;const a=e.readFileX(".gitignore");return!!r(a).add(a).ignores(".env.keys")}return isIgnoringDotenvKeys_1=v,isIgnoringDotenvKeys_1}var main,hasRequiredMain;function requireMain(){if(hasRequiredMain)return main;hasRequiredMain=1;const e=require$$0__default$1,{setLogLevel:r,setLogName:v,setLogVersion:a,logger:f}=requireLogger(),{getColor:c,bold:s}=requireColors(),d=requireLs(),b=requireRun(),T=requireSets(),R=requireGet(),q=requireKeypair$1(),A=requireGenexample(),L=requireRadar(),w=requireOps(),B=requireBuildEnvs(),x=requireParse(),N=requireFsx(),M=requireIsIgnoringDotenvKeys();return main={config:function($={}){let S=process.env;$&&$.processEnv!=null&&(S=$.processEnv);const F=$.overload||$.override,D=$.ignore||[],V=$.strict,u=$.envKeysFile;let h=process.env.DOTENV_KEY;$&&$.DOTENV_KEY&&(h=$.DOTENV_KEY);const o=$.opsOff!==!0;$&&(r($),v($),a($));try{const i=B($,h),{beforeEnv:p,afterEnv:l,processedEnvs:t,readableFilepaths:g,uniqueInjectedKeys:E}=new b(i,F,h,S,u,o).run();if(o){try{new L().observe({beforeEnv:p,processedEnvs:t,afterEnv:l})}catch{}try{new w().observe({beforeEnv:p,processedEnvs:t,afterEnv:l})}catch{}}let y;const m={};for(const Y of t){Y.type==="envVaultFile"&&(f.verbose(`loading env from encrypted ${Y.filepath} (${e.resolve(Y.filepath)})`),f.debug(`decrypting encrypted env from ${Y.filepath} (${e.resolve(Y.filepath)})`)),Y.type==="envFile"&&f.verbose(`loading env from ${Y.filepath} (${e.resolve(Y.filepath)})`);for(const C of Y.errors||[]){if(D.includes(C.code)){f.verbose(`ignored: ${C.message}`);continue}if(V)throw C;y=C,C.code==="MISSING_ENV_FILE"&&$.convention||(f.error(C.message),C.help&&f.error(C.help))}Object.assign(m,Y.injected||{}),Object.assign(m,Y.preExisted||{}),f.debug(Y.parsed);for(const[C,G]of Object.entries(Y.injected||{}))f.verbose(`${C} set`),f.debug(`${C} set to ${G}`);for(const[C,G]of Object.entries(Y.preExisted||{}))f.verbose(`${C} pre-exists (protip: use --overload to override)`),f.debug(`${C} pre-exists as ${G} (protip: use --overload to override)`)}let ee=`injecting env (${E.length})`;return g.length>0&&(ee+=` from ${g.join(", ")}`),f.successv(ee),y?{parsed:m,error:y}:{parsed:m}}catch(i){if(V)throw i;return f.error(i.message),i.help&&f.help(i.help),{parsed:{},error:i}}},parse:function($,S={}){let F=process.env;S&&S.processEnv!=null&&(F=S.processEnv);const D=S.privateKey||null,V=S.overload||S.override,{parsed:u,errors:h}=new x($,D,F,V).run();for(const o of h)f.error(o.message),o.help&&f.error(o.help);return u},set:function($,S,F={}){let D=!0;(F.plain||F.encrypt===!1)&&(D=!1);const V=B(F),u=F.envKeysFile,{processedEnvs:h,changedFilepaths:o,unchangedFilepaths:i}=new T($,S,V,D,u).run();let p="";D&&(p=" with encryption");for(const l of h)f.verbose(`setting for ${l.envFilepath}`),l.error?l.error.code==="MISSING_ENV_FILE"?(f.warn(l.error.message),f.help(`? add one with [echo "HELLO=World" > ${l.envFilepath}] and re-run [dotenvx set]`)):(f.warn(l.error.message),l.error.help&&f.help(l.error.help)):(N.writeFileX(l.filepath,l.envSrc),f.verbose(`${l.key} set${p} (${l.envFilepath})`),f.debug(`${l.key} set${p} to ${l.value} (${l.envFilepath})`));o.length>0?f.success(`\u2714 set ${$}${p} (${o.join(",")})`):i.length>0&&f.info(`no changes (${i})`);for(const l of h)l.privateKeyAdded&&(f.success(`\u2714 key added to ${l.envKeysFilepath} (${l.privateKeyName})`),M()||f.help("\u2B95 next run [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys"),f.help(`\u2B95 next run [${l.privateKeyName}='${l.privateKey}' dotenvx get ${$}] to test decryption locally`));return{processedEnvs:h,changedFilepaths:o,unchangedFilepaths:i}},get:function($,S={}){const F=B(S),D=S.ignore||[],{parsed:V,errors:u}=new R($,F,S.overload,process.env.DOTENV_KEY,S.all,S.envKeysFile).run();for(const h of u||[])if(!D.includes(h.code)){if(S.strict)throw h;f.error(h.message),h.help&&f.error(h.help)}if($){const h=V[$];return h===void 0?void 0:h}else if(S.format==="eval"){let h="";for(const[o,i]of Object.entries(V))h+=`${o}=${escape(i)}
|
|
29
|
+
`;return h=h.trim(),h}else if(S.format==="shell"){let h="";for(const[o,i]of Object.entries(V))h+=`${o}=${i} `;return h=h.trim(),h}else return V},ls:function($,S,F){return new d($,S,F).run()},keypair:function($,S,F=null){const D=new q($,F).run();return S?D[S]:D},genexample:function($,S){return new A($,S).run()},setLogLevel:r,logger:f,getColor:c,bold:s},main}var hasRequiredConfig;function requireConfig(){return hasRequiredConfig||(hasRequiredConfig=1,requireMain().config()),config$1}requireConfig();const n={ALGOLIA_APP_ID:"ALGOLIA_APP_ID",ALGOLIA_ADMIN_API_KEY:"ALGOLIA_ADMIN_API_KEY",ALGOLIA_INDEX_NAME:"ALGOLIA_INDEX_NAME",DATA_DIR:"DATA_DIR"};class ConfigProvider{static instance;envVars;constructor(){this.envVars={},Object.values(n).forEach(r=>{const v=process.env[r];if(v==null)throw new Error(`Missing required environment variable: ${r}`);this.envVars[r]=v})}static getInstance(){return ConfigProvider.instance||(ConfigProvider.instance=new ConfigProvider),ConfigProvider.instance}getConfig(r){return this.envVars[r]}}function isIndexedItem(e){return typeof e=="object"&&e!==null&&"objectID"in e&&typeof e.objectID=="string"}function I$1(e){const r=Object.keys(e).sort(),v={objectID:e.objectID};for(const a of r)a!=="objectID"&&(v[a]=e[a]);return v}function normalizeIndexedItemArray(e){return e.map(I$1).sort((r,v)=>r.objectID.localeCompare(v.objectID))}class Uploader{client;indexName;constructor(r){this.client=r.getClient(),this.indexName=r.getIndexName()}async uploadObjects(r){if(r.length===0){console.error("No items are included in the target JSON file. More than 1 item is necessary.");return}let v=await this.getAllObjects();v=normalizeIndexedItemArray(v);const a=normalizeIndexedItemArray(r),f=this.determineOperations(v,a);if(f.update.length===0&&f.add.length===0&&f.delete.length===0){console.log("No updates needed. All objects are up to date.");return}if(f.update.length>0){const c=await this.client.partialUpdateObjects({indexName:this.indexName,objects:f.update,createIfNotExists:!0});console.log(`Updated ${c[0].objectIDs.length} objects`)}if(f.add.length>0){const c=await this.client.saveObjects({indexName:this.indexName,objects:f.add});console.log(`Added ${c[0].objectIDs.length} objects`)}if(f.delete.length>0){const c=f.delete.map(d=>d.objectID),s=await this.client.deleteObjects({indexName:this.indexName,objectIDs:c});console.log(`Deleted ${s[0].objectIDs.length} objects`)}}async getAllObjects(){const r=[];return await this.client.browseObjects({indexName:this.indexName,aggregator:v=>{Array.isArray(v.hits)&&v.hits.forEach(a=>{isIndexedItem(a)&&r.push(a)})}}),r}determineOperations(r,v){const a=new Map(r.map(s=>[s.objectID,s])),f=new Map(v.map(s=>[s.objectID,s])),c={update:[],add:[],delete:[]};for(const s of v){const d=a.get(s.objectID);d==null?c.add.push(s):esToolkit.isEqual(d,s)||c.update.push(s)}for(const s of r)f.has(s.objectID)||c.delete.push(s);return c}}class AlgoliaClientProvider{static instance;client;indexName;constructor(r,v){this.client=v(r.getConfig("ALGOLIA_APP_ID"),r.getConfig("ALGOLIA_ADMIN_API_KEY")),this.indexName=r.getConfig("ALGOLIA_INDEX_NAME")}static getInstance(){if(!this.instance){const r=ConfigProvider.getInstance();this.instance=new AlgoliaClientProvider(r,algoliasearch.algoliasearch)}return this.instance}getClient(){return this.client}getIndexName(){return this.indexName}}const I=citty.defineCommand({meta:{name:name$2,version:version$2,description:description$2},args:{},async run({args:e}){try{let r=ConfigProvider.getInstance().getConfig("DATA_DIR");r=require$$0__default$1.join(process.cwd(),r),require$$0__default.existsSync(r)&&require$$0__default.statSync(r).isDirectory()||(console.error(`Error: provided directory does not exist - ${r}`),process.exit(1));const v=readAllJsonFiles(r)[0];v.every(f=>isIndexedItem(f))||(console.error(`The content of the provided json file is incompatible. Check the file: ${r}`),process.exit(1));const a=AlgoliaClientProvider.getInstance();await new Uploader(a).uploadObjects(v)}catch(r){console.error("Some errors occured: ",r),process.exit(1)}}});citty.runMain(I);
|