algolia-uploader 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/dist/index.cjs +0 -29
- package/dist/index.d.cts +0 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +0 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "algolia-uploader",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "command-line util to upload Algolia source",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,21 +20,21 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"algoliasearch": "^5.
|
|
24
|
-
"citty": "^0.2.
|
|
23
|
+
"algoliasearch": "^5.50.2",
|
|
24
|
+
"citty": "^0.2.2",
|
|
25
25
|
"es-toolkit": "^1.45.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@dotenvx/dotenvx": "^1.
|
|
29
|
-
"@types/node": "^25.
|
|
28
|
+
"@dotenvx/dotenvx": "^1.61.1",
|
|
29
|
+
"@types/node": "^25.6.0",
|
|
30
30
|
"husky": "^9.1.7",
|
|
31
31
|
"jiti": "^2.6.1",
|
|
32
|
-
"lint-staged": "^16.
|
|
33
|
-
"npm-check-updates": "^
|
|
34
|
-
"prettier": "^3.8.
|
|
32
|
+
"lint-staged": "^16.4.0",
|
|
33
|
+
"npm-check-updates": "^21.0.2",
|
|
34
|
+
"prettier": "^3.8.3",
|
|
35
35
|
"typescript": "^5.9.3",
|
|
36
36
|
"unbuild": "^3.6.1",
|
|
37
|
-
"vitest": "^4.
|
|
37
|
+
"vitest": "^4.1.4"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "unbuild",
|
package/dist/index.cjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";const citty=require("citty"),require$$0$1=require("fs"),require$$1=require("path"),require$$0$2=require("tty"),require$$2=require("os"),require$$3=require("crypto"),node_module=require("node:module"),require$$0$3=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$$1__default=_interopDefaultCompat(require$$1),require$$0__default$1=_interopDefaultCompat(require$$0$2),require$$2__default=_interopDefaultCompat(require$$2),require$$3__default=_interopDefaultCompat(require$$3),require$$0__default$2=_interopDefaultCompat(require$$0$3),name$2="algolia-uploader",version$2="0.0.12",description$2="command-line util to upload Algolia source";function readAllJsonFiles(e){return require$$0__default.readdirSync(e).filter(s=>s.endsWith(".json")).map(s=>{const v=require$$0__default.readFileSync(require$$1__default.join(e,s),"utf8");return JSON.parse(v)})}function getAugmentedNamespace(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var s=e.default;if(typeof s=="function"){var v=function c(){var l=!1;try{l=this instanceof c}catch{}return l?Reflect.construct(s,arguments,this.constructor):s.apply(this,arguments)};v.prototype=s.prototype}else v={};return Object.defineProperty(v,"__esModule",{value:!0}),Object.keys(e).forEach(function(c){var l=Object.getOwnPropertyDescriptor(e,c);Object.defineProperty(v,c,l.get?l:{enumerable:!0,get:function(){return e[c]}})}),v}var config$1={};const version$1="1.54.1",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:s,description:v}=require$$0;return packageJson={name:e,version:s,description:v},packageJson}var colorDepth,hasRequiredColorDepth;function requireColorDepth(){if(hasRequiredColorDepth)return colorDepth;hasRequiredColorDepth=1;const{WriteStream:e}=require$$0__default$1;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(),s=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 c(a){const o=e.getColorDepth();if(!v.has(a))throw new Error(`Invalid color ${a}`);if(o>=8){const h=v.get(a);return E=>`\x1B[38;5;${h}m${E}\x1B[39m`}if(o>=4){const h=s.get(a);return E=>`\x1B[${h}m${E}\x1B[39m`}return h=>h}function l(a){return e.getColorDepth()>=4?`\x1B[1m${a}\x1B[22m`:a}return colors={getColor:c,bold:l},colors}var logger_1,hasRequiredLogger;function requireLogger(){if(hasRequiredLogger)return logger_1;hasRequiredLogger=1;const e=requirePackageJson(),{getColor:s,bold:v}=requireColors(),c={error:0,warn:1,success:2,successv:2,info:2,help:2,verbose:4,debug:5,silly:6},l=_=>v(s("red")(_)),a=s("orangered"),o=s("green"),h=s("olive"),E=s("dodgerblue"),T=s("plum"),x=s("plum");let q=c.info,S="dotenvx",L=e.version;function w(_,O){const D=A(_,O);console.error(D)}function B(_,O){if(c[_]===void 0)throw new Error(`MISSING_LOG_LEVEL: '${_}'. implement in logger.`);if(c[_]<=q){const D=A(_,O);console.log(D)}}function A(_,O){const D=typeof O=="object"?JSON.stringify(O):O;switch(_.toLowerCase()){case"error":return l(D);case"warn":return a(D);case"success":return o(D);case"successv":return h(`[${S}@${L}] ${D}`);case"info":return D;case"help":return E(D);case"verbose":return T(D);case"debug":return x(D)}}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:_=>{c[_]!==void 0&&(q=c[_],N.level=_)},setName:_=>{S=_,N.name=_},setVersion:_=>{L=_,N.version=_}};function $(_){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 U(_){const O=_.logVersion;O&&N.setVersion(O)}return logger_1={logger:N,getColor:s,setLogLevel:$,setLogName:K,setLogVersion:U,levels:c},logger_1}var dist$1={},utils$4={},constants,hasRequiredConstants;function requireConstants(){if(hasRequiredConstants)return constants;hasRequiredConstants=1;const e="\\\\/",s=`[^${e}]`,v="\\.",c="\\+",l="\\?",a="\\/",o="(?=.)",h="[^/]",E=`(?:${a}|$)`,T=`(?:^|${a})`,x=`${v}{1,2}${E}`,q=`(?!${v})`,S=`(?!${T}${x})`,L=`(?!${v}{0,1}${E})`,w=`(?!${x})`,B=`[^.${a}]`,A=`${h}*?`,$={DOT_LITERAL:v,PLUS_LITERAL:c,QMARK_LITERAL:l,SLASH_LITERAL:a,ONE_CHAR:o,QMARK:h,END_ANCHOR:E,DOTS_SLASH:x,NO_DOT:q,NO_DOTS:S,NO_DOT_SLASH:L,NO_DOTS_SLASH:w,QMARK_NO_DOT:B,STAR:A,START_ANCHOR:T,SEP:"/"},K={...$,SLASH_LITERAL:`[${e}]`,QMARK:s,STAR:`${s}*?`,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:"\\"},U={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:U,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:$}},constants}var hasRequiredUtils$4;function requireUtils$4(){return hasRequiredUtils$4||(hasRequiredUtils$4=1,(function(e){const{REGEX_BACKSLASH:s,REGEX_REMOVE_BACKSLASH:v,REGEX_SPECIAL_CHARS:c,REGEX_SPECIAL_CHARS_GLOBAL:l}=requireConstants();e.isObject=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),e.hasRegexChars=a=>c.test(a),e.isRegexChar=a=>a.length===1&&e.hasRegexChars(a),e.escapeRegex=a=>a.replace(l,"\\$1"),e.toPosixSlashes=a=>a.replace(s,"/"),e.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const a=navigator.platform.toLowerCase();return a==="win32"||a==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1},e.removeBackslashes=a=>a.replace(v,o=>o==="\\"?"":o),e.escapeLast=(a,o,h)=>{const E=a.lastIndexOf(o,h);return E===-1?a:a[E-1]==="\\"?e.escapeLast(a,o,E-1):`${a.slice(0,E)}\\${a.slice(E)}`},e.removePrefix=(a,o={})=>{let h=a;return h.startsWith("./")&&(h=h.slice(2),o.prefix="./"),h},e.wrapOutput=(a,o={},h={})=>{const E=h.contains?"":"^",T=h.contains?"":"$";let x=`${E}(?:${a})${T}`;return o.negated===!0&&(x=`(?:^(?!${x}).*$)`),x},e.basename=(a,{windows:o}={})=>{const h=a.split(o?/[\\/]/:"/"),E=h[h.length-1];return E===""?h[h.length-2]:E}})(utils$4)),utils$4}var scan_1,hasRequiredScan;function requireScan(){if(hasRequiredScan)return scan_1;hasRequiredScan=1;const e=requireUtils$4(),{CHAR_ASTERISK:s,CHAR_AT:v,CHAR_BACKWARD_SLASH:c,CHAR_COMMA:l,CHAR_DOT:a,CHAR_EXCLAMATION_MARK:o,CHAR_FORWARD_SLASH:h,CHAR_LEFT_CURLY_BRACE:E,CHAR_LEFT_PARENTHESES:T,CHAR_LEFT_SQUARE_BRACKET:x,CHAR_PLUS:q,CHAR_QUESTION_MARK:S,CHAR_RIGHT_CURLY_BRACE:L,CHAR_RIGHT_PARENTHESES:w,CHAR_RIGHT_SQUARE_BRACKET:B}=requireConstants(),A=K=>K===h||K===c,N=K=>{K.isPrefix!==!0&&(K.depth=K.isGlobstar?1/0:1)};return scan_1=(K,U)=>{const _=U||{},O=K.length-1,D=_.parts===!0||_.scanToEnd===!0,F=[],P=[],j=[];let R=K,M=-1,V=0,H=0,u=!1,y=!1,i=!1,r=!1,p=!1,d=!1,t=!1,g=!1,m=!1,f=!1,b=0,ee,X,k={value:"",depth:0,isGlob:!1};const Y=()=>M>=O,z=()=>R.charCodeAt(M+1),J=()=>(ee=X,R.charCodeAt(++M));for(;M<O;){X=J();let ue;if(X===c){t=k.backslashes=!0,X=J(),X===E&&(d=!0);continue}if(d===!0||X===E){for(b++;Y()!==!0&&(X=J());){if(X===c){t=k.backslashes=!0,J();continue}if(X===E){b++;continue}if(d!==!0&&X===a&&(X=J())===a){if(u=k.isBrace=!0,i=k.isGlob=!0,f=!0,D===!0)continue;break}if(d!==!0&&X===l){if(u=k.isBrace=!0,i=k.isGlob=!0,f=!0,D===!0)continue;break}if(X===L&&(b--,b===0)){d=!1,u=k.isBrace=!0,f=!0;break}}if(D===!0)continue;break}if(X===h){if(F.push(M),P.push(k),k={value:"",depth:0,isGlob:!1},f===!0)continue;if(ee===a&&M===V+1){V+=2;continue}H=M+1;continue}if(_.noext!==!0&&(X===q||X===v||X===s||X===S||X===o)===!0&&z()===T){if(i=k.isGlob=!0,r=k.isExtglob=!0,f=!0,X===o&&M===V&&(m=!0),D===!0){for(;Y()!==!0&&(X=J());){if(X===c){t=k.backslashes=!0,X=J();continue}if(X===w){i=k.isGlob=!0,f=!0;break}}continue}break}if(X===s){if(ee===s&&(p=k.isGlobstar=!0),i=k.isGlob=!0,f=!0,D===!0)continue;break}if(X===S){if(i=k.isGlob=!0,f=!0,D===!0)continue;break}if(X===x){for(;Y()!==!0&&(ue=J());){if(ue===c){t=k.backslashes=!0,J();continue}if(ue===B){y=k.isBracket=!0,i=k.isGlob=!0,f=!0;break}}if(D===!0)continue;break}if(_.nonegate!==!0&&X===o&&M===V){g=k.negated=!0,V++;continue}if(_.noparen!==!0&&X===T){if(i=k.isGlob=!0,D===!0){for(;Y()!==!0&&(X=J());){if(X===T){t=k.backslashes=!0,X=J();continue}if(X===w){f=!0;break}}continue}break}if(i===!0){if(f=!0,D===!0)continue;break}}_.noext===!0&&(r=!1,i=!1);let ne=R,G="",W="";V>0&&(G=R.slice(0,V),R=R.slice(V),H-=V),ne&&i===!0&&H>0?(ne=R.slice(0,H),W=R.slice(H)):i===!0?(ne="",W=R):ne=R,ne&&ne!==""&&ne!=="/"&&ne!==R&&A(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:G,input:K,start:V,base:ne,glob:W,isBrace:u,isBracket:y,isGlob:i,isExtglob:r,isGlobstar:p,negated:g,negatedExtglob:m};if(_.tokens===!0&&(re.maxDepth=0,A(X)||P.push(k),re.tokens=P),_.parts===!0||_.tokens===!0){let ue;for(let de=0;de<F.length;de++){const se=ue?ue+1:V,pe=F[de],Q=K.slice(se,pe);_.tokens&&(de===0&&V!==0?(P[de].isPrefix=!0,P[de].value=G):P[de].value=Q,N(P[de]),re.maxDepth+=P[de].depth),(de!==0||Q!=="")&&j.push(Q),ue=pe}if(ue&&ue+1<K.length){const de=K.slice(ue+1);j.push(de),_.tokens&&(P[P.length-1].value=de,N(P[P.length-1]),re.maxDepth+=P[P.length-1].depth)}re.slashes=F,re.parts=j}return re},scan_1}var parse_1,hasRequiredParse$1;function requireParse$1(){if(hasRequiredParse$1)return parse_1;hasRequiredParse$1=1;const e=requireConstants(),s=requireUtils$4(),{MAX_LENGTH:v,POSIX_REGEX_SOURCE:c,REGEX_NON_SPECIAL_CHARS:l,REGEX_SPECIAL_CHARS_BACKREF:a,REPLACEMENTS:o}=e,h=(x,q)=>{if(typeof q.expandRange=="function")return q.expandRange(...x,q);x.sort();const S=`[${x.join("-")}]`;try{new RegExp(S)}catch{return x.map(w=>s.escapeRegex(w)).join("..")}return S},E=(x,q)=>`Missing ${x}: "${q}" - use "\\\\${q}" to match literal characters`,T=(x,q)=>{if(typeof x!="string")throw new TypeError("Expected a string");x=o[x]||x;const S={...q},L=typeof S.maxLength=="number"?Math.min(v,S.maxLength):v;let w=x.length;if(w>L)throw new SyntaxError(`Input length: ${w}, exceeds maximum allowed length: ${L}`);const B={type:"bos",value:"",output:S.prepend||""},A=[B],N=S.capture?"":"?:",$=e.globChars(S.windows),K=e.extglobChars($),{DOT_LITERAL:U,PLUS_LITERAL:_,SLASH_LITERAL:O,ONE_CHAR:D,DOTS_SLASH:F,NO_DOT:P,NO_DOT_SLASH:j,NO_DOTS_SLASH:R,QMARK:M,QMARK_NO_DOT:V,STAR:H,START_ANCHOR:u}=$,y=se=>`(${N}(?:(?!${u}${se.dot?F:U}).)*?)`,i=S.dot?"":P,r=S.dot?M:V;let p=S.bash===!0?y(S):H;S.capture&&(p=`(${p})`),typeof S.noext=="boolean"&&(S.noextglob=S.noext);const d={input:x,index:-1,start:0,dot:S.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:A};x=s.removePrefix(x,d),w=x.length;const t=[],g=[],m=[];let f=B,b;const ee=()=>d.index===w-1,X=d.peek=(se=1)=>x[d.index+se],k=d.advance=()=>x[++d.index]||"",Y=()=>x.slice(d.index+1),z=(se="",pe=0)=>{d.consumed+=se,d.index+=pe},J=se=>{d.output+=se.output!=null?se.output:se.value,z(se.value)},ne=()=>{let se=1;for(;X()==="!"&&(X(2)!=="("||X(3)==="?");)k(),d.start++,se++;return se%2===0?!1:(d.negated=!0,d.start++,!0)},G=se=>{d[se]++,m.push(se)},W=se=>{d[se]--,m.pop()},re=se=>{if(f.type==="globstar"){const pe=d.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&&(d.output=d.output.slice(0,-f.output.length),f.type="star",f.value="*",f.output=p,d.output+=f.output)}if(t.length&&se.type!=="paren"&&(t[t.length-1].inner+=se.value),(se.value||se.output)&&J(se),f&&f.type==="text"&&se.type==="text"){f.output=(f.output||f.value)+se.value,f.value+=se.value;return}se.prev=f,A.push(se),f=se},ue=(se,pe)=>{const Q={...K[pe],conditions:1,inner:""};Q.prev=f,Q.parens=d.parens,Q.output=d.output;const ve=(S.capture?"(":"")+Q.open;G("parens"),re({type:se,value:pe,output:d.output?"":D}),re({type:"paren",extglob:!0,value:k(),output:ve}),t.push(Q)},de=se=>{let pe=se.close+(S.capture?")":""),Q;if(se.type==="negate"){let ve=p;if(se.inner&&se.inner.length>1&&se.inner.includes("/")&&(ve=y(S)),(ve!==p||ee()||/^\)+$/.test(Y()))&&(pe=se.close=`)$))${ve}`),se.inner.includes("*")&&(Q=Y())&&/^\.[^\\/.]+$/.test(Q)){const Ee=T(Q,{...q,fastpaths:!1}).output;pe=se.close=`)${Ee})${ve})`}se.prev.type==="bos"&&(d.negatedExtglob=!0)}re({type:"paren",extglob:!0,value:b,output:pe}),W("parens")};if(S.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(x)){let se=!1,pe=x.replace(a,(Q,ve,Ee,he,te,ie)=>he==="\\"?(se=!0,Q):he==="?"?ve?ve+he+(te?M.repeat(te.length):""):ie===0?r+(te?M.repeat(te.length):""):M.repeat(Ee.length):he==="."?U.repeat(Ee.length):he==="*"?ve?ve+he+(te?p:""):p:ve?Q:`\\${Q}`);return se===!0&&(S.unescape===!0?pe=pe.replace(/\\/g,""):pe=pe.replace(/\\+/g,Q=>Q.length%2===0?"\\\\":Q?"\\":"")),pe===x&&S.contains===!0?(d.output=x,d):(d.output=s.wrapOutput(pe,d,q),d)}for(;!ee();){if(b=k(),b==="\0")continue;if(b==="\\"){const Q=X();if(Q==="/"&&S.bash!==!0||Q==="."||Q===";")continue;if(!Q){b+="\\",re({type:"text",value:b});continue}const ve=/^\\+/.exec(Y());let Ee=0;if(ve&&ve[0].length>2&&(Ee=ve[0].length,d.index+=Ee,Ee%2!==0&&(b+="\\")),S.unescape===!0?b=k():b+=k(),d.brackets===0){re({type:"text",value:b});continue}}if(d.brackets>0&&(b!=="]"||f.value==="["||f.value==="[^")){if(S.posix!==!1&&b===":"){const Q=f.value.slice(1);if(Q.includes("[")&&(f.posix=!0,Q.includes(":"))){const ve=f.value.lastIndexOf("["),Ee=f.value.slice(0,ve),he=f.value.slice(ve+2),te=c[he];if(te){f.value=Ee+te,d.backtrack=!0,k(),!B.output&&A.indexOf(f)===1&&(B.output=D);continue}}}(b==="["&&X()!==":"||b==="-"&&X()==="]")&&(b=`\\${b}`),b==="]"&&(f.value==="["||f.value==="[^")&&(b=`\\${b}`),S.posix===!0&&b==="!"&&f.value==="["&&(b="^"),f.value+=b,J({value:b});continue}if(d.quotes===1&&b!=='"'){b=s.escapeRegex(b),f.value+=b,J({value:b});continue}if(b==='"'){d.quotes=d.quotes===1?0:1,S.keepQuotes===!0&&re({type:"text",value:b});continue}if(b==="("){G("parens"),re({type:"paren",value:b});continue}if(b===")"){if(d.parens===0&&S.strictBrackets===!0)throw new SyntaxError(E("opening","("));const Q=t[t.length-1];if(Q&&d.parens===Q.parens+1){de(t.pop());continue}re({type:"paren",value:b,output:d.parens?")":"\\)"}),W("parens");continue}if(b==="["){if(S.nobracket===!0||!Y().includes("]")){if(S.nobracket!==!0&&S.strictBrackets===!0)throw new SyntaxError(E("closing","]"));b=`\\${b}`}else G("brackets");re({type:"bracket",value:b});continue}if(b==="]"){if(S.nobracket===!0||f&&f.type==="bracket"&&f.value.length===1){re({type:"text",value:b,output:`\\${b}`});continue}if(d.brackets===0){if(S.strictBrackets===!0)throw new SyntaxError(E("opening","["));re({type:"text",value:b,output:`\\${b}`});continue}W("brackets");const Q=f.value.slice(1);if(f.posix!==!0&&Q[0]==="^"&&!Q.includes("/")&&(b=`/${b}`),f.value+=b,J({value:b}),S.literalBrackets===!1||s.hasRegexChars(Q))continue;const ve=s.escapeRegex(f.value);if(d.output=d.output.slice(0,-f.value.length),S.literalBrackets===!0){d.output+=ve,f.value=ve;continue}f.value=`(${N}${ve}|${f.value})`,d.output+=f.value;continue}if(b==="{"&&S.nobrace!==!0){G("braces");const Q={type:"brace",value:b,output:"(",outputIndex:d.output.length,tokensIndex:d.tokens.length};g.push(Q),re(Q);continue}if(b==="}"){const Q=g[g.length-1];if(S.nobrace===!0||!Q){re({type:"text",value:b,output:b});continue}let ve=")";if(Q.dots===!0){const Ee=A.slice(),he=[];for(let te=Ee.length-1;te>=0&&(A.pop(),Ee[te].type!=="brace");te--)Ee[te].type!=="dots"&&he.unshift(Ee[te].value);ve=h(he,S),d.backtrack=!0}if(Q.comma!==!0&&Q.dots!==!0){const Ee=d.output.slice(0,Q.outputIndex),he=d.tokens.slice(Q.tokensIndex);Q.value=Q.output="\\{",b=ve="\\}",d.output=Ee;for(const te of he)d.output+=te.output||te.value}re({type:"brace",value:b,output:ve}),W("braces"),g.pop();continue}if(b==="|"){t.length>0&&t[t.length-1].conditions++,re({type:"text",value:b});continue}if(b===","){let Q=b;const ve=g[g.length-1];ve&&m[m.length-1]==="braces"&&(ve.comma=!0,Q="|"),re({type:"comma",value:b,output:Q});continue}if(b==="/"){if(f.type==="dot"&&d.index===d.start+1){d.start=d.index+1,d.consumed="",d.output="",A.pop(),f=B;continue}re({type:"slash",value:b,output:O});continue}if(b==="."){if(d.braces>0&&f.type==="dot"){f.value==="."&&(f.output=U);const Q=g[g.length-1];f.type="dots",f.output+=b,f.value+=b,Q.dots=!0;continue}if(d.braces+d.parens===0&&f.type!=="bos"&&f.type!=="slash"){re({type:"text",value:b,output:U});continue}re({type:"dot",value:b,output:U});continue}if(b==="?"){if(!(f&&f.value==="(")&&S.noextglob!==!0&&X()==="("&&X(2)!=="?"){ue("qmark",b);continue}if(f&&f.type==="paren"){const ve=X();let Ee=b;(f.value==="("&&!/[!=<:]/.test(ve)||ve==="<"&&!/<([!=]|\w+>)/.test(Y()))&&(Ee=`\\${b}`),re({type:"text",value:b,output:Ee});continue}if(S.dot!==!0&&(f.type==="slash"||f.type==="bos")){re({type:"qmark",value:b,output:V});continue}re({type:"qmark",value:b,output:M});continue}if(b==="!"){if(S.noextglob!==!0&&X()==="("&&(X(2)!=="?"||!/[!=<:]/.test(X(3)))){ue("negate",b);continue}if(S.nonegate!==!0&&d.index===0){ne();continue}}if(b==="+"){if(S.noextglob!==!0&&X()==="("&&X(2)!=="?"){ue("plus",b);continue}if(f&&f.value==="("||S.regex===!1){re({type:"plus",value:b,output:_});continue}if(f&&(f.type==="bracket"||f.type==="paren"||f.type==="brace")||d.parens>0){re({type:"plus",value:b});continue}re({type:"plus",value:_});continue}if(b==="@"){if(S.noextglob!==!0&&X()==="("&&X(2)!=="?"){re({type:"at",extglob:!0,value:b,output:""});continue}re({type:"text",value:b});continue}if(b!=="*"){(b==="$"||b==="^")&&(b=`\\${b}`);const Q=l.exec(Y());Q&&(b+=Q[0],d.index+=Q[0].length),re({type:"text",value:b});continue}if(f&&(f.type==="globstar"||f.star===!0)){f.type="star",f.star=!0,f.value+=b,f.output=p,d.backtrack=!0,d.globstar=!0,z(b);continue}let se=Y();if(S.noextglob!==!0&&/^\([^?]/.test(se)){ue("star",b);continue}if(f.type==="star"){if(S.noglobstar===!0){z(b);continue}const Q=f.prev,ve=Q.prev,Ee=Q.type==="slash"||Q.type==="bos",he=ve&&(ve.type==="star"||ve.type==="globstar");if(S.bash===!0&&(!Ee||se[0]&&se[0]!=="/")){re({type:"star",value:b,output:""});continue}const te=d.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:b,output:""});continue}for(;se.slice(0,3)==="/**";){const oe=x[d.index+4];if(oe&&oe!=="/")break;se=se.slice(3),z("/**",3)}if(Q.type==="bos"&&ee()){f.type="globstar",f.value+=b,f.output=y(S),d.output=f.output,d.globstar=!0,z(b);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&!he&&ee()){d.output=d.output.slice(0,-(Q.output+f.output).length),Q.output=`(?:${Q.output}`,f.type="globstar",f.output=y(S)+(S.strictSlashes?")":"|$)"),f.value+=b,d.globstar=!0,d.output+=Q.output+f.output,z(b);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&se[0]==="/"){const oe=se[1]!==void 0?"|$":"";d.output=d.output.slice(0,-(Q.output+f.output).length),Q.output=`(?:${Q.output}`,f.type="globstar",f.output=`${y(S)}${O}|${O}${oe})`,f.value+=b,d.output+=Q.output+f.output,d.globstar=!0,z(b+k()),re({type:"slash",value:"/",output:""});continue}if(Q.type==="bos"&&se[0]==="/"){f.type="globstar",f.value+=b,f.output=`(?:^|${O}|${y(S)}${O})`,d.output=f.output,d.globstar=!0,z(b+k()),re({type:"slash",value:"/",output:""});continue}d.output=d.output.slice(0,-f.output.length),f.type="globstar",f.output=y(S),f.value+=b,d.output+=f.output,d.globstar=!0,z(b);continue}const pe={type:"star",value:b,output:p};if(S.bash===!0){pe.output=".*?",(f.type==="bos"||f.type==="slash")&&(pe.output=i+pe.output),re(pe);continue}if(f&&(f.type==="bracket"||f.type==="paren")&&S.regex===!0){pe.output=b,re(pe);continue}(d.index===d.start||f.type==="slash"||f.type==="dot")&&(f.type==="dot"?(d.output+=j,f.output+=j):S.dot===!0?(d.output+=R,f.output+=R):(d.output+=i,f.output+=i),X()!=="*"&&(d.output+=D,f.output+=D)),re(pe)}for(;d.brackets>0;){if(S.strictBrackets===!0)throw new SyntaxError(E("closing","]"));d.output=s.escapeLast(d.output,"["),W("brackets")}for(;d.parens>0;){if(S.strictBrackets===!0)throw new SyntaxError(E("closing",")"));d.output=s.escapeLast(d.output,"("),W("parens")}for(;d.braces>0;){if(S.strictBrackets===!0)throw new SyntaxError(E("closing","}"));d.output=s.escapeLast(d.output,"{"),W("braces")}if(S.strictSlashes!==!0&&(f.type==="star"||f.type==="bracket")&&re({type:"maybe_slash",value:"",output:`${O}?`}),d.backtrack===!0){d.output="";for(const se of d.tokens)d.output+=se.output!=null?se.output:se.value,se.suffix&&(d.output+=se.suffix)}return d};return T.fastpaths=(x,q)=>{const S={...q},L=typeof S.maxLength=="number"?Math.min(v,S.maxLength):v,w=x.length;if(w>L)throw new SyntaxError(`Input length: ${w}, exceeds maximum allowed length: ${L}`);x=o[x]||x;const{DOT_LITERAL:B,SLASH_LITERAL:A,ONE_CHAR:N,DOTS_SLASH:$,NO_DOT:K,NO_DOTS:U,NO_DOTS_SLASH:_,STAR:O,START_ANCHOR:D}=e.globChars(S.windows),F=S.dot?U:K,P=S.dot?_:K,j=S.capture?"":"?:",R={negated:!1,prefix:""};let M=S.bash===!0?".*?":O;S.capture&&(M=`(${M})`);const V=i=>i.noglobstar===!0?M:`(${j}(?:(?!${D}${i.dot?$:B}).)*?)`,H=i=>{switch(i){case"*":return`${F}${N}${M}`;case".*":return`${B}${N}${M}`;case"*.*":return`${F}${M}${B}${N}${M}`;case"*/*":return`${F}${M}${A}${N}${P}${M}`;case"**":return F+V(S);case"**/*":return`(?:${F}${V(S)}${A})?${P}${N}${M}`;case"**/*.*":return`(?:${F}${V(S)}${A})?${P}${M}${B}${N}${M}`;case"**/.*":return`(?:${F}${V(S)}${A})?${B}${N}${M}`;default:{const r=/^(.*?)\.(\w+)$/.exec(i);if(!r)return;const p=H(r[1]);return p?p+B+r[2]:void 0}}},u=s.removePrefix(x,R);let y=H(u);return y&&S.strictSlashes!==!0&&(y+=`${A}?`),y},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(),s=requireParse$1(),v=requireUtils$4(),c=requireConstants(),l=o=>o&&typeof o=="object"&&!Array.isArray(o),a=(o,h,E=!1)=>{if(Array.isArray(o)){const A=o.map($=>a($,h,E));return $=>{for(const K of A){const U=K($);if(U)return U}return!1}}const T=l(o)&&o.tokens&&o.input;if(o===""||typeof o!="string"&&!T)throw new TypeError("Expected pattern to be a non-empty string");const x=h||{},q=x.windows,S=T?a.compileRe(o,h):a.makeRe(o,h,!1,!0),L=S.state;delete S.state;let w=()=>!1;if(x.ignore){const A={...h,ignore:null,onMatch:null,onResult:null};w=a(x.ignore,A,E)}const B=(A,N=!1)=>{const{isMatch:$,match:K,output:U}=a.test(A,S,h,{glob:o,posix:q}),_={glob:o,state:L,regex:S,posix:q,input:A,output:U,match:K,isMatch:$};return typeof x.onResult=="function"&&x.onResult(_),$===!1?(_.isMatch=!1,N?_:!1):w(A)?(typeof x.onIgnore=="function"&&x.onIgnore(_),_.isMatch=!1,N?_:!1):(typeof x.onMatch=="function"&&x.onMatch(_),N?_:!0)};return E&&(B.state=L),B};return a.test=(o,h,E,{glob:T,posix:x}={})=>{if(typeof o!="string")throw new TypeError("Expected input to be a string");if(o==="")return{isMatch:!1,output:""};const q=E||{},S=q.format||(x?v.toPosixSlashes:null);let L=o===T,w=L&&S?S(o):o;return L===!1&&(w=S?S(o):o,L=w===T),(L===!1||q.capture===!0)&&(q.matchBase===!0||q.basename===!0?L=a.matchBase(o,h,E,x):L=h.exec(w)),{isMatch:!!L,match:L,output:w}},a.matchBase=(o,h,E)=>(h instanceof RegExp?h:a.makeRe(h,E)).test(v.basename(o)),a.isMatch=(o,h,E)=>a(h,E)(o),a.parse=(o,h)=>Array.isArray(o)?o.map(E=>a.parse(E,h)):s(o,{...h,fastpaths:!1}),a.scan=(o,h)=>e(o,h),a.compileRe=(o,h,E=!1,T=!1)=>{if(E===!0)return o.output;const x=h||{},q=x.contains?"":"^",S=x.contains?"":"$";let L=`${q}(?:${o.output})${S}`;o&&o.negated===!0&&(L=`^(?!${L}).*$`);const w=a.toRegex(L,h);return T===!0&&(w.state=o),w},a.makeRe=(o,h={},E=!1,T=!1)=>{if(!o||typeof o!="string")throw new TypeError("Expected a non-empty string");let x={negated:!1,fastpaths:!0};return h.fastpaths!==!1&&(o[0]==="."||o[0]==="*")&&(x.output=s.fastpaths(o,h)),x.output||(x=s(o,h)),a.compileRe(x,h,E,T)},a.toRegex=(o,h)=>{try{const E=h||{};return new RegExp(o,E.flags||(E.nocase?"i":""))}catch(E){if(h&&h.debug===!0)throw E;return/$^/}},a.constants=c,picomatch_1$1=a,picomatch_1$1}var picomatch_1,hasRequiredPicomatch;function requirePicomatch(){if(hasRequiredPicomatch)return picomatch_1;hasRequiredPicomatch=1;const e=requirePicomatch$1(),s=requireUtils$4();function v(c,l,a=!1){return l&&(l.windows===null||l.windows===void 0)&&(l={...l,windows:s.isWindows()}),e(c,l,a)}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,s=Object.defineProperty,v=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,l=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(C,Z,ce,ae)=>{if(Z&&typeof Z=="object"||typeof Z=="function")for(var le=c(Z),_e=0,we=le.length,Se;_e<we;_e++)Se=le[_e],!a.call(C,Se)&&Se!==ce&&s(C,Se,{get:(Ae=>Z[Ae]).bind(null,Se),enumerable:!(ae=v(Z,Se))||ae.enumerable});return C},h=(C,Z,ce)=>(ce=C!=null?e(l(C)):{},o(!C||!C.__esModule?s(ce,"default",{value:C,enumerable:!0}):ce,C));const E=h(require$$1__default),T=h(require$$0__default);function x(C){let Z=(0,E.normalize)(C);return Z.length>1&&Z[Z.length-1]===E.sep&&(Z=Z.substring(0,Z.length-1)),Z}const q=/[\\/]/g;function S(C,Z){return C.replace(q,Z)}const L=/^[a-z]:[\\/]$/i;function w(C){return C==="/"||L.test(C)}function B(C,Z){const{resolvePaths:ce,normalizePath:ae,pathSeparator:le}=Z,_e=process.platform==="win32"&&C.includes("/")||C.startsWith(".");if(ce&&(C=(0,E.resolve)(C)),(ae||_e)&&(C=x(C)),C===".")return"";const we=C[C.length-1]!==le;return S(we?C+le:C,le)}function A(C,Z){return Z+C}function N(C,Z){return function(ce,ae){return ae.startsWith(C)?ae.slice(C.length)+ce:S((0,E.relative)(C,ae),Z.pathSeparator)+Z.pathSeparator+ce}}function $(C){return C}function K(C,Z,ce){return Z+C+ce}function U(C,Z){const{relativePaths:ce,includeBasePath:ae}=Z;return ce&&C?N(C,Z):ae?A:$}function _(C){return function(Z,ce){ce.push(Z.substring(C.length)||".")}}function O(C){return function(Z,ce,ae){const le=Z.substring(C.length)||".";ae.every(_e=>_e(le,!0))&&ce.push(le)}}const D=(C,Z)=>{Z.push(C||".")},F=(C,Z,ce)=>{const ae=C||".";ce.every(le=>le(ae,!0))&&Z.push(ae)},P=()=>{};function j(C,Z){const{includeDirs:ce,filters:ae,relativePaths:le}=Z;return ce?le?ae&&ae.length?O(C):_(C):ae&&ae.length?F:D:P}const R=(C,Z,ce,ae)=>{ae.every(le=>le(C,!1))&&ce.files++},M=(C,Z,ce,ae)=>{ae.every(le=>le(C,!1))&&Z.push(C)},V=(C,Z,ce,ae)=>{ce.files++},H=(C,Z)=>{Z.push(C)},u=()=>{};function y(C){const{excludeFiles:Z,filters:ce,onlyCounts:ae}=C;return Z?u:ce&&ce.length?ae?R:M:ae?V:H}const i=C=>C,r=()=>[""].slice(0,0);function p(C){return C.group?r:i}const d=(C,Z,ce)=>{C.push({directory:Z,files:ce,dir:Z})},t=()=>{};function g(C){return C.group?d:t}const m=function(C,Z,ce){const{queue:ae,fs:le,options:{suppressErrors:_e}}=Z;ae.enqueue(),le.realpath(C,(we,Se)=>{if(we)return ae.dequeue(_e?null:we,Z);le.stat(Se,(Ae,xe)=>{if(Ae)return ae.dequeue(_e?null:Ae,Z);if(xe.isDirectory()&&ee(C,Se,Z))return ae.dequeue(null,Z);ce(xe,Se),ae.dequeue(null,Z)})})},f=function(C,Z,ce){const{queue:ae,fs:le,options:{suppressErrors:_e}}=Z;ae.enqueue();try{const we=le.realpathSync(C),Se=le.statSync(we);if(Se.isDirectory()&&ee(C,we,Z))return;ce(Se,we)}catch(we){if(!_e)throw we}};function b(C,Z){return!C.resolveSymlinks||C.excludeSymlinks?null:Z?f:m}function ee(C,Z,ce){if(ce.options.useRealPaths)return X(Z,ce);let ae=(0,E.dirname)(C),le=1;for(;ae!==ce.root&&le<2;){const _e=ce.symlinks.get(ae);!!_e&&(_e===Z||_e.startsWith(Z)||Z.startsWith(_e))?le++:ae=(0,E.dirname)(ae)}return ce.symlinks.set(C,Z),le>1}function X(C,Z){return Z.visited.includes(C+Z.options.pathSeparator)}const k=C=>C.counts,Y=C=>C.groups,z=C=>C.paths,J=C=>C.paths.slice(0,C.options.maxFiles),ne=(C,Z,ce)=>(ue(Z,ce,C.counts,C.options.suppressErrors),null),G=(C,Z,ce)=>(ue(Z,ce,C.paths,C.options.suppressErrors),null),W=(C,Z,ce)=>(ue(Z,ce,C.paths.slice(0,C.options.maxFiles),C.options.suppressErrors),null),re=(C,Z,ce)=>(ue(Z,ce,C.groups,C.options.suppressErrors),null);function ue(C,Z,ce,ae){Z(C&&!ae?C:null,ce)}function de(C,Z){const{onlyCounts:ce,group:ae,maxFiles:le}=C;return ce?Z?k:ne:ae?Z?Y:re:le?Z?J:W:Z?z:G}const se={withFileTypes:!0},pe=(C,Z,ce,ae,le)=>{if(C.queue.enqueue(),ae<0)return C.queue.dequeue(null,C);const{fs:_e}=C;C.visited.push(Z),C.counts.directories++,_e.readdir(Z||".",se,(we,Se=[])=>{le(Se,ce,ae),C.queue.dequeue(C.options.suppressErrors?null:we,C)})},Q=(C,Z,ce,ae,le)=>{const{fs:_e}=C;if(ae<0)return;C.visited.push(Z),C.counts.directories++;let we=[];try{we=_e.readdirSync(Z||".",se)}catch(Se){if(!C.options.suppressErrors)throw Se}le(we,ce,ae)};function ve(C){return C?Q:pe}var Ee=class{count=0;constructor(C){this.onQueueEmpty=C}enqueue(){return this.count++,this.count}dequeue(C,Z){this.onQueueEmpty&&(--this.count<=0||C)&&(this.onQueueEmpty(C,Z),C&&(Z.controller.abort(),this.onQueueEmpty=void 0))}},he=class{_files=0;_directories=0;set files(C){this._files=C}get files(){return this._files}set directories(C){this._directories=C}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(C,Z,ce){this.isSynchronous=!ce,this.callbackInvoker=de(Z,this.isSynchronous),this.root=B(C,Z),this.state={root:w(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new he,options:Z,queue:new Ee((ae,le)=>this.callbackInvoker(le,ae,ce)),symlinks:new Map,visited:[""].slice(0,0),controller:new te,fs:Z.fs||T},this.joinPath=U(this.root,Z),this.pushDirectory=j(this.root,Z),this.pushFile=y(Z),this.getArray=p(Z),this.groupFiles=g(Z),this.resolveSymlink=b(Z,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=(C,Z,ce)=>{const{paths:ae,options:{filters:le,resolveSymlinks:_e,excludeSymlinks:we,exclude:Se,maxFiles:Ae,signal:xe,useRealPaths:Oe,pathSeparator:Te},controller:Ne}=this.state;if(Ne.aborted||xe&&xe.aborted||Ae&&ae.length>Ae)return;const Ce=this.getArray(this.state.paths);for(let Pe=0;Pe<C.length;++Pe){const Ie=C[Pe];if(Ie.isFile()||Ie.isSymbolicLink()&&!_e&&!we){const Be=this.joinPath(Ie.name,Z);this.pushFile(Be,Ce,this.state.counts,le)}else if(Ie.isDirectory()){let Be=K(Ie.name,Z,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=A(Ie.name,Z);this.resolveSymlink(Be,this.state,(He,Re)=>{if(He.isDirectory()){if(Re=B(Re,this.state.options),Se&&Se(Ie.name,Oe?Re:Be+Te))return;this.walkDirectory(this.state,Re,Oe?Re:Be+Te,ce-1,this.walk)}else{Re=Oe?Re:Be;const Le=(0,E.basename)(Re),De=B((0,E.dirname)(Re),this.state.options);Re=this.joinPath(Le,De),this.pushFile(Re,Ce,this.state.counts,le)}})}}this.groupFiles(this.state.groups,Z,Ce)}};function oe(C,Z){return new Promise((ce,ae)=>{fe(C,Z,(le,_e)=>{if(le)return ae(le);ce(_e)})})}function fe(C,Z,ce){new ie(C,Z,ce).start()}function ye(C,Z){return new ie(C,Z).start()}var be=class{constructor(C,Z){this.root=C,this.options=Z}withPromise(){return oe(this.root,this.options)}withCallback(C){fe(this.root,this.options,C)}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:E.sep,filters:[]};globFunction;constructor(C){this.options={...this.options,...C},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(C){return this.options.pathSeparator=C,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(C){return this.options.maxDepth=C,this}withMaxFiles(C){return this.options.maxFiles=C,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:C=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=C,this.withFullPaths()}withAbortSignal(C){return this.options.signal=C,this}normalize(){return this.options.normalizePath=!0,this}filter(C){return this.options.filters.push(C),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(C){return this.options.exclude=C,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(C){return new be(C||".",this.options)}withGlobFunction(C){return this.globFunction=C,this}crawlWithOptions(C,Z){return this.options={...this.options,...Z},new be(C||".",this.options)}glob(...C){return this.globFunction?this.globWithOptions(C):this.globWithOptions(C,{dot:!0})}globWithOptions(C,...Z){const ce=this.globFunction||ge;if(!ce)throw new Error("Please specify a glob function to use glob matching.");var ae=this.globCache[C.join("\0")];return ae||(ae=ce(C,...Z),this.globCache[C.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(),s=require$$1__default,v=requirePicomatch();class c{constructor(a="./",o=[".env*"],h=[]){this.ignore=["node_modules/**",".git/**"],this.cwd=s.resolve(a),this.envFile=o,this.excludeEnvFile=h}run(){return this._filepaths()}_filepaths(){const a=v(this._exclude()),o=v(this._patterns(),{ignore:this._exclude()});return new e().withRelativePaths().exclude((h,E)=>a(E)).filter(h=>o(h)).crawl(this.cwd).sync()}_patterns(){return Array.isArray(this.envFile)?this.envFile.map(a=>`**/${a}`):[`**/${this.envFile}`]}_excludePatterns(){return Array.isArray(this.excludeEnvFile)?this.excludeEnvFile.map(a=>`**/${a}`):[`**/${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,s="utf8";function v(a,o=null){return o||(o=s),e.readFileSync(a,o)}function c(a,o){return e.writeFileSync(a,o,s)}return fsx_1={chmodSync:e.chmodSync,existsSync:e.existsSync,readdirSync:e.readdirSync,readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,readFileX:v,writeFileX:c},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,s=require$$1__default,v=require$$2__default,c=require$$3__default,a=require$$4.version,o=["\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 h(){return o[Math.floor(Math.random()*o.length)]}function E(R){return typeof R=="string"?!["false","0","no","off",""].includes(R.toLowerCase()):!!R}function T(){return process.stdout.isTTY}function x(R){return T()?`\x1B[2m${R}\x1B[0m`:R}const q=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function S(R){const M={};let V=R.toString();V=V.replace(/\r\n?/mg,`
|
|
3
|
-
`);let H;for(;(H=q.exec(V))!=null;){const u=H[1];let y=H[2]||"";y=y.trim();const i=y[0];y=y.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),i==='"'&&(y=y.replace(/\\n/g,`
|
|
4
|
-
`),y=y.replace(/\\r/g,"\r")),M[u]=y}return M}function L(R){R=R||{};const M=K(R);R.path=M;const V=j.configDotenv(R);if(!V.parsed){const i=new Error(`MISSING_DATA: Cannot parse ${M} for an unknown reason`);throw i.code="MISSING_DATA",i}const H=N(R).split(","),u=H.length;let y;for(let i=0;i<u;i++)try{const r=H[i].trim(),p=$(V,r);y=j.decrypt(p.ciphertext,p.key);break}catch(r){if(i+1>=u)throw r}return j.parse(y)}function w(R){console.error(`[dotenv@${a}][WARN] ${R}`)}function B(R){console.log(`[dotenv@${a}][DEBUG] ${R}`)}function A(R){console.log(`[dotenv@${a}] ${R}`)}function N(R){return R&&R.DOTENV_KEY&&R.DOTENV_KEY.length>0?R.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function $(R,M){let V;try{V=new URL(M)}catch(r){if(r.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 r}const H=V.password;if(!H){const r=new Error("INVALID_DOTENV_KEY: Missing key part");throw r.code="INVALID_DOTENV_KEY",r}const u=V.searchParams.get("environment");if(!u){const r=new Error("INVALID_DOTENV_KEY: Missing environment part");throw r.code="INVALID_DOTENV_KEY",r}const y=`DOTENV_VAULT_${u.toUpperCase()}`,i=R.parsed[y];if(!i){const r=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${y} in your .env.vault file.`);throw r.code="NOT_FOUND_DOTENV_ENVIRONMENT",r}return{ciphertext:i,key:H}}function K(R){let M=null;if(R&&R.path&&R.path.length>0)if(Array.isArray(R.path))for(const V of R.path)e.existsSync(V)&&(M=V.endsWith(".vault")?V:`${V}.vault`);else M=R.path.endsWith(".vault")?R.path:`${R.path}.vault`;else M=s.resolve(process.cwd(),".env.vault");return e.existsSync(M)?M:null}function U(R){return R[0]==="~"?s.join(v.homedir(),R.slice(1)):R}function _(R){const M=E(process.env.DOTENV_CONFIG_DEBUG||R&&R.debug),V=E(process.env.DOTENV_CONFIG_QUIET||R&&R.quiet);(M||!V)&&A("Loading env from encrypted .env.vault");const H=j._parseVault(R);let u=process.env;return R&&R.processEnv!=null&&(u=R.processEnv),j.populate(u,H,R),{parsed:H}}function O(R){const M=s.resolve(process.cwd(),".env");let V="utf8",H=process.env;R&&R.processEnv!=null&&(H=R.processEnv);let u=E(H.DOTENV_CONFIG_DEBUG||R&&R.debug),y=E(H.DOTENV_CONFIG_QUIET||R&&R.quiet);R&&R.encoding?V=R.encoding:u&&B("No encoding is specified. UTF-8 is used by default");let i=[M];if(R&&R.path)if(!Array.isArray(R.path))i=[U(R.path)];else{i=[];for(const t of R.path)i.push(U(t))}let r;const p={};for(const t of i)try{const g=j.parse(e.readFileSync(t,{encoding:V}));j.populate(p,g,R)}catch(g){u&&B(`Failed to load ${t} ${g.message}`),r=g}const d=j.populate(H,p,R);if(u=E(H.DOTENV_CONFIG_DEBUG||u),y=E(H.DOTENV_CONFIG_QUIET||y),u||!y){const t=Object.keys(d).length,g=[];for(const m of i)try{const f=s.relative(process.cwd(),m);g.push(f)}catch(f){u&&B(`Failed to load ${m} ${f.message}`),r=f}A(`injecting env (${t}) from ${g.join(",")} ${x(`-- tip: ${h()}`)}`)}return r?{parsed:p,error:r}:{parsed:p}}function D(R){if(N(R).length===0)return j.configDotenv(R);const M=K(R);return M?j._configVault(R):(w(`You set DOTENV_KEY but you are missing a .env.vault file at ${M}. Did you forget to build it?`),j.configDotenv(R))}function F(R,M){const V=Buffer.from(M.slice(-64),"hex");let H=Buffer.from(R,"base64");const u=H.subarray(0,12),y=H.subarray(-16);H=H.subarray(12,-16);try{const i=c.createDecipheriv("aes-256-gcm",V,u);return i.setAuthTag(y),`${i.update(H)}${i.final()}`}catch(i){const r=i instanceof RangeError,p=i.message==="Invalid key length",d=i.message==="Unsupported state or unable to authenticate data";if(r||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(d){const t=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw t.code="DECRYPTION_FAILED",t}else throw i}}function P(R,M,V={}){const H=!!(V&&V.debug),u=!!(V&&V.override),y={};if(typeof M!="object"){const i=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw i.code="OBJECT_REQUIRED",i}for(const i of Object.keys(M))Object.prototype.hasOwnProperty.call(R,i)?(u===!0&&(R[i]=M[i],y[i]=M[i]),H&&B(u===!0?`"${i}" is already defined and WAS overwritten`:`"${i}" is already defined and was NOT overwritten`)):(R[i]=M[i],y[i]=M[i]);return y}const j={configDotenv:O,_configVault:_,_parseVault:L,config:D,decrypt:F,parse:S,populate:P};return main$2.exports.configDotenv=j.configDotenv,main$2.exports._configVault=j._configVault,main$2.exports._parseVault=j._parseVault,main$2.exports.config=j.config,main$2.exports.decrypt=j.decrypt,main$2.exports.parse=j.parse,main$2.exports.populate=j.populate,main$2.exports=j,main$2.exports}var parseEncryptionKeyFromDotenvKey_1,hasRequiredParseEncryptionKeyFromDotenvKey;function requireParseEncryptionKeyFromDotenvKey(){if(hasRequiredParseEncryptionKeyFromDotenvKey)return parseEncryptionKeyFromDotenvKey_1;hasRequiredParseEncryptionKeyFromDotenvKey=1;function e(s){let v;try{v=new URL(s)}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=v.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(),s=requireParseEncryptionKeyFromDotenvKey();function v(c,l){const a=s(l);try{return e.decrypt(c,a)}catch(o){if(o.code==="DECRYPTION_FAILED"){const h=new Error("[DECRYPTION_FAILED] Unable to decrypt .env.vault with DOTENV_KEY.");throw h.code="DECRYPTION_FAILED",h.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.",h.debug=`[DECRYPTION_FAILED] DOTENV_KEY is ${l}`,h}if(o.code==="ERR_CRYPTO_INVALID_AUTH_TAG"){const h=new Error("[INVALID_CIPHERTEXT] Unable to decrypt what appears to be invalid ciphertext.");throw h.code="INVALID_CIPHERTEXT",h.help="[INVALID_CIPHERTEXT] Run with debug flag [dotenvx run --debug -- yourcommand] or manually check .env.vault.",h.debug=`[INVALID_CIPHERTEXT] ciphertext is '${c}'`,h}throw o}}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=s,e.abool=v,e.anumber=c,e.abytes=l,e.ahash=a,e.aexists=o,e.aoutput=h,e.u8=E,e.u32=T,e.clean=x,e.createView=q,e.bytesToHex=w,e.hexToBytes=N,e.hexToNumber=$,e.bytesToNumberBE=K,e.numberToBytesBE=U,e.utf8ToBytes=O,e.bytesToUtf8=D,e.toBytes=F,e.overlapBytes=P,e.complexOverlapBytes=j,e.concatBytes=R,e.checkOpts=M,e.equalBytes=V,e.getOutput=y,e.setBigUint64=i,e.u64Lengths=r,e.isAligned32=p,e.copyBytes=d;function s(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 c(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function l(t,...g){if(!s(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 a(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");c(t.outputLen),c(t.blockLen)}function o(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 h(t,g){l(t);const m=g.outputLen;if(t.length<m)throw new Error("digestInto() expects output buffer of length at least "+m)}function E(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 x(...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 S=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(l(t),S)return t.toHex();let g="";for(let m=0;m<t.length;m++)g+=L[t[m]];return g}const B={_0:48,_9:57,A:65,F:70,a:97,f:102};function A(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(S)return Uint8Array.fromHex(t);const g=t.length,m=g/2;if(g%2)throw new Error("hex string expected, got unpadded hex of length "+g);const f=new Uint8Array(m);for(let b=0,ee=0;b<m;b++,ee+=2){const X=A(t.charCodeAt(ee)),k=A(t.charCodeAt(ee+1));if(X===void 0||k===void 0){const Y=t[ee]+t[ee+1];throw new Error('hex string expected, got non-hex character "'+Y+'" at index '+ee)}f[b]=X*16+k}return f}function $(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":"0x"+t)}function K(t){return $(w(t))}function U(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 D(t){return new TextDecoder().decode(t)}function F(t){if(typeof t=="string")t=O(t);else if(s(t))t=d(t);else throw new Error("Uint8Array expected, got "+typeof t);return t}function P(t,g){return t.buffer===g.buffer&&t.byteOffset<g.byteOffset+g.byteLength&&g.byteOffset<t.byteOffset+t.byteLength}function j(t,g){if(P(t,g)&&t.byteOffset<g.byteOffset)throw new Error("complex overlap of input and output is not supported")}function R(...t){let g=0;for(let f=0;f<t.length;f++){const b=t[f];l(b),g+=b.length}const m=new Uint8Array(g);for(let f=0,b=0;f<t.length;f++){const ee=t[f];m.set(ee,b),b+=ee.length}return m}function M(t,g){if(g==null||typeof g!="object")throw new Error("options must be defined");return Object.assign(t,g)}function V(t,g){if(t.length!==g.length)return!1;let m=0;for(let f=0;f<t.length;f++)m|=t[f]^g[f];return m===0}class H{}e.Hash=H;const u=(t,g)=>{function m(f,...b){if(l(f),!e.isLE)throw new Error("Non little-endian hardware is not yet supported");if(t.nonceLength!==void 0){const J=b[0];if(!J)throw new Error("nonce / iv required");t.varSizeNonce?l(J):l(J,t.nonceLength)}const ee=t.tagLength;ee&&b[1]!==void 0&&l(b[1]);const X=g(f,...b),k=(J,ne)=>{if(ne!==void 0){if(J!==2)throw new Error("cipher output not supported");l(ne)}};let Y=!1;return{encrypt(J,ne){if(Y)throw new Error("cannot encrypt() twice with same key + nonce");return Y=!0,l(J),k(X.encrypt.length,ne),X.encrypt(J,ne)},decrypt(J,ne){if(l(J),ee&&J.length<ee)throw new Error("invalid ciphertext length: smaller than tagLength="+ee);return k(X.decrypt.length,ne),X.decrypt(J,ne)}}}return Object.assign(m,t),m};e.wrapCipher=u;function y(t,g,m=!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(m&&!p(g))throw new Error("invalid output, must be aligned");return g}function i(t,g,m,f){if(typeof t.setBigUint64=="function")return t.setBigUint64(g,m,f);const b=BigInt(32),ee=BigInt(4294967295),X=Number(m>>b&ee),k=Number(m&ee),Y=f?4:0,z=f?0:4;t.setUint32(g+Y,X,f),t.setUint32(g+z,k,f)}function r(t,g,m){v(m);const f=new Uint8Array(16),b=q(f);return i(b,0,BigInt(g),m),i(b,8,BigInt(t),m),f}function p(t){return t.byteOffset%4===0}function d(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 s=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 c=function(){return e.ECIES_CONFIG.ellipticCurve};e.ellipticCurve=c;var l=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed};e.isEphemeralKeyCompressed=l;var a=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed};e.isHkdfKeyCompressed=a;var o=function(){return e.ECIES_CONFIG.symmetricAlgorithm};e.symmetricAlgorithm=o;var h=function(){return e.ECIES_CONFIG.symmetricNonceLength};e.symmetricNonceLength=h;var E=function(){var T={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?s.COMPRESSED_PUBLIC_KEY_SIZE:s.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:s.CURVE25519_PUBLIC_KEY_SIZE,ed25519:s.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in T)return T[e.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};e.ephemeralKeySize=E})(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=c,e.getWebcryptoSubtle=l,e.managedNonce=a;const s=requireCrypto$1(),v=requireUtils$3();function c(T=32){if(s.crypto&&typeof s.crypto.getRandomValues=="function")return s.crypto.getRandomValues(new Uint8Array(T));if(s.crypto&&typeof s.crypto.randomBytes=="function")return Uint8Array.from(s.crypto.randomBytes(T));throw new Error("crypto.getRandomValues must be defined")}function l(){if(s.crypto&&typeof s.crypto.subtle=="object"&&s.crypto.subtle!=null)return s.crypto.subtle;throw new Error("crypto.subtle must be defined")}function a(T){const{nonceLength:x}=T;return(0,v.anumber)(x),((q,...S)=>({encrypt(L,...w){const B=c(x),A=T(q,B,...S).encrypt(L,...w),N=(0,v.concatBytes)(B,A);return A.fill(0),N},decrypt(L,...w){const B=L.subarray(0,x),A=L.subarray(x);return T(q,B,...S).decrypt(A,...w)}}))}e.utils={async encrypt(T,x,q,S){const L=l(),w=await L.importKey("raw",T,x,!0,["encrypt"]),B=await L.encrypt(q,w,S);return new Uint8Array(B)},async decrypt(T,x,q,S){const L=l(),w=await L.importKey("raw",T,x,!0,["decrypt"]),B=await L.decrypt(q,w,S);return new Uint8Array(B)}};const o={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function h(T,x,q){if(T===o.CBC)return{name:o.CBC,iv:x};if(T===o.CTR)return{name:o.CTR,counter:x,length:64};if(T===o.GCM)return q?{name:o.GCM,iv:x,additionalData:q}:{name:o.GCM,iv:x};throw new Error("unknown aes block mode")}function E(T){return(x,q,S)=>{(0,v.abytes)(x),(0,v.abytes)(q);const L={name:T,length:x.length*8},w=h(T,q,S);let B=!1;return{encrypt(A){if((0,v.abytes)(A),B)throw new Error("Cannot encrypt() twice with same key / nonce");return B=!0,e.utils.encrypt(x,L,w,A)},decrypt(A){return(0,v.abytes)(A),e.utils.decrypt(x,L,w,A)}}}}e.cbc=E(o.CBC),e.ctr=E(o.CTR),e.gcm=E(o.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=c,e.abytes=l,e.ahash=a,e.aexists=o,e.aoutput=h,e.u8=E,e.u32=T,e.clean=x,e.createView=q,e.rotr=S,e.rotl=L,e.byteSwap=w,e.byteSwap32=B,e.bytesToHex=$,e.hexToBytes=_,e.asyncLoop=D,e.utf8ToBytes=F,e.bytesToUtf8=P,e.toBytes=j,e.kdfInputToBytes=R,e.concatBytes=M,e.checkOpts=V,e.createHasher=u,e.createOptHasher=y,e.createXOFer=i,e.randomBytes=r;const s=requireCrypto();function v(p){return p instanceof Uint8Array||ArrayBuffer.isView(p)&&p.constructor.name==="Uint8Array"}function c(p){if(!Number.isSafeInteger(p)||p<0)throw new Error("positive integer expected, got "+p)}function l(p,...d){if(!v(p))throw new Error("Uint8Array expected");if(d.length>0&&!d.includes(p.length))throw new Error("Uint8Array expected of length "+d+", got length="+p.length)}function a(p){if(typeof p!="function"||typeof p.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");c(p.outputLen),c(p.blockLen)}function o(p,d=!0){if(p.destroyed)throw new Error("Hash instance has been destroyed");if(d&&p.finished)throw new Error("Hash#digest() has already been called")}function h(p,d){l(p);const t=d.outputLen;if(p.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}function E(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 x(...p){for(let d=0;d<p.length;d++)p[d].fill(0)}function q(p){return new DataView(p.buffer,p.byteOffset,p.byteLength)}function S(p,d){return p<<32-d|p>>>d}function L(p,d){return p<<d|p>>>32-d>>>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 d=0;d<p.length;d++)p[d]=w(p[d]);return p}e.swap32IfBE=e.isLE?p=>p:B;const A=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",N=Array.from({length:256},(p,d)=>d.toString(16).padStart(2,"0"));function $(p){if(l(p),A)return p.toHex();let d="";for(let t=0;t<p.length;t++)d+=N[p[t]];return d}const K={_0:48,_9:57,A:65,F:70,a:97,f:102};function U(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(A)return Uint8Array.fromHex(p);const d=p.length,t=d/2;if(d%2)throw new Error("hex string expected, got unpadded hex of length "+d);const g=new Uint8Array(t);for(let m=0,f=0;m<t;m++,f+=2){const b=U(p.charCodeAt(f)),ee=U(p.charCodeAt(f+1));if(b===void 0||ee===void 0){const X=p[f]+p[f+1];throw new Error('hex string expected, got non-hex character "'+X+'" at index '+f)}g[m]=b*16+ee}return g}const O=async()=>{};e.nextTick=O;async function D(p,d,t){let g=Date.now();for(let m=0;m<p;m++){t(m);const f=Date.now()-g;f>=0&&f<d||(await(0,e.nextTick)(),g+=f)}}function F(p){if(typeof p!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(p))}function P(p){return new TextDecoder().decode(p)}function j(p){return typeof p=="string"&&(p=F(p)),l(p),p}function R(p){return typeof p=="string"&&(p=F(p)),l(p),p}function M(...p){let d=0;for(let g=0;g<p.length;g++){const m=p[g];l(m),d+=m.length}const t=new Uint8Array(d);for(let g=0,m=0;g<p.length;g++){const f=p[g];t.set(f,m),m+=f.length}return t}function V(p,d){if(d!==void 0&&{}.toString.call(d)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(p,d)}class H{}e.Hash=H;function u(p){const d=g=>p().update(j(g)).digest(),t=p();return d.outputLen=t.outputLen,d.blockLen=t.blockLen,d.create=()=>p(),d}function y(p){const d=(g,m)=>p(m).update(j(g)).digest(),t=p({});return d.outputLen=t.outputLen,d.blockLen=t.blockLen,d.create=g=>p(g),d}function i(p){const d=(g,m)=>p(m).update(j(g)).digest(),t=p({});return d.outputLen=t.outputLen,d.blockLen=t.blockLen,d.create=g=>p(g),d}e.wrapConstructor=u,e.wrapConstructorWithOpts=y,e.wrapXOFConstructorWithOpts=i;function r(p=32){if(s.crypto&&typeof s.crypto.getRandomValues=="function")return s.crypto.getRandomValues(new Uint8Array(p));if(s.crypto&&typeof s.crypto.randomBytes=="function")return Uint8Array.from(s.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=s,_md.Chi=v,_md.Maj=c;const e=requireUtils$2();function s(a,o,h,E){if(typeof a.setBigUint64=="function")return a.setBigUint64(o,h,E);const T=BigInt(32),x=BigInt(4294967295),q=Number(h>>T&x),S=Number(h&x),L=E?4:0,w=E?0:4;a.setUint32(o+L,q,E),a.setUint32(o+w,S,E)}function v(a,o,h){return a&o^~a&h}function c(a,o,h){return a&o^a&h^o&h}class l extends e.Hash{constructor(o,h,E,T){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=o,this.outputLen=h,this.padOffset=E,this.isLE=T,this.buffer=new Uint8Array(o),this.view=(0,e.createView)(this.buffer)}update(o){(0,e.aexists)(this),o=(0,e.toBytes)(o),(0,e.abytes)(o);const{view:h,buffer:E,blockLen:T}=this,x=o.length;for(let q=0;q<x;){const S=Math.min(T-this.pos,x-q);if(S===T){const L=(0,e.createView)(o);for(;T<=x-q;q+=T)this.process(L,q);continue}E.set(o.subarray(q,q+S),this.pos),this.pos+=S,q+=S,this.pos===T&&(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:E,blockLen:T,isLE:x}=this;let{pos:q}=this;h[q++]=128,(0,e.clean)(this.buffer.subarray(q)),this.padOffset>T-q&&(this.process(E,0),q=0);for(let A=q;A<T;A++)h[A]=0;s(E,T-8,BigInt(this.length*8),x),this.process(E,0);const S=(0,e.createView)(o),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 A=0;A<w;A++)S.setUint32(4*A,B[A],x)}digest(){const{buffer:o,outputLen:h}=this;this.digestInto(o);const E=o.slice(0,h);return this.destroy(),E}_cloneInto(o){o||(o=new this.constructor),o.set(...this.get());const{blockLen:h,buffer:E,length:T,finished:x,destroyed:q,pos:S}=this;return o.destroyed=q,o.finished=x,o.length=T,o.pos=S,T%h&&o.buffer.set(E),o}clone(){return this._cloneInto()}}return _md.HashMD=l,_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=c;const e=BigInt(2**32-1),s=BigInt(32);function v(P,j=!1){return j?{h:Number(P&e),l:Number(P>>s&e)}:{h:Number(P>>s&e)|0,l:Number(P&e)|0}}function c(P,j=!1){const R=P.length;let M=new Uint32Array(R),V=new Uint32Array(R);for(let H=0;H<R;H++){const{h:u,l:y}=v(P[H],j);[M[H],V[H]]=[u,y]}return[M,V]}const l=(P,j)=>BigInt(P>>>0)<<s|BigInt(j>>>0);_u64.toBig=l;const a=(P,j,R)=>P>>>R;_u64.shrSH=a;const o=(P,j,R)=>P<<32-R|j>>>R;_u64.shrSL=o;const h=(P,j,R)=>P>>>R|j<<32-R;_u64.rotrSH=h;const E=(P,j,R)=>P<<32-R|j>>>R;_u64.rotrSL=E;const T=(P,j,R)=>P<<64-R|j>>>R-32;_u64.rotrBH=T;const x=(P,j,R)=>P>>>R-32|j<<64-R;_u64.rotrBL=x;const q=(P,j)=>j;_u64.rotr32H=q;const S=(P,j)=>P;_u64.rotr32L=S;const L=(P,j,R)=>P<<R|j>>>32-R;_u64.rotlSH=L;const w=(P,j,R)=>j<<R|P>>>32-R;_u64.rotlSL=w;const B=(P,j,R)=>j<<R-32|P>>>64-R;_u64.rotlBH=B;const A=(P,j,R)=>P<<R-32|j>>>64-R;_u64.rotlBL=A;function N(P,j,R,M){const V=(j>>>0)+(M>>>0);return{h:P+R+(V/2**32|0)|0,l:V|0}}const $=(P,j,R)=>(P>>>0)+(j>>>0)+(R>>>0);_u64.add3L=$;const K=(P,j,R,M)=>j+R+M+(P/2**32|0)|0;_u64.add3H=K;const U=(P,j,R,M)=>(P>>>0)+(j>>>0)+(R>>>0)+(M>>>0);_u64.add4L=U;const _=(P,j,R,M,V)=>j+R+M+V+(P/2**32|0)|0;_u64.add4H=_;const O=(P,j,R,M,V)=>(P>>>0)+(j>>>0)+(R>>>0)+(M>>>0)+(V>>>0);_u64.add5L=O;const D=(P,j,R,M,V,H)=>j+R+M+V+H+(P/2**32|0)|0;_u64.add5H=D;const F={fromBig:v,split:c,toBig:l,shrSH:a,shrSL:o,rotrSH:h,rotrSL:E,rotrBH:T,rotrBL:x,rotr32H:q,rotr32L:S,rotlSH:L,rotlSL:w,rotlBH:B,rotlBL:A,add:N,add3L:$,add3H:K,add4L:U,add4H:_,add5H:D,add5L:O};return _u64.default=F,_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(),s=require_u64(),v=requireUtils$2(),c=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]),l=new Uint32Array(64);class a 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:U,C:_,D:O,E:D,F,G:P,H:j}=this;return[K,U,_,O,D,F,P,j]}set(K,U,_,O,D,F,P,j){this.A=K|0,this.B=U|0,this.C=_|0,this.D=O|0,this.E=D|0,this.F=F|0,this.G=P|0,this.H=j|0}process(K,U){for(let V=0;V<16;V++,U+=4)l[V]=K.getUint32(U,!1);for(let V=16;V<64;V++){const H=l[V-15],u=l[V-2],y=(0,v.rotr)(H,7)^(0,v.rotr)(H,18)^H>>>3,i=(0,v.rotr)(u,17)^(0,v.rotr)(u,19)^u>>>10;l[V]=i+l[V-7]+y+l[V-16]|0}let{A:_,B:O,C:D,D:F,E:P,F:j,G:R,H:M}=this;for(let V=0;V<64;V++){const H=(0,v.rotr)(P,6)^(0,v.rotr)(P,11)^(0,v.rotr)(P,25),u=M+H+(0,e.Chi)(P,j,R)+c[V]+l[V]|0,i=((0,v.rotr)(_,2)^(0,v.rotr)(_,13)^(0,v.rotr)(_,22))+(0,e.Maj)(_,O,D)|0;M=R,R=j,j=P,P=F+u|0,F=D,D=O,O=_,_=u+i|0}_=_+this.A|0,O=O+this.B|0,D=D+this.C|0,F=F+this.D|0,P=P+this.E|0,j=j+this.F|0,R=R+this.G|0,M=M+this.H|0,this.set(_,O,D,F,P,j,R,M)}roundClean(){(0,v.clean)(l)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,v.clean)(this.buffer)}}sha2.SHA256=a;class o extends a{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=o;const h=s.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($=>BigInt($))),E=h[0],T=h[1],x=new Uint32Array(80),q=new Uint32Array(80);class S 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:U,Bh:_,Bl:O,Ch:D,Cl:F,Dh:P,Dl:j,Eh:R,El:M,Fh:V,Fl:H,Gh:u,Gl:y,Hh:i,Hl:r}=this;return[K,U,_,O,D,F,P,j,R,M,V,H,u,y,i,r]}set(K,U,_,O,D,F,P,j,R,M,V,H,u,y,i,r){this.Ah=K|0,this.Al=U|0,this.Bh=_|0,this.Bl=O|0,this.Ch=D|0,this.Cl=F|0,this.Dh=P|0,this.Dl=j|0,this.Eh=R|0,this.El=M|0,this.Fh=V|0,this.Fl=H|0,this.Gh=u|0,this.Gl=y|0,this.Hh=i|0,this.Hl=r|0}process(K,U){for(let t=0;t<16;t++,U+=4)x[t]=K.getUint32(U),q[t]=K.getUint32(U+=4);for(let t=16;t<80;t++){const g=x[t-15]|0,m=q[t-15]|0,f=s.rotrSH(g,m,1)^s.rotrSH(g,m,8)^s.shrSH(g,m,7),b=s.rotrSL(g,m,1)^s.rotrSL(g,m,8)^s.shrSL(g,m,7),ee=x[t-2]|0,X=q[t-2]|0,k=s.rotrSH(ee,X,19)^s.rotrBH(ee,X,61)^s.shrSH(ee,X,6),Y=s.rotrSL(ee,X,19)^s.rotrBL(ee,X,61)^s.shrSL(ee,X,6),z=s.add4L(b,Y,q[t-7],q[t-16]),J=s.add4H(z,f,k,x[t-7],x[t-16]);x[t]=J|0,q[t]=z|0}let{Ah:_,Al:O,Bh:D,Bl:F,Ch:P,Cl:j,Dh:R,Dl:M,Eh:V,El:H,Fh:u,Fl:y,Gh:i,Gl:r,Hh:p,Hl:d}=this;for(let t=0;t<80;t++){const g=s.rotrSH(V,H,14)^s.rotrSH(V,H,18)^s.rotrBH(V,H,41),m=s.rotrSL(V,H,14)^s.rotrSL(V,H,18)^s.rotrBL(V,H,41),f=V&u^~V&i,b=H&y^~H&r,ee=s.add5L(d,m,b,T[t],q[t]),X=s.add5H(ee,p,g,f,E[t],x[t]),k=ee|0,Y=s.rotrSH(_,O,28)^s.rotrBH(_,O,34)^s.rotrBH(_,O,39),z=s.rotrSL(_,O,28)^s.rotrBL(_,O,34)^s.rotrBL(_,O,39),J=_&D^_&P^D&P,ne=O&F^O&j^F&j;p=i|0,d=r|0,i=u|0,r=y|0,u=V|0,y=H|0,{h:V,l:H}=s.add(R|0,M|0,X|0,k|0),R=P|0,M=j|0,P=D|0,j=F|0,D=_|0,F=O|0;const G=s.add3L(k,z,ne);_=s.add3H(G,X,Y,J),O=G|0}({h:_,l:O}=s.add(this.Ah|0,this.Al|0,_|0,O|0)),{h:D,l:F}=s.add(this.Bh|0,this.Bl|0,D|0,F|0),{h:P,l:j}=s.add(this.Ch|0,this.Cl|0,P|0,j|0),{h:R,l:M}=s.add(this.Dh|0,this.Dl|0,R|0,M|0),{h:V,l:H}=s.add(this.Eh|0,this.El|0,V|0,H|0),{h:u,l:y}=s.add(this.Fh|0,this.Fl|0,u|0,y|0),{h:i,l:r}=s.add(this.Gh|0,this.Gl|0,i|0,r|0),{h:p,l:d}=s.add(this.Hh|0,this.Hl|0,p|0,d|0),this.set(_,O,D,F,P,j,R,M,V,H,u,y,i,r,p,d)}roundClean(){(0,v.clean)(x,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=S;class L extends S{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 A extends S{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=A;class N extends S{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 a),sha2.sha224=(0,v.createHasher)(()=>new o),sha2.sha512=(0,v.createHasher)(()=>new S),sha2.sha384=(0,v.createHasher)(()=>new L),sha2.sha512_256=(0,v.createHasher)(()=>new N),sha2.sha512_224=(0,v.createHasher)(()=>new A),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=a,e._abool2=o,e._abytes2=h,e.numberToHexUnpadded=E,e.hexToNumber=T,e.bytesToNumberBE=x,e.bytesToNumberLE=q,e.numberToBytesBE=S,e.numberToBytesLE=L,e.numberToVarBytesBE=w,e.ensureBytes=B,e.equalBytes=A,e.copyBytes=N,e.asciiToBytes=$,e.inRange=U,e.aInRange=_,e.bitLen=O,e.bitGet=D,e.bitSet=F,e.createHmacDrbg=j,e.validateObject=M,e.isHash=V,e._validateObject=H,e.memoized=y;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const s=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 c=BigInt(0),l=BigInt(1);function a(i,r){if(typeof r!="boolean")throw new Error(i+" boolean expected, got "+r)}function o(i,r=""){if(typeof i!="boolean"){const p=r&&`"${r}"`;throw new Error(p+"expected boolean, got type="+typeof i)}return i}function h(i,r,p=""){const d=(0,s.isBytes)(i),t=i?.length,g=r!==void 0;if(!d||g&&t!==r){const m=p&&`"${p}" `,f=g?` of length ${r}`:"",b=d?`length=${t}`:`type=${typeof i}`;throw new Error(m+"expected Uint8Array"+f+", got "+b)}return i}function E(i){const r=i.toString(16);return r.length&1?"0"+r:r}function T(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);return i===""?c:BigInt("0x"+i)}function x(i){return T((0,s.bytesToHex)(i))}function q(i){return(0,s.abytes)(i),T((0,s.bytesToHex)(Uint8Array.from(i).reverse()))}function S(i,r){return(0,s.hexToBytes)(i.toString(16).padStart(r*2,"0"))}function L(i,r){return S(i,r).reverse()}function w(i){return(0,s.hexToBytes)(E(i))}function B(i,r,p){let d;if(typeof r=="string")try{d=(0,s.hexToBytes)(r)}catch(g){throw new Error(i+" must be hex string or Uint8Array, cause: "+g)}else if((0,s.isBytes)(r))d=Uint8Array.from(r);else throw new Error(i+" must be hex string or Uint8Array");const t=d.length;if(typeof p=="number"&&t!==p)throw new Error(i+" of length "+p+" expected, got "+t);return d}function A(i,r){if(i.length!==r.length)return!1;let p=0;for(let d=0;d<i.length;d++)p|=i[d]^r[d];return p===0}function N(i){return Uint8Array.from(i)}function $(i){return Uint8Array.from(i,(r,p)=>{const d=r.charCodeAt(0);if(r.length!==1||d>127)throw new Error(`string contains non-ASCII character "${i[p]}" with code ${d} at position ${p}`);return d})}const K=i=>typeof i=="bigint"&&c<=i;function U(i,r,p){return K(i)&&K(r)&&K(p)&&r<=i&&i<p}function _(i,r,p,d){if(!U(r,p,d))throw new Error("expected valid "+i+": "+p+" <= n < "+d+", got "+r)}function O(i){let r;for(r=0;i>c;i>>=l,r+=1);return r}function D(i,r){return i>>BigInt(r)&l}function F(i,r,p){return i|(p?l:c)<<BigInt(r)}const P=i=>(l<<BigInt(i))-l;e.bitMask=P;function j(i,r,p){if(typeof i!="number"||i<2)throw new Error("hashLen must be a number");if(typeof r!="number"||r<2)throw new Error("qByteLen must be a number");if(typeof p!="function")throw new Error("hmacFn must be a function");const d=z=>new Uint8Array(z),t=z=>Uint8Array.of(z);let g=d(i),m=d(i),f=0;const b=()=>{g.fill(1),m.fill(0),f=0},ee=(...z)=>p(m,g,...z),X=(z=d(0))=>{m=ee(t(0),z),g=ee(),z.length!==0&&(m=ee(t(1),z),g=ee())},k=()=>{if(f++>=1e3)throw new Error("drbg: tried 1000 values");let z=0;const J=[];for(;z<r;){g=ee();const ne=g.slice();J.push(ne),z+=g.length}return(0,s.concatBytes)(...J)};return(z,J)=>{b(),X(z);let ne;for(;!(ne=J(k()));)X();return b(),ne}}const R={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"||(0,s.isBytes)(i),isSafeInteger:i=>Number.isSafeInteger(i),array:i=>Array.isArray(i),field:(i,r)=>r.Fp.isValid(i),hash:i=>typeof i=="function"&&Number.isSafeInteger(i.outputLen)};function M(i,r,p={}){const d=(t,g,m)=>{const f=R[g];if(typeof f!="function")throw new Error("invalid validator function");const b=i[t];if(!(m&&b===void 0)&&!f(b,i))throw new Error("param "+String(t)+" is invalid. Expected "+g+", got "+b)};for(const[t,g]of Object.entries(r))d(t,g,!1);for(const[t,g]of Object.entries(p))d(t,g,!0);return i}function V(i){return typeof i=="function"&&Number.isSafeInteger(i.outputLen)}function H(i,r,p={}){if(!i||typeof i!="object")throw new Error("expected valid options object");function d(t,g,m){const f=i[t];if(m&&f===void 0)return;const b=typeof f;if(b!==g||f===null)throw new Error(`param "${t}" is invalid: expected ${g}, got ${b}`)}Object.entries(r).forEach(([t,g])=>d(t,g,!1)),Object.entries(p).forEach(([t,g])=>d(t,g,!0))}const u=()=>{throw new Error("not implemented")};e.notImplemented=u;function y(i){const r=new WeakMap;return(p,...d)=>{const t=r.get(p);if(t!==void 0)return t;const g=i(p,...d);return r.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=S,modular.pow2=L,modular.invert=w,modular.tonelliShanks=K,modular.FpSqrt=U,modular.validateField=D,modular.FpPow=F,modular.FpInvertBatch=P,modular.FpDiv=j,modular.FpLegendre=R,modular.FpIsSquare=M,modular.nLength=V,modular.Field=H,modular.FpSqrtOdd=u,modular.FpSqrtEven=y,modular.hashToPrivateScalar=i,modular.getFieldBytesLength=r,modular.getMinHashLength=p,modular.mapHashToField=d;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireUtils$1(),s=BigInt(0),v=BigInt(1),c=BigInt(2),l=BigInt(3),a=BigInt(4),o=BigInt(5),h=BigInt(7),E=BigInt(8),T=BigInt(9),x=BigInt(16);function q(t,g){const m=t%g;return m>=s?m:g+m}function S(t,g,m){return F(H(m),t,g)}function L(t,g,m){let f=t;for(;g-- >s;)f*=f,f%=m;return f}function w(t,g){if(t===s)throw new Error("invert: expected non-zero number");if(g<=s)throw new Error("invert: expected positive modulus, got "+g);let m=q(t,g),f=g,b=s,ee=v;for(;m!==s;){const k=f/m,Y=f%m,z=b-ee*k;f=m,m=Y,b=ee,ee=z}if(f!==v)throw new Error("invert: does not exist");return q(b,g)}function B(t,g,m){if(!t.eql(t.sqr(g),m))throw new Error("Cannot find square root")}function A(t,g){const m=(t.ORDER+v)/a,f=t.pow(g,m);return B(t,f,g),f}function N(t,g){const m=(t.ORDER-o)/E,f=t.mul(g,c),b=t.pow(f,m),ee=t.mul(g,b),X=t.mul(t.mul(ee,c),b),k=t.mul(ee,t.sub(X,t.ONE));return B(t,k,g),k}function $(t){const g=H(t),m=K(t),f=m(g,g.neg(g.ONE)),b=m(g,f),ee=m(g,g.neg(f)),X=(t+h)/x;return(k,Y)=>{let z=k.pow(Y,X),J=k.mul(z,f);const ne=k.mul(z,b),G=k.mul(z,ee),W=k.eql(k.sqr(J),Y),re=k.eql(k.sqr(ne),Y);z=k.cmov(z,J,W),J=k.cmov(G,ne,re);const ue=k.eql(k.sqr(J),Y),de=k.cmov(z,J,ue);return B(k,de,Y),de}}function K(t){if(t<l)throw new Error("sqrt is not defined for small field");let g=t-v,m=0;for(;g%c===s;)g/=c,m++;let f=c;const b=H(t);for(;R(b,f)===1;)if(f++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(m===1)return A;let ee=b.pow(f,g);const X=(g+v)/c;return function(Y,z){if(Y.is0(z))return z;if(R(Y,z)!==1)throw new Error("Cannot find square root");let J=m,ne=Y.mul(Y.ONE,ee),G=Y.pow(z,g),W=Y.pow(z,X);for(;!Y.eql(G,Y.ONE);){if(Y.is0(G))return Y.ZERO;let re=1,ue=Y.sqr(G);for(;!Y.eql(ue,Y.ONE);)if(re++,ue=Y.sqr(ue),re===J)throw new Error("Cannot find square root");const de=v<<BigInt(J-re-1),se=Y.pow(ne,de);J=re,ne=Y.sqr(se),G=Y.mul(G,ne),W=Y.mul(W,se)}return W}}function U(t){return t%a===l?A:t%E===o?N:t%x===T?$(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 D(t){const g={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},m=O.reduce((f,b)=>(f[b]="function",f),g);return(0,e._validateObject)(t,m),t}function F(t,g,m){if(m<s)throw new Error("invalid exponent, negatives unsupported");if(m===s)return t.ONE;if(m===v)return g;let f=t.ONE,b=g;for(;m>s;)m&v&&(f=t.mul(f,b)),b=t.sqr(b),m>>=v;return f}function P(t,g,m=!1){const f=new Array(g.length).fill(m?t.ZERO:void 0),b=g.reduce((X,k,Y)=>t.is0(k)?X:(f[Y]=X,t.mul(X,k)),t.ONE),ee=t.inv(b);return g.reduceRight((X,k,Y)=>t.is0(k)?X:(f[Y]=t.mul(X,f[Y]),t.mul(X,k)),ee),f}function j(t,g,m){return t.mul(g,typeof m=="bigint"?w(m,t.ORDER):t.inv(m))}function R(t,g){const m=(t.ORDER-v)/c,f=t.pow(g,m),b=t.eql(f,t.ONE),ee=t.eql(f,t.ZERO),X=t.eql(f,t.neg(t.ONE));if(!b&&!ee&&!X)throw new Error("invalid Legendre symbol result");return b?1:ee?0:-1}function M(t,g){return R(t,g)===1}function V(t,g){g!==void 0&&(0,e.anumber)(g);const m=g!==void 0?g:t.toString(2).length,f=Math.ceil(m/8);return{nBitLength:m,nByteLength:f}}function H(t,g,m=!1,f={}){if(t<=s)throw new Error("invalid field: expected ORDER > 0, got "+t);let b,ee,X=!1,k;if(typeof g=="object"&&g!=null){if(f.sqrt||m)throw new Error("cannot specify opts in two arguments");const G=g;G.BITS&&(b=G.BITS),G.sqrt&&(ee=G.sqrt),typeof G.isLE=="boolean"&&(m=G.isLE),typeof G.modFromBytes=="boolean"&&(X=G.modFromBytes),k=G.allowedLengths}else typeof g=="number"&&(b=g),f.sqrt&&(ee=f.sqrt);const{nBitLength:Y,nByteLength:z}=V(t,b);if(z>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let J;const ne=Object.freeze({ORDER:t,isLE:m,BITS:Y,BYTES:z,MASK:(0,e.bitMask)(Y),ZERO:s,ONE:v,allowedLengths:k,create:G=>q(G,t),isValid:G=>{if(typeof G!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof G);return s<=G&&G<t},is0:G=>G===s,isValidNot0:G=>!ne.is0(G)&&ne.isValid(G),isOdd:G=>(G&v)===v,neg:G=>q(-G,t),eql:(G,W)=>G===W,sqr:G=>q(G*G,t),add:(G,W)=>q(G+W,t),sub:(G,W)=>q(G-W,t),mul:(G,W)=>q(G*W,t),pow:(G,W)=>F(ne,G,W),div:(G,W)=>q(G*w(W,t),t),sqrN:G=>G*G,addN:(G,W)=>G+W,subN:(G,W)=>G-W,mulN:(G,W)=>G*W,inv:G=>w(G,t),sqrt:ee||(G=>(J||(J=U(t)),J(ne,G))),toBytes:G=>m?(0,e.numberToBytesLE)(G,z):(0,e.numberToBytesBE)(G,z),fromBytes:(G,W=!0)=>{if(k){if(!k.includes(G.length)||G.length>z)throw new Error("Field.fromBytes: expected "+k+" bytes, got "+G.length);const ue=new Uint8Array(z);ue.set(G,m?0:ue.length-G.length),G=ue}if(G.length!==z)throw new Error("Field.fromBytes: expected "+z+" bytes, got "+G.length);let re=m?(0,e.bytesToNumberLE)(G):(0,e.bytesToNumberBE)(G);if(X&&(re=q(re,t)),!W&&!ne.isValid(re))throw new Error("invalid field element: outside of range 0..ORDER");return re},invertBatch:G=>P(ne,G),cmov:(G,W,re)=>re?W:G});return Object.freeze(ne)}function u(t,g){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const m=t.sqrt(g);return t.isOdd(m)?m:t.neg(m)}function y(t,g){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const m=t.sqrt(g);return t.isOdd(m)?t.neg(m):m}function i(t,g,m=!1){t=(0,e.ensureBytes)("privateHash",t);const f=t.length,b=V(g).nByteLength+8;if(b<24||f<b||f>1024)throw new Error("hashToPrivateScalar: expected "+b+"-1024 bytes of input, got "+f);const ee=m?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t);return q(ee,g-v)+v}function r(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=r(t);return g+Math.ceil(g/2)}function d(t,g,m=!1){const f=t.length,b=r(g),ee=p(g);if(f<16||f<ee||f>1024)throw new Error("expected "+ee+"-1024 bytes of input, got "+f);const X=m?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t),k=q(X,g-v)+v;return m?(0,e.numberToBytesLE)(k,b):(0,e.numberToBytesBE)(k,b)}return modular}var hasRequiredCurve;function requireCurve(){if(hasRequiredCurve)return curve;hasRequiredCurve=1,Object.defineProperty(curve,"__esModule",{value:!0}),curve.wNAF=void 0,curve.negateCt=l,curve.normalizeZ=a,curve.mulEndoUnsafe=A,curve.pippenger=N,curve.precomputeMSMUnsafe=$,curve.validateBasic=K,curve._createCurveFields=_;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireUtils$1(),s=requireModular(),v=BigInt(0),c=BigInt(1);function l(O,D){const F=D.negate();return O?F:D}function a(O,D){const F=(0,s.FpInvertBatch)(O.Fp,D.map(P=>P.Z));return D.map((P,j)=>O.fromAffine(P.toAffine(F[j])))}function o(O,D){if(!Number.isSafeInteger(O)||O<=0||O>D)throw new Error("invalid window size, expected [1.."+D+"], got W="+O)}function h(O,D){o(O,D);const F=Math.ceil(D/O)+1,P=2**(O-1),j=2**O,R=(0,e.bitMask)(O),M=BigInt(O);return{windows:F,windowSize:P,mask:R,maxNumber:j,shiftBy:M}}function E(O,D,F){const{windowSize:P,mask:j,maxNumber:R,shiftBy:M}=F;let V=Number(O&j),H=O>>M;V>P&&(V-=R,H+=c);const u=D*P,y=u+Math.abs(V)-1,i=V===0,r=V<0,p=D%2!==0;return{nextN:H,offset:y,isZero:i,isNeg:r,isNegF:p,offsetF:u}}function T(O,D){if(!Array.isArray(O))throw new Error("array expected");O.forEach((F,P)=>{if(!(F instanceof D))throw new Error("invalid point at index "+P)})}function x(O,D){if(!Array.isArray(O))throw new Error("array of scalars expected");O.forEach((F,P)=>{if(!D.isValid(F))throw new Error("invalid scalar at index "+P)})}const q=new WeakMap,S=new WeakMap;function L(O){return S.get(O)||1}function w(O){if(O!==v)throw new Error("invalid wNAF")}class B{constructor(D,F){this.BASE=D.BASE,this.ZERO=D.ZERO,this.Fn=D.Fn,this.bits=F}_unsafeLadder(D,F,P=this.ZERO){let j=D;for(;F>v;)F&c&&(P=P.add(j)),j=j.double(),F>>=c;return P}precomputeWindow(D,F){const{windows:P,windowSize:j}=h(F,this.bits),R=[];let M=D,V=M;for(let H=0;H<P;H++){V=M,R.push(V);for(let u=1;u<j;u++)V=V.add(M),R.push(V);M=V.double()}return R}wNAF(D,F,P){if(!this.Fn.isValid(P))throw new Error("invalid scalar");let j=this.ZERO,R=this.BASE;const M=h(D,this.bits);for(let V=0;V<M.windows;V++){const{nextN:H,offset:u,isZero:y,isNeg:i,isNegF:r,offsetF:p}=E(P,V,M);P=H,y?R=R.add(l(r,F[p])):j=j.add(l(i,F[u]))}return w(P),{p:j,f:R}}wNAFUnsafe(D,F,P,j=this.ZERO){const R=h(D,this.bits);for(let M=0;M<R.windows&&P!==v;M++){const{nextN:V,offset:H,isZero:u,isNeg:y}=E(P,M,R);if(P=V,!u){const i=F[H];j=j.add(y?i.negate():i)}}return w(P),j}getPrecomputes(D,F,P){let j=q.get(F);return j||(j=this.precomputeWindow(F,D),D!==1&&(typeof P=="function"&&(j=P(j)),q.set(F,j))),j}cached(D,F,P){const j=L(D);return this.wNAF(j,this.getPrecomputes(j,D,P),F)}unsafe(D,F,P,j){const R=L(D);return R===1?this._unsafeLadder(D,F,j):this.wNAFUnsafe(R,this.getPrecomputes(R,D,P),F,j)}createCache(D,F){o(F,this.bits),S.set(D,F),q.delete(D)}hasCache(D){return L(D)!==1}}curve.wNAF=B;function A(O,D,F,P){let j=D,R=O.ZERO,M=O.ZERO;for(;F>v||P>v;)F&c&&(R=R.add(j)),P&c&&(M=M.add(j)),j=j.double(),F>>=c,P>>=c;return{p1:R,p2:M}}function N(O,D,F,P){T(F,O),x(P,D);const j=F.length,R=P.length;if(j!==R)throw new Error("arrays of points and scalars must have equal length");const M=O.ZERO,V=(0,e.bitLen)(BigInt(j));let H=1;V>12?H=V-3:V>4?H=V-2:V>0&&(H=2);const u=(0,e.bitMask)(H),y=new Array(Number(u)+1).fill(M),i=Math.floor((D.BITS-1)/H)*H;let r=M;for(let p=i;p>=0;p-=H){y.fill(M);for(let t=0;t<R;t++){const g=P[t],m=Number(g>>BigInt(p)&u);y[m]=y[m].add(F[t])}let d=M;for(let t=y.length-1,g=M;t>0;t--)g=g.add(y[t]),d=d.add(g);if(r=r.add(d),p!==0)for(let t=0;t<H;t++)r=r.double()}return r}function $(O,D,F,P){o(P,D.BITS),T(F,O);const j=O.ZERO,R=2**P-1,M=Math.ceil(D.BITS/P),V=(0,e.bitMask)(P),H=F.map(u=>{const y=[];for(let i=0,r=u;i<R;i++)y.push(r),r=r.add(u);return y});return u=>{if(x(u,D),u.length>F.length)throw new Error("array of scalars must be smaller than array of points");let y=j;for(let i=0;i<M;i++){if(y!==j)for(let p=0;p<P;p++)y=y.double();const r=BigInt(M*P-(i+1)*P);for(let p=0;p<u.length;p++){const d=u[p],t=Number(d>>r&V);t&&(y=y.add(H[p][t-1]))}}return y}}function K(O){return(0,s.validateField)(O.Fp),(0,e.validateObject)(O,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,s.nLength)(O.n,O.nBitLength),...O,p:O.Fp.ORDER})}function U(O,D,F){if(D){if(D.ORDER!==O)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return(0,s.validateField)(D),D}else return(0,s.Field)(O,{isLE:F})}function _(O,D,F={},P){if(P===void 0&&(P=O==="edwards"),!D||typeof D!="object")throw new Error(`expected valid ${O} CURVE object`);for(const H of["p","n","h"]){const u=D[H];if(!(typeof u=="bigint"&&u>v))throw new Error(`CURVE.${H} must be positive bigint`)}const j=U(D.p,F.Fp,P),R=U(D.n,F.Fn,P),V=["Gx","Gy","a",O==="weierstrass"?"b":"d"];for(const H of V)if(!j.isValid(D[H]))throw new Error(`CURVE.${H} must be valid field element of CURVE.Fp`);return D=Object.freeze(Object.assign({},D)),{CURVE:D,Fp:j,Fn:R}}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=E,edwards.eddsa=x,edwards.twistedEdwards=L;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireUtils$1(),s=requireCurve(),v=requireModular(),c=BigInt(0),l=BigInt(1),a=BigInt(2),o=BigInt(8);function h(w,B,A,N){const $=w.sqr(A),K=w.sqr(N),U=w.add(w.mul(B.a,$),K),_=w.add(w.ONE,w.mul(B.d,w.mul($,K)));return w.eql(U,_)}function E(w,B={}){const A=(0,s._createCurveFields)("edwards",w,B,B.FpFnLE),{Fp:N,Fn:$}=A;let K=A.CURVE;const{h:U}=K;(0,e._validateObject)(B,{},{uvRatio:"function"});const _=a<<BigInt($.BYTES*8)-l,O=H=>N.create(H),D=B.uvRatio||((H,u)=>{try{return{isValid:!0,value:N.sqrt(N.div(H,u))}}catch{return{isValid:!1,value:c}}});if(!h(N,K,K.Gx,K.Gy))throw new Error("bad curve params: generator point");function F(H,u,y=!1){const i=y?l:c;return(0,e.aInRange)("coordinate "+H,u,i,_),u}function P(H){if(!(H instanceof M))throw new Error("ExtendedPoint expected")}const j=(0,e.memoized)((H,u)=>{const{X:y,Y:i,Z:r}=H,p=H.is0();u==null&&(u=p?o:N.inv(r));const d=O(y*u),t=O(i*u),g=N.mul(r,u);if(p)return{x:c,y:l};if(g!==l)throw new Error("invZ was invalid");return{x:d,y:t}}),R=(0,e.memoized)(H=>{const{a:u,d:y}=K;if(H.is0())throw new Error("bad point: ZERO");const{X:i,Y:r,Z:p,T:d}=H,t=O(i*i),g=O(r*r),m=O(p*p),f=O(m*m),b=O(t*u),ee=O(m*O(b+g)),X=O(f+O(y*O(t*g)));if(ee!==X)throw new Error("bad point: equation left != right (1)");const k=O(i*r),Y=O(p*d);if(k!==Y)throw new Error("bad point: equation left != right (2)");return!0});class M{constructor(u,y,i,r){this.X=F("x",u),this.Y=F("y",y),this.Z=F("z",i,!0),this.T=F("t",r),Object.freeze(this)}static CURVE(){return K}static fromAffine(u){if(u instanceof M)throw new Error("extended point not allowed");const{x:y,y:i}=u||{};return F("x",y),F("y",i),new M(y,i,l,O(y*i))}static fromBytes(u,y=!1){const i=N.BYTES,{a:r,d:p}=K;u=(0,e.copyBytes)((0,e._abytes2)(u,i,"point")),(0,e._abool2)(y,"zip215");const d=(0,e.copyBytes)(u),t=u[i-1];d[i-1]=t&-129;const g=(0,e.bytesToNumberLE)(d),m=y?_:N.ORDER;(0,e.aInRange)("point.y",g,c,m);const f=O(g*g),b=O(f-l),ee=O(p*f-r);let{isValid:X,value:k}=D(b,ee);if(!X)throw new Error("bad point: invalid y coordinate");const Y=(k&l)===l,z=(t&128)!==0;if(!y&&k===c&&z)throw new Error("bad point: x=0 and x_0=1");return z!==Y&&(k=O(-k)),M.fromAffine({x:k,y:g})}static fromHex(u,y=!1){return M.fromBytes((0,e.ensureBytes)("point",u),y)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(u=8,y=!0){return V.createCache(this,u),y||this.multiply(a),this}assertValidity(){R(this)}equals(u){P(u);const{X:y,Y:i,Z:r}=this,{X:p,Y:d,Z:t}=u,g=O(y*t),m=O(p*r),f=O(i*t),b=O(d*r);return g===m&&f===b}is0(){return this.equals(M.ZERO)}negate(){return new M(O(-this.X),this.Y,this.Z,O(-this.T))}double(){const{a:u}=K,{X:y,Y:i,Z:r}=this,p=O(y*y),d=O(i*i),t=O(a*O(r*r)),g=O(u*p),m=y+i,f=O(O(m*m)-p-d),b=g+d,ee=b-t,X=g-d,k=O(f*ee),Y=O(b*X),z=O(f*X),J=O(ee*b);return new M(k,Y,J,z)}add(u){P(u);const{a:y,d:i}=K,{X:r,Y:p,Z:d,T:t}=this,{X:g,Y:m,Z:f,T:b}=u,ee=O(r*g),X=O(p*m),k=O(t*i*b),Y=O(d*f),z=O((r+p)*(g+m)-ee-X),J=Y-k,ne=Y+k,G=O(X-y*ee),W=O(z*J),re=O(ne*G),ue=O(z*G),de=O(J*ne);return new M(W,re,de,ue)}subtract(u){return this.add(u.negate())}multiply(u){if(!$.isValidNot0(u))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:y,f:i}=V.cached(this,u,r=>(0,s.normalizeZ)(M,r));return(0,s.normalizeZ)(M,[y,i])[0]}multiplyUnsafe(u,y=M.ZERO){if(!$.isValid(u))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return u===c?M.ZERO:this.is0()||u===l?this:V.unsafe(this,u,i=>(0,s.normalizeZ)(M,i),y)}isSmallOrder(){return this.multiplyUnsafe(U).is0()}isTorsionFree(){return V.unsafe(this,K.n).is0()}toAffine(u){return j(this,u)}clearCofactor(){return U===l?this:this.multiplyUnsafe(U)}toBytes(){const{x:u,y}=this.toAffine(),i=N.toBytes(y);return i[i.length-1]|=u&l?128:0,i}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,s.normalizeZ)(M,u)}static msm(u,y){return(0,s.pippenger)(M,$,u,y)}_setWindowSize(u){this.precompute(u)}toRawBytes(){return this.toBytes()}}M.BASE=new M(K.Gx,K.Gy,l,O(K.Gx*K.Gy)),M.ZERO=new M(c,l,l,c),M.Fp=N,M.Fn=$;const V=new s.wNAF(M,$.BITS);return M.BASE.precompute(8),M}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,A){return this.init(this.ep.precompute(B,A))}toRawBytes(){return this.toBytes()}}edwards.PrimeEdwardsPoint=T;function x(w,B,A={}){if(typeof B!="function")throw new Error('"hash" function param is required');(0,e._validateObject)(A,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:N}=A,{BASE:$,Fp:K,Fn:U}=w,_=A.randomBytes||e.randomBytes,O=A.adjustScalarBytes||(m=>m),D=A.domain||((m,f,b)=>{if((0,e._abool2)(b,"phflag"),f.length||b)throw new Error("Contexts/pre-hash are not supported");return m});function F(m){return U.create((0,e.bytesToNumberLE)(m))}function P(m){const f=i.secretKey;m=(0,e.ensureBytes)("private key",m,f);const b=(0,e.ensureBytes)("hashed private key",B(m),2*f),ee=O(b.slice(0,f)),X=b.slice(f,2*f),k=F(ee);return{head:ee,prefix:X,scalar:k}}function j(m){const{head:f,prefix:b,scalar:ee}=P(m),X=$.multiply(ee),k=X.toBytes();return{head:f,prefix:b,scalar:ee,point:X,pointBytes:k}}function R(m){return j(m).pointBytes}function M(m=Uint8Array.of(),...f){const b=(0,e.concatBytes)(...f);return F(B(D(b,(0,e.ensureBytes)("context",m),!!N)))}function V(m,f,b={}){m=(0,e.ensureBytes)("message",m),N&&(m=N(m));const{prefix:ee,scalar:X,pointBytes:k}=j(f),Y=M(b.context,ee,m),z=$.multiply(Y).toBytes(),J=M(b.context,z,k,m),ne=U.create(Y+J*X);if(!U.isValid(ne))throw new Error("sign failed: invalid s");const G=(0,e.concatBytes)(z,U.toBytes(ne));return(0,e._abytes2)(G,i.signature,"result")}const H={zip215:!0};function u(m,f,b,ee=H){const{context:X,zip215:k}=ee,Y=i.signature;m=(0,e.ensureBytes)("signature",m,Y),f=(0,e.ensureBytes)("message",f),b=(0,e.ensureBytes)("publicKey",b,i.publicKey),k!==void 0&&(0,e._abool2)(k,"zip215"),N&&(f=N(f));const z=Y/2,J=m.subarray(0,z),ne=(0,e.bytesToNumberLE)(m.subarray(z,Y));let G,W,re;try{G=w.fromBytes(b,k),W=w.fromBytes(J,k),re=$.multiplyUnsafe(ne)}catch{return!1}if(!k&&G.isSmallOrder())return!1;const ue=M(X,W.toBytes(),G.toBytes(),f);return W.add(G.multiplyUnsafe(ue)).subtract(re).clearCofactor().is0()}const y=K.BYTES,i={secretKey:y,publicKey:y,signature:2*y,seed:y};function r(m=_(i.seed)){return(0,e._abytes2)(m,i.seed,"seed")}function p(m){const f=g.randomSecretKey(m);return{secretKey:f,publicKey:R(f)}}function d(m){return(0,e.isBytes)(m)&&m.length===U.BYTES}function t(m,f){try{return!!w.fromBytes(m,f)}catch{return!1}}const g={getExtendedPublicKey:j,randomSecretKey:r,isValidSecretKey:d,isValidPublicKey:t,toMontgomery(m){const{y:f}=w.fromBytes(m),b=i.publicKey,ee=b===32;if(!ee&&b!==57)throw new Error("only defined for 25519 and 448");const X=ee?K.div(l+f,l-f):K.div(f-l,f+l);return K.toBytes(X)},toMontgomerySecret(m){const f=i.secretKey;(0,e._abytes2)(m,f);const b=B(m.subarray(0,f));return O(b).subarray(0,f)},randomPrivateKey:r,precompute(m=8,f=w.BASE){return f.precompute(m,!1)}};return Object.freeze({keygen:p,getPublicKey:R,sign:V,verify:u,utils:g,Point:w,lengths:i})}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},A=w.Fp,N=(0,v.Field)(B.n,w.nBitLength,!0),$={Fp:A,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:$,hash:w.hash,eddsaOpts:K}}function S(w,B){const A=B.Point;return Object.assign({},B,{ExtendedPoint:A,CURVE:w,nBitLength:A.Fn.BITS,nByteLength:A.Fn.BYTES})}function L(w){const{CURVE:B,curveOpts:A,hash:N,eddsaOpts:$}=q(w),K=E(B,A),U=x(K,N,$);return S(w,U)}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=E,e.expand_message_xof=T,e.hash_to_field=x,e.isogenyMap=q,e.createHasher=S;const s=requireUtils$1(),v=requireModular(),c=s.bytesToNumberBE;function l(L,w){if(o(L),o(w),L<0||L>=1<<8*w)throw new Error("invalid I2OSP input: "+L);const B=Array.from({length:w}).fill(0);for(let A=w-1;A>=0;A--)B[A]=L&255,L>>>=8;return new Uint8Array(B)}function a(L,w){const B=new Uint8Array(L.length);for(let A=0;A<L.length;A++)B[A]=L[A]^w[A];return B}function o(L){if(!Number.isSafeInteger(L))throw new Error("number expected")}function h(L){if(!(0,s.isBytes)(L)&&typeof L!="string")throw new Error("DST must be Uint8Array or string");return typeof L=="string"?(0,s.utf8ToBytes)(L):L}function E(L,w,B,A){(0,s.abytes)(L),o(B),w=h(w),w.length>255&&(w=A((0,s.concatBytes)((0,s.utf8ToBytes)("H2C-OVERSIZE-DST-"),w)));const{outputLen:N,blockLen:$}=A,K=Math.ceil(B/N);if(B>65535||K>255)throw new Error("expand_message_xmd: invalid lenInBytes");const U=(0,s.concatBytes)(w,l(w.length,1)),_=l(0,$),O=l(B,2),D=new Array(K),F=A((0,s.concatBytes)(_,L,O,l(0,1),U));D[0]=A((0,s.concatBytes)(F,l(1,1),U));for(let j=1;j<=K;j++){const R=[a(F,D[j-1]),l(j+1,1),U];D[j]=A((0,s.concatBytes)(...R))}return(0,s.concatBytes)(...D).slice(0,B)}function T(L,w,B,A,N){if((0,s.abytes)(L),o(B),w=h(w),w.length>255){const $=Math.ceil(2*A/8);w=N.create({dkLen:$}).update((0,s.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(l(B,2)).update(w).update(l(w.length,1)).digest()}function x(L,w,B){(0,s._validateObject)(B,{p:"bigint",m:"number",k:"number",hash:"function"});const{p:A,k:N,m:$,hash:K,expand:U,DST:_}=B;if(!(0,s.isHash)(B.hash))throw new Error("expected valid hash");(0,s.abytes)(L),o(w);const O=A.toString(2).length,D=Math.ceil((O+N)/8),F=w*$*D;let P;if(U==="xmd")P=E(L,_,F,K);else if(U==="xof")P=T(L,_,F,N,K);else if(U==="_internal_pass")P=L;else throw new Error('expand must be "xmd" or "xof"');const j=new Array(w);for(let R=0;R<w;R++){const M=new Array($);for(let V=0;V<$;V++){const H=D*(V+R*$),u=P.subarray(H,H+D);M[V]=(0,v.mod)(c(u),A)}j[R]=M}return j}function q(L,w){const B=w.map(A=>Array.from(A).reverse());return(A,N)=>{const[$,K,U,_]=B.map(F=>F.reduce((P,j)=>L.add(L.mul(P,A),j))),[O,D]=(0,v.FpInvertBatch)(L,[K,_],!0);return A=L.mul($,O),N=L.mul(N,L.mul(U,D)),{x:A,y:N}}}e._DST_scalar=(0,s.utf8ToBytes)("HashToScalar-");function S(L,w,B){if(typeof w!="function")throw new Error("mapToCurve() must be defined");function A($){return L.fromAffine(w($))}function N($){const K=$.clearCofactor();return K.equals(L.ZERO)?L.ZERO:(K.assertValidity(),K)}return{defaults:B,hashToCurve($,K){const U=Object.assign({},B,K),_=x($,2,U),O=A(_[0]),D=A(_[1]);return N(O.add(D))},encodeToCurve($,K){const U=B.encodeDST?{DST:B.encodeDST}:{},_=Object.assign({},B,U,K),O=x($,1,_),D=A(O[0]);return N(D)},mapToCurve($){if(!Array.isArray($))throw new Error("expected array of bigints");for(const K of $)if(typeof K!="bigint")throw new Error("expected array of bigints");return N(A($))},hashToScalar($,K){const U=L.Fn.ORDER,_=Object.assign({},B,{p:U,m:1,DST:e._DST_scalar},K);return x($,1,_)[0][0]}}}})(hashToCurve)),hashToCurve}var montgomery={},hasRequiredMontgomery;function requireMontgomery(){if(hasRequiredMontgomery)return montgomery;hasRequiredMontgomery=1,Object.defineProperty(montgomery,"__esModule",{value:!0}),montgomery.montgomery=o;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireUtils$1(),s=requireModular(),v=BigInt(0),c=BigInt(1),l=BigInt(2);function a(h){return(0,e._validateObject)(h,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...h})}function o(h){const E=a(h),{P:T,type:x,adjustScalarBytes:q,powPminus2:S,randomBytes:L}=E,w=x==="x25519";if(!w&&x!=="x448")throw new Error("invalid type");const B=L||e.randomBytes,A=w?255:448,N=w?32:56,$=BigInt(w?9:5),K=BigInt(w?121665:39081),U=w?l**BigInt(254):l**BigInt(447),_=w?BigInt(8)*l**BigInt(251)-c:BigInt(4)*l**BigInt(445)-c,O=U+_+c,D=d=>(0,s.mod)(d,T),F=P($);function P(d){return(0,e.numberToBytesLE)(D(d),N)}function j(d){const t=(0,e.ensureBytes)("u coordinate",d,N);return w&&(t[31]&=127),D((0,e.bytesToNumberLE)(t))}function R(d){return(0,e.bytesToNumberLE)(q((0,e.ensureBytes)("scalar",d,N)))}function M(d,t){const g=u(j(t),R(d));if(g===v)throw new Error("invalid private or public key received");return P(g)}function V(d){return M(d,F)}function H(d,t,g){const m=D(d*(t-g));return t=D(t-m),g=D(g+m),{x_2:t,x_3:g}}function u(d,t){(0,e.aInRange)("u",d,v,T),(0,e.aInRange)("scalar",t,U,O);const g=t,m=d;let f=c,b=v,ee=d,X=c,k=v;for(let z=BigInt(A-1);z>=v;z--){const J=g>>z&c;k^=J,{x_2:f,x_3:ee}=H(k,f,ee),{x_2:b,x_3:X}=H(k,b,X),k=J;const ne=f+b,G=D(ne*ne),W=f-b,re=D(W*W),ue=G-re,de=ee+X,se=ee-X,pe=D(se*ne),Q=D(de*W),ve=pe+Q,Ee=pe-Q;ee=D(ve*ve),X=D(m*D(Ee*Ee)),f=D(G*re),b=D(ue*(G+D(K*ue)))}({x_2:f,x_3:ee}=H(k,f,ee)),{x_2:b,x_3:X}=H(k,b,X);const Y=S(b);return D(f*Y)}const y={secretKey:N,publicKey:N,seed:N},i=(d=B(N))=>((0,e.abytes)(d,y.seed),d);function r(d){const t=i(d);return{secretKey:t,publicKey:V(t)}}return{keygen:r,getSharedSecret:(d,t)=>M(d,t),getPublicKey:d=>V(d),scalarMult:M,scalarMultBase:V,utils:{randomSecretKey:i,randomPrivateKey:i},GuBytes:F.slice(),lengths:y}}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=X;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const s=requireSha2(),v=requireUtils$2(),c=requireCurve(),l=requireEdwards(),a=requireHashToCurve(),o=requireModular(),h=requireMontgomery(),E=requireUtils$1(),T=BigInt(0),x=BigInt(1),q=BigInt(2),S=BigInt(3),L=BigInt(5),w=BigInt(8),B=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),A={p:B,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:w,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function N(k){const Y=BigInt(10),z=BigInt(20),J=BigInt(40),ne=BigInt(80),G=B,re=k*k%G*k%G,ue=(0,o.pow2)(re,q,G)*re%G,de=(0,o.pow2)(ue,x,G)*k%G,se=(0,o.pow2)(de,L,G)*de%G,pe=(0,o.pow2)(se,Y,G)*se%G,Q=(0,o.pow2)(pe,z,G)*pe%G,ve=(0,o.pow2)(Q,J,G)*Q%G,Ee=(0,o.pow2)(ve,ne,G)*ve%G,he=(0,o.pow2)(Ee,ne,G)*ve%G,te=(0,o.pow2)(he,Y,G)*se%G;return{pow_p_5_8:(0,o.pow2)(te,q,G)*k%G,b2:re}}function $(k){return k[0]&=248,k[31]&=127,k[31]|=64,k}const K=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function U(k,Y){const z=B,J=(0,o.mod)(Y*Y*Y,z),ne=(0,o.mod)(J*J*Y,z),G=N(k*ne).pow_p_5_8;let W=(0,o.mod)(k*J*G,z);const re=(0,o.mod)(Y*W*W,z),ue=W,de=(0,o.mod)(W*K,z),se=re===k,pe=re===(0,o.mod)(-k,z),Q=re===(0,o.mod)(-k*K,z);return se&&(W=ue),(pe||Q)&&(W=de),(0,o.isNegativeLE)(W,z)&&(W=(0,o.mod)(-W,z)),{isValid:se||pe,value:W}}const _=(0,o.Field)(A.p,{isLE:!0}),O=(0,o.Field)(A.n,{isLE:!0}),D={...A,Fp:_,hash:s.sha512,adjustScalarBytes:$,uvRatio:U};e.ed25519=(0,l.twistedEdwards)(D);function F(k,Y,z){if(Y.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,Y.length]),Y,k)}e.ed25519ctx=(0,l.twistedEdwards)({...D,domain:F}),e.ed25519ph=(0,l.twistedEdwards)(Object.assign({},D,{domain:F,prehash:s.sha512})),e.x25519=(()=>{const k=_.ORDER;return(0,h.montgomery)({P:k,type:"x25519",powPminus2:Y=>{const{pow_p_5_8:z,b2:J}=N(Y);return(0,o.mod)((0,o.pow2)(z,S,k)*J,k)},adjustScalarBytes:$})})();const P=(B+S)/w,j=_.pow(q,P),R=_.sqrt(_.neg(_.ONE));function M(k){const Y=(B-L)/w,z=BigInt(486662);let J=_.sqr(k);J=_.mul(J,q);let ne=_.add(J,_.ONE),G=_.neg(z),W=_.sqr(ne),re=_.mul(W,ne),ue=_.mul(J,z);ue=_.mul(ue,G),ue=_.add(ue,W),ue=_.mul(ue,G);let de=_.sqr(re);W=_.sqr(de),de=_.mul(de,re),de=_.mul(de,ue),W=_.mul(W,de);let se=_.pow(W,Y);se=_.mul(se,de);let pe=_.mul(se,R);W=_.sqr(se),W=_.mul(W,re);let Q=_.eql(W,ue),ve=_.cmov(pe,se,Q),Ee=_.mul(G,J),he=_.mul(se,k);he=_.mul(he,j);let te=_.mul(he,R),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,G,ye),ge=_.cmov(fe,ve,ye),me=_.isOdd(ge);return ge=_.cmov(ge,_.neg(ge),ye!==me),{xMn:be,xMd:ne,yMn:ge,yMd:x}}const V=(0,o.FpSqrtEven)(_,_.neg(BigInt(486664)));function H(k){const{xMn:Y,xMd:z,yMn:J,yMd:ne}=M(k);let G=_.mul(Y,ne);G=_.mul(G,V);let W=_.mul(z,J),re=_.sub(Y,z),ue=_.add(Y,z),de=_.mul(W,ue),se=_.eql(de,_.ZERO);G=_.cmov(G,_.ZERO,se),W=_.cmov(W,_.ONE,se),re=_.cmov(re,_.ONE,se),ue=_.cmov(ue,_.ONE,se);const[pe,Q]=(0,o.FpInvertBatch)(_,[W,ue],!0);return{x:_.mul(G,pe),y:_.mul(re,Q)}}e.ed25519_hasher=(0,a.createHasher)(e.ed25519.Point,k=>H(k[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:B,m:1,k:128,expand:"xmd",hash:s.sha512});const u=K,y=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),i=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),r=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),p=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),d=k=>U(x,k),t=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),g=k=>e.ed25519.Point.Fp.create((0,E.bytesToNumberLE)(k)&t);function m(k){const{d:Y}=A,z=B,J=ie=>_.create(ie),ne=J(u*k*k),G=J((ne+x)*r);let W=BigInt(-1);const re=J((W-Y*ne)*J(ne+Y));let{isValid:ue,value:de}=U(G,re),se=J(de*k);(0,o.isNegativeLE)(se,z)||(se=J(-se)),ue||(de=se),ue||(W=ne);const pe=J(W*(ne-x)*p-re),Q=de*de,ve=J((de+de)*re),Ee=J(pe*y),he=J(x-Q),te=J(x+Q);return new e.ed25519.Point(J(ve*te),J(he*Ee),J(Ee*te),J(ve*he))}function f(k){(0,v.abytes)(k,64);const Y=g(k.subarray(0,32)),z=m(Y),J=g(k.subarray(32,64)),ne=m(J);return new b(z.add(ne))}class b extends l.PrimeEdwardsPoint{constructor(Y){super(Y)}static fromAffine(Y){return new b(e.ed25519.Point.fromAffine(Y))}assertSame(Y){if(!(Y instanceof b))throw new Error("RistrettoPoint expected")}init(Y){return new b(Y)}static hashToCurve(Y){return f((0,E.ensureBytes)("ristrettoHash",Y,64))}static fromBytes(Y){(0,v.abytes)(Y,32);const{a:z,d:J}=A,ne=B,G=ye=>_.create(ye),W=g(Y);if(!(0,E.equalBytes)(_.toBytes(W),Y)||(0,o.isNegativeLE)(W,ne))throw new Error("invalid ristretto255 encoding 1");const re=G(W*W),ue=G(x+z*re),de=G(x-z*re),se=G(ue*ue),pe=G(de*de),Q=G(z*J*se-pe),{isValid:ve,value:Ee}=d(G(Q*pe)),he=G(Ee*de),te=G(Ee*he*Q);let ie=G((W+W)*he);(0,o.isNegativeLE)(ie,ne)&&(ie=G(-ie));const oe=G(ue*te),fe=G(ie*oe);if(!ve||(0,o.isNegativeLE)(fe,ne)||oe===T)throw new Error("invalid ristretto255 encoding 2");return new b(new e.ed25519.Point(ie,oe,x,fe))}static fromHex(Y){return b.fromBytes((0,E.ensureBytes)("ristrettoHex",Y,32))}static msm(Y,z){return(0,c.pippenger)(b,e.ed25519.Point.Fn,Y,z)}toBytes(){let{X:Y,Y:z,Z:J,T:ne}=this.ep;const G=B,W=te=>_.create(te),re=W(W(J+z)*W(J-z)),ue=W(Y*z),de=W(ue*ue),{value:se}=d(W(re*de)),pe=W(se*re),Q=W(se*ue),ve=W(pe*Q*ne);let Ee;if((0,o.isNegativeLE)(ne*ve,G)){let te=W(z*u),ie=W(Y*u);Y=te,z=ie,Ee=W(pe*i)}else Ee=Q;(0,o.isNegativeLE)(Y*ve,G)&&(z=W(-z));let he=W((J-z)*Ee);return(0,o.isNegativeLE)(he,G)&&(he=W(-he)),_.toBytes(he)}equals(Y){this.assertSame(Y);const{X:z,Y:J}=this.ep,{X:ne,Y:G}=Y.ep,W=de=>_.create(de),re=W(z*G)===W(J*ne),ue=W(J*G)===W(z*ne);return re||ue}is0(){return this.equals(b.ZERO)}}b.BASE=new b(e.ed25519.Point.BASE),b.ZERO=new b(e.ed25519.Point.ZERO),b.Fp=_,b.Fn=O,e.ristretto255={Point:b},e.ristretto255_hasher={hashToCurve(k,Y){const z=Y?.DST||"ristretto255_XMD:SHA-512_R255MAP_RO_",J=(0,a.expand_message_xmd)(k,z,64,s.sha512);return f(J)},hashToScalar(k,Y={DST:a._DST_scalar}){const z=(0,a.expand_message_xmd)(k,Y.DST,64,s.sha512);return O.create((0,E.bytesToNumberLE)(z))}},e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];function ee(k){return e.ed25519.utils.toMontgomery((0,E.ensureBytes)("pub",k))}e.edwardsToMontgomery=ee;function X(k){return e.ed25519.utils.toMontgomerySecret((0,E.ensureBytes)("pub",k))}e.RistrettoPoint=b,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 s=requireUtils$2();class v extends s.Hash{constructor(a,o){super(),this.finished=!1,this.destroyed=!1,(0,s.ahash)(a);const h=(0,s.toBytes)(o);if(this.iHash=a.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 E=this.blockLen,T=new Uint8Array(E);T.set(h.length>E?a.create().update(h).digest():h);for(let x=0;x<T.length;x++)T[x]^=54;this.iHash.update(T),this.oHash=a.create();for(let x=0;x<T.length;x++)T[x]^=106;this.oHash.update(T),(0,s.clean)(T)}update(a){return(0,s.aexists)(this),this.iHash.update(a),this}digestInto(a){(0,s.aexists)(this),(0,s.abytes)(a,this.outputLen),this.finished=!0,this.iHash.digestInto(a),this.oHash.update(a),this.oHash.digestInto(a),this.destroy()}digest(){const a=new Uint8Array(this.oHash.outputLen);return this.digestInto(a),a}_cloneInto(a){a||(a=Object.create(Object.getPrototypeOf(this),{}));const{oHash:o,iHash:h,finished:E,destroyed:T,blockLen:x,outputLen:q}=this;return a=a,a.finished=E,a.destroyed=T,a.blockLen=x,a.outputLen=q,a.oHash=o._cloneInto(a.oHash),a.iHash=h._cloneInto(a.iHash),a}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=v;const c=(l,a,o)=>new v(l,a).update(o).digest();e.hmac=c,e.hmac.create=(l,a)=>new v(l,a)})(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=h,e._normFnElement=A,e.weierstrassN=N,e.SWUFpSqrtRatio=K,e.mapToCurveSimpleSWU=U,e.ecdh=O,e.ecdsa=D,e.weierstrassPoints=F,e._legacyHelperEquat=R,e.weierstrass=H;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const s=requireHmac(),v=requireUtils$2(),c=requireUtils$1(),l=requireCurve(),a=requireModular(),o=(u,y)=>(u+(u>=0?y:-y)/L)/y;function h(u,y,i){const[[r,p],[d,t]]=y,g=o(t*u,i),m=o(-p*u,i);let f=u-g*r-m*d,b=-g*p-m*t;const ee=f<q,X=b<q;ee&&(f=-f),X&&(b=-b);const k=(0,c.bitMask)(Math.ceil((0,c.bitLen)(i)/2))+S;if(f<q||f>=k||b<q||b>=k)throw new Error("splitScalar (endomorphism): failed, k="+u);return{k1neg:ee,k1:f,k2neg:X,k2:b}}function E(u){if(!["compact","recovered","der"].includes(u))throw new Error('Signature format must be "compact", "recovered", or "der"');return u}function T(u,y){const i={};for(let r of Object.keys(y))i[r]=u[r]===void 0?y[r]:u[r];return(0,c._abool2)(i.lowS,"lowS"),(0,c._abool2)(i.prehash,"prehash"),i.format!==void 0&&E(i.format),i}class x extends Error{constructor(y=""){super(y)}}e.DERErr=x,e.DER={Err:x,_tlv:{encode:(u,y)=>{const{Err:i}=e.DER;if(u<0||u>256)throw new i("tlv.encode: wrong tag");if(y.length&1)throw new i("tlv.encode: unpadded data");const r=y.length/2,p=(0,c.numberToHexUnpadded)(r);if(p.length/2&128)throw new i("tlv.encode: long form length too big");const d=r>127?(0,c.numberToHexUnpadded)(p.length/2|128):"";return(0,c.numberToHexUnpadded)(u)+d+p+y},decode(u,y){const{Err:i}=e.DER;let r=0;if(u<0||u>256)throw new i("tlv.encode: wrong tag");if(y.length<2||y[r++]!==u)throw new i("tlv.decode: wrong tlv");const p=y[r++],d=!!(p&128);let t=0;if(!d)t=p;else{const m=p&127;if(!m)throw new i("tlv.decode(long): indefinite length not supported");if(m>4)throw new i("tlv.decode(long): byte length is too big");const f=y.subarray(r,r+m);if(f.length!==m)throw new i("tlv.decode: length bytes not complete");if(f[0]===0)throw new i("tlv.decode(long): zero leftmost byte");for(const b of f)t=t<<8|b;if(r+=m,t<128)throw new i("tlv.decode(long): not minimal encoding")}const g=y.subarray(r,r+t);if(g.length!==t)throw new i("tlv.decode: wrong value length");return{v:g,l:y.subarray(r+t)}}},_int:{encode(u){const{Err:y}=e.DER;if(u<q)throw new y("integer: negative integers are not allowed");let i=(0,c.numberToHexUnpadded)(u);if(Number.parseInt(i[0],16)&8&&(i="00"+i),i.length&1)throw new y("unexpected DER parsing assertion: unpadded hex");return i},decode(u){const{Err:y}=e.DER;if(u[0]&128)throw new y("invalid signature integer: negative");if(u[0]===0&&!(u[1]&128))throw new y("invalid signature integer: unnecessary leading zero");return(0,c.bytesToNumberBE)(u)}},toSig(u){const{Err:y,_int:i,_tlv:r}=e.DER,p=(0,c.ensureBytes)("signature",u),{v:d,l:t}=r.decode(48,p);if(t.length)throw new y("invalid signature: left bytes after parsing");const{v:g,l:m}=r.decode(2,d),{v:f,l:b}=r.decode(2,m);if(b.length)throw new y("invalid signature: left bytes after parsing");return{r:i.decode(g),s:i.decode(f)}},hexFromSig(u){const{_tlv:y,_int:i}=e.DER,r=y.encode(2,i.encode(u.r)),p=y.encode(2,i.encode(u.s)),d=r+p;return y.encode(48,d)}};const q=BigInt(0),S=BigInt(1),L=BigInt(2),w=BigInt(3),B=BigInt(4);function A(u,y){const{BYTES:i}=u;let r;if(typeof y=="bigint")r=y;else{let p=(0,c.ensureBytes)("private key",y);try{r=u.fromBytes(p)}catch{throw new Error(`invalid private key: expected ui8a of size ${i}, got ${typeof y}`)}}if(!u.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function N(u,y={}){const i=(0,l._createCurveFields)("weierstrass",u,y),{Fp:r,Fn:p}=i;let d=i.CURVE;const{h:t,n:g}=d;(0,c._validateObject)(y,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:m}=y;if(m&&(!r.is0(d.a)||typeof m.beta!="bigint"||!Array.isArray(m.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const f=_(r,p);function b(){if(!r.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=r.toBytes(oe);if((0,c._abool2)(ie,"isCompressed"),ie){b();const be=!r.isOdd(fe);return(0,c.concatBytes)($(be),ye)}else return(0,c.concatBytes)(Uint8Array.of(4),ye,r.toBytes(fe))}function X(he){(0,c._abytes2)(he,void 0,"Point");const{publicKey:te,publicKeyUncompressed:ie}=f,oe=he.length,fe=he[0],ye=he.subarray(1);if(oe===te&&(fe===2||fe===3)){const be=r.fromBytes(ye);if(!r.isValid(be))throw new Error("bad point: is not on curve, wrong x");const ge=z(be);let me;try{me=r.sqrt(ge)}catch(ce){const ae=ce instanceof Error?": "+ce.message:"";throw new Error("bad point: is not on curve, sqrt error"+ae)}b();const C=r.isOdd(me);return(fe&1)===1!==C&&(me=r.neg(me)),{x:be,y:me}}else if(oe===ie&&fe===4){const be=r.BYTES,ge=r.fromBytes(ye.subarray(0,be)),me=r.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 k=y.toBytes||ee,Y=y.fromBytes||X;function z(he){const te=r.sqr(he),ie=r.mul(te,he);return r.add(r.add(ie,r.mul(he,d.a)),d.b)}function J(he,te){const ie=r.sqr(te),oe=z(he);return r.eql(ie,oe)}if(!J(d.Gx,d.Gy))throw new Error("bad curve params: generator point");const ne=r.mul(r.pow(d.a,w),B),G=r.mul(r.sqr(d.b),BigInt(27));if(r.is0(r.add(ne,G)))throw new Error("bad curve params: a or b");function W(he,te,ie=!1){if(!r.isValid(te)||ie&&r.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(!m||!m.basises)throw new Error("no endo");return h(he,m.basises,p.ORDER)}const de=(0,c.memoized)((he,te)=>{const{X:ie,Y:oe,Z:fe}=he;if(r.eql(fe,r.ONE))return{x:ie,y:oe};const ye=he.is0();te==null&&(te=ye?r.ONE:r.inv(fe));const be=r.mul(ie,te),ge=r.mul(oe,te),me=r.mul(fe,te);if(ye)return{x:r.ZERO,y:r.ZERO};if(!r.eql(me,r.ONE))throw new Error("invZ was invalid");return{x:be,y:ge}}),se=(0,c.memoized)(he=>{if(he.is0()){if(y.allowInfinityPoint&&!r.is0(he.Y))return;throw new Error("bad point: ZERO")}const{x:te,y:ie}=he.toAffine();if(!r.isValid(te)||!r.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(r.mul(ie.X,he),ie.Y,ie.Z),te=(0,l.negateCt)(oe,te),ie=(0,l.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 d}static fromAffine(te){const{x:ie,y:oe}=te||{};if(!te||!r.isValid(ie)||!r.isValid(oe))throw new Error("invalid affine point");if(te instanceof Q)throw new Error("projective point not allowed");return r.is0(ie)&&r.is0(oe)?Q.ZERO:new Q(ie,oe,r.ONE)}static fromBytes(te){const ie=Q.fromAffine(Y((0,c._abytes2)(te,void 0,"point")));return ie.assertValidity(),ie}static fromHex(te){return Q.fromBytes((0,c.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(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(te)}equals(te){re(te);const{X:ie,Y:oe,Z:fe}=this,{X:ye,Y:be,Z:ge}=te,me=r.eql(r.mul(ie,ge),r.mul(ye,fe)),C=r.eql(r.mul(oe,ge),r.mul(be,fe));return me&&C}negate(){return new Q(this.X,r.neg(this.Y),this.Z)}double(){const{a:te,b:ie}=d,oe=r.mul(ie,w),{X:fe,Y:ye,Z:be}=this;let ge=r.ZERO,me=r.ZERO,C=r.ZERO,Z=r.mul(fe,fe),ce=r.mul(ye,ye),ae=r.mul(be,be),le=r.mul(fe,ye);return le=r.add(le,le),C=r.mul(fe,be),C=r.add(C,C),ge=r.mul(te,C),me=r.mul(oe,ae),me=r.add(ge,me),ge=r.sub(ce,me),me=r.add(ce,me),me=r.mul(ge,me),ge=r.mul(le,ge),C=r.mul(oe,C),ae=r.mul(te,ae),le=r.sub(Z,ae),le=r.mul(te,le),le=r.add(le,C),C=r.add(Z,Z),Z=r.add(C,Z),Z=r.add(Z,ae),Z=r.mul(Z,le),me=r.add(me,Z),ae=r.mul(ye,be),ae=r.add(ae,ae),Z=r.mul(ae,le),ge=r.sub(ge,Z),C=r.mul(ae,ce),C=r.add(C,C),C=r.add(C,C),new Q(ge,me,C)}add(te){re(te);const{X:ie,Y:oe,Z:fe}=this,{X:ye,Y:be,Z:ge}=te;let me=r.ZERO,C=r.ZERO,Z=r.ZERO;const ce=d.a,ae=r.mul(d.b,w);let le=r.mul(ie,ye),_e=r.mul(oe,be),we=r.mul(fe,ge),Se=r.add(ie,oe),Ae=r.add(ye,be);Se=r.mul(Se,Ae),Ae=r.add(le,_e),Se=r.sub(Se,Ae),Ae=r.add(ie,fe);let xe=r.add(ye,ge);return Ae=r.mul(Ae,xe),xe=r.add(le,we),Ae=r.sub(Ae,xe),xe=r.add(oe,fe),me=r.add(be,ge),xe=r.mul(xe,me),me=r.add(_e,we),xe=r.sub(xe,me),Z=r.mul(ce,Ae),me=r.mul(ae,we),Z=r.add(me,Z),me=r.sub(_e,Z),Z=r.add(_e,Z),C=r.mul(me,Z),_e=r.add(le,le),_e=r.add(_e,le),we=r.mul(ce,we),Ae=r.mul(ae,Ae),_e=r.add(_e,we),we=r.sub(le,we),we=r.mul(ce,we),Ae=r.add(Ae,we),le=r.mul(_e,Ae),C=r.add(C,le),le=r.mul(xe,Ae),me=r.mul(Se,me),me=r.sub(me,le),le=r.mul(Se,_e),Z=r.mul(xe,Z),Z=r.add(Z,le),new Q(me,C,Z)}subtract(te){return this.add(te.negate())}is0(){return this.equals(Q.ZERO)}multiply(te){const{endo:ie}=y;if(!p.isValidNot0(te))throw new Error("invalid scalar: out of range");let oe,fe;const ye=be=>Ee.cached(this,be,ge=>(0,l.normalizeZ)(Q,ge));if(ie){const{k1neg:be,k1:ge,k2neg:me,k2:C}=ue(te),{p:Z,f:ce}=ye(ge),{p:ae,f:le}=ye(C);fe=ce.add(le),oe=pe(ie.beta,Z,ae,be,me)}else{const{p:be,f:ge}=ye(te);oe=be,fe=ge}return(0,l.normalizeZ)(Q,[oe,fe])[0]}multiplyUnsafe(te){const{endo:ie}=y,oe=this;if(!p.isValid(te))throw new Error("invalid scalar: out of range");if(te===q||oe.is0())return Q.ZERO;if(te===S)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:C}=(0,l.mulEndoUnsafe)(Q,oe,ye,ge);return pe(ie.beta,me,C,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}=y;return t===S?!0:te?te(Q,this):Ee.unsafe(this,g).is0()}clearCofactor(){const{clearCofactor:te}=y;return t===S?this:te?te(Q,this):this.multiplyUnsafe(t)}isSmallOrder(){return this.multiplyUnsafe(t).is0()}toBytes(te=!0){return(0,c._abool2)(te,"isCompressed"),this.assertValidity(),k(Q,this,te)}toHex(te=!0){return(0,c.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,l.normalizeZ)(Q,te)}static msm(te,ie){return(0,l.pippenger)(Q,p,te,ie)}static fromPrivateKey(te){return Q.BASE.multiply(A(p,te))}}Q.BASE=new Q(d.Gx,d.Gy,r.ONE),Q.ZERO=new Q(r.ZERO,r.ONE,r.ZERO),Q.Fp=r,Q.Fn=p;const ve=p.BITS,Ee=new l.wNAF(Q,y.endo?Math.ceil(ve/2):ve);return Q.BASE.precompute(8),Q}function $(u){return Uint8Array.of(u?2:3)}function K(u,y){const i=u.ORDER;let r=q;for(let Y=i-S;Y%L===q;Y/=L)r+=S;const p=r,d=L<<p-S-S,t=d*L,g=(i-S)/t,m=(g-S)/L,f=t-S,b=d,ee=u.pow(y,g),X=u.pow(y,(g+S)/L);let k=(Y,z)=>{let J=ee,ne=u.pow(z,f),G=u.sqr(ne);G=u.mul(G,z);let W=u.mul(Y,G);W=u.pow(W,m),W=u.mul(W,ne),ne=u.mul(W,z),G=u.mul(W,Y);let re=u.mul(G,ne);W=u.pow(re,b);let ue=u.eql(W,u.ONE);ne=u.mul(G,X),W=u.mul(re,J),G=u.cmov(ne,G,ue),re=u.cmov(W,re,ue);for(let de=p;de>S;de--){let se=de-L;se=L<<se-S;let pe=u.pow(re,se);const Q=u.eql(pe,u.ONE);ne=u.mul(G,J),J=u.mul(J,J),pe=u.mul(re,J),G=u.cmov(ne,G,Q),re=u.cmov(pe,re,Q)}return{isValid:ue,value:G}};if(u.ORDER%B===w){const Y=(u.ORDER-w)/B,z=u.sqrt(u.neg(y));k=(J,ne)=>{let G=u.sqr(ne);const W=u.mul(J,ne);G=u.mul(G,W);let re=u.pow(G,Y);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 k}function U(u,y){(0,a.validateField)(u);const{A:i,B:r,Z:p}=y;if(!u.isValid(i)||!u.isValid(r)||!u.isValid(p))throw new Error("mapToCurveSimpleSWU: invalid opts");const d=K(u,p);if(!u.isOdd)throw new Error("Field does not have .isOdd()");return t=>{let g,m,f,b,ee,X,k,Y;g=u.sqr(t),g=u.mul(g,p),m=u.sqr(g),m=u.add(m,g),f=u.add(m,u.ONE),f=u.mul(f,r),b=u.cmov(p,u.neg(m),!u.eql(m,u.ZERO)),b=u.mul(b,i),m=u.sqr(f),X=u.sqr(b),ee=u.mul(X,i),m=u.add(m,ee),m=u.mul(m,f),X=u.mul(X,b),ee=u.mul(X,r),m=u.add(m,ee),k=u.mul(g,f);const{isValid:z,value:J}=d(m,X);Y=u.mul(g,t),Y=u.mul(Y,J),k=u.cmov(k,f,z),Y=u.cmov(Y,J,z);const ne=u.isOdd(t)===u.isOdd(Y);Y=u.cmov(u.neg(Y),Y,ne);const G=(0,a.FpInvertBatch)(u,[b],!0)[0];return k=u.mul(k,G),{x:k,y:Y}}}function _(u,y){return{secretKey:y.BYTES,publicKey:1+u.BYTES,publicKeyUncompressed:1+2*u.BYTES,publicKeyHasPrefix:!0,signature:2*y.BYTES}}function O(u,y={}){const{Fn:i}=u,r=y.randomBytes||c.randomBytes,p=Object.assign(_(u.Fp,i),{seed:(0,a.getMinHashLength)(i.ORDER)});function d(k){try{return!!A(i,k)}catch{return!1}}function t(k,Y){const{publicKey:z,publicKeyUncompressed:J}=p;try{const ne=k.length;return Y===!0&&ne!==z||Y===!1&&ne!==J?!1:!!u.fromBytes(k)}catch{return!1}}function g(k=r(p.seed)){return(0,a.mapHashToField)((0,c._abytes2)(k,p.seed,"seed"),i.ORDER)}function m(k,Y=!0){return u.BASE.multiply(A(i,k)).toBytes(Y)}function f(k){const Y=g(k);return{secretKey:Y,publicKey:m(Y)}}function b(k){if(typeof k=="bigint")return!1;if(k instanceof u)return!0;const{secretKey:Y,publicKey:z,publicKeyUncompressed:J}=p;if(i.allowedLengths||Y===z)return;const ne=(0,c.ensureBytes)("key",k).length;return ne===z||ne===J}function ee(k,Y,z=!0){if(b(k)===!0)throw new Error("first arg must be private key");if(b(Y)===!1)throw new Error("second arg must be public key");const J=A(i,k);return u.fromHex(Y).multiply(J).toBytes(z)}return Object.freeze({getPublicKey:m,getSharedSecret:ee,keygen:f,Point:u,utils:{isValidSecretKey:d,isValidPublicKey:t,randomSecretKey:g,isValidPrivateKey:d,randomPrivateKey:g,normPrivateKeyToScalar:k=>A(i,k),precompute(k=8,Y=u.BASE){return Y.precompute(k,!1)}},lengths:p})}function D(u,y,i={}){(0,v.ahash)(y),(0,c._validateObject)(i,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=i.randomBytes||c.randomBytes,p=i.hmac||((ie,...oe)=>(0,s.hmac)(y,ie,(0,c.concatBytes)(...oe))),{Fp:d,Fn:t}=u,{ORDER:g,BITS:m}=t,{keygen:f,getPublicKey:b,getSharedSecret:ee,utils:X,lengths:k}=O(u,i),Y={prehash:!1,lowS:typeof i.lowS=="boolean"?i.lowS:!1,format:void 0,extraEntropy:!1},z="compact";function J(ie){const oe=g>>S;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 G(ie,oe){E(oe);const fe=k.signature,ye=oe==="compact"?fe:oe==="recovered"?fe+1:void 0;return(0,c._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){G(oe,fe);let ye;if(fe==="der"){const{r:C,s:Z}=e.DER.toSig((0,c._abytes2)(oe));return new W(C,Z)}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,c.hexToBytes)(oe),fe)}addRecoveryBit(oe){return new W(this.r,this.s,oe)}recoverPublicKey(oe){const fe=d.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 C=ge===2||ge===3?ye+g:ye;if(!d.isValid(C))throw new Error("recovery id 2 or 3 invalid");const Z=d.toBytes(C),ce=u.fromBytes((0,c.concatBytes)($((ge&1)===0),Z)),ae=t.inv(C),le=ue((0,c.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(E(oe),oe==="der")return(0,c.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,c.concatBytes)(Uint8Array.of(this.recovery),fe,ye)}return(0,c.concatBytes)(fe,ye)}toHex(oe){return(0,c.bytesToHex)(this.toBytes(oe))}assertValidity(){}static fromCompact(oe){return W.fromBytes((0,c.ensureBytes)("sig",oe),"compact")}static fromDER(oe){return W.fromBytes((0,c.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,c.bytesToHex)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,c.bytesToHex)(this.toBytes("compact"))}}const re=i.bits2int||function(oe){if(oe.length>8192)throw new Error("input is too large");const fe=(0,c.bytesToNumberBE)(oe),ye=oe.length*8-m;return ye>0?fe>>BigInt(ye):fe},ue=i.bits2int_modN||function(oe){return t.create(re(oe))},de=(0,c.bitMask)(m);function se(ie){return(0,c.aInRange)("num < 2^"+m,ie,q,de),t.toBytes(ie)}function pe(ie,oe){return(0,c._abytes2)(ie,void 0,"message"),oe?(0,c._abytes2)(y(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,Y);ie=pe(ie,be);const me=ue(ie),C=A(t,oe),Z=[se(C),se(me)];if(ge!=null&&ge!==!1){const _e=ge===!0?r(k.secretKey):ge;Z.push((0,c.ensureBytes)("extraEntropy",_e))}const ce=(0,c.concatBytes)(...Z),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*C));if(Oe===q)return;let Te=(Ae.x===xe?0:2)|Number(Ae.y&S),Ne=Oe;return ye&&J(Oe)&&(Ne=t.neg(Oe),Te^=1),new W(xe,Ne,Te)}return{seed:ce,k2sig:le}}function ve(ie,oe,fe={}){ie=(0,c.ensureBytes)("message",ie);const{seed:ye,k2sig:be}=Q(ie,oe,fe);return(0,c.createHmacDrbg)(y.outputLen,t.BYTES,p)(ye,be)}function Ee(ie){let oe;const fe=typeof ie=="string"||(0,c.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,c.ensureBytes)("sig",ie),"der")}catch(be){if(!(be instanceof e.DER.Err))throw be}if(!oe)try{oe=W.fromBytes((0,c.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,Y);if(fe=(0,c.ensureBytes)("publicKey",fe),oe=pe((0,c.ensureBytes)("message",oe),ge),"strict"in ye)throw new Error("options.strict was renamed to lowS");const C=me===void 0?Ee(ie):W.fromBytes((0,c.ensureBytes)("sig",ie),me);if(C===!1)return!1;try{const Z=u.fromBytes(fe);if(be&&C.hasHighS())return!1;const{r:ce,s:ae}=C,le=ue(oe),_e=t.inv(ae),we=t.create(le*_e),Se=t.create(ce*_e),Ae=u.BASE.multiplyUnsafe(we).add(Z.multiplyUnsafe(Se));return Ae.is0()?!1:t.create(Ae.x)===ce}catch{return!1}}function te(ie,oe,fe={}){const{prehash:ye}=T(fe,Y);return oe=pe(oe,ye),W.fromBytes(ie,"recovered").recoverPublicKey(oe).toBytes()}return Object.freeze({keygen:f,getPublicKey:b,getSharedSecret:ee,utils:X,lengths:k,Point:u,sign:ve,verify:he,recoverPublicKey:te,Signature:W,hash:y})}function F(u){const{CURVE:y,curveOpts:i}=P(u),r=N(y,i);return M(u,r)}function P(u){const y={a:u.a,b:u.b,p:u.Fp.ORDER,n:u.n,h:u.h,Gx:u.Gx,Gy:u.Gy},i=u.Fp;let r=u.allowedPrivateKeyLengths?Array.from(new Set(u.allowedPrivateKeyLengths.map(t=>Math.ceil(t/2)))):void 0;const p=(0,a.Field)(y.n,{BITS:u.nBitLength,allowedLengths:r,modFromBytes:u.wrapPrivateKey}),d={Fp:i,Fn:p,allowInfinityPoint:u.allowInfinityPoint,endo:u.endo,isTorsionFree:u.isTorsionFree,clearCofactor:u.clearCofactor,fromBytes:u.fromBytes,toBytes:u.toBytes};return{CURVE:y,curveOpts:d}}function j(u){const{CURVE:y,curveOpts:i}=P(u),r={hmac:u.hmac,randomBytes:u.randomBytes,lowS:u.lowS,bits2int:u.bits2int,bits2int_modN:u.bits2int_modN};return{CURVE:y,curveOpts:i,hash:u.hash,ecdsaOpts:r}}function R(u,y,i){function r(p){const d=u.sqr(p),t=u.mul(d,p);return u.add(u.add(t,u.mul(p,y)),i)}return r}function M(u,y){const{Fp:i,Fn:r}=y;function p(t){return(0,c.inRange)(t,S,r.ORDER)}const d=R(i,u.a,u.b);return Object.assign({},{CURVE:u,Point:y,ProjectivePoint:y,normPrivateKeyToScalar:t=>A(r,t),weierstrassEquation:d,isWithinCurveOrder:p})}function V(u,y){const i=y.Point;return Object.assign({},y,{ProjectivePoint:i,CURVE:Object.assign({},u,(0,a.nLength)(i.Fn.ORDER,i.Fn.BITS))})}function H(u){const{CURVE:y,curveOpts:i,hash:r,ecdsaOpts:p}=j(u),d=N(y,i),t=D(d,r,p);return V(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=s,_shortw_utils.createCurve=v;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireWeierstrass();function s(c){return{hash:c}}function v(c,l){const a=o=>(0,e.weierstrass)({...c,hash:o});return{...a(l),create:a}}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 s=requireSha2(),v=requireUtils$2(),c=require_shortw_utils(),l=requireHashToCurve(),a=requireModular(),o=requireWeierstrass(),h=requireUtils$1(),E={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")]]},x=BigInt(0),q=BigInt(1),S=BigInt(2);function L(V){const H=E.p,u=BigInt(3),y=BigInt(6),i=BigInt(11),r=BigInt(22),p=BigInt(23),d=BigInt(44),t=BigInt(88),g=V*V*V%H,m=g*g*V%H,f=(0,a.pow2)(m,u,H)*m%H,b=(0,a.pow2)(f,u,H)*m%H,ee=(0,a.pow2)(b,S,H)*g%H,X=(0,a.pow2)(ee,i,H)*ee%H,k=(0,a.pow2)(X,r,H)*X%H,Y=(0,a.pow2)(k,d,H)*k%H,z=(0,a.pow2)(Y,t,H)*Y%H,J=(0,a.pow2)(z,d,H)*k%H,ne=(0,a.pow2)(J,u,H)*m%H,G=(0,a.pow2)(ne,p,H)*X%H,W=(0,a.pow2)(G,y,H)*g%H,re=(0,a.pow2)(W,S,H);if(!w.eql(w.sqr(re),V))throw new Error("Cannot find square root");return re}const w=(0,a.Field)(E.p,{sqrt:L});e.secp256k1=(0,c.createCurve)({...E,Fp:w,lowS:!0,endo:T},s.sha256);const B={};function A(V,...H){let u=B[V];if(u===void 0){const y=(0,s.sha256)((0,h.utf8ToBytes)(V));u=(0,h.concatBytes)(y,y),B[V]=u}return(0,s.sha256)((0,h.concatBytes)(u,...H))}const N=V=>V.toBytes(!0).slice(1),$=e.secp256k1.Point,K=V=>V%S===x;function U(V){const{Fn:H,BASE:u}=$,y=(0,o._normFnElement)(H,V),i=u.multiply(y);return{scalar:K(i.y)?y:H.neg(y),bytes:N(i)}}function _(V){const H=w;if(!H.isValidNot0(V))throw new Error("invalid x: Fail if x \u2265 p");const u=H.create(V*V),y=H.create(u*V+BigInt(7));let i=H.sqrt(y);K(i)||(i=H.neg(i));const r=$.fromAffine({x:V,y:i});return r.assertValidity(),r}const O=h.bytesToNumberBE;function D(...V){return $.Fn.create(O(A("BIP0340/challenge",...V)))}function F(V){return U(V).bytes}function P(V,H,u=(0,v.randomBytes)(32)){const{Fn:y}=$,i=(0,h.ensureBytes)("message",V),{bytes:r,scalar:p}=U(H),d=(0,h.ensureBytes)("auxRand",u,32),t=y.toBytes(p^O(A("BIP0340/aux",d))),g=A("BIP0340/nonce",t,r,i),{bytes:m,scalar:f}=U(g),b=D(m,r,i),ee=new Uint8Array(64);if(ee.set(m,0),ee.set(y.toBytes(y.create(f+b*p)),32),!j(ee,i,r))throw new Error("sign: Invalid signature produced");return ee}function j(V,H,u){const{Fn:y,BASE:i}=$,r=(0,h.ensureBytes)("signature",V,64),p=(0,h.ensureBytes)("message",H),d=(0,h.ensureBytes)("publicKey",u,32);try{const t=_(O(d)),g=O(r.subarray(0,32));if(!(0,h.inRange)(g,q,E.p))return!1;const m=O(r.subarray(32,64));if(!(0,h.inRange)(m,q,E.n))return!1;const f=D(y.toBytes(g),N(t),p),b=i.multiplyUnsafe(m).add(t.multiplyUnsafe(y.neg(f))),{x:ee,y:X}=b.toAffine();return!(b.is0()||!K(X)||ee!==g)}catch{return!1}}e.schnorr=(()=>{const u=(i=(0,v.randomBytes)(48))=>(0,a.mapHashToField)(i,E.n);e.secp256k1.utils.randomSecretKey;function y(i){const r=u(i);return{secretKey:r,publicKey:F(r)}}return{keygen:y,getPublicKey:F,sign:P,verify:j,Point:$,utils:{randomSecretKey:u,randomPrivateKey:u,taggedHash:A,lift_x:_,pointToBytes:N,numberToBytesBE:h.numberToBytesBE,bytesToNumberBE:h.bytesToNumberBE,mod:a.mod},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})();const R=(0,l.isogenyMap)(w,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(V=>V.map(H=>BigInt(H)))),M=(0,o.mapToCurveSimpleSWU)(w,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:w.create(BigInt("-11"))});e.secp256k1_hasher=(0,l.createHasher)(e.secp256k1.Point,V=>{const{x:H,y:u}=M(w.create(V[0]));return R(H,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:s.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 s=requireUtils$3(),v=function(l){return l.startsWith("0x")||l.startsWith("0X")?l.slice(2):l};e.remove0x=v;var c=function(l){return(0,s.hexToBytes)((0,e.remove0x)(l))};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 s=requireWebcrypto(),v=requireEd25519(),c=requireSecp256k1(),l=requireConfig$1(),a=requireConsts(),o=requireHex(),h=function(A){var N;do N=(0,s.randomBytes)(a.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(N,A));return N};e.getValidSecret=h;var E=function(A,N){return L(N,function($){return $.utils.isValidSecretKey(A)},function(){return!0},function(){return!0})};e.isValidPrivateKey=E;var T=function(A,N){return L(N,function($){return $.getPublicKey(A)},function($){return $.getPublicKey(A)},function($){return $.getPublicKey(A)})};e.getPublicKey=T;var x=function(A,N,$,K){return L(K,function(U){return U.getSharedSecret(A,N,$)},function(U){return U.getSharedSecret(A,N)},function(U){return B(U,A,N)})};e.getSharedPoint=x;var q=function(A,N,$){return L($,function(K){return K.getSharedSecret(Uint8Array.from(Array(31).fill(0).concat([1])),A,N)},function(){return A},function(){return A})};e.convertPublicKeyFormat=q;var S=function(A,N){var $=(0,o.decodeHex)(A);return L(N,function(){return w($)},function(){return $},function(){return $})};e.hexToPublicKey=S;function L(A,N,$,K){var U=A||(0,l.ellipticCurve)();if(U==="secp256k1")return N(c.secp256k1);if(U==="x25519")return $(v.x25519);if(U==="ed25519")return K(v.ed25519);throw new Error("Not implemented")}var w=function(A){if(A.length===a.ETH_PUBLIC_KEY_SIZE){var N=new Uint8Array(1+A.length);return N.set([4]),N.set(A,1),N}return A},B=function(A,N,$){var K=A.utils.getExtendedPublicKey(N).scalar,U=A.Point.fromBytes($).multiply(K);return U.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=a;const e=requireHmac(),s=requireUtils$2();function v(h,E,T){return(0,s.ahash)(h),T===void 0&&(T=new Uint8Array(h.outputLen)),(0,e.hmac)(h,(0,s.toBytes)(T),(0,s.toBytes)(E))}const c=Uint8Array.from([0]),l=Uint8Array.of();function a(h,E,T,x=32){(0,s.ahash)(h),(0,s.anumber)(x);const q=h.outputLen;if(x>255*q)throw new Error("Length should be <= 255*HashLen");const S=Math.ceil(x/q);T===void 0&&(T=l);const L=new Uint8Array(S*q),w=e.hmac.create(h,E),B=w._cloneInto(),A=new Uint8Array(w.outputLen);for(let N=0;N<S;N++)c[0]=N+1,B.update(N===0?l:A).update(T).update(c).digestInto(A),L.set(A,q*N),w._cloneInto(B);return w.destroy(),B.destroy(),(0,s.clean)(A,c),L.slice(0,x)}const o=(h,E,T,x,q)=>a(h,v(h,E,T),x,q);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 s=requireUtils$3(),v=requireHkdf(),c=requireSha2(),l=function(o,h,E){return(0,v.hkdf)(c.sha256,o,h,E,32)};e.deriveKey=l;var a=function(){for(var o=[],h=0;h<arguments.length;h++)o[h]=arguments[h];return(0,e.deriveKey)(s.concatBytes.apply(void 0,o))};e.getSharedKey=a})(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(),s=__require(),v=16,c=globalThis.Deno!==void 0,l=function(a,o,h,E){var T=a==="aes-256-gcm"||a==="chacha20-poly1305",x=T?v:0,q=T?{authTagLength:x}:void 0,S=function(w){var B=(0,s.createCipheriv)(a,o,h,q);T&&E!==void 0&&B.setAAD(E);var A=B.update(w),N=B.final(),$=T?B.getAuthTag():new Uint8Array(0);return(0,e.concatBytes)(A,N,$)},L=function(w){var B=w.subarray(0,w.length-x),A=w.subarray(w.length-x),N=(0,s.createDecipheriv)(a,o,h,q);T&&(E!==void 0&&N.setAAD(E),N.setAuthTag(A)),!T&&c&&N.setAutoPadding(!1);var $=N.update(B),K=N.final();return(0,e.concatBytes)($,K)};return{encrypt:S,decrypt:L}};return compat._compat=l,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(),s=function(c,l,a){return(0,e._compat)("aes-256-gcm",c,l,a)};node$1.aes256gcm=s;var v=function(c,l,a){return(0,e._compat)("aes-256-cbc",c,l)};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,c,l,a){for(var o=v[0],h=v[1],E=v[2],T=v[3],x=c[0],q=c[1],S=c[2],L=c[3],w=c[4],B=c[5],A=c[6],N=c[7],$=l[0],K=l[1],U=l[2],_=l[3],O=0;O<20;O+=2)o=o+x|0,$=s($^o,16),w=w+$|0,x=s(x^w,12),o=o+x|0,$=s($^o,8),w=w+$|0,x=s(x^w,7),h=h+q|0,K=s(K^h,16),B=B+K|0,q=s(q^B,12),h=h+q|0,K=s(K^h,8),B=B+K|0,q=s(q^B,7),E=E+S|0,U=s(U^E,16),A=A+U|0,S=s(S^A,12),E=E+S|0,U=s(U^E,8),A=A+U|0,S=s(S^A,7),T=T+L|0,_=s(_^T,16),N=N+_|0,L=s(L^N,12),T=T+L|0,_=s(_^T,8),N=N+_|0,L=s(L^N,7),o=o+q|0,_=s(_^o,16),A=A+_|0,q=s(q^A,12),o=o+q|0,_=s(_^o,8),A=A+_|0,q=s(q^A,7),h=h+S|0,$=s($^h,16),N=N+$|0,S=s(S^N,12),h=h+S|0,$=s($^h,8),N=N+$|0,S=s(S^N,7),E=E+L|0,K=s(K^E,16),w=w+K|0,L=s(L^w,12),E=E+L|0,K=s(K^E,8),w=w+K|0,L=s(L^w,7),T=T+x|0,U=s(U^T,16),B=B+U|0,x=s(x^B,12),T=T+x|0,U=s(U^T,8),B=B+U|0,x=s(x^B,7);var D=0;a[D++]=o,a[D++]=h,a[D++]=E,a[D++]=T,a[D++]=$,a[D++]=K,a[D++]=U,a[D++]=_};hchacha._hchacha20=e;var s=function(v,c){return v<<c|v>>>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(),s=requireCompat(),v=requireHchacha(),c=function(a,o,h){if(o.length!==24)throw new Error("xchacha20's nonce must be 24 bytes");var E=new Uint32Array([1634760805,857760878,2036477234,1797285236]),T=new Uint32Array(8);(0,v._hchacha20)(E,(0,e.u32)(a),(0,e.u32)(o.subarray(0,16)),T);var x=new Uint8Array(12);return x.set([0,0,0,0]),x.set(o.subarray(16),4),(0,s._compat)("chacha20-poly1305",(0,e.u8)(T),x,h)};node.xchacha20=c;var l=function(a,o,h){if(o.length!==12)throw new Error("chacha20's nonce must be 12 bytes");return(0,s._compat)("chacha20-poly1305",a,o,h)};return node.chacha20=l,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 s=requireNode$1(),v=requireNode(),c=requireUtils$3(),l=requireWebcrypto(),a=requireConfig$1(),o=requireConsts(),h=function(S,L,w){return T(x,S,L,w)};e.symEncrypt=h;var E=function(S,L,w){return T(q,S,L,w)};e.symDecrypt=E,e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt;function T(S,L,w,B){var A=(0,a.symmetricAlgorithm)();if(A==="aes-256-gcm")return S(s.aes256gcm,L,w,(0,a.symmetricNonceLength)(),o.AEAD_TAG_LENGTH,B);if(A==="xchacha20")return S(v.xchacha20,L,w,o.XCHACHA20_NONCE_LENGTH,o.AEAD_TAG_LENGTH,B);if(A==="aes-256-cbc")return S(s.aes256cbc,L,w,16,0);throw new Error("Not implemented")}function x(S,L,w,B,A,N){var $=(0,l.randomBytes)(B),K=S(L,$,N),U=K.encrypt(w);if(A===0)return(0,c.concatBytes)($,U);var _=U.length-A,O=U.subarray(0,_),D=U.subarray(_);return(0,c.concatBytes)($,D,O)}function q(S,L,w,B,A,N){var $=w.subarray(0,B),K=S(L,Uint8Array.from($),N),U=w.subarray(B);if(A===0)return K.decrypt(U);var _=U.subarray(0,A),O=U.subarray(A);return K.decrypt((0,c.concatBytes)(O,_))}})(symmetric)),symmetric}var hasRequiredUtils;function requireUtils(){return hasRequiredUtils||(hasRequiredUtils=1,(function(e){var s=utils$2&&utils$2.__createBinding||(Object.create?(function(c,l,a,o){o===void 0&&(o=a);var h=Object.getOwnPropertyDescriptor(l,a);(!h||("get"in h?!l.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return l[a]}}),Object.defineProperty(c,o,h)}):(function(c,l,a,o){o===void 0&&(o=a),c[o]=l[a]})),v=utils$2&&utils$2.__exportStar||function(c,l){for(var a in c)a!=="default"&&!Object.prototype.hasOwnProperty.call(l,a)&&s(l,c,a)};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(),s=requireUtils(),v=(function(){function c(l,a){var o=(0,s.convertPublicKeyFormat)(l,!0,a),h=(0,s.convertPublicKeyFormat)(l,!1,a);this.data=o,this.dataUncompressed=o.length!==h.length?h:null}return c.fromHex=function(l,a){return new c((0,s.hexToPublicKey)(l,a),a)},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(l){return l===void 0&&(l=!0),l?this.data:this._uncompressed},c.prototype.toHex=function(l){return l===void 0&&(l=!0),(0,e.bytesToHex)(this.toBytes(l))},c.prototype.decapsulate=function(l,a){a===void 0&&(a=!1);var o=this.toBytes(a),h=l.multiply(this,a);return(0,s.getSharedKey)(o,h)},c.prototype.equals=function(l){return(0,e.equalBytes)(this.data,l.data)},c})();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(),s=requireUtils(),v=requirePublicKey(),c=(function(){function l(a,o){if(this.curve=o,a===void 0)this.data=(0,s.getValidSecret)(o);else if((0,s.isValidPrivateKey)(a,o))this.data=a;else throw new Error("Invalid private key");this.publicKey=new v.PublicKey((0,s.getPublicKey)(this.data,o),o)}return l.fromHex=function(a,o){return new l((0,s.decodeHex)(a),o)},Object.defineProperty(l.prototype,"secret",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),l.prototype.toHex=function(){return(0,e.bytesToHex)(this.data)},l.prototype.encapsulate=function(a,o){o===void 0&&(o=!1);var h=this.publicKey.toBytes(o),E=this.multiply(a,o);return(0,s.getSharedKey)(h,E)},l.prototype.multiply=function(a,o){return o===void 0&&(o=!1),(0,s.getSharedPoint)(this.data,a.toBytes(!0),o,this.curve)},l.prototype.equals=function(a){return(0,e.equalBytes)(this.data,a.data)},l})();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 s=requirePrivateKey();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return s.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=a,e.decrypt=h;var s=requireUtils$3(),v=requireConfig$1(),c=requireKeys(),l=requireUtils();function a(q,S){return Buffer.from(o(q,S))}function o(q,S){var L=(0,v.ellipticCurve)(),w=new c.PrivateKey(void 0,L),B=q instanceof Uint8Array?new c.PublicKey(q,L):c.PublicKey.fromHex(q,L),A=w.encapsulate(B,(0,v.isHkdfKeyCompressed)()),N=w.publicKey.toBytes((0,v.isEphemeralKeyCompressed)()),$=(0,l.symEncrypt)(A,S);return(0,s.concatBytes)(N,$)}function h(q,S){return Buffer.from(E(q,S))}function E(q,S){var L=(0,v.ellipticCurve)(),w=q instanceof Uint8Array?new c.PrivateKey(q,L):c.PrivateKey.fromHex(q,L),B=(0,v.ephemeralKeySize)(),A=new c.PublicKey(S.subarray(0,B),L),N=S.subarray(B),$=A.decapsulate(w,(0,v.isHkdfKeyCompressed)());return(0,l.symDecrypt)($,N)}var T=requireConfig$1();Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return T.ECIES_CONFIG}});var x=requireKeys();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return x.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return x.PublicKey}}),e.utils={aesEncrypt:l.aesEncrypt,aesDecrypt:l.aesDecrypt,symEncrypt:l.symEncrypt,symDecrypt:l.symDecrypt,decodeHex:l.decodeHex,getValidSecret:l.getValidSecret,remove0x:l.remove0x}})(dist)),dist}var truncate_1,hasRequiredTruncate;function requireTruncate(){if(hasRequiredTruncate)return truncate_1;hasRequiredTruncate=1;function e(s,v=7){return s&&s.length>0?s.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 s{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",l=`[${c}] missing ${this.envFilepath} file (${this.filepath})`,a=`[${c}] https://github.com/dotenvx/dotenvx/issues/484`,o=new Error(l);return o.code=c,o.help=a,o}missingKey(){const c="MISSING_KEY",l=`[${c}] missing ${this.key} key`,a=new Error(l);return a.code=c,a}missingPrivateKey(){const c="MISSING_PRIVATE_KEY",l=`[${c}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,a=`[${c}] https://github.com/dotenvx/dotenvx/issues/464`,o=new Error(l);return o.code=c,o.help=a,o}invalidPrivateKey(){const c="INVALID_PRIVATE_KEY",l=`[${c}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,a=`[${c}] https://github.com/dotenvx/dotenvx/issues/465`,o=new Error(l);return o.code=c,o.help=a,o}looksWrongPrivateKey(){const c="WRONG_PRIVATE_KEY",l=`[${c}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,a=`[${c}] https://github.com/dotenvx/dotenvx/issues/466`,o=new Error(l);return o.code=c,o.help=a,o}malformedEncryptedData(){const c="MALFORMED_ENCRYPTED_DATA",l=`[${c}] could not decrypt ${this.key} because encrypted data appears malformed`,a=`[${c}] https://github.com/dotenvx/dotenvx/issues/467`,o=new Error(l);return o.code=c,o.help=a,o}decryptionFailed(){const c="DECRYPTION_FAILED",l=this.message,a=new Error(l);return a.code=c,a}commandSubstitutionFailed(){const c="COMMAND_SUBSTITUTION_FAILED",l=`[${c}] could not eval ${this.key} containing command '${this.command}': ${this.message}`,a=`[${c}] https://github.com/dotenvx/dotenvx/issues/532`,o=new Error(l);return o.code=c,o.help=a,o}dangerousDependencyHoist(){const c="DANGEROUS_DEPENDENCY_HOIST",l=`[${c}] your environment has hoisted an incompatible version of a dotenvx dependency: ${this.message}`,a=`[${c}] https://github.com/dotenvx/dotenvx/issues/622`,o=new Error(l);return o.code=c,o.help=a,o}}return errors=s,errors}var decryptKeyValue_1,hasRequiredDecryptKeyValue;function requireDecryptKeyValue(){if(hasRequiredDecryptKeyValue)return decryptKeyValue_1;hasRequiredDecryptKeyValue=1;const{decrypt:e}=requireDist(),s=requireErrors(),v="encrypted:";function c(l,a,o,h){let E,T;if(!a.startsWith(v))return a;if(h=h||"",h.length<=0)T=new s({key:l,privateKeyName:o,privateKey:h}).missingPrivateKey();else{const x=h.split(",");for(const q of x){const S=Buffer.from(q,"hex"),L=a.substring(v.length),w=Buffer.from(L,"base64");try{E=e(S,w).toString(),T=null;break}catch(B){B.message==="Invalid private key"?T=new s({key:l,privateKeyName:o,privateKey:h}).invalidPrivateKey():B.message==="Unsupported state or unable to authenticate data"?T=new s({key:l,privateKeyName:o,privateKey:h}).looksWrongPrivateKey():B.message==="Point of length 65 was invalid. Expected 33 compressed bytes or 65 uncompressed bytes"?T=new s({key:l,privateKeyName:o,privateKey:h}).malformedEncryptedData():T=new s({key:l,privateKeyName:o,privateKey:h,message:B.message}).decryptionFailed()}}}if(T)throw T;return E}return decryptKeyValue_1=c,decryptKeyValue_1}var chomp_1,hasRequiredChomp;function requireChomp(){if(hasRequiredChomp)return chomp_1;hasRequiredChomp=1;function e(s){return s.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$2,s=requireChomp(),v=requireErrors();function c(l,a,o,h){return(a.match(/\$\(([^)]+(?:\)[^(]*)*)\)/g)||[]).reduce((T,x)=>{const q=x.slice(2,-1);let S;try{S=e(q,{env:{...o,...h}}).toString()}catch(L){throw new v({key:l,command:q,message:L.message.trim()}).commandSubstitutionFailed()}return S=s(S),T.replace(x,S)},a)}return evalKeyValue_1=c,evalKeyValue_1}var resolveEscapeSequences_1,hasRequiredResolveEscapeSequences;function requireResolveEscapeSequences(){if(hasRequiredResolveEscapeSequences)return resolveEscapeSequences_1;hasRequiredResolveEscapeSequences=1;function e(s){return s.replace(/\\\$/g,"$")}return resolveEscapeSequences_1=e,resolveEscapeSequences_1}var parse,hasRequiredParse;function requireParse(){if(hasRequiredParse)return parse;hasRequiredParse=1;const e=requireDecryptKeyValue(),s=requireEvalKeyValue(),v=requireResolveEscapeSequences();class c{static LINE=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;constructor(a,o=null,h=process.env,E=!1,T=null){this.src=a,this.privateKey=o,this.privateKeyName=T,this.processEnv=h,this.overload=E,this.parsed={},this.preExisted={},this.injected={},this.errors=[],this.runningParsed={},this.literals={}}run(){const a=this.getLines();let o;for(;(o=c.LINE.exec(a))!==null;){const h=o[1],E=o[2],T=this.quote(E);this.parsed[h]=this.clean(E,T),!this.overload&&this.inProcessEnv(h)&&(this.parsed[h]=this.processEnv[h]);try{this.parsed[h]=this.decrypt(h,this.parsed[h])}catch(q){this.errors.push(q)}let x=!1;if(T!=="'"&&(!this.inProcessEnv(h)||this.processEnv[h]===this.parsed[h])){const q=this.parsed[h];try{this.parsed[h]=this.eval(h,q)}catch(S){this.errors.push(S)}q!==this.parsed[h]&&(x=!0)}!x&&T!=="'"&&(!this.processEnv[h]||this.overload)&&(this.parsed[h]=v(this.expand(this.parsed[h]))),T==="'"&&(this.literals[h]=this.parsed[h]),this.runningParsed[h]=this.parsed[h],Object.prototype.hasOwnProperty.call(this.processEnv,h)&&!this.overload?this.preExisted[h]=this.processEnv[h]:this.injected[h]=this.parsed[h]}return{parsed:this.parsed,processEnv:this.processEnv,injected:this.injected,preExisted:this.preExisted,errors:this.errors}}trimmer(a){return(a||"").trim()}quote(a){const h=this.trimmer(a)[0];let E="";switch(h){case"'":E="'";break;case'"':E='"';break;case"`":E="`";break;default:E=""}return E}clean(a,o){let h=this.trimmer(a);return h=h.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),o==='"'&&(h=h.replace(/\\n/g,`
|
|
5
|
-
`),h=h.replace(/\\r/g,"\r"),h=h.replace(/\\t/g," ")),h}decrypt(a,o){return e(a,o,this.privateKeyName,this.privateKey)}eval(a,o){return s(a,o,this.processEnv,this.runningParsed)}expand(a){let o={...this.runningParsed,...this.processEnv};this.overload&&(o={...this.processEnv,...this.runningParsed});const h=/(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g;let E=a,T;for(;(T=h.exec(E))!==null;){const[x,q,S]=T,L=q||S,w=/(:\+|\+|:-|-)/,B=L.match(w),A=B?B[0]:null,N=L.split(A);let $,K;const U=N.shift();if([":+","+"].includes(A)?($=o[U]?N.join(A):"",K=null):($=N.join(A),K=o[U]),K?E=E.replace(x,K):E=E.replace(x,$),E===o[U]||this.literals[U]&&/\$\{[^}]+\}|\$[A-Za-z_][A-Za-z0-9_]*/.test(this.literals[U]))break;h.lastIndex=0}return E}inProcessEnv(a){return Object.prototype.hasOwnProperty.call(this.processEnv,a)}getLines(){return(this.src||"").toString().replace(/\r\n?/mg,`
|
|
6
|
-
`)}}return parse=c,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 s(v,c=!1,l=!1,a=!1){const o={};let h=v.toString();l||(h=h.replace(/\r\n?/mg,`
|
|
7
|
-
`));let E;for(;(E=e.exec(h))!=null;){const T=E[1];let x=E[2]||"";x=x.trim();const q=x[0];x=x.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),q==='"'&&!c&&(x=x.replace(/\\n/g,`
|
|
8
|
-
`),x=x.replace(/\\r/g,"\r"),x=x.replace(/\\t/g," ")),a?(o[T]=o[T]||[],o[T].push(x)):o[T]=x}return o}return dotenvParse_1=s,dotenvParse_1}var parseEnvironmentFromDotenvKey_1,hasRequiredParseEnvironmentFromDotenvKey;function requireParseEnvironmentFromDotenvKey(){if(hasRequiredParseEnvironmentFromDotenvKey)return parseEnvironmentFromDotenvKey_1;hasRequiredParseEnvironmentFromDotenvKey=1;function e(s){let v;try{v=new URL(s)}catch(l){throw new Error(`INVALID_DOTENV_KEY: ${l.message}`)}const c=v.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 s(v){const c=e.readFileSync(v);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=s,detectEncoding_1}var guessEnvironment_1,hasRequiredGuessEnvironment;function requireGuessEnvironment(){if(hasRequiredGuessEnvironment)return guessEnvironment_1;hasRequiredGuessEnvironment=1;const e=require$$1__default;function s(v){const c=e.basename(v),a=[...c.split(".").slice(2)];return a.length===0?c.replace(".env","development"):a.length===1?a[0]:a.length===2?a.join("_"):a.slice(0,2).join("_")}return guessEnvironment_1=s,guessEnvironment_1}var guessPrivateKeyName_1,hasRequiredGuessPrivateKeyName;function requireGuessPrivateKeyName(){if(hasRequiredGuessPrivateKeyName)return guessPrivateKeyName_1;hasRequiredGuessPrivateKeyName=1;const e=require$$1__default,s=requireGuessEnvironment();function v(c){const l=e.basename(c).toLowerCase();return l===".env"?"DOTENV_PRIVATE_KEY":`DOTENV_PRIVATE_KEY_${s(l).toUpperCase()}`}return guessPrivateKeyName_1=v,guessPrivateKeyName_1}var guessPublicKeyName_1,hasRequiredGuessPublicKeyName;function requireGuessPublicKeyName(){if(hasRequiredGuessPublicKeyName)return guessPublicKeyName_1;hasRequiredGuessPublicKeyName=1;const e=require$$1__default,s=requireGuessEnvironment();function v(c){const l=e.basename(c).toLowerCase();return l===".env"?"DOTENV_PUBLIC_KEY":`DOTENV_PUBLIC_KEY_${s(l).toUpperCase()}`}return guessPublicKeyName_1=v,guessPublicKeyName_1}var proKeypair,hasRequiredProKeypair;function requireProKeypair(){if(hasRequiredProKeypair)return proKeypair;hasRequiredProKeypair=1;const e=require$$1__default,s=require$$0__default$2,v=requireGuessPrivateKeyName(),c=requireGuessPublicKeyName();class l{constructor(o){this.envFilepath=o}run(){let o={};try{const h=e.resolve(process.cwd(),"node_modules/.bin/dotenvx-pro"),E=s.execSync(`${h} keypair -f ${this.envFilepath}`,{stdio:["pipe","pipe","ignore"]}).toString().trim();o=JSON.parse(E)}catch{try{const E=s.execSync(`dotenvx-pro keypair -f ${this.envFilepath}`,{stdio:["pipe","pipe","ignore"]}).toString().trim();o=JSON.parse(E)}catch{const T=v(this.envFilepath),x=c(this.envFilepath);o[T]=null,o[x]=null}}return o}}return proKeypair=l,proKeypair}var smartDotenvPublicKey_1,hasRequiredSmartDotenvPublicKey;function requireSmartDotenvPublicKey(){if(hasRequiredSmartDotenvPublicKey)return smartDotenvPublicKey_1;hasRequiredSmartDotenvPublicKey=1;const e=requireFsx(),s=requireDotenvParse(),v=requireGuessPublicKeyName();function c(o){if(process.env[o]&&process.env[o].length>0)return process.env[o]}function l(o,h){if(e.existsSync(h)){const E=e.readFileX(h),T=s(E);if(T[o]&&T[o].length>0)return T[o]}}function a(o){let h=null;const E=v(o);return h=c(E),h||(h=l(E,o),h)?h:null}return smartDotenvPublicKey_1=a,smartDotenvPublicKey_1}var smartDotenvPrivateKey_1,hasRequiredSmartDotenvPrivateKey;function requireSmartDotenvPrivateKey(){if(hasRequiredSmartDotenvPrivateKey)return smartDotenvPrivateKey_1;hasRequiredSmartDotenvPrivateKey=1;const e=requireFsx(),s=require$$1__default,v="DOTENV_PUBLIC_KEY",c="DOTENV_PRIVATE_KEY",l=requireDotenvParse(),a=requireGuessPrivateKeyName();function o(x){if(process.env[x]&&process.env[x].length>0)return process.env[x]}function h(x,q,S=null){let L=s.resolve(s.dirname(q),".env.keys");if(S&&(L=s.resolve(S)),e.existsSync(L)){const w=e.readFileX(L),B=l(w);if(B[x]&&B[x].length>0)return B[x]}}function E(x){if(!e.existsSync(x))return null;const q=e.readFileX(x),S=l(q);let L;for(const w of Object.keys(S))(w===v||w.startsWith(v))&&(L=w);return L?L.replace(v,c):null}function T(x,q=null){let S=null,L=a(x);return S=o(L),S||(S=h(L,x,q),S)||(L=E(x),L&&(S=o(L),S||(S=h(L,x,q),S)))?S: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(),s=requireSmartDotenvPublicKey(),v=requireGuessPrivateKeyName(),c=requireSmartDotenvPrivateKey();class l{constructor(o=".env",h=null){this.envFile=o,this.envKeysFilepath=h}run(){const o={},h=this._envFilepaths();for(const E of h){const T=e(E),x=s(E);o[T]=x;const q=v(E),S=c(E,this.envKeysFilepath);o[q]=S}return o}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return keypair=l,keypair}var findPrivateKey_1,hasRequiredFindPrivateKey;function requireFindPrivateKey(){if(hasRequiredFindPrivateKey)return findPrivateKey_1;hasRequiredFindPrivateKey=1;const e=requireGuessPrivateKeyName(),s=requireProKeypair(),v=requireKeypair$1();function c(l,a=null,o=!0){const h=e(l);let E={};o&&(E=new s(l).run());const T=new v(l,a).run();return E[h]||T[h]}return findPrivateKey_1={findPrivateKey:c},findPrivateKey_1}var dotenvPrivateKeyNames_1,hasRequiredDotenvPrivateKeyNames;function requireDotenvPrivateKeyNames(){if(hasRequiredDotenvPrivateKeyNames)return dotenvPrivateKeyNames_1;hasRequiredDotenvPrivateKeyNames=1;const e="DOTENV_PRIVATE_KEY";function s(v){return Object.keys(v).filter(c=>c.startsWith(e))}return dotenvPrivateKeyNames_1=s,dotenvPrivateKeyNames_1}var guessPrivateKeyFilename_1,hasRequiredGuessPrivateKeyFilename;function requireGuessPrivateKeyFilename(){if(hasRequiredGuessPrivateKeyFilename)return guessPrivateKeyFilename_1;hasRequiredGuessPrivateKeyFilename=1;const e="DOTENV_PRIVATE_KEY";function s(v){return v===e?".env":`.env.${v.substring(`${e}_`.length).split("_").join(".").toLowerCase()}`}return guessPrivateKeyFilename_1=s,guessPrivateKeyFilename_1}var determineEnvs_1,hasRequiredDetermineEnvs;function requireDetermineEnvs(){if(hasRequiredDetermineEnvs)return determineEnvs_1;hasRequiredDetermineEnvs=1;const e=requireDotenvPrivateKeyNames(),s=requireGuessPrivateKeyFilename(),v="envFile",c="envVaultFile",l=[{type:v,value:".env"}],a=[{type:c,value:".env.vault"}];function o(E){const T=[];for(const x of E){const q=s(x);T.push({type:v,value:q})}return T}function h(E=[],T,x=""){const q=e(T);if(!E||E.length<=0)return q.length>0?o(q):x.length>0?a:l;{let S=!1;for(const L of E)x.length>0&&L.type===c&&(S=!0),x.length<=0&&L.type===v&&(S=!0);return S?E:x.length>0?[...a,...E]:[...l,...E]}}return determineEnvs_1=h,determineEnvs_1}var run,hasRequiredRun;function requireRun(){if(hasRequiredRun)return run;hasRequiredRun=1;const e=requireFsx(),s=require$$1__default,v="env",c="envFile",l="envVaultFile",a=requireDecrypt(),o=requireParse(),h=requireErrors(),E=requireDotenvParse(),T=requireParseEnvironmentFromDotenvKey(),x=requireDetectEncoding(),{findPrivateKey:q}=requireFindPrivateKey(),S=requireGuessPrivateKeyName(),L=requireDetermineEnvs();class w{constructor(A=[],N=!1,$="",K=process.env,U=null,_=!0){this.envs=L(A,K,$),this.overload=N,this.DOTENV_KEY=$,this.processEnv=K,this.envKeysFilepath=U,this.opsOn=_,this.processedEnvs=[],this.readableFilepaths=new Set,this.readableStrings=new Set,this.uniqueInjectedKeys=new Set,this.beforeEnv={...this.processEnv}}run(){for(const A of this.envs)A.type===l?this._injectEnvVaultFile(A.value):A.type===c?this._injectEnvFile(A.value):A.type===v&&this._injectEnv(A.value);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys],beforeEnv:this.beforeEnv,afterEnv:{...this.processEnv}}}_injectEnv(A){const N={};N.type=v,N.string=A;try{const{parsed:$,errors:K,injected:U,preExisted:_}=new o(A,null,this.processEnv,this.overload).run();N.parsed=$,N.errors=K,N.injected=U,N.preExisted=_,this.inject(N.parsed),this.readableStrings.add(A);for(const O of Object.keys(U))this.uniqueInjectedKeys.add(O)}catch($){N.errors=[$]}this.processedEnvs.push(N)}_injectEnvFile(A){const N={};N.type=c,N.filepath=A;const $=s.resolve(A);try{const K=x($),U=e.readFileX($,{encoding:K});this.readableFilepaths.add(A);const _=q(A,this.envKeysFilepath,this.opsOn),O=S(A),{parsed:D,errors:F,injected:P,preExisted:j}=new o(U,_,this.processEnv,this.overload,O).run();N.privateKeyName=O,N.privateKey=_,N.src=U,N.parsed=D,N.errors=F,N.injected=P,N.preExisted=j,this.inject(N.parsed);for(const R of Object.keys(P))this.uniqueInjectedKeys.add(R)}catch(K){K.code==="ENOENT"||K.code==="EISDIR"?N.errors=[new h({envFilepath:A,filepath:$}).missingEnvFile()]:N.errors=[K]}this.processedEnvs.push(N)}_injectEnvVaultFile(A){const N={};N.type=l,N.filepath=A;const $=s.resolve(A);if(this.readableFilepaths.add(A),!e.existsSync($)){const O="MISSING_ENV_VAULT_FILE",D=`you set DOTENV_KEY but your .env.vault file is missing: ${$}`,F=new Error(D);throw F.code=O,F}if(this.DOTENV_KEY.length<1){const O="MISSING_DOTENV_KEY",D=`your DOTENV_KEY appears to be blank: '${this.DOTENV_KEY}'`,F=new Error(D);throw F.code=O,F}let K;const U=this._dotenvKeys(),_=this._parsedVault($);for(let O=0;O<U.length;O++)try{const D=U[O].trim();K=this._decrypted(D,_);break}catch(D){if(O+1>=U.length)throw D}try{const{parsed:O,errors:D,injected:F,preExisted:P}=new o(K,null,this.processEnv,this.overload).run();N.parsed=O,N.errors=D,N.injected=F,N.preExisted=P,this.inject(N.parsed);for(const j of Object.keys(F))this.uniqueInjectedKeys.add(j)}catch(O){N.errors=[O]}this.processedEnvs.push(N)}inject(A){for(const N of Object.keys(A))this.processEnv[N]=A[N]}_dotenvKeys(){return this.DOTENV_KEY.split(",")}_parsedVault(A){const N=e.readFileX(A);return E(N)}_decrypted(A,N){const K=`DOTENV_VAULT_${T(A).toUpperCase()}`,U=N[K];if(!U){const _=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: cannot locate environment ${K} in your .env.vault file`);throw _.code="NOT_FOUND_DOTENV_ENVIRONMENT",_}return a(U,A)}}return run=w,run}var encryptValue_1,hasRequiredEncryptValue;function requireEncryptValue(){if(hasRequiredEncryptValue)return encryptValue_1;hasRequiredEncryptValue=1;const{encrypt:e}=requireDist(),s="encrypted:";function v(c,l){const a=e(l,Buffer.from(c)),o=Buffer.from(a,"hex").toString("base64");return`${s}${o}`}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 s(v){const c={};let l=v.toString();l=l.replace(/\r\n?/mg,`
|
|
9
|
-
`);let a;for(;(a=e.exec(l))!=null;){const o=a[1];let h=a[2]||"";h=h.trim();const E=h[0];h=h.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),E===h[0]?c[o]="":c[o]=E}return c}return quotes_1=s,quotes_1}var escapeForRegex_1,hasRequiredEscapeForRegex;function requireEscapeForRegex(){if(hasRequiredEscapeForRegex)return escapeForRegex_1;hasRequiredEscapeForRegex=1;function e(s){return s.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(s){return s.replace(/\$/g,"$$$$")}return escapeDollarSigns_1=e,escapeDollarSigns_1}var replace_1,hasRequiredReplace;function requireReplace(){if(hasRequiredReplace)return replace_1;hasRequiredReplace=1;const e=requireQuotes(),s=requireDotenvParse(),v=requireEscapeForRegex(),c=requireEscapeDollarSigns();function l(a,o,h){let E,T="";const x=s(a,!0,!0),q=e(a);if(Object.prototype.hasOwnProperty.call(x,o)){const S=q[o];T+=`${o}=${S}${h}${S}`;const L=x[o],w=v(L);let B="";if(w===""){B="$";const $=a.match(new RegExp(`${o}\\s*=\\s*
|
|
10
|
-
|
|
11
|
-
`,"m"));if(S===""&&$){const K=$[0].match(/\n/g).length-1;for(let U=0;U<K;U++)T+=`
|
|
12
|
-
`}}const A=new RegExp("^(\\s*)?(export\\s+)?"+o+"\\s*=\\s*[\"'`]?"+w+"[\"'`]?"+B,"gm"),N=c(T);E=a.replace(A,`$1$2${N}`)}else T+=`${o}="${h}"`,a.endsWith(`
|
|
13
|
-
`)?T=T+`
|
|
14
|
-
`:T=`
|
|
15
|
-
`+T,E=a+T;return E}return replace_1=l,replace_1}var findPublicKey_1,hasRequiredFindPublicKey;function requireFindPublicKey(){if(hasRequiredFindPublicKey)return findPublicKey_1;hasRequiredFindPublicKey=1;const e=requireGuessPublicKeyName(),s=requireProKeypair(),v=requireKeypair$1();function c(l,a=!0){const o=e(l);let h={};a&&(h=new s(l).run());const E=new v(l).run();return h[o]||E[o]}return findPublicKey_1=c,findPublicKey_1}var keypair_1,hasRequiredKeypair;function requireKeypair(){if(hasRequiredKeypair)return keypair_1;hasRequiredKeypair=1;const{PrivateKey:e}=requireDist();function s(v){let c;v?c=new e(Buffer.from(v,"hex")):c=new e;const l=c.publicKey.toHex(),a=c.secret.toString("hex");return{publicKey:l,privateKey:a}}return keypair_1=s,keypair_1}var isEncrypted_1,hasRequiredIsEncrypted;function requireIsEncrypted(){if(hasRequiredIsEncrypted)return isEncrypted_1;hasRequiredIsEncrypted=1;const e=/^encrypted:.+/;function s(v){return e.test(v)}return isEncrypted_1=s,isEncrypted_1}var sets,hasRequiredSets;function requireSets(){if(hasRequiredSets)return sets;hasRequiredSets=1;const e=requireFsx(),s=require$$1__default,v="envFile",c=requireErrors(),l=requireGuessPrivateKeyName(),a=requireGuessPublicKeyName(),o=requireEncryptValue(),h=requireDecryptKeyValue(),E=requireReplace(),T=requireDotenvParse(),x=requireDetectEncoding(),q=requireDetermineEnvs(),{findPrivateKey:S}=requireFindPrivateKey(),L=requireFindPublicKey(),w=requireKeypair(),B=requireTruncate(),A=requireIsEncrypted();class N{constructor(K,U,_=[],O=!0,D=null){this.envs=q(_,process.env),this.key=K,this.value=U,this.encrypt=O,this.envKeysFilepath=D,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 U={};U.key=this.key||null,U.value=this.value||null,U.type=v;const _=s.basename(K),O=s.resolve(K);U.filepath=O,U.envFilepath=K,U.changed=!1;try{const D=this._detectEncoding(O);let F=e.readFileX(O,{encoding:D});const P=T(F);U.originalValue=P[U.key]||null;const j=!A(U.originalValue);if(this.readableFilepaths.add(K),this.encrypt){let V,H;const u=a(K),y=l(K),i=S(K,this.envKeysFilepath),r=L(K);let p=s.join(s.dirname(O),".env.keys");this.envKeysFilepath&&(p=s.resolve(this.envKeysFilepath));const d=s.relative(s.dirname(O),p);if(i){const t=w(i);if(V=t.publicKey,H=t.privateKey,U.originalValue&&(U.originalValue=h(U.key,U.originalValue,y,H)),r&&r!==V){const g=new Error(`derived public key (${B(V)}) does not match the existing public key (${B(r)})`);throw g.code="INVALID_DOTENV_PRIVATE_KEY",g.help=`debug info: ${y}=${B(i)} (derived ${u}=${B(V)} vs existing ${u}=${B(r)})`,g}if(!r){const g=this._preserveShebang(F),m=g.firstLinePreserved;F=g.envSrc;const f=this._prependPublicKey(u,V,_,d);F=`${m}${f}
|
|
16
|
-
${F}`}}else if(r)V=r;else{let t="";e.existsSync(p)&&(t=e.readFileX(p));const g=this._preserveShebang(F),m=g.firstLinePreserved;F=g.envSrc;const f=w();V=f.publicKey,H=f.privateKey;const b=this._prependPublicKey(u,V,_,d),ee=["#/------------------!DOTENV_PRIVATE_KEYS!-------------------/","#/ private decryption keys. DO NOT commit to source control /","#/ [how it works](https://dotenvx.com/encryption) /","#/ backup with: `dotenvx ops backup` /","#/----------------------------------------------------------/"].join(`
|
|
17
|
-
`),X=[`# ${_}`,`${y}=${H}`,""].join(`
|
|
18
|
-
`);F=`${m}${b}
|
|
19
|
-
${F}`,t=t.length>1?t:`${ee}
|
|
20
|
-
`,t=`${t}
|
|
21
|
-
${X}`,e.writeFileX(p,t),U.privateKeyAdded=!0,U.envKeysFilepath=this.envKeysFilepath||s.join(s.dirname(K),s.basename(p))}U.publicKey=V,U.privateKey=H,U.encryptedValue=o(this.value,V),U.privateKeyName=y}const R=j&&this.encrypt,M=this.value!==U.originalValue;R||M?(U.envSrc=E(F,this.key,U.encryptedValue||this.value),this.changedFilepaths.add(K),U.changed=!0):(U.envSrc=F,this.unchangedFilepaths.add(K),U.changed=!1)}catch(D){D.code==="ENOENT"?U.error=new c({envFilepath:K,filepath:O}).missingEnvFile():U.error=D}this.processedEnvs.push(U)}_detectEncoding(K){return x(K)}_prependPublicKey(K,U,_,O=".env.keys"){const D=O===".env.keys"?"":` # -fk ${O}`;return["#/-------------------[DOTENV_PUBLIC_KEY]--------------------/","#/ public-key encryption for .env files /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/",`${K}="${U}"${D}`,"",`# ${_}`].join(`
|
|
22
|
-
`)}_preserveShebang(K){const[U,..._]=K.split(`
|
|
23
|
-
`);let O="";return U.startsWith("#!")&&(O=U+`
|
|
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(),s=requireErrors();class v{constructor(l,a=[],o=!1,h="",E=!1,T=null){this.key=l,this.envs=a,this.overload=o,this.DOTENV_KEY=h,this.all=E,this.envKeysFilepath=T}run(){const l={...process.env},{processedEnvs:a}=new e(this.envs,this.overload,this.DOTENV_KEY,l,this.envKeysFilepath).run(),o=[];for(const h of a)for(const E of h.errors)o.push(E);if(this.key){const h={},E=l[this.key];return h[this.key]=E,E===void 0&&o.push(new s({key:this.key}).missingKey()),{parsed:h,errors:o}}else{if(this.all)return{parsed:l,errors:o};const h={};for(const E of a)if(E.parsed)for(const T of Object.keys(E.parsed))h[T]=l[T];return{parsed:h,errors:o}}}}return get=v,get}var findEnvFiles_1,hasRequiredFindEnvFiles;function requireFindEnvFiles(){if(hasRequiredFindEnvFiles)return findEnvFiles_1;hasRequiredFindEnvFiles=1;const e=requireFsx(),s=[".env.vault",".env.project",".env.keys",".env.me",".env.x",".env.example"];function v(c){try{return e.readdirSync(c).filter(o=>o.startsWith(".env")&&!o.endsWith(".previous")&&!s.includes(o))}catch(l){if(l.code==="ENOENT"){const a=new Error(`missing directory (${c})`);throw a.code="MISSING_DIRECTORY",a}else throw l}}return findEnvFiles_1=v,findEnvFiles_1}var genexample,hasRequiredGenexample;function requireGenexample(){if(hasRequiredGenexample)return genexample;hasRequiredGenexample=1;const e=requireFsx(),s=require$$1__default,v=requireErrors(),c=requireFindEnvFiles(),l=requireReplace(),a=requireDotenvParse();class o{constructor(E=".",T){this.directory=E,this.envFile=T||c(E),this.exampleFilename=".env.example",this.exampleFilepath=s.resolve(this.directory,this.exampleFilename)}run(){if(this.envFile.length<1){const w="MISSING_ENV_FILES",B="no .env* files found",A='? add one with [echo "HELLO=World" > .env] and then run [dotenvx genexample]',N=new Error(B);throw N.code=w,N.help=A,N}const E=new Set,T=new Set,x=this._envFilepaths(),q={},S={};let L=`# ${this.exampleFilename} - generated with dotenvx
|
|
26
|
-
`;for(const w of x){const B=s.resolve(this.directory,w);if(!e.existsSync(B)){const $=new v({envFilepath:w,filepath:B}).missingEnvFile();throw $.help=`? add it with [echo "HELLO=World" > ${w}] and then run [dotenvx genexample]`,$}let A=e.readFileX(B);const N=a(A);for(const $ in N)E.add($),A=l(A,$,"");L+=`
|
|
27
|
-
${A}`}if(e.existsSync(this.exampleFilepath)){L=e.readFileX(this.exampleFilepath);const w=a(L);for(const B of[...E])B in w?S[B]=w[B]:(L+=`${B}=''
|
|
28
|
-
`,T.add(B),q[B]="")}else for(const w of[...E])T.add(w),q[w]="";return{envExampleFile:L,envFile:this.envFile,exampleFilepath:this.exampleFilepath,addedKeys:[...T],injected:q,preExisted:S}}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return genexample=o,genexample}var conventions_1,hasRequiredConventions;function requireConventions(){if(hasRequiredConventions)return conventions_1;hasRequiredConventions=1;function e(s){const v=process.env.DOTENV_ENV||process.env.NODE_ENV||"development";if(s==="nextjs"){const c=["development","test","production"].includes(v)&&v;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{if(s==="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: '${s}'. 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,s=require$$1__default;function v(c){return c[0]==="~"?s.join(e.homedir(),c.slice(1)):c}return resolveHome_1=v,resolveHome_1}var dotenvOptionPaths_1,hasRequiredDotenvOptionPaths;function requireDotenvOptionPaths(){if(hasRequiredDotenvOptionPaths)return dotenvOptionPaths_1;hasRequiredDotenvOptionPaths=1;const e=requireResolveHome();function s(v){let c=[];if(v&&v.path)if(!Array.isArray(v.path))c=[e(v.path)];else{c=[];for(const l of v.path)c.push(e(l))}return c}return dotenvOptionPaths_1=s,dotenvOptionPaths_1}var deprecationNotice,hasRequiredDeprecationNotice;function requireDeprecationNotice(){if(hasRequiredDeprecationNotice)return deprecationNotice;hasRequiredDeprecationNotice=1;const{logger:e}=requireLogger();class s{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=s,deprecationNotice}var buildEnvs_1,hasRequiredBuildEnvs;function requireBuildEnvs(){if(hasRequiredBuildEnvs)return buildEnvs_1;hasRequiredBuildEnvs=1;const e=require$$1__default,s=requireConventions(),v=requireDotenvOptionPaths(),c=requireDeprecationNotice();function l(a,o=void 0){const h=v(a);let E=[];a.convention&&(E=s(a.convention).concat(E)),new c({DOTENV_KEY:o}).dotenvKey();for(const T of h)o?E.push({type:"envVaultFile",value:e.join(e.dirname(T),".env.vault")}):E.push({type:"envFile",value:T});return E}return buildEnvs_1=l,buildEnvs_1}var ignore,hasRequiredIgnore;function requireIgnore(){if(hasRequiredIgnore)return ignore;hasRequiredIgnore=1;function e(y){return Array.isArray(y)?y:[y]}const s="",v=" ",c="\\",l=/^\s+$/,a=/(?:[^\\]|^)\\$/,o=/^\\!/,h=/^\\#/,E=/\r?\n/g,T=/^\.*\/|^\.+$/,x="/";let q="node-ignore";typeof Symbol<"u"&&(q=Symbol.for("node-ignore"));const S=q,L=(y,i,r)=>Object.defineProperty(y,i,{value:r}),w=/([0-z])-([0-z])/g,B=()=>!1,A=y=>y.replace(w,(i,r,p)=>r.charCodeAt(0)<=p.charCodeAt(0)?i:s),N=y=>{const{length:i}=y;return y.slice(0,i-i%2)},$=[[/^\uFEFF/,()=>s],[/((?:\\\\)*?)(\\?\s+)$/,(y,i,r)=>i+(r.indexOf("\\")===0?v:s)],[/(\\+?)\s/g,(y,i)=>{const{length:r}=i;return i.slice(0,r-r%2)+v}],[/[\\$.|*+(){^]/g,y=>`\\${y}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(y,i,r)=>i+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(y,i,r)=>{const p=r.replace(/\\\*/g,"[^\\/]*");return i+p}],[/\\\\\\(?=[$.|*+(){^])/g,()=>c],[/\\\\/g,()=>c],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(y,i,r,p,d)=>i===c?`\\[${r}${N(p)}${d}`:d==="]"&&p.length%2===0?`[${A(r)}${p}]`:"[]"],[/(?:[^*])$/,y=>/\/$/.test(y)?`${y}$`:`${y}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(y,i)=>`${i?`${i}[^/]+`:"[^/]*"}(?=$|\\/$)`]],K=Object.create(null),U=(y,i)=>{let r=K[y];return r||(r=$.reduce((p,[d,t])=>p.replace(d,t.bind(y)),y),K[y]=r),i?new RegExp(r,"i"):new RegExp(r)},_=y=>typeof y=="string",O=y=>y&&_(y)&&!l.test(y)&&!a.test(y)&&y.indexOf("#")!==0,D=y=>y.split(E);class F{constructor(i,r,p,d){this.origin=i,this.pattern=r,this.negative=p,this.regex=d}}const P=(y,i)=>{const r=y;let p=!1;y.indexOf("!")===0&&(p=!0,y=y.substr(1)),y=y.replace(o,"!").replace(h,"#");const d=U(y,i);return new F(r,y,p,d)},j=(y,i)=>{throw new i(y)},R=(y,i,r)=>_(y)?y?R.isNotRelative(y)?r(`path should be a \`path.relative()\`d string, but got "${i}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${i}\``,TypeError),M=y=>T.test(y);R.isNotRelative=M,R.convert=y=>y;class V{constructor({ignorecase:i=!0,ignoreCase:r=i,allowRelativePaths:p=!1}={}){L(this,S,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=p,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(i){if(i&&i[S]){this._rules=this._rules.concat(i._rules),this._added=!0;return}if(O(i)){const r=P(i,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(i){return this._added=!1,e(_(i)?D(i):i).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(i){return this.add(i)}_testOne(i,r){let p=!1,d=!1;return this._rules.forEach(t=>{const{negative:g}=t;if(d===g&&p!==d||g&&!p&&!d&&!r)return;t.regex.test(i)&&(p=!g,d=g)}),{ignored:p,unignored:d}}_test(i,r,p,d){const t=i&&R.convert(i);return R(t,i,this._allowRelativePaths?B:j),this._t(t,r,p,d)}_t(i,r,p,d){if(i in r)return r[i];if(d||(d=i.split(x)),d.pop(),!d.length)return r[i]=this._testOne(i,p);const t=this._t(d.join(x)+x,r,p,d);return r[i]=t.ignored?t:this._testOne(i,p)}ignores(i){return this._test(i,this._ignoreCache,!1).ignored}createFilter(){return i=>!this.ignores(i)}filter(i){return e(i).filter(this.createFilter())}test(i){return this._test(i,this._testCache,!0)}}const H=y=>new V(y),u=y=>R(y&&R.convert(y),y,B);if(H.isPathValid=u,H.default=H,ignore=H,typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){const y=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");R.convert=y;const i=/^[a-z]:\//i;R.isNotRelative=r=>i.test(r)||M(r)}return ignore}var isIgnoringDotenvKeys_1,hasRequiredIsIgnoringDotenvKeys;function requireIsIgnoringDotenvKeys(){if(hasRequiredIsIgnoringDotenvKeys)return isIgnoringDotenvKeys_1;hasRequiredIsIgnoringDotenvKeys=1;const e=requireFsx(),s=requireIgnore();function v(){if(!e.existsSync(".gitignore"))return!1;const c=e.readFileX(".gitignore");return!!s(c).add(c).ignores(".env.keys")}return isIgnoringDotenvKeys_1=v,isIgnoringDotenvKeys_1}var main,hasRequiredMain;function requireMain(){if(hasRequiredMain)return main;hasRequiredMain=1;const e=require$$1__default,{setLogLevel:s,setLogName:v,setLogVersion:c,logger:l}=requireLogger(),{getColor:a,bold:o}=requireColors(),h=requireLs(),E=requireRun(),T=requireSets(),x=requireGet(),q=requireKeypair$1(),S=requireGenexample(),L=requireBuildEnvs(),w=requireParse(),B=requireFsx(),A=requireIsIgnoringDotenvKeys();return main={config:function(F={}){let P=process.env;F&&F.processEnv!=null&&(P=F.processEnv);const j=F.overload||F.override,R=F.ignore||[],M=F.strict,V=F.envKeysFile;let H=process.env.DOTENV_KEY;F&&F.DOTENV_KEY&&(H=F.DOTENV_KEY);const u=F.opsOff!==!0;F&&(s(F),v(F),c(F));try{const y=L(F,H),{processedEnvs:i,readableFilepaths:r,uniqueInjectedKeys:p}=new E(y,j,H,P,V,u).run();let d;const t={};for(const m of i){m.type==="envVaultFile"&&(l.verbose(`loading env from encrypted ${m.filepath} (${e.resolve(m.filepath)})`),l.debug(`decrypting encrypted env from ${m.filepath} (${e.resolve(m.filepath)})`)),m.type==="envFile"&&l.verbose(`loading env from ${m.filepath} (${e.resolve(m.filepath)})`);for(const f of m.errors||[]){if(R.includes(f.code)){l.verbose(`ignored: ${f.message}`);continue}if(M)throw f;d=f,f.code==="MISSING_ENV_FILE"&&F.convention||(l.error(f.message),f.help&&l.error(f.help))}Object.assign(t,m.injected||{}),Object.assign(t,m.preExisted||{}),l.debug(m.parsed);for(const[f,b]of Object.entries(m.injected||{}))l.verbose(`${f} set`),l.debug(`${f} set to ${b}`);for(const[f,b]of Object.entries(m.preExisted||{}))l.verbose(`${f} pre-exists (protip: use --overload to override)`),l.debug(`${f} pre-exists as ${b} (protip: use --overload to override)`)}let g=`injecting env (${p.length})`;return r.length>0&&(g+=` from ${r.join(", ")}`),l.successv(g),d?{parsed:t,error:d}:{parsed:t}}catch(y){if(M)throw y;return l.error(y.message),y.help&&l.help(y.help),{parsed:{},error:y}}},parse:function(F,P={}){let j=process.env;P&&P.processEnv!=null&&(j=P.processEnv);const R=P.privateKey||null,M=P.overload||P.override,{parsed:V,errors:H}=new w(F,R,j,M).run();for(const u of H)l.error(u.message),u.help&&l.error(u.help);return V},set:function(F,P,j={}){let R=!0;(j.plain||j.encrypt===!1)&&(R=!1),j&&(s(j),v(j),c(j));const M=L(j),V=j.envKeysFile,{processedEnvs:H,changedFilepaths:u,unchangedFilepaths:y}=new T(F,P,M,R,V).run();let i="";R&&(i=" with encryption");for(const r of H)l.verbose(`setting for ${r.envFilepath}`),r.error?r.error.code==="MISSING_ENV_FILE"?(l.warn(r.error.message),l.help(`? add one with [echo "HELLO=World" > ${r.envFilepath}] and re-run [dotenvx set]`)):(l.warn(r.error.message),r.error.help&&l.help(r.error.help)):(B.writeFileX(r.filepath,r.envSrc),l.verbose(`${r.key} set${i} (${r.envFilepath})`),l.debug(`${r.key} set${i} to ${r.value} (${r.envFilepath})`));u.length>0?l.success(`\u2714 set ${F}${i} (${u.join(",")})`):y.length>0&&l.info(`no changes (${y})`);for(const r of H)r.privateKeyAdded&&(l.success(`\u2714 key added to ${r.envKeysFilepath} (${r.privateKeyName})`),l.help("\u2B95 optional: [dotenvx ops backup] to securely backup private key"),A()||l.help("\u2B95 next run: [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys"),l.help(`\u2B95 next run: [${r.privateKeyName}='${r.privateKey}' dotenvx get ${F}] to test decryption locally`));return{processedEnvs:H,changedFilepaths:u,unchangedFilepaths:y}},get:function(F,P={}){const j=L(P),R=P.ignore||[],{parsed:M,errors:V}=new x(F,j,P.overload,process.env.DOTENV_KEY,P.all,P.envKeysFile).run();for(const H of V||[])if(!R.includes(H.code)){if(P.strict)throw H;l.error(H.message),H.help&&l.error(H.help)}if(F){const H=M[F];return H===void 0?void 0:H}else if(P.format==="eval"){let H="";for(const[u,y]of Object.entries(M))H+=`${u}=${escape(y)}
|
|
29
|
-
`;return H=H.trim(),H}else if(P.format==="shell"){let H="";for(const[u,y]of Object.entries(M))H+=`${u}=${y} `;return H=H.trim(),H}else return M},ls:function(F,P,j){return new h(F,P,j).run()},keypair:function(F,P,j=null){const R=new q(F,j).run();return P?R[P]:R},genexample:function(F,P){return new S(F,P).run()},setLogLevel:s,logger:l,getColor:a,bold:o},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(s=>{const v=process.env[s];if(v==null)throw new Error(`Missing required environment variable: ${s}`);this.envVars[s]=v})}static getInstance(){return ConfigProvider.instance||(ConfigProvider.instance=new ConfigProvider),ConfigProvider.instance}getConfig(s){return this.envVars[s]}}function isIndexedItem(e){return typeof e=="object"&&e!==null&&"objectID"in e&&typeof e.objectID=="string"}function I$1(e){const s=Object.keys(e).sort(),v={objectID:e.objectID};for(const c of s)c!=="objectID"&&(v[c]=e[c]);return v}function normalizeIndexedItemArray(e){return e.map(I$1).sort((s,v)=>s.objectID.localeCompare(v.objectID))}class Uploader{client;indexName;constructor(s){this.client=s.getClient(),this.indexName=s.getIndexName()}async uploadObjects(s){if(s.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 c=normalizeIndexedItemArray(s),l=this.determineOperations(v,c);if(l.update.length===0&&l.add.length===0&&l.delete.length===0){console.log("No updates needed. All objects are up to date.");return}if(l.update.length>0){const a=await this.client.partialUpdateObjects({indexName:this.indexName,objects:l.update,createIfNotExists:!0});console.log(`Updated ${a[0].objectIDs.length} objects`)}if(l.add.length>0){const a=await this.client.saveObjects({indexName:this.indexName,objects:l.add});console.log(`Added ${a[0].objectIDs.length} objects`)}if(l.delete.length>0){const a=l.delete.map(h=>h.objectID),o=await this.client.deleteObjects({indexName:this.indexName,objectIDs:a});console.log(`Deleted ${o[0].objectIDs.length} objects`)}}async getAllObjects(){const s=[];return await this.client.browseObjects({indexName:this.indexName,aggregator:v=>{Array.isArray(v.hits)&&v.hits.forEach(c=>{isIndexedItem(c)&&s.push(c)})}}),s}determineOperations(s,v){const c=new Map(s.map(o=>[o.objectID,o])),l=new Map(v.map(o=>[o.objectID,o])),a={update:[],add:[],delete:[]};for(const o of v){const h=c.get(o.objectID);h==null?a.add.push(o):esToolkit.isEqual(h,o)||a.update.push(o)}for(const o of s)l.has(o.objectID)||a.delete.push(o);return a}}class AlgoliaClientProvider{static instance;client;indexName;constructor(s,v){this.client=v(s.getConfig("ALGOLIA_APP_ID"),s.getConfig("ALGOLIA_ADMIN_API_KEY")),this.indexName=s.getConfig("ALGOLIA_INDEX_NAME")}static getInstance(){if(!this.instance){const s=ConfigProvider.getInstance();this.instance=new AlgoliaClientProvider(s,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 s=ConfigProvider.getInstance().getConfig("DATA_DIR");s=require$$1__default.join(process.cwd(),s),require$$0__default.existsSync(s)&&require$$0__default.statSync(s).isDirectory()||(console.error(`Error: provided directory does not exist - ${s}`),process.exit(1));const v=readAllJsonFiles(s)[0];v.every(l=>isIndexedItem(l))||(console.error(`The content of the provided json file is incompatible. Check the file: ${s}`),process.exit(1));const c=AlgoliaClientProvider.getInstance();await new Uploader(c).uploadObjects(v)}catch(s){console.error("Some errors occured: ",s),process.exit(1)}}});citty.runMain(I);
|
package/dist/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/dist/index.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/dist/index.mjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{defineCommand as Ko,runMain as qo}from"citty";import qe from"fs";import Ie from"path";import Vo from"tty";import kn from"os";import ko from"crypto";import{createRequire as Fo}from"node:module";import Fn from"child_process";import{isEqual as jo}from"es-toolkit";import{algoliasearch as Uo}from"algoliasearch";const Mo="algolia-uploader",Go="0.0.12",Yo="command-line util to upload Algolia source";function $o(e){return qe.readdirSync(e).filter(r=>r.endsWith(".json")).map(r=>{const y=qe.readFileSync(Ie.join(e,r),"utf8");return JSON.parse(y)})}function jn(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var y=function i(){var u=!1;try{u=this instanceof i}catch{}return u?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};y.prototype=r.prototype}else y={};return Object.defineProperty(y,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var u=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(y,i,u.get?u:{enumerable:!0,get:function(){return e[i]}})}),y}var Un={};const Mn="1.54.1",Gn="@dotenvx/dotenvx",Yn="a secure dotenv\u2013from the creator of `dotenv`",$n="@motdotla",Zn=["dotenv","env"],Xn="https://github.com/dotenvx/dotenvx",Wn={type:"git",url:"git+https://github.com/dotenvx/dotenvx.git"},zn="BSD-3-Clause",Qn=["src/**/*","CHANGELOG.md"],Jn="src/lib/main.js",er="src/lib/main.d.ts",tr={".":{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"},nr={dotenvx:"./src/cli/dotenvx.js"},rr={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"},sr="https://dotenvx.com",or={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"},ir={"@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"},cr={access:"public",provenance:!0},Zo={version:Mn,name:Gn,description:Yn,author:$n,keywords:Zn,homepage:Xn,repository:Wn,license:zn,files:Qn,main:Jn,types:er,exports:tr,bin:nr,scripts:rr,funding:sr,dependencies:or,devDependencies:ir,publishConfig:cr},Xo={__proto__:null,author:$n,bin:nr,default:Zo,dependencies:or,description:Yn,devDependencies:ir,exports:tr,files:Qn,funding:sr,homepage:Xn,keywords:Zn,license:zn,main:Jn,name:Gn,publishConfig:cr,repository:Wn,scripts:rr,types:er,version:Mn},Wo=jn(Xo);var ht,ar;function zo(){if(ar)return ht;ar=1;const{name:e,version:r,description:y}=Wo;return ht={name:e,version:r,description:y},ht}var pt,ur;function Qo(){if(ur)return pt;ur=1;const{WriteStream:e}=Vo;return pt={getColorDepth:()=>{try{return e.prototype.getColorDepth()}catch{const i=process.env.TERM;return i&&(i.includes("256color")||i.includes("xterm"))?8:4}}},pt}var yt,lr;function fr(){if(lr)return yt;lr=1;const e=Qo(),r=new Map([["blue",34],["gray",37],["green",32],["olive",33],["orangered",31],["plum",35],["red",31],["electricblue",36],["dodgerblue",36]]),y=new Map([["blue",21],["gray",244],["green",34],["olive",142],["orangered",202],["plum",182],["red",196],["electricblue",45],["dodgerblue",33]]);function i(c){const s=e.getColorDepth();if(!y.has(c))throw new Error(`Invalid color ${c}`);if(s>=8){const d=y.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 u(c){return e.getColorDepth()>=4?`\x1B[1m${c}\x1B[22m`:c}return yt={getColor:i,bold:u},yt}var vt,dr;function hr(){if(dr)return vt;dr=1;const e=zo(),{getColor:r,bold:y}=fr(),i={error:0,warn:1,success:2,successv:2,info:2,help:2,verbose:4,debug:5,silly:6},u=E=>y(r("red")(E)),c=r("orangered"),s=r("green"),d=r("olive"),b=r("dodgerblue"),I=r("plum"),A=r("plum");let D=i.info,w="dotenvx",P=e.version;function _(E,R){const H=S(E,R);console.error(H)}function x(E,R){if(i[E]===void 0)throw new Error(`MISSING_LOG_LEVEL: '${E}'. implement in logger.`);if(i[E]<=D){const H=S(E,R);console.log(H)}}function S(E,R){const H=typeof R=="object"?JSON.stringify(R):R;switch(E.toLowerCase()){case"error":return u(H);case"warn":return c(H);case"success":return s(H);case"successv":return d(`[${w}@${P}] ${H}`);case"info":return H;case"help":return b(H);case"verbose":return I(H);case"debug":return A(H)}}const O={level:"info",error:E=>_("error",E),warn:E=>x("warn",E),success:E=>x("success",E),successv:E=>x("successv",E),info:E=>x("info",E),help:E=>x("help",E),verbose:E=>x("verbose",E),debug:E=>x("debug",E),setLevel:E=>{i[E]!==void 0&&(D=i[E],O.level=E)},setName:E=>{w=E,O.name=E},setVersion:E=>{P=E,O.version=E}};function M(E){const R=E.debug?"debug":E.verbose?"verbose":E.quiet?"error":E.logLevel;R&&(O.setLevel(R),(!E.quiet||E.quiet&&R!=="error")&&O.debug(`Setting log level to ${R}`))}function L(E){const R=E.logName;R&&O.setName(R)}function F(E){const R=E.logVersion;R&&O.setVersion(R)}return vt={logger:O,getColor:r,setLogLevel:M,setLogName:L,setLogVersion:F,levels:i},vt}var gt={},mt={},bt,pr;function ct(){if(pr)return bt;pr=1;const e="\\\\/",r=`[^${e}]`,y="\\.",i="\\+",u="\\?",c="\\/",s="(?=.)",d="[^/]",b=`(?:${c}|$)`,I=`(?:^|${c})`,A=`${y}{1,2}${b}`,D=`(?!${y})`,w=`(?!${I}${A})`,P=`(?!${y}{0,1}${b})`,_=`(?!${A})`,x=`[^.${c}]`,S=`${d}*?`,M={DOT_LITERAL:y,PLUS_LITERAL:i,QMARK_LITERAL:u,SLASH_LITERAL:c,ONE_CHAR:s,QMARK:d,END_ANCHOR:b,DOTS_SLASH:A,NO_DOT:D,NO_DOTS:w,NO_DOT_SLASH:P,NO_DOTS_SLASH:_,QMARK_NO_DOT:x,STAR:S,START_ANCHOR:I,SEP:"/"},L={...M,SLASH_LITERAL:`[${e}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${y}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${y})`,NO_DOTS:`(?!(?:^|[${e}])${y}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${y}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${y}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`,SEP:"\\"},F={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 bt={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:F,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(E){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${E.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(E){return E===!0?L:M}},bt}var yr;function at(){return yr||(yr=1,(function(e){const{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:y,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:u}=ct();e.isObject=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),e.hasRegexChars=c=>i.test(c),e.isRegexChar=c=>c.length===1&&e.hasRegexChars(c),e.escapeRegex=c=>c.replace(u,"\\$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(y,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?"":"^",I=d.contains?"":"$";let A=`${b}(?:${c})${I}`;return s.negated===!0&&(A=`(?:^(?!${A}).*$)`),A},e.basename=(c,{windows:s}={})=>{const d=c.split(s?/[\\/]/:"/"),b=d[d.length-1];return b===""?d[d.length-2]:b}})(mt)),mt}var Et,vr;function Jo(){if(vr)return Et;vr=1;const e=at(),{CHAR_ASTERISK:r,CHAR_AT:y,CHAR_BACKWARD_SLASH:i,CHAR_COMMA:u,CHAR_DOT:c,CHAR_EXCLAMATION_MARK:s,CHAR_FORWARD_SLASH:d,CHAR_LEFT_CURLY_BRACE:b,CHAR_LEFT_PARENTHESES:I,CHAR_LEFT_SQUARE_BRACKET:A,CHAR_PLUS:D,CHAR_QUESTION_MARK:w,CHAR_RIGHT_CURLY_BRACE:P,CHAR_RIGHT_PARENTHESES:_,CHAR_RIGHT_SQUARE_BRACKET:x}=ct(),S=L=>L===d||L===i,O=L=>{L.isPrefix!==!0&&(L.depth=L.isGlobstar?1/0:1)};return Et=(L,F)=>{const E=F||{},R=L.length-1,H=E.parts===!0||E.scanToEnd===!0,k=[],N=[],V=[];let B=L,j=-1,K=0,C=0,a=!1,p=!1,o=!1,n=!1,h=!1,f=!1,t=!1,v=!1,g=!1,l=!1,m=0,Q,$,q={value:"",depth:0,isGlob:!1};const G=()=>j>=R,X=()=>B.charCodeAt(j+1),z=()=>(Q=$,B.charCodeAt(++j));for(;j<R;){$=z();let ce;if($===i){t=q.backslashes=!0,$=z(),$===b&&(f=!0);continue}if(f===!0||$===b){for(m++;G()!==!0&&($=z());){if($===i){t=q.backslashes=!0,z();continue}if($===b){m++;continue}if(f!==!0&&$===c&&($=z())===c){if(a=q.isBrace=!0,o=q.isGlob=!0,l=!0,H===!0)continue;break}if(f!==!0&&$===u){if(a=q.isBrace=!0,o=q.isGlob=!0,l=!0,H===!0)continue;break}if($===P&&(m--,m===0)){f=!1,a=q.isBrace=!0,l=!0;break}}if(H===!0)continue;break}if($===d){if(k.push(j),N.push(q),q={value:"",depth:0,isGlob:!1},l===!0)continue;if(Q===c&&j===K+1){K+=2;continue}C=j+1;continue}if(E.noext!==!0&&($===D||$===y||$===r||$===w||$===s)===!0&&X()===I){if(o=q.isGlob=!0,n=q.isExtglob=!0,l=!0,$===s&&j===K&&(g=!0),H===!0){for(;G()!==!0&&($=z());){if($===i){t=q.backslashes=!0,$=z();continue}if($===_){o=q.isGlob=!0,l=!0;break}}continue}break}if($===r){if(Q===r&&(h=q.isGlobstar=!0),o=q.isGlob=!0,l=!0,H===!0)continue;break}if($===w){if(o=q.isGlob=!0,l=!0,H===!0)continue;break}if($===A){for(;G()!==!0&&(ce=z());){if(ce===i){t=q.backslashes=!0,z();continue}if(ce===x){p=q.isBracket=!0,o=q.isGlob=!0,l=!0;break}}if(H===!0)continue;break}if(E.nonegate!==!0&&$===s&&j===K){v=q.negated=!0,K++;continue}if(E.noparen!==!0&&$===I){if(o=q.isGlob=!0,H===!0){for(;G()!==!0&&($=z());){if($===I){t=q.backslashes=!0,$=z();continue}if($===_){l=!0;break}}continue}break}if(o===!0){if(l=!0,H===!0)continue;break}}E.noext===!0&&(n=!1,o=!1);let ee=B,U="",Z="";K>0&&(U=B.slice(0,K),B=B.slice(K),C-=K),ee&&o===!0&&C>0?(ee=B.slice(0,C),Z=B.slice(C)):o===!0?(ee="",Z=B):ee=B,ee&&ee!==""&&ee!=="/"&&ee!==B&&S(ee.charCodeAt(ee.length-1))&&(ee=ee.slice(0,-1)),E.unescape===!0&&(Z&&(Z=e.removeBackslashes(Z)),ee&&t===!0&&(ee=e.removeBackslashes(ee)));const te={prefix:U,input:L,start:K,base:ee,glob:Z,isBrace:a,isBracket:p,isGlob:o,isExtglob:n,isGlobstar:h,negated:v,negatedExtglob:g};if(E.tokens===!0&&(te.maxDepth=0,S($)||N.push(q),te.tokens=N),E.parts===!0||E.tokens===!0){let ce;for(let le=0;le<k.length;le++){const ne=ce?ce+1:K,de=k[le],W=L.slice(ne,de);E.tokens&&(le===0&&K!==0?(N[le].isPrefix=!0,N[le].value=U):N[le].value=W,O(N[le]),te.maxDepth+=N[le].depth),(le!==0||W!=="")&&V.push(W),ce=de}if(ce&&ce+1<L.length){const le=L.slice(ce+1);V.push(le),E.tokens&&(N[N.length-1].value=le,O(N[N.length-1]),te.maxDepth+=N[N.length-1].depth)}te.slashes=k,te.parts=V}return te},Et}var _t,gr;function ei(){if(gr)return _t;gr=1;const e=ct(),r=at(),{MAX_LENGTH:y,POSIX_REGEX_SOURCE:i,REGEX_NON_SPECIAL_CHARS:u,REGEX_SPECIAL_CHARS_BACKREF:c,REPLACEMENTS:s}=e,d=(A,D)=>{if(typeof D.expandRange=="function")return D.expandRange(...A,D);A.sort();const w=`[${A.join("-")}]`;try{new RegExp(w)}catch{return A.map(_=>r.escapeRegex(_)).join("..")}return w},b=(A,D)=>`Missing ${A}: "${D}" - use "\\\\${D}" to match literal characters`,I=(A,D)=>{if(typeof A!="string")throw new TypeError("Expected a string");A=s[A]||A;const w={...D},P=typeof w.maxLength=="number"?Math.min(y,w.maxLength):y;let _=A.length;if(_>P)throw new SyntaxError(`Input length: ${_}, exceeds maximum allowed length: ${P}`);const x={type:"bos",value:"",output:w.prepend||""},S=[x],O=w.capture?"":"?:",M=e.globChars(w.windows),L=e.extglobChars(M),{DOT_LITERAL:F,PLUS_LITERAL:E,SLASH_LITERAL:R,ONE_CHAR:H,DOTS_SLASH:k,NO_DOT:N,NO_DOT_SLASH:V,NO_DOTS_SLASH:B,QMARK:j,QMARK_NO_DOT:K,STAR:C,START_ANCHOR:a}=M,p=ne=>`(${O}(?:(?!${a}${ne.dot?k:F}).)*?)`,o=w.dot?"":N,n=w.dot?j:K;let h=w.bash===!0?p(w):C;w.capture&&(h=`(${h})`),typeof w.noext=="boolean"&&(w.noextglob=w.noext);const f={input:A,index:-1,start:0,dot:w.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:S};A=r.removePrefix(A,f),_=A.length;const t=[],v=[],g=[];let l=x,m;const Q=()=>f.index===_-1,$=f.peek=(ne=1)=>A[f.index+ne],q=f.advance=()=>A[++f.index]||"",G=()=>A.slice(f.index+1),X=(ne="",de=0)=>{f.consumed+=ne,f.index+=de},z=ne=>{f.output+=ne.output!=null?ne.output:ne.value,X(ne.value)},ee=()=>{let ne=1;for(;$()==="!"&&($(2)!=="("||$(3)==="?");)q(),f.start++,ne++;return ne%2===0?!1:(f.negated=!0,f.start++,!0)},U=ne=>{f[ne]++,g.push(ne)},Z=ne=>{f[ne]--,g.pop()},te=ne=>{if(l.type==="globstar"){const de=f.braces>0&&(ne.type==="comma"||ne.type==="brace"),W=ne.extglob===!0||t.length&&(ne.type==="pipe"||ne.type==="paren");ne.type!=="slash"&&ne.type!=="paren"&&!de&&!W&&(f.output=f.output.slice(0,-l.output.length),l.type="star",l.value="*",l.output=h,f.output+=l.output)}if(t.length&&ne.type!=="paren"&&(t[t.length-1].inner+=ne.value),(ne.value||ne.output)&&z(ne),l&&l.type==="text"&&ne.type==="text"){l.output=(l.output||l.value)+ne.value,l.value+=ne.value;return}ne.prev=l,S.push(ne),l=ne},ce=(ne,de)=>{const W={...L[de],conditions:1,inner:""};W.prev=l,W.parens=f.parens,W.output=f.output;const pe=(w.capture?"(":"")+W.open;U("parens"),te({type:ne,value:de,output:f.output?"":H}),te({type:"paren",extglob:!0,value:q(),output:pe}),t.push(W)},le=ne=>{let de=ne.close+(w.capture?")":""),W;if(ne.type==="negate"){let pe=h;if(ne.inner&&ne.inner.length>1&&ne.inner.includes("/")&&(pe=p(w)),(pe!==h||Q()||/^\)+$/.test(G()))&&(de=ne.close=`)$))${pe}`),ne.inner.includes("*")&&(W=G())&&/^\.[^\\/.]+$/.test(W)){const me=I(W,{...D,fastpaths:!1}).output;de=ne.close=`)${me})${pe})`}ne.prev.type==="bos"&&(f.negatedExtglob=!0)}te({type:"paren",extglob:!0,value:m,output:de}),Z("parens")};if(w.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(A)){let ne=!1,de=A.replace(c,(W,pe,me,fe,J,se)=>fe==="\\"?(ne=!0,W):fe==="?"?pe?pe+fe+(J?j.repeat(J.length):""):se===0?n+(J?j.repeat(J.length):""):j.repeat(me.length):fe==="."?F.repeat(me.length):fe==="*"?pe?pe+fe+(J?h:""):h:pe?W:`\\${W}`);return ne===!0&&(w.unescape===!0?de=de.replace(/\\/g,""):de=de.replace(/\\+/g,W=>W.length%2===0?"\\\\":W?"\\":"")),de===A&&w.contains===!0?(f.output=A,f):(f.output=r.wrapOutput(de,f,D),f)}for(;!Q();){if(m=q(),m==="\0")continue;if(m==="\\"){const W=$();if(W==="/"&&w.bash!==!0||W==="."||W===";")continue;if(!W){m+="\\",te({type:"text",value:m});continue}const pe=/^\\+/.exec(G());let me=0;if(pe&&pe[0].length>2&&(me=pe[0].length,f.index+=me,me%2!==0&&(m+="\\")),w.unescape===!0?m=q():m+=q(),f.brackets===0){te({type:"text",value:m});continue}}if(f.brackets>0&&(m!=="]"||l.value==="["||l.value==="[^")){if(w.posix!==!1&&m===":"){const W=l.value.slice(1);if(W.includes("[")&&(l.posix=!0,W.includes(":"))){const pe=l.value.lastIndexOf("["),me=l.value.slice(0,pe),fe=l.value.slice(pe+2),J=i[fe];if(J){l.value=me+J,f.backtrack=!0,q(),!x.output&&S.indexOf(l)===1&&(x.output=H);continue}}}(m==="["&&$()!==":"||m==="-"&&$()==="]")&&(m=`\\${m}`),m==="]"&&(l.value==="["||l.value==="[^")&&(m=`\\${m}`),w.posix===!0&&m==="!"&&l.value==="["&&(m="^"),l.value+=m,z({value:m});continue}if(f.quotes===1&&m!=='"'){m=r.escapeRegex(m),l.value+=m,z({value:m});continue}if(m==='"'){f.quotes=f.quotes===1?0:1,w.keepQuotes===!0&&te({type:"text",value:m});continue}if(m==="("){U("parens"),te({type:"paren",value:m});continue}if(m===")"){if(f.parens===0&&w.strictBrackets===!0)throw new SyntaxError(b("opening","("));const W=t[t.length-1];if(W&&f.parens===W.parens+1){le(t.pop());continue}te({type:"paren",value:m,output:f.parens?")":"\\)"}),Z("parens");continue}if(m==="["){if(w.nobracket===!0||!G().includes("]")){if(w.nobracket!==!0&&w.strictBrackets===!0)throw new SyntaxError(b("closing","]"));m=`\\${m}`}else U("brackets");te({type:"bracket",value:m});continue}if(m==="]"){if(w.nobracket===!0||l&&l.type==="bracket"&&l.value.length===1){te({type:"text",value:m,output:`\\${m}`});continue}if(f.brackets===0){if(w.strictBrackets===!0)throw new SyntaxError(b("opening","["));te({type:"text",value:m,output:`\\${m}`});continue}Z("brackets");const W=l.value.slice(1);if(l.posix!==!0&&W[0]==="^"&&!W.includes("/")&&(m=`/${m}`),l.value+=m,z({value:m}),w.literalBrackets===!1||r.hasRegexChars(W))continue;const pe=r.escapeRegex(l.value);if(f.output=f.output.slice(0,-l.value.length),w.literalBrackets===!0){f.output+=pe,l.value=pe;continue}l.value=`(${O}${pe}|${l.value})`,f.output+=l.value;continue}if(m==="{"&&w.nobrace!==!0){U("braces");const W={type:"brace",value:m,output:"(",outputIndex:f.output.length,tokensIndex:f.tokens.length};v.push(W),te(W);continue}if(m==="}"){const W=v[v.length-1];if(w.nobrace===!0||!W){te({type:"text",value:m,output:m});continue}let pe=")";if(W.dots===!0){const me=S.slice(),fe=[];for(let J=me.length-1;J>=0&&(S.pop(),me[J].type!=="brace");J--)me[J].type!=="dots"&&fe.unshift(me[J].value);pe=d(fe,w),f.backtrack=!0}if(W.comma!==!0&&W.dots!==!0){const me=f.output.slice(0,W.outputIndex),fe=f.tokens.slice(W.tokensIndex);W.value=W.output="\\{",m=pe="\\}",f.output=me;for(const J of fe)f.output+=J.output||J.value}te({type:"brace",value:m,output:pe}),Z("braces"),v.pop();continue}if(m==="|"){t.length>0&&t[t.length-1].conditions++,te({type:"text",value:m});continue}if(m===","){let W=m;const pe=v[v.length-1];pe&&g[g.length-1]==="braces"&&(pe.comma=!0,W="|"),te({type:"comma",value:m,output:W});continue}if(m==="/"){if(l.type==="dot"&&f.index===f.start+1){f.start=f.index+1,f.consumed="",f.output="",S.pop(),l=x;continue}te({type:"slash",value:m,output:R});continue}if(m==="."){if(f.braces>0&&l.type==="dot"){l.value==="."&&(l.output=F);const W=v[v.length-1];l.type="dots",l.output+=m,l.value+=m,W.dots=!0;continue}if(f.braces+f.parens===0&&l.type!=="bos"&&l.type!=="slash"){te({type:"text",value:m,output:F});continue}te({type:"dot",value:m,output:F});continue}if(m==="?"){if(!(l&&l.value==="(")&&w.noextglob!==!0&&$()==="("&&$(2)!=="?"){ce("qmark",m);continue}if(l&&l.type==="paren"){const pe=$();let me=m;(l.value==="("&&!/[!=<:]/.test(pe)||pe==="<"&&!/<([!=]|\w+>)/.test(G()))&&(me=`\\${m}`),te({type:"text",value:m,output:me});continue}if(w.dot!==!0&&(l.type==="slash"||l.type==="bos")){te({type:"qmark",value:m,output:K});continue}te({type:"qmark",value:m,output:j});continue}if(m==="!"){if(w.noextglob!==!0&&$()==="("&&($(2)!=="?"||!/[!=<:]/.test($(3)))){ce("negate",m);continue}if(w.nonegate!==!0&&f.index===0){ee();continue}}if(m==="+"){if(w.noextglob!==!0&&$()==="("&&$(2)!=="?"){ce("plus",m);continue}if(l&&l.value==="("||w.regex===!1){te({type:"plus",value:m,output:E});continue}if(l&&(l.type==="bracket"||l.type==="paren"||l.type==="brace")||f.parens>0){te({type:"plus",value:m});continue}te({type:"plus",value:E});continue}if(m==="@"){if(w.noextglob!==!0&&$()==="("&&$(2)!=="?"){te({type:"at",extglob:!0,value:m,output:""});continue}te({type:"text",value:m});continue}if(m!=="*"){(m==="$"||m==="^")&&(m=`\\${m}`);const W=u.exec(G());W&&(m+=W[0],f.index+=W[0].length),te({type:"text",value:m});continue}if(l&&(l.type==="globstar"||l.star===!0)){l.type="star",l.star=!0,l.value+=m,l.output=h,f.backtrack=!0,f.globstar=!0,X(m);continue}let ne=G();if(w.noextglob!==!0&&/^\([^?]/.test(ne)){ce("star",m);continue}if(l.type==="star"){if(w.noglobstar===!0){X(m);continue}const W=l.prev,pe=W.prev,me=W.type==="slash"||W.type==="bos",fe=pe&&(pe.type==="star"||pe.type==="globstar");if(w.bash===!0&&(!me||ne[0]&&ne[0]!=="/")){te({type:"star",value:m,output:""});continue}const J=f.braces>0&&(W.type==="comma"||W.type==="brace"),se=t.length&&(W.type==="pipe"||W.type==="paren");if(!me&&W.type!=="paren"&&!J&&!se){te({type:"star",value:m,output:""});continue}for(;ne.slice(0,3)==="/**";){const re=A[f.index+4];if(re&&re!=="/")break;ne=ne.slice(3),X("/**",3)}if(W.type==="bos"&&Q()){l.type="globstar",l.value+=m,l.output=p(w),f.output=l.output,f.globstar=!0,X(m);continue}if(W.type==="slash"&&W.prev.type!=="bos"&&!fe&&Q()){f.output=f.output.slice(0,-(W.output+l.output).length),W.output=`(?:${W.output}`,l.type="globstar",l.output=p(w)+(w.strictSlashes?")":"|$)"),l.value+=m,f.globstar=!0,f.output+=W.output+l.output,X(m);continue}if(W.type==="slash"&&W.prev.type!=="bos"&&ne[0]==="/"){const re=ne[1]!==void 0?"|$":"";f.output=f.output.slice(0,-(W.output+l.output).length),W.output=`(?:${W.output}`,l.type="globstar",l.output=`${p(w)}${R}|${R}${re})`,l.value+=m,f.output+=W.output+l.output,f.globstar=!0,X(m+q()),te({type:"slash",value:"/",output:""});continue}if(W.type==="bos"&&ne[0]==="/"){l.type="globstar",l.value+=m,l.output=`(?:^|${R}|${p(w)}${R})`,f.output=l.output,f.globstar=!0,X(m+q()),te({type:"slash",value:"/",output:""});continue}f.output=f.output.slice(0,-l.output.length),l.type="globstar",l.output=p(w),l.value+=m,f.output+=l.output,f.globstar=!0,X(m);continue}const de={type:"star",value:m,output:h};if(w.bash===!0){de.output=".*?",(l.type==="bos"||l.type==="slash")&&(de.output=o+de.output),te(de);continue}if(l&&(l.type==="bracket"||l.type==="paren")&&w.regex===!0){de.output=m,te(de);continue}(f.index===f.start||l.type==="slash"||l.type==="dot")&&(l.type==="dot"?(f.output+=V,l.output+=V):w.dot===!0?(f.output+=B,l.output+=B):(f.output+=o,l.output+=o),$()!=="*"&&(f.output+=H,l.output+=H)),te(de)}for(;f.brackets>0;){if(w.strictBrackets===!0)throw new SyntaxError(b("closing","]"));f.output=r.escapeLast(f.output,"["),Z("brackets")}for(;f.parens>0;){if(w.strictBrackets===!0)throw new SyntaxError(b("closing",")"));f.output=r.escapeLast(f.output,"("),Z("parens")}for(;f.braces>0;){if(w.strictBrackets===!0)throw new SyntaxError(b("closing","}"));f.output=r.escapeLast(f.output,"{"),Z("braces")}if(w.strictSlashes!==!0&&(l.type==="star"||l.type==="bracket")&&te({type:"maybe_slash",value:"",output:`${R}?`}),f.backtrack===!0){f.output="";for(const ne of f.tokens)f.output+=ne.output!=null?ne.output:ne.value,ne.suffix&&(f.output+=ne.suffix)}return f};return I.fastpaths=(A,D)=>{const w={...D},P=typeof w.maxLength=="number"?Math.min(y,w.maxLength):y,_=A.length;if(_>P)throw new SyntaxError(`Input length: ${_}, exceeds maximum allowed length: ${P}`);A=s[A]||A;const{DOT_LITERAL:x,SLASH_LITERAL:S,ONE_CHAR:O,DOTS_SLASH:M,NO_DOT:L,NO_DOTS:F,NO_DOTS_SLASH:E,STAR:R,START_ANCHOR:H}=e.globChars(w.windows),k=w.dot?F:L,N=w.dot?E:L,V=w.capture?"":"?:",B={negated:!1,prefix:""};let j=w.bash===!0?".*?":R;w.capture&&(j=`(${j})`);const K=o=>o.noglobstar===!0?j:`(${V}(?:(?!${H}${o.dot?M:x}).)*?)`,C=o=>{switch(o){case"*":return`${k}${O}${j}`;case".*":return`${x}${O}${j}`;case"*.*":return`${k}${j}${x}${O}${j}`;case"*/*":return`${k}${j}${S}${O}${N}${j}`;case"**":return k+K(w);case"**/*":return`(?:${k}${K(w)}${S})?${N}${O}${j}`;case"**/*.*":return`(?:${k}${K(w)}${S})?${N}${j}${x}${O}${j}`;case"**/.*":return`(?:${k}${K(w)}${S})?${x}${O}${j}`;default:{const n=/^(.*?)\.(\w+)$/.exec(o);if(!n)return;const h=C(n[1]);return h?h+x+n[2]:void 0}}},a=r.removePrefix(A,B);let p=C(a);return p&&w.strictSlashes!==!0&&(p+=`${S}?`),p},_t=I,_t}var wt,mr;function ti(){if(mr)return wt;mr=1;const e=Jo(),r=ei(),y=at(),i=ct(),u=s=>s&&typeof s=="object"&&!Array.isArray(s),c=(s,d,b=!1)=>{if(Array.isArray(s)){const S=s.map(M=>c(M,d,b));return M=>{for(const L of S){const F=L(M);if(F)return F}return!1}}const I=u(s)&&s.tokens&&s.input;if(s===""||typeof s!="string"&&!I)throw new TypeError("Expected pattern to be a non-empty string");const A=d||{},D=A.windows,w=I?c.compileRe(s,d):c.makeRe(s,d,!1,!0),P=w.state;delete w.state;let _=()=>!1;if(A.ignore){const S={...d,ignore:null,onMatch:null,onResult:null};_=c(A.ignore,S,b)}const x=(S,O=!1)=>{const{isMatch:M,match:L,output:F}=c.test(S,w,d,{glob:s,posix:D}),E={glob:s,state:P,regex:w,posix:D,input:S,output:F,match:L,isMatch:M};return typeof A.onResult=="function"&&A.onResult(E),M===!1?(E.isMatch=!1,O?E:!1):_(S)?(typeof A.onIgnore=="function"&&A.onIgnore(E),E.isMatch=!1,O?E:!1):(typeof A.onMatch=="function"&&A.onMatch(E),O?E:!0)};return b&&(x.state=P),x};return c.test=(s,d,b,{glob:I,posix:A}={})=>{if(typeof s!="string")throw new TypeError("Expected input to be a string");if(s==="")return{isMatch:!1,output:""};const D=b||{},w=D.format||(A?y.toPosixSlashes:null);let P=s===I,_=P&&w?w(s):s;return P===!1&&(_=w?w(s):s,P=_===I),(P===!1||D.capture===!0)&&(D.matchBase===!0||D.basename===!0?P=c.matchBase(s,d,b,A):P=d.exec(_)),{isMatch:!!P,match:P,output:_}},c.matchBase=(s,d,b)=>(d instanceof RegExp?d:c.makeRe(d,b)).test(y.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,I=!1)=>{if(b===!0)return s.output;const A=d||{},D=A.contains?"":"^",w=A.contains?"":"$";let P=`${D}(?:${s.output})${w}`;s&&s.negated===!0&&(P=`^(?!${P}).*$`);const _=c.toRegex(P,d);return I===!0&&(_.state=s),_},c.makeRe=(s,d={},b=!1,I=!1)=>{if(!s||typeof s!="string")throw new TypeError("Expected a non-empty string");let A={negated:!1,fastpaths:!0};return d.fastpaths!==!1&&(s[0]==="."||s[0]==="*")&&(A.output=r.fastpaths(s,d)),A.output||(A=r(s,d)),c.compileRe(A,d,b,I)},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=i,wt=c,wt}var St,br;function Er(){if(br)return St;br=1;const e=ti(),r=at();function y(i,u,c=!1){return u&&(u.windows===null||u.windows===void 0)&&(u={...u,windows:r.isWindows()}),e(i,u,c)}return Object.assign(y,e),St=y,St}var _r;function ni(){if(_r)return gt;_r=1;var e=Object.create,r=Object.defineProperty,y=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,u=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,s=(T,Y,oe,ie)=>{if(Y&&typeof Y=="object"||typeof Y=="function")for(var ae=i(Y),be=0,_e=ae.length,we;be<_e;be++)we=ae[be],!c.call(T,we)&&we!==oe&&r(T,we,{get:(Se=>Y[Se]).bind(null,we),enumerable:!(ie=y(Y,we))||ie.enumerable});return T},d=(T,Y,oe)=>(oe=T!=null?e(u(T)):{},s(!T||!T.__esModule?r(oe,"default",{value:T,enumerable:!0}):oe,T));const b=d(Ie),I=d(qe);function A(T){let Y=(0,b.normalize)(T);return Y.length>1&&Y[Y.length-1]===b.sep&&(Y=Y.substring(0,Y.length-1)),Y}const D=/[\\/]/g;function w(T,Y){return T.replace(D,Y)}const P=/^[a-z]:[\\/]$/i;function _(T){return T==="/"||P.test(T)}function x(T,Y){const{resolvePaths:oe,normalizePath:ie,pathSeparator:ae}=Y,be=process.platform==="win32"&&T.includes("/")||T.startsWith(".");if(oe&&(T=(0,b.resolve)(T)),(ie||be)&&(T=A(T)),T===".")return"";const _e=T[T.length-1]!==ae;return w(_e?T+ae:T,ae)}function S(T,Y){return Y+T}function O(T,Y){return function(oe,ie){return ie.startsWith(T)?ie.slice(T.length)+oe:w((0,b.relative)(T,ie),Y.pathSeparator)+Y.pathSeparator+oe}}function M(T){return T}function L(T,Y,oe){return Y+T+oe}function F(T,Y){const{relativePaths:oe,includeBasePath:ie}=Y;return oe&&T?O(T,Y):ie?S:M}function E(T){return function(Y,oe){oe.push(Y.substring(T.length)||".")}}function R(T){return function(Y,oe,ie){const ae=Y.substring(T.length)||".";ie.every(be=>be(ae,!0))&&oe.push(ae)}}const H=(T,Y)=>{Y.push(T||".")},k=(T,Y,oe)=>{const ie=T||".";oe.every(ae=>ae(ie,!0))&&Y.push(ie)},N=()=>{};function V(T,Y){const{includeDirs:oe,filters:ie,relativePaths:ae}=Y;return oe?ae?ie&&ie.length?R(T):E(T):ie&&ie.length?k:H:N}const B=(T,Y,oe,ie)=>{ie.every(ae=>ae(T,!1))&&oe.files++},j=(T,Y,oe,ie)=>{ie.every(ae=>ae(T,!1))&&Y.push(T)},K=(T,Y,oe,ie)=>{oe.files++},C=(T,Y)=>{Y.push(T)},a=()=>{};function p(T){const{excludeFiles:Y,filters:oe,onlyCounts:ie}=T;return Y?a:oe&&oe.length?ie?B:j:ie?K:C}const o=T=>T,n=()=>[""].slice(0,0);function h(T){return T.group?n:o}const f=(T,Y,oe)=>{T.push({directory:Y,files:oe,dir:Y})},t=()=>{};function v(T){return T.group?f:t}const g=function(T,Y,oe){const{queue:ie,fs:ae,options:{suppressErrors:be}}=Y;ie.enqueue(),ae.realpath(T,(_e,we)=>{if(_e)return ie.dequeue(be?null:_e,Y);ae.stat(we,(Se,Be)=>{if(Se)return ie.dequeue(be?null:Se,Y);if(Be.isDirectory()&&Q(T,we,Y))return ie.dequeue(null,Y);oe(Be,we),ie.dequeue(null,Y)})})},l=function(T,Y,oe){const{queue:ie,fs:ae,options:{suppressErrors:be}}=Y;ie.enqueue();try{const _e=ae.realpathSync(T),we=ae.statSync(_e);if(we.isDirectory()&&Q(T,_e,Y))return;oe(we,_e)}catch(_e){if(!be)throw _e}};function m(T,Y){return!T.resolveSymlinks||T.excludeSymlinks?null:Y?l:g}function Q(T,Y,oe){if(oe.options.useRealPaths)return $(Y,oe);let ie=(0,b.dirname)(T),ae=1;for(;ie!==oe.root&&ae<2;){const be=oe.symlinks.get(ie);!!be&&(be===Y||be.startsWith(Y)||Y.startsWith(be))?ae++:ie=(0,b.dirname)(ie)}return oe.symlinks.set(T,Y),ae>1}function $(T,Y){return Y.visited.includes(T+Y.options.pathSeparator)}const q=T=>T.counts,G=T=>T.groups,X=T=>T.paths,z=T=>T.paths.slice(0,T.options.maxFiles),ee=(T,Y,oe)=>(ce(Y,oe,T.counts,T.options.suppressErrors),null),U=(T,Y,oe)=>(ce(Y,oe,T.paths,T.options.suppressErrors),null),Z=(T,Y,oe)=>(ce(Y,oe,T.paths.slice(0,T.options.maxFiles),T.options.suppressErrors),null),te=(T,Y,oe)=>(ce(Y,oe,T.groups,T.options.suppressErrors),null);function ce(T,Y,oe,ie){Y(T&&!ie?T:null,oe)}function le(T,Y){const{onlyCounts:oe,group:ie,maxFiles:ae}=T;return oe?Y?q:ee:ie?Y?G:te:ae?Y?z:Z:Y?X:U}const ne={withFileTypes:!0},de=(T,Y,oe,ie,ae)=>{if(T.queue.enqueue(),ie<0)return T.queue.dequeue(null,T);const{fs:be}=T;T.visited.push(Y),T.counts.directories++,be.readdir(Y||".",ne,(_e,we=[])=>{ae(we,oe,ie),T.queue.dequeue(T.options.suppressErrors?null:_e,T)})},W=(T,Y,oe,ie,ae)=>{const{fs:be}=T;if(ie<0)return;T.visited.push(Y),T.counts.directories++;let _e=[];try{_e=be.readdirSync(Y||".",ne)}catch(we){if(!T.options.suppressErrors)throw we}ae(_e,oe,ie)};function pe(T){return T?W:de}var me=class{count=0;constructor(T){this.onQueueEmpty=T}enqueue(){return this.count++,this.count}dequeue(T,Y){this.onQueueEmpty&&(--this.count<=0||T)&&(this.onQueueEmpty(T,Y),T&&(Y.controller.abort(),this.onQueueEmpty=void 0))}},fe=class{_files=0;_directories=0;set files(T){this._files=T}get files(){return this._files}set directories(T){this._directories=T}get directories(){return this._directories}get dirs(){return this._directories}},J=class{aborted=!1;abort(){this.aborted=!0}},se=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(T,Y,oe){this.isSynchronous=!oe,this.callbackInvoker=le(Y,this.isSynchronous),this.root=x(T,Y),this.state={root:_(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new fe,options:Y,queue:new me((ie,ae)=>this.callbackInvoker(ae,ie,oe)),symlinks:new Map,visited:[""].slice(0,0),controller:new J,fs:Y.fs||I},this.joinPath=F(this.root,Y),this.pushDirectory=V(this.root,Y),this.pushFile=p(Y),this.getArray=h(Y),this.groupFiles=v(Y),this.resolveSymlink=m(Y,this.isSynchronous),this.walkDirectory=pe(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=(T,Y,oe)=>{const{paths:ie,options:{filters:ae,resolveSymlinks:be,excludeSymlinks:_e,exclude:we,maxFiles:Se,signal:Be,useRealPaths:Ke,pathSeparator:ze},controller:it}=this.state;if(it.aborted||Be&&Be.aborted||Se&&ie.length>Se)return;const ft=this.getArray(this.state.paths);for(let dt=0;dt<T.length;++dt){const He=T[dt];if(He.isFile()||He.isSymbolicLink()&&!be&&!_e){const Ne=this.joinPath(He.name,Y);this.pushFile(Ne,ft,this.state.counts,ae)}else if(He.isDirectory()){let Ne=L(He.name,Y,this.state.options.pathSeparator);if(we&&we(He.name,Ne))continue;this.pushDirectory(Ne,ie,ae),this.walkDirectory(this.state,Ne,Ne,oe-1,this.walk)}else if(this.resolveSymlink&&He.isSymbolicLink()){let Ne=S(He.name,Y);this.resolveSymlink(Ne,this.state,(Ho,Ce)=>{if(Ho.isDirectory()){if(Ce=x(Ce,this.state.options),we&&we(He.name,Ke?Ce:Ne+ze))return;this.walkDirectory(this.state,Ce,Ke?Ce:Ne+ze,oe-1,this.walk)}else{Ce=Ke?Ce:Ne;const Lo=(0,b.basename)(Ce),Do=x((0,b.dirname)(Ce),this.state.options);Ce=this.joinPath(Lo,Do),this.pushFile(Ce,ft,this.state.counts,ae)}})}}this.groupFiles(this.state.groups,Y,ft)}};function re(T,Y){return new Promise((oe,ie)=>{ue(T,Y,(ae,be)=>{if(ae)return ie(ae);oe(be)})})}function ue(T,Y,oe){new se(T,Y,oe).start()}function he(T,Y){return new se(T,Y).start()}var ge=class{constructor(T,Y){this.root=T,this.options=Y}withPromise(){return re(this.root,this.options)}withCallback(T){ue(this.root,this.options,T)}sync(){return he(this.root,this.options)}};let ye=null;try{require.resolve("picomatch"),ye=Er()}catch{}var ve=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:b.sep,filters:[]};globFunction;constructor(T){this.options={...this.options,...T},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(T){return this.options.pathSeparator=T,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(T){return this.options.maxDepth=T,this}withMaxFiles(T){return this.options.maxFiles=T,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:T=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=T,this.withFullPaths()}withAbortSignal(T){return this.options.signal=T,this}normalize(){return this.options.normalizePath=!0,this}filter(T){return this.options.filters.push(T),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(T){return this.options.exclude=T,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(T){return new ge(T||".",this.options)}withGlobFunction(T){return this.globFunction=T,this}crawlWithOptions(T,Y){return this.options={...this.options,...Y},new ge(T||".",this.options)}glob(...T){return this.globFunction?this.globWithOptions(T):this.globWithOptions(T,{dot:!0})}globWithOptions(T,...Y){const oe=this.globFunction||ye;if(!oe)throw new Error("Please specify a glob function to use glob matching.");var ie=this.globCache[T.join("\0")];return ie||(ie=oe(T,...Y),this.globCache[T.join("\0")]=ie),this.options.filters.push(ae=>ie(ae)),this}};return gt.fdir=ve,gt}var At,wr;function ri(){if(wr)return At;wr=1;const{fdir:e}=ni(),r=Ie,y=Er();class i{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=y(this._exclude()),s=y(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 At=i,At}var xt,Sr;function Ve(){if(Sr)return xt;Sr=1;const e=qe,r="utf8";function y(c,s=null){return s||(s=r),e.readFileSync(c,s)}function i(c,s){return e.writeFileSync(c,s,r)}return xt={chmodSync:e.chmodSync,existsSync:e.existsSync,readdirSync:e.readdirSync,readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,readFileX:y,writeFileX:i},xt}var Pe={exports:{}};const Ar="dotenv",xr="17.2.3",Br="Loads environment variables from .env file",Rr="lib/main.js",Ir="lib/main.d.ts",Or={".":{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"},Tr={"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"},Nr={type:"git",url:"git://github.com/motdotla/dotenv.git"},Cr="https://github.com/motdotla/dotenv#readme",Pr="https://dotenvx.com",Hr=["dotenv","env",".env","environment","variables","config","settings"],Lr="README.md",Dr="BSD-2-Clause",Kr={"@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"},qr={node:">=12"},Vr={fs:!1},si={name:Ar,version:xr,description:Br,main:Rr,types:Ir,exports:Or,scripts:Tr,repository:Nr,homepage:Cr,funding:Pr,keywords:Hr,readmeFilename:Lr,license:Dr,devDependencies:Kr,engines:qr,browser:Vr},oi={__proto__:null,browser:Vr,default:si,description:Br,devDependencies:Kr,engines:qr,exports:Or,funding:Pr,homepage:Cr,keywords:Hr,license:Dr,main:Rr,name:Ar,readmeFilename:Lr,repository:Nr,scripts:Tr,types:Ir,version:xr},ii=jn(oi);var kr;function ci(){if(kr)return Pe.exports;kr=1;const e=qe,r=Ie,y=kn,i=ko,c=ii.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(B){return typeof B=="string"?!["false","0","no","off",""].includes(B.toLowerCase()):!!B}function I(){return process.stdout.isTTY}function A(B){return I()?`\x1B[2m${B}\x1B[0m`:B}const D=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function w(B){const j={};let K=B.toString();K=K.replace(/\r\n?/mg,`
|
|
3
|
-
`);let C;for(;(C=D.exec(K))!=null;){const a=C[1];let p=C[2]||"";p=p.trim();const o=p[0];p=p.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),o==='"'&&(p=p.replace(/\\n/g,`
|
|
4
|
-
`),p=p.replace(/\\r/g,"\r")),j[a]=p}return j}function P(B){B=B||{};const j=L(B);B.path=j;const K=V.configDotenv(B);if(!K.parsed){const o=new Error(`MISSING_DATA: Cannot parse ${j} for an unknown reason`);throw o.code="MISSING_DATA",o}const C=O(B).split(","),a=C.length;let p;for(let o=0;o<a;o++)try{const n=C[o].trim(),h=M(K,n);p=V.decrypt(h.ciphertext,h.key);break}catch(n){if(o+1>=a)throw n}return V.parse(p)}function _(B){console.error(`[dotenv@${c}][WARN] ${B}`)}function x(B){console.log(`[dotenv@${c}][DEBUG] ${B}`)}function S(B){console.log(`[dotenv@${c}] ${B}`)}function O(B){return B&&B.DOTENV_KEY&&B.DOTENV_KEY.length>0?B.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function M(B,j){let K;try{K=new URL(j)}catch(n){if(n.code==="ERR_INVALID_URL"){const h=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 h.code="INVALID_DOTENV_KEY",h}throw n}const C=K.password;if(!C){const n=new Error("INVALID_DOTENV_KEY: Missing key part");throw n.code="INVALID_DOTENV_KEY",n}const a=K.searchParams.get("environment");if(!a){const n=new Error("INVALID_DOTENV_KEY: Missing environment part");throw n.code="INVALID_DOTENV_KEY",n}const p=`DOTENV_VAULT_${a.toUpperCase()}`,o=B.parsed[p];if(!o){const n=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${p} in your .env.vault file.`);throw n.code="NOT_FOUND_DOTENV_ENVIRONMENT",n}return{ciphertext:o,key:C}}function L(B){let j=null;if(B&&B.path&&B.path.length>0)if(Array.isArray(B.path))for(const K of B.path)e.existsSync(K)&&(j=K.endsWith(".vault")?K:`${K}.vault`);else j=B.path.endsWith(".vault")?B.path:`${B.path}.vault`;else j=r.resolve(process.cwd(),".env.vault");return e.existsSync(j)?j:null}function F(B){return B[0]==="~"?r.join(y.homedir(),B.slice(1)):B}function E(B){const j=b(process.env.DOTENV_CONFIG_DEBUG||B&&B.debug),K=b(process.env.DOTENV_CONFIG_QUIET||B&&B.quiet);(j||!K)&&S("Loading env from encrypted .env.vault");const C=V._parseVault(B);let a=process.env;return B&&B.processEnv!=null&&(a=B.processEnv),V.populate(a,C,B),{parsed:C}}function R(B){const j=r.resolve(process.cwd(),".env");let K="utf8",C=process.env;B&&B.processEnv!=null&&(C=B.processEnv);let a=b(C.DOTENV_CONFIG_DEBUG||B&&B.debug),p=b(C.DOTENV_CONFIG_QUIET||B&&B.quiet);B&&B.encoding?K=B.encoding:a&&x("No encoding is specified. UTF-8 is used by default");let o=[j];if(B&&B.path)if(!Array.isArray(B.path))o=[F(B.path)];else{o=[];for(const t of B.path)o.push(F(t))}let n;const h={};for(const t of o)try{const v=V.parse(e.readFileSync(t,{encoding:K}));V.populate(h,v,B)}catch(v){a&&x(`Failed to load ${t} ${v.message}`),n=v}const f=V.populate(C,h,B);if(a=b(C.DOTENV_CONFIG_DEBUG||a),p=b(C.DOTENV_CONFIG_QUIET||p),a||!p){const t=Object.keys(f).length,v=[];for(const g of o)try{const l=r.relative(process.cwd(),g);v.push(l)}catch(l){a&&x(`Failed to load ${g} ${l.message}`),n=l}S(`injecting env (${t}) from ${v.join(",")} ${A(`-- tip: ${d()}`)}`)}return n?{parsed:h,error:n}:{parsed:h}}function H(B){if(O(B).length===0)return V.configDotenv(B);const j=L(B);return j?V._configVault(B):(_(`You set DOTENV_KEY but you are missing a .env.vault file at ${j}. Did you forget to build it?`),V.configDotenv(B))}function k(B,j){const K=Buffer.from(j.slice(-64),"hex");let C=Buffer.from(B,"base64");const a=C.subarray(0,12),p=C.subarray(-16);C=C.subarray(12,-16);try{const o=i.createDecipheriv("aes-256-gcm",K,a);return o.setAuthTag(p),`${o.update(C)}${o.final()}`}catch(o){const n=o instanceof RangeError,h=o.message==="Invalid key length",f=o.message==="Unsupported state or unable to authenticate data";if(n||h){const t=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw t.code="INVALID_DOTENV_KEY",t}else if(f){const t=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw t.code="DECRYPTION_FAILED",t}else throw o}}function N(B,j,K={}){const C=!!(K&&K.debug),a=!!(K&&K.override),p={};if(typeof j!="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(j))Object.prototype.hasOwnProperty.call(B,o)?(a===!0&&(B[o]=j[o],p[o]=j[o]),C&&x(a===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):(B[o]=j[o],p[o]=j[o]);return p}const V={configDotenv:R,_configVault:E,_parseVault:P,config:H,decrypt:k,parse:w,populate:N};return Pe.exports.configDotenv=V.configDotenv,Pe.exports._configVault=V._configVault,Pe.exports._parseVault=V._parseVault,Pe.exports.config=V.config,Pe.exports.decrypt=V.decrypt,Pe.exports.parse=V.parse,Pe.exports.populate=V.populate,Pe.exports=V,Pe.exports}var Bt,Fr;function ai(){if(Fr)return Bt;Fr=1;function e(r){let y;try{y=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 i=y.password;if(!i)throw new Error("INVALID_DOTENV_KEY: Missing key part");return Buffer.from(i.slice(-64),"hex")}return Bt=e,Bt}var Rt,jr;function ui(){if(jr)return Rt;jr=1;const e=ci(),r=ai();function y(i,u){const c=r(u);try{return e.decrypt(i,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 ${u}`,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 '${i}'`,d}throw s}}return Rt=y,Rt}var It={},Ot={},Ur;function Le(){return Ur||(Ur=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=y,e.anumber=i,e.abytes=u,e.ahash=c,e.aexists=s,e.aoutput=d,e.u8=b,e.u32=I,e.clean=A,e.createView=D,e.bytesToHex=_,e.hexToBytes=O,e.hexToNumber=M,e.bytesToNumberBE=L,e.numberToBytesBE=F,e.utf8ToBytes=R,e.bytesToUtf8=H,e.toBytes=k,e.overlapBytes=N,e.complexOverlapBytes=V,e.concatBytes=B,e.checkOpts=j,e.equalBytes=K,e.getOutput=p,e.setBigUint64=o,e.u64Lengths=n,e.isAligned32=h,e.copyBytes=f;function r(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function y(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function i(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function u(t,...v){if(!r(t))throw new Error("Uint8Array expected");if(v.length>0&&!v.includes(t.length))throw new Error("Uint8Array expected of length "+v+", 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");i(t.outputLen),i(t.blockLen)}function s(t,v=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(v&&t.finished)throw new Error("Hash#digest() has already been called")}function d(t,v){u(t);const g=v.outputLen;if(t.length<g)throw new Error("digestInto() expects output buffer of length at least "+g)}function b(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function I(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function A(...t){for(let v=0;v<t.length;v++)t[v].fill(0)}function D(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const w=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",P=Array.from({length:256},(t,v)=>v.toString(16).padStart(2,"0"));function _(t){if(u(t),w)return t.toHex();let v="";for(let g=0;g<t.length;g++)v+=P[t[g]];return v}const x={_0:48,_9:57,A:65,F:70,a:97,f:102};function S(t){if(t>=x._0&&t<=x._9)return t-x._0;if(t>=x.A&&t<=x.F)return t-(x.A-10);if(t>=x.a&&t<=x.f)return t-(x.a-10)}function O(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(w)return Uint8Array.fromHex(t);const v=t.length,g=v/2;if(v%2)throw new Error("hex string expected, got unpadded hex of length "+v);const l=new Uint8Array(g);for(let m=0,Q=0;m<g;m++,Q+=2){const $=S(t.charCodeAt(Q)),q=S(t.charCodeAt(Q+1));if($===void 0||q===void 0){const G=t[Q]+t[Q+1];throw new Error('hex string expected, got non-hex character "'+G+'" at index '+Q)}l[m]=$*16+q}return l}function M(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":"0x"+t)}function L(t){return M(_(t))}function F(t,v){return O(t.toString(16).padStart(v*2,"0"))}const E=async()=>{};e.nextTick=E;function R(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 k(t){if(typeof t=="string")t=R(t);else if(r(t))t=f(t);else throw new Error("Uint8Array expected, got "+typeof t);return t}function N(t,v){return t.buffer===v.buffer&&t.byteOffset<v.byteOffset+v.byteLength&&v.byteOffset<t.byteOffset+t.byteLength}function V(t,v){if(N(t,v)&&t.byteOffset<v.byteOffset)throw new Error("complex overlap of input and output is not supported")}function B(...t){let v=0;for(let l=0;l<t.length;l++){const m=t[l];u(m),v+=m.length}const g=new Uint8Array(v);for(let l=0,m=0;l<t.length;l++){const Q=t[l];g.set(Q,m),m+=Q.length}return g}function j(t,v){if(v==null||typeof v!="object")throw new Error("options must be defined");return Object.assign(t,v)}function K(t,v){if(t.length!==v.length)return!1;let g=0;for(let l=0;l<t.length;l++)g|=t[l]^v[l];return g===0}class C{}e.Hash=C;const a=(t,v)=>{function g(l,...m){if(u(l),!e.isLE)throw new Error("Non little-endian hardware is not yet supported");if(t.nonceLength!==void 0){const z=m[0];if(!z)throw new Error("nonce / iv required");t.varSizeNonce?u(z):u(z,t.nonceLength)}const Q=t.tagLength;Q&&m[1]!==void 0&&u(m[1]);const $=v(l,...m),q=(z,ee)=>{if(ee!==void 0){if(z!==2)throw new Error("cipher output not supported");u(ee)}};let G=!1;return{encrypt(z,ee){if(G)throw new Error("cannot encrypt() twice with same key + nonce");return G=!0,u(z),q($.encrypt.length,ee),$.encrypt(z,ee)},decrypt(z,ee){if(u(z),Q&&z.length<Q)throw new Error("invalid ciphertext length: smaller than tagLength="+Q);return q($.decrypt.length,ee),$.decrypt(z,ee)}}}return Object.assign(g,t),g};e.wrapCipher=a;function p(t,v,g=!0){if(v===void 0)return new Uint8Array(t);if(v.length!==t)throw new Error("invalid output length, expected "+t+", got: "+v.length);if(g&&!h(v))throw new Error("invalid output, must be aligned");return v}function o(t,v,g,l){if(typeof t.setBigUint64=="function")return t.setBigUint64(v,g,l);const m=BigInt(32),Q=BigInt(4294967295),$=Number(g>>m&Q),q=Number(g&Q),G=l?4:0,X=l?0:4;t.setUint32(v+G,$,l),t.setUint32(v+X,q,l)}function n(t,v,g){y(g);const l=new Uint8Array(16),m=D(l);return o(m,0,BigInt(v),g),o(m,8,BigInt(t),g),l}function h(t){return t.byteOffset%4===0}function f(t){return Uint8Array.from(t)}})(Ot)),Ot}var Tt={},Re={},Mr;function Nt(){return Mr||(Mr=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.AEAD_TAG_LENGTH=Re.XCHACHA20_NONCE_LENGTH=Re.CURVE25519_PUBLIC_KEY_SIZE=Re.ETH_PUBLIC_KEY_SIZE=Re.UNCOMPRESSED_PUBLIC_KEY_SIZE=Re.COMPRESSED_PUBLIC_KEY_SIZE=Re.SECRET_KEY_LENGTH=void 0,Re.SECRET_KEY_LENGTH=32,Re.COMPRESSED_PUBLIC_KEY_SIZE=33,Re.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,Re.ETH_PUBLIC_KEY_SIZE=64,Re.CURVE25519_PUBLIC_KEY_SIZE=32,Re.XCHACHA20_NONCE_LENGTH=24,Re.AEAD_TAG_LENGTH=16),Re}var Gr;function ut(){return Gr||(Gr=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=Nt(),y=(function(){function I(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return I})();e.ECIES_CONFIG=new y;var i=function(){return e.ECIES_CONFIG.ellipticCurve};e.ellipticCurve=i;var u=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed};e.isEphemeralKeyCompressed=u;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 I={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 I)return I[e.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};e.ephemeralKeySize=b})(Tt)),Tt}var Ct={},Qe={},je={},Pt={},Ht={},Je={},Yr;function li(){return Yr||(Yr=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.crypto=void 0,Je.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),Je}var $r;function Zr(){return $r||($r=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=i,e.getWebcryptoSubtle=u,e.managedNonce=c;const r=li(),y=Le();function i(I=32){if(r.crypto&&typeof r.crypto.getRandomValues=="function")return r.crypto.getRandomValues(new Uint8Array(I));if(r.crypto&&typeof r.crypto.randomBytes=="function")return Uint8Array.from(r.crypto.randomBytes(I));throw new Error("crypto.getRandomValues must be defined")}function u(){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(I){const{nonceLength:A}=I;return(0,y.anumber)(A),((D,...w)=>({encrypt(P,..._){const x=i(A),S=I(D,x,...w).encrypt(P,..._),O=(0,y.concatBytes)(x,S);return S.fill(0),O},decrypt(P,..._){const x=P.subarray(0,A),S=P.subarray(A);return I(D,x,...w).decrypt(S,..._)}}))}e.utils={async encrypt(I,A,D,w){const P=u(),_=await P.importKey("raw",I,A,!0,["encrypt"]),x=await P.encrypt(D,_,w);return new Uint8Array(x)},async decrypt(I,A,D,w){const P=u(),_=await P.importKey("raw",I,A,!0,["decrypt"]),x=await P.decrypt(D,_,w);return new Uint8Array(x)}};const s={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function d(I,A,D){if(I===s.CBC)return{name:s.CBC,iv:A};if(I===s.CTR)return{name:s.CTR,counter:A,length:64};if(I===s.GCM)return D?{name:s.GCM,iv:A,additionalData:D}:{name:s.GCM,iv:A};throw new Error("unknown aes block mode")}function b(I){return(A,D,w)=>{(0,y.abytes)(A),(0,y.abytes)(D);const P={name:I,length:A.length*8},_=d(I,D,w);let x=!1;return{encrypt(S){if((0,y.abytes)(S),x)throw new Error("Cannot encrypt() twice with same key / nonce");return x=!0,e.utils.encrypt(A,P,_,S)},decrypt(S){return(0,y.abytes)(S),e.utils.decrypt(A,P,_,S)}}}}e.cbc=b(s.CBC),e.ctr=b(s.CTR),e.gcm=b(s.GCM)})(Ht)),Ht}var Lt={},Ae={},Oe={},Dt={},et={},Xr;function fi(){return Xr||(Xr=1,Object.defineProperty(et,"__esModule",{value:!0}),et.crypto=void 0,et.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),et}var Wr;function De(){return Wr||(Wr=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=y,e.anumber=i,e.abytes=u,e.ahash=c,e.aexists=s,e.aoutput=d,e.u8=b,e.u32=I,e.clean=A,e.createView=D,e.rotr=w,e.rotl=P,e.byteSwap=_,e.byteSwap32=x,e.bytesToHex=M,e.hexToBytes=E,e.asyncLoop=H,e.utf8ToBytes=k,e.bytesToUtf8=N,e.toBytes=V,e.kdfInputToBytes=B,e.concatBytes=j,e.checkOpts=K,e.createHasher=a,e.createOptHasher=p,e.createXOFer=o,e.randomBytes=n;const r=fi();function y(h){return h instanceof Uint8Array||ArrayBuffer.isView(h)&&h.constructor.name==="Uint8Array"}function i(h){if(!Number.isSafeInteger(h)||h<0)throw new Error("positive integer expected, got "+h)}function u(h,...f){if(!y(h))throw new Error("Uint8Array expected");if(f.length>0&&!f.includes(h.length))throw new Error("Uint8Array expected of length "+f+", got length="+h.length)}function c(h){if(typeof h!="function"||typeof h.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");i(h.outputLen),i(h.blockLen)}function s(h,f=!0){if(h.destroyed)throw new Error("Hash instance has been destroyed");if(f&&h.finished)throw new Error("Hash#digest() has already been called")}function d(h,f){u(h);const t=f.outputLen;if(h.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}function b(h){return new Uint8Array(h.buffer,h.byteOffset,h.byteLength)}function I(h){return new Uint32Array(h.buffer,h.byteOffset,Math.floor(h.byteLength/4))}function A(...h){for(let f=0;f<h.length;f++)h[f].fill(0)}function D(h){return new DataView(h.buffer,h.byteOffset,h.byteLength)}function w(h,f){return h<<32-f|h>>>f}function P(h,f){return h<<f|h>>>32-f>>>0}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function _(h){return h<<24&4278190080|h<<8&16711680|h>>>8&65280|h>>>24&255}e.swap8IfBE=e.isLE?h=>h:h=>_(h),e.byteSwapIfBE=e.swap8IfBE;function x(h){for(let f=0;f<h.length;f++)h[f]=_(h[f]);return h}e.swap32IfBE=e.isLE?h=>h:x;const S=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",O=Array.from({length:256},(h,f)=>f.toString(16).padStart(2,"0"));function M(h){if(u(h),S)return h.toHex();let f="";for(let t=0;t<h.length;t++)f+=O[h[t]];return f}const L={_0:48,_9:57,A:65,F:70,a:97,f:102};function F(h){if(h>=L._0&&h<=L._9)return h-L._0;if(h>=L.A&&h<=L.F)return h-(L.A-10);if(h>=L.a&&h<=L.f)return h-(L.a-10)}function E(h){if(typeof h!="string")throw new Error("hex string expected, got "+typeof h);if(S)return Uint8Array.fromHex(h);const f=h.length,t=f/2;if(f%2)throw new Error("hex string expected, got unpadded hex of length "+f);const v=new Uint8Array(t);for(let g=0,l=0;g<t;g++,l+=2){const m=F(h.charCodeAt(l)),Q=F(h.charCodeAt(l+1));if(m===void 0||Q===void 0){const $=h[l]+h[l+1];throw new Error('hex string expected, got non-hex character "'+$+'" at index '+l)}v[g]=m*16+Q}return v}const R=async()=>{};e.nextTick=R;async function H(h,f,t){let v=Date.now();for(let g=0;g<h;g++){t(g);const l=Date.now()-v;l>=0&&l<f||(await(0,e.nextTick)(),v+=l)}}function k(h){if(typeof h!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(h))}function N(h){return new TextDecoder().decode(h)}function V(h){return typeof h=="string"&&(h=k(h)),u(h),h}function B(h){return typeof h=="string"&&(h=k(h)),u(h),h}function j(...h){let f=0;for(let v=0;v<h.length;v++){const g=h[v];u(g),f+=g.length}const t=new Uint8Array(f);for(let v=0,g=0;v<h.length;v++){const l=h[v];t.set(l,g),g+=l.length}return t}function K(h,f){if(f!==void 0&&{}.toString.call(f)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(h,f)}class C{}e.Hash=C;function a(h){const f=v=>h().update(V(v)).digest(),t=h();return f.outputLen=t.outputLen,f.blockLen=t.blockLen,f.create=()=>h(),f}function p(h){const f=(v,g)=>h(g).update(V(v)).digest(),t=h({});return f.outputLen=t.outputLen,f.blockLen=t.blockLen,f.create=v=>h(v),f}function o(h){const f=(v,g)=>h(g).update(V(v)).digest(),t=h({});return f.outputLen=t.outputLen,f.blockLen=t.blockLen,f.create=v=>h(v),f}e.wrapConstructor=a,e.wrapConstructorWithOpts=p,e.wrapXOFConstructorWithOpts=o;function n(h=32){if(r.crypto&&typeof r.crypto.getRandomValues=="function")return r.crypto.getRandomValues(new Uint8Array(h));if(r.crypto&&typeof r.crypto.randomBytes=="function")return Uint8Array.from(r.crypto.randomBytes(h));throw new Error("crypto.getRandomValues must be defined")}})(Dt)),Dt}var zr;function di(){if(zr)return Oe;zr=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.SHA512_IV=Oe.SHA384_IV=Oe.SHA224_IV=Oe.SHA256_IV=Oe.HashMD=void 0,Oe.setBigUint64=r,Oe.Chi=y,Oe.Maj=i;const e=De();function r(c,s,d,b){if(typeof c.setBigUint64=="function")return c.setBigUint64(s,d,b);const I=BigInt(32),A=BigInt(4294967295),D=Number(d>>I&A),w=Number(d&A),P=b?4:0,_=b?0:4;c.setUint32(s+P,D,b),c.setUint32(s+_,w,b)}function y(c,s,d){return c&s^~c&d}function i(c,s,d){return c&s^c&d^s&d}class u extends e.Hash{constructor(s,d,b,I){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=s,this.outputLen=d,this.padOffset=b,this.isLE=I,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:I}=this,A=s.length;for(let D=0;D<A;){const w=Math.min(I-this.pos,A-D);if(w===I){const P=(0,e.createView)(s);for(;I<=A-D;D+=I)this.process(P,D);continue}b.set(s.subarray(D,D+w),this.pos),this.pos+=w,D+=w,this.pos===I&&(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:I,isLE:A}=this;let{pos:D}=this;d[D++]=128,(0,e.clean)(this.buffer.subarray(D)),this.padOffset>I-D&&(this.process(b,0),D=0);for(let S=D;S<I;S++)d[S]=0;r(b,I-8,BigInt(this.length*8),A),this.process(b,0);const w=(0,e.createView)(s),P=this.outputLen;if(P%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const _=P/4,x=this.get();if(_>x.length)throw new Error("_sha2: outputLen bigger than state");for(let S=0;S<_;S++)w.setUint32(4*S,x[S],A)}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:I,finished:A,destroyed:D,pos:w}=this;return s.destroyed=D,s.finished=A,s.length=I,s.pos=w,I%d&&s.buffer.set(b),s}clone(){return this._cloneInto()}}return Oe.HashMD=u,Oe.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Oe.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),Oe.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Oe.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Oe}var Ee={},Qr;function hi(){if(Qr)return Ee;Qr=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.toBig=Ee.shrSL=Ee.shrSH=Ee.rotrSL=Ee.rotrSH=Ee.rotrBL=Ee.rotrBH=Ee.rotr32L=Ee.rotr32H=Ee.rotlSL=Ee.rotlSH=Ee.rotlBL=Ee.rotlBH=Ee.add5L=Ee.add5H=Ee.add4L=Ee.add4H=Ee.add3L=Ee.add3H=void 0,Ee.add=O,Ee.fromBig=y,Ee.split=i;const e=BigInt(2**32-1),r=BigInt(32);function y(N,V=!1){return V?{h:Number(N&e),l:Number(N>>r&e)}:{h:Number(N>>r&e)|0,l:Number(N&e)|0}}function i(N,V=!1){const B=N.length;let j=new Uint32Array(B),K=new Uint32Array(B);for(let C=0;C<B;C++){const{h:a,l:p}=y(N[C],V);[j[C],K[C]]=[a,p]}return[j,K]}const u=(N,V)=>BigInt(N>>>0)<<r|BigInt(V>>>0);Ee.toBig=u;const c=(N,V,B)=>N>>>B;Ee.shrSH=c;const s=(N,V,B)=>N<<32-B|V>>>B;Ee.shrSL=s;const d=(N,V,B)=>N>>>B|V<<32-B;Ee.rotrSH=d;const b=(N,V,B)=>N<<32-B|V>>>B;Ee.rotrSL=b;const I=(N,V,B)=>N<<64-B|V>>>B-32;Ee.rotrBH=I;const A=(N,V,B)=>N>>>B-32|V<<64-B;Ee.rotrBL=A;const D=(N,V)=>V;Ee.rotr32H=D;const w=(N,V)=>N;Ee.rotr32L=w;const P=(N,V,B)=>N<<B|V>>>32-B;Ee.rotlSH=P;const _=(N,V,B)=>V<<B|N>>>32-B;Ee.rotlSL=_;const x=(N,V,B)=>V<<B-32|N>>>64-B;Ee.rotlBH=x;const S=(N,V,B)=>N<<B-32|V>>>64-B;Ee.rotlBL=S;function O(N,V,B,j){const K=(V>>>0)+(j>>>0);return{h:N+B+(K/2**32|0)|0,l:K|0}}const M=(N,V,B)=>(N>>>0)+(V>>>0)+(B>>>0);Ee.add3L=M;const L=(N,V,B,j)=>V+B+j+(N/2**32|0)|0;Ee.add3H=L;const F=(N,V,B,j)=>(N>>>0)+(V>>>0)+(B>>>0)+(j>>>0);Ee.add4L=F;const E=(N,V,B,j,K)=>V+B+j+K+(N/2**32|0)|0;Ee.add4H=E;const R=(N,V,B,j,K)=>(N>>>0)+(V>>>0)+(B>>>0)+(j>>>0)+(K>>>0);Ee.add5L=R;const H=(N,V,B,j,K,C)=>V+B+j+K+C+(N/2**32|0)|0;Ee.add5H=H;const k={fromBig:y,split:i,toBig:u,shrSH:c,shrSL:s,rotrSH:d,rotrSL:b,rotrBH:I,rotrBL:A,rotr32H:D,rotr32L:w,rotlSH:P,rotlSL:_,rotlBH:x,rotlBL:S,add:O,add3L:M,add3H:L,add4L:F,add4H:E,add5H:H,add5L:R};return Ee.default=k,Ee}var Jr;function Kt(){if(Jr)return Ae;Jr=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.sha512_224=Ae.sha512_256=Ae.sha384=Ae.sha512=Ae.sha224=Ae.sha256=Ae.SHA512_256=Ae.SHA512_224=Ae.SHA384=Ae.SHA512=Ae.SHA224=Ae.SHA256=void 0;const e=di(),r=hi(),y=De(),i=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]),u=new Uint32Array(64);class c extends e.HashMD{constructor(L=32){super(64,L,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:L,B:F,C:E,D:R,E:H,F:k,G:N,H:V}=this;return[L,F,E,R,H,k,N,V]}set(L,F,E,R,H,k,N,V){this.A=L|0,this.B=F|0,this.C=E|0,this.D=R|0,this.E=H|0,this.F=k|0,this.G=N|0,this.H=V|0}process(L,F){for(let K=0;K<16;K++,F+=4)u[K]=L.getUint32(F,!1);for(let K=16;K<64;K++){const C=u[K-15],a=u[K-2],p=(0,y.rotr)(C,7)^(0,y.rotr)(C,18)^C>>>3,o=(0,y.rotr)(a,17)^(0,y.rotr)(a,19)^a>>>10;u[K]=o+u[K-7]+p+u[K-16]|0}let{A:E,B:R,C:H,D:k,E:N,F:V,G:B,H:j}=this;for(let K=0;K<64;K++){const C=(0,y.rotr)(N,6)^(0,y.rotr)(N,11)^(0,y.rotr)(N,25),a=j+C+(0,e.Chi)(N,V,B)+i[K]+u[K]|0,o=((0,y.rotr)(E,2)^(0,y.rotr)(E,13)^(0,y.rotr)(E,22))+(0,e.Maj)(E,R,H)|0;j=B,B=V,V=N,N=k+a|0,k=H,H=R,R=E,E=a+o|0}E=E+this.A|0,R=R+this.B|0,H=H+this.C|0,k=k+this.D|0,N=N+this.E|0,V=V+this.F|0,B=B+this.G|0,j=j+this.H|0,this.set(E,R,H,k,N,V,B,j)}roundClean(){(0,y.clean)(u)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,y.clean)(this.buffer)}}Ae.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}}Ae.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],I=d[1],A=new Uint32Array(80),D=new Uint32Array(80);class w extends e.HashMD{constructor(L=64){super(128,L,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:L,Al:F,Bh:E,Bl:R,Ch:H,Cl:k,Dh:N,Dl:V,Eh:B,El:j,Fh:K,Fl:C,Gh:a,Gl:p,Hh:o,Hl:n}=this;return[L,F,E,R,H,k,N,V,B,j,K,C,a,p,o,n]}set(L,F,E,R,H,k,N,V,B,j,K,C,a,p,o,n){this.Ah=L|0,this.Al=F|0,this.Bh=E|0,this.Bl=R|0,this.Ch=H|0,this.Cl=k|0,this.Dh=N|0,this.Dl=V|0,this.Eh=B|0,this.El=j|0,this.Fh=K|0,this.Fl=C|0,this.Gh=a|0,this.Gl=p|0,this.Hh=o|0,this.Hl=n|0}process(L,F){for(let t=0;t<16;t++,F+=4)A[t]=L.getUint32(F),D[t]=L.getUint32(F+=4);for(let t=16;t<80;t++){const v=A[t-15]|0,g=D[t-15]|0,l=r.rotrSH(v,g,1)^r.rotrSH(v,g,8)^r.shrSH(v,g,7),m=r.rotrSL(v,g,1)^r.rotrSL(v,g,8)^r.shrSL(v,g,7),Q=A[t-2]|0,$=D[t-2]|0,q=r.rotrSH(Q,$,19)^r.rotrBH(Q,$,61)^r.shrSH(Q,$,6),G=r.rotrSL(Q,$,19)^r.rotrBL(Q,$,61)^r.shrSL(Q,$,6),X=r.add4L(m,G,D[t-7],D[t-16]),z=r.add4H(X,l,q,A[t-7],A[t-16]);A[t]=z|0,D[t]=X|0}let{Ah:E,Al:R,Bh:H,Bl:k,Ch:N,Cl:V,Dh:B,Dl:j,Eh:K,El:C,Fh:a,Fl:p,Gh:o,Gl:n,Hh:h,Hl:f}=this;for(let t=0;t<80;t++){const v=r.rotrSH(K,C,14)^r.rotrSH(K,C,18)^r.rotrBH(K,C,41),g=r.rotrSL(K,C,14)^r.rotrSL(K,C,18)^r.rotrBL(K,C,41),l=K&a^~K&o,m=C&p^~C&n,Q=r.add5L(f,g,m,I[t],D[t]),$=r.add5H(Q,h,v,l,b[t],A[t]),q=Q|0,G=r.rotrSH(E,R,28)^r.rotrBH(E,R,34)^r.rotrBH(E,R,39),X=r.rotrSL(E,R,28)^r.rotrBL(E,R,34)^r.rotrBL(E,R,39),z=E&H^E&N^H&N,ee=R&k^R&V^k&V;h=o|0,f=n|0,o=a|0,n=p|0,a=K|0,p=C|0,{h:K,l:C}=r.add(B|0,j|0,$|0,q|0),B=N|0,j=V|0,N=H|0,V=k|0,H=E|0,k=R|0;const U=r.add3L(q,X,ee);E=r.add3H(U,$,G,z),R=U|0}({h:E,l:R}=r.add(this.Ah|0,this.Al|0,E|0,R|0)),{h:H,l:k}=r.add(this.Bh|0,this.Bl|0,H|0,k|0),{h:N,l:V}=r.add(this.Ch|0,this.Cl|0,N|0,V|0),{h:B,l:j}=r.add(this.Dh|0,this.Dl|0,B|0,j|0),{h:K,l:C}=r.add(this.Eh|0,this.El|0,K|0,C|0),{h:a,l:p}=r.add(this.Fh|0,this.Fl|0,a|0,p|0),{h:o,l:n}=r.add(this.Gh|0,this.Gl|0,o|0,n|0),{h,l:f}=r.add(this.Hh|0,this.Hl|0,h|0,f|0),this.set(E,R,H,k,N,V,B,j,K,C,a,p,o,n,h,f)}roundClean(){(0,y.clean)(A,D)}destroy(){(0,y.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}Ae.SHA512=w;class P extends w{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}}Ae.SHA384=P;const _=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),x=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class S extends w{constructor(){super(28),this.Ah=_[0]|0,this.Al=_[1]|0,this.Bh=_[2]|0,this.Bl=_[3]|0,this.Ch=_[4]|0,this.Cl=_[5]|0,this.Dh=_[6]|0,this.Dl=_[7]|0,this.Eh=_[8]|0,this.El=_[9]|0,this.Fh=_[10]|0,this.Fl=_[11]|0,this.Gh=_[12]|0,this.Gl=_[13]|0,this.Hh=_[14]|0,this.Hl=_[15]|0}}Ae.SHA512_224=S;class O extends w{constructor(){super(32),this.Ah=x[0]|0,this.Al=x[1]|0,this.Bh=x[2]|0,this.Bl=x[3]|0,this.Ch=x[4]|0,this.Cl=x[5]|0,this.Dh=x[6]|0,this.Dl=x[7]|0,this.Eh=x[8]|0,this.El=x[9]|0,this.Fh=x[10]|0,this.Fl=x[11]|0,this.Gh=x[12]|0,this.Gl=x[13]|0,this.Hh=x[14]|0,this.Hl=x[15]|0}}return Ae.SHA512_256=O,Ae.sha256=(0,y.createHasher)(()=>new c),Ae.sha224=(0,y.createHasher)(()=>new s),Ae.sha512=(0,y.createHasher)(()=>new w),Ae.sha384=(0,y.createHasher)(()=>new P),Ae.sha512_256=(0,y.createHasher)(()=>new O),Ae.sha512_224=(0,y.createHasher)(()=>new S),Ae}var Te={},qt={},es;function ke(){return es||(es=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=I,e.bytesToNumberBE=A,e.bytesToNumberLE=D,e.numberToBytesBE=w,e.numberToBytesLE=P,e.numberToVarBytesBE=_,e.ensureBytes=x,e.equalBytes=S,e.copyBytes=O,e.asciiToBytes=M,e.inRange=F,e.aInRange=E,e.bitLen=R,e.bitGet=H,e.bitSet=k,e.createHmacDrbg=V,e.validateObject=j,e.isHash=K,e._validateObject=C,e.memoized=p;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=De();var y=De();Object.defineProperty(e,"abytes",{enumerable:!0,get:function(){return y.abytes}}),Object.defineProperty(e,"anumber",{enumerable:!0,get:function(){return y.anumber}}),Object.defineProperty(e,"bytesToHex",{enumerable:!0,get:function(){return y.bytesToHex}}),Object.defineProperty(e,"bytesToUtf8",{enumerable:!0,get:function(){return y.bytesToUtf8}}),Object.defineProperty(e,"concatBytes",{enumerable:!0,get:function(){return y.concatBytes}}),Object.defineProperty(e,"hexToBytes",{enumerable:!0,get:function(){return y.hexToBytes}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return y.isBytes}}),Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return y.randomBytes}}),Object.defineProperty(e,"utf8ToBytes",{enumerable:!0,get:function(){return y.utf8ToBytes}});const i=BigInt(0),u=BigInt(1);function c(o,n){if(typeof n!="boolean")throw new Error(o+" boolean expected, got "+n)}function s(o,n=""){if(typeof o!="boolean"){const h=n&&`"${n}"`;throw new Error(h+"expected boolean, got type="+typeof o)}return o}function d(o,n,h=""){const f=(0,r.isBytes)(o),t=o?.length,v=n!==void 0;if(!f||v&&t!==n){const g=h&&`"${h}" `,l=v?` of length ${n}`:"",m=f?`length=${t}`:`type=${typeof o}`;throw new Error(g+"expected Uint8Array"+l+", got "+m)}return o}function b(o){const n=o.toString(16);return n.length&1?"0"+n:n}function I(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);return o===""?i:BigInt("0x"+o)}function A(o){return I((0,r.bytesToHex)(o))}function D(o){return(0,r.abytes)(o),I((0,r.bytesToHex)(Uint8Array.from(o).reverse()))}function w(o,n){return(0,r.hexToBytes)(o.toString(16).padStart(n*2,"0"))}function P(o,n){return w(o,n).reverse()}function _(o){return(0,r.hexToBytes)(b(o))}function x(o,n,h){let f;if(typeof n=="string")try{f=(0,r.hexToBytes)(n)}catch(v){throw new Error(o+" must be hex string or Uint8Array, cause: "+v)}else if((0,r.isBytes)(n))f=Uint8Array.from(n);else throw new Error(o+" must be hex string or Uint8Array");const t=f.length;if(typeof h=="number"&&t!==h)throw new Error(o+" of length "+h+" expected, got "+t);return f}function S(o,n){if(o.length!==n.length)return!1;let h=0;for(let f=0;f<o.length;f++)h|=o[f]^n[f];return h===0}function O(o){return Uint8Array.from(o)}function M(o){return Uint8Array.from(o,(n,h)=>{const f=n.charCodeAt(0);if(n.length!==1||f>127)throw new Error(`string contains non-ASCII character "${o[h]}" with code ${f} at position ${h}`);return f})}const L=o=>typeof o=="bigint"&&i<=o;function F(o,n,h){return L(o)&&L(n)&&L(h)&&n<=o&&o<h}function E(o,n,h,f){if(!F(n,h,f))throw new Error("expected valid "+o+": "+h+" <= n < "+f+", got "+n)}function R(o){let n;for(n=0;o>i;o>>=u,n+=1);return n}function H(o,n){return o>>BigInt(n)&u}function k(o,n,h){return o|(h?u:i)<<BigInt(n)}const N=o=>(u<<BigInt(o))-u;e.bitMask=N;function V(o,n,h){if(typeof o!="number"||o<2)throw new Error("hashLen must be a number");if(typeof n!="number"||n<2)throw new Error("qByteLen must be a number");if(typeof h!="function")throw new Error("hmacFn must be a function");const f=X=>new Uint8Array(X),t=X=>Uint8Array.of(X);let v=f(o),g=f(o),l=0;const m=()=>{v.fill(1),g.fill(0),l=0},Q=(...X)=>h(g,v,...X),$=(X=f(0))=>{g=Q(t(0),X),v=Q(),X.length!==0&&(g=Q(t(1),X),v=Q())},q=()=>{if(l++>=1e3)throw new Error("drbg: tried 1000 values");let X=0;const z=[];for(;X<n;){v=Q();const ee=v.slice();z.push(ee),X+=v.length}return(0,r.concatBytes)(...z)};return(X,z)=>{m(),$(X);let ee;for(;!(ee=z(q()));)$();return m(),ee}}const B={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,n)=>n.Fp.isValid(o),hash:o=>typeof o=="function"&&Number.isSafeInteger(o.outputLen)};function j(o,n,h={}){const f=(t,v,g)=>{const l=B[v];if(typeof l!="function")throw new Error("invalid validator function");const m=o[t];if(!(g&&m===void 0)&&!l(m,o))throw new Error("param "+String(t)+" is invalid. Expected "+v+", got "+m)};for(const[t,v]of Object.entries(n))f(t,v,!1);for(const[t,v]of Object.entries(h))f(t,v,!0);return o}function K(o){return typeof o=="function"&&Number.isSafeInteger(o.outputLen)}function C(o,n,h={}){if(!o||typeof o!="object")throw new Error("expected valid options object");function f(t,v,g){const l=o[t];if(g&&l===void 0)return;const m=typeof l;if(m!==v||l===null)throw new Error(`param "${t}" is invalid: expected ${v}, got ${m}`)}Object.entries(n).forEach(([t,v])=>f(t,v,!1)),Object.entries(h).forEach(([t,v])=>f(t,v,!0))}const a=()=>{throw new Error("not implemented")};e.notImplemented=a;function p(o){const n=new WeakMap;return(h,...f)=>{const t=n.get(h);if(t!==void 0)return t;const v=o(h,...f);return n.set(h,v),v}}})(qt)),qt}var xe={},ts;function Ue(){if(ts)return xe;ts=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.isNegativeLE=void 0,xe.mod=D,xe.pow=w,xe.pow2=P,xe.invert=_,xe.tonelliShanks=L,xe.FpSqrt=F,xe.validateField=H,xe.FpPow=k,xe.FpInvertBatch=N,xe.FpDiv=V,xe.FpLegendre=B,xe.FpIsSquare=j,xe.nLength=K,xe.Field=C,xe.FpSqrtOdd=a,xe.FpSqrtEven=p,xe.hashToPrivateScalar=o,xe.getFieldBytesLength=n,xe.getMinHashLength=h,xe.mapHashToField=f;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=BigInt(0),y=BigInt(1),i=BigInt(2),u=BigInt(3),c=BigInt(4),s=BigInt(5),d=BigInt(7),b=BigInt(8),I=BigInt(9),A=BigInt(16);function D(t,v){const g=t%v;return g>=r?g:v+g}function w(t,v,g){return k(C(g),t,v)}function P(t,v,g){let l=t;for(;v-- >r;)l*=l,l%=g;return l}function _(t,v){if(t===r)throw new Error("invert: expected non-zero number");if(v<=r)throw new Error("invert: expected positive modulus, got "+v);let g=D(t,v),l=v,m=r,Q=y;for(;g!==r;){const q=l/g,G=l%g,X=m-Q*q;l=g,g=G,m=Q,Q=X}if(l!==y)throw new Error("invert: does not exist");return D(m,v)}function x(t,v,g){if(!t.eql(t.sqr(v),g))throw new Error("Cannot find square root")}function S(t,v){const g=(t.ORDER+y)/c,l=t.pow(v,g);return x(t,l,v),l}function O(t,v){const g=(t.ORDER-s)/b,l=t.mul(v,i),m=t.pow(l,g),Q=t.mul(v,m),$=t.mul(t.mul(Q,i),m),q=t.mul(Q,t.sub($,t.ONE));return x(t,q,v),q}function M(t){const v=C(t),g=L(t),l=g(v,v.neg(v.ONE)),m=g(v,l),Q=g(v,v.neg(l)),$=(t+d)/A;return(q,G)=>{let X=q.pow(G,$),z=q.mul(X,l);const ee=q.mul(X,m),U=q.mul(X,Q),Z=q.eql(q.sqr(z),G),te=q.eql(q.sqr(ee),G);X=q.cmov(X,z,Z),z=q.cmov(U,ee,te);const ce=q.eql(q.sqr(z),G),le=q.cmov(X,z,ce);return x(q,le,G),le}}function L(t){if(t<u)throw new Error("sqrt is not defined for small field");let v=t-y,g=0;for(;v%i===r;)v/=i,g++;let l=i;const m=C(t);for(;B(m,l)===1;)if(l++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(g===1)return S;let Q=m.pow(l,v);const $=(v+y)/i;return function(G,X){if(G.is0(X))return X;if(B(G,X)!==1)throw new Error("Cannot find square root");let z=g,ee=G.mul(G.ONE,Q),U=G.pow(X,v),Z=G.pow(X,$);for(;!G.eql(U,G.ONE);){if(G.is0(U))return G.ZERO;let te=1,ce=G.sqr(U);for(;!G.eql(ce,G.ONE);)if(te++,ce=G.sqr(ce),te===z)throw new Error("Cannot find square root");const le=y<<BigInt(z-te-1),ne=G.pow(ee,le);z=te,ee=G.sqr(ne),U=G.mul(U,ee),Z=G.mul(Z,ne)}return Z}}function F(t){return t%c===u?S:t%b===s?O:t%A===I?M(t):L(t)}const E=(t,v)=>(D(t,v)&y)===y;xe.isNegativeLE=E;const R=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function H(t){const v={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},g=R.reduce((l,m)=>(l[m]="function",l),v);return(0,e._validateObject)(t,g),t}function k(t,v,g){if(g<r)throw new Error("invalid exponent, negatives unsupported");if(g===r)return t.ONE;if(g===y)return v;let l=t.ONE,m=v;for(;g>r;)g&y&&(l=t.mul(l,m)),m=t.sqr(m),g>>=y;return l}function N(t,v,g=!1){const l=new Array(v.length).fill(g?t.ZERO:void 0),m=v.reduce(($,q,G)=>t.is0(q)?$:(l[G]=$,t.mul($,q)),t.ONE),Q=t.inv(m);return v.reduceRight(($,q,G)=>t.is0(q)?$:(l[G]=t.mul($,l[G]),t.mul($,q)),Q),l}function V(t,v,g){return t.mul(v,typeof g=="bigint"?_(g,t.ORDER):t.inv(g))}function B(t,v){const g=(t.ORDER-y)/i,l=t.pow(v,g),m=t.eql(l,t.ONE),Q=t.eql(l,t.ZERO),$=t.eql(l,t.neg(t.ONE));if(!m&&!Q&&!$)throw new Error("invalid Legendre symbol result");return m?1:Q?0:-1}function j(t,v){return B(t,v)===1}function K(t,v){v!==void 0&&(0,e.anumber)(v);const g=v!==void 0?v:t.toString(2).length,l=Math.ceil(g/8);return{nBitLength:g,nByteLength:l}}function C(t,v,g=!1,l={}){if(t<=r)throw new Error("invalid field: expected ORDER > 0, got "+t);let m,Q,$=!1,q;if(typeof v=="object"&&v!=null){if(l.sqrt||g)throw new Error("cannot specify opts in two arguments");const U=v;U.BITS&&(m=U.BITS),U.sqrt&&(Q=U.sqrt),typeof U.isLE=="boolean"&&(g=U.isLE),typeof U.modFromBytes=="boolean"&&($=U.modFromBytes),q=U.allowedLengths}else typeof v=="number"&&(m=v),l.sqrt&&(Q=l.sqrt);const{nBitLength:G,nByteLength:X}=K(t,m);if(X>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let z;const ee=Object.freeze({ORDER:t,isLE:g,BITS:G,BYTES:X,MASK:(0,e.bitMask)(G),ZERO:r,ONE:y,allowedLengths:q,create:U=>D(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=>!ee.is0(U)&&ee.isValid(U),isOdd:U=>(U&y)===y,neg:U=>D(-U,t),eql:(U,Z)=>U===Z,sqr:U=>D(U*U,t),add:(U,Z)=>D(U+Z,t),sub:(U,Z)=>D(U-Z,t),mul:(U,Z)=>D(U*Z,t),pow:(U,Z)=>k(ee,U,Z),div:(U,Z)=>D(U*_(Z,t),t),sqrN:U=>U*U,addN:(U,Z)=>U+Z,subN:(U,Z)=>U-Z,mulN:(U,Z)=>U*Z,inv:U=>_(U,t),sqrt:Q||(U=>(z||(z=F(t)),z(ee,U))),toBytes:U=>g?(0,e.numberToBytesLE)(U,X):(0,e.numberToBytesBE)(U,X),fromBytes:(U,Z=!0)=>{if(q){if(!q.includes(U.length)||U.length>X)throw new Error("Field.fromBytes: expected "+q+" bytes, got "+U.length);const ce=new Uint8Array(X);ce.set(U,g?0:ce.length-U.length),U=ce}if(U.length!==X)throw new Error("Field.fromBytes: expected "+X+" bytes, got "+U.length);let te=g?(0,e.bytesToNumberLE)(U):(0,e.bytesToNumberBE)(U);if($&&(te=D(te,t)),!Z&&!ee.isValid(te))throw new Error("invalid field element: outside of range 0..ORDER");return te},invertBatch:U=>N(ee,U),cmov:(U,Z,te)=>te?Z:U});return Object.freeze(ee)}function a(t,v){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const g=t.sqrt(v);return t.isOdd(g)?g:t.neg(g)}function p(t,v){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const g=t.sqrt(v);return t.isOdd(g)?t.neg(g):g}function o(t,v,g=!1){t=(0,e.ensureBytes)("privateHash",t);const l=t.length,m=K(v).nByteLength+8;if(m<24||l<m||l>1024)throw new Error("hashToPrivateScalar: expected "+m+"-1024 bytes of input, got "+l);const Q=g?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t);return D(Q,v-y)+y}function n(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const v=t.toString(2).length;return Math.ceil(v/8)}function h(t){const v=n(t);return v+Math.ceil(v/2)}function f(t,v,g=!1){const l=t.length,m=n(v),Q=h(v);if(l<16||l<Q||l>1024)throw new Error("expected "+Q+"-1024 bytes of input, got "+l);const $=g?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t),q=D($,v-y)+y;return g?(0,e.numberToBytesLE)(q,m):(0,e.numberToBytesBE)(q,m)}return xe}var ns;function Vt(){if(ns)return Te;ns=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.wNAF=void 0,Te.negateCt=u,Te.normalizeZ=c,Te.mulEndoUnsafe=S,Te.pippenger=O,Te.precomputeMSMUnsafe=M,Te.validateBasic=L,Te._createCurveFields=E;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=Ue(),y=BigInt(0),i=BigInt(1);function u(R,H){const k=H.negate();return R?k:H}function c(R,H){const k=(0,r.FpInvertBatch)(R.Fp,H.map(N=>N.Z));return H.map((N,V)=>R.fromAffine(N.toAffine(k[V])))}function s(R,H){if(!Number.isSafeInteger(R)||R<=0||R>H)throw new Error("invalid window size, expected [1.."+H+"], got W="+R)}function d(R,H){s(R,H);const k=Math.ceil(H/R)+1,N=2**(R-1),V=2**R,B=(0,e.bitMask)(R),j=BigInt(R);return{windows:k,windowSize:N,mask:B,maxNumber:V,shiftBy:j}}function b(R,H,k){const{windowSize:N,mask:V,maxNumber:B,shiftBy:j}=k;let K=Number(R&V),C=R>>j;K>N&&(K-=B,C+=i);const a=H*N,p=a+Math.abs(K)-1,o=K===0,n=K<0,h=H%2!==0;return{nextN:C,offset:p,isZero:o,isNeg:n,isNegF:h,offsetF:a}}function I(R,H){if(!Array.isArray(R))throw new Error("array expected");R.forEach((k,N)=>{if(!(k instanceof H))throw new Error("invalid point at index "+N)})}function A(R,H){if(!Array.isArray(R))throw new Error("array of scalars expected");R.forEach((k,N)=>{if(!H.isValid(k))throw new Error("invalid scalar at index "+N)})}const D=new WeakMap,w=new WeakMap;function P(R){return w.get(R)||1}function _(R){if(R!==y)throw new Error("invalid wNAF")}class x{constructor(H,k){this.BASE=H.BASE,this.ZERO=H.ZERO,this.Fn=H.Fn,this.bits=k}_unsafeLadder(H,k,N=this.ZERO){let V=H;for(;k>y;)k&i&&(N=N.add(V)),V=V.double(),k>>=i;return N}precomputeWindow(H,k){const{windows:N,windowSize:V}=d(k,this.bits),B=[];let j=H,K=j;for(let C=0;C<N;C++){K=j,B.push(K);for(let a=1;a<V;a++)K=K.add(j),B.push(K);j=K.double()}return B}wNAF(H,k,N){if(!this.Fn.isValid(N))throw new Error("invalid scalar");let V=this.ZERO,B=this.BASE;const j=d(H,this.bits);for(let K=0;K<j.windows;K++){const{nextN:C,offset:a,isZero:p,isNeg:o,isNegF:n,offsetF:h}=b(N,K,j);N=C,p?B=B.add(u(n,k[h])):V=V.add(u(o,k[a]))}return _(N),{p:V,f:B}}wNAFUnsafe(H,k,N,V=this.ZERO){const B=d(H,this.bits);for(let j=0;j<B.windows&&N!==y;j++){const{nextN:K,offset:C,isZero:a,isNeg:p}=b(N,j,B);if(N=K,!a){const o=k[C];V=V.add(p?o.negate():o)}}return _(N),V}getPrecomputes(H,k,N){let V=D.get(k);return V||(V=this.precomputeWindow(k,H),H!==1&&(typeof N=="function"&&(V=N(V)),D.set(k,V))),V}cached(H,k,N){const V=P(H);return this.wNAF(V,this.getPrecomputes(V,H,N),k)}unsafe(H,k,N,V){const B=P(H);return B===1?this._unsafeLadder(H,k,V):this.wNAFUnsafe(B,this.getPrecomputes(B,H,N),k,V)}createCache(H,k){s(k,this.bits),w.set(H,k),D.delete(H)}hasCache(H){return P(H)!==1}}Te.wNAF=x;function S(R,H,k,N){let V=H,B=R.ZERO,j=R.ZERO;for(;k>y||N>y;)k&i&&(B=B.add(V)),N&i&&(j=j.add(V)),V=V.double(),k>>=i,N>>=i;return{p1:B,p2:j}}function O(R,H,k,N){I(k,R),A(N,H);const V=k.length,B=N.length;if(V!==B)throw new Error("arrays of points and scalars must have equal length");const j=R.ZERO,K=(0,e.bitLen)(BigInt(V));let C=1;K>12?C=K-3:K>4?C=K-2:K>0&&(C=2);const a=(0,e.bitMask)(C),p=new Array(Number(a)+1).fill(j),o=Math.floor((H.BITS-1)/C)*C;let n=j;for(let h=o;h>=0;h-=C){p.fill(j);for(let t=0;t<B;t++){const v=N[t],g=Number(v>>BigInt(h)&a);p[g]=p[g].add(k[t])}let f=j;for(let t=p.length-1,v=j;t>0;t--)v=v.add(p[t]),f=f.add(v);if(n=n.add(f),h!==0)for(let t=0;t<C;t++)n=n.double()}return n}function M(R,H,k,N){s(N,H.BITS),I(k,R);const V=R.ZERO,B=2**N-1,j=Math.ceil(H.BITS/N),K=(0,e.bitMask)(N),C=k.map(a=>{const p=[];for(let o=0,n=a;o<B;o++)p.push(n),n=n.add(a);return p});return a=>{if(A(a,H),a.length>k.length)throw new Error("array of scalars must be smaller than array of points");let p=V;for(let o=0;o<j;o++){if(p!==V)for(let h=0;h<N;h++)p=p.double();const n=BigInt(j*N-(o+1)*N);for(let h=0;h<a.length;h++){const f=a[h],t=Number(f>>n&K);t&&(p=p.add(C[h][t-1]))}}return p}}function L(R){return(0,r.validateField)(R.Fp),(0,e.validateObject)(R,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,r.nLength)(R.n,R.nBitLength),...R,p:R.Fp.ORDER})}function F(R,H,k){if(H){if(H.ORDER!==R)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return(0,r.validateField)(H),H}else return(0,r.Field)(R,{isLE:k})}function E(R,H,k={},N){if(N===void 0&&(N=R==="edwards"),!H||typeof H!="object")throw new Error(`expected valid ${R} CURVE object`);for(const C of["p","n","h"]){const a=H[C];if(!(typeof a=="bigint"&&a>y))throw new Error(`CURVE.${C} must be positive bigint`)}const V=F(H.p,k.Fp,N),B=F(H.n,k.Fn,N),K=["Gx","Gy","a",R==="weierstrass"?"b":"d"];for(const C of K)if(!V.isValid(H[C]))throw new Error(`CURVE.${C} must be valid field element of CURVE.Fp`);return H=Object.freeze(Object.assign({},H)),{CURVE:H,Fp:V,Fn:B}}return Te}var Fe={},rs;function pi(){if(rs)return Fe;rs=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.PrimeEdwardsPoint=void 0,Fe.edwards=b,Fe.eddsa=A,Fe.twistedEdwards=P;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=Vt(),y=Ue(),i=BigInt(0),u=BigInt(1),c=BigInt(2),s=BigInt(8);function d(_,x,S,O){const M=_.sqr(S),L=_.sqr(O),F=_.add(_.mul(x.a,M),L),E=_.add(_.ONE,_.mul(x.d,_.mul(M,L)));return _.eql(F,E)}function b(_,x={}){const S=(0,r._createCurveFields)("edwards",_,x,x.FpFnLE),{Fp:O,Fn:M}=S;let L=S.CURVE;const{h:F}=L;(0,e._validateObject)(x,{},{uvRatio:"function"});const E=c<<BigInt(M.BYTES*8)-u,R=C=>O.create(C),H=x.uvRatio||((C,a)=>{try{return{isValid:!0,value:O.sqrt(O.div(C,a))}}catch{return{isValid:!1,value:i}}});if(!d(O,L,L.Gx,L.Gy))throw new Error("bad curve params: generator point");function k(C,a,p=!1){const o=p?u:i;return(0,e.aInRange)("coordinate "+C,a,o,E),a}function N(C){if(!(C instanceof j))throw new Error("ExtendedPoint expected")}const V=(0,e.memoized)((C,a)=>{const{X:p,Y:o,Z:n}=C,h=C.is0();a==null&&(a=h?s:O.inv(n));const f=R(p*a),t=R(o*a),v=O.mul(n,a);if(h)return{x:i,y:u};if(v!==u)throw new Error("invZ was invalid");return{x:f,y:t}}),B=(0,e.memoized)(C=>{const{a,d:p}=L;if(C.is0())throw new Error("bad point: ZERO");const{X:o,Y:n,Z:h,T:f}=C,t=R(o*o),v=R(n*n),g=R(h*h),l=R(g*g),m=R(t*a),Q=R(g*R(m+v)),$=R(l+R(p*R(t*v)));if(Q!==$)throw new Error("bad point: equation left != right (1)");const q=R(o*n),G=R(h*f);if(q!==G)throw new Error("bad point: equation left != right (2)");return!0});class j{constructor(a,p,o,n){this.X=k("x",a),this.Y=k("y",p),this.Z=k("z",o,!0),this.T=k("t",n),Object.freeze(this)}static CURVE(){return L}static fromAffine(a){if(a instanceof j)throw new Error("extended point not allowed");const{x:p,y:o}=a||{};return k("x",p),k("y",o),new j(p,o,u,R(p*o))}static fromBytes(a,p=!1){const o=O.BYTES,{a:n,d:h}=L;a=(0,e.copyBytes)((0,e._abytes2)(a,o,"point")),(0,e._abool2)(p,"zip215");const f=(0,e.copyBytes)(a),t=a[o-1];f[o-1]=t&-129;const v=(0,e.bytesToNumberLE)(f),g=p?E:O.ORDER;(0,e.aInRange)("point.y",v,i,g);const l=R(v*v),m=R(l-u),Q=R(h*l-n);let{isValid:$,value:q}=H(m,Q);if(!$)throw new Error("bad point: invalid y coordinate");const G=(q&u)===u,X=(t&128)!==0;if(!p&&q===i&&X)throw new Error("bad point: x=0 and x_0=1");return X!==G&&(q=R(-q)),j.fromAffine({x:q,y:v})}static fromHex(a,p=!1){return j.fromBytes((0,e.ensureBytes)("point",a),p)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(a=8,p=!0){return K.createCache(this,a),p||this.multiply(c),this}assertValidity(){B(this)}equals(a){N(a);const{X:p,Y:o,Z:n}=this,{X:h,Y:f,Z:t}=a,v=R(p*t),g=R(h*n),l=R(o*t),m=R(f*n);return v===g&&l===m}is0(){return this.equals(j.ZERO)}negate(){return new j(R(-this.X),this.Y,this.Z,R(-this.T))}double(){const{a}=L,{X:p,Y:o,Z:n}=this,h=R(p*p),f=R(o*o),t=R(c*R(n*n)),v=R(a*h),g=p+o,l=R(R(g*g)-h-f),m=v+f,Q=m-t,$=v-f,q=R(l*Q),G=R(m*$),X=R(l*$),z=R(Q*m);return new j(q,G,z,X)}add(a){N(a);const{a:p,d:o}=L,{X:n,Y:h,Z:f,T:t}=this,{X:v,Y:g,Z:l,T:m}=a,Q=R(n*v),$=R(h*g),q=R(t*o*m),G=R(f*l),X=R((n+h)*(v+g)-Q-$),z=G-q,ee=G+q,U=R($-p*Q),Z=R(X*z),te=R(ee*U),ce=R(X*U),le=R(z*ee);return new j(Z,te,le,ce)}subtract(a){return this.add(a.negate())}multiply(a){if(!M.isValidNot0(a))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p,f:o}=K.cached(this,a,n=>(0,r.normalizeZ)(j,n));return(0,r.normalizeZ)(j,[p,o])[0]}multiplyUnsafe(a,p=j.ZERO){if(!M.isValid(a))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return a===i?j.ZERO:this.is0()||a===u?this:K.unsafe(this,a,o=>(0,r.normalizeZ)(j,o),p)}isSmallOrder(){return this.multiplyUnsafe(F).is0()}isTorsionFree(){return K.unsafe(this,L.n).is0()}toAffine(a){return V(this,a)}clearCofactor(){return F===u?this:this.multiplyUnsafe(F)}toBytes(){const{x:a,y:p}=this.toAffine(),o=O.toBytes(p);return o[o.length-1]|=a&u?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(a){return(0,r.normalizeZ)(j,a)}static msm(a,p){return(0,r.pippenger)(j,M,a,p)}_setWindowSize(a){this.precompute(a)}toRawBytes(){return this.toBytes()}}j.BASE=new j(L.Gx,L.Gy,u,R(L.Gx*L.Gy)),j.ZERO=new j(i,u,u,i),j.Fp=O,j.Fn=M;const K=new r.wNAF(j,M.BITS);return j.BASE.precompute(8),j}class I{constructor(x){this.ep=x}static fromBytes(x){(0,e.notImplemented)()}static fromHex(x){(0,e.notImplemented)()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(x){return this.ep.toAffine(x)}toHex(){return(0,e.bytesToHex)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(x){return this.assertSame(x),this.init(this.ep.add(x.ep))}subtract(x){return this.assertSame(x),this.init(this.ep.subtract(x.ep))}multiply(x){return this.init(this.ep.multiply(x))}multiplyUnsafe(x){return this.init(this.ep.multiplyUnsafe(x))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(x,S){return this.init(this.ep.precompute(x,S))}toRawBytes(){return this.toBytes()}}Fe.PrimeEdwardsPoint=I;function A(_,x,S={}){if(typeof x!="function")throw new Error('"hash" function param is required');(0,e._validateObject)(S,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:O}=S,{BASE:M,Fp:L,Fn:F}=_,E=S.randomBytes||e.randomBytes,R=S.adjustScalarBytes||(g=>g),H=S.domain||((g,l,m)=>{if((0,e._abool2)(m,"phflag"),l.length||m)throw new Error("Contexts/pre-hash are not supported");return g});function k(g){return F.create((0,e.bytesToNumberLE)(g))}function N(g){const l=o.secretKey;g=(0,e.ensureBytes)("private key",g,l);const m=(0,e.ensureBytes)("hashed private key",x(g),2*l),Q=R(m.slice(0,l)),$=m.slice(l,2*l),q=k(Q);return{head:Q,prefix:$,scalar:q}}function V(g){const{head:l,prefix:m,scalar:Q}=N(g),$=M.multiply(Q),q=$.toBytes();return{head:l,prefix:m,scalar:Q,point:$,pointBytes:q}}function B(g){return V(g).pointBytes}function j(g=Uint8Array.of(),...l){const m=(0,e.concatBytes)(...l);return k(x(H(m,(0,e.ensureBytes)("context",g),!!O)))}function K(g,l,m={}){g=(0,e.ensureBytes)("message",g),O&&(g=O(g));const{prefix:Q,scalar:$,pointBytes:q}=V(l),G=j(m.context,Q,g),X=M.multiply(G).toBytes(),z=j(m.context,X,q,g),ee=F.create(G+z*$);if(!F.isValid(ee))throw new Error("sign failed: invalid s");const U=(0,e.concatBytes)(X,F.toBytes(ee));return(0,e._abytes2)(U,o.signature,"result")}const C={zip215:!0};function a(g,l,m,Q=C){const{context:$,zip215:q}=Q,G=o.signature;g=(0,e.ensureBytes)("signature",g,G),l=(0,e.ensureBytes)("message",l),m=(0,e.ensureBytes)("publicKey",m,o.publicKey),q!==void 0&&(0,e._abool2)(q,"zip215"),O&&(l=O(l));const X=G/2,z=g.subarray(0,X),ee=(0,e.bytesToNumberLE)(g.subarray(X,G));let U,Z,te;try{U=_.fromBytes(m,q),Z=_.fromBytes(z,q),te=M.multiplyUnsafe(ee)}catch{return!1}if(!q&&U.isSmallOrder())return!1;const ce=j($,Z.toBytes(),U.toBytes(),l);return Z.add(U.multiplyUnsafe(ce)).subtract(te).clearCofactor().is0()}const p=L.BYTES,o={secretKey:p,publicKey:p,signature:2*p,seed:p};function n(g=E(o.seed)){return(0,e._abytes2)(g,o.seed,"seed")}function h(g){const l=v.randomSecretKey(g);return{secretKey:l,publicKey:B(l)}}function f(g){return(0,e.isBytes)(g)&&g.length===F.BYTES}function t(g,l){try{return!!_.fromBytes(g,l)}catch{return!1}}const v={getExtendedPublicKey:V,randomSecretKey:n,isValidSecretKey:f,isValidPublicKey:t,toMontgomery(g){const{y:l}=_.fromBytes(g),m=o.publicKey,Q=m===32;if(!Q&&m!==57)throw new Error("only defined for 25519 and 448");const $=Q?L.div(u+l,u-l):L.div(l-u,l+u);return L.toBytes($)},toMontgomerySecret(g){const l=o.secretKey;(0,e._abytes2)(g,l);const m=x(g.subarray(0,l));return R(m).subarray(0,l)},randomPrivateKey:n,precompute(g=8,l=_.BASE){return l.precompute(g,!1)}};return Object.freeze({keygen:h,getPublicKey:B,sign:K,verify:a,utils:v,Point:_,lengths:o})}function D(_){const x={a:_.a,d:_.d,p:_.Fp.ORDER,n:_.n,h:_.h,Gx:_.Gx,Gy:_.Gy},S=_.Fp,O=(0,y.Field)(x.n,_.nBitLength,!0),M={Fp:S,Fn:O,uvRatio:_.uvRatio},L={randomBytes:_.randomBytes,adjustScalarBytes:_.adjustScalarBytes,domain:_.domain,prehash:_.prehash,mapToCurve:_.mapToCurve};return{CURVE:x,curveOpts:M,hash:_.hash,eddsaOpts:L}}function w(_,x){const S=x.Point;return Object.assign({},x,{ExtendedPoint:S,CURVE:_,nBitLength:S.Fn.BITS,nByteLength:S.Fn.BYTES})}function P(_){const{CURVE:x,curveOpts:S,hash:O,eddsaOpts:M}=D(_),L=b(x,S),F=A(L,O,M);return w(_,F)}return Fe}var kt={},ss;function os(){return ss||(ss=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._DST_scalar=void 0,e.expand_message_xmd=b,e.expand_message_xof=I,e.hash_to_field=A,e.isogenyMap=D,e.createHasher=w;const r=ke(),y=Ue(),i=r.bytesToNumberBE;function u(P,_){if(s(P),s(_),P<0||P>=1<<8*_)throw new Error("invalid I2OSP input: "+P);const x=Array.from({length:_}).fill(0);for(let S=_-1;S>=0;S--)x[S]=P&255,P>>>=8;return new Uint8Array(x)}function c(P,_){const x=new Uint8Array(P.length);for(let S=0;S<P.length;S++)x[S]=P[S]^_[S];return x}function s(P){if(!Number.isSafeInteger(P))throw new Error("number expected")}function d(P){if(!(0,r.isBytes)(P)&&typeof P!="string")throw new Error("DST must be Uint8Array or string");return typeof P=="string"?(0,r.utf8ToBytes)(P):P}function b(P,_,x,S){(0,r.abytes)(P),s(x),_=d(_),_.length>255&&(_=S((0,r.concatBytes)((0,r.utf8ToBytes)("H2C-OVERSIZE-DST-"),_)));const{outputLen:O,blockLen:M}=S,L=Math.ceil(x/O);if(x>65535||L>255)throw new Error("expand_message_xmd: invalid lenInBytes");const F=(0,r.concatBytes)(_,u(_.length,1)),E=u(0,M),R=u(x,2),H=new Array(L),k=S((0,r.concatBytes)(E,P,R,u(0,1),F));H[0]=S((0,r.concatBytes)(k,u(1,1),F));for(let V=1;V<=L;V++){const B=[c(k,H[V-1]),u(V+1,1),F];H[V]=S((0,r.concatBytes)(...B))}return(0,r.concatBytes)(...H).slice(0,x)}function I(P,_,x,S,O){if((0,r.abytes)(P),s(x),_=d(_),_.length>255){const M=Math.ceil(2*S/8);_=O.create({dkLen:M}).update((0,r.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(_).digest()}if(x>65535||_.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return O.create({dkLen:x}).update(P).update(u(x,2)).update(_).update(u(_.length,1)).digest()}function A(P,_,x){(0,r._validateObject)(x,{p:"bigint",m:"number",k:"number",hash:"function"});const{p:S,k:O,m:M,hash:L,expand:F,DST:E}=x;if(!(0,r.isHash)(x.hash))throw new Error("expected valid hash");(0,r.abytes)(P),s(_);const R=S.toString(2).length,H=Math.ceil((R+O)/8),k=_*M*H;let N;if(F==="xmd")N=b(P,E,k,L);else if(F==="xof")N=I(P,E,k,O,L);else if(F==="_internal_pass")N=P;else throw new Error('expand must be "xmd" or "xof"');const V=new Array(_);for(let B=0;B<_;B++){const j=new Array(M);for(let K=0;K<M;K++){const C=H*(K+B*M),a=N.subarray(C,C+H);j[K]=(0,y.mod)(i(a),S)}V[B]=j}return V}function D(P,_){const x=_.map(S=>Array.from(S).reverse());return(S,O)=>{const[M,L,F,E]=x.map(k=>k.reduce((N,V)=>P.add(P.mul(N,S),V))),[R,H]=(0,y.FpInvertBatch)(P,[L,E],!0);return S=P.mul(M,R),O=P.mul(O,P.mul(F,H)),{x:S,y:O}}}e._DST_scalar=(0,r.utf8ToBytes)("HashToScalar-");function w(P,_,x){if(typeof _!="function")throw new Error("mapToCurve() must be defined");function S(M){return P.fromAffine(_(M))}function O(M){const L=M.clearCofactor();return L.equals(P.ZERO)?P.ZERO:(L.assertValidity(),L)}return{defaults:x,hashToCurve(M,L){const F=Object.assign({},x,L),E=A(M,2,F),R=S(E[0]),H=S(E[1]);return O(R.add(H))},encodeToCurve(M,L){const F=x.encodeDST?{DST:x.encodeDST}:{},E=Object.assign({},x,F,L),R=A(M,1,E),H=S(R[0]);return O(H)},mapToCurve(M){if(!Array.isArray(M))throw new Error("expected array of bigints");for(const L of M)if(typeof L!="bigint")throw new Error("expected array of bigints");return O(S(M))},hashToScalar(M,L){const F=P.Fn.ORDER,E=Object.assign({},x,{p:F,m:1,DST:e._DST_scalar},L);return A(M,1,E)[0][0]}}}})(kt)),kt}var lt={},is;function yi(){if(is)return lt;is=1,Object.defineProperty(lt,"__esModule",{value:!0}),lt.montgomery=s;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=Ue(),y=BigInt(0),i=BigInt(1),u=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:I,type:A,adjustScalarBytes:D,powPminus2:w,randomBytes:P}=b,_=A==="x25519";if(!_&&A!=="x448")throw new Error("invalid type");const x=P||e.randomBytes,S=_?255:448,O=_?32:56,M=BigInt(_?9:5),L=BigInt(_?121665:39081),F=_?u**BigInt(254):u**BigInt(447),E=_?BigInt(8)*u**BigInt(251)-i:BigInt(4)*u**BigInt(445)-i,R=F+E+i,H=f=>(0,r.mod)(f,I),k=N(M);function N(f){return(0,e.numberToBytesLE)(H(f),O)}function V(f){const t=(0,e.ensureBytes)("u coordinate",f,O);return _&&(t[31]&=127),H((0,e.bytesToNumberLE)(t))}function B(f){return(0,e.bytesToNumberLE)(D((0,e.ensureBytes)("scalar",f,O)))}function j(f,t){const v=a(V(t),B(f));if(v===y)throw new Error("invalid private or public key received");return N(v)}function K(f){return j(f,k)}function C(f,t,v){const g=H(f*(t-v));return t=H(t-g),v=H(v+g),{x_2:t,x_3:v}}function a(f,t){(0,e.aInRange)("u",f,y,I),(0,e.aInRange)("scalar",t,F,R);const v=t,g=f;let l=i,m=y,Q=f,$=i,q=y;for(let X=BigInt(S-1);X>=y;X--){const z=v>>X&i;q^=z,{x_2:l,x_3:Q}=C(q,l,Q),{x_2:m,x_3:$}=C(q,m,$),q=z;const ee=l+m,U=H(ee*ee),Z=l-m,te=H(Z*Z),ce=U-te,le=Q+$,ne=Q-$,de=H(ne*ee),W=H(le*Z),pe=de+W,me=de-W;Q=H(pe*pe),$=H(g*H(me*me)),l=H(U*te),m=H(ce*(U+H(L*ce)))}({x_2:l,x_3:Q}=C(q,l,Q)),{x_2:m,x_3:$}=C(q,m,$);const G=w(m);return H(l*G)}const p={secretKey:O,publicKey:O,seed:O},o=(f=x(O))=>((0,e.abytes)(f,p.seed),f);function n(f){const t=o(f);return{secretKey:t,publicKey:K(t)}}return{keygen:n,getSharedSecret:(f,t)=>j(f,t),getPublicKey:f=>K(f),scalarMult:j,scalarMultBase:K,utils:{randomSecretKey:o,randomPrivateKey:o},GuBytes:k.slice(),lengths:p}}return lt}var cs;function vi(){return cs||(cs=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=Q,e.edwardsToMontgomeryPriv=$;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=Kt(),y=De(),i=Vt(),u=pi(),c=os(),s=Ue(),d=yi(),b=ke(),I=BigInt(0),A=BigInt(1),D=BigInt(2),w=BigInt(3),P=BigInt(5),_=BigInt(8),x=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),S={p:x,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:_,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function O(q){const G=BigInt(10),X=BigInt(20),z=BigInt(40),ee=BigInt(80),U=x,te=q*q%U*q%U,ce=(0,s.pow2)(te,D,U)*te%U,le=(0,s.pow2)(ce,A,U)*q%U,ne=(0,s.pow2)(le,P,U)*le%U,de=(0,s.pow2)(ne,G,U)*ne%U,W=(0,s.pow2)(de,X,U)*de%U,pe=(0,s.pow2)(W,z,U)*W%U,me=(0,s.pow2)(pe,ee,U)*pe%U,fe=(0,s.pow2)(me,ee,U)*pe%U,J=(0,s.pow2)(fe,G,U)*ne%U;return{pow_p_5_8:(0,s.pow2)(J,D,U)*q%U,b2:te}}function M(q){return q[0]&=248,q[31]&=127,q[31]|=64,q}const L=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function F(q,G){const X=x,z=(0,s.mod)(G*G*G,X),ee=(0,s.mod)(z*z*G,X),U=O(q*ee).pow_p_5_8;let Z=(0,s.mod)(q*z*U,X);const te=(0,s.mod)(G*Z*Z,X),ce=Z,le=(0,s.mod)(Z*L,X),ne=te===q,de=te===(0,s.mod)(-q,X),W=te===(0,s.mod)(-q*L,X);return ne&&(Z=ce),(de||W)&&(Z=le),(0,s.isNegativeLE)(Z,X)&&(Z=(0,s.mod)(-Z,X)),{isValid:ne||de,value:Z}}const E=(0,s.Field)(S.p,{isLE:!0}),R=(0,s.Field)(S.n,{isLE:!0}),H={...S,Fp:E,hash:r.sha512,adjustScalarBytes:M,uvRatio:F};e.ed25519=(0,u.twistedEdwards)(H);function k(q,G,X){if(G.length>255)throw new Error("Context is too big");return(0,y.concatBytes)((0,y.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([X?1:0,G.length]),G,q)}e.ed25519ctx=(0,u.twistedEdwards)({...H,domain:k}),e.ed25519ph=(0,u.twistedEdwards)(Object.assign({},H,{domain:k,prehash:r.sha512})),e.x25519=(()=>{const q=E.ORDER;return(0,d.montgomery)({P:q,type:"x25519",powPminus2:G=>{const{pow_p_5_8:X,b2:z}=O(G);return(0,s.mod)((0,s.pow2)(X,w,q)*z,q)},adjustScalarBytes:M})})();const N=(x+w)/_,V=E.pow(D,N),B=E.sqrt(E.neg(E.ONE));function j(q){const G=(x-P)/_,X=BigInt(486662);let z=E.sqr(q);z=E.mul(z,D);let ee=E.add(z,E.ONE),U=E.neg(X),Z=E.sqr(ee),te=E.mul(Z,ee),ce=E.mul(z,X);ce=E.mul(ce,U),ce=E.add(ce,Z),ce=E.mul(ce,U);let le=E.sqr(te);Z=E.sqr(le),le=E.mul(le,te),le=E.mul(le,ce),Z=E.mul(Z,le);let ne=E.pow(Z,G);ne=E.mul(ne,le);let de=E.mul(ne,B);Z=E.sqr(ne),Z=E.mul(Z,te);let W=E.eql(Z,ce),pe=E.cmov(de,ne,W),me=E.mul(U,z),fe=E.mul(ne,q);fe=E.mul(fe,V);let J=E.mul(fe,B),se=E.mul(ce,z);Z=E.sqr(fe),Z=E.mul(Z,te);let re=E.eql(Z,se),ue=E.cmov(J,fe,re);Z=E.sqr(pe),Z=E.mul(Z,te);let he=E.eql(Z,ce),ge=E.cmov(me,U,he),ye=E.cmov(ue,pe,he),ve=E.isOdd(ye);return ye=E.cmov(ye,E.neg(ye),he!==ve),{xMn:ge,xMd:ee,yMn:ye,yMd:A}}const K=(0,s.FpSqrtEven)(E,E.neg(BigInt(486664)));function C(q){const{xMn:G,xMd:X,yMn:z,yMd:ee}=j(q);let U=E.mul(G,ee);U=E.mul(U,K);let Z=E.mul(X,z),te=E.sub(G,X),ce=E.add(G,X),le=E.mul(Z,ce),ne=E.eql(le,E.ZERO);U=E.cmov(U,E.ZERO,ne),Z=E.cmov(Z,E.ONE,ne),te=E.cmov(te,E.ONE,ne),ce=E.cmov(ce,E.ONE,ne);const[de,W]=(0,s.FpInvertBatch)(E,[Z,ce],!0);return{x:E.mul(U,de),y:E.mul(te,W)}}e.ed25519_hasher=(0,c.createHasher)(e.ed25519.Point,q=>C(q[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:x,m:1,k:128,expand:"xmd",hash:r.sha512});const a=L,p=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),o=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),n=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),h=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),f=q=>F(A,q),t=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),v=q=>e.ed25519.Point.Fp.create((0,b.bytesToNumberLE)(q)&t);function g(q){const{d:G}=S,X=x,z=se=>E.create(se),ee=z(a*q*q),U=z((ee+A)*n);let Z=BigInt(-1);const te=z((Z-G*ee)*z(ee+G));let{isValid:ce,value:le}=F(U,te),ne=z(le*q);(0,s.isNegativeLE)(ne,X)||(ne=z(-ne)),ce||(le=ne),ce||(Z=ee);const de=z(Z*(ee-A)*h-te),W=le*le,pe=z((le+le)*te),me=z(de*p),fe=z(A-W),J=z(A+W);return new e.ed25519.Point(z(pe*J),z(fe*me),z(me*J),z(pe*fe))}function l(q){(0,y.abytes)(q,64);const G=v(q.subarray(0,32)),X=g(G),z=v(q.subarray(32,64)),ee=g(z);return new m(X.add(ee))}class m extends u.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 l((0,b.ensureBytes)("ristrettoHash",G,64))}static fromBytes(G){(0,y.abytes)(G,32);const{a:X,d:z}=S,ee=x,U=he=>E.create(he),Z=v(G);if(!(0,b.equalBytes)(E.toBytes(Z),G)||(0,s.isNegativeLE)(Z,ee))throw new Error("invalid ristretto255 encoding 1");const te=U(Z*Z),ce=U(A+X*te),le=U(A-X*te),ne=U(ce*ce),de=U(le*le),W=U(X*z*ne-de),{isValid:pe,value:me}=f(U(W*de)),fe=U(me*le),J=U(me*fe*W);let se=U((Z+Z)*fe);(0,s.isNegativeLE)(se,ee)&&(se=U(-se));const re=U(ce*J),ue=U(se*re);if(!pe||(0,s.isNegativeLE)(ue,ee)||re===I)throw new Error("invalid ristretto255 encoding 2");return new m(new e.ed25519.Point(se,re,A,ue))}static fromHex(G){return m.fromBytes((0,b.ensureBytes)("ristrettoHex",G,32))}static msm(G,X){return(0,i.pippenger)(m,e.ed25519.Point.Fn,G,X)}toBytes(){let{X:G,Y:X,Z:z,T:ee}=this.ep;const U=x,Z=J=>E.create(J),te=Z(Z(z+X)*Z(z-X)),ce=Z(G*X),le=Z(ce*ce),{value:ne}=f(Z(te*le)),de=Z(ne*te),W=Z(ne*ce),pe=Z(de*W*ee);let me;if((0,s.isNegativeLE)(ee*pe,U)){let J=Z(X*a),se=Z(G*a);G=J,X=se,me=Z(de*o)}else me=W;(0,s.isNegativeLE)(G*pe,U)&&(X=Z(-X));let fe=Z((z-X)*me);return(0,s.isNegativeLE)(fe,U)&&(fe=Z(-fe)),E.toBytes(fe)}equals(G){this.assertSame(G);const{X,Y:z}=this.ep,{X:ee,Y:U}=G.ep,Z=le=>E.create(le),te=Z(X*U)===Z(z*ee),ce=Z(z*U)===Z(X*ee);return te||ce}is0(){return this.equals(m.ZERO)}}m.BASE=new m(e.ed25519.Point.BASE),m.ZERO=new m(e.ed25519.Point.ZERO),m.Fp=E,m.Fn=R,e.ristretto255={Point:m},e.ristretto255_hasher={hashToCurve(q,G){const X=G?.DST||"ristretto255_XMD:SHA-512_R255MAP_RO_",z=(0,c.expand_message_xmd)(q,X,64,r.sha512);return l(z)},hashToScalar(q,G={DST:c._DST_scalar}){const X=(0,c.expand_message_xmd)(q,G.DST,64,r.sha512);return R.create((0,b.bytesToNumberLE)(X))}},e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];function Q(q){return e.ed25519.utils.toMontgomery((0,b.ensureBytes)("pub",q))}e.edwardsToMontgomery=Q;function $(q){return e.ed25519.utils.toMontgomerySecret((0,b.ensureBytes)("pub",q))}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})(Lt)),Lt}var Ft={},tt={},jt={},Ut={},as;function us(){return as||(as=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const r=De();class y 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,I=new Uint8Array(b);I.set(d.length>b?c.create().update(d).digest():d);for(let A=0;A<I.length;A++)I[A]^=54;this.iHash.update(I),this.oHash=c.create();for(let A=0;A<I.length;A++)I[A]^=106;this.oHash.update(I),(0,r.clean)(I)}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:I,blockLen:A,outputLen:D}=this;return c=c,c.finished=b,c.destroyed=I,c.blockLen=A,c.outputLen=D,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=y;const i=(u,c,s)=>new y(u,c).update(s).digest();e.hmac=i,e.hmac.create=(u,c)=>new y(u,c)})(Ut)),Ut}var ls;function fs(){return ls||(ls=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=e.DERErr=void 0,e._splitEndoScalar=d,e._normFnElement=S,e.weierstrassN=O,e.SWUFpSqrtRatio=L,e.mapToCurveSimpleSWU=F,e.ecdh=R,e.ecdsa=H,e.weierstrassPoints=k,e._legacyHelperEquat=B,e.weierstrass=C;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=us(),y=De(),i=ke(),u=Vt(),c=Ue(),s=(a,p)=>(a+(a>=0?p:-p)/P)/p;function d(a,p,o){const[[n,h],[f,t]]=p,v=s(t*a,o),g=s(-h*a,o);let l=a-v*n-g*f,m=-v*h-g*t;const Q=l<D,$=m<D;Q&&(l=-l),$&&(m=-m);const q=(0,i.bitMask)(Math.ceil((0,i.bitLen)(o)/2))+w;if(l<D||l>=q||m<D||m>=q)throw new Error("splitScalar (endomorphism): failed, k="+a);return{k1neg:Q,k1:l,k2neg:$,k2:m}}function b(a){if(!["compact","recovered","der"].includes(a))throw new Error('Signature format must be "compact", "recovered", or "der"');return a}function I(a,p){const o={};for(let n of Object.keys(p))o[n]=a[n]===void 0?p[n]:a[n];return(0,i._abool2)(o.lowS,"lowS"),(0,i._abool2)(o.prehash,"prehash"),o.format!==void 0&&b(o.format),o}class A extends Error{constructor(p=""){super(p)}}e.DERErr=A,e.DER={Err:A,_tlv:{encode:(a,p)=>{const{Err:o}=e.DER;if(a<0||a>256)throw new o("tlv.encode: wrong tag");if(p.length&1)throw new o("tlv.encode: unpadded data");const n=p.length/2,h=(0,i.numberToHexUnpadded)(n);if(h.length/2&128)throw new o("tlv.encode: long form length too big");const f=n>127?(0,i.numberToHexUnpadded)(h.length/2|128):"";return(0,i.numberToHexUnpadded)(a)+f+h+p},decode(a,p){const{Err:o}=e.DER;let n=0;if(a<0||a>256)throw new o("tlv.encode: wrong tag");if(p.length<2||p[n++]!==a)throw new o("tlv.decode: wrong tlv");const h=p[n++],f=!!(h&128);let t=0;if(!f)t=h;else{const g=h&127;if(!g)throw new o("tlv.decode(long): indefinite length not supported");if(g>4)throw new o("tlv.decode(long): byte length is too big");const l=p.subarray(n,n+g);if(l.length!==g)throw new o("tlv.decode: length bytes not complete");if(l[0]===0)throw new o("tlv.decode(long): zero leftmost byte");for(const m of l)t=t<<8|m;if(n+=g,t<128)throw new o("tlv.decode(long): not minimal encoding")}const v=p.subarray(n,n+t);if(v.length!==t)throw new o("tlv.decode: wrong value length");return{v,l:p.subarray(n+t)}}},_int:{encode(a){const{Err:p}=e.DER;if(a<D)throw new p("integer: negative integers are not allowed");let o=(0,i.numberToHexUnpadded)(a);if(Number.parseInt(o[0],16)&8&&(o="00"+o),o.length&1)throw new p("unexpected DER parsing assertion: unpadded hex");return o},decode(a){const{Err:p}=e.DER;if(a[0]&128)throw new p("invalid signature integer: negative");if(a[0]===0&&!(a[1]&128))throw new p("invalid signature integer: unnecessary leading zero");return(0,i.bytesToNumberBE)(a)}},toSig(a){const{Err:p,_int:o,_tlv:n}=e.DER,h=(0,i.ensureBytes)("signature",a),{v:f,l:t}=n.decode(48,h);if(t.length)throw new p("invalid signature: left bytes after parsing");const{v,l:g}=n.decode(2,f),{v:l,l:m}=n.decode(2,g);if(m.length)throw new p("invalid signature: left bytes after parsing");return{r:o.decode(v),s:o.decode(l)}},hexFromSig(a){const{_tlv:p,_int:o}=e.DER,n=p.encode(2,o.encode(a.r)),h=p.encode(2,o.encode(a.s)),f=n+h;return p.encode(48,f)}};const D=BigInt(0),w=BigInt(1),P=BigInt(2),_=BigInt(3),x=BigInt(4);function S(a,p){const{BYTES:o}=a;let n;if(typeof p=="bigint")n=p;else{let h=(0,i.ensureBytes)("private key",p);try{n=a.fromBytes(h)}catch{throw new Error(`invalid private key: expected ui8a of size ${o}, got ${typeof p}`)}}if(!a.isValidNot0(n))throw new Error("invalid private key: out of range [1..N-1]");return n}function O(a,p={}){const o=(0,u._createCurveFields)("weierstrass",a,p),{Fp:n,Fn:h}=o;let f=o.CURVE;const{h:t,n:v}=f;(0,i._validateObject)(p,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:g}=p;if(g&&(!n.is0(f.a)||typeof g.beta!="bigint"||!Array.isArray(g.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const l=E(n,h);function m(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function Q(fe,J,se){const{x:re,y:ue}=J.toAffine(),he=n.toBytes(re);if((0,i._abool2)(se,"isCompressed"),se){m();const ge=!n.isOdd(ue);return(0,i.concatBytes)(M(ge),he)}else return(0,i.concatBytes)(Uint8Array.of(4),he,n.toBytes(ue))}function $(fe){(0,i._abytes2)(fe,void 0,"Point");const{publicKey:J,publicKeyUncompressed:se}=l,re=fe.length,ue=fe[0],he=fe.subarray(1);if(re===J&&(ue===2||ue===3)){const ge=n.fromBytes(he);if(!n.isValid(ge))throw new Error("bad point: is not on curve, wrong x");const ye=X(ge);let ve;try{ve=n.sqrt(ye)}catch(oe){const ie=oe instanceof Error?": "+oe.message:"";throw new Error("bad point: is not on curve, sqrt error"+ie)}m();const T=n.isOdd(ve);return(ue&1)===1!==T&&(ve=n.neg(ve)),{x:ge,y:ve}}else if(re===se&&ue===4){const ge=n.BYTES,ye=n.fromBytes(he.subarray(0,ge)),ve=n.fromBytes(he.subarray(ge,ge*2));if(!z(ye,ve))throw new Error("bad point: is not on curve");return{x:ye,y:ve}}else throw new Error(`bad point: got length ${re}, expected compressed=${J} or uncompressed=${se}`)}const q=p.toBytes||Q,G=p.fromBytes||$;function X(fe){const J=n.sqr(fe),se=n.mul(J,fe);return n.add(n.add(se,n.mul(fe,f.a)),f.b)}function z(fe,J){const se=n.sqr(J),re=X(fe);return n.eql(se,re)}if(!z(f.Gx,f.Gy))throw new Error("bad curve params: generator point");const ee=n.mul(n.pow(f.a,_),x),U=n.mul(n.sqr(f.b),BigInt(27));if(n.is0(n.add(ee,U)))throw new Error("bad curve params: a or b");function Z(fe,J,se=!1){if(!n.isValid(J)||se&&n.is0(J))throw new Error(`bad point coordinate ${fe}`);return J}function te(fe){if(!(fe instanceof W))throw new Error("ProjectivePoint expected")}function ce(fe){if(!g||!g.basises)throw new Error("no endo");return d(fe,g.basises,h.ORDER)}const le=(0,i.memoized)((fe,J)=>{const{X:se,Y:re,Z:ue}=fe;if(n.eql(ue,n.ONE))return{x:se,y:re};const he=fe.is0();J==null&&(J=he?n.ONE:n.inv(ue));const ge=n.mul(se,J),ye=n.mul(re,J),ve=n.mul(ue,J);if(he)return{x:n.ZERO,y:n.ZERO};if(!n.eql(ve,n.ONE))throw new Error("invZ was invalid");return{x:ge,y:ye}}),ne=(0,i.memoized)(fe=>{if(fe.is0()){if(p.allowInfinityPoint&&!n.is0(fe.Y))return;throw new Error("bad point: ZERO")}const{x:J,y:se}=fe.toAffine();if(!n.isValid(J)||!n.isValid(se))throw new Error("bad point: x or y not field elements");if(!z(J,se))throw new Error("bad point: equation left != right");if(!fe.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function de(fe,J,se,re,ue){return se=new W(n.mul(se.X,fe),se.Y,se.Z),J=(0,u.negateCt)(re,J),se=(0,u.negateCt)(ue,se),J.add(se)}class W{constructor(J,se,re){this.X=Z("x",J),this.Y=Z("y",se,!0),this.Z=Z("z",re),Object.freeze(this)}static CURVE(){return f}static fromAffine(J){const{x:se,y:re}=J||{};if(!J||!n.isValid(se)||!n.isValid(re))throw new Error("invalid affine point");if(J instanceof W)throw new Error("projective point not allowed");return n.is0(se)&&n.is0(re)?W.ZERO:new W(se,re,n.ONE)}static fromBytes(J){const se=W.fromAffine(G((0,i._abytes2)(J,void 0,"point")));return se.assertValidity(),se}static fromHex(J){return W.fromBytes((0,i.ensureBytes)("pointHex",J))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(J=8,se=!0){return me.createCache(this,J),se||this.multiply(_),this}assertValidity(){ne(this)}hasEvenY(){const{y:J}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(J)}equals(J){te(J);const{X:se,Y:re,Z:ue}=this,{X:he,Y:ge,Z:ye}=J,ve=n.eql(n.mul(se,ye),n.mul(he,ue)),T=n.eql(n.mul(re,ye),n.mul(ge,ue));return ve&&T}negate(){return new W(this.X,n.neg(this.Y),this.Z)}double(){const{a:J,b:se}=f,re=n.mul(se,_),{X:ue,Y:he,Z:ge}=this;let ye=n.ZERO,ve=n.ZERO,T=n.ZERO,Y=n.mul(ue,ue),oe=n.mul(he,he),ie=n.mul(ge,ge),ae=n.mul(ue,he);return ae=n.add(ae,ae),T=n.mul(ue,ge),T=n.add(T,T),ye=n.mul(J,T),ve=n.mul(re,ie),ve=n.add(ye,ve),ye=n.sub(oe,ve),ve=n.add(oe,ve),ve=n.mul(ye,ve),ye=n.mul(ae,ye),T=n.mul(re,T),ie=n.mul(J,ie),ae=n.sub(Y,ie),ae=n.mul(J,ae),ae=n.add(ae,T),T=n.add(Y,Y),Y=n.add(T,Y),Y=n.add(Y,ie),Y=n.mul(Y,ae),ve=n.add(ve,Y),ie=n.mul(he,ge),ie=n.add(ie,ie),Y=n.mul(ie,ae),ye=n.sub(ye,Y),T=n.mul(ie,oe),T=n.add(T,T),T=n.add(T,T),new W(ye,ve,T)}add(J){te(J);const{X:se,Y:re,Z:ue}=this,{X:he,Y:ge,Z:ye}=J;let ve=n.ZERO,T=n.ZERO,Y=n.ZERO;const oe=f.a,ie=n.mul(f.b,_);let ae=n.mul(se,he),be=n.mul(re,ge),_e=n.mul(ue,ye),we=n.add(se,re),Se=n.add(he,ge);we=n.mul(we,Se),Se=n.add(ae,be),we=n.sub(we,Se),Se=n.add(se,ue);let Be=n.add(he,ye);return Se=n.mul(Se,Be),Be=n.add(ae,_e),Se=n.sub(Se,Be),Be=n.add(re,ue),ve=n.add(ge,ye),Be=n.mul(Be,ve),ve=n.add(be,_e),Be=n.sub(Be,ve),Y=n.mul(oe,Se),ve=n.mul(ie,_e),Y=n.add(ve,Y),ve=n.sub(be,Y),Y=n.add(be,Y),T=n.mul(ve,Y),be=n.add(ae,ae),be=n.add(be,ae),_e=n.mul(oe,_e),Se=n.mul(ie,Se),be=n.add(be,_e),_e=n.sub(ae,_e),_e=n.mul(oe,_e),Se=n.add(Se,_e),ae=n.mul(be,Se),T=n.add(T,ae),ae=n.mul(Be,Se),ve=n.mul(we,ve),ve=n.sub(ve,ae),ae=n.mul(we,be),Y=n.mul(Be,Y),Y=n.add(Y,ae),new W(ve,T,Y)}subtract(J){return this.add(J.negate())}is0(){return this.equals(W.ZERO)}multiply(J){const{endo:se}=p;if(!h.isValidNot0(J))throw new Error("invalid scalar: out of range");let re,ue;const he=ge=>me.cached(this,ge,ye=>(0,u.normalizeZ)(W,ye));if(se){const{k1neg:ge,k1:ye,k2neg:ve,k2:T}=ce(J),{p:Y,f:oe}=he(ye),{p:ie,f:ae}=he(T);ue=oe.add(ae),re=de(se.beta,Y,ie,ge,ve)}else{const{p:ge,f:ye}=he(J);re=ge,ue=ye}return(0,u.normalizeZ)(W,[re,ue])[0]}multiplyUnsafe(J){const{endo:se}=p,re=this;if(!h.isValid(J))throw new Error("invalid scalar: out of range");if(J===D||re.is0())return W.ZERO;if(J===w)return re;if(me.hasCache(this))return this.multiply(J);if(se){const{k1neg:ue,k1:he,k2neg:ge,k2:ye}=ce(J),{p1:ve,p2:T}=(0,u.mulEndoUnsafe)(W,re,he,ye);return de(se.beta,ve,T,ue,ge)}else return me.unsafe(re,J)}multiplyAndAddUnsafe(J,se,re){const ue=this.multiplyUnsafe(se).add(J.multiplyUnsafe(re));return ue.is0()?void 0:ue}toAffine(J){return le(this,J)}isTorsionFree(){const{isTorsionFree:J}=p;return t===w?!0:J?J(W,this):me.unsafe(this,v).is0()}clearCofactor(){const{clearCofactor:J}=p;return t===w?this:J?J(W,this):this.multiplyUnsafe(t)}isSmallOrder(){return this.multiplyUnsafe(t).is0()}toBytes(J=!0){return(0,i._abool2)(J,"isCompressed"),this.assertValidity(),q(W,this,J)}toHex(J=!0){return(0,i.bytesToHex)(this.toBytes(J))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(J=!0){return this.toBytes(J)}_setWindowSize(J){this.precompute(J)}static normalizeZ(J){return(0,u.normalizeZ)(W,J)}static msm(J,se){return(0,u.pippenger)(W,h,J,se)}static fromPrivateKey(J){return W.BASE.multiply(S(h,J))}}W.BASE=new W(f.Gx,f.Gy,n.ONE),W.ZERO=new W(n.ZERO,n.ONE,n.ZERO),W.Fp=n,W.Fn=h;const pe=h.BITS,me=new u.wNAF(W,p.endo?Math.ceil(pe/2):pe);return W.BASE.precompute(8),W}function M(a){return Uint8Array.of(a?2:3)}function L(a,p){const o=a.ORDER;let n=D;for(let G=o-w;G%P===D;G/=P)n+=w;const h=n,f=P<<h-w-w,t=f*P,v=(o-w)/t,g=(v-w)/P,l=t-w,m=f,Q=a.pow(p,v),$=a.pow(p,(v+w)/P);let q=(G,X)=>{let z=Q,ee=a.pow(X,l),U=a.sqr(ee);U=a.mul(U,X);let Z=a.mul(G,U);Z=a.pow(Z,g),Z=a.mul(Z,ee),ee=a.mul(Z,X),U=a.mul(Z,G);let te=a.mul(U,ee);Z=a.pow(te,m);let ce=a.eql(Z,a.ONE);ee=a.mul(U,$),Z=a.mul(te,z),U=a.cmov(ee,U,ce),te=a.cmov(Z,te,ce);for(let le=h;le>w;le--){let ne=le-P;ne=P<<ne-w;let de=a.pow(te,ne);const W=a.eql(de,a.ONE);ee=a.mul(U,z),z=a.mul(z,z),de=a.mul(te,z),U=a.cmov(ee,U,W),te=a.cmov(de,te,W)}return{isValid:ce,value:U}};if(a.ORDER%x===_){const G=(a.ORDER-_)/x,X=a.sqrt(a.neg(p));q=(z,ee)=>{let U=a.sqr(ee);const Z=a.mul(z,ee);U=a.mul(U,Z);let te=a.pow(U,G);te=a.mul(te,Z);const ce=a.mul(te,X),le=a.mul(a.sqr(te),ee),ne=a.eql(le,z);let de=a.cmov(ce,te,ne);return{isValid:ne,value:de}}}return q}function F(a,p){(0,c.validateField)(a);const{A:o,B:n,Z:h}=p;if(!a.isValid(o)||!a.isValid(n)||!a.isValid(h))throw new Error("mapToCurveSimpleSWU: invalid opts");const f=L(a,h);if(!a.isOdd)throw new Error("Field does not have .isOdd()");return t=>{let v,g,l,m,Q,$,q,G;v=a.sqr(t),v=a.mul(v,h),g=a.sqr(v),g=a.add(g,v),l=a.add(g,a.ONE),l=a.mul(l,n),m=a.cmov(h,a.neg(g),!a.eql(g,a.ZERO)),m=a.mul(m,o),g=a.sqr(l),$=a.sqr(m),Q=a.mul($,o),g=a.add(g,Q),g=a.mul(g,l),$=a.mul($,m),Q=a.mul($,n),g=a.add(g,Q),q=a.mul(v,l);const{isValid:X,value:z}=f(g,$);G=a.mul(v,t),G=a.mul(G,z),q=a.cmov(q,l,X),G=a.cmov(G,z,X);const ee=a.isOdd(t)===a.isOdd(G);G=a.cmov(a.neg(G),G,ee);const U=(0,c.FpInvertBatch)(a,[m],!0)[0];return q=a.mul(q,U),{x:q,y:G}}}function E(a,p){return{secretKey:p.BYTES,publicKey:1+a.BYTES,publicKeyUncompressed:1+2*a.BYTES,publicKeyHasPrefix:!0,signature:2*p.BYTES}}function R(a,p={}){const{Fn:o}=a,n=p.randomBytes||i.randomBytes,h=Object.assign(E(a.Fp,o),{seed:(0,c.getMinHashLength)(o.ORDER)});function f(q){try{return!!S(o,q)}catch{return!1}}function t(q,G){const{publicKey:X,publicKeyUncompressed:z}=h;try{const ee=q.length;return G===!0&&ee!==X||G===!1&&ee!==z?!1:!!a.fromBytes(q)}catch{return!1}}function v(q=n(h.seed)){return(0,c.mapHashToField)((0,i._abytes2)(q,h.seed,"seed"),o.ORDER)}function g(q,G=!0){return a.BASE.multiply(S(o,q)).toBytes(G)}function l(q){const G=v(q);return{secretKey:G,publicKey:g(G)}}function m(q){if(typeof q=="bigint")return!1;if(q instanceof a)return!0;const{secretKey:G,publicKey:X,publicKeyUncompressed:z}=h;if(o.allowedLengths||G===X)return;const ee=(0,i.ensureBytes)("key",q).length;return ee===X||ee===z}function Q(q,G,X=!0){if(m(q)===!0)throw new Error("first arg must be private key");if(m(G)===!1)throw new Error("second arg must be public key");const z=S(o,q);return a.fromHex(G).multiply(z).toBytes(X)}return Object.freeze({getPublicKey:g,getSharedSecret:Q,keygen:l,Point:a,utils:{isValidSecretKey:f,isValidPublicKey:t,randomSecretKey:v,isValidPrivateKey:f,randomPrivateKey:v,normPrivateKeyToScalar:q=>S(o,q),precompute(q=8,G=a.BASE){return G.precompute(q,!1)}},lengths:h})}function H(a,p,o={}){(0,y.ahash)(p),(0,i._validateObject)(o,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=o.randomBytes||i.randomBytes,h=o.hmac||((se,...re)=>(0,r.hmac)(p,se,(0,i.concatBytes)(...re))),{Fp:f,Fn:t}=a,{ORDER:v,BITS:g}=t,{keygen:l,getPublicKey:m,getSharedSecret:Q,utils:$,lengths:q}=R(a,o),G={prehash:!1,lowS:typeof o.lowS=="boolean"?o.lowS:!1,format:void 0,extraEntropy:!1},X="compact";function z(se){const re=v>>w;return se>re}function ee(se,re){if(!t.isValidNot0(re))throw new Error(`invalid signature ${se}: out of range 1..Point.Fn.ORDER`);return re}function U(se,re){b(re);const ue=q.signature,he=re==="compact"?ue:re==="recovered"?ue+1:void 0;return(0,i._abytes2)(se,he,`${re} signature`)}class Z{constructor(re,ue,he){this.r=ee("r",re),this.s=ee("s",ue),he!=null&&(this.recovery=he),Object.freeze(this)}static fromBytes(re,ue=X){U(re,ue);let he;if(ue==="der"){const{r:T,s:Y}=e.DER.toSig((0,i._abytes2)(re));return new Z(T,Y)}ue==="recovered"&&(he=re[0],ue="compact",re=re.subarray(1));const ge=t.BYTES,ye=re.subarray(0,ge),ve=re.subarray(ge,ge*2);return new Z(t.fromBytes(ye),t.fromBytes(ve),he)}static fromHex(re,ue){return this.fromBytes((0,i.hexToBytes)(re),ue)}addRecoveryBit(re){return new Z(this.r,this.s,re)}recoverPublicKey(re){const ue=f.ORDER,{r:he,s:ge,recovery:ye}=this;if(ye==null||![0,1,2,3].includes(ye))throw new Error("recovery id invalid");if(v*P<ue&&ye>1)throw new Error("recovery id is ambiguous for h>1 curve");const T=ye===2||ye===3?he+v:he;if(!f.isValid(T))throw new Error("recovery id 2 or 3 invalid");const Y=f.toBytes(T),oe=a.fromBytes((0,i.concatBytes)(M((ye&1)===0),Y)),ie=t.inv(T),ae=ce((0,i.ensureBytes)("msgHash",re)),be=t.create(-ae*ie),_e=t.create(ge*ie),we=a.BASE.multiplyUnsafe(be).add(oe.multiplyUnsafe(_e));if(we.is0())throw new Error("point at infinify");return we.assertValidity(),we}hasHighS(){return z(this.s)}toBytes(re=X){if(b(re),re==="der")return(0,i.hexToBytes)(e.DER.hexFromSig(this));const ue=t.toBytes(this.r),he=t.toBytes(this.s);if(re==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return(0,i.concatBytes)(Uint8Array.of(this.recovery),ue,he)}return(0,i.concatBytes)(ue,he)}toHex(re){return(0,i.bytesToHex)(this.toBytes(re))}assertValidity(){}static fromCompact(re){return Z.fromBytes((0,i.ensureBytes)("sig",re),"compact")}static fromDER(re){return Z.fromBytes((0,i.ensureBytes)("sig",re),"der")}normalizeS(){return this.hasHighS()?new Z(this.r,t.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,i.bytesToHex)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,i.bytesToHex)(this.toBytes("compact"))}}const te=o.bits2int||function(re){if(re.length>8192)throw new Error("input is too large");const ue=(0,i.bytesToNumberBE)(re),he=re.length*8-g;return he>0?ue>>BigInt(he):ue},ce=o.bits2int_modN||function(re){return t.create(te(re))},le=(0,i.bitMask)(g);function ne(se){return(0,i.aInRange)("num < 2^"+g,se,D,le),t.toBytes(se)}function de(se,re){return(0,i._abytes2)(se,void 0,"message"),re?(0,i._abytes2)(p(se),void 0,"prehashed message"):se}function W(se,re,ue){if(["recovered","canonical"].some(be=>be in ue))throw new Error("sign() legacy options not supported");const{lowS:he,prehash:ge,extraEntropy:ye}=I(ue,G);se=de(se,ge);const ve=ce(se),T=S(t,re),Y=[ne(T),ne(ve)];if(ye!=null&&ye!==!1){const be=ye===!0?n(q.secretKey):ye;Y.push((0,i.ensureBytes)("extraEntropy",be))}const oe=(0,i.concatBytes)(...Y),ie=ve;function ae(be){const _e=te(be);if(!t.isValidNot0(_e))return;const we=t.inv(_e),Se=a.BASE.multiply(_e).toAffine(),Be=t.create(Se.x);if(Be===D)return;const Ke=t.create(we*t.create(ie+Be*T));if(Ke===D)return;let ze=(Se.x===Be?0:2)|Number(Se.y&w),it=Ke;return he&&z(Ke)&&(it=t.neg(Ke),ze^=1),new Z(Be,it,ze)}return{seed:oe,k2sig:ae}}function pe(se,re,ue={}){se=(0,i.ensureBytes)("message",se);const{seed:he,k2sig:ge}=W(se,re,ue);return(0,i.createHmacDrbg)(p.outputLen,t.BYTES,h)(he,ge)}function me(se){let re;const ue=typeof se=="string"||(0,i.isBytes)(se),he=!ue&&se!==null&&typeof se=="object"&&typeof se.r=="bigint"&&typeof se.s=="bigint";if(!ue&&!he)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(he)re=new Z(se.r,se.s);else if(ue){try{re=Z.fromBytes((0,i.ensureBytes)("sig",se),"der")}catch(ge){if(!(ge instanceof e.DER.Err))throw ge}if(!re)try{re=Z.fromBytes((0,i.ensureBytes)("sig",se),"compact")}catch{return!1}}return re||!1}function fe(se,re,ue,he={}){const{lowS:ge,prehash:ye,format:ve}=I(he,G);if(ue=(0,i.ensureBytes)("publicKey",ue),re=de((0,i.ensureBytes)("message",re),ye),"strict"in he)throw new Error("options.strict was renamed to lowS");const T=ve===void 0?me(se):Z.fromBytes((0,i.ensureBytes)("sig",se),ve);if(T===!1)return!1;try{const Y=a.fromBytes(ue);if(ge&&T.hasHighS())return!1;const{r:oe,s:ie}=T,ae=ce(re),be=t.inv(ie),_e=t.create(ae*be),we=t.create(oe*be),Se=a.BASE.multiplyUnsafe(_e).add(Y.multiplyUnsafe(we));return Se.is0()?!1:t.create(Se.x)===oe}catch{return!1}}function J(se,re,ue={}){const{prehash:he}=I(ue,G);return re=de(re,he),Z.fromBytes(se,"recovered").recoverPublicKey(re).toBytes()}return Object.freeze({keygen:l,getPublicKey:m,getSharedSecret:Q,utils:$,lengths:q,Point:a,sign:pe,verify:fe,recoverPublicKey:J,Signature:Z,hash:p})}function k(a){const{CURVE:p,curveOpts:o}=N(a),n=O(p,o);return j(a,n)}function N(a){const p={a:a.a,b:a.b,p:a.Fp.ORDER,n:a.n,h:a.h,Gx:a.Gx,Gy:a.Gy},o=a.Fp;let n=a.allowedPrivateKeyLengths?Array.from(new Set(a.allowedPrivateKeyLengths.map(t=>Math.ceil(t/2)))):void 0;const h=(0,c.Field)(p.n,{BITS:a.nBitLength,allowedLengths:n,modFromBytes:a.wrapPrivateKey}),f={Fp:o,Fn:h,allowInfinityPoint:a.allowInfinityPoint,endo:a.endo,isTorsionFree:a.isTorsionFree,clearCofactor:a.clearCofactor,fromBytes:a.fromBytes,toBytes:a.toBytes};return{CURVE:p,curveOpts:f}}function V(a){const{CURVE:p,curveOpts:o}=N(a),n={hmac:a.hmac,randomBytes:a.randomBytes,lowS:a.lowS,bits2int:a.bits2int,bits2int_modN:a.bits2int_modN};return{CURVE:p,curveOpts:o,hash:a.hash,ecdsaOpts:n}}function B(a,p,o){function n(h){const f=a.sqr(h),t=a.mul(f,h);return a.add(a.add(t,a.mul(h,p)),o)}return n}function j(a,p){const{Fp:o,Fn:n}=p;function h(t){return(0,i.inRange)(t,w,n.ORDER)}const f=B(o,a.a,a.b);return Object.assign({},{CURVE:a,Point:p,ProjectivePoint:p,normPrivateKeyToScalar:t=>S(n,t),weierstrassEquation:f,isWithinCurveOrder:h})}function K(a,p){const o=p.Point;return Object.assign({},p,{ProjectivePoint:o,CURVE:Object.assign({},a,(0,c.nLength)(o.Fn.ORDER,o.Fn.BITS))})}function C(a){const{CURVE:p,curveOpts:o,hash:n,ecdsaOpts:h}=V(a),f=O(p,o),t=H(f,n,h);return K(a,t)}})(jt)),jt}var ds;function gi(){if(ds)return tt;ds=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt.getHash=r,tt.createCurve=y;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=fs();function r(i){return{hash:i}}function y(i,u){const c=s=>(0,e.weierstrass)({...i,hash:s});return{...c(u),create:c}}return tt}var hs;function mi(){return hs||(hs=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=Kt(),y=De(),i=gi(),u=os(),c=Ue(),s=fs(),d=ke(),b={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},I={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},A=BigInt(0),D=BigInt(1),w=BigInt(2);function P(K){const C=b.p,a=BigInt(3),p=BigInt(6),o=BigInt(11),n=BigInt(22),h=BigInt(23),f=BigInt(44),t=BigInt(88),v=K*K*K%C,g=v*v*K%C,l=(0,c.pow2)(g,a,C)*g%C,m=(0,c.pow2)(l,a,C)*g%C,Q=(0,c.pow2)(m,w,C)*v%C,$=(0,c.pow2)(Q,o,C)*Q%C,q=(0,c.pow2)($,n,C)*$%C,G=(0,c.pow2)(q,f,C)*q%C,X=(0,c.pow2)(G,t,C)*G%C,z=(0,c.pow2)(X,f,C)*q%C,ee=(0,c.pow2)(z,a,C)*g%C,U=(0,c.pow2)(ee,h,C)*$%C,Z=(0,c.pow2)(U,p,C)*v%C,te=(0,c.pow2)(Z,w,C);if(!_.eql(_.sqr(te),K))throw new Error("Cannot find square root");return te}const _=(0,c.Field)(b.p,{sqrt:P});e.secp256k1=(0,i.createCurve)({...b,Fp:_,lowS:!0,endo:I},r.sha256);const x={};function S(K,...C){let a=x[K];if(a===void 0){const p=(0,r.sha256)((0,d.utf8ToBytes)(K));a=(0,d.concatBytes)(p,p),x[K]=a}return(0,r.sha256)((0,d.concatBytes)(a,...C))}const O=K=>K.toBytes(!0).slice(1),M=e.secp256k1.Point,L=K=>K%w===A;function F(K){const{Fn:C,BASE:a}=M,p=(0,s._normFnElement)(C,K),o=a.multiply(p);return{scalar:L(o.y)?p:C.neg(p),bytes:O(o)}}function E(K){const C=_;if(!C.isValidNot0(K))throw new Error("invalid x: Fail if x \u2265 p");const a=C.create(K*K),p=C.create(a*K+BigInt(7));let o=C.sqrt(p);L(o)||(o=C.neg(o));const n=M.fromAffine({x:K,y:o});return n.assertValidity(),n}const R=d.bytesToNumberBE;function H(...K){return M.Fn.create(R(S("BIP0340/challenge",...K)))}function k(K){return F(K).bytes}function N(K,C,a=(0,y.randomBytes)(32)){const{Fn:p}=M,o=(0,d.ensureBytes)("message",K),{bytes:n,scalar:h}=F(C),f=(0,d.ensureBytes)("auxRand",a,32),t=p.toBytes(h^R(S("BIP0340/aux",f))),v=S("BIP0340/nonce",t,n,o),{bytes:g,scalar:l}=F(v),m=H(g,n,o),Q=new Uint8Array(64);if(Q.set(g,0),Q.set(p.toBytes(p.create(l+m*h)),32),!V(Q,o,n))throw new Error("sign: Invalid signature produced");return Q}function V(K,C,a){const{Fn:p,BASE:o}=M,n=(0,d.ensureBytes)("signature",K,64),h=(0,d.ensureBytes)("message",C),f=(0,d.ensureBytes)("publicKey",a,32);try{const t=E(R(f)),v=R(n.subarray(0,32));if(!(0,d.inRange)(v,D,b.p))return!1;const g=R(n.subarray(32,64));if(!(0,d.inRange)(g,D,b.n))return!1;const l=H(p.toBytes(v),O(t),h),m=o.multiplyUnsafe(g).add(t.multiplyUnsafe(p.neg(l))),{x:Q,y:$}=m.toAffine();return!(m.is0()||!L($)||Q!==v)}catch{return!1}}e.schnorr=(()=>{const a=(o=(0,y.randomBytes)(48))=>(0,c.mapHashToField)(o,b.n);e.secp256k1.utils.randomSecretKey;function p(o){const n=a(o);return{secretKey:n,publicKey:k(n)}}return{keygen:p,getPublicKey:k,sign:N,verify:V,Point:M,utils:{randomSecretKey:a,randomPrivateKey:a,taggedHash:S,lift_x:E,pointToBytes:O,numberToBytesBE:d.numberToBytesBE,bytesToNumberBE:d.bytesToNumberBE,mod:c.mod},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})();const B=(0,u.isogenyMap)(_,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(K=>K.map(C=>BigInt(C)))),j=(0,s.mapToCurveSimpleSWU)(_,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:_.create(BigInt("-11"))});e.secp256k1_hasher=(0,u.createHasher)(e.secp256k1.Point,K=>{const{x:C,y:a}=j(_.create(K[0]));return B(C,a)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:_.ORDER,m:1,k:128,expand:"xmd",hash:r.sha256}),e.hashToCurve=e.secp256k1_hasher.hashToCurve,e.encodeToCurve=e.secp256k1_hasher.encodeToCurve})(Ft)),Ft}var Mt={},ps;function ys(){return ps||(ps=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0;var r=Le(),y=function(u){return u.startsWith("0x")||u.startsWith("0X")?u.slice(2):u};e.remove0x=y;var i=function(u){return(0,r.hexToBytes)((0,e.remove0x)(u))};e.decodeHex=i})(Mt)),Mt}var vs;function bi(){return vs||(vs=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=Zr(),y=vi(),i=mi(),u=ut(),c=Nt(),s=ys(),d=function(S){var O;do O=(0,r.randomBytes)(c.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(O,S));return O};e.getValidSecret=d;var b=function(S,O){return P(O,function(M){return M.utils.isValidSecretKey(S)},function(){return!0},function(){return!0})};e.isValidPrivateKey=b;var I=function(S,O){return P(O,function(M){return M.getPublicKey(S)},function(M){return M.getPublicKey(S)},function(M){return M.getPublicKey(S)})};e.getPublicKey=I;var A=function(S,O,M,L){return P(L,function(F){return F.getSharedSecret(S,O,M)},function(F){return F.getSharedSecret(S,O)},function(F){return x(F,S,O)})};e.getSharedPoint=A;var D=function(S,O,M){return P(M,function(L){return L.getSharedSecret(Uint8Array.from(Array(31).fill(0).concat([1])),S,O)},function(){return S},function(){return S})};e.convertPublicKeyFormat=D;var w=function(S,O){var M=(0,s.decodeHex)(S);return P(O,function(){return _(M)},function(){return M},function(){return M})};e.hexToPublicKey=w;function P(S,O,M,L){var F=S||(0,u.ellipticCurve)();if(F==="secp256k1")return O(i.secp256k1);if(F==="x25519")return M(y.x25519);if(F==="ed25519")return L(y.ed25519);throw new Error("Not implemented")}var _=function(S){if(S.length===c.ETH_PUBLIC_KEY_SIZE){var O=new Uint8Array(1+S.length);return O.set([4]),O.set(S,1),O}return S},x=function(S,O,M){var L=S.utils.getExtendedPublicKey(O).scalar,F=S.Point.fromBytes(M).multiply(L);return F.toBytes()}})(Pt)),Pt}var Gt={},Me={},gs;function Ei(){if(gs)return Me;gs=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.hkdf=void 0,Me.extract=y,Me.expand=c;const e=us(),r=De();function y(d,b,I){return(0,r.ahash)(d),I===void 0&&(I=new Uint8Array(d.outputLen)),(0,e.hmac)(d,(0,r.toBytes)(I),(0,r.toBytes)(b))}const i=Uint8Array.from([0]),u=Uint8Array.of();function c(d,b,I,A=32){(0,r.ahash)(d),(0,r.anumber)(A);const D=d.outputLen;if(A>255*D)throw new Error("Length should be <= 255*HashLen");const w=Math.ceil(A/D);I===void 0&&(I=u);const P=new Uint8Array(w*D),_=e.hmac.create(d,b),x=_._cloneInto(),S=new Uint8Array(_.outputLen);for(let O=0;O<w;O++)i[0]=O+1,x.update(O===0?u:S).update(I).update(i).digestInto(S),P.set(S,D*O),_._cloneInto(x);return _.destroy(),x.destroy(),(0,r.clean)(S,i),P.slice(0,A)}const s=(d,b,I,A,D)=>c(d,y(d,b,I),A,D);return Me.hkdf=s,Me}var ms;function _i(){return ms||(ms=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0;var r=Le(),y=Ei(),i=Kt(),u=function(s,d,b){return(0,y.hkdf)(i.sha256,s,d,b,32)};e.deriveKey=u;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})(Gt)),Gt}var Yt={},Ge={},nt={};const wi=Fo(import.meta.url);function Si(){return wi("node:crypto")}var bs;function Es(){if(bs)return nt;bs=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt._compat=void 0;var e=Le(),r=Si(),y=16,i=globalThis.Deno!==void 0,u=function(c,s,d,b){var I=c==="aes-256-gcm"||c==="chacha20-poly1305",A=I?y:0,D=I?{authTagLength:A}:void 0,w=function(_){var x=(0,r.createCipheriv)(c,s,d,D);I&&b!==void 0&&x.setAAD(b);var S=x.update(_),O=x.final(),M=I?x.getAuthTag():new Uint8Array(0);return(0,e.concatBytes)(S,O,M)},P=function(_){var x=_.subarray(0,_.length-A),S=_.subarray(_.length-A),O=(0,r.createDecipheriv)(c,s,d,D);I&&(b!==void 0&&O.setAAD(b),O.setAuthTag(S)),!I&&i&&O.setAutoPadding(!1);var M=O.update(x),L=O.final();return(0,e.concatBytes)(M,L)};return{encrypt:w,decrypt:P}};return nt._compat=u,nt}var _s;function Ai(){if(_s)return Ge;_s=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.aes256cbc=Ge.aes256gcm=void 0;var e=Es(),r=function(i,u,c){return(0,e._compat)("aes-256-gcm",i,u,c)};Ge.aes256gcm=r;var y=function(i,u,c){return(0,e._compat)("aes-256-cbc",i,u)};return Ge.aes256cbc=y,Ge}var Ye={},rt={},ws;function xi(){if(ws)return rt;ws=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt._hchacha20=void 0;var e=function(y,i,u,c){for(var s=y[0],d=y[1],b=y[2],I=y[3],A=i[0],D=i[1],w=i[2],P=i[3],_=i[4],x=i[5],S=i[6],O=i[7],M=u[0],L=u[1],F=u[2],E=u[3],R=0;R<20;R+=2)s=s+A|0,M=r(M^s,16),_=_+M|0,A=r(A^_,12),s=s+A|0,M=r(M^s,8),_=_+M|0,A=r(A^_,7),d=d+D|0,L=r(L^d,16),x=x+L|0,D=r(D^x,12),d=d+D|0,L=r(L^d,8),x=x+L|0,D=r(D^x,7),b=b+w|0,F=r(F^b,16),S=S+F|0,w=r(w^S,12),b=b+w|0,F=r(F^b,8),S=S+F|0,w=r(w^S,7),I=I+P|0,E=r(E^I,16),O=O+E|0,P=r(P^O,12),I=I+P|0,E=r(E^I,8),O=O+E|0,P=r(P^O,7),s=s+D|0,E=r(E^s,16),S=S+E|0,D=r(D^S,12),s=s+D|0,E=r(E^s,8),S=S+E|0,D=r(D^S,7),d=d+w|0,M=r(M^d,16),O=O+M|0,w=r(w^O,12),d=d+w|0,M=r(M^d,8),O=O+M|0,w=r(w^O,7),b=b+P|0,L=r(L^b,16),_=_+L|0,P=r(P^_,12),b=b+P|0,L=r(L^b,8),_=_+L|0,P=r(P^_,7),I=I+A|0,F=r(F^I,16),x=x+F|0,A=r(A^x,12),I=I+A|0,F=r(F^I,8),x=x+F|0,A=r(A^x,7);var H=0;c[H++]=s,c[H++]=d,c[H++]=b,c[H++]=I,c[H++]=M,c[H++]=L,c[H++]=F,c[H++]=E};rt._hchacha20=e;var r=function(y,i){return y<<i|y>>>32-i};return rt}var Ss;function Bi(){if(Ss)return Ye;Ss=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.chacha20=Ye.xchacha20=void 0;var e=Le(),r=Es(),y=xi(),i=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]),I=new Uint32Array(8);(0,y._hchacha20)(b,(0,e.u32)(c),(0,e.u32)(s.subarray(0,16)),I);var A=new Uint8Array(12);return A.set([0,0,0,0]),A.set(s.subarray(16),4),(0,r._compat)("chacha20-poly1305",(0,e.u8)(I),A,d)};Ye.xchacha20=i;var u=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 Ye.chacha20=u,Ye}var As;function Ri(){return As||(As=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var r=Ai(),y=Bi(),i=Le(),u=Zr(),c=ut(),s=Nt(),d=function(w,P,_){return I(A,w,P,_)};e.symEncrypt=d;var b=function(w,P,_){return I(D,w,P,_)};e.symDecrypt=b,e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt;function I(w,P,_,x){var S=(0,c.symmetricAlgorithm)();if(S==="aes-256-gcm")return w(r.aes256gcm,P,_,(0,c.symmetricNonceLength)(),s.AEAD_TAG_LENGTH,x);if(S==="xchacha20")return w(y.xchacha20,P,_,s.XCHACHA20_NONCE_LENGTH,s.AEAD_TAG_LENGTH,x);if(S==="aes-256-cbc")return w(r.aes256cbc,P,_,16,0);throw new Error("Not implemented")}function A(w,P,_,x,S,O){var M=(0,u.randomBytes)(x),L=w(P,M,O),F=L.encrypt(_);if(S===0)return(0,i.concatBytes)(M,F);var E=F.length-S,R=F.subarray(0,E),H=F.subarray(E);return(0,i.concatBytes)(M,H,R)}function D(w,P,_,x,S,O){var M=_.subarray(0,x),L=w(P,Uint8Array.from(M),O),F=_.subarray(x);if(S===0)return L.decrypt(F);var E=F.subarray(0,S),R=F.subarray(S);return L.decrypt((0,i.concatBytes)(R,E))}})(Yt)),Yt}var xs;function $t(){return xs||(xs=1,(function(e){var r=je&&je.__createBinding||(Object.create?(function(i,u,c,s){s===void 0&&(s=c);var d=Object.getOwnPropertyDescriptor(u,c);(!d||("get"in d?!u.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return u[c]}}),Object.defineProperty(i,s,d)}):(function(i,u,c,s){s===void 0&&(s=c),i[s]=u[c]})),y=je&&je.__exportStar||function(i,u){for(var c in i)c!=="default"&&!Object.prototype.hasOwnProperty.call(u,c)&&r(u,i,c)};Object.defineProperty(e,"__esModule",{value:!0}),y(bi(),e),y(_i(),e),y(ys(),e),y(Ri(),e)})(je)),je}var st={},Bs;function Rs(){if(Bs)return st;Bs=1,Object.defineProperty(st,"__esModule",{value:!0}),st.PublicKey=void 0;var e=Le(),r=$t(),y=(function(){function i(u,c){var s=(0,r.convertPublicKeyFormat)(u,!0,c),d=(0,r.convertPublicKeyFormat)(u,!1,c);this.data=s,this.dataUncompressed=s.length!==d.length?d:null}return i.fromHex=function(u,c){return new i((0,r.hexToPublicKey)(u,c),c)},Object.defineProperty(i.prototype,"_uncompressed",{get:function(){return this.dataUncompressed!==null?this.dataUncompressed:this.data},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"uncompressed",{get:function(){return Buffer.from(this._uncompressed)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"compressed",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),i.prototype.toBytes=function(u){return u===void 0&&(u=!0),u?this.data:this._uncompressed},i.prototype.toHex=function(u){return u===void 0&&(u=!0),(0,e.bytesToHex)(this.toBytes(u))},i.prototype.decapsulate=function(u,c){c===void 0&&(c=!1);var s=this.toBytes(c),d=u.multiply(this,c);return(0,r.getSharedKey)(s,d)},i.prototype.equals=function(u){return(0,e.equalBytes)(this.data,u.data)},i})();return st.PublicKey=y,st}var Is;function Ii(){if(Is)return Qe;Is=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.PrivateKey=void 0;var e=Le(),r=$t(),y=Rs(),i=(function(){function u(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 y.PublicKey((0,r.getPublicKey)(this.data,s),s)}return u.fromHex=function(c,s){return new u((0,r.decodeHex)(c),s)},Object.defineProperty(u.prototype,"secret",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),u.prototype.toHex=function(){return(0,e.bytesToHex)(this.data)},u.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)},u.prototype.multiply=function(c,s){return s===void 0&&(s=!1),(0,r.getSharedPoint)(this.data,c.toBytes(!0),s,this.curve)},u.prototype.equals=function(c){return(0,e.equalBytes)(this.data,c.data)},u})();return Qe.PrivateKey=i,Qe}var Os;function Ts(){return Os||(Os=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var r=Ii();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return r.PrivateKey}});var y=Rs();Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return y.PublicKey}})})(Ct)),Ct}var Ns;function Zt(){return Ns||(Ns=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=Le(),y=ut(),i=Ts(),u=$t();function c(D,w){return Buffer.from(s(D,w))}function s(D,w){var P=(0,y.ellipticCurve)(),_=new i.PrivateKey(void 0,P),x=D instanceof Uint8Array?new i.PublicKey(D,P):i.PublicKey.fromHex(D,P),S=_.encapsulate(x,(0,y.isHkdfKeyCompressed)()),O=_.publicKey.toBytes((0,y.isEphemeralKeyCompressed)()),M=(0,u.symEncrypt)(S,w);return(0,r.concatBytes)(O,M)}function d(D,w){return Buffer.from(b(D,w))}function b(D,w){var P=(0,y.ellipticCurve)(),_=D instanceof Uint8Array?new i.PrivateKey(D,P):i.PrivateKey.fromHex(D,P),x=(0,y.ephemeralKeySize)(),S=new i.PublicKey(w.subarray(0,x),P),O=w.subarray(x),M=S.decapsulate(_,(0,y.isHkdfKeyCompressed)());return(0,u.symDecrypt)(M,O)}var I=ut();Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return I.ECIES_CONFIG}});var A=Ts();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return A.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return A.PublicKey}}),e.utils={aesEncrypt:u.aesEncrypt,aesDecrypt:u.aesDecrypt,symEncrypt:u.symEncrypt,symDecrypt:u.symDecrypt,decodeHex:u.decodeHex,getValidSecret:u.getValidSecret,remove0x:u.remove0x}})(It)),It}var Xt,Cs;function Ps(){if(Cs)return Xt;Cs=1;function e(r,y=7){return r&&r.length>0?r.slice(0,y)+"\u2026":""}return Xt=e,Xt}var Wt,Hs;function Ze(){if(Hs)return Wt;Hs=1;const e=Ps();class r{constructor(i={}){this.filepath=i.filepath,this.envFilepath=i.envFilepath,this.key=i.key,this.privateKey=i.privateKey,this.privateKeyName=i.privateKeyName,this.command=i.command,this.message=i.message}missingEnvFile(){const i="MISSING_ENV_FILE",u=`[${i}] missing ${this.envFilepath} file (${this.filepath})`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/484`,s=new Error(u);return s.code=i,s.help=c,s}missingKey(){const i="MISSING_KEY",u=`[${i}] missing ${this.key} key`,c=new Error(u);return c.code=i,c}missingPrivateKey(){const i="MISSING_PRIVATE_KEY",u=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/464`,s=new Error(u);return s.code=i,s.help=c,s}invalidPrivateKey(){const i="INVALID_PRIVATE_KEY",u=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/465`,s=new Error(u);return s.code=i,s.help=c,s}looksWrongPrivateKey(){const i="WRONG_PRIVATE_KEY",u=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/466`,s=new Error(u);return s.code=i,s.help=c,s}malformedEncryptedData(){const i="MALFORMED_ENCRYPTED_DATA",u=`[${i}] could not decrypt ${this.key} because encrypted data appears malformed`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/467`,s=new Error(u);return s.code=i,s.help=c,s}decryptionFailed(){const i="DECRYPTION_FAILED",u=this.message,c=new Error(u);return c.code=i,c}commandSubstitutionFailed(){const i="COMMAND_SUBSTITUTION_FAILED",u=`[${i}] could not eval ${this.key} containing command '${this.command}': ${this.message}`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/532`,s=new Error(u);return s.code=i,s.help=c,s}dangerousDependencyHoist(){const i="DANGEROUS_DEPENDENCY_HOIST",u=`[${i}] your environment has hoisted an incompatible version of a dotenvx dependency: ${this.message}`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/622`,s=new Error(u);return s.code=i,s.help=c,s}}return Wt=r,Wt}var zt,Ls;function Ds(){if(Ls)return zt;Ls=1;const{decrypt:e}=Zt(),r=Ze(),y="encrypted:";function i(u,c,s,d){let b,I;if(!c.startsWith(y))return c;if(d=d||"",d.length<=0)I=new r({key:u,privateKeyName:s,privateKey:d}).missingPrivateKey();else{const A=d.split(",");for(const D of A){const w=Buffer.from(D,"hex"),P=c.substring(y.length),_=Buffer.from(P,"base64");try{b=e(w,_).toString(),I=null;break}catch(x){x.message==="Invalid private key"?I=new r({key:u,privateKeyName:s,privateKey:d}).invalidPrivateKey():x.message==="Unsupported state or unable to authenticate data"?I=new r({key:u,privateKeyName:s,privateKey:d}).looksWrongPrivateKey():x.message==="Point of length 65 was invalid. Expected 33 compressed bytes or 65 uncompressed bytes"?I=new r({key:u,privateKeyName:s,privateKey:d}).malformedEncryptedData():I=new r({key:u,privateKeyName:s,privateKey:d,message:x.message}).decryptionFailed()}}}if(I)throw I;return b}return zt=i,zt}var Qt,Ks;function Oi(){if(Ks)return Qt;Ks=1;function e(r){return r.replace(/[\r\n]+$/,"")}return Qt=e,Qt}var Jt,qs;function Ti(){if(qs)return Jt;qs=1;const{execSync:e}=Fn,r=Oi(),y=Ze();function i(u,c,s,d){return(c.match(/\$\(([^)]+(?:\)[^(]*)*)\)/g)||[]).reduce((I,A)=>{const D=A.slice(2,-1);let w;try{w=e(D,{env:{...s,...d}}).toString()}catch(P){throw new y({key:u,command:D,message:P.message.trim()}).commandSubstitutionFailed()}return w=r(w),I.replace(A,w)},c)}return Jt=i,Jt}var en,Vs;function Ni(){if(Vs)return en;Vs=1;function e(r){return r.replace(/\\\$/g,"$")}return en=e,en}var tn,ks;function Fs(){if(ks)return tn;ks=1;const e=Ds(),r=Ti(),y=Ni();class i{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,I=null){this.src=c,this.privateKey=s,this.privateKeyName=I,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=i.LINE.exec(c))!==null;){const d=s[1],b=s[2],I=this.quote(b);this.parsed[d]=this.clean(b,I),!this.overload&&this.inProcessEnv(d)&&(this.parsed[d]=this.processEnv[d]);try{this.parsed[d]=this.decrypt(d,this.parsed[d])}catch(D){this.errors.push(D)}let A=!1;if(I!=="'"&&(!this.inProcessEnv(d)||this.processEnv[d]===this.parsed[d])){const D=this.parsed[d];try{this.parsed[d]=this.eval(d,D)}catch(w){this.errors.push(w)}D!==this.parsed[d]&&(A=!0)}!A&&I!=="'"&&(!this.processEnv[d]||this.overload)&&(this.parsed[d]=y(this.expand(this.parsed[d]))),I==="'"&&(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,I;for(;(I=d.exec(b))!==null;){const[A,D,w]=I,P=D||w,_=/(:\+|\+|:-|-)/,x=P.match(_),S=x?x[0]:null,O=P.split(S);let M,L;const F=O.shift();if([":+","+"].includes(S)?(M=s[F]?O.join(S):"",L=null):(M=O.join(S),L=s[F]),L?b=b.replace(A,L):b=b.replace(A,M),b===s[F]||this.literals[F]&&/\$\{[^}]+\}|\$[A-Za-z_][A-Za-z0-9_]*/.test(this.literals[F]))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 tn=i,tn}var nn,js;function Xe(){if(js)return nn;js=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function r(y,i=!1,u=!1,c=!1){const s={};let d=y.toString();u||(d=d.replace(/\r\n?/mg,`
|
|
7
|
-
`));let b;for(;(b=e.exec(d))!=null;){const I=b[1];let A=b[2]||"";A=A.trim();const D=A[0];A=A.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),D==='"'&&!i&&(A=A.replace(/\\n/g,`
|
|
8
|
-
`),A=A.replace(/\\r/g,"\r"),A=A.replace(/\\t/g," ")),c?(s[I]=s[I]||[],s[I].push(A)):s[I]=A}return s}return nn=r,nn}var rn,Us;function Ci(){if(Us)return rn;Us=1;function e(r){let y;try{y=new URL(r)}catch(u){throw new Error(`INVALID_DOTENV_KEY: ${u.message}`)}const i=y.searchParams.get("environment");if(!i)throw new Error("INVALID_DOTENV_KEY: Missing environment part");return i}return rn=e,rn}var sn,Ms;function Gs(){if(Ms)return sn;Ms=1;const e=qe;function r(y){const i=e.readFileSync(y);return i.length>=2&&i[0]===255&&i[1]===254?"utf16le":(i.length>=3&&i[0]===239&&i[1]===187&&i[2]===191,"utf8")}return sn=r,sn}var on,Ys;function $s(){if(Ys)return on;Ys=1;const e=Ie;function r(y){const i=e.basename(y),c=[...i.split(".").slice(2)];return c.length===0?i.replace(".env","development"):c.length===1?c[0]:c.length===2?c.join("_"):c.slice(0,2).join("_")}return on=r,on}var cn,Zs;function We(){if(Zs)return cn;Zs=1;const e=Ie,r=$s();function y(i){const u=e.basename(i).toLowerCase();return u===".env"?"DOTENV_PRIVATE_KEY":`DOTENV_PRIVATE_KEY_${r(u).toUpperCase()}`}return cn=y,cn}var an,Xs;function ot(){if(Xs)return an;Xs=1;const e=Ie,r=$s();function y(i){const u=e.basename(i).toLowerCase();return u===".env"?"DOTENV_PUBLIC_KEY":`DOTENV_PUBLIC_KEY_${r(u).toUpperCase()}`}return an=y,an}var un,Ws;function zs(){if(Ws)return un;Ws=1;const e=Ie,r=Fn,y=We(),i=ot();class u{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 I=y(this.envFilepath),A=i(this.envFilepath);s[I]=null,s[A]=null}}return s}}return un=u,un}var ln,Qs;function Pi(){if(Qs)return ln;Qs=1;const e=Ve(),r=Xe(),y=ot();function i(s){if(process.env[s]&&process.env[s].length>0)return process.env[s]}function u(s,d){if(e.existsSync(d)){const b=e.readFileX(d),I=r(b);if(I[s]&&I[s].length>0)return I[s]}}function c(s){let d=null;const b=y(s);return d=i(b),d||(d=u(b,s),d)?d:null}return ln=c,ln}var fn,Js;function Hi(){if(Js)return fn;Js=1;const e=Ve(),r=Ie,y="DOTENV_PUBLIC_KEY",i="DOTENV_PRIVATE_KEY",u=Xe(),c=We();function s(A){if(process.env[A]&&process.env[A].length>0)return process.env[A]}function d(A,D,w=null){let P=r.resolve(r.dirname(D),".env.keys");if(w&&(P=r.resolve(w)),e.existsSync(P)){const _=e.readFileX(P),x=u(_);if(x[A]&&x[A].length>0)return x[A]}}function b(A){if(!e.existsSync(A))return null;const D=e.readFileX(A),w=u(D);let P;for(const _ of Object.keys(w))(_===y||_.startsWith(y))&&(P=_);return P?P.replace(y,i):null}function I(A,D=null){let w=null,P=c(A);return w=s(P),w||(w=d(P,A,D),w)||(P=b(A),P&&(w=s(P),w||(w=d(P,A,D),w)))?w:null}return fn=I,fn}var dn,eo;function hn(){if(eo)return dn;eo=1;const e=ot(),r=Pi(),y=We(),i=Hi();class u{constructor(s=".env",d=null){this.envFile=s,this.envKeysFilepath=d}run(){const s={},d=this._envFilepaths();for(const b of d){const I=e(b),A=r(b);s[I]=A;const D=y(b),w=i(b,this.envKeysFilepath);s[D]=w}return s}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return dn=u,dn}var pn,to;function no(){if(to)return pn;to=1;const e=We(),r=zs(),y=hn();function i(u,c=null,s=!0){const d=e(u);let b={};s&&(b=new r(u).run());const I=new y(u,c).run();return b[d]||I[d]}return pn={findPrivateKey:i},pn}var yn,ro;function Li(){if(ro)return yn;ro=1;const e="DOTENV_PRIVATE_KEY";function r(y){return Object.keys(y).filter(i=>i.startsWith(e))}return yn=r,yn}var vn,so;function Di(){if(so)return vn;so=1;const e="DOTENV_PRIVATE_KEY";function r(y){return y===e?".env":`.env.${y.substring(`${e}_`.length).split("_").join(".").toLowerCase()}`}return vn=r,vn}var gn,oo;function io(){if(oo)return gn;oo=1;const e=Li(),r=Di(),y="envFile",i="envVaultFile",u=[{type:y,value:".env"}],c=[{type:i,value:".env.vault"}];function s(b){const I=[];for(const A of b){const D=r(A);I.push({type:y,value:D})}return I}function d(b=[],I,A=""){const D=e(I);if(!b||b.length<=0)return D.length>0?s(D):A.length>0?c:u;{let w=!1;for(const P of b)A.length>0&&P.type===i&&(w=!0),A.length<=0&&P.type===y&&(w=!0);return w?b:A.length>0?[...c,...b]:[...u,...b]}}return gn=d,gn}var mn,co;function ao(){if(co)return mn;co=1;const e=Ve(),r=Ie,y="env",i="envFile",u="envVaultFile",c=ui(),s=Fs(),d=Ze(),b=Xe(),I=Ci(),A=Gs(),{findPrivateKey:D}=no(),w=We(),P=io();class _{constructor(S=[],O=!1,M="",L=process.env,F=null,E=!0){this.envs=P(S,L,M),this.overload=O,this.DOTENV_KEY=M,this.processEnv=L,this.envKeysFilepath=F,this.opsOn=E,this.processedEnvs=[],this.readableFilepaths=new Set,this.readableStrings=new Set,this.uniqueInjectedKeys=new Set,this.beforeEnv={...this.processEnv}}run(){for(const S of this.envs)S.type===u?this._injectEnvVaultFile(S.value):S.type===i?this._injectEnvFile(S.value):S.type===y&&this._injectEnv(S.value);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys],beforeEnv:this.beforeEnv,afterEnv:{...this.processEnv}}}_injectEnv(S){const O={};O.type=y,O.string=S;try{const{parsed:M,errors:L,injected:F,preExisted:E}=new s(S,null,this.processEnv,this.overload).run();O.parsed=M,O.errors=L,O.injected=F,O.preExisted=E,this.inject(O.parsed),this.readableStrings.add(S);for(const R of Object.keys(F))this.uniqueInjectedKeys.add(R)}catch(M){O.errors=[M]}this.processedEnvs.push(O)}_injectEnvFile(S){const O={};O.type=i,O.filepath=S;const M=r.resolve(S);try{const L=A(M),F=e.readFileX(M,{encoding:L});this.readableFilepaths.add(S);const E=D(S,this.envKeysFilepath,this.opsOn),R=w(S),{parsed:H,errors:k,injected:N,preExisted:V}=new s(F,E,this.processEnv,this.overload,R).run();O.privateKeyName=R,O.privateKey=E,O.src=F,O.parsed=H,O.errors=k,O.injected=N,O.preExisted=V,this.inject(O.parsed);for(const B of Object.keys(N))this.uniqueInjectedKeys.add(B)}catch(L){L.code==="ENOENT"||L.code==="EISDIR"?O.errors=[new d({envFilepath:S,filepath:M}).missingEnvFile()]:O.errors=[L]}this.processedEnvs.push(O)}_injectEnvVaultFile(S){const O={};O.type=u,O.filepath=S;const M=r.resolve(S);if(this.readableFilepaths.add(S),!e.existsSync(M)){const R="MISSING_ENV_VAULT_FILE",H=`you set DOTENV_KEY but your .env.vault file is missing: ${M}`,k=new Error(H);throw k.code=R,k}if(this.DOTENV_KEY.length<1){const R="MISSING_DOTENV_KEY",H=`your DOTENV_KEY appears to be blank: '${this.DOTENV_KEY}'`,k=new Error(H);throw k.code=R,k}let L;const F=this._dotenvKeys(),E=this._parsedVault(M);for(let R=0;R<F.length;R++)try{const H=F[R].trim();L=this._decrypted(H,E);break}catch(H){if(R+1>=F.length)throw H}try{const{parsed:R,errors:H,injected:k,preExisted:N}=new s(L,null,this.processEnv,this.overload).run();O.parsed=R,O.errors=H,O.injected=k,O.preExisted=N,this.inject(O.parsed);for(const V of Object.keys(k))this.uniqueInjectedKeys.add(V)}catch(R){O.errors=[R]}this.processedEnvs.push(O)}inject(S){for(const O of Object.keys(S))this.processEnv[O]=S[O]}_dotenvKeys(){return this.DOTENV_KEY.split(",")}_parsedVault(S){const O=e.readFileX(S);return b(O)}_decrypted(S,O){const L=`DOTENV_VAULT_${I(S).toUpperCase()}`,F=O[L];if(!F){const E=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: cannot locate environment ${L} in your .env.vault file`);throw E.code="NOT_FOUND_DOTENV_ENVIRONMENT",E}return c(F,S)}}return mn=_,mn}var bn,uo;function Ki(){if(uo)return bn;uo=1;const{encrypt:e}=Zt(),r="encrypted:";function y(i,u){const c=e(u,Buffer.from(i)),s=Buffer.from(c,"hex").toString("base64");return`${r}${s}`}return bn=y,bn}var En,lo;function qi(){if(lo)return En;lo=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function r(y){const i={};let u=y.toString();u=u.replace(/\r\n?/mg,`
|
|
9
|
-
`);let c;for(;(c=e.exec(u))!=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]?i[s]="":i[s]=b}return i}return En=r,En}var _n,fo;function Vi(){if(fo)return _n;fo=1;function e(r){return r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}return _n=e,_n}var wn,ho;function ki(){if(ho)return wn;ho=1;function e(r){return r.replace(/\$/g,"$$$$")}return wn=e,wn}var Sn,po;function yo(){if(po)return Sn;po=1;const e=qi(),r=Xe(),y=Vi(),i=ki();function u(c,s,d){let b,I="";const A=r(c,!0,!0),D=e(c);if(Object.prototype.hasOwnProperty.call(A,s)){const w=D[s];I+=`${s}=${w}${d}${w}`;const P=A[s],_=y(P);let x="";if(_===""){x="$";const M=c.match(new RegExp(`${s}\\s*=\\s*
|
|
10
|
-
|
|
11
|
-
`,"m"));if(w===""&&M){const L=M[0].match(/\n/g).length-1;for(let F=0;F<L;F++)I+=`
|
|
12
|
-
`}}const S=new RegExp("^(\\s*)?(export\\s+)?"+s+"\\s*=\\s*[\"'`]?"+_+"[\"'`]?"+x,"gm"),O=i(I);b=c.replace(S,`$1$2${O}`)}else I+=`${s}="${d}"`,c.endsWith(`
|
|
13
|
-
`)?I=I+`
|
|
14
|
-
`:I=`
|
|
15
|
-
`+I,b=c+I;return b}return Sn=u,Sn}var An,vo;function Fi(){if(vo)return An;vo=1;const e=ot(),r=zs(),y=hn();function i(u,c=!0){const s=e(u);let d={};c&&(d=new r(u).run());const b=new y(u).run();return d[s]||b[s]}return An=i,An}var xn,go;function ji(){if(go)return xn;go=1;const{PrivateKey:e}=Zt();function r(y){let i;y?i=new e(Buffer.from(y,"hex")):i=new e;const u=i.publicKey.toHex(),c=i.secret.toString("hex");return{publicKey:u,privateKey:c}}return xn=r,xn}var Bn,mo;function Ui(){if(mo)return Bn;mo=1;const e=/^encrypted:.+/;function r(y){return e.test(y)}return Bn=r,Bn}var Rn,bo;function Mi(){if(bo)return Rn;bo=1;const e=Ve(),r=Ie,y="envFile",i=Ze(),u=We(),c=ot(),s=Ki(),d=Ds(),b=yo(),I=Xe(),A=Gs(),D=io(),{findPrivateKey:w}=no(),P=Fi(),_=ji(),x=Ps(),S=Ui();class O{constructor(L,F,E=[],R=!0,H=null){this.envs=D(E,process.env),this.key=L,this.value=F,this.encrypt=R,this.envKeysFilepath=H,this.processedEnvs=[],this.changedFilepaths=new Set,this.unchangedFilepaths=new Set,this.readableFilepaths=new Set}run(){for(const L of this.envs)L.type===y&&this._setEnvFile(L.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}_setEnvFile(L){const F={};F.key=this.key||null,F.value=this.value||null,F.type=y;const E=r.basename(L),R=r.resolve(L);F.filepath=R,F.envFilepath=L,F.changed=!1;try{const H=this._detectEncoding(R);let k=e.readFileX(R,{encoding:H});const N=I(k);F.originalValue=N[F.key]||null;const V=!S(F.originalValue);if(this.readableFilepaths.add(L),this.encrypt){let K,C;const a=c(L),p=u(L),o=w(L,this.envKeysFilepath),n=P(L);let h=r.join(r.dirname(R),".env.keys");this.envKeysFilepath&&(h=r.resolve(this.envKeysFilepath));const f=r.relative(r.dirname(R),h);if(o){const t=_(o);if(K=t.publicKey,C=t.privateKey,F.originalValue&&(F.originalValue=d(F.key,F.originalValue,p,C)),n&&n!==K){const v=new Error(`derived public key (${x(K)}) does not match the existing public key (${x(n)})`);throw v.code="INVALID_DOTENV_PRIVATE_KEY",v.help=`debug info: ${p}=${x(o)} (derived ${a}=${x(K)} vs existing ${a}=${x(n)})`,v}if(!n){const v=this._preserveShebang(k),g=v.firstLinePreserved;k=v.envSrc;const l=this._prependPublicKey(a,K,E,f);k=`${g}${l}
|
|
16
|
-
${k}`}}else if(n)K=n;else{let t="";e.existsSync(h)&&(t=e.readFileX(h));const v=this._preserveShebang(k),g=v.firstLinePreserved;k=v.envSrc;const l=_();K=l.publicKey,C=l.privateKey;const m=this._prependPublicKey(a,K,E,f),Q=["#/------------------!DOTENV_PRIVATE_KEYS!-------------------/","#/ private decryption keys. DO NOT commit to source control /","#/ [how it works](https://dotenvx.com/encryption) /","#/ backup with: `dotenvx ops backup` /","#/----------------------------------------------------------/"].join(`
|
|
17
|
-
`),$=[`# ${E}`,`${p}=${C}`,""].join(`
|
|
18
|
-
`);k=`${g}${m}
|
|
19
|
-
${k}`,t=t.length>1?t:`${Q}
|
|
20
|
-
`,t=`${t}
|
|
21
|
-
${$}`,e.writeFileX(h,t),F.privateKeyAdded=!0,F.envKeysFilepath=this.envKeysFilepath||r.join(r.dirname(L),r.basename(h))}F.publicKey=K,F.privateKey=C,F.encryptedValue=s(this.value,K),F.privateKeyName=p}const B=V&&this.encrypt,j=this.value!==F.originalValue;B||j?(F.envSrc=b(k,this.key,F.encryptedValue||this.value),this.changedFilepaths.add(L),F.changed=!0):(F.envSrc=k,this.unchangedFilepaths.add(L),F.changed=!1)}catch(H){H.code==="ENOENT"?F.error=new i({envFilepath:L,filepath:R}).missingEnvFile():F.error=H}this.processedEnvs.push(F)}_detectEncoding(L){return A(L)}_prependPublicKey(L,F,E,R=".env.keys"){const H=R===".env.keys"?"":` # -fk ${R}`;return["#/-------------------[DOTENV_PUBLIC_KEY]--------------------/","#/ public-key encryption for .env files /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/",`${L}="${F}"${H}`,"",`# ${E}`].join(`
|
|
22
|
-
`)}_preserveShebang(L){const[F,...E]=L.split(`
|
|
23
|
-
`);let R="";return F.startsWith("#!")&&(R=F+`
|
|
24
|
-
`,L=E.join(`
|
|
25
|
-
`)),{firstLinePreserved:R,envSrc:L}}}return Rn=O,Rn}var In,Eo;function Gi(){if(Eo)return In;Eo=1;const e=ao(),r=Ze();class y{constructor(u,c=[],s=!1,d="",b=!1,I=null){this.key=u,this.envs=c,this.overload=s,this.DOTENV_KEY=d,this.all=b,this.envKeysFilepath=I}run(){const u={...process.env},{processedEnvs:c}=new e(this.envs,this.overload,this.DOTENV_KEY,u,this.envKeysFilepath).run(),s=[];for(const d of c)for(const b of d.errors)s.push(b);if(this.key){const d={},b=u[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:u,errors:s};const d={};for(const b of c)if(b.parsed)for(const I of Object.keys(b.parsed))d[I]=u[I];return{parsed:d,errors:s}}}}return In=y,In}var On,_o;function Yi(){if(_o)return On;_o=1;const e=Ve(),r=[".env.vault",".env.project",".env.keys",".env.me",".env.x",".env.example"];function y(i){try{return e.readdirSync(i).filter(s=>s.startsWith(".env")&&!s.endsWith(".previous")&&!r.includes(s))}catch(u){if(u.code==="ENOENT"){const c=new Error(`missing directory (${i})`);throw c.code="MISSING_DIRECTORY",c}else throw u}}return On=y,On}var Tn,wo;function $i(){if(wo)return Tn;wo=1;const e=Ve(),r=Ie,y=Ze(),i=Yi(),u=yo(),c=Xe();class s{constructor(b=".",I){this.directory=b,this.envFile=I||i(b),this.exampleFilename=".env.example",this.exampleFilepath=r.resolve(this.directory,this.exampleFilename)}run(){if(this.envFile.length<1){const _="MISSING_ENV_FILES",x="no .env* files found",S='? add one with [echo "HELLO=World" > .env] and then run [dotenvx genexample]',O=new Error(x);throw O.code=_,O.help=S,O}const b=new Set,I=new Set,A=this._envFilepaths(),D={},w={};let P=`# ${this.exampleFilename} - generated with dotenvx
|
|
26
|
-
`;for(const _ of A){const x=r.resolve(this.directory,_);if(!e.existsSync(x)){const M=new y({envFilepath:_,filepath:x}).missingEnvFile();throw M.help=`? add it with [echo "HELLO=World" > ${_}] and then run [dotenvx genexample]`,M}let S=e.readFileX(x);const O=c(S);for(const M in O)b.add(M),S=u(S,M,"");P+=`
|
|
27
|
-
${S}`}if(e.existsSync(this.exampleFilepath)){P=e.readFileX(this.exampleFilepath);const _=c(P);for(const x of[...b])x in _?w[x]=_[x]:(P+=`${x}=''
|
|
28
|
-
`,I.add(x),D[x]="")}else for(const _ of[...b])I.add(_),D[_]="";return{envExampleFile:P,envFile:this.envFile,exampleFilepath:this.exampleFilepath,addedKeys:[...I],injected:D,preExisted:w}}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return Tn=s,Tn}var Nn,So;function Zi(){if(So)return Nn;So=1;function e(r){const y=process.env.DOTENV_ENV||process.env.NODE_ENV||"development";if(r==="nextjs"){const i=["development","test","production"].includes(y)&&y;return[i&&{type:"envFile",value:`.env.${i}.local`},i!=="test"&&{type:"envFile",value:".env.local"},i&&{type:"envFile",value:`.env.${i}`},{type:"envFile",value:".env"}].filter(Boolean)}else{if(r==="flow")return[{type:"envFile",value:`.env.${y}.local`},{type:"envFile",value:`.env.${y}`},{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 Nn=e,Nn}var Cn,Ao;function Xi(){if(Ao)return Cn;Ao=1;const e=kn,r=Ie;function y(i){return i[0]==="~"?r.join(e.homedir(),i.slice(1)):i}return Cn=y,Cn}var Pn,xo;function Wi(){if(xo)return Pn;xo=1;const e=Xi();function r(y){let i=[];if(y&&y.path)if(!Array.isArray(y.path))i=[e(y.path)];else{i=[];for(const u of y.path)i.push(e(u))}return i}return Pn=r,Pn}var Hn,Bo;function zi(){if(Bo)return Hn;Bo=1;const{logger:e}=hr();class r{constructor(i={}){this.DOTENV_KEY=i.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 Hn=r,Hn}var Ln,Ro;function Qi(){if(Ro)return Ln;Ro=1;const e=Ie,r=Zi(),y=Wi(),i=zi();function u(c,s=void 0){const d=y(c);let b=[];c.convention&&(b=r(c.convention).concat(b)),new i({DOTENV_KEY:s}).dotenvKey();for(const I of d)s?b.push({type:"envVaultFile",value:e.join(e.dirname(I),".env.vault")}):b.push({type:"envFile",value:I});return b}return Ln=u,Ln}var Dn,Io;function Ji(){if(Io)return Dn;Io=1;function e(p){return Array.isArray(p)?p:[p]}const r="",y=" ",i="\\",u=/^\s+$/,c=/(?:[^\\]|^)\\$/,s=/^\\!/,d=/^\\#/,b=/\r?\n/g,I=/^\.*\/|^\.+$/,A="/";let D="node-ignore";typeof Symbol<"u"&&(D=Symbol.for("node-ignore"));const w=D,P=(p,o,n)=>Object.defineProperty(p,o,{value:n}),_=/([0-z])-([0-z])/g,x=()=>!1,S=p=>p.replace(_,(o,n,h)=>n.charCodeAt(0)<=h.charCodeAt(0)?o:r),O=p=>{const{length:o}=p;return p.slice(0,o-o%2)},M=[[/^\uFEFF/,()=>r],[/((?:\\\\)*?)(\\?\s+)$/,(p,o,n)=>o+(n.indexOf("\\")===0?y:r)],[/(\\+?)\s/g,(p,o)=>{const{length:n}=o;return o.slice(0,n-n%2)+y}],[/[\\$.|*+(){^]/g,p=>`\\${p}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(p,o,n)=>o+6<n.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(p,o,n)=>{const h=n.replace(/\\\*/g,"[^\\/]*");return o+h}],[/\\\\\\(?=[$.|*+(){^])/g,()=>i],[/\\\\/g,()=>i],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(p,o,n,h,f)=>o===i?`\\[${n}${O(h)}${f}`:f==="]"&&h.length%2===0?`[${S(n)}${h}]`:"[]"],[/(?:[^*])$/,p=>/\/$/.test(p)?`${p}$`:`${p}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(p,o)=>`${o?`${o}[^/]+`:"[^/]*"}(?=$|\\/$)`]],L=Object.create(null),F=(p,o)=>{let n=L[p];return n||(n=M.reduce((h,[f,t])=>h.replace(f,t.bind(p)),p),L[p]=n),o?new RegExp(n,"i"):new RegExp(n)},E=p=>typeof p=="string",R=p=>p&&E(p)&&!u.test(p)&&!c.test(p)&&p.indexOf("#")!==0,H=p=>p.split(b);class k{constructor(o,n,h,f){this.origin=o,this.pattern=n,this.negative=h,this.regex=f}}const N=(p,o)=>{const n=p;let h=!1;p.indexOf("!")===0&&(h=!0,p=p.substr(1)),p=p.replace(s,"!").replace(d,"#");const f=F(p,o);return new k(n,p,h,f)},V=(p,o)=>{throw new o(p)},B=(p,o,n)=>E(p)?p?B.isNotRelative(p)?n(`path should be a \`path.relative()\`d string, but got "${o}"`,RangeError):!0:n("path must not be empty",TypeError):n(`path must be a string, but got \`${o}\``,TypeError),j=p=>I.test(p);B.isNotRelative=j,B.convert=p=>p;class K{constructor({ignorecase:o=!0,ignoreCase:n=o,allowRelativePaths:h=!1}={}){P(this,w,!0),this._rules=[],this._ignoreCase=n,this._allowRelativePaths=h,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(o){if(o&&o[w]){this._rules=this._rules.concat(o._rules),this._added=!0;return}if(R(o)){const n=N(o,this._ignoreCase);this._added=!0,this._rules.push(n)}}add(o){return this._added=!1,e(E(o)?H(o):o).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(o){return this.add(o)}_testOne(o,n){let h=!1,f=!1;return this._rules.forEach(t=>{const{negative:v}=t;if(f===v&&h!==f||v&&!h&&!f&&!n)return;t.regex.test(o)&&(h=!v,f=v)}),{ignored:h,unignored:f}}_test(o,n,h,f){const t=o&&B.convert(o);return B(t,o,this._allowRelativePaths?x:V),this._t(t,n,h,f)}_t(o,n,h,f){if(o in n)return n[o];if(f||(f=o.split(A)),f.pop(),!f.length)return n[o]=this._testOne(o,h);const t=this._t(f.join(A)+A,n,h,f);return n[o]=t.ignored?t:this._testOne(o,h)}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 C=p=>new K(p),a=p=>B(p&&B.convert(p),p,x);if(C.isPathValid=a,C.default=C,Dn=C,typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){const p=n=>/^\\\\\?\\/.test(n)||/["<>|\u0000-\u001F]+/u.test(n)?n:n.replace(/\\/g,"/");B.convert=p;const o=/^[a-z]:\//i;B.isNotRelative=n=>o.test(n)||j(n)}return Dn}var Kn,Oo;function ec(){if(Oo)return Kn;Oo=1;const e=Ve(),r=Ji();function y(){if(!e.existsSync(".gitignore"))return!1;const i=e.readFileX(".gitignore");return!!r(i).add(i).ignores(".env.keys")}return Kn=y,Kn}var qn,To;function tc(){if(To)return qn;To=1;const e=Ie,{setLogLevel:r,setLogName:y,setLogVersion:i,logger:u}=hr(),{getColor:c,bold:s}=fr(),d=ri(),b=ao(),I=Mi(),A=Gi(),D=hn(),w=$i(),P=Qi(),_=Fs(),x=Ve(),S=ec();return qn={config:function(k={}){let N=process.env;k&&k.processEnv!=null&&(N=k.processEnv);const V=k.overload||k.override,B=k.ignore||[],j=k.strict,K=k.envKeysFile;let C=process.env.DOTENV_KEY;k&&k.DOTENV_KEY&&(C=k.DOTENV_KEY);const a=k.opsOff!==!0;k&&(r(k),y(k),i(k));try{const p=P(k,C),{processedEnvs:o,readableFilepaths:n,uniqueInjectedKeys:h}=new b(p,V,C,N,K,a).run();let f;const t={};for(const g of o){g.type==="envVaultFile"&&(u.verbose(`loading env from encrypted ${g.filepath} (${e.resolve(g.filepath)})`),u.debug(`decrypting encrypted env from ${g.filepath} (${e.resolve(g.filepath)})`)),g.type==="envFile"&&u.verbose(`loading env from ${g.filepath} (${e.resolve(g.filepath)})`);for(const l of g.errors||[]){if(B.includes(l.code)){u.verbose(`ignored: ${l.message}`);continue}if(j)throw l;f=l,l.code==="MISSING_ENV_FILE"&&k.convention||(u.error(l.message),l.help&&u.error(l.help))}Object.assign(t,g.injected||{}),Object.assign(t,g.preExisted||{}),u.debug(g.parsed);for(const[l,m]of Object.entries(g.injected||{}))u.verbose(`${l} set`),u.debug(`${l} set to ${m}`);for(const[l,m]of Object.entries(g.preExisted||{}))u.verbose(`${l} pre-exists (protip: use --overload to override)`),u.debug(`${l} pre-exists as ${m} (protip: use --overload to override)`)}let v=`injecting env (${h.length})`;return n.length>0&&(v+=` from ${n.join(", ")}`),u.successv(v),f?{parsed:t,error:f}:{parsed:t}}catch(p){if(j)throw p;return u.error(p.message),p.help&&u.help(p.help),{parsed:{},error:p}}},parse:function(k,N={}){let V=process.env;N&&N.processEnv!=null&&(V=N.processEnv);const B=N.privateKey||null,j=N.overload||N.override,{parsed:K,errors:C}=new _(k,B,V,j).run();for(const a of C)u.error(a.message),a.help&&u.error(a.help);return K},set:function(k,N,V={}){let B=!0;(V.plain||V.encrypt===!1)&&(B=!1),V&&(r(V),y(V),i(V));const j=P(V),K=V.envKeysFile,{processedEnvs:C,changedFilepaths:a,unchangedFilepaths:p}=new I(k,N,j,B,K).run();let o="";B&&(o=" with encryption");for(const n of C)u.verbose(`setting for ${n.envFilepath}`),n.error?n.error.code==="MISSING_ENV_FILE"?(u.warn(n.error.message),u.help(`? add one with [echo "HELLO=World" > ${n.envFilepath}] and re-run [dotenvx set]`)):(u.warn(n.error.message),n.error.help&&u.help(n.error.help)):(x.writeFileX(n.filepath,n.envSrc),u.verbose(`${n.key} set${o} (${n.envFilepath})`),u.debug(`${n.key} set${o} to ${n.value} (${n.envFilepath})`));a.length>0?u.success(`\u2714 set ${k}${o} (${a.join(",")})`):p.length>0&&u.info(`no changes (${p})`);for(const n of C)n.privateKeyAdded&&(u.success(`\u2714 key added to ${n.envKeysFilepath} (${n.privateKeyName})`),u.help("\u2B95 optional: [dotenvx ops backup] to securely backup private key"),S()||u.help("\u2B95 next run: [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys"),u.help(`\u2B95 next run: [${n.privateKeyName}='${n.privateKey}' dotenvx get ${k}] to test decryption locally`));return{processedEnvs:C,changedFilepaths:a,unchangedFilepaths:p}},get:function(k,N={}){const V=P(N),B=N.ignore||[],{parsed:j,errors:K}=new A(k,V,N.overload,process.env.DOTENV_KEY,N.all,N.envKeysFile).run();for(const C of K||[])if(!B.includes(C.code)){if(N.strict)throw C;u.error(C.message),C.help&&u.error(C.help)}if(k){const C=j[k];return C===void 0?void 0:C}else if(N.format==="eval"){let C="";for(const[a,p]of Object.entries(j))C+=`${a}=${escape(p)}
|
|
29
|
-
`;return C=C.trim(),C}else if(N.format==="shell"){let C="";for(const[a,p]of Object.entries(j))C+=`${a}=${p} `;return C=C.trim(),C}else return j},ls:function(k,N,V){return new d(k,N,V).run()},keypair:function(k,N,V=null){const B=new D(k,V).run();return N?B[N]:B},genexample:function(k,N){return new w(k,N).run()},setLogLevel:r,logger:u,getColor:c,bold:s},qn}var No;function nc(){return No||(No=1,tc().config()),Un}nc();const rc={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 $e{static instance;envVars;constructor(){this.envVars={},Object.values(rc).forEach(r=>{const y=process.env[r];if(y==null)throw new Error(`Missing required environment variable: ${r}`);this.envVars[r]=y})}static getInstance(){return $e.instance||($e.instance=new $e),$e.instance}getConfig(r){return this.envVars[r]}}function Co(e){return typeof e=="object"&&e!==null&&"objectID"in e&&typeof e.objectID=="string"}function sc(e){const r=Object.keys(e).sort(),y={objectID:e.objectID};for(const i of r)i!=="objectID"&&(y[i]=e[i]);return y}function Po(e){return e.map(sc).sort((r,y)=>r.objectID.localeCompare(y.objectID))}class oc{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 y=await this.getAllObjects();y=Po(y);const i=Po(r),u=this.determineOperations(y,i);if(u.update.length===0&&u.add.length===0&&u.delete.length===0){console.log("No updates needed. All objects are up to date.");return}if(u.update.length>0){const c=await this.client.partialUpdateObjects({indexName:this.indexName,objects:u.update,createIfNotExists:!0});console.log(`Updated ${c[0].objectIDs.length} objects`)}if(u.add.length>0){const c=await this.client.saveObjects({indexName:this.indexName,objects:u.add});console.log(`Added ${c[0].objectIDs.length} objects`)}if(u.delete.length>0){const c=u.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:y=>{Array.isArray(y.hits)&&y.hits.forEach(i=>{Co(i)&&r.push(i)})}}),r}determineOperations(r,y){const i=new Map(r.map(s=>[s.objectID,s])),u=new Map(y.map(s=>[s.objectID,s])),c={update:[],add:[],delete:[]};for(const s of y){const d=i.get(s.objectID);d==null?c.add.push(s):jo(d,s)||c.update.push(s)}for(const s of r)u.has(s.objectID)||c.delete.push(s);return c}}class Vn{static instance;client;indexName;constructor(r,y){this.client=y(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=$e.getInstance();this.instance=new Vn(r,Uo)}return this.instance}getClient(){return this.client}getIndexName(){return this.indexName}}const ic=Ko({meta:{name:Mo,version:Go,description:Yo},args:{},async run({args:e}){try{let r=$e.getInstance().getConfig("DATA_DIR");r=Ie.join(process.cwd(),r),qe.existsSync(r)&&qe.statSync(r).isDirectory()||(console.error(`Error: provided directory does not exist - ${r}`),process.exit(1));const y=$o(r)[0];y.every(u=>Co(u))||(console.error(`The content of the provided json file is incompatible. Check the file: ${r}`),process.exit(1));const i=Vn.getInstance();await new oc(i).uploadObjects(y)}catch(r){console.error("Some errors occured: ",r),process.exit(1)}}});qo(ic);
|