resend-cli 2.6.0 → 2.7.0-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +296 -295
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,165 +1,165 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`)}displayWidth(
|
|
2
|
+
"use strict";var Eu=Object.create;var pn=Object.defineProperty;var Du=Object.getOwnPropertyDescriptor;var Su=Object.getOwnPropertyNames;var Tu=Object.getPrototypeOf,Ou=Object.prototype.hasOwnProperty;var ye=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Ae=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Vt=(e,t)=>{for(var r in t)pn(e,r,{get:t[r],enumerable:!0})},Iu=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Su(t))!Ou.call(e,o)&&o!==r&&pn(e,o,{get:()=>t[o],enumerable:!(n=Du(t,o))||n.enumerable});return e};var pe=(e,t,r)=>(r=e!=null?Eu(Tu(e)):{},Iu(t||!e||!e.__esModule?pn(r,"default",{value:e,enumerable:!0}):r,e));var Kt=Ae(hn=>{var fr=class extends Error{constructor(t,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},fn=class extends fr{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};hn.CommanderError=fr;hn.InvalidArgumentError=fn});var hr=Ae(bn=>{var{InvalidArgumentError:Pu}=Kt(),gn=class{constructor(t,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new Pu(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ju(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}bn.Argument=gn;bn.humanReadableArgName=ju});var Cn=Ae(vn=>{var{humanReadableArgName:Ru}=hr(),yn=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let r=t.commands.filter(o=>!o._hidden),n=t._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((o,i)=>o.name().localeCompare(i.name())),r}compareOptions(t,r){let n=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return n(t).localeCompare(n(r))}visibleOptions(t){let r=t.options.filter(o=>!o.hidden),n=t._getHelpOption();if(n&&!n.hidden){let o=n.short&&t._findOption(n.short),i=n.long&&t._findOption(n.long);!o&&!i?r.push(n):n.long&&!i?r.push(t.createOption(n.long,n.description)):n.short&&!o&&r.push(t.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let r=[];for(let n=t.parent;n;n=n.parent){let o=n.options.filter(i=>!i.hidden);r.push(...o)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t.registeredArguments.find(r=>r.description)?t.registeredArguments:[]}subcommandTerm(t){let r=t.registeredArguments.map(n=>Ru(n)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(o)))),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(o)))),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let n="";for(let o=t.parent;o;o=o.parent)n=o.name()+" "+n;return n+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}formatItemList(t,r,n){return r.length===0?[]:[n.styleTitle(t),...r,""]}groupItems(t,r,n){let o=new Map;return t.forEach(i=>{let s=n(i);o.has(s)||o.set(s,[])}),r.forEach(i=>{let s=n(i);o.has(s)||o.set(s,[]),o.get(s).push(i)}),o}formatHelp(t,r){let n=r.padWidth(t,r),o=r.helpWidth??80;function i(u,p){return r.formatItem(u,n,p,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(t))}`,""],a=r.commandDescription(t);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),o),""]));let l=r.visibleArguments(t).map(u=>i(r.styleArgumentTerm(r.argumentTerm(u)),r.styleArgumentDescription(r.argumentDescription(u))));if(s=s.concat(this.formatItemList("Arguments:",l,r)),this.groupItems(t.options,r.visibleOptions(t),u=>u.helpGroupHeading??"Options:").forEach((u,p)=>{let y=u.map(g=>i(r.styleOptionTerm(r.optionTerm(g)),r.styleOptionDescription(r.optionDescription(g))));s=s.concat(this.formatItemList(p,y,r))}),r.showGlobalOptions){let u=r.visibleGlobalOptions(t).map(p=>i(r.styleOptionTerm(r.optionTerm(p)),r.styleOptionDescription(r.optionDescription(p))));s=s.concat(this.formatItemList("Global Options:",u,r))}return this.groupItems(t.commands,r.visibleCommands(t),u=>u.helpGroup()||"Commands:").forEach((u,p)=>{let y=u.map(g=>i(r.styleSubcommandTerm(r.subcommandTerm(g)),r.styleSubcommandDescription(r.subcommandDescription(g))));s=s.concat(this.formatItemList(p,y,r))}),s.join(`
|
|
3
|
+
`)}displayWidth(t){return jo(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,r,n,o){let s=" ".repeat(2);if(!n)return s+t;let a=t.padEnd(r+t.length-o.displayWidth(t)),l=2,c=(this.helpWidth??80)-r-l-2,u;return c<this.minWidthToWrap||o.preformatted(n)?u=n:u=o.boxWrap(n,c).replace(/\n/g,`
|
|
4
4
|
`+" ".repeat(r+l)),s+a+" ".repeat(l)+u.replace(/\n/g,`
|
|
5
|
-
${s}`)}boxWrap(
|
|
6
|
-
`)}};function
|
|
5
|
+
${s}`)}boxWrap(t,r){if(r<this.minWidthToWrap)return t;let n=t.split(/\r\n|\n/),o=/[\s]*[^\s]+/g,i=[];return n.forEach(s=>{let a=s.match(o);if(a===null){i.push("");return}let l=[a.shift()],d=this.displayWidth(l[0]);a.forEach(c=>{let u=this.displayWidth(c);if(d+u<=r){l.push(c),d+=u;return}i.push(l.join(""));let p=c.trimStart();l=[p],d=this.displayWidth(p)}),i.push(l.join(""))}),i.join(`
|
|
6
|
+
`)}};function jo(e){let t=/\x1b\[\d*(;\d*)*m/g;return e.replace(t,"")}vn.Help=yn;vn.stripColor=jo});var kn=Ae(xn=>{var{InvalidArgumentError:Fu}=Kt(),wn=class{constructor(t,r){this.flags=t,this.description=r||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let n=Nu(t);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let r=t;return typeof t=="string"&&(r={[t]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new Fu(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Ro(this.name().replace(/^no-/,"")):Ro(this.name())}helpGroup(t){return this.helpGroupHeading=t,this}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},_n=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(t,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let o=this.negativeOptions.get(n).presetArg,i=o!==void 0?o:!1;return r.negate===(i===t)}};function Ro(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function Nu(e){let t,r,n=/^-[^-]$/,o=/^--[^-]/,i=e.split(/[ |,]+/).concat("guard");if(n.test(i[0])&&(t=i.shift()),o.test(i[0])&&(r=i.shift()),!t&&n.test(i[0])&&(t=i.shift()),!t&&o.test(i[0])&&(t=r,r=i.shift()),i[0].startsWith("-")){let s=i[0],a=`option creation failed due to '${s}' in option flags '${e}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a}
|
|
7
7
|
- a short flag is a single dash and a single character
|
|
8
8
|
- either use a single dash and a single character (for a short flag)
|
|
9
9
|
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a}
|
|
10
|
-
- too many short flags`):
|
|
10
|
+
- too many short flags`):o.test(s)?new Error(`${a}
|
|
11
11
|
- too many long flags`):new Error(`${a}
|
|
12
|
-
- unrecognised flag format`)}if(
|
|
12
|
+
- unrecognised flag format`)}if(t===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:r}}xn.Option=wn;xn.DualOptions=_n});var No=Ae(Fo=>{function Bu(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let n=0;n<=e.length;n++)r[n]=[n];for(let n=0;n<=t.length;n++)r[0][n]=n;for(let n=1;n<=t.length;n++)for(let o=1;o<=e.length;o++){let i=1;e[o-1]===t[n-1]?i=0:i=1,r[o][n]=Math.min(r[o-1][n]+1,r[o][n-1]+1,r[o-1][n-1]+i),o>1&&n>1&&e[o-1]===t[n-2]&&e[o-2]===t[n-1]&&(r[o][n]=Math.min(r[o][n],r[o-2][n-2]+1))}return r[e.length][t.length]}function Gu(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let r=e.startsWith("--");r&&(e=e.slice(2),t=t.map(s=>s.slice(2)));let n=[],o=3,i=.4;return t.forEach(s=>{if(s.length<=1)return;let a=Bu(e,s),l=Math.max(e.length,s.length);(l-a)/l>i&&(a<o?(o=a,n=[s]):a===o&&n.push(s))}),n.sort((s,a)=>s.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?`
|
|
13
13
|
(Did you mean one of ${n.join(", ")}?)`:n.length===1?`
|
|
14
|
-
(Did you mean ${n[0]}?)`:""}
|
|
15
|
-
- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=
|
|
16
|
-
Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[
|
|
17
|
-
- already used by option '${r.flags}'`)}this._initOptionGroup(
|
|
18
|
-
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(
|
|
14
|
+
(Did you mean ${n[0]}?)`:""}Fo.suggestSimilar=Gu});var Ho=Ae(Sn=>{var Lu=require("node:events").EventEmitter,An=require("node:child_process"),Ye=require("node:path"),gr=require("node:fs"),V=require("node:process"),{Argument:Hu,humanReadableArgName:Mu}=hr(),{CommanderError:$n}=Kt(),{Help:qu,stripColor:Uu}=Cn(),{Option:Bo,DualOptions:Wu}=kn(),{suggestSimilar:Go}=No(),En=class e extends Lu{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:r=>V.stdout.write(r),writeErr:r=>V.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>V.stdout.isTTY?V.stdout.columns:void 0,getErrHelpWidth:()=>V.stderr.isTTY?V.stderr.columns:void 0,getOutHasColors:()=>Dn()??(V.stdout.isTTY&&V.stdout.hasColors?.()),getErrHasColors:()=>Dn()??(V.stderr.isTTY&&V.stderr.hasColors?.()),stripColor:r=>Uu(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let r=this;r;r=r.parent)t.push(r);return t}command(t,r,n){let o=r,i=n;typeof o=="object"&&o!==null&&(i=o,o=null),i=i||{};let[,s,a]=t.match(/([^ ]+) *(.*)/),l=this.createCommand(s);return o&&(l.description(o),l._executableHandler=!0),i.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(i.noHelp||i.hidden),l._executableFile=i.executableFile||null,a&&l.arguments(a),this._registerCommand(l),l.parent=this,l.copyInheritedSettings(this),o?this:l}createCommand(t){return new e(t)}createHelp(){return Object.assign(new qu,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...t},this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,r){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
15
|
+
- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=t._name),(r.noHelp||r.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,r){return new Hu(t,r)}argument(t,r,n,o){let i=this.createArgument(t,r);return typeof n=="function"?i.default(o).argParser(n):i.default(n),this.addArgument(i),this}arguments(t){return t.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(t){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,r){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,t&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=t??"help [command]",[,o,i]=n.match(/([^ ]+) *(.*)/),s=r??"display help for command",a=this.createCommand(o);return a.helpOption(!1),i&&a.arguments(i),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(t||r)&&this._initCommandGroup(a),this}addHelpCommand(t,r){return typeof t!="object"?(this.helpCommand(t,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this._initCommandGroup(t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
|
|
16
|
+
Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(r):this._lifeCycleHooks[t]=[r],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(t,r,n){this._exitCallback&&this._exitCallback(new $n(t,r,n)),V.exit(t)}action(t){let r=n=>{let o=this.registeredArguments.length,i=n.slice(0,o);return this._storeOptionsAsProperties?i[o]=this:i[o]=this.opts(),i.push(this),t.apply(this,i)};return this._actionHandler=r,this}createOption(t,r){return new Bo(t,r)}_callParseArg(t,r,n,o){try{return t.parseArg(r,n)}catch(i){if(i.code==="commander.invalidArgument"){let s=`${o} ${i.message}`;this.error(s,{exitCode:i.exitCode,code:i.code})}throw i}}_registerOption(t){let r=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(r){let n=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
|
|
17
|
+
- already used by option '${r.flags}'`)}this._initOptionGroup(t),this.options.push(t)}_registerCommand(t){let r=o=>[o.name()].concat(o.aliases()),n=r(t).find(o=>this._findCommand(o));if(n){let o=r(this._findCommand(n)).join("|"),i=r(t).join("|");throw new Error(`cannot add command '${i}' as already have command '${o}'`)}this._initCommandGroup(t),this.commands.push(t)}addOption(t){this._registerOption(t);let r=t.name(),n=t.attributeName();if(t.negate){let i=t.long.replace(/^--no-/,"--");this._findOption(i)||this.setOptionValueWithSource(n,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(n,t.defaultValue,"default");let o=(i,s,a)=>{i==null&&t.presetArg!==void 0&&(i=t.presetArg);let l=this.getOptionValue(n);i!==null&&t.parseArg?i=this._callParseArg(t,i,l,s):i!==null&&t.variadic&&(i=t._collectValue(i,l)),i==null&&(t.negate?i=!1:t.isBoolean()||t.optional?i=!0:i=""),this.setOptionValueWithSource(n,i,a)};return this.on("option:"+r,i=>{let s=`error: option '${t.flags}' argument '${i}' is invalid.`;o(i,s,"cli")}),t.envVar&&this.on("optionEnv:"+r,i=>{let s=`error: option '${t.flags}' value '${i}' from env '${t.envVar}' is invalid.`;o(i,s,"env")}),this}_optionEx(t,r,n,o,i){if(typeof r=="object"&&r instanceof Bo)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!t.mandatory),typeof o=="function")s.default(i).argParser(o);else if(o instanceof RegExp){let a=o;o=(l,d)=>{let c=a.exec(l);return c?c[0]:d},s.default(i).argParser(o)}else s.default(o);return this.addOption(s)}option(t,r,n,o){return this._optionEx({},t,r,n,o)}requiredOption(t,r,n,o){return this._optionEx({mandatory:!0},t,r,n,o)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(t=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,void 0)}setOptionValueWithSource(t,r,n){return this._storeOptionsAsProperties?this[t]=r:this._optionValues[t]=r,this._optionValueSources[t]=n,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(t)!==void 0&&(r=n.getOptionValueSource(t))}),r}_prepareUserArgs(t,r){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},t===void 0&&r.from===void 0){V.versions?.electron&&(r.from="electron");let o=V.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}t===void 0&&(t=V.argv),this.rawArgs=t.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=t[1],n=t.slice(2);break;case"electron":V.defaultApp?(this._scriptPath=t[1],n=t.slice(2)):n=t.slice(1);break;case"user":n=t.slice(0);break;case"eval":n=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(t,r){this._prepareForParse();let n=this._prepareUserArgs(t,r);return this._parseCommand([],n),this}async parseAsync(t,r){this._prepareForParse();let n=this._prepareUserArgs(t,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
18
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(t,r,n){if(gr.existsSync(t))return;let o=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",i=`'${t}' does not exist
|
|
19
19
|
- if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
20
20
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
21
|
-
- ${
|
|
21
|
+
- ${o}`;throw new Error(i)}_executeSubCommand(t,r){r=r.slice();let n=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function i(c,u){let p=Ye.resolve(c,u);if(gr.existsSync(p))return p;if(o.includes(Ye.extname(u)))return;let y=o.find(g=>gr.existsSync(`${p}${g}`));if(y)return`${p}${y}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=t._executableFile||`${this._name}-${t._name}`,a=this._executableDir||"";if(this._scriptPath){let c;try{c=gr.realpathSync(this._scriptPath)}catch{c=this._scriptPath}a=Ye.resolve(Ye.dirname(c),a)}if(a){let c=i(a,s);if(!c&&!t._executableFile&&this._scriptPath){let u=Ye.basename(this._scriptPath,Ye.extname(this._scriptPath));u!==this._name&&(c=i(a,`${u}-${t._name}`))}s=c||s}n=o.includes(Ye.extname(s));let l;V.platform!=="win32"?n?(r.unshift(s),r=Lo(V.execArgv).concat(r),l=An.spawn(V.argv[0],r,{stdio:"inherit"})):l=An.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,t._name),r.unshift(s),r=Lo(V.execArgv).concat(r),l=An.spawn(V.execPath,r,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(u=>{V.on(u,()=>{l.killed===!1&&l.exitCode===null&&l.kill(u)})});let d=this._exitCallback;l.on("close",c=>{c=c??1,d?d(new $n(c,"commander.executeSubCommandAsync","(close)")):V.exit(c)}),l.on("error",c=>{if(c.code==="ENOENT")this._checkForMissingExecutable(s,a,t._name);else if(c.code==="EACCES")throw new Error(`'${s}' not executable`);if(!d)V.exit(1);else{let u=new $n(1,"commander.executeSubCommandAsync","(error)");u.nestedError=c,d(u)}}),this.runningCommand=l}_dispatchSubcommand(t,r,n){let o=this._findCommand(t);o||this.help({error:!0}),o._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,o,"preSubcommand"),i=this._chainOrCall(i,()=>{if(o._executableHandler)this._executeSubCommand(o,r.concat(n));else return o._parseCommand(r,n)}),i}_dispatchHelpCommand(t){t||this.help();let r=this._findCommand(t);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,r)=>{t.required&&this.args[r]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(n,o,i)=>{let s=o;if(o!==null&&n.parseArg){let a=`error: command-argument value '${o}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,o,i,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,o)=>{let i=n.defaultValue;n.variadic?o<this.args.length?(i=this.args.slice(o),n.parseArg&&(i=i.reduce((s,a)=>t(n,a,s),n.defaultValue))):i===void 0&&(i=[]):o<this.args.length&&(i=this.args[o],n.parseArg&&(i=t(n,i,n.defaultValue))),r[o]=i}),this.processedArgs=r}_chainOrCall(t,r){return t?.then&&typeof t.then=="function"?t.then(()=>r()):r()}_chainOrCallHooks(t,r){let n=t,o=[];return this._getCommandAndAncestors().reverse().filter(i=>i._lifeCycleHooks[r]!==void 0).forEach(i=>{i._lifeCycleHooks[r].forEach(s=>{o.push({hookedCommand:i,callback:s})})}),r==="postAction"&&o.reverse(),o.forEach(i=>{n=this._chainOrCall(n,()=>i.callback(i.hookedCommand,this))}),n}_chainOrCallSubCommandHook(t,r,n){let o=t;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(i=>{o=this._chainOrCall(o,()=>i(this,r))}),o}_parseCommand(t,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(n.operands),r=n.unknown,this.args=t.concat(r),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),r);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,t,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(i,t,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(i))o(),this._processArguments(),this.parent.emit(i,t,r);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,r);this.listenerCount("command:*")?this.emit("command:*",t,r):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(r=>r._name===t||r._aliases.includes(t))}_findOption(t){return this.options.find(r=>r.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(r=>{r.mandatory&&t.getOptionValue(r.attributeName())===void 0&&t.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(n=>{let o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});t.filter(n=>n.conflictsWith.length>0).forEach(n=>{let o=t.find(i=>n.conflictsWith.includes(i.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let r=[],n=[],o=r;function i(c){return c.length>1&&c[0]==="-"}let s=c=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(c)?!this._getCommandAndAncestors().some(u=>u.options.map(p=>p.short).some(p=>/^-\d$/.test(p))):!1,a=null,l=null,d=0;for(;d<t.length||l;){let c=l??t[d++];if(l=null,c==="--"){o===n&&o.push(c),o.push(...t.slice(d));break}if(a&&(!i(c)||s(c))){this.emit(`option:${a.name()}`,c);continue}if(a=null,i(c)){let u=this._findOption(c);if(u){if(u.required){let p=t[d++];p===void 0&&this.optionMissingArgument(u),this.emit(`option:${u.name()}`,p)}else if(u.optional){let p=null;d<t.length&&(!i(t[d])||s(t[d]))&&(p=t[d++]),this.emit(`option:${u.name()}`,p)}else this.emit(`option:${u.name()}`);a=u.variadic?u:null;continue}}if(c.length>2&&c[0]==="-"&&c[1]!=="-"){let u=this._findOption(`-${c[1]}`);if(u){u.required||u.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${u.name()}`,c.slice(2)):(this.emit(`option:${u.name()}`),l=`-${c.slice(2)}`);continue}}if(/^--[^=]+=/.test(c)){let u=c.indexOf("="),p=this._findOption(c.slice(0,u));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,c.slice(u+1));continue}}if(o===r&&i(c)&&!(this.commands.length===0&&s(c))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(c)){r.push(c),n.push(...t.slice(d));break}else if(this._getHelpCommand()&&c===this._getHelpCommand().name()){r.push(c,...t.slice(d));break}else if(this._defaultCommandName){n.push(c,...t.slice(d));break}}if(this._passThroughOptions){o.push(c,...t.slice(d));break}o.push(c)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let t={},r=this.options.length;for(let n=0;n<r;n++){let o=this.options[n].attributeName();t[o]=o===this._versionOptionName?this._version:this[o]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,r)=>Object.assign(t,r.opts()),{})}error(t,r){this._outputConfiguration.outputError(`${t}
|
|
22
22
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
23
23
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
24
|
-
`),this.outputHelp({error:!0}));let n=r||{},
|
|
25
|
-
`),this._exit(0,"commander.version",
|
|
26
|
-
Expecting one of '${n.join("', '")}'`);let
|
|
27
|
-
`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Ti(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function xn(){if(W.env.NO_COLOR||W.env.FORCE_COLOR==="0"||W.env.FORCE_COLOR==="false")return!1;if(W.env.FORCE_COLOR||W.env.CLICOLOR_FORCE!==void 0)return!0}kn.Command=_n;kn.useColor=xn});var Ri=ke(Re=>{var{Argument:Ii}=pr(),{Command:An}=Oi(),{CommanderError:ku,InvalidArgumentError:ji}=Kt(),{Help:Au}=hn(),{Option:Pi}=vn();Re.program=new An;Re.createCommand=t=>new An(t);Re.createOption=(t,e)=>new Pi(t,e);Re.createArgument=(t,e)=>new Ii(t,e);Re.Command=An;Re.Option=Pi;Re.Argument=Ii;Re.Help=Au;Re.CommanderError=ku;Re.InvalidArgumentError=ji;Re.InvalidOptionArgumentError=ji});var Bi=ke((Te,Fi)=>{var Ge=Ri();Te=Fi.exports={};Te.program=new Ge.Command;Te.Argument=Ge.Argument;Te.Command=Ge.Command;Te.CommanderError=Ge.CommanderError;Te.Help=Ge.Help;Te.InvalidArgumentError=Ge.InvalidArgumentError;Te.InvalidOptionArgumentError=Ge.InvalidArgumentError;Te.Option=Ge.Option;Te.createCommand=t=>new Ge.Command(t);Te.createOption=(t,e)=>new Ge.Option(t,e);Te.createArgument=(t,e)=>new Ge.Argument(t,e)});var et=ke((Up,$n)=>{var gr=process||{},Gi=gr.argv||[],hr=gr.env||{},$u=!(hr.NO_COLOR||Gi.includes("--no-color"))&&(!!hr.FORCE_COLOR||Gi.includes("--color")||gr.platform==="win32"||(gr.stdout||{}).isTTY&&hr.TERM!=="dumb"||!!hr.CI),Eu=(t,e,r=t)=>n=>{let i=""+n,o=i.indexOf(e,t.length);return~o?t+Du(i,e,r,o)+e:t+i+e},Du=(t,e,r,n)=>{let i="",o=0;do i+=t.substring(o,n)+r,o=n+e.length,n=t.indexOf(e,o);while(~n);return i+t.substring(o)},Li=(t=$u)=>{let e=t?Eu:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};$n.exports=Li();$n.exports.createColors=Li});var On=ke((Zp,ro)=>{"use strict";var Tn={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Wu={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},Vu={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?Tn.up():"");return t&&(e+=Tn.left),e}};ro.exports={cursor:Tn,scroll:Wu,erase:Vu,beep:"\x07"}});var Bn,yo=xe(()=>{Bn={name:"resend-cli",version:"2.6.0",description:"The official CLI for Resend",license:"MIT",repository:{type:"git",url:"https://github.com/resend/resend-cli"},homepage:"https://github.com/resend/resend-cli#readme",keywords:["cli","resend","email","api","tanstack-intent"],engines:{node:">=22"},packageManager:"pnpm@11.8.0",files:["dist/cli.cjs","skills/"],type:"module",bin:{resend:"./dist/cli.cjs"},scripts:{dev:"tsx src/cli.ts","dev:watch":"tsx --watch src/cli.ts",build:"node scripts/build.mjs","build:bin":"pnpm build && pkg dist/cli.cjs --config package.json --compress Brotli --target node24 --output dist/resend",lint:"biome check .","lint:fix":"biome check --write .",typecheck:"tsc --noEmit",test:"vitest run","test:e2e":"vitest run --config vitest.config.e2e.ts",prepack:"pnpm install && pnpm build && node scripts/verify-bundle.mjs"},dependencies:{"@clack/prompts":"1.4.0","@commander-js/extra-typings":"14.0.0",commander:"14.0.3",esbuild:"0.28.1","esbuild-wasm":"0.28.0",picocolors:"1.1.1",resend:"6.14.0"},pkg:{scripts:["node_modules/esbuild-wasm/bin/esbuild","node_modules/esbuild-wasm/wasm_exec.js","node_modules/esbuild-wasm/wasm_exec_node.js"],assets:["node_modules/esbuild-wasm/esbuild.wasm"]},devDependencies:{"@biomejs/biome":"2.4.11","@types/node":"24.12.4","@yao-pkg/pkg":"6.20.0",tsx:"4.22.4",typescript:"5.9.3",vitest:"4.1.9"}}});var te,vo,ht=xe(()=>{"use strict";yo();te=Bn.version,vo=Bn.name});var To=ke(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.timingSafeEqual=void 0;function So(t,e=""){if(!t)throw new Error(e)}function _d(t,e){if(t.byteLength!==e.byteLength)return!1;t instanceof DataView||(t=new DataView(ArrayBuffer.isView(t)?t.buffer:t)),e instanceof DataView||(e=new DataView(ArrayBuffer.isView(e)?e.buffer:e)),So(t instanceof DataView),So(e instanceof DataView);let r=t.byteLength,n=0,i=-1;for(;++i<r;)n|=t.getUint8(i)^e.getUint8(i);return n===0}Sr.timingSafeEqual=_d});var jo=ke(Ie=>{"use strict";var xd=Ie&&Ie.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},t(e,r)};return function(e,r){t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(Ie,"__esModule",{value:!0});var ne=256,Vn=(function(){function t(e){e===void 0&&(e="="),this._paddingCharacter=e}return t.prototype.encodedLength=function(e){return this._paddingCharacter?(e+2)/3*4|0:(e*8+5)/6|0},t.prototype.encode=function(e){for(var r="",n=0;n<e.length-2;n+=3){var i=e[n]<<16|e[n+1]<<8|e[n+2];r+=this._encodeByte(i>>>18&63),r+=this._encodeByte(i>>>12&63),r+=this._encodeByte(i>>>6&63),r+=this._encodeByte(i>>>0&63)}var o=e.length-n;if(o>0){var i=e[n]<<16|(o===2?e[n+1]<<8:0);r+=this._encodeByte(i>>>18&63),r+=this._encodeByte(i>>>12&63),o===2?r+=this._encodeByte(i>>>6&63):r+=this._paddingCharacter||"",r+=this._paddingCharacter||""}return r},t.prototype.maxDecodedLength=function(e){return this._paddingCharacter?e/4*3|0:(e*6+7)/8|0},t.prototype.decodedLength=function(e){return this.maxDecodedLength(e.length-this._getPaddingLength(e))},t.prototype.decode=function(e){if(e.length===0)return new Uint8Array(0);for(var r=this._getPaddingLength(e),n=e.length-r,i=new Uint8Array(this.maxDecodedLength(n)),o=0,s=0,a=0,l=0,d=0,c=0,u=0;s<n-4;s+=4)l=this._decodeChar(e.charCodeAt(s+0)),d=this._decodeChar(e.charCodeAt(s+1)),c=this._decodeChar(e.charCodeAt(s+2)),u=this._decodeChar(e.charCodeAt(s+3)),i[o++]=l<<2|d>>>4,i[o++]=d<<4|c>>>2,i[o++]=c<<6|u,a|=l&ne,a|=d&ne,a|=c&ne,a|=u≠if(s<n-1&&(l=this._decodeChar(e.charCodeAt(s)),d=this._decodeChar(e.charCodeAt(s+1)),i[o++]=l<<2|d>>>4,a|=l&ne,a|=d&ne),s<n-2&&(c=this._decodeChar(e.charCodeAt(s+2)),i[o++]=d<<4|c>>>2,a|=c&ne),s<n-3&&(u=this._decodeChar(e.charCodeAt(s+3)),i[o++]=c<<6|u,a|=u&ne),a!==0)throw new Error("Base64Coder: incorrect characters for decoding");return i},t.prototype._encodeByte=function(e){var r=e;return r+=65,r+=25-e>>>8&6,r+=51-e>>>8&-75,r+=61-e>>>8&-15,r+=62-e>>>8&3,String.fromCharCode(r)},t.prototype._decodeChar=function(e){var r=ne;return r+=(42-e&e-44)>>>8&-ne+e-43+62,r+=(46-e&e-48)>>>8&-ne+e-47+63,r+=(47-e&e-58)>>>8&-ne+e-48+52,r+=(64-e&e-91)>>>8&-ne+e-65+0,r+=(96-e&e-123)>>>8&-ne+e-97+26,r},t.prototype._getPaddingLength=function(e){var r=0;if(this._paddingCharacter){for(var n=e.length-1;n>=0&&e[n]===this._paddingCharacter;n--)r++;if(e.length<4||r>2)throw new Error("Base64Coder: incorrect padding")}return r},t})();Ie.Coder=Vn;var nr=new Vn;function kd(t){return nr.encode(t)}Ie.encode=kd;function Ad(t){return nr.decode(t)}Ie.decode=Ad;var Oo=(function(t){xd(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype._encodeByte=function(r){var n=r;return n+=65,n+=25-r>>>8&6,n+=51-r>>>8&-75,n+=61-r>>>8&-13,n+=62-r>>>8&49,String.fromCharCode(n)},e.prototype._decodeChar=function(r){var n=ne;return n+=(44-r&r-46)>>>8&-ne+r-45+62,n+=(94-r&r-96)>>>8&-ne+r-95+63,n+=(47-r&r-58)>>>8&-ne+r-48+52,n+=(64-r&r-91)>>>8&-ne+r-65+0,n+=(96-r&r-123)>>>8&-ne+r-97+26,n},e})(Vn);Ie.URLSafeCoder=Oo;var Io=new Oo;function $d(t){return Io.encode(t)}Ie.encodeURLSafe=$d;function Ed(t){return Io.decode(t)}Ie.decodeURLSafe=Ed;Ie.encodedLength=function(t){return nr.encodedLength(t)};Ie.maxDecodedLength=function(t){return nr.maxDecodedLength(t)};Ie.decodedLength=function(t){return nr.decodedLength(t)}});var Ro=ke((Po,Tr)=>{(function(t,e){var r={};e(r);var n=r.default;for(var i in r)n[i]=r[i];typeof Tr=="object"&&typeof Tr.exports=="object"?Tr.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):t.sha256=n})(Po,function(t){"use strict";t.__esModule=!0,t.digestLength=32,t.blockSize=64;var e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function r(u,p,y,g,b){for(var _,k,x,$,B,D,I,T,E,j,ge,ee,pt;b>=64;){for(_=p[0],k=p[1],x=p[2],$=p[3],B=p[4],D=p[5],I=p[6],T=p[7],j=0;j<16;j++)ge=g+j*4,u[j]=(y[ge]&255)<<24|(y[ge+1]&255)<<16|(y[ge+2]&255)<<8|y[ge+3]&255;for(j=16;j<64;j++)E=u[j-2],ee=(E>>>17|E<<15)^(E>>>19|E<<13)^E>>>10,E=u[j-15],pt=(E>>>7|E<<25)^(E>>>18|E<<14)^E>>>3,u[j]=(ee+u[j-7]|0)+(pt+u[j-16]|0);for(j=0;j<64;j++)ee=(((B>>>6|B<<26)^(B>>>11|B<<21)^(B>>>25|B<<7))+(B&D^~B&I)|0)+(T+(e[j]+u[j]|0)|0)|0,pt=((_>>>2|_<<30)^(_>>>13|_<<19)^(_>>>22|_<<10))+(_&k^_&x^k&x)|0,T=I,I=D,D=B,B=$+ee|0,$=x,x=k,k=_,_=ee+pt|0;p[0]+=_,p[1]+=k,p[2]+=x,p[3]+=$,p[4]+=B,p[5]+=D,p[6]+=I,p[7]+=T,g+=64,b-=64}return g}var n=(function(){function u(){this.digestLength=t.digestLength,this.blockSize=t.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return u.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},u.prototype.clean=function(){for(var p=0;p<this.buffer.length;p++)this.buffer[p]=0;for(var p=0;p<this.temp.length;p++)this.temp[p]=0;this.reset()},u.prototype.update=function(p,y){if(y===void 0&&(y=p.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var g=0;if(this.bytesHashed+=y,this.bufferLength>0){for(;this.bufferLength<64&&y>0;)this.buffer[this.bufferLength++]=p[g++],y--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(y>=64&&(g=r(this.temp,this.state,p,g,y),y%=64);y>0;)this.buffer[this.bufferLength++]=p[g++],y--;return this},u.prototype.finish=function(p){if(!this.finished){var y=this.bytesHashed,g=this.bufferLength,b=y/536870912|0,_=y<<3,k=y%64<56?64:128;this.buffer[g]=128;for(var x=g+1;x<k-8;x++)this.buffer[x]=0;this.buffer[k-8]=b>>>24&255,this.buffer[k-7]=b>>>16&255,this.buffer[k-6]=b>>>8&255,this.buffer[k-5]=b>>>0&255,this.buffer[k-4]=_>>>24&255,this.buffer[k-3]=_>>>16&255,this.buffer[k-2]=_>>>8&255,this.buffer[k-1]=_>>>0&255,r(this.temp,this.state,this.buffer,0,k),this.finished=!0}for(var x=0;x<8;x++)p[x*4+0]=this.state[x]>>>24&255,p[x*4+1]=this.state[x]>>>16&255,p[x*4+2]=this.state[x]>>>8&255,p[x*4+3]=this.state[x]>>>0&255;return this},u.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},u.prototype._saveState=function(p){for(var y=0;y<this.state.length;y++)p[y]=this.state[y]},u.prototype._restoreState=function(p,y){for(var g=0;g<this.state.length;g++)this.state[g]=p[g];this.bytesHashed=y,this.finished=!1,this.bufferLength=0},u})();t.Hash=n;var i=(function(){function u(p){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var y=new Uint8Array(this.blockSize);if(p.length>this.blockSize)new n().update(p).finish(y).clean();else for(var g=0;g<p.length;g++)y[g]=p[g];for(var g=0;g<y.length;g++)y[g]^=54;this.inner.update(y);for(var g=0;g<y.length;g++)y[g]^=106;this.outer.update(y),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var g=0;g<y.length;g++)y[g]=0}return u.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},u.prototype.clean=function(){for(var p=0;p<this.istate.length;p++)this.ostate[p]=this.istate[p]=0;this.inner.clean(),this.outer.clean()},u.prototype.update=function(p){return this.inner.update(p),this},u.prototype.finish=function(p){return this.outer.finished?this.outer.finish(p):(this.inner.finish(p),this.outer.update(p,this.digestLength).finish(p)),this},u.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},u})();t.HMAC=i;function o(u){var p=new n().update(u),y=p.digest();return p.clean(),y}t.hash=o,t.default=o;function s(u,p){var y=new i(u).update(p),g=y.digest();return y.clean(),g}t.hmac=s;function a(u,p,y,g){var b=g[0];if(b===0)throw new Error("hkdf: cannot expand more");p.reset(),b>1&&p.update(u),y&&p.update(y),p.update(g),p.finish(u),g[0]++}var l=new Uint8Array(t.digestLength);function d(u,p,y,g){p===void 0&&(p=l),g===void 0&&(g=32);for(var b=new Uint8Array([1]),_=s(p,u),k=new i(_),x=new Uint8Array(k.digestLength),$=x.length,B=new Uint8Array(g),D=0;D<g;D++)$===x.length&&(a(x,k,y,b),$=0),B[D]=x[$++];return k.clean(),x.fill(0),b.fill(0),B}t.hkdf=d;function c(u,p,y,g){for(var b=new i(u),_=b.digestLength,k=new Uint8Array(4),x=new Uint8Array(_),$=new Uint8Array(_),B=new Uint8Array(g),D=0;D*_<g;D++){var I=D+1;k[0]=I>>>24&255,k[1]=I>>>16&255,k[2]=I>>>8&255,k[3]=I>>>0&255,b.reset(),b.update(p),b.update(k),b.finish($);for(var T=0;T<_;T++)x[T]=$[T];for(var T=2;T<=y;T++){b.reset(),b.update($).finish($);for(var E=0;E<_;E++)x[E]^=$[E]}for(var T=0;T<_&&D*_+T<g;T++)B[D*_+T]=x[T]}for(var D=0;D<_;D++)x[D]=$[D]=0;for(var D=0;D<4;D++)k[D]=0;return b.clean(),B}t.pbkdf2=c})});var No=ke(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.Webhook=Et.WebhookVerificationError=void 0;var Dd=To(),Fo=jo(),Sd=Ro(),Bo=300,Kn=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype),this.name="ExtendableError",this.stack=new Error(e).stack}},ot=class t extends Kn{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype),this.name="WebhookVerificationError"}};Et.WebhookVerificationError=ot;var Or=class t{constructor(e,r){if(!e)throw new Error("Secret can't be empty.");if(r?.format==="raw")e instanceof Uint8Array?this.key=e:this.key=Uint8Array.from(e,n=>n.charCodeAt(0));else{if(typeof e!="string")throw new Error("Expected secret to be of type string");e.startsWith(t.prefix)&&(e=e.substring(t.prefix.length)),this.key=Fo.decode(e)}}verify(e,r){let n={};for(let p of Object.keys(r))n[p.toLowerCase()]=r[p];let i=n["webhook-id"],o=n["webhook-signature"],s=n["webhook-timestamp"];if(!o||!i||!s)throw new ot("Missing required headers");let a=this.verifyTimestamp(s),d=this.sign(i,a,e).split(",")[1],c=o.split(" "),u=new globalThis.TextEncoder;for(let p of c){let[y,g]=p.split(",");if(y==="v1"&&(0,Dd.timingSafeEqual)(u.encode(g),u.encode(d)))return JSON.parse(e.toString())}throw new ot("No matching signature found")}sign(e,r,n){if(typeof n!="string")if(n.constructor.name==="Buffer")n=n.toString();else throw new Error("Expected payload to be of type string or Buffer.");let i=new TextEncoder,o=Math.floor(r.getTime()/1e3),s=i.encode(`${e}.${o}.${n}`);return`v1,${Fo.encode(Sd.hmac(this.key,s))}`}verifyTimestamp(e){let r=Math.floor(Date.now()/1e3),n=parseInt(e,10);if(isNaN(n))throw new ot("Invalid Signature Headers");if(r-n>Bo)throw new ot("Message timestamp too old");if(n>r+Bo)throw new ot("Message timestamp too new");return new Date(n*1e3)}};Et.Webhook=Or;Or.prefix="whsec_"});var Ir,Jo=xe(()=>{"use strict";Ir=class extends Error{constructor(e){super(`Credentials file is corrupted or contains invalid JSON: ${e}
|
|
24
|
+
`),this.outputHelp({error:!0}));let n=r||{},o=n.exitCode||1,i=n.code||"commander.error";this._exit(o,i,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in V.env){let r=t.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,V.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Wu(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&t.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!r(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(t){let r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){let r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){let n=s=>{let a=s.attributeName(),l=this.getOptionValue(a),d=this.options.find(u=>u.negate&&a===u.attributeName()),c=this.options.find(u=>!u.negate&&a===u.attributeName());return d&&(d.presetArg===void 0&&l===!1||d.presetArg!==void 0&&l===d.presetArg)?d:c||s},o=s=>{let a=n(s),l=a.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},i=`error: ${o(t)} cannot be used with ${o(r)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let o=[],i=this;do{let s=i.createHelp().visibleOptions(i).filter(a=>a.long).map(a=>a.long);o=o.concat(s),i=i.parent}while(i&&!i._enablePositionalOptions);r=Go(t,o)}let n=`error: unknown option '${t}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",i=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${t.length}.`;this.error(i,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],r="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(i=>{o.push(i.name()),i.alias()&&o.push(i.alias())}),r=Go(t,o)}let n=`error: unknown command '${t}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(t,r,n){if(t===void 0)return this._version;this._version=t,r=r||"-V, --version",n=n||"output the version number";let o=this.createOption(r,n);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${t}
|
|
25
|
+
`),this._exit(0,"commander.version",t)}),this}description(t,r){return t===void 0&&r===void 0?this._description:(this._description=t,r&&(this._argsDescription=r),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),t===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(t);if(n){let o=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${o}'`)}return r._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(r=>this.alias(r)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>Mu(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=Ye.basename(t,Ye.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let r=this.createHelp(),n=this._getOutputContext(t);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let o=r.formatHelp(this,r);return n.hasColors?o:this._outputConfiguration.stripColor(o)}_getOutputContext(t){t=t||{};let r=!!t.error,n,o,i;return r?(n=a=>this._outputConfiguration.writeErr(a),o=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),o=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(o||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:o,helpWidth:i}}outputHelp(t){let r;typeof t=="function"&&(r=t,t=void 0);let n=this._getOutputContext(t),o={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",o)),this.emit("beforeHelp",o);let i=this.helpInformation({error:n.error});if(r&&(i=r(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",o),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",o))}helpOption(t,r){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",r??"display help for command"),(t||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let r=Number(V.exitCode??0);r===0&&t&&typeof t!="function"&&t.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(t))throw new Error(`Unexpected value for position to addHelpText.
|
|
26
|
+
Expecting one of '${n.join("', '")}'`);let o=`${t}Help`;return this.on(o,i=>{let s;typeof r=="function"?s=r({error:i.error,command:i.command}):s=r,s&&i.write(`${s}
|
|
27
|
+
`)}),this}_outputHelpIfRequested(t){let r=this._getHelpOption();r&&t.find(o=>r.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Lo(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let r,n="127.0.0.1",o="9229",i;return(i=t.match(/^(--inspect(-brk)?)$/))!==null?r=i[1]:(i=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=i[1],/^\d+$/.test(i[3])?o=i[3]:n=i[3]):(i=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=i[1],n=i[3],o=i[4]),r&&o!=="0"?`${r}=${n}:${parseInt(o)+1}`:t})}function Dn(){if(V.env.NO_COLOR||V.env.FORCE_COLOR==="0"||V.env.FORCE_COLOR==="false")return!1;if(V.env.FORCE_COLOR||V.env.CLICOLOR_FORCE!==void 0)return!0}Sn.Command=En;Sn.useColor=Dn});var Wo=Ae(Re=>{var{Argument:Mo}=hr(),{Command:Tn}=Ho(),{CommanderError:Vu,InvalidArgumentError:qo}=Kt(),{Help:Ku}=Cn(),{Option:Uo}=kn();Re.program=new Tn;Re.createCommand=e=>new Tn(e);Re.createOption=(e,t)=>new Uo(e,t);Re.createArgument=(e,t)=>new Mo(e,t);Re.Command=Tn;Re.Option=Uo;Re.Argument=Mo;Re.Help=Ku;Re.CommanderError=Vu;Re.InvalidArgumentError=qo;Re.InvalidOptionArgumentError=qo});var Ko=Ae((Te,Vo)=>{var Le=Wo();Te=Vo.exports={};Te.program=new Le.Command;Te.Argument=Le.Argument;Te.Command=Le.Command;Te.CommanderError=Le.CommanderError;Te.Help=Le.Help;Te.InvalidArgumentError=Le.InvalidArgumentError;Te.InvalidOptionArgumentError=Le.InvalidArgumentError;Te.Option=Le.Option;Te.createCommand=e=>new Le.Command(e);Te.createOption=(e,t)=>new Le.Option(e,t);Te.createArgument=(e,t)=>new Le.Argument(e,t)});var rt=Ae((Cf,On)=>{var yr=process||{},Yo=yr.argv||[],br=yr.env||{},zu=!(br.NO_COLOR||Yo.includes("--no-color"))&&(!!br.FORCE_COLOR||Yo.includes("--color")||yr.platform==="win32"||(yr.stdout||{}).isTTY&&br.TERM!=="dumb"||!!br.CI),Ju=(e,t,r=e)=>n=>{let o=""+n,i=o.indexOf(t,e.length);return~i?e+Yu(o,t,r,i)+t:e+o+t},Yu=(e,t,r,n)=>{let o="",i=0;do o+=e.substring(i,n)+r,i=n+t.length,n=e.indexOf(t,i);while(~n);return o+e.substring(i)},Qo=(e=zu)=>{let t=e?Ju:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};On.exports=Qo();On.exports.createColors=Qo});var Fn=Ae((Sf,mi)=>{"use strict";var Rn={to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e,t){let r="";return e<0?r+=`\x1B[${-e}D`:e>0&&(r+=`\x1B[${e}C`),t<0?r+=`\x1B[${-t}A`:t>0&&(r+=`\x1B[${t}B`),r},up:(e=1)=>`\x1B[${e}A`,down:(e=1)=>`\x1B[${e}B`,forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},pd={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},fd={screen:"\x1B[2J",up:(e=1)=>"\x1B[1J".repeat(e),down:(e=1)=>"\x1B[J".repeat(e),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?Rn.up():"");return e&&(t+=Rn.left),t}};mi.exports={cursor:Rn,scroll:pd,erase:fd,beep:"\x07"}});var Mn,Ei=ye(()=>{Mn={name:"resend-cli",version:"2.7.0-preview.0",description:"The official CLI for Resend",license:"MIT",repository:{type:"git",url:"https://github.com/resend/resend-cli"},homepage:"https://github.com/resend/resend-cli#readme",keywords:["cli","resend","email","api","tanstack-intent"],engines:{node:">=22"},packageManager:"pnpm@11.8.0",files:["dist/cli.cjs","skills/"],type:"module",bin:{resend:"./dist/cli.cjs"},scripts:{dev:"tsx src/cli.ts","dev:watch":"tsx --watch src/cli.ts",build:"node scripts/build.mjs","build:bin":"pnpm build && pkg dist/cli.cjs --config package.json --compress Brotli --target node24 --output dist/resend",lint:"biome check .","lint:fix":"biome check --write .",typecheck:"tsc --noEmit",test:"vitest run","test:e2e":"vitest run --config vitest.config.e2e.ts",prepack:"pnpm install && pnpm build && node scripts/verify-bundle.mjs"},dependencies:{"@clack/prompts":"1.4.0","@commander-js/extra-typings":"14.0.0",commander:"14.0.3",esbuild:"0.28.1","esbuild-wasm":"0.28.0",picocolors:"1.1.1",resend:"6.14.0"},pkg:{scripts:["node_modules/esbuild-wasm/bin/esbuild","node_modules/esbuild-wasm/wasm_exec.js","node_modules/esbuild-wasm/wasm_exec_node.js"],assets:["node_modules/esbuild-wasm/esbuild.wasm"]},devDependencies:{"@biomejs/biome":"2.4.11","@types/node":"24.12.4","@yao-pkg/pkg":"6.20.0",tsx:"4.22.4",typescript:"5.9.3",vitest:"4.1.9"}}});var te,Di,yt=ye(()=>{"use strict";Ei();te=Mn.version,Di=Mn.name});var Gi=Ae(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.timingSafeEqual=void 0;function Bi(e,t=""){if(!e)throw new Error(t)}function Ud(e,t){if(e.byteLength!==t.byteLength)return!1;e instanceof DataView||(e=new DataView(ArrayBuffer.isView(e)?e.buffer:e)),t instanceof DataView||(t=new DataView(ArrayBuffer.isView(t)?t.buffer:t)),Bi(e instanceof DataView),Bi(t instanceof DataView);let r=e.byteLength,n=0,o=-1;for(;++o<r;)n|=e.getUint8(o)^t.getUint8(o);return n===0}Or.timingSafeEqual=Ud});var Mi=Ae(Ie=>{"use strict";var Wd=Ie&&Ie.__extends||(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(Ie,"__esModule",{value:!0});var oe=256,Qn=(function(){function e(t){t===void 0&&(t="="),this._paddingCharacter=t}return e.prototype.encodedLength=function(t){return this._paddingCharacter?(t+2)/3*4|0:(t*8+5)/6|0},e.prototype.encode=function(t){for(var r="",n=0;n<t.length-2;n+=3){var o=t[n]<<16|t[n+1]<<8|t[n+2];r+=this._encodeByte(o>>>18&63),r+=this._encodeByte(o>>>12&63),r+=this._encodeByte(o>>>6&63),r+=this._encodeByte(o>>>0&63)}var i=t.length-n;if(i>0){var o=t[n]<<16|(i===2?t[n+1]<<8:0);r+=this._encodeByte(o>>>18&63),r+=this._encodeByte(o>>>12&63),i===2?r+=this._encodeByte(o>>>6&63):r+=this._paddingCharacter||"",r+=this._paddingCharacter||""}return r},e.prototype.maxDecodedLength=function(t){return this._paddingCharacter?t/4*3|0:(t*6+7)/8|0},e.prototype.decodedLength=function(t){return this.maxDecodedLength(t.length-this._getPaddingLength(t))},e.prototype.decode=function(t){if(t.length===0)return new Uint8Array(0);for(var r=this._getPaddingLength(t),n=t.length-r,o=new Uint8Array(this.maxDecodedLength(n)),i=0,s=0,a=0,l=0,d=0,c=0,u=0;s<n-4;s+=4)l=this._decodeChar(t.charCodeAt(s+0)),d=this._decodeChar(t.charCodeAt(s+1)),c=this._decodeChar(t.charCodeAt(s+2)),u=this._decodeChar(t.charCodeAt(s+3)),o[i++]=l<<2|d>>>4,o[i++]=d<<4|c>>>2,o[i++]=c<<6|u,a|=l&oe,a|=d&oe,a|=c&oe,a|=u&oe;if(s<n-1&&(l=this._decodeChar(t.charCodeAt(s)),d=this._decodeChar(t.charCodeAt(s+1)),o[i++]=l<<2|d>>>4,a|=l&oe,a|=d&oe),s<n-2&&(c=this._decodeChar(t.charCodeAt(s+2)),o[i++]=d<<4|c>>>2,a|=c&oe),s<n-3&&(u=this._decodeChar(t.charCodeAt(s+3)),o[i++]=c<<6|u,a|=u&oe),a!==0)throw new Error("Base64Coder: incorrect characters for decoding");return o},e.prototype._encodeByte=function(t){var r=t;return r+=65,r+=25-t>>>8&6,r+=51-t>>>8&-75,r+=61-t>>>8&-15,r+=62-t>>>8&3,String.fromCharCode(r)},e.prototype._decodeChar=function(t){var r=oe;return r+=(42-t&t-44)>>>8&-oe+t-43+62,r+=(46-t&t-48)>>>8&-oe+t-47+63,r+=(47-t&t-58)>>>8&-oe+t-48+52,r+=(64-t&t-91)>>>8&-oe+t-65+0,r+=(96-t&t-123)>>>8&-oe+t-97+26,r},e.prototype._getPaddingLength=function(t){var r=0;if(this._paddingCharacter){for(var n=t.length-1;n>=0&&t[n]===this._paddingCharacter;n--)r++;if(t.length<4||r>2)throw new Error("Base64Coder: incorrect padding")}return r},e})();Ie.Coder=Qn;var nr=new Qn;function Vd(e){return nr.encode(e)}Ie.encode=Vd;function Kd(e){return nr.decode(e)}Ie.decode=Kd;var Li=(function(e){Wd(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._encodeByte=function(r){var n=r;return n+=65,n+=25-r>>>8&6,n+=51-r>>>8&-75,n+=61-r>>>8&-13,n+=62-r>>>8&49,String.fromCharCode(n)},t.prototype._decodeChar=function(r){var n=oe;return n+=(44-r&r-46)>>>8&-oe+r-45+62,n+=(94-r&r-96)>>>8&-oe+r-95+63,n+=(47-r&r-58)>>>8&-oe+r-48+52,n+=(64-r&r-91)>>>8&-oe+r-65+0,n+=(96-r&r-123)>>>8&-oe+r-97+26,n},t})(Qn);Ie.URLSafeCoder=Li;var Hi=new Li;function zd(e){return Hi.encode(e)}Ie.encodeURLSafe=zd;function Jd(e){return Hi.decode(e)}Ie.decodeURLSafe=Jd;Ie.encodedLength=function(e){return nr.encodedLength(e)};Ie.maxDecodedLength=function(e){return nr.maxDecodedLength(e)};Ie.decodedLength=function(e){return nr.decodedLength(e)}});var Ui=Ae((qi,Ir)=>{(function(e,t){var r={};t(r);var n=r.default;for(var o in r)n[o]=r[o];typeof Ir=="object"&&typeof Ir.exports=="object"?Ir.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):e.sha256=n})(qi,function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function r(u,p,y,g,b){for(var _,k,x,A,B,D,I,T,E,P,be,ee,gt;b>=64;){for(_=p[0],k=p[1],x=p[2],A=p[3],B=p[4],D=p[5],I=p[6],T=p[7],P=0;P<16;P++)be=g+P*4,u[P]=(y[be]&255)<<24|(y[be+1]&255)<<16|(y[be+2]&255)<<8|y[be+3]&255;for(P=16;P<64;P++)E=u[P-2],ee=(E>>>17|E<<15)^(E>>>19|E<<13)^E>>>10,E=u[P-15],gt=(E>>>7|E<<25)^(E>>>18|E<<14)^E>>>3,u[P]=(ee+u[P-7]|0)+(gt+u[P-16]|0);for(P=0;P<64;P++)ee=(((B>>>6|B<<26)^(B>>>11|B<<21)^(B>>>25|B<<7))+(B&D^~B&I)|0)+(T+(t[P]+u[P]|0)|0)|0,gt=((_>>>2|_<<30)^(_>>>13|_<<19)^(_>>>22|_<<10))+(_&k^_&x^k&x)|0,T=I,I=D,D=B,B=A+ee|0,A=x,x=k,k=_,_=ee+gt|0;p[0]+=_,p[1]+=k,p[2]+=x,p[3]+=A,p[4]+=B,p[5]+=D,p[6]+=I,p[7]+=T,g+=64,b-=64}return g}var n=(function(){function u(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return u.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},u.prototype.clean=function(){for(var p=0;p<this.buffer.length;p++)this.buffer[p]=0;for(var p=0;p<this.temp.length;p++)this.temp[p]=0;this.reset()},u.prototype.update=function(p,y){if(y===void 0&&(y=p.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var g=0;if(this.bytesHashed+=y,this.bufferLength>0){for(;this.bufferLength<64&&y>0;)this.buffer[this.bufferLength++]=p[g++],y--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(y>=64&&(g=r(this.temp,this.state,p,g,y),y%=64);y>0;)this.buffer[this.bufferLength++]=p[g++],y--;return this},u.prototype.finish=function(p){if(!this.finished){var y=this.bytesHashed,g=this.bufferLength,b=y/536870912|0,_=y<<3,k=y%64<56?64:128;this.buffer[g]=128;for(var x=g+1;x<k-8;x++)this.buffer[x]=0;this.buffer[k-8]=b>>>24&255,this.buffer[k-7]=b>>>16&255,this.buffer[k-6]=b>>>8&255,this.buffer[k-5]=b>>>0&255,this.buffer[k-4]=_>>>24&255,this.buffer[k-3]=_>>>16&255,this.buffer[k-2]=_>>>8&255,this.buffer[k-1]=_>>>0&255,r(this.temp,this.state,this.buffer,0,k),this.finished=!0}for(var x=0;x<8;x++)p[x*4+0]=this.state[x]>>>24&255,p[x*4+1]=this.state[x]>>>16&255,p[x*4+2]=this.state[x]>>>8&255,p[x*4+3]=this.state[x]>>>0&255;return this},u.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},u.prototype._saveState=function(p){for(var y=0;y<this.state.length;y++)p[y]=this.state[y]},u.prototype._restoreState=function(p,y){for(var g=0;g<this.state.length;g++)this.state[g]=p[g];this.bytesHashed=y,this.finished=!1,this.bufferLength=0},u})();e.Hash=n;var o=(function(){function u(p){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var y=new Uint8Array(this.blockSize);if(p.length>this.blockSize)new n().update(p).finish(y).clean();else for(var g=0;g<p.length;g++)y[g]=p[g];for(var g=0;g<y.length;g++)y[g]^=54;this.inner.update(y);for(var g=0;g<y.length;g++)y[g]^=106;this.outer.update(y),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var g=0;g<y.length;g++)y[g]=0}return u.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},u.prototype.clean=function(){for(var p=0;p<this.istate.length;p++)this.ostate[p]=this.istate[p]=0;this.inner.clean(),this.outer.clean()},u.prototype.update=function(p){return this.inner.update(p),this},u.prototype.finish=function(p){return this.outer.finished?this.outer.finish(p):(this.inner.finish(p),this.outer.update(p,this.digestLength).finish(p)),this},u.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},u})();e.HMAC=o;function i(u){var p=new n().update(u),y=p.digest();return p.clean(),y}e.hash=i,e.default=i;function s(u,p){var y=new o(u).update(p),g=y.digest();return y.clean(),g}e.hmac=s;function a(u,p,y,g){var b=g[0];if(b===0)throw new Error("hkdf: cannot expand more");p.reset(),b>1&&p.update(u),y&&p.update(y),p.update(g),p.finish(u),g[0]++}var l=new Uint8Array(e.digestLength);function d(u,p,y,g){p===void 0&&(p=l),g===void 0&&(g=32);for(var b=new Uint8Array([1]),_=s(p,u),k=new o(_),x=new Uint8Array(k.digestLength),A=x.length,B=new Uint8Array(g),D=0;D<g;D++)A===x.length&&(a(x,k,y,b),A=0),B[D]=x[A++];return k.clean(),x.fill(0),b.fill(0),B}e.hkdf=d;function c(u,p,y,g){for(var b=new o(u),_=b.digestLength,k=new Uint8Array(4),x=new Uint8Array(_),A=new Uint8Array(_),B=new Uint8Array(g),D=0;D*_<g;D++){var I=D+1;k[0]=I>>>24&255,k[1]=I>>>16&255,k[2]=I>>>8&255,k[3]=I>>>0&255,b.reset(),b.update(p),b.update(k),b.finish(A);for(var T=0;T<_;T++)x[T]=A[T];for(var T=2;T<=y;T++){b.reset(),b.update(A).finish(A);for(var E=0;E<_;E++)x[E]^=A[E]}for(var T=0;T<_&&D*_+T<g;T++)B[D*_+T]=x[T]}for(var D=0;D<_;D++)x[D]=A[D]=0;for(var D=0;D<4;D++)k[D]=0;return b.clean(),B}e.pbkdf2=c})});var Ki=Ae(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.Webhook=Et.WebhookVerificationError=void 0;var Yd=Gi(),Wi=Mi(),Qd=Ui(),Vi=300,Xn=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},at=class e extends Xn{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};Et.WebhookVerificationError=at;var Pr=class e{constructor(t,r){if(!t)throw new Error("Secret can't be empty.");if(r?.format==="raw")t instanceof Uint8Array?this.key=t:this.key=Uint8Array.from(t,n=>n.charCodeAt(0));else{if(typeof t!="string")throw new Error("Expected secret to be of type string");t.startsWith(e.prefix)&&(t=t.substring(e.prefix.length)),this.key=Wi.decode(t)}}verify(t,r){let n={};for(let p of Object.keys(r))n[p.toLowerCase()]=r[p];let o=n["webhook-id"],i=n["webhook-signature"],s=n["webhook-timestamp"];if(!i||!o||!s)throw new at("Missing required headers");let a=this.verifyTimestamp(s),d=this.sign(o,a,t).split(",")[1],c=i.split(" "),u=new globalThis.TextEncoder;for(let p of c){let[y,g]=p.split(",");if(y==="v1"&&(0,Yd.timingSafeEqual)(u.encode(g),u.encode(d)))return JSON.parse(t.toString())}throw new at("No matching signature found")}sign(t,r,n){if(typeof n!="string")if(n.constructor.name==="Buffer")n=n.toString();else throw new Error("Expected payload to be of type string or Buffer.");let o=new TextEncoder,i=Math.floor(r.getTime()/1e3),s=o.encode(`${t}.${i}.${n}`);return`v1,${Wi.encode(Qd.hmac(this.key,s))}`}verifyTimestamp(t){let r=Math.floor(Date.now()/1e3),n=parseInt(t,10);if(isNaN(n))throw new at("Invalid Signature Headers");if(r-n>Vi)throw new at("Message timestamp too old");if(n>r+Vi)throw new at("Message timestamp too new");return new Date(n*1e3)}};Et.Webhook=Pr;Pr.prefix="whsec_"});var jr,os=ye(()=>{"use strict";jr=class extends Error{constructor(t){super(`Credentials file is corrupted or contains invalid JSON: ${t}
|
|
28
28
|
The file has been preserved for manual inspection.
|
|
29
|
-
To fix: either repair the JSON manually, or delete the file and run: resend login`),this.name="CorruptedCredentialsError"}}});var
|
|
29
|
+
To fix: either repair the JSON manually, or delete the file and run: resend login`),this.name="CorruptedCredentialsError"}}});var eo={};Vt(eo,{FileBackend:()=>Zn});var Zn,to=ye(()=>{"use strict";fe();Zn=class{name="plaintext file";isSecure=!1;async get(t,r){let n=Ce();if(!n)return null;let o=n.profiles[r];return(o?.type==="api_key"?o.api_key:null)??null}async set(t,r,n){ro(n,r)}async delete(t,r){try{return is(r),!0}catch{return!1}}async isAvailable(){return!0}}});var as={};Vt(as,{MacOSBackend:()=>oo});function no(e,t){return new Promise(r=>{(0,ss.execFile)(e,t,{timeout:5e3},(n,o,i)=>{let s=n&&"code"in n?n.code:0;r({stdout:o??"",stderr:i??"",code:s})})})}var ss,oo,ls=ye(()=>{"use strict";ss=require("node:child_process");oo=class{name="macOS Keychain";isSecure=!0;async get(t,r){let{stdout:n,stderr:o,code:i}=await no("/usr/bin/security",["find-generic-password","-s",t,"-a",r,"-w"]);if(i===44)return null;if(i!==0)throw new Error(`Failed to read from macOS Keychain (exit code ${i}): ${o.trim()}`);return n.trim()||null}async set(t,r,n){let{code:o,stderr:i}=await no("/usr/bin/security",["add-generic-password","-s",t,"-a",r,"-w",n,"-U"]);if(o!==0)throw new Error(`Failed to store credential in macOS Keychain: ${i.trim()}`)}async delete(t,r){let{code:n}=await no("/usr/bin/security",["delete-generic-password","-s",t,"-a",r]);return n===0}async isAvailable(){return process.platform==="darwin"}}});var cs={};Vt(cs,{LinuxBackend:()=>io});function Rr(e,t,r){return new Promise(n=>{(0,Fr.execFile)(e,t,{timeout:r?.timeout??5e3},(o,i,s)=>{let a=o&&"code"in o?o.code:0;n({stdout:i??"",stderr:s??"",code:a})})})}function Sm(e,t,r){return new Promise(n=>{let o=(0,Fr.spawn)(e,t,{stdio:["pipe","ignore","pipe"],timeout:5e3}),i="";o.stderr?.on("data",s=>{i+=s.toString()}),o.on("close",s=>{n({code:s,stderr:i})}),o.on("error",()=>{n({code:1,stderr:"Failed to spawn process"})}),o.stdin?.on("error",()=>{}),o.stdin?.write(r),o.stdin?.end()})}var Fr,io,us=ye(()=>{"use strict";Fr=require("node:child_process");io=class{name="Secret Service (libsecret)";isSecure=!0;async get(t,r){let{stdout:n,code:o}=await Rr("secret-tool",["lookup","service",t,"account",r]);return o!==0||!n.trim()?null:n.trim()}async set(t,r,n){let{code:o,stderr:i}=await Sm("secret-tool",["store",`--label=Resend CLI (${r})`,"service",t,"account",r],n);if(o!==0)throw new Error(`Failed to store credential in Secret Service: ${i.trim()}`)}async delete(t,r){let{code:n}=await Rr("secret-tool",["clear","service",t,"account",r]);return n===0}async isAvailable(){if(process.platform!=="linux"||(await Rr("which",["secret-tool"])).code!==0)return!1;let r=await Rr("secret-tool",["lookup","service","__resend_cli_probe__"],{timeout:3e3});return r.code===0||r.code===1}}});var ds={};Vt(ds,{WindowsBackend:()=>so});function Nr(e){return new Promise(t=>{(0,Br.execFile)("powershell.exe",["-NoProfile","-NonInteractive","-Command",e],{timeout:1e4},(r,n,o)=>{let i=r&&"code"in r?r.code:0;t({stdout:n??"",stderr:o??"",code:i})})})}function Tm(e,t){return new Promise(r=>{let n=(0,Br.spawn)("powershell.exe",["-NoProfile","-NonInteractive","-Command",e],{stdio:["pipe","pipe","pipe"],timeout:1e4}),o="",i="";n.stdout?.on("data",s=>{o+=s.toString()}),n.stderr?.on("data",s=>{i+=s.toString()}),n.on("close",s=>{r({stdout:o,stderr:i,code:s})}),n.on("error",()=>{r({stdout:"",stderr:"Failed to spawn process",code:1})}),n.stdin?.on("error",()=>{}),n.stdin?.write(t),n.stdin?.end()})}function lt(e){return e.replace(/'/g,"''")}var Br,ir,so,ms=ye(()=>{"use strict";Br=require("node:child_process");ir=`
|
|
30
30
|
try { $null = [Windows.Security.Credentials.PasswordVault] } catch {
|
|
31
31
|
[void][Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime]
|
|
32
32
|
}
|
|
33
|
-
`,
|
|
33
|
+
`,so=class{name="Windows Credential Manager";isSecure=!0;async get(t,r){let n=`${ir}
|
|
34
34
|
$v = New-Object Windows.Security.Credentials.PasswordVault
|
|
35
35
|
try {
|
|
36
|
-
$c = $v.Retrieve('${
|
|
36
|
+
$c = $v.Retrieve('${lt(t)}', '${lt(r)}')
|
|
37
37
|
$c.RetrievePassword()
|
|
38
38
|
Write-Output $c.Password
|
|
39
39
|
} catch {
|
|
40
40
|
exit 1
|
|
41
41
|
}
|
|
42
|
-
`,{stdout:
|
|
42
|
+
`,{stdout:o,code:i}=await Nr(n);return i!==0||!o.trim()?null:o.trim()}async set(t,r,n){let o=`${ir}
|
|
43
43
|
$v = New-Object Windows.Security.Credentials.PasswordVault
|
|
44
44
|
try {
|
|
45
|
-
$c = $v.Retrieve('${
|
|
45
|
+
$c = $v.Retrieve('${lt(t)}', '${lt(r)}')
|
|
46
46
|
$v.Remove($c)
|
|
47
47
|
} catch {}
|
|
48
|
-
`;await
|
|
48
|
+
`;await Nr(o);let i=`${ir}
|
|
49
49
|
$secret = [Console]::In.ReadLine()
|
|
50
50
|
$v = New-Object Windows.Security.Credentials.PasswordVault
|
|
51
|
-
$c = New-Object Windows.Security.Credentials.PasswordCredential('${
|
|
51
|
+
$c = New-Object Windows.Security.Credentials.PasswordCredential('${lt(t)}', '${lt(r)}', $secret)
|
|
52
52
|
$v.Add($c)
|
|
53
|
-
`,{code:s,stderr:a}=await
|
|
53
|
+
`,{code:s,stderr:a}=await Tm(i,n);if(s!==0)throw new Error(`Failed to store credential in Windows Credential Manager: ${a.trim()}`)}async delete(t,r){let n=`${ir}
|
|
54
54
|
$v = New-Object Windows.Security.Credentials.PasswordVault
|
|
55
55
|
try {
|
|
56
|
-
$c = $v.Retrieve('${
|
|
56
|
+
$c = $v.Retrieve('${lt(t)}', '${lt(r)}')
|
|
57
57
|
$v.Remove($c)
|
|
58
58
|
} catch {
|
|
59
59
|
exit 1
|
|
60
60
|
}
|
|
61
|
-
`,{code:
|
|
62
|
-
`,384),(0,
|
|
63
|
-
Create a full access key at https://resend.com/api-keys`;
|
|
64
|
-
`)}async function
|
|
61
|
+
`,{code:o}=await Nr(n);return o===0}async isAvailable(){if(process.platform!=="win32")return!1;let{code:t}=await Nr(`${ir} $null = New-Object Windows.Security.Credentials.PasswordVault`);return t===0}}});async function Qe(){if(Ve)return Ve;let e=process.env.RESEND_CREDENTIAL_STORE;if(e==="file"){let{FileBackend:r}=await Promise.resolve().then(()=>(to(),eo));return Ve=new r,Ve}if(e==="secure_storage"){let r=await ps();if(r)return Ve=r,Ve}if(!e){let r=await ps();if(r)return Ve=r,Ve}let{FileBackend:t}=await Promise.resolve().then(()=>(to(),eo));return Ve=new t,Ve}async function ps(){if(process.platform==="darwin"){let{MacOSBackend:e}=await Promise.resolve().then(()=>(ls(),as)),t=new e;if(await t.isAvailable())return t}else if(process.platform==="linux"){let{LinuxBackend:e}=await Promise.resolve().then(()=>(us(),cs)),t=new e;if(await t.isAvailable())return t}else if(process.platform==="win32"){let{WindowsBackend:e}=await Promise.resolve().then(()=>(ms(),ds)),t=new e;if(await t.isAvailable())return t}return null}var He,Ve,ao=ye(()=>{"use strict";He="resend-cli",Ve=null});function Xe(e,t){(0,we.mkdirSync)((0,gs.dirname)(e),{recursive:!0});let r=Pm(e);try{let n=t();return n instanceof Promise?n.finally(()=>lo(e,r)):(lo(e,r),n)}catch(n){throw lo(e,r),n}}var hs,we,gs,Om,Im,fs,Pm,lo,jm,Rm,bs=ye(()=>{"use strict";hs=require("node:crypto"),we=require("node:fs"),gs=require("node:path"),Om=1e4,Im=50,fs=200;Pm=e=>{let t=(0,hs.randomUUID)();for(let r=0;r<fs;r++)try{let n=(0,we.openSync)(e,"wx");try{(0,we.writeSync)(n,t)}finally{(0,we.closeSync)(n)}return t}catch(n){if(n.code!=="EEXIST")throw n;if(jm(e)){try{(0,we.unlinkSync)(e)}catch{}continue}Rm(Im)}throw new Error(`Could not acquire lock on ${e} after ${fs} retries. If no other resend process is running, delete the lock file manually.`)},lo=(e,t)=>{try{if((0,we.readFileSync)(e,"utf-8")!==t)return;(0,we.unlinkSync)(e)}catch{}},jm=e=>{try{let t=(0,we.statSync)(e);return Date.now()-t.mtimeMs>Om}catch{return!0}},Rm=e=>{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}});function mo(e){let t=e.split(".");if(t.length!==3)throw new Error(co);let r;try{r=JSON.parse(Buffer.from(t[1],"base64url").toString())}catch{throw new Error(co)}if(typeof r!="object"||r===null||typeof r.exp!="number")throw new Error(co);return r.exp}function Cs(e){let t=new Error("Received an unexpected response from Resend while authenticating. Please run `resend login` again.");if(typeof e!="object"||e===null)throw t;let r=e;if(typeof r.access_token!="string"||r.access_token.length===0||typeof r.refresh_token!="string"||r.refresh_token.length===0||typeof r.scope!="string")throw t;return r}async function ws(e,t,r){try{return await fetch(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:t,signal:AbortSignal.timeout(Fm)})}catch(n){let o=n instanceof Error&&n.name==="TimeoutError"?`${r} timed out after 30s. Check your connection and try again.`:"Could not reach the Resend API. Check your connection and try again.",i=new Error(o);throw i.name=po,i}}async function _s(e,t){let r=Math.floor(Date.now()/1e3);if(e.access_token_expires_at>r+Nm)return{access_token:e.access_token,scope:e.scope};let n=process.env.RESEND_BASE_URL??"https://api.resend.com",o=await ws(`${n}/oauth/token`,new URLSearchParams({grant_type:"refresh_token",client_id:Gr,refresh_token:e.refresh_token}),"Token refresh");if(!o.ok)throw new Error(`Token refresh failed (${o.status}). Please run \`resend login\` again.`);let i=Cs(await o.json());return await Hr({access_token:i.access_token,access_token_expires_at:mo(i.access_token),refresh_token:i.refresh_token,scope:i.scope},t),{access_token:i.access_token,scope:i.scope}}function uo(e){return e.toString("base64url")}function ys(e,t){return`<!doctype html><html><head><title>Resend CLI</title></head><body style="font-family:system-ui;text-align:center;padding:2rem"><h2>${e}</h2><p>${t}</p></body></html>`}function xs(){let e=uo((0,sr.randomBytes)(64)),t=uo((0,sr.createHash)("sha256").update(e).digest()),r=uo((0,sr.randomBytes)(24));return{codeVerifier:e,codeChallenge:t,state:r}}function ks(){return new Promise((e,t)=>{let r,n,o=new Promise((a,l)=>{r=a,n=l}),i=(0,vs.createServer)((a,l)=>{let d=new URL(a.url??"/","http://127.0.0.1");if(d.pathname!=="/oauth/callback"){l.writeHead(404,{Connection:"close"}),l.end();return}let c=d.searchParams.get("code"),u=d.searchParams.get("state"),p=d.searchParams.get("error"),y=p?`Authorization denied: ${p}`:!c||!u?"Missing code or state in OAuth callback":null,g=y?ys("Authentication failed",`${y}. Return to your terminal and try again.`):ys("Authentication complete","You can close this tab and return to your terminal.");l.writeHead(200,{"Content-Type":"text/html; charset=utf-8",Connection:"close"}),l.end(g,()=>{a.socket.destroy()}),i.close(),clearTimeout(s),y?n(new Error(y)):c&&u&&r({code:c,state:u})}),s=setTimeout(()=>{i.close(),n(new Error("OAuth login timed out after 5 minutes. Please try again."))},300*1e3);i.listen(0,"127.0.0.1",()=>{let{port:a}=i.address();e({port:a,waitForCallback:o})}),i.on("error",t)})}async function As(e){let t=await ws(`${e.baseUrl}/oauth/token`,new URLSearchParams({grant_type:"authorization_code",client_id:e.clientId,code:e.code,redirect_uri:e.redirectUri,code_verifier:e.codeVerifier}),"Token exchange");if(!t.ok){let r="";try{let n=await t.json();r=n.error_description??n.error??""}catch{}throw new Error(`Token exchange failed (${t.status})${r?`: ${r}`:""}`)}return Cs(await t.json())}var sr,vs,Gr,co,Fm,Nm,po,Lr=ye(()=>{"use strict";sr=require("node:crypto"),vs=require("node:http");fe();Gr="7136aa0b-625c-4c9c-8820-e9784c8eb141",co="Received an invalid access token from Resend. Please run `resend login` to authenticate again.";Fm=3e4,Nm=60,po="OAuthNetworkError"});var $s,_e,Es,Ds,Bm,Ss=ye(()=>{"use strict";$s=require("node:crypto"),_e=require("node:fs"),Es=require("node:path"),Ds=(e,t,r)=>{let n=`${e}.tmp.${process.pid}.${(0,$s.randomUUID)()}`;try{let o=(0,_e.openSync)(n,"w",r);try{(0,_e.writeSync)(o,t),(0,_e.fsyncSync)(o)}finally{(0,_e.closeSync)(o)}(0,_e.renameSync)(n,e),Bm((0,Es.dirname)(e))}catch(o){try{(0,_e.unlinkSync)(n)}catch{}throw o}},Bm=e=>{if(process.platform!=="win32")try{let t=(0,_e.openSync)(e,"r");try{(0,_e.fsyncSync)(t)}finally{(0,_e.closeSync)(t)}}catch{}}});function Ne(){return process.env.XDG_CONFIG_HOME?(0,St.join)(process.env.XDG_CONFIG_HOME,"resend"):process.platform==="win32"&&process.env.APPDATA?(0,St.join)(process.env.APPDATA,"resend"):(0,St.join)((0,Is.homedir)(),".config","resend")}function wt(){return(0,St.join)(Ne(),"credentials.json")}function Ts(e){return e.type==="oauth_grant"?ho(e)?{type:"oauth_grant",...e}:{type:"oauth_grant",scope:typeof e.scope=="string"?e.scope:""}:{type:"api_key",...e.api_key!==void 0?{api_key:e.api_key}:{},...e.permission?{permission:e.permission}:{}}}function fo(){try{return Ce()}catch{return null}}function Ce(){let e=wt();if(!(0,Pe.existsSync)(e))return null;let t=(0,Pe.readFileSync)(e,"utf-8");if(t.trim().length===0)return null;let r;try{r=JSON.parse(t)}catch{throw new jr(e)}if(typeof r=="object"&&r!==null&&"api_key"in r&&!("profiles"in r)&&!("teams"in r))return{active_profile:"default",profiles:{default:{type:"api_key",api_key:r.api_key}}};if("profiles"in r){let n=r.storage==="keychain"?"secure_storage":r.storage,o=r.profiles;return{active_profile:r.active_profile??"default",...n?{storage:n}:{},profiles:Object.fromEntries(Object.entries(o).map(([i,s])=>[i,Ts(s)]))}}if("teams"in r){let n=r.teams;return{active_profile:r.active_team??"default",profiles:Object.fromEntries(Object.entries(n).map(([o,i])=>[o,Ts(i)]))}}return null}function ut(e){let t=Ne();(0,Pe.mkdirSync)(t,{recursive:!0,mode:448});let r=wt();return Ds(r,`${JSON.stringify(e,null,2)}
|
|
62
|
+
`,384),(0,Pe.chmodSync)(r,384),r}function Mr(e){if(e)return e;let t=process.env.RESEND_PROFILE;if(t)return t;let r=Ce();return r?.active_profile?r.active_profile:"default"}function ro(e,t,r){let n=t||"default",o=ie(n);if(o)throw new Error(o);return Xe(ct(),()=>{let i=Ce()||{active_profile:"default",profiles:{}},s={...i.profiles,[n]:{type:"api_key",api_key:e,...r&&{permission:r}}},a={...i,profiles:s,...Object.keys(s).length===1?{active_profile:n}:{}};return ut(a)})}function is(e){return Xe(ct(),()=>{let t=Ce();if(!t)throw new Error("No credentials file found.");let r=e||Mr();if(!t.profiles[r])throw new Error(`Profile "${r}" not found. Available profiles: ${Object.keys(t.profiles).join(", ")}`);let{[r]:n,...o}=t.profiles;if(Object.keys(o).length===0){let s=wt();return(0,Pe.unlinkSync)(s),s}let i=t.active_profile===r?Object.keys(o)[0]||"default":t.active_profile;return ut({...t,active_profile:i,profiles:o})})}function ar(e){let t=ie(e);if(t)throw new Error(t);Xe(ct(),()=>{let r=Ce();if(!r)throw new Error("No credentials file found. Run: resend login");if(!r.profiles[e])throw new Error(`Profile "${e}" not found. Available profiles: ${Object.keys(r.profiles).join(", ")}`);ut({...r,active_profile:e})})}function xe(){let e=Ce();return e?Object.keys(e.profiles).map(t=>({name:t,active:t===e.active_profile})):[]}function ie(e){if(!e||e.length===0)return"Profile name must not be empty";if(e.length>64)return"Profile name must be 64 characters or fewer";if(!/^[a-zA-Z0-9._-]+$/.test(e))return"Profile name must contain only letters, numbers, dots, dashes, and underscores"}function dt(e){return e.length<=7?`${e.slice(0,3)}...`:`${e.slice(0,3)}...${e.slice(-4)}`}function ho(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.access_token=="string"&&typeof t.access_token_expires_at=="number"&&typeof t.refresh_token=="string"&&typeof t.scope=="string"}function Gm(e){return ho(e)?e:null}function Lm(e){let t;try{t=JSON.parse(e)}catch{t=null}if(!ho(t))throw new Error("Stored OAuth credentials are invalid. Please run `resend login` to authenticate again.");return t}async function _t(e,t,r){if(e)return{type:"api_key",key:e,source:"flag"};let n=process.env.RESEND_API_KEY;if(n)return{type:"api_key",key:n,source:"env"};let o=Ce(),i=t||process.env.RESEND_PROFILE||o?.active_profile||"default";if(o?.storage==="secure_storage"&&o.profiles[i]){let s=o.profiles[i],l=await(await Qe()).get(He,i);if(l){if(s.type==="oauth_grant"){let d=Lm(l);return Os(d,i,"secure_storage",r)}return{type:"api_key",key:l,source:"secure_storage",profile:i,permission:s.permission}}}if(o){let s=o.profiles[i];if(s?.type==="api_key"&&s.api_key)return{type:"api_key",key:s.api_key,source:"config",profile:i,permission:s.permission};if(s?.type==="oauth_grant"){let a=Gm(s);if(a)return Os(a,i,"config",r)}}return null}async function Os(e,t,r,n){if(n?.refresh===!1)return{type:"oauth_grant",access_token:e.access_token,profile:t,scope:e.scope,source:r};let{access_token:o,scope:i}=await _s(e,t);return{type:"oauth_grant",access_token:o,profile:t,scope:i,source:r}}async function Ps(e,t,r){let n=t||"default",o=ie(n);if(o)throw new Error(o);let i=await Qe();return i.isSecure?{configPath:await Xe(ct(),async()=>{await i.set(He,n,e);let a=Ce()||{active_profile:"default",profiles:{}},l={...a.profiles,[n]:{type:"api_key",...r&&{permission:r}}};return ut({...a,storage:"secure_storage",profiles:l,...Object.keys(l).length===1?{active_profile:n}:{}})}),backend:i}:{configPath:ro(e,n,r),backend:i}}async function Hr(e,t){let r=t||"default",n=ie(r);if(n)throw new Error(n);let o=await Qe();return{configPath:await Xe(ct(),async()=>{let s=Ce()||{active_profile:"default",profiles:{}},a=o.isSecure?{type:"oauth_grant",scope:e.scope}:{type:"oauth_grant",...e};o.isSecure&&await o.set(He,r,JSON.stringify(e));let l={...s.profiles,[r]:a};try{return ut({...s,storage:o.isSecure?"secure_storage":"file",profiles:l,...Object.keys(l).length===1?{active_profile:r}:{}})}catch(d){throw o.isSecure&&await o.delete(He,r).catch(()=>{}),d}}),backend:o}}async function qr(e){return Xe(ct(),async()=>{let t=Ce(),r=e||process.env.RESEND_PROFILE||t?.active_profile||"default";if(!t?.profiles[r])throw new Error(t?`Profile "${r}" not found. Available profiles: ${Object.keys(t.profiles).join(", ")}`:"No credentials file found.");if(t.storage==="secure_storage"){let s=await Qe();if(s.isSecure&&!await s.delete(He,r))throw new Error(`Failed to remove API key for profile "${r}" from ${s.name}. Credential may still exist in secure storage.`)}let{[r]:n,...o}=t.profiles;if(Object.keys(o).length===0){let s=wt();return(0,Pe.unlinkSync)(s),s}let i=t.active_profile===r?Object.keys(o)[0]||"default":t.active_profile;return ut({...t,active_profile:i,profiles:o})})}async function js(){return Xe(ct(),async()=>{let e=fo(),t=wt();if(e?.storage==="secure_storage"){let r=await Qe();if(r.isSecure){let n=Object.keys(e.profiles),o=await Promise.all(n.map(s=>r.delete(He,s))),i=n.filter((s,a)=>!o[a]);if(i.length>0){let s=Object.fromEntries(Object.entries(e.profiles).filter(([l])=>!o[n.indexOf(l)])),a=Object.keys(s);throw ut({...e,active_profile:e.active_profile&&s[e.active_profile]?e.active_profile:a[0]??"default",profiles:s}),new Error(`Failed to remove API keys from ${r.name} for profiles: ${i.join(", ")}. Credentials may still exist in secure storage.`)}}}return(0,Pe.existsSync)(t)&&(0,Pe.unlinkSync)(t),t})}async function Ur(e,t){if(e===t)return;let r=ie(t);if(r)throw new Error(r);await Xe(ct(),async()=>{let n=Ce();if(!n)throw new Error("No credentials file found. Run: resend login");if(!n.profiles[e])throw new Error(`Profile "${e}" not found. Available profiles: ${Object.keys(n.profiles).join(", ")}`);if(n.profiles[t])throw new Error(`Profile "${t}" already exists.`);if(n.storage==="secure_storage"){let s=await Qe();if(s.isSecure){let a=await s.get(He,e);if(a&&(await s.set(He,t,a),!await s.delete(He,e))){let d=await s.delete(He,t);throw new Error(d?`Failed to remove old credential "${e}" from ${s.name} during rename. The rename has been rolled back.`:`Failed to remove old credential "${e}" from ${s.name} during rename. Rollback also failed \u2014 credential "${t}" may still exist in secure storage.`)}}}let{[e]:o,...i}=n.profiles;ut({...n,active_profile:n.active_profile===e?t:n.active_profile,profiles:{...i,[t]:o}})})}var Pe,Is,St,Tt,ct,fe=ye(()=>{"use strict";Pe=require("node:fs"),Is=require("node:os"),St=require("node:path");os();ao();bs();Lr();Ss();Tt=`Sending-only keys work with: emails send, emails batch, broadcasts send.
|
|
63
|
+
Create a full access key at https://resend.com/api-keys`;ct=()=>(0,St.join)(Ne(),"credentials.json.lock")});function w(){return!(!process.stdin.isTTY||!process.stdout.isTTY||process.env.CI==="true"||process.env.CI==="1"||process.env.GITHUB_ACTIONS||process.env.TERM==="dumb")}var Ze,J=ye(()=>{"use strict";Ze=process.platform!=="win32"||!!process.env.WT_SESSION||process.env.TERM_PROGRAM==="vscode"});function Sl(){return(0,Dl.join)(Ne(),"update-state.json")}function bp(){try{return JSON.parse((0,Ht.readFileSync)(Sl(),"utf-8"))}catch{return null}}function yp(e){(0,Ht.mkdirSync)(Ne(),{recursive:!0,mode:448}),(0,Ht.writeFileSync)(Sl(),JSON.stringify(e),{mode:384})}function ln(e,t){let r=d=>d.replace(/^v/,"").split(".").map(Number),[n,o,i]=r(e),[s,a,l]=r(t);return s!==n?s>n:a!==o?a>o:l>i}async function Ao(){try{let e=await fetch(ko,{headers:{Accept:"application/vnd.github.v3+json"},signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json();if(t.prerelease||t.draft)return null;let r=t.tag_name?.replace(/^v/,"");return!r||!/^\d+\.\d+\.\d+$/.test(r)?null:r}catch{return null}}function vp(e){return!!(e?.json||process.env.RESEND_NO_UPDATE_NOTIFIER==="1"||process.env.CI==="true"||process.env.CI==="1"||process.env.GITHUB_ACTIONS||!process.stdout.isTTY)}function Tl(){let e=cn();return e.startsWith("npm")?"npm":e.startsWith("brew")?"homebrew":e.startsWith("curl")||e.startsWith("irm")?"install-script":"manual"}function cn(){let e=process.execPath||process.argv[0]||"",t=process.argv[1]||"";return process.env.npm_execpath||/node_modules/.test(t)||/node_modules/.test(e)?"npm install -g resend-cli":/\/(Cellar|homebrew)\//i.test(e)?"brew update && brew upgrade resend":/[/\\]\.resend[/\\]bin[/\\]/.test(e)?process.platform==="win32"?"irm https://resend.com/install.ps1 | iex":"curl -fsSL https://resend.com/install.sh | bash":"https://github.com/resend/resend-cli/releases/latest"}function El(e){let t=cn(),r=t.startsWith("http"),n="\x1B[2m",o="\x1B[33m",i="\x1B[36m",s="\x1B[0m",a=["",`${n}Update available: ${o}v${te}${s}${n} \u2192 ${i}v${e}${s}`,`${n}${r?"Visit":"Run"}: ${i}${t}${s}`];return process.platform==="win32"&&a.push(`${n}Or download from: ${i}https://github.com/resend/resend-cli/releases/latest${s}`),a.push(""),a.join(`
|
|
64
|
+
`)}async function Ol(e){if(vp(e))return;let t=bp(),r=Date.now();if(t&&r-t.lastChecked<gp){ln(te,t.latestVersion)&&process.stderr.write(El(t.latestVersion));return}let n=await Ao();n&&(yp({lastChecked:r,latestVersion:n}),ln(te,n)&&process.stderr.write(El(n)))}var Ht,Dl,gp,ko,pr=ye(()=>{"use strict";Ht=require("node:fs"),Dl=require("node:path");fe();yt();gp=3600*1e3,ko="https://api.github.com/repos/resend/resend-cli/releases/latest"});var xu={};Vt(xu,{flushFromFile:()=>tf,flushPayload:()=>_u,getOrCreateAnonymousId:()=>wu,getSpoolDir:()=>To,isDisabled:()=>Cu,trackCommand:()=>Oo});function Yp(){return Jp[process.platform]??process.platform}function To(){let e=(0,qe.join)(Ne(),"telemetry-spool");return(0,W.mkdirSync)(e,{recursive:!0,mode:448}),e}function Cu(){return!vu||process.env.DO_NOT_TRACK==="1"||process.env.RESEND_TELEMETRY_DISABLED==="1"}function wu(){let e=Ne(),t=(0,qe.join)(e,"telemetry-id");try{let n=(0,W.readFileSync)(t,"utf-8").trim();if(n)return n}catch{}let r=crypto.randomUUID();return(0,W.mkdirSync)(e,{recursive:!0,mode:448}),(0,W.writeFileSync)(t,r,{mode:384}),r}function Qp(e){if(!e)return;let t=Ne(),r=(0,qe.join)(t,"telemetry-notice-shown");(0,W.existsSync)(r)||((0,W.mkdirSync)(t,{recursive:!0,mode:448}),(0,W.writeFileSync)(r,"",{mode:384}),process.stderr.write(`
|
|
65
65
|
Resend collects anonymous CLI usage data to improve the tool.
|
|
66
66
|
To opt out: export RESEND_TELEMETRY_DISABLED=1
|
|
67
67
|
|
|
68
|
-
`))}function
|
|
68
|
+
`))}function Oo(e,t){if(!Cu())try{let r=w()&&!t.json;Qp(r);let n=wu(),o={command:e,cli_version:te,os:Yp(),node_version:process.version,interactive:r,install_method:Tl()};t.flags?.length&&(o.flags=t.flags),t.globalFlags?.length&&(o.global_flags=t.globalFlags);let i=crypto.randomUUID(),s=JSON.stringify({api_key:vu,distinct_id:n,event:"cli.used",properties:o,_nonce:i}),a=To(),l=(0,qe.join)(a,`resend-telemetry-${crypto.randomUUID()}.json`),d=(0,W.openSync)(l,W.constants.O_CREAT|W.constants.O_EXCL|W.constants.O_WRONLY|(W.constants.O_NOFOLLOW??0),384);try{(0,W.writeFileSync)(d,s)}finally{(0,W.closeSync)(d)}let c="pkg"in process,u=c?["telemetry","flush",l]:process.execArgv.concat([process.argv[1],"telemetry","flush",l]);(0,yu.spawn)(process.execPath,u,{detached:!0,stdio:"ignore",env:{...process.env,RESEND_TELEMETRY_DISABLED:"1",...c?{PKG_EXECPATH:""}:{}}}).unref()}catch{}}async function _u(e){let t=JSON.parse(e);if(!Xp(t))throw new Error("invalid telemetry payload schema");let{_nonce:r,...n}=t,o=JSON.stringify(n),i=await fetch(zp,{method:"POST",headers:{"Content-Type":"application/json"},body:o,signal:AbortSignal.timeout(3e3)});if(!i.ok)throw new Error(`telemetry flush failed: ${i.status}`)}async function tf(e){let t=(0,qe.join)(e),r=To(),n=(0,qe.basename)(t);if((0,qe.dirname)(t)!==r||!ef.test(n)||(0,W.realpathSync)((0,qe.dirname)(t))!==(0,W.realpathSync)(r))throw new Error("invalid telemetry flush path");let o=(0,W.openSync)(t,W.constants.O_RDONLY|W.constants.O_NOFOLLOW),i;try{let s=(0,W.fstatSync)(o);if(!s.isFile()||s.nlink!==1)throw new Error("invalid telemetry flush path");i=(0,W.readFileSync)(o,"utf-8")}finally{(0,W.closeSync)(o)}try{await _u(i)}finally{(0,W.unlinkSync)(t)}}var yu,W,qe,vu,zp,Jp,bu,Xp,Zp,ef,Io=ye(()=>{"use strict";yu=require("node:child_process"),W=require("node:fs"),qe=require("node:path");fe();J();pr();yt();vu="phc_AgEBpcQTRsBl3UgQX2U8XvimTlgdXG6YEhfvJl2cUfc",zp="https://us.i.posthog.com/capture/",Jp={darwin:"macOS",win32:"Windows",linux:"Linux"};bu=new Set(["api_key","distinct_id","event","properties","_nonce"]),Xp=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,r=Object.keys(t);return r.length!==bu.size||r.some(n=>!bu.has(n))?!1:typeof t.api_key=="string"&&typeof t.distinct_id=="string"&&t.event==="cli.used"&&typeof t.properties=="object"&&t.properties!==null&&!Array.isArray(t.properties)&&typeof t._nonce=="string"&&t._nonce.length>0};Zp="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",ef=new RegExp(`^resend-telemetry-${Zp}\\.json$`)});var zo=pe(Ko(),1),{program:df,createCommand:mf,createArgument:pf,createOption:ff,CommanderError:hf,InvalidArgumentError:gf,InvalidOptionArgumentError:bf,Command:m,Argument:Jo,Option:Y,Help:yf}=zo.default;var Wt=pe(rt(),1);var Qu=`Global options:
|
|
69
69
|
--api-key <key> API key (or set RESEND_API_KEY env var)
|
|
70
70
|
-p, --profile <name> Profile to use (overrides RESEND_PROFILE)
|
|
71
71
|
--json Force JSON output (also auto-enabled when stdout is piped)
|
|
72
|
-
-q, --quiet Suppress spinners and status output (implies --json)`,
|
|
72
|
+
-q, --quiet Suppress spinners and status output (implies --json)`,Xu=`Global options:
|
|
73
73
|
-p, --profile <name> Profile to use
|
|
74
74
|
--json Force JSON output
|
|
75
|
-
-q, --quiet Suppress spinners and status output (implies --json)`,
|
|
76
|
-
${
|
|
77
|
-
${
|
|
78
|
-
Codes: ${
|
|
79
|
-
${
|
|
75
|
+
-q, --quiet Suppress spinners and status output (implies --json)`,Zu=' {"error":{"message":"<message>","code":"<code>"}}';function f(e){let t=[];return e.context!=null&&t.push(e.context),t.push(e.setup?Xu:Qu),e.output!=null&&t.push(`Output (--json or piped):
|
|
76
|
+
${e.output}`),e.errorCodes!=null&&t.push(`Errors (exit code 1, JSON on stderr when using --json or non-TTY):
|
|
77
|
+
${Zu}
|
|
78
|
+
Codes: ${e.errorCodes.join(" | ")}`),t.push(`Examples:
|
|
79
|
+
${e.examples.map(r=>` $ ${r}`).join(`
|
|
80
80
|
`)}`),`
|
|
81
|
-
${
|
|
82
|
-
|
|
83
|
-
`)}`}var
|
|
84
|
-
`),c=!1;for(let u=0;u<d.length;u++){let p=d[u];if(n+=p,c)c=!1;else if(c=p>="\uD800"&&p<="\uDBFF",c)continue;if(p===
|
|
85
|
-
`){
|
|
86
|
-
`&&(
|
|
87
|
-
`)}var Oe=pe(
|
|
88
|
-
`),n=
|
|
89
|
-
`),
|
|
90
|
-
`).map((a,l,d)=>{let c=
|
|
91
|
-
`)}var Jt=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(t
|
|
92
|
-
`),
|
|
93
|
-
`).length-1;this.output.write(Oe.cursor.move(-999,
|
|
94
|
-
`);this.output.write(s[
|
|
95
|
-
`).slice(
|
|
96
|
-
`)),this._prevFrame=
|
|
97
|
-
`);_.push(I),k+=I.length}if(k>c){let D=0,I=0,T=k,E=
|
|
81
|
+
${t.join(`
|
|
82
|
+
|
|
83
|
+
`)}`}var wr=require("node:util"),zt=require("node:process");var pi=pe(require("node:readline"),1);var Xo=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let r=0;for(e.lastIndex=0;e.test(t);)r+=1;return t.length-r}})(),Zo=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,ei=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141;var ed=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,td=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,ti=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,rd=/\t{1,1000}/y,ri=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,nd=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,od=/\p{M}+/gu,id={limit:1/0,ellipsis:""},ni=(e,t={},r={})=>{let n=t.limit??1/0,o=t.ellipsis??"",i=t?.ellipsisWidth??(o?ni(o,id,r).width:0),s=0,a=r.controlWidth??0,l=r.tabWidth??8,d=r.emojiWidth??2,c=2,u=r.regularWidth??1,p=r.wideWidth??c,y=[[nd,u],[ed,s],[td,a],[rd,l],[ri,d],[ti,p]],g=0,b=0,_=e.length,k=0,x=!1,A=_,B=Math.max(0,n-i),D=0,I=0,T=0,E=0;e:for(;;){if(I>D||b>=_&&b>g){let P=e.slice(D,I)||e.slice(g,b);k=0;for(let be of P.replaceAll(od,"")){let ee=be.codePointAt(0)||0;if(Zo(ee)?E=c:ei(ee)?E=p:E=u,T+E>B&&(A=Math.min(A,Math.max(D,g)+k)),T+E>n){x=!0;break e}k+=be.length,T+=E}D=I=0}if(b>=_)break e;for(let P=0,be=y.length;P<be;P++){let[ee,gt]=y[P];if(ee.lastIndex=b,ee.test(e)){if(k=ee===ti?Xo(e.slice(b,ee.lastIndex)):ee===ri?1:ee.lastIndex-b,E=k*gt,T+E>B&&(A=Math.min(A,b+Math.floor((B-T)/gt))),T+E>n){x=!0;break e}T+=E,D=g,I=b,b=g=ee.lastIndex;continue e}}b+=1}return{width:x?B:T,index:x?A:_,truncated:x,ellipsed:x&&n>=i}},oi=ni;var sd={limit:1/0,ellipsis:"",ellipsisWidth:0},ad=(e,t={})=>oi(e,sd,t).width,Ue=ad;var vr="\x1B",ci="\x9B",ld=39,Pn="\x07",ui="[",cd="]",di="m",jn=`${cd}8;;`,ii=new RegExp(`(?:\\${ui}(?<code>\\d+)m|\\${jn}(?<uri>.*)${Pn})`,"y"),si=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},ai=e=>`${vr}${ui}${e}${di}`,li=e=>`${vr}${jn}${e}${Pn}`,In=(e,t,r)=>{let n=t[Symbol.iterator](),o=!1,i=!1,s=e.at(-1),a=s===void 0?0:Ue(s),l=n.next(),d=n.next(),c=0;for(;!l.done;){let u=l.value,p=Ue(u);a+p<=r?e[e.length-1]+=u:(e.push(u),a=0),(u===vr||u===ci)&&(o=!0,i=t.startsWith(jn,c+1)),o?i?u===Pn&&(o=!1,i=!1):u===di&&(o=!1):(a+=p,a===r&&!d.done&&(e.push(""),a=0)),l=d,d=n.next(),c+=u.length}s=e.at(-1),!a&&s!==void 0&&s.length&&e.length>1&&(e[e.length-2]+=e.pop())},ud=e=>{let t=e.split(" "),r=t.length;for(;r&&!Ue(t[r-1]);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},dd=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",o,i,s=e.split(" "),a=[""],l=0;for(let u=0;u<s.length;u++){let p=s[u];if(r.trim!==!1){let g=a.at(-1)??"",b=g.trimStart();g.length!==b.length&&(a[a.length-1]=b,l=Ue(b))}u!==0&&(l>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),l=0),(l||r.trim===!1)&&(a[a.length-1]+=" ",l++));let y=Ue(p);if(r.hard&&y>t){let g=t-l,b=1+Math.floor((y-g-1)/t);Math.floor((y-1)/t)<b&&a.push(""),In(a,p,t),l=Ue(a.at(-1)??"");continue}if(l+y>t&&l&&y){if(r.wordWrap===!1&&l<t){In(a,p,t),l=Ue(a.at(-1)??"");continue}a.push(""),l=0}if(l+y>t&&r.wordWrap===!1){In(a,p,t),l=Ue(a.at(-1)??"");continue}a[a.length-1]+=p,l+=y}r.trim!==!1&&(a=a.map(u=>ud(u)));let d=a.join(`
|
|
84
|
+
`),c=!1;for(let u=0;u<d.length;u++){let p=d[u];if(n+=p,c)c=!1;else if(c=p>="\uD800"&&p<="\uDBFF",c)continue;if(p===vr||p===ci){ii.lastIndex=u+1;let g=ii.exec(d)?.groups;if(g?.code!==void 0){let b=Number.parseFloat(g.code);o=b===ld?void 0:b}else g?.uri!==void 0&&(i=g.uri.length===0?void 0:g.uri)}if(d[u+1]===`
|
|
85
|
+
`){i&&(n+=li(""));let y=o?si(o):void 0;o&&y&&(n+=ai(y))}else p===`
|
|
86
|
+
`&&(o&&si(o)&&(n+=ai(o)),i&&(n+=li(i)))}return n},md=/\r?\n/;function kt(e,t,r){return String(e).normalize().split(md).map(n=>dd(n,t,r)).join(`
|
|
87
|
+
`)}var Oe=pe(Fn(),1);function bt(e,t,r){if(!r.some(s=>!s.disabled))return e;let n=e+t,o=Math.max(r.length-1,0),i=n<0?o:n>o?0:n;return r[i].disabled?bt(i,t<0?-1:1,r):i}var hd=["up","down","left","right","space","enter","cancel"],gd=["January","February","March","April","May","June","July","August","September","October","November","December"],ve={actions:new Set(hd),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...gd],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:e=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:e=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};function fi(e,t){if(typeof e=="string")return ve.aliases.get(e)===t;for(let r of e)if(r!==void 0&&fi(r,t))return!0;return!1}function bd(e,t){if(e===t)return;let r=e.split(`
|
|
88
|
+
`),n=t.split(`
|
|
89
|
+
`),o=Math.max(r.length,n.length),i=[];for(let s=0;s<o;s++)r[s]!==n[s]&&i.push(s);return{lines:i,numLinesBefore:r.length,numLinesAfter:n.length,numLines:o}}var Of=globalThis.process.platform.startsWith("win"),Nn=Symbol("clack:cancel");function $(e){return e===Nn}function Cr(e,t){let r=e;r.isTTY&&r.setRawMode(t)}var Bn=e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,Gn=e=>"rows"in e&&typeof e.rows=="number"?e.rows:20;function nt(e,t,r,n=r,o=r,i){let s=Bn(e??zt.stdout);return kt(t,s-r.length,{hard:!0,trim:!1}).split(`
|
|
90
|
+
`).map((a,l,d)=>{let c=i?i(a,l):a;return l===0?`${n}${c}`:l===d.length-1?`${o}${c}`:`${r}${c}`}).join(`
|
|
91
|
+
`)}var Jt=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(e,t=!0){let{input:r=zt.stdin,output:n=zt.stdout,render:o,signal:i,...s}=e;this.opts=s,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=o.bind(this),this._track=t,this._abortSignal=i,this.input=r,this.output=n}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let r=this._subscribers.get(e)??[];r.push(t),this._subscribers.set(e,r)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let r=this._subscribers.get(e)??[],n=[];for(let o of r)o.cb(...t),o.once&&n.push(()=>r.splice(r.indexOf(o),1));for(let o of n)o()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Nn);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=pi.default.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),Cr(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(Oe.cursor.show),this.output.off("resize",this.render),Cr(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(Oe.cursor.show),this.output.off("resize",this.render),Cr(this.input,!1),e(Nn)})})}_isActionKey(e,t){return e===" "}_shouldSubmit(e,t){return!0}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,t){this.userInput=e??"",this.emit("userInput",this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(e,t){if(this._track&&t.name!=="return"&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&ve.aliases.has(t.name)&&this.emit("cursor",ve.aliases.get(t.name)),ve.actions.has(t.name)&&this.emit("cursor",t.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),this.emit("key",e?.toLowerCase(),t),t?.name==="return"&&this._shouldSubmit(e,t)){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}fi([e,t?.name,t?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
92
|
+
`),Cr(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=kt(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
93
|
+
`).length-1;this.output.write(Oe.cursor.move(-999,e*-1))}render(){let e=kt(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(Oe.cursor.hide);else{let t=bd(this._prevFrame,e),r=Gn(this.output);if(this.restoreCursor(),t){let n=Math.max(0,t.numLinesAfter-r),o=Math.max(0,t.numLinesBefore-r),i=t.lines.find(s=>s>=n);if(i===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(Oe.cursor.move(0,i-o)),this.output.write(Oe.erase.lines(1));let s=e.split(`
|
|
94
|
+
`);this.output.write(s[i]),this._prevFrame=e,this.output.write(Oe.cursor.move(0,s.length-i-1));return}else if(t.lines.length>1){if(n<o)i=n;else{let a=i-o;a>0&&this.output.write(Oe.cursor.move(0,a))}this.output.write(Oe.erase.down());let s=e.split(`
|
|
95
|
+
`).slice(i);this.output.write(s.join(`
|
|
96
|
+
`)),this._prevFrame=e;return}}this.output.write(Oe.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};var _r=class extends Jt{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(Oe.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var hi=class extends Jt{options;cursor=0;get _value(){return this.options[this.cursor].value}get _enabledOptions(){return this.options.filter(e=>e.disabled!==!0)}toggleAll(){let e=this._enabledOptions,t=this.value!==void 0&&this.value.length===e.length;this.value=t?[]:e.map(r=>r.value)}toggleInvert(){let e=this.value;if(!e)return;let t=this._enabledOptions.filter(r=>!e.includes(r.value));this.value=t.map(r=>r.value)}toggleValue(){this.value===void 0&&(this.value=[]);let e=this.value.includes(this._value);this.value=e?this.value.filter(t=>t!==this._value):[...this.value,this._value]}constructor(e){super(e,!1),this.options=e.options,this.value=[...e.initialValues??[]];let t=Math.max(this.options.findIndex(({value:r})=>r===e.cursorAt),0);this.cursor=this.options[t].disabled?bt(t,1,this.options):t,this.on("key",r=>{r==="a"&&this.toggleAll(),r==="i"&&this.toggleInvert()}),this.on("cursor",r=>{switch(r){case"left":case"up":this.cursor=bt(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=bt(this.cursor,1,this.options);break;case"space":this.toggleValue();break}})}},xr=class extends Jt{_mask="\u2022";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;let t=this.userInput;if(this.cursor>=t.length)return`${this.masked}${(0,wr.styleText)(["inverse","hidden"],"_")}`;let r=this.masked,n=r.slice(0,this.cursor),o=r.slice(this.cursor);return`${n}${(0,wr.styleText)("inverse",o[0])}${o.slice(1)}`}clear(){this._clearUserInput()}constructor({mask:t,...r}){super(r),this._mask=t??"\u2022",this.on("userInput",n=>{this._setValue(n)})}},kr=class extends Jt{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(t){super(t,!1),this.options=t.options;let r=this.options.findIndex(({value:o})=>o===t.initialValue),n=r===-1?0:r;this.cursor=this.options[n].disabled?bt(n,1,this.options):n,this.changeValue(),this.on("cursor",o=>{switch(o){case"left":case"up":this.cursor=bt(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=bt(this.cursor,1,this.options);break}this.changeValue()})}};var Ar=class extends Jt{get userInputWithCursor(){if(this.state==="submit")return this.userInput;let t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;let r=t.slice(0,this.cursor),[n,...o]=t.slice(this.cursor);return`${r}${(0,wr.styleText)("inverse",n)}${o.join("")}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}};var v=require("node:util"),Fe=pe(require("node:process"),1);var vi=pe(Fn(),1);function yd(){return Fe.default.platform!=="win32"?Fe.default.env.TERM!=="linux":!!Fe.default.env.CI||!!Fe.default.env.WT_SESSION||!!Fe.default.env.TERMINUS_SUBLIME||Fe.default.env.ConEmuTask==="{cmd::Cmder}"||Fe.default.env.TERM_PROGRAM==="Terminus-Sublime"||Fe.default.env.TERM_PROGRAM==="vscode"||Fe.default.env.TERM==="xterm-256color"||Fe.default.env.TERM==="alacritty"||Fe.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var vd=yd();var z=(e,t)=>vd?e:t,Cd=z("\u25C6","*"),wd=z("\u25A0","x"),_d=z("\u25B2","x"),Ci=z("\u25C7","o"),xd=z("\u250C","T"),j=z("\u2502","|"),We=z("\u2514","\u2014"),Wf=z("\u2510","T"),Vf=z("\u2518","\u2014"),Ln=z("\u25CF",">"),Er=z("\u25CB"," "),kd=z("\u25FB","[\u2022]"),gi=z("\u25FC","[+]"),bi=z("\u25FB","[ ]"),Ad=z("\u25AA","\u2022"),Kf=z("\u2500","-"),zf=z("\u256E","+"),Jf=z("\u251C","+"),Yf=z("\u256F","+"),Qf=z("\u2570","+"),Xf=z("\u256D","+"),$d=z("\u25CF","\u2022"),Ed=z("\u25C6","*"),Dd=z("\u25B2","!"),Sd=z("\u25A0","x"),Qt=e=>{switch(e){case"initial":case"active":return(0,v.styleText)("cyan",Cd);case"cancel":return(0,v.styleText)("red",wd);case"error":return(0,v.styleText)("yellow",_d);case"submit":return(0,v.styleText)("green",Ci)}},wi=e=>{switch(e){case"initial":case"active":return(0,v.styleText)("cyan",j);case"cancel":return(0,v.styleText)("red",j);case"error":return(0,v.styleText)("yellow",j);case"submit":return(0,v.styleText)("green",j)}},yi=(e,t,r,n,o,i=!1)=>{let s=t,a=0;if(i)for(let l=n-1;l>=r&&(s-=e[l].length,a++,!(s<=o));l--);else for(let l=r;l<n&&(s-=e[l].length,a++,!(s<=o));l++);return{lineCount:s,removals:a}},Hn=({cursor:e,options:t,style:r,output:n=process.stdout,maxItems:o=Number.POSITIVE_INFINITY,columnPadding:i=0,rowPadding:s=4})=>{let a=Bn(n)-i,l=Gn(n),d=(0,v.styleText)("dim","..."),c=Math.max(l-s,0),u=Math.max(Math.min(o,c),5),p=0;e>=u-3&&(p=Math.max(Math.min(e-u+3,t.length-u),0));let y=u<t.length&&p>0,g=u<t.length&&p+u<t.length,b=Math.min(p+u,t.length),_=[],k=0;y&&k++,g&&k++;let x=p+(y?1:0),A=b-(g?1:0);for(let D=x;D<A;D++){let I=kt(r(t[D],D===e),a,{hard:!0,trim:!1}).split(`
|
|
97
|
+
`);_.push(I),k+=I.length}if(k>c){let D=0,I=0,T=k,E=e-x,P=c,be=()=>yi(_,T,0,E,P),ee=()=>yi(_,T,E+1,_.length,P,!0);y?({lineCount:T,removals:D}=be(),T>P&&(g||(P-=1),{lineCount:T,removals:I}=ee())):(g||(P-=1),{lineCount:T,removals:I}=ee(),T>P&&(P-=1,{lineCount:T,removals:D}=be())),D>0&&(y=!0,_.splice(0,D)),I>0&&(g=!0,_.splice(_.length-I,I))}let B=[];y&&B.push(d);for(let D of _)for(let I of D)B.push(I);return g&&B.push(d),B};var ot=e=>{let t=e.active??"Yes",r=e.inactive??"No";return new _r({active:t,inactive:r,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let n=e.withGuide??ve.withGuide,o=`${Qt(this.state)} `,i=n?`${(0,v.styleText)("gray",j)} `:"",s=nt(e.output,e.message,i,o),a=`${n?`${(0,v.styleText)("gray",j)}
|
|
98
98
|
`:""}${s}
|
|
99
|
-
`,l=this.value?
|
|
100
|
-
${(0,v.styleText)("gray",
|
|
101
|
-
${(0,v.styleText)("cyan",
|
|
102
|
-
`:` ${(0,v.styleText)("dim","/")} `}${this.value?`${(0,v.styleText)("dim",
|
|
99
|
+
`,l=this.value?t:r;switch(this.state){case"submit":{let d=n?`${(0,v.styleText)("gray",j)} `:"";return`${a}${d}${(0,v.styleText)("dim",l)}`}case"cancel":{let d=n?`${(0,v.styleText)("gray",j)} `:"";return`${a}${d}${(0,v.styleText)(["strikethrough","dim"],l)}${n?`
|
|
100
|
+
${(0,v.styleText)("gray",j)}`:""}`}default:{let d=n?`${(0,v.styleText)("cyan",j)} `:"",c=n?(0,v.styleText)("cyan",We):"";return`${a}${d}${this.value?`${(0,v.styleText)("green",Ln)} ${t}`:`${(0,v.styleText)("dim",Er)} ${(0,v.styleText)("dim",t)}`}${e.vertical?n?`
|
|
101
|
+
${(0,v.styleText)("cyan",j)} `:`
|
|
102
|
+
`:` ${(0,v.styleText)("dim","/")} `}${this.value?`${(0,v.styleText)("dim",Er)} ${(0,v.styleText)("dim",r)}`:`${(0,v.styleText)("green",Ln)} ${r}`}
|
|
103
103
|
${c}
|
|
104
|
-
`}}}}).prompt()};var
|
|
105
|
-
`);if(u.length>0){let[p,...y]=u;p.length>0?s.push(`${d}${p}`):s.push(a?
|
|
104
|
+
`}}}}).prompt()};var _i=async(e,t)=>{let r={},n=Object.keys(e);for(let o of n){let i=e[o],s=await i({results:r})?.catch(a=>{throw a});if(typeof t?.onCancel=="function"&&$(s)){r[o]="canceled",t.onCancel({results:r});continue}r[o]=s}return r};var Q={message:(e=[],{symbol:t=(0,v.styleText)("gray",j),secondarySymbol:r=(0,v.styleText)("gray",j),output:n=process.stdout,spacing:o=1,withGuide:i}={})=>{let s=[],a=i??ve.withGuide,l=a?r:"",d=a?`${t} `:"",c=a?`${r} `:"";for(let p=0;p<o;p++)s.push(l);let u=Array.isArray(e)?e:e.split(`
|
|
105
|
+
`);if(u.length>0){let[p,...y]=u;p.length>0?s.push(`${d}${p}`):s.push(a?t:"");for(let g of y)g.length>0?s.push(`${c}${g}`):s.push(a?r:"")}n.write(`${s.join(`
|
|
106
106
|
`)}
|
|
107
|
-
`)},info:(t
|
|
107
|
+
`)},info:(e,t)=>{Q.message(e,{...t,symbol:(0,v.styleText)("blue",$d)})},success:(e,t)=>{Q.message(e,{...t,symbol:(0,v.styleText)("green",Ed)})},step:(e,t)=>{Q.message(e,{...t,symbol:(0,v.styleText)("green",Ci)})},warn:(e,t)=>{Q.message(e,{...t,symbol:(0,v.styleText)("yellow",Dd)})},warning:(e,t)=>{Q.warn(e,t)},error:(e,t)=>{Q.message(e,{...t,symbol:(0,v.styleText)("red",Sd)})}},xi=(e="",t)=>{let r=t?.output??process.stdout,n=t?.withGuide??ve.withGuide?`${(0,v.styleText)("gray",We)} `:"";r.write(`${n}${(0,v.styleText)("red",e)}
|
|
108
108
|
|
|
109
|
-
`)},
|
|
110
|
-
`)}
|
|
111
|
-
${(0,v.styleText)("gray",
|
|
109
|
+
`)},ki=(e="",t)=>{let r=t?.output??process.stdout,n=t?.withGuide??ve.withGuide?`${(0,v.styleText)("gray",xd)} `:"";r.write(`${n}${e}
|
|
110
|
+
`)},Dr=(e="",t)=>{let r=t?.output??process.stdout,n=t?.withGuide??ve.withGuide?`${(0,v.styleText)("gray",j)}
|
|
111
|
+
${(0,v.styleText)("gray",We)} `:"";r.write(`${n}${e}
|
|
112
112
|
|
|
113
|
-
`)};var Yt=(t
|
|
114
|
-
`).map(r=>
|
|
115
|
-
`),
|
|
116
|
-
${(0,v.styleText)("reset",(0,v.styleText)("dim",`Press ${(0,v.styleText)(["gray","bgWhite","inverse"]," space ")} to select, ${(0,v.styleText)("gray",(0,v.styleText)("bgWhite",(0,v.styleText)("inverse"," enter ")))} to submit`))}`},render(){let n=
|
|
117
|
-
`:""}${
|
|
118
|
-
`,s=this.value??[],a=(l,d)=>{if(l.disabled)return
|
|
119
|
-
${(0,v.styleText)("gray",
|
|
120
|
-
`).map((p,y)=>y===0?`${n?`${(0,v.styleText)("yellow",
|
|
121
|
-
`),c=
|
|
113
|
+
`)};var Yt=(e,t)=>e.split(`
|
|
114
|
+
`).map(r=>t(r)).join(`
|
|
115
|
+
`),Ai=e=>{let t=(n,o)=>{let i=n.label??String(n.value);return o==="disabled"?`${(0,v.styleText)("gray",bi)} ${Yt(i,s=>(0,v.styleText)(["strikethrough","gray"],s))}${n.hint?` ${(0,v.styleText)("dim",`(${n.hint??"disabled"})`)}`:""}`:o==="active"?`${(0,v.styleText)("cyan",kd)} ${i}${n.hint?` ${(0,v.styleText)("dim",`(${n.hint})`)}`:""}`:o==="selected"?`${(0,v.styleText)("green",gi)} ${Yt(i,s=>(0,v.styleText)("dim",s))}${n.hint?` ${(0,v.styleText)("dim",`(${n.hint})`)}`:""}`:o==="cancelled"?`${Yt(i,s=>(0,v.styleText)(["strikethrough","dim"],s))}`:o==="active-selected"?`${(0,v.styleText)("green",gi)} ${i}${n.hint?` ${(0,v.styleText)("dim",`(${n.hint})`)}`:""}`:o==="submitted"?`${Yt(i,s=>(0,v.styleText)("dim",s))}`:`${(0,v.styleText)("dim",bi)} ${Yt(i,s=>(0,v.styleText)("dim",s))}`},r=e.required??!0;return new hi({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:r,cursorAt:e.cursorAt,validate(n){if(r&&(n===void 0||n.length===0))return`Please select at least one option.
|
|
116
|
+
${(0,v.styleText)("reset",(0,v.styleText)("dim",`Press ${(0,v.styleText)(["gray","bgWhite","inverse"]," space ")} to select, ${(0,v.styleText)("gray",(0,v.styleText)("bgWhite",(0,v.styleText)("inverse"," enter ")))} to submit`))}`},render(){let n=e.withGuide??ve.withGuide,o=nt(e.output,e.message,n?`${wi(this.state)} `:"",`${Qt(this.state)} `),i=`${n?`${(0,v.styleText)("gray",j)}
|
|
117
|
+
`:""}${o}
|
|
118
|
+
`,s=this.value??[],a=(l,d)=>{if(l.disabled)return t(l,"disabled");let c=s.includes(l.value);return d&&c?t(l,"active-selected"):c?t(l,"selected"):t(l,d?"active":"inactive")};switch(this.state){case"submit":{let l=this.options.filter(({value:c})=>s.includes(c)).map(c=>t(c,"submitted")).join((0,v.styleText)("dim",", "))||(0,v.styleText)("dim","none"),d=nt(e.output,l,n?`${(0,v.styleText)("gray",j)} `:"");return`${i}${d}`}case"cancel":{let l=this.options.filter(({value:c})=>s.includes(c)).map(c=>t(c,"cancelled")).join((0,v.styleText)("dim",", "));if(l.trim()==="")return`${i}${(0,v.styleText)("gray",j)}`;let d=nt(e.output,l,n?`${(0,v.styleText)("gray",j)} `:"");return`${i}${d}${n?`
|
|
119
|
+
${(0,v.styleText)("gray",j)}`:""}`}case"error":{let l=n?`${(0,v.styleText)("yellow",j)} `:"",d=this.error.split(`
|
|
120
|
+
`).map((p,y)=>y===0?`${n?`${(0,v.styleText)("yellow",We)} `:""}${(0,v.styleText)("yellow",p)}`:` ${p}`).join(`
|
|
121
|
+
`),c=i.split(`
|
|
122
122
|
`).length,u=d.split(`
|
|
123
|
-
`).length+1;return`${
|
|
123
|
+
`).length+1;return`${i}${l}${Hn({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:l.length,rowPadding:c+u,style:a}).join(`
|
|
124
124
|
${l}`)}
|
|
125
125
|
${d}
|
|
126
|
-
`}default:{let l=n?`${(0,v.styleText)("cyan",
|
|
127
|
-
`).length,c=n?2:1;return`${
|
|
126
|
+
`}default:{let l=n?`${(0,v.styleText)("cyan",j)} `:"",d=i.split(`
|
|
127
|
+
`).length,c=n?2:1;return`${i}${l}${Hn({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:l.length,rowPadding:d+c,style:a}).join(`
|
|
128
128
|
${l}`)}
|
|
129
|
-
${n?(0,v.styleText)("cyan",
|
|
130
|
-
`}}}}).prompt()};var
|
|
131
|
-
`:""}${Qt(this.state)} ${
|
|
132
|
-
`,n=this.userInputWithCursor,
|
|
133
|
-
${
|
|
129
|
+
${n?(0,v.styleText)("cyan",We):""}
|
|
130
|
+
`}}}}).prompt()};var $i=e=>new xr({validate:e.validate,mask:e.mask??Ad,signal:e.signal,input:e.input,output:e.output,render(){let t=e.withGuide??ve.withGuide,r=`${t?`${(0,v.styleText)("gray",j)}
|
|
131
|
+
`:""}${Qt(this.state)} ${e.message}
|
|
132
|
+
`,n=this.userInputWithCursor,o=this.masked;switch(this.state){case"error":{let i=t?`${(0,v.styleText)("yellow",j)} `:"",s=t?`${(0,v.styleText)("yellow",We)} `:"",a=o??"";return e.clearOnError&&this.clear(),`${r.trim()}
|
|
133
|
+
${i}${a}
|
|
134
134
|
${s}${(0,v.styleText)("yellow",this.error)}
|
|
135
|
-
`}case"submit":{let
|
|
136
|
-
${(0,v.styleText)("gray",
|
|
135
|
+
`}case"submit":{let i=t?`${(0,v.styleText)("gray",j)} `:"",s=o?(0,v.styleText)("dim",o):"";return`${r}${i}${s}`}case"cancel":{let i=t?`${(0,v.styleText)("gray",j)} `:"",s=o?(0,v.styleText)(["strikethrough","dim"],o):"";return`${r}${i}${s}${o&&t?`
|
|
136
|
+
${(0,v.styleText)("gray",j)}`:""}`}default:{let i=t?`${(0,v.styleText)("cyan",j)} `:"",s=t?(0,v.styleText)("cyan",We):"";return`${r}${i}${n}
|
|
137
137
|
${s}
|
|
138
|
-
`}}}}).prompt();var
|
|
139
|
-
`)?
|
|
140
|
-
`).map(r=>
|
|
141
|
-
`):e
|
|
142
|
-
`:""}${
|
|
143
|
-
`;switch(this.state){case"submit":{let a=r?`${(0,v.styleText)("gray",
|
|
144
|
-
${(0,v.styleText)("gray",
|
|
145
|
-
`).length,c=r?2:1;return`${s}${a}${
|
|
138
|
+
`}}}}).prompt();var Zf={light:z("\u2500","-"),heavy:z("\u2501","="),block:z("\u2588","#")};var $r=(e,t)=>e.includes(`
|
|
139
|
+
`)?e.split(`
|
|
140
|
+
`).map(r=>t(r)).join(`
|
|
141
|
+
`):t(e),se=e=>{let t=(r,n)=>{let o=r.label??String(r.value);switch(n){case"disabled":return`${(0,v.styleText)("gray",Er)} ${$r(o,i=>(0,v.styleText)("gray",i))}${r.hint?` ${(0,v.styleText)("dim",`(${r.hint??"disabled"})`)}`:""}`;case"selected":return`${$r(o,i=>(0,v.styleText)("dim",i))}`;case"active":return`${(0,v.styleText)("green",Ln)} ${o}${r.hint?` ${(0,v.styleText)("dim",`(${r.hint})`)}`:""}`;case"cancelled":return`${$r(o,i=>(0,v.styleText)(["strikethrough","dim"],i))}`;default:return`${(0,v.styleText)("dim",Er)} ${$r(o,i=>(0,v.styleText)("dim",i))}`}};return new kr({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let r=e.withGuide??ve.withGuide,n=`${Qt(this.state)} `,o=`${wi(this.state)} `,i=nt(e.output,e.message,o,n),s=`${r?`${(0,v.styleText)("gray",j)}
|
|
142
|
+
`:""}${i}
|
|
143
|
+
`;switch(this.state){case"submit":{let a=r?`${(0,v.styleText)("gray",j)} `:"",l=nt(e.output,t(this.options[this.cursor],"selected"),a);return`${s}${l}`}case"cancel":{let a=r?`${(0,v.styleText)("gray",j)} `:"",l=nt(e.output,t(this.options[this.cursor],"cancelled"),a);return`${s}${l}${r?`
|
|
144
|
+
${(0,v.styleText)("gray",j)}`:""}`}default:{let a=r?`${(0,v.styleText)("cyan",j)} `:"",l=r?(0,v.styleText)("cyan",We):"",d=s.split(`
|
|
145
|
+
`).length,c=r?2:1;return`${s}${a}${Hn({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:a.length,rowPadding:d+c,style:(u,p)=>t(u,u.disabled?"disabled":p?"active":"inactive")}).join(`
|
|
146
146
|
${a}`)}
|
|
147
147
|
${l}
|
|
148
|
-
`}}}}).prompt()};var
|
|
149
|
-
`:""}${Qt(this.state)} `}${
|
|
150
|
-
`,n=
|
|
151
|
-
${a}${
|
|
148
|
+
`}}}}).prompt()};var eh=`${(0,v.styleText)("gray",j)} `;var X=e=>new Ar({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let t=e?.withGuide??ve.withGuide,r=`${`${t?`${(0,v.styleText)("gray",j)}
|
|
149
|
+
`:""}${Qt(this.state)} `}${e.message}
|
|
150
|
+
`,n=e.placeholder?(0,v.styleText)("inverse",e.placeholder[0])+(0,v.styleText)("dim",e.placeholder.slice(1)):(0,v.styleText)(["inverse","hidden"],"_"),o=this.userInput?this.userInputWithCursor:n,i=this.value??"";switch(this.state){case"error":{let s=this.error?` ${(0,v.styleText)("yellow",this.error)}`:"",a=t?`${(0,v.styleText)("yellow",j)} `:"",l=t?(0,v.styleText)("yellow",We):"";return`${r.trim()}
|
|
151
|
+
${a}${o}
|
|
152
152
|
${l}${s}
|
|
153
|
-
`}case"submit":{let s=
|
|
154
|
-
${a}`:""}`}default:{let s=
|
|
153
|
+
`}case"submit":{let s=i?` ${(0,v.styleText)("dim",i)}`:"",a=t?(0,v.styleText)("gray",j):"";return`${r}${a}${s}`}case"cancel":{let s=i?` ${(0,v.styleText)(["strikethrough","dim"],i)}`:"",a=t?(0,v.styleText)("gray",j):"";return`${r}${a}${s}${i.trim()?`
|
|
154
|
+
${a}`:""}`}default:{let s=t?`${(0,v.styleText)("cyan",j)} `:"",a=t?(0,v.styleText)("cyan",We):"";return`${r}${s}${o}
|
|
155
155
|
${a}
|
|
156
|
-
`}}}}).prompt();var
|
|
157
|
-
`)}finalize(){return
|
|
158
|
-
`;if(r=this.remainder+r,r.length<this.maxChunkSize){this.remainder=r;return}this.remainder="";let n=r.match(
|
|
159
|
-
-- `)?r?n.slice(0,-1)+
|
|
160
|
-
`+
|
|
161
|
-
`+r,this.headerLines.splice(
|
|
162
|
-
`,"𝔑":"\u{1D511}","⁠":"\u2060"," ":"\xA0","ℕ":"\u2115","⫬":"\u2AEC","≢":"\u2262","≭":"\u226D","∦":"\u2226","∉":"\u2209","≠":"\u2260","≂̸":"\u2242\u0338","∄":"\u2204","≯":"\u226F","≱":"\u2271","≧̸":"\u2267\u0338","≫̸":"\u226B\u0338","≹":"\u2279","⩾̸":"\u2A7E\u0338","≵":"\u2275","≎̸":"\u224E\u0338","≏̸":"\u224F\u0338","⋪":"\u22EA","⧏̸":"\u29CF\u0338","⋬":"\u22EC","≮":"\u226E","≰":"\u2270","≸":"\u2278","≪̸":"\u226A\u0338","⩽̸":"\u2A7D\u0338","≴":"\u2274","⪢̸":"\u2AA2\u0338","⪡̸":"\u2AA1\u0338","⊀":"\u2280","⪯̸":"\u2AAF\u0338","⋠":"\u22E0","∌":"\u220C","⋫":"\u22EB","⧐̸":"\u29D0\u0338","⋭":"\u22ED","⊏̸":"\u228F\u0338","⋢":"\u22E2","⊐̸":"\u2290\u0338","⋣":"\u22E3","⊂⃒":"\u2282\u20D2","⊈":"\u2288","⊁":"\u2281","⪰̸":"\u2AB0\u0338","⋡":"\u22E1","≿̸":"\u227F\u0338","⊃⃒":"\u2283\u20D2","⊉":"\u2289","≁":"\u2241","≄":"\u2244","≇":"\u2247","≉":"\u2249","∤":"\u2224","𝒩":"\u{1D4A9}","Ñ":"\xD1","Ñ":"\xD1","Ν":"\u039D","Œ":"\u0152","Ó":"\xD3","Ó":"\xD3","Ô":"\xD4","Ô":"\xD4","О":"\u041E","Ő":"\u0150","𝔒":"\u{1D512}","Ò":"\xD2","Ò":"\xD2","Ō":"\u014C","Ω":"\u03A9","Ο":"\u039F","𝕆":"\u{1D546}","“":"\u201C","‘":"\u2018","⩔":"\u2A54","𝒪":"\u{1D4AA}","Ø":"\xD8","Ø":"\xD8","Õ":"\xD5","Õ":"\xD5","⨷":"\u2A37","Ö":"\xD6","Ö":"\xD6","‾":"\u203E","⏞":"\u23DE","⎴":"\u23B4","⏜":"\u23DC","∂":"\u2202","П":"\u041F","𝔓":"\u{1D513}","Φ":"\u03A6","Π":"\u03A0","±":"\xB1","ℌ":"\u210C","ℙ":"\u2119","⪻":"\u2ABB","≺":"\u227A","⪯":"\u2AAF","≼":"\u227C","≾":"\u227E","″":"\u2033","∏":"\u220F","∷":"\u2237","∝":"\u221D","𝒫":"\u{1D4AB}","Ψ":"\u03A8",""":'"',""":'"',"𝔔":"\u{1D514}","ℚ":"\u211A","𝒬":"\u{1D4AC}","⤐":"\u2910","®":"\xAE","®":"\xAE","Ŕ":"\u0154","⟫":"\u27EB","↠":"\u21A0","⤖":"\u2916","Ř":"\u0158","Ŗ":"\u0156","Р":"\u0420","ℜ":"\u211C","∋":"\u220B","⇋":"\u21CB","⥯":"\u296F","ℜ":"\u211C","Ρ":"\u03A1","⟩":"\u27E9","→":"\u2192","⇥":"\u21E5","⇄":"\u21C4","⌉":"\u2309","⟧":"\u27E7","⥝":"\u295D","⇂":"\u21C2","⥕":"\u2955","⌋":"\u230B","⊢":"\u22A2","↦":"\u21A6","⥛":"\u295B","⊳":"\u22B3","⧐":"\u29D0","⊵":"\u22B5","⥏":"\u294F","⥜":"\u295C","↾":"\u21BE","⥔":"\u2954","⇀":"\u21C0","⥓":"\u2953","⇒":"\u21D2","ℝ":"\u211D","⥰":"\u2970","⇛":"\u21DB","ℛ":"\u211B","↱":"\u21B1","⧴":"\u29F4","Щ":"\u0429","Ш":"\u0428","Ь":"\u042C","Ś":"\u015A","⪼":"\u2ABC","Š":"\u0160","Ş":"\u015E","Ŝ":"\u015C","С":"\u0421","𝔖":"\u{1D516}","↓":"\u2193","←":"\u2190","→":"\u2192","↑":"\u2191","Σ":"\u03A3","∘":"\u2218","𝕊":"\u{1D54A}","√":"\u221A","□":"\u25A1","⊓":"\u2293","⊏":"\u228F","⊑":"\u2291","⊐":"\u2290","⊒":"\u2292","⊔":"\u2294","𝒮":"\u{1D4AE}","⋆":"\u22C6","⋐":"\u22D0","⋐":"\u22D0","⊆":"\u2286","≻":"\u227B","⪰":"\u2AB0","≽":"\u227D","≿":"\u227F","∋":"\u220B","∑":"\u2211","⋑":"\u22D1","⊃":"\u2283","⊇":"\u2287","⋑":"\u22D1","Þ":"\xDE","Þ":"\xDE","™":"\u2122","Ћ":"\u040B","Ц":"\u0426","	":" ","Τ":"\u03A4","Ť":"\u0164","Ţ":"\u0162","Т":"\u0422","𝔗":"\u{1D517}","∴":"\u2234","Θ":"\u0398","  ":"\u205F\u200A"," ":"\u2009","∼":"\u223C","≃":"\u2243","≅":"\u2245","≈":"\u2248","𝕋":"\u{1D54B}","⃛":"\u20DB","𝒯":"\u{1D4AF}","Ŧ":"\u0166","Ú":"\xDA","Ú":"\xDA","↟":"\u219F","⥉":"\u2949","Ў":"\u040E","Ŭ":"\u016C","Û":"\xDB","Û":"\xDB","У":"\u0423","Ű":"\u0170","𝔘":"\u{1D518}","Ù":"\xD9","Ù":"\xD9","Ū":"\u016A","_":"_","⏟":"\u23DF","⎵":"\u23B5","⏝":"\u23DD","⋃":"\u22C3","⊎":"\u228E","Ų":"\u0172","𝕌":"\u{1D54C}","↑":"\u2191","⤒":"\u2912","⇅":"\u21C5","↕":"\u2195","⥮":"\u296E","⊥":"\u22A5","↥":"\u21A5","⇑":"\u21D1","⇕":"\u21D5","↖":"\u2196","↗":"\u2197","ϒ":"\u03D2","Υ":"\u03A5","Ů":"\u016E","𝒰":"\u{1D4B0}","Ũ":"\u0168","Ü":"\xDC","Ü":"\xDC","⊫":"\u22AB","⫫":"\u2AEB","В":"\u0412","⊩":"\u22A9","⫦":"\u2AE6","⋁":"\u22C1","‖":"\u2016","‖":"\u2016","∣":"\u2223","|":"|","❘":"\u2758","≀":"\u2240"," ":"\u200A","𝔙":"\u{1D519}","𝕍":"\u{1D54D}","𝒱":"\u{1D4B1}","⊪":"\u22AA","Ŵ":"\u0174","⋀":"\u22C0","𝔚":"\u{1D51A}","𝕎":"\u{1D54E}","𝒲":"\u{1D4B2}","𝔛":"\u{1D51B}","Ξ":"\u039E","𝕏":"\u{1D54F}","𝒳":"\u{1D4B3}","Я":"\u042F","Ї":"\u0407","Ю":"\u042E","Ý":"\xDD","Ý":"\xDD","Ŷ":"\u0176","Ы":"\u042B","𝔜":"\u{1D51C}","𝕐":"\u{1D550}","𝒴":"\u{1D4B4}","Ÿ":"\u0178","Ж":"\u0416","Ź":"\u0179","Ž":"\u017D","З":"\u0417","Ż":"\u017B","​":"\u200B","Ζ":"\u0396","ℨ":"\u2128","ℤ":"\u2124","𝒵":"\u{1D4B5}","á":"\xE1","á":"\xE1","ă":"\u0103","∾":"\u223E","∾̳":"\u223E\u0333","∿":"\u223F","â":"\xE2","â":"\xE2","´":"\xB4","´":"\xB4","а":"\u0430","æ":"\xE6","æ":"\xE6","⁡":"\u2061","𝔞":"\u{1D51E}","à":"\xE0","à":"\xE0","ℵ":"\u2135","ℵ":"\u2135","α":"\u03B1","ā":"\u0101","⨿":"\u2A3F","&":"&","&":"&","∧":"\u2227","⩕":"\u2A55","⩜":"\u2A5C","⩘":"\u2A58","⩚":"\u2A5A","∠":"\u2220","⦤":"\u29A4","∠":"\u2220","∡":"\u2221","⦨":"\u29A8","⦩":"\u29A9","⦪":"\u29AA","⦫":"\u29AB","⦬":"\u29AC","⦭":"\u29AD","⦮":"\u29AE","⦯":"\u29AF","∟":"\u221F","⊾":"\u22BE","⦝":"\u299D","∢":"\u2222","Å":"\xC5","⍼":"\u237C","ą":"\u0105","𝕒":"\u{1D552}","≈":"\u2248","⩰":"\u2A70","⩯":"\u2A6F","≊":"\u224A","≋":"\u224B","'":"'","≈":"\u2248","≊":"\u224A","å":"\xE5","å":"\xE5","𝒶":"\u{1D4B6}","*":"*","≈":"\u2248","≍":"\u224D","ã":"\xE3","ã":"\xE3","ä":"\xE4","ä":"\xE4","∳":"\u2233","⨑":"\u2A11","⫭":"\u2AED","≌":"\u224C","϶":"\u03F6","‵":"\u2035","∽":"\u223D","⋍":"\u22CD","⊽":"\u22BD","⌅":"\u2305","⌅":"\u2305","⎵":"\u23B5","⎶":"\u23B6","≌":"\u224C","б":"\u0431","„":"\u201E","∵":"\u2235","∵":"\u2235","⦰":"\u29B0","϶":"\u03F6","ℬ":"\u212C","β":"\u03B2","ℶ":"\u2136","≬":"\u226C","𝔟":"\u{1D51F}","⋂":"\u22C2","◯":"\u25EF","⋃":"\u22C3","⨀":"\u2A00","⨁":"\u2A01","⨂":"\u2A02","⨆":"\u2A06","★":"\u2605","▽":"\u25BD","△":"\u25B3","⨄":"\u2A04","⋁":"\u22C1","⋀":"\u22C0","⤍":"\u290D","⧫":"\u29EB","▪":"\u25AA","▴":"\u25B4","▾":"\u25BE","◂":"\u25C2","▸":"\u25B8","␣":"\u2423","▒":"\u2592","░":"\u2591","▓":"\u2593","█":"\u2588","=⃥":"=\u20E5","≡⃥":"\u2261\u20E5","⌐":"\u2310","𝕓":"\u{1D553}","⊥":"\u22A5","⊥":"\u22A5","⋈":"\u22C8","╗":"\u2557","╔":"\u2554","╖":"\u2556","╓":"\u2553","═":"\u2550","╦":"\u2566","╩":"\u2569","╤":"\u2564","╧":"\u2567","╝":"\u255D","╚":"\u255A","╜":"\u255C","╙":"\u2559","║":"\u2551","╬":"\u256C","╣":"\u2563","╠":"\u2560","╫":"\u256B","╢":"\u2562","╟":"\u255F","⧉":"\u29C9","╕":"\u2555","╒":"\u2552","┐":"\u2510","┌":"\u250C","─":"\u2500","╥":"\u2565","╨":"\u2568","┬":"\u252C","┴":"\u2534","⊟":"\u229F","⊞":"\u229E","⊠":"\u22A0","╛":"\u255B","╘":"\u2558","┘":"\u2518","└":"\u2514","│":"\u2502","╪":"\u256A","╡":"\u2561","╞":"\u255E","┼":"\u253C","┤":"\u2524","├":"\u251C","‵":"\u2035","˘":"\u02D8","¦":"\xA6","¦":"\xA6","𝒷":"\u{1D4B7}","⁏":"\u204F","∽":"\u223D","⋍":"\u22CD","\":"\\","⧅":"\u29C5","⟈":"\u27C8","•":"\u2022","•":"\u2022","≎":"\u224E","⪮":"\u2AAE","≏":"\u224F","≏":"\u224F","ć":"\u0107","∩":"\u2229","⩄":"\u2A44","⩉":"\u2A49","⩋":"\u2A4B","⩇":"\u2A47","⩀":"\u2A40","∩︀":"\u2229\uFE00","⁁":"\u2041","ˇ":"\u02C7","⩍":"\u2A4D","č":"\u010D","ç":"\xE7","ç":"\xE7","ĉ":"\u0109","⩌":"\u2A4C","⩐":"\u2A50","ċ":"\u010B","¸":"\xB8","¸":"\xB8","⦲":"\u29B2","¢":"\xA2","¢":"\xA2","·":"\xB7","𝔠":"\u{1D520}","ч":"\u0447","✓":"\u2713","✓":"\u2713","χ":"\u03C7","○":"\u25CB","⧃":"\u29C3","ˆ":"\u02C6","≗":"\u2257","↺":"\u21BA","↻":"\u21BB","®":"\xAE","Ⓢ":"\u24C8","⊛":"\u229B","⊚":"\u229A","⊝":"\u229D","≗":"\u2257","⨐":"\u2A10","⫯":"\u2AEF","⧂":"\u29C2","♣":"\u2663","♣":"\u2663",":":":","≔":"\u2254","≔":"\u2254",",":",","@":"@","∁":"\u2201","∘":"\u2218","∁":"\u2201","ℂ":"\u2102","≅":"\u2245","⩭":"\u2A6D","∮":"\u222E","𝕔":"\u{1D554}","∐":"\u2210","©":"\xA9","©":"\xA9","℗":"\u2117","↵":"\u21B5","✗":"\u2717","𝒸":"\u{1D4B8}","⫏":"\u2ACF","⫑":"\u2AD1","⫐":"\u2AD0","⫒":"\u2AD2","⋯":"\u22EF","⤸":"\u2938","⤵":"\u2935","⋞":"\u22DE","⋟":"\u22DF","↶":"\u21B6","⤽":"\u293D","∪":"\u222A","⩈":"\u2A48","⩆":"\u2A46","⩊":"\u2A4A","⊍":"\u228D","⩅":"\u2A45","∪︀":"\u222A\uFE00","↷":"\u21B7","⤼":"\u293C","⋞":"\u22DE","⋟":"\u22DF","⋎":"\u22CE","⋏":"\u22CF","¤":"\xA4","¤":"\xA4","↶":"\u21B6","↷":"\u21B7","⋎":"\u22CE","⋏":"\u22CF","∲":"\u2232","∱":"\u2231","⌭":"\u232D","⇓":"\u21D3","⥥":"\u2965","†":"\u2020","ℸ":"\u2138","↓":"\u2193","‐":"\u2010","⊣":"\u22A3","⤏":"\u290F","˝":"\u02DD","ď":"\u010F","д":"\u0434","ⅆ":"\u2146","‡":"\u2021","⇊":"\u21CA","⩷":"\u2A77","°":"\xB0","°":"\xB0","δ":"\u03B4","⦱":"\u29B1","⥿":"\u297F","𝔡":"\u{1D521}","⇃":"\u21C3","⇂":"\u21C2","⋄":"\u22C4","⋄":"\u22C4","♦":"\u2666","♦":"\u2666","¨":"\xA8","ϝ":"\u03DD","⋲":"\u22F2","÷":"\xF7","÷":"\xF7","÷":"\xF7","⋇":"\u22C7","⋇":"\u22C7","ђ":"\u0452","⌞":"\u231E","⌍":"\u230D","$":"$","𝕕":"\u{1D555}","˙":"\u02D9","≐":"\u2250","≑":"\u2251","∸":"\u2238","∔":"\u2214","⊡":"\u22A1","⌆":"\u2306","↓":"\u2193","⇊":"\u21CA","⇃":"\u21C3","⇂":"\u21C2","⤐":"\u2910","⌟":"\u231F","⌌":"\u230C","𝒹":"\u{1D4B9}","ѕ":"\u0455","⧶":"\u29F6","đ":"\u0111","⋱":"\u22F1","▿":"\u25BF","▾":"\u25BE","⇵":"\u21F5","⥯":"\u296F","⦦":"\u29A6","џ":"\u045F","⟿":"\u27FF","⩷":"\u2A77","≑":"\u2251","é":"\xE9","é":"\xE9","⩮":"\u2A6E","ě":"\u011B","≖":"\u2256","ê":"\xEA","ê":"\xEA","≕":"\u2255","э":"\u044D","ė":"\u0117","ⅇ":"\u2147","≒":"\u2252","𝔢":"\u{1D522}","⪚":"\u2A9A","è":"\xE8","è":"\xE8","⪖":"\u2A96","⪘":"\u2A98","⪙":"\u2A99","⏧":"\u23E7","ℓ":"\u2113","⪕":"\u2A95","⪗":"\u2A97","ē":"\u0113","∅":"\u2205","∅":"\u2205","∅":"\u2205"," ":"\u2004"," ":"\u2005"," ":"\u2003","ŋ":"\u014B"," ":"\u2002","ę":"\u0119","𝕖":"\u{1D556}","⋕":"\u22D5","⧣":"\u29E3","⩱":"\u2A71","ε":"\u03B5","ε":"\u03B5","ϵ":"\u03F5","≖":"\u2256","≕":"\u2255","≂":"\u2242","⪖":"\u2A96","⪕":"\u2A95","=":"=","≟":"\u225F","≡":"\u2261","⩸":"\u2A78","⧥":"\u29E5","≓":"\u2253","⥱":"\u2971","ℯ":"\u212F","≐":"\u2250","≂":"\u2242","η":"\u03B7","ð":"\xF0","ð":"\xF0","ë":"\xEB","ë":"\xEB","€":"\u20AC","!":"!","∃":"\u2203","ℰ":"\u2130","ⅇ":"\u2147","≒":"\u2252","ф":"\u0444","♀":"\u2640","ffi":"\uFB03","ff":"\uFB00","ffl":"\uFB04","𝔣":"\u{1D523}","fi":"\uFB01","fj":"fj","♭":"\u266D","fl":"\uFB02","▱":"\u25B1","ƒ":"\u0192","𝕗":"\u{1D557}","∀":"\u2200","⋔":"\u22D4","⫙":"\u2AD9","⨍":"\u2A0D","½":"\xBD","½":"\xBD","⅓":"\u2153","¼":"\xBC","¼":"\xBC","⅕":"\u2155","⅙":"\u2159","⅛":"\u215B","⅔":"\u2154","⅖":"\u2156","¾":"\xBE","¾":"\xBE","⅗":"\u2157","⅜":"\u215C","⅘":"\u2158","⅚":"\u215A","⅝":"\u215D","⅞":"\u215E","⁄":"\u2044","⌢":"\u2322","𝒻":"\u{1D4BB}","≧":"\u2267","⪌":"\u2A8C","ǵ":"\u01F5","γ":"\u03B3","ϝ":"\u03DD","⪆":"\u2A86","ğ":"\u011F","ĝ":"\u011D","г":"\u0433","ġ":"\u0121","≥":"\u2265","⋛":"\u22DB","≥":"\u2265","≧":"\u2267","⩾":"\u2A7E","⩾":"\u2A7E","⪩":"\u2AA9","⪀":"\u2A80","⪂":"\u2A82","⪄":"\u2A84","⋛︀":"\u22DB\uFE00","⪔":"\u2A94","𝔤":"\u{1D524}","≫":"\u226B","⋙":"\u22D9","ℷ":"\u2137","ѓ":"\u0453","≷":"\u2277","⪒":"\u2A92","⪥":"\u2AA5","⪤":"\u2AA4","≩":"\u2269","⪊":"\u2A8A","⪊":"\u2A8A","⪈":"\u2A88","⪈":"\u2A88","≩":"\u2269","⋧":"\u22E7","𝕘":"\u{1D558}","`":"`","ℊ":"\u210A","≳":"\u2273","⪎":"\u2A8E","⪐":"\u2A90",">":">",">":">","⪧":"\u2AA7","⩺":"\u2A7A","⋗":"\u22D7","⦕":"\u2995","⩼":"\u2A7C","⪆":"\u2A86","⥸":"\u2978","⋗":"\u22D7","⋛":"\u22DB","⪌":"\u2A8C","≷":"\u2277","≳":"\u2273","≩︀":"\u2269\uFE00","≩︀":"\u2269\uFE00","⇔":"\u21D4"," ":"\u200A","½":"\xBD","ℋ":"\u210B","ъ":"\u044A","↔":"\u2194","⥈":"\u2948","↭":"\u21AD","ℏ":"\u210F","ĥ":"\u0125","♥":"\u2665","♥":"\u2665","…":"\u2026","⊹":"\u22B9","𝔥":"\u{1D525}","⤥":"\u2925","⤦":"\u2926","⇿":"\u21FF","∻":"\u223B","↩":"\u21A9","↪":"\u21AA","𝕙":"\u{1D559}","―":"\u2015","𝒽":"\u{1D4BD}","ℏ":"\u210F","ħ":"\u0127","⁃":"\u2043","‐":"\u2010","í":"\xED","í":"\xED","⁣":"\u2063","î":"\xEE","î":"\xEE","и":"\u0438","е":"\u0435","¡":"\xA1","¡":"\xA1","⇔":"\u21D4","𝔦":"\u{1D526}","ì":"\xEC","ì":"\xEC","ⅈ":"\u2148","⨌":"\u2A0C","∭":"\u222D","⧜":"\u29DC","℩":"\u2129","ij":"\u0133","ī":"\u012B","ℑ":"\u2111","ℐ":"\u2110","ℑ":"\u2111","ı":"\u0131","⊷":"\u22B7","Ƶ":"\u01B5","∈":"\u2208","℅":"\u2105","∞":"\u221E","⧝":"\u29DD","ı":"\u0131","∫":"\u222B","⊺":"\u22BA","ℤ":"\u2124","⊺":"\u22BA","⨗":"\u2A17","⨼":"\u2A3C","ё":"\u0451","į":"\u012F","𝕚":"\u{1D55A}","ι":"\u03B9","⨼":"\u2A3C","¿":"\xBF","¿":"\xBF","𝒾":"\u{1D4BE}","∈":"\u2208","⋹":"\u22F9","⋵":"\u22F5","⋴":"\u22F4","⋳":"\u22F3","∈":"\u2208","⁢":"\u2062","ĩ":"\u0129","і":"\u0456","ï":"\xEF","ï":"\xEF","ĵ":"\u0135","й":"\u0439","𝔧":"\u{1D527}","ȷ":"\u0237","𝕛":"\u{1D55B}","𝒿":"\u{1D4BF}","ј":"\u0458","є":"\u0454","κ":"\u03BA","ϰ":"\u03F0","ķ":"\u0137","к":"\u043A","𝔨":"\u{1D528}","ĸ":"\u0138","х":"\u0445","ќ":"\u045C","𝕜":"\u{1D55C}","𝓀":"\u{1D4C0}","⇚":"\u21DA","⇐":"\u21D0","⤛":"\u291B","⤎":"\u290E","≦":"\u2266","⪋":"\u2A8B","⥢":"\u2962","ĺ":"\u013A","⦴":"\u29B4","ℒ":"\u2112","λ":"\u03BB","⟨":"\u27E8","⦑":"\u2991","⟨":"\u27E8","⪅":"\u2A85","«":"\xAB","«":"\xAB","←":"\u2190","⇤":"\u21E4","⤟":"\u291F","⤝":"\u291D","↩":"\u21A9","↫":"\u21AB","⤹":"\u2939","⥳":"\u2973","↢":"\u21A2","⪫":"\u2AAB","⤙":"\u2919","⪭":"\u2AAD","⪭︀":"\u2AAD\uFE00","⤌":"\u290C","❲":"\u2772","{":"{","[":"[","⦋":"\u298B","⦏":"\u298F","⦍":"\u298D","ľ":"\u013E","ļ":"\u013C","⌈":"\u2308","{":"{","л":"\u043B","⤶":"\u2936","“":"\u201C","„":"\u201E","⥧":"\u2967","⥋":"\u294B","↲":"\u21B2","≤":"\u2264","←":"\u2190","↢":"\u21A2","↽":"\u21BD","↼":"\u21BC","⇇":"\u21C7","↔":"\u2194","⇆":"\u21C6","⇋":"\u21CB","↭":"\u21AD","⋋":"\u22CB","⋚":"\u22DA","≤":"\u2264","≦":"\u2266","⩽":"\u2A7D","⩽":"\u2A7D","⪨":"\u2AA8","⩿":"\u2A7F","⪁":"\u2A81","⪃":"\u2A83","⋚︀":"\u22DA\uFE00","⪓":"\u2A93","⪅":"\u2A85","⋖":"\u22D6","⋚":"\u22DA","⪋":"\u2A8B","≶":"\u2276","≲":"\u2272","⥼":"\u297C","⌊":"\u230A","𝔩":"\u{1D529}","≶":"\u2276","⪑":"\u2A91","↽":"\u21BD","↼":"\u21BC","⥪":"\u296A","▄":"\u2584","љ":"\u0459","≪":"\u226A","⇇":"\u21C7","⌞":"\u231E","⥫":"\u296B","◺":"\u25FA","ŀ":"\u0140","⎰":"\u23B0","⎰":"\u23B0","≨":"\u2268","⪉":"\u2A89","⪉":"\u2A89","⪇":"\u2A87","⪇":"\u2A87","≨":"\u2268","⋦":"\u22E6","⟬":"\u27EC","⇽":"\u21FD","⟦":"\u27E6","⟵":"\u27F5","⟷":"\u27F7","⟼":"\u27FC","⟶":"\u27F6","↫":"\u21AB","↬":"\u21AC","⦅":"\u2985","𝕝":"\u{1D55D}","⨭":"\u2A2D","⨴":"\u2A34","∗":"\u2217","_":"_","◊":"\u25CA","◊":"\u25CA","⧫":"\u29EB","(":"(","⦓":"\u2993","⇆":"\u21C6","⌟":"\u231F","⇋":"\u21CB","⥭":"\u296D","‎":"\u200E","⊿":"\u22BF","‹":"\u2039","𝓁":"\u{1D4C1}","↰":"\u21B0","≲":"\u2272","⪍":"\u2A8D","⪏":"\u2A8F","[":"[","‘":"\u2018","‚":"\u201A","ł":"\u0142","<":"<","<":"<","⪦":"\u2AA6","⩹":"\u2A79","⋖":"\u22D6","⋋":"\u22CB","⋉":"\u22C9","⥶":"\u2976","⩻":"\u2A7B","⦖":"\u2996","◃":"\u25C3","⊴":"\u22B4","◂":"\u25C2","⥊":"\u294A","⥦":"\u2966","≨︀":"\u2268\uFE00","≨︀":"\u2268\uFE00","∺":"\u223A","¯":"\xAF","¯":"\xAF","♂":"\u2642","✠":"\u2720","✠":"\u2720","↦":"\u21A6","↦":"\u21A6","↧":"\u21A7","↤":"\u21A4","↥":"\u21A5","▮":"\u25AE","⨩":"\u2A29","м":"\u043C","—":"\u2014","∡":"\u2221","𝔪":"\u{1D52A}","℧":"\u2127","µ":"\xB5","µ":"\xB5","∣":"\u2223","*":"*","⫰":"\u2AF0","·":"\xB7","·":"\xB7","−":"\u2212","⊟":"\u229F","∸":"\u2238","⨪":"\u2A2A","⫛":"\u2ADB","…":"\u2026","∓":"\u2213","⊧":"\u22A7","𝕞":"\u{1D55E}","∓":"\u2213","𝓂":"\u{1D4C2}","∾":"\u223E","μ":"\u03BC","⊸":"\u22B8","⊸":"\u22B8","⋙̸":"\u22D9\u0338","≫⃒":"\u226B\u20D2","≫̸":"\u226B\u0338","⇍":"\u21CD","⇎":"\u21CE","⋘̸":"\u22D8\u0338","≪⃒":"\u226A\u20D2","≪̸":"\u226A\u0338","⇏":"\u21CF","⊯":"\u22AF","⊮":"\u22AE","∇":"\u2207","ń":"\u0144","∠⃒":"\u2220\u20D2","≉":"\u2249","⩰̸":"\u2A70\u0338","≋̸":"\u224B\u0338","ʼn":"\u0149","≉":"\u2249","♮":"\u266E","♮":"\u266E","ℕ":"\u2115"," ":"\xA0"," ":"\xA0","≎̸":"\u224E\u0338","≏̸":"\u224F\u0338","⩃":"\u2A43","ň":"\u0148","ņ":"\u0146","≇":"\u2247","⩭̸":"\u2A6D\u0338","⩂":"\u2A42","н":"\u043D","–":"\u2013","≠":"\u2260","⇗":"\u21D7","⤤":"\u2924","↗":"\u2197","↗":"\u2197","≐̸":"\u2250\u0338","≢":"\u2262","⤨":"\u2928","≂̸":"\u2242\u0338","∄":"\u2204","∄":"\u2204","𝔫":"\u{1D52B}","≧̸":"\u2267\u0338","≱":"\u2271","≱":"\u2271","≧̸":"\u2267\u0338","⩾̸":"\u2A7E\u0338","⩾̸":"\u2A7E\u0338","≵":"\u2275","≯":"\u226F","≯":"\u226F","⇎":"\u21CE","↮":"\u21AE","⫲":"\u2AF2","∋":"\u220B","⋼":"\u22FC","⋺":"\u22FA","∋":"\u220B","њ":"\u045A","⇍":"\u21CD","≦̸":"\u2266\u0338","↚":"\u219A","‥":"\u2025","≰":"\u2270","↚":"\u219A","↮":"\u21AE","≰":"\u2270","≦̸":"\u2266\u0338","⩽̸":"\u2A7D\u0338","⩽̸":"\u2A7D\u0338","≮":"\u226E","≴":"\u2274","≮":"\u226E","⋪":"\u22EA","⋬":"\u22EC","∤":"\u2224","𝕟":"\u{1D55F}","¬":"\xAC","¬":"\xAC","∉":"\u2209","⋹̸":"\u22F9\u0338","⋵̸":"\u22F5\u0338","∉":"\u2209","⋷":"\u22F7","⋶":"\u22F6","∌":"\u220C","∌":"\u220C","⋾":"\u22FE","⋽":"\u22FD","∦":"\u2226","∦":"\u2226","⫽⃥":"\u2AFD\u20E5","∂̸":"\u2202\u0338","⨔":"\u2A14","⊀":"\u2280","⋠":"\u22E0","⪯̸":"\u2AAF\u0338","⊀":"\u2280","⪯̸":"\u2AAF\u0338","⇏":"\u21CF","↛":"\u219B","⤳̸":"\u2933\u0338","↝̸":"\u219D\u0338","↛":"\u219B","⋫":"\u22EB","⋭":"\u22ED","⊁":"\u2281","⋡":"\u22E1","⪰̸":"\u2AB0\u0338","𝓃":"\u{1D4C3}","∤":"\u2224","∦":"\u2226","≁":"\u2241","≄":"\u2244","≄":"\u2244","∤":"\u2224","∦":"\u2226","⋢":"\u22E2","⋣":"\u22E3","⊄":"\u2284","⫅̸":"\u2AC5\u0338","⊈":"\u2288","⊂⃒":"\u2282\u20D2","⊈":"\u2288","⫅̸":"\u2AC5\u0338","⊁":"\u2281","⪰̸":"\u2AB0\u0338","⊅":"\u2285","⫆̸":"\u2AC6\u0338","⊉":"\u2289","⊃⃒":"\u2283\u20D2","⊉":"\u2289","⫆̸":"\u2AC6\u0338","≹":"\u2279","ñ":"\xF1","ñ":"\xF1","≸":"\u2278","⋪":"\u22EA","⋬":"\u22EC","⋫":"\u22EB","⋭":"\u22ED","ν":"\u03BD","#":"#","№":"\u2116"," ":"\u2007","⊭":"\u22AD","⤄":"\u2904","≍⃒":"\u224D\u20D2","⊬":"\u22AC","≥⃒":"\u2265\u20D2",">⃒":">\u20D2","⧞":"\u29DE","⤂":"\u2902","≤⃒":"\u2264\u20D2","<⃒":"<\u20D2","⊴⃒":"\u22B4\u20D2","⤃":"\u2903","⊵⃒":"\u22B5\u20D2","∼⃒":"\u223C\u20D2","⇖":"\u21D6","⤣":"\u2923","↖":"\u2196","↖":"\u2196","⤧":"\u2927","Ⓢ":"\u24C8","ó":"\xF3","ó":"\xF3","⊛":"\u229B","⊚":"\u229A","ô":"\xF4","ô":"\xF4","о":"\u043E","⊝":"\u229D","ő":"\u0151","⨸":"\u2A38","⊙":"\u2299","⦼":"\u29BC","œ":"\u0153","⦿":"\u29BF","𝔬":"\u{1D52C}","˛":"\u02DB","ò":"\xF2","ò":"\xF2","⧁":"\u29C1","⦵":"\u29B5","Ω":"\u03A9","∮":"\u222E","↺":"\u21BA","⦾":"\u29BE","⦻":"\u29BB","‾":"\u203E","⧀":"\u29C0","ō":"\u014D","ω":"\u03C9","ο":"\u03BF","⦶":"\u29B6","⊖":"\u2296","𝕠":"\u{1D560}","⦷":"\u29B7","⦹":"\u29B9","⊕":"\u2295","∨":"\u2228","↻":"\u21BB","⩝":"\u2A5D","ℴ":"\u2134","ℴ":"\u2134","ª":"\xAA","ª":"\xAA","º":"\xBA","º":"\xBA","⊶":"\u22B6","⩖":"\u2A56","⩗":"\u2A57","⩛":"\u2A5B","ℴ":"\u2134","ø":"\xF8","ø":"\xF8","⊘":"\u2298","õ":"\xF5","õ":"\xF5","⊗":"\u2297","⨶":"\u2A36","ö":"\xF6","ö":"\xF6","⌽":"\u233D","∥":"\u2225","¶":"\xB6","¶":"\xB6","∥":"\u2225","⫳":"\u2AF3","⫽":"\u2AFD","∂":"\u2202","п":"\u043F","%":"%",".":".","‰":"\u2030","⊥":"\u22A5","‱":"\u2031","𝔭":"\u{1D52D}","φ":"\u03C6","ϕ":"\u03D5","ℳ":"\u2133","☎":"\u260E","π":"\u03C0","⋔":"\u22D4","ϖ":"\u03D6","ℏ":"\u210F","ℎ":"\u210E","ℏ":"\u210F","+":"+","⨣":"\u2A23","⊞":"\u229E","⨢":"\u2A22","∔":"\u2214","⨥":"\u2A25","⩲":"\u2A72","±":"\xB1","±":"\xB1","⨦":"\u2A26","⨧":"\u2A27","±":"\xB1","⨕":"\u2A15","𝕡":"\u{1D561}","£":"\xA3","£":"\xA3","≺":"\u227A","⪳":"\u2AB3","⪷":"\u2AB7","≼":"\u227C","⪯":"\u2AAF","≺":"\u227A","⪷":"\u2AB7","≼":"\u227C","⪯":"\u2AAF","⪹":"\u2AB9","⪵":"\u2AB5","⋨":"\u22E8","≾":"\u227E","′":"\u2032","ℙ":"\u2119","⪵":"\u2AB5","⪹":"\u2AB9","⋨":"\u22E8","∏":"\u220F","⌮":"\u232E","⌒":"\u2312","⌓":"\u2313","∝":"\u221D","∝":"\u221D","≾":"\u227E","⊰":"\u22B0","𝓅":"\u{1D4C5}","ψ":"\u03C8"," ":"\u2008","𝔮":"\u{1D52E}","⨌":"\u2A0C","𝕢":"\u{1D562}","⁗":"\u2057","𝓆":"\u{1D4C6}","ℍ":"\u210D","⨖":"\u2A16","?":"?","≟":"\u225F",""":'"',""":'"',"⇛":"\u21DB","⇒":"\u21D2","⤜":"\u291C","⤏":"\u290F","⥤":"\u2964","∽̱":"\u223D\u0331","ŕ":"\u0155","√":"\u221A","⦳":"\u29B3","⟩":"\u27E9","⦒":"\u2992","⦥":"\u29A5","⟩":"\u27E9","»":"\xBB","»":"\xBB","→":"\u2192","⥵":"\u2975","⇥":"\u21E5","⤠":"\u2920","⤳":"\u2933","⤞":"\u291E","↪":"\u21AA","↬":"\u21AC","⥅":"\u2945","⥴":"\u2974","↣":"\u21A3","↝":"\u219D","⤚":"\u291A","∶":"\u2236","ℚ":"\u211A","⤍":"\u290D","❳":"\u2773","}":"}","]":"]","⦌":"\u298C","⦎":"\u298E","⦐":"\u2990","ř":"\u0159","ŗ":"\u0157","⌉":"\u2309","}":"}","р":"\u0440","⤷":"\u2937","⥩":"\u2969","”":"\u201D","”":"\u201D","↳":"\u21B3","ℜ":"\u211C","ℛ":"\u211B","ℜ":"\u211C","ℝ":"\u211D","▭":"\u25AD","®":"\xAE","®":"\xAE","⥽":"\u297D","⌋":"\u230B","𝔯":"\u{1D52F}","⇁":"\u21C1","⇀":"\u21C0","⥬":"\u296C","ρ":"\u03C1","ϱ":"\u03F1","→":"\u2192","↣":"\u21A3","⇁":"\u21C1","⇀":"\u21C0","⇄":"\u21C4","⇌":"\u21CC","⇉":"\u21C9","↝":"\u219D","⋌":"\u22CC","˚":"\u02DA","≓":"\u2253","⇄":"\u21C4","⇌":"\u21CC","‏":"\u200F","⎱":"\u23B1","⎱":"\u23B1","⫮":"\u2AEE","⟭":"\u27ED","⇾":"\u21FE","⟧":"\u27E7","⦆":"\u2986","𝕣":"\u{1D563}","⨮":"\u2A2E","⨵":"\u2A35",")":")","⦔":"\u2994","⨒":"\u2A12","⇉":"\u21C9","›":"\u203A","𝓇":"\u{1D4C7}","↱":"\u21B1","]":"]","’":"\u2019","’":"\u2019","⋌":"\u22CC","⋊":"\u22CA","▹":"\u25B9","⊵":"\u22B5","▸":"\u25B8","⧎":"\u29CE","⥨":"\u2968","℞":"\u211E","ś":"\u015B","‚":"\u201A","≻":"\u227B","⪴":"\u2AB4","⪸":"\u2AB8","š":"\u0161","≽":"\u227D","⪰":"\u2AB0","ş":"\u015F","ŝ":"\u015D","⪶":"\u2AB6","⪺":"\u2ABA","⋩":"\u22E9","⨓":"\u2A13","≿":"\u227F","с":"\u0441","⋅":"\u22C5","⊡":"\u22A1","⩦":"\u2A66","⇘":"\u21D8","⤥":"\u2925","↘":"\u2198","↘":"\u2198","§":"\xA7","§":"\xA7",";":";","⤩":"\u2929","∖":"\u2216","∖":"\u2216","✶":"\u2736","𝔰":"\u{1D530}","⌢":"\u2322","♯":"\u266F","щ":"\u0449","ш":"\u0448","∣":"\u2223","∥":"\u2225","­":"\xAD","­":"\xAD","σ":"\u03C3","ς":"\u03C2","ς":"\u03C2","∼":"\u223C","⩪":"\u2A6A","≃":"\u2243","≃":"\u2243","⪞":"\u2A9E","⪠":"\u2AA0","⪝":"\u2A9D","⪟":"\u2A9F","≆":"\u2246","⨤":"\u2A24","⥲":"\u2972","←":"\u2190","∖":"\u2216","⨳":"\u2A33","⧤":"\u29E4","∣":"\u2223","⌣":"\u2323","⪪":"\u2AAA","⪬":"\u2AAC","⪬︀":"\u2AAC\uFE00","ь":"\u044C","/":"/","⧄":"\u29C4","⌿":"\u233F","𝕤":"\u{1D564}","♠":"\u2660","♠":"\u2660","∥":"\u2225","⊓":"\u2293","⊓︀":"\u2293\uFE00","⊔":"\u2294","⊔︀":"\u2294\uFE00","⊏":"\u228F","⊑":"\u2291","⊏":"\u228F","⊑":"\u2291","⊐":"\u2290","⊒":"\u2292","⊐":"\u2290","⊒":"\u2292","□":"\u25A1","□":"\u25A1","▪":"\u25AA","▪":"\u25AA","→":"\u2192","𝓈":"\u{1D4C8}","∖":"\u2216","⌣":"\u2323","⋆":"\u22C6","☆":"\u2606","★":"\u2605","ϵ":"\u03F5","ϕ":"\u03D5","¯":"\xAF","⊂":"\u2282","⫅":"\u2AC5","⪽":"\u2ABD","⊆":"\u2286","⫃":"\u2AC3","⫁":"\u2AC1","⫋":"\u2ACB","⊊":"\u228A","⪿":"\u2ABF","⥹":"\u2979","⊂":"\u2282","⊆":"\u2286","⫅":"\u2AC5","⊊":"\u228A","⫋":"\u2ACB","⫇":"\u2AC7","⫕":"\u2AD5","⫓":"\u2AD3","≻":"\u227B","⪸":"\u2AB8","≽":"\u227D","⪰":"\u2AB0","⪺":"\u2ABA","⪶":"\u2AB6","⋩":"\u22E9","≿":"\u227F","∑":"\u2211","♪":"\u266A","¹":"\xB9","¹":"\xB9","²":"\xB2","²":"\xB2","³":"\xB3","³":"\xB3","⊃":"\u2283","⫆":"\u2AC6","⪾":"\u2ABE","⫘":"\u2AD8","⊇":"\u2287","⫄":"\u2AC4","⟉":"\u27C9","⫗":"\u2AD7","⥻":"\u297B","⫂":"\u2AC2","⫌":"\u2ACC","⊋":"\u228B","⫀":"\u2AC0","⊃":"\u2283","⊇":"\u2287","⫆":"\u2AC6","⊋":"\u228B","⫌":"\u2ACC","⫈":"\u2AC8","⫔":"\u2AD4","⫖":"\u2AD6","⇙":"\u21D9","⤦":"\u2926","↙":"\u2199","↙":"\u2199","⤪":"\u292A","ß":"\xDF","ß":"\xDF","⌖":"\u2316","τ":"\u03C4","⎴":"\u23B4","ť":"\u0165","ţ":"\u0163","т":"\u0442","⃛":"\u20DB","⌕":"\u2315","𝔱":"\u{1D531}","∴":"\u2234","∴":"\u2234","θ":"\u03B8","ϑ":"\u03D1","ϑ":"\u03D1","≈":"\u2248","∼":"\u223C"," ":"\u2009","≈":"\u2248","∼":"\u223C","þ":"\xFE","þ":"\xFE","˜":"\u02DC","×":"\xD7","×":"\xD7","⊠":"\u22A0","⨱":"\u2A31","⨰":"\u2A30","∭":"\u222D","⤨":"\u2928","⊤":"\u22A4","⌶":"\u2336","⫱":"\u2AF1","𝕥":"\u{1D565}","⫚":"\u2ADA","⤩":"\u2929","‴":"\u2034","™":"\u2122","▵":"\u25B5","▿":"\u25BF","◃":"\u25C3","⊴":"\u22B4","≜":"\u225C","▹":"\u25B9","⊵":"\u22B5","◬":"\u25EC","≜":"\u225C","⨺":"\u2A3A","⨹":"\u2A39","⧍":"\u29CD","⨻":"\u2A3B","⏢":"\u23E2","𝓉":"\u{1D4C9}","ц":"\u0446","ћ":"\u045B","ŧ":"\u0167","≬":"\u226C","↞":"\u219E","↠":"\u21A0","⇑":"\u21D1","⥣":"\u2963","ú":"\xFA","ú":"\xFA","↑":"\u2191","ў":"\u045E","ŭ":"\u016D","û":"\xFB","û":"\xFB","у":"\u0443","⇅":"\u21C5","ű":"\u0171","⥮":"\u296E","⥾":"\u297E","𝔲":"\u{1D532}","ù":"\xF9","ù":"\xF9","↿":"\u21BF","↾":"\u21BE","▀":"\u2580","⌜":"\u231C","⌜":"\u231C","⌏":"\u230F","◸":"\u25F8","ū":"\u016B","¨":"\xA8","¨":"\xA8","ų":"\u0173","𝕦":"\u{1D566}","↑":"\u2191","↕":"\u2195","↿":"\u21BF","↾":"\u21BE","⊎":"\u228E","υ":"\u03C5","ϒ":"\u03D2","υ":"\u03C5","⇈":"\u21C8","⌝":"\u231D","⌝":"\u231D","⌎":"\u230E","ů":"\u016F","◹":"\u25F9","𝓊":"\u{1D4CA}","⋰":"\u22F0","ũ":"\u0169","▵":"\u25B5","▴":"\u25B4","⇈":"\u21C8","ü":"\xFC","ü":"\xFC","⦧":"\u29A7","⇕":"\u21D5","⫨":"\u2AE8","⫩":"\u2AE9","⊨":"\u22A8","⦜":"\u299C","ϵ":"\u03F5","ϰ":"\u03F0","∅":"\u2205","ϕ":"\u03D5","ϖ":"\u03D6","∝":"\u221D","↕":"\u2195","ϱ":"\u03F1","ς":"\u03C2","⊊︀":"\u228A\uFE00","⫋︀":"\u2ACB\uFE00","⊋︀":"\u228B\uFE00","⫌︀":"\u2ACC\uFE00","ϑ":"\u03D1","⊲":"\u22B2","⊳":"\u22B3","в":"\u0432","⊢":"\u22A2","∨":"\u2228","⊻":"\u22BB","≚":"\u225A","⋮":"\u22EE","|":"|","|":"|","𝔳":"\u{1D533}","⊲":"\u22B2","⊂⃒":"\u2282\u20D2","⊃⃒":"\u2283\u20D2","𝕧":"\u{1D567}","∝":"\u221D","⊳":"\u22B3","𝓋":"\u{1D4CB}","⫋︀":"\u2ACB\uFE00","⊊︀":"\u228A\uFE00","⫌︀":"\u2ACC\uFE00","⊋︀":"\u228B\uFE00","⦚":"\u299A","ŵ":"\u0175","⩟":"\u2A5F","∧":"\u2227","≙":"\u2259","℘":"\u2118","𝔴":"\u{1D534}","𝕨":"\u{1D568}","℘":"\u2118","≀":"\u2240","≀":"\u2240","𝓌":"\u{1D4CC}","⋂":"\u22C2","◯":"\u25EF","⋃":"\u22C3","▽":"\u25BD","𝔵":"\u{1D535}","⟺":"\u27FA","⟷":"\u27F7","ξ":"\u03BE","⟸":"\u27F8","⟵":"\u27F5","⟼":"\u27FC","⋻":"\u22FB","⨀":"\u2A00","𝕩":"\u{1D569}","⨁":"\u2A01","⨂":"\u2A02","⟹":"\u27F9","⟶":"\u27F6","𝓍":"\u{1D4CD}","⨆":"\u2A06","⨄":"\u2A04","△":"\u25B3","⋁":"\u22C1","⋀":"\u22C0","ý":"\xFD","ý":"\xFD","я":"\u044F","ŷ":"\u0177","ы":"\u044B","¥":"\xA5","¥":"\xA5","𝔶":"\u{1D536}","ї":"\u0457","𝕪":"\u{1D56A}","𝓎":"\u{1D4CE}","ю":"\u044E","ÿ":"\xFF","ÿ":"\xFF","ź":"\u017A","ž":"\u017E","з":"\u0437","ż":"\u017C","ℨ":"\u2128","ζ":"\u03B6","𝔷":"\u{1D537}","ж":"\u0436","⇝":"\u21DD","𝕫":"\u{1D56B}","𝓏":"\u{1D4CF}","‍":"\u200D","‌":"\u200C"},Nn=hd;function gd(t){return t.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,r)=>{if(typeof Nn[e]=="string")return Nn[e];if(r.charAt(0)!=="#"||e.charAt(e.length-1)!==";")return e;let n;r.charAt(1)==="x"?n=parseInt(r.substr(2),16):n=parseInt(r.substr(1),10);let i="";return n>=55296&&n<=57343||n>1114111?"\uFFFD":(n>65535&&(n-=65536,i+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),i+=String.fromCharCode(n),i)})}function bt(t){return t.trim().replace(/[<>"'?&]/g,e=>{let r=e.charCodeAt(0).toString(16);return r.length<2&&(r="0"+r),"&#x"+r.toUpperCase()+";"})}function ko(t){return"<div>"+bt(t).replace(/\n/g,"<br />")+"</div>"}function Ao(t){return t=t.replace(/\r?\n/g,"").replace(/<\!\-\-.*?\-\->/gi," ").replace(/<br\b[^>]*>/gi,`
|
|
156
|
+
`}}}}).prompt();var cr=pe(rt(),1);yt();process.env.RESEND_USER_AGENT=`resend-cli:${te}`;var it=new TextEncoder,Si="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xt=new Uint8Array(256);for(let e=0;e<Si.length;e++)Xt[Si.charCodeAt(e)]=e;function Sr(e){let t=Math.ceil(e.length/4)*3,r=e.length,n=0;e.length%4===3?t--:e.length%4===2?t-=2:e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);let o=new ArrayBuffer(t),i=new Uint8Array(o);for(let s=0;s<r;s+=4){let a=Xt[e.charCodeAt(s)],l=Xt[e.charCodeAt(s+1)],d=Xt[e.charCodeAt(s+2)],c=Xt[e.charCodeAt(s+3)];i[n++]=a<<2|l>>4,i[n++]=(l&15)<<4|d>>2,i[n++]=(d&3)<<6|c&63}return o}function At(e){e=e||"utf8";let t;try{t=new TextDecoder(e)}catch{t=new TextDecoder("windows-1252")}return t}async function st(e){if("arrayBuffer"in e)return await e.arrayBuffer();let t=new FileReader;return new Promise((r,n)=>{t.onload=function(o){r(o.target.result)},t.onerror=function(o){n(t.error)},t.readAsArrayBuffer(e)})}function Ti(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70?String.fromCharCode(e):!1}function Od(e,t,r){let n=e.indexOf("*");n>=0&&(e=e.substr(0,n)),t=t.toUpperCase();let o;if(t==="Q"){r=r.replace(/=\s+([0-9a-fA-F])/g,"=$1").replace(/[_\s]/g," ");let i=it.encode(r),s=[];for(let l=0,d=i.length;l<d;l++){let c=i[l];if(l<=d-2&&c===61){let u=Ti(i[l+1]),p=Ti(i[l+2]);if(u&&p){let y=parseInt(u+p,16);s.push(y),l+=2;continue}}s.push(c)}o=new ArrayBuffer(s.length);let a=new DataView(o);for(let l=0,d=s.length;l<d;l++)a.setUint8(l,s[l])}else t==="B"?o=Sr(r.replace(/[^a-zA-Z0-9\+\/=]+/g,"")):o=it.encode(r);return At(e).decode(o)}function vt(e){let t=!0,r=!1;for(;!r;){let n=(e||"").toString().replace(/(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,(o,i,s,a,l)=>t&&s===l&&a.length%4===0&&!/=$/.test(a)?i+"__\0JOIN\0__":o).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(o,i,s,a)=>t&&s===a?i+"__\0JOIN\0__":o).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(o,i,s,a)=>Od(i,s,a));if(t&&n.indexOf("\uFFFD")>=0)t=!1;else return n}}function Id(e,t){t=t||"utf-8";let r=[];for(let i=0;i<e.length;i++){let s=e.charAt(i);if(s==="%"&&/^[a-f0-9]{2}/i.test(e.substr(i+1,2))){let a=e.substr(i+1,2);i+=2,r.push(parseInt(a,16))}else if(s.charCodeAt(0)>126){s=it.encode(s);for(let a=0;a<s.length;a++)r.push(s[a])}else r.push(s.charCodeAt(0))}let n=new ArrayBuffer(r.length),o=new DataView(n);for(let i=0,s=r.length;i<s;i++)o.setUint8(i,r[i]);return At(t).decode(n)}function Oi(e){let t=new Map;Object.keys(e.params).forEach(r=>{let n=r.match(/\*((\d+)\*?)?$/);if(!n)return;let o=r.substr(0,n.index).toLowerCase(),i=Number(n[2])||0,s;t.has(o)?s=t.get(o):(s={charset:!1,values:[]},t.set(o,s));let a=e.params[r];i===0&&n[0].charAt(n[0].length-1)==="*"&&(n=a.match(/^([^']*)'[^']*'(.*)$/))&&(s.charset=n[1]||"utf-8",a=n[2]),s.values.push({nr:i,value:a}),delete e.params[r]}),t.forEach((r,n)=>{e.params[n]=Id(r.values.sort((o,i)=>o.nr-i.nr).map(o=>o.value).join(""),r.charset)})}var Zt=class{constructor(){this.chunks=[]}update(t){this.chunks.push(t),this.chunks.push(`
|
|
157
|
+
`)}finalize(){return st(new Blob(this.chunks,{type:"application/octet-stream"}))}};var er=class{constructor(t){t=t||{},this.decoder=t.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.chunks=[],this.remainder=""}update(t){let r=this.decoder.decode(t);if(r=r.replace(/[^a-zA-Z0-9+\/]+/g,""),this.remainder+=r,this.remainder.length>=this.maxChunkSize){let n=Math.floor(this.remainder.length/4)*4,o;n===this.remainder.length?(o=this.remainder,this.remainder=""):(o=this.remainder.substr(0,n),this.remainder=this.remainder.substr(n)),o.length&&this.chunks.push(Sr(o))}}finalize(){return this.remainder&&!/^=+$/.test(this.remainder)&&this.chunks.push(Sr(this.remainder)),st(new Blob(this.chunks,{type:"application/octet-stream"}))}};var Ii=/^=[a-f0-9]{2}$/i,Pd=/(?==[a-f0-9]{2})/i,jd=/=\r?\n/g,Rd=/=[a-fA-F0-9]?$/,tr=class{constructor(t){t=t||{},this.decoder=t.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.remainder="",this.chunks=[]}decodeQPBytes(t){let r=new ArrayBuffer(t.length),n=new DataView(r);for(let o=0,i=t.length;o<i;o++)n.setUint8(o,parseInt(t[o],16));return r}decodeChunks(t){t=t.replace(jd,"");let r=t.split(Pd),n=[];for(let o of r){if(o.charAt(0)!=="="){n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(o);continue}if(o.length===3){Ii.test(o)?n.push(o.substr(1)):(n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(o));continue}if(o.length>3){let i=o.substr(0,3);Ii.test(i)?(n.push(o.substr(1,2)),this.chunks.push(this.decodeQPBytes(n)),n=[],o=o.substr(3),this.chunks.push(o)):(n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(o))}}n.length&&this.chunks.push(this.decodeQPBytes(n))}update(t){let r=this.decoder.decode(t)+`
|
|
158
|
+
`;if(r=this.remainder+r,r.length<this.maxChunkSize){this.remainder=r;return}this.remainder="";let n=r.match(Rd);if(n){if(n.index===0){this.remainder=r;return}this.remainder=r.substr(n.index),r=r.substr(0,n.index)}this.decodeChunks(r)}finalize(){return this.remainder.length&&(this.decodeChunks(this.remainder),this.remainder=""),st(new Blob(this.chunks,{type:"application/octet-stream"}))}};var Fd=At(),$t=class{constructor(t){if(this.options=t||{},this.postalMime=this.options.postalMime,this.root=!!this.options.parentNode,this.childNodes=[],this.options.parentNode){if(this.parentNode=this.options.parentNode,this.depth=this.parentNode.depth+1,this.depth>this.options.maxNestingDepth)throw new Error(`Maximum MIME nesting depth of ${this.options.maxNestingDepth} levels exceeded`);this.options.parentNode.childNodes.push(this)}else this.depth=0;this.state="header",this.headerLines=[],this.headerSize=0;let n=(this.options.parentMultipartType||null)==="digest"?"message/rfc822":"text/plain";this.contentType={value:n,default:!0},this.contentTransferEncoding={value:"8bit"},this.contentDisposition={value:""},this.headers=[],this.contentDecoder=!1}setupContentDecoder(t){/base64/i.test(t)?this.contentDecoder=new er:/quoted-printable/i.test(t)?this.contentDecoder=new tr({decoder:At(this.contentType.parsed.params.charset)}):this.contentDecoder=new Zt}async finalize(){if(this.state==="finished")return;this.state==="header"&&this.processHeaders();let t=this.postalMime.boundaries;for(let r=t.length-1;r>=0;r--)if(t[r].node===this){t.splice(r,1);break}await this.finalizeChildNodes(),this.content=this.contentDecoder?await this.contentDecoder.finalize():null,this.state="finished"}async finalizeChildNodes(){for(let t of this.childNodes)await t.finalize()}stripComments(t){let r="",n=0,o=!1,i=!1;for(let s=0;s<t.length;s++){let a=t.charAt(s);if(o){n===0&&(r+=a),o=!1;continue}if(a==="\\"){o=!0,n===0&&(r+=a);continue}if(a==='"'&&n===0){i=!i,r+=a;continue}if(!i){if(a==="("){n++;continue}if(a===")"&&n>0){n--;continue}}n===0&&(r+=a)}return r}parseStructuredHeader(t){t=this.stripComments(t);let r={value:!1,params:{}},n=!1,o="",i="value",s=!1,a=!1,l;for(let d=0,c=t.length;d<c;d++)switch(l=t.charAt(d),i){case"key":if(l==="="){n=o.trim().toLowerCase(),i="value",o="";break}o+=l;break;case"value":if(a)o+=l;else if(l==="\\"){a=!0;continue}else s&&l===s?s=!1:!s&&l==='"'?s=l:!s&&l===";"?(n===!1?r.value=o.trim():r.params[n]=o.trim(),i="key",o=""):o+=l;a=!1;break}return o=o.trim(),i==="value"?n===!1?r.value=o:r.params[n]=o:o&&(r.params[o.toLowerCase()]=""),r.value&&(r.value=r.value.toLowerCase()),Oi(r),r}decodeFlowedText(t,r){return t.split(/\r?\n/).reduce((n,o)=>n.endsWith(" ")&&n!=="-- "&&!n.endsWith(`
|
|
159
|
+
-- `)?r?n.slice(0,-1)+o:n+o:n+`
|
|
160
|
+
`+o).replace(/^ /gm,"")}getTextContent(){if(!this.content)return"";let t=At(this.contentType.parsed.params.charset).decode(this.content);return/^flowed$/i.test(this.contentType.parsed.params.format)&&(t=this.decodeFlowedText(t,/^yes$/i.test(this.contentType.parsed.params.delsp))),t}processHeaders(){for(let t=this.headerLines.length-1;t>=0;t--){let r=this.headerLines[t];t&&/^\s/.test(r)&&(this.headerLines[t-1]+=`
|
|
161
|
+
`+r,this.headerLines.splice(t,1))}this.rawHeaderLines=[];for(let t=this.headerLines.length-1;t>=0;t--){let r=this.headerLines[t],n=r.indexOf(":"),o=n<0?r.trim():r.substr(0,n).trim();this.rawHeaderLines.push({key:o.toLowerCase(),line:r});let i=r.replace(/\s+/g," ");n=i.indexOf(":");let s=n<0?i.trim():i.substr(0,n).trim(),a=n<0?"":i.substr(n+1).trim();switch(this.headers.push({key:s.toLowerCase(),originalKey:s,value:a}),s.toLowerCase()){case"content-type":this.contentType.default&&(this.contentType={value:a,parsed:{}});break;case"content-transfer-encoding":this.contentTransferEncoding={value:a,parsed:{}};break;case"content-disposition":this.contentDisposition={value:a,parsed:{}};break;case"content-id":this.contentId=a;break;case"content-description":this.contentDescription=a;break}}this.contentType.parsed=this.parseStructuredHeader(this.contentType.value),this.contentType.multipart=/^multipart\//i.test(this.contentType.parsed.value)?this.contentType.parsed.value.substr(this.contentType.parsed.value.indexOf("/")+1):!1,this.contentType.multipart&&this.contentType.parsed.params.boundary&&this.postalMime.boundaries.push({value:it.encode(this.contentType.parsed.params.boundary),node:this}),this.contentDisposition.parsed=this.parseStructuredHeader(this.contentDisposition.value),this.contentTransferEncoding.encoding=this.contentTransferEncoding.value.toLowerCase().split(/[^\w-]/).shift(),this.setupContentDecoder(this.contentTransferEncoding.encoding)}feed(t){switch(this.state){case"header":if(!t.length)return this.state="body",this.processHeaders();if(this.headerSize+=t.length,this.headerSize>this.options.maxHeadersSize)throw new Error(`Maximum header size of ${this.options.maxHeadersSize} bytes exceeded`);this.headerLines.push(Fd.decode(t));break;case"body":this.contentDecoder.update(t)}}};var Nd={"Æ":"\xC6","Æ":"\xC6","&":"&","&":"&","Á":"\xC1","Á":"\xC1","Ă":"\u0102","Â":"\xC2","Â":"\xC2","А":"\u0410","𝔄":"\u{1D504}","À":"\xC0","À":"\xC0","Α":"\u0391","Ā":"\u0100","⩓":"\u2A53","Ą":"\u0104","𝔸":"\u{1D538}","⁡":"\u2061","Å":"\xC5","Å":"\xC5","𝒜":"\u{1D49C}","≔":"\u2254","Ã":"\xC3","Ã":"\xC3","Ä":"\xC4","Ä":"\xC4","∖":"\u2216","⫧":"\u2AE7","⌆":"\u2306","Б":"\u0411","∵":"\u2235","ℬ":"\u212C","Β":"\u0392","𝔅":"\u{1D505}","𝔹":"\u{1D539}","˘":"\u02D8","ℬ":"\u212C","≎":"\u224E","Ч":"\u0427","©":"\xA9","©":"\xA9","Ć":"\u0106","⋒":"\u22D2","ⅅ":"\u2145","ℭ":"\u212D","Č":"\u010C","Ç":"\xC7","Ç":"\xC7","Ĉ":"\u0108","∰":"\u2230","Ċ":"\u010A","¸":"\xB8","·":"\xB7","ℭ":"\u212D","Χ":"\u03A7","⊙":"\u2299","⊖":"\u2296","⊕":"\u2295","⊗":"\u2297","∲":"\u2232","”":"\u201D","’":"\u2019","∷":"\u2237","⩴":"\u2A74","≡":"\u2261","∯":"\u222F","∮":"\u222E","ℂ":"\u2102","∐":"\u2210","∳":"\u2233","⨯":"\u2A2F","𝒞":"\u{1D49E}","⋓":"\u22D3","≍":"\u224D","ⅅ":"\u2145","⤑":"\u2911","Ђ":"\u0402","Ѕ":"\u0405","Џ":"\u040F","‡":"\u2021","↡":"\u21A1","⫤":"\u2AE4","Ď":"\u010E","Д":"\u0414","∇":"\u2207","Δ":"\u0394","𝔇":"\u{1D507}","´":"\xB4","˙":"\u02D9","˝":"\u02DD","`":"`","˜":"\u02DC","⋄":"\u22C4","ⅆ":"\u2146","𝔻":"\u{1D53B}","¨":"\xA8","⃜":"\u20DC","≐":"\u2250","∯":"\u222F","¨":"\xA8","⇓":"\u21D3","⇐":"\u21D0","⇔":"\u21D4","⫤":"\u2AE4","⟸":"\u27F8","⟺":"\u27FA","⟹":"\u27F9","⇒":"\u21D2","⊨":"\u22A8","⇑":"\u21D1","⇕":"\u21D5","∥":"\u2225","↓":"\u2193","⤓":"\u2913","⇵":"\u21F5","̑":"\u0311","⥐":"\u2950","⥞":"\u295E","↽":"\u21BD","⥖":"\u2956","⥟":"\u295F","⇁":"\u21C1","⥗":"\u2957","⊤":"\u22A4","↧":"\u21A7","⇓":"\u21D3","𝒟":"\u{1D49F}","Đ":"\u0110","Ŋ":"\u014A","Ð":"\xD0","Ð":"\xD0","É":"\xC9","É":"\xC9","Ě":"\u011A","Ê":"\xCA","Ê":"\xCA","Э":"\u042D","Ė":"\u0116","𝔈":"\u{1D508}","È":"\xC8","È":"\xC8","∈":"\u2208","Ē":"\u0112","◻":"\u25FB","▫":"\u25AB","Ę":"\u0118","𝔼":"\u{1D53C}","Ε":"\u0395","⩵":"\u2A75","≂":"\u2242","⇌":"\u21CC","ℰ":"\u2130","⩳":"\u2A73","Η":"\u0397","Ë":"\xCB","Ë":"\xCB","∃":"\u2203","ⅇ":"\u2147","Ф":"\u0424","𝔉":"\u{1D509}","◼":"\u25FC","▪":"\u25AA","𝔽":"\u{1D53D}","∀":"\u2200","ℱ":"\u2131","ℱ":"\u2131","Ѓ":"\u0403",">":">",">":">","Γ":"\u0393","Ϝ":"\u03DC","Ğ":"\u011E","Ģ":"\u0122","Ĝ":"\u011C","Г":"\u0413","Ġ":"\u0120","𝔊":"\u{1D50A}","⋙":"\u22D9","𝔾":"\u{1D53E}","≥":"\u2265","⋛":"\u22DB","≧":"\u2267","⪢":"\u2AA2","≷":"\u2277","⩾":"\u2A7E","≳":"\u2273","𝒢":"\u{1D4A2}","≫":"\u226B","Ъ":"\u042A","ˇ":"\u02C7","^":"^","Ĥ":"\u0124","ℌ":"\u210C","ℋ":"\u210B","ℍ":"\u210D","─":"\u2500","ℋ":"\u210B","Ħ":"\u0126","≎":"\u224E","≏":"\u224F","Е":"\u0415","IJ":"\u0132","Ё":"\u0401","Í":"\xCD","Í":"\xCD","Î":"\xCE","Î":"\xCE","И":"\u0418","İ":"\u0130","ℑ":"\u2111","Ì":"\xCC","Ì":"\xCC","ℑ":"\u2111","Ī":"\u012A","ⅈ":"\u2148","⇒":"\u21D2","∬":"\u222C","∫":"\u222B","⋂":"\u22C2","⁣":"\u2063","⁢":"\u2062","Į":"\u012E","𝕀":"\u{1D540}","Ι":"\u0399","ℐ":"\u2110","Ĩ":"\u0128","І":"\u0406","Ï":"\xCF","Ï":"\xCF","Ĵ":"\u0134","Й":"\u0419","𝔍":"\u{1D50D}","𝕁":"\u{1D541}","𝒥":"\u{1D4A5}","Ј":"\u0408","Є":"\u0404","Х":"\u0425","Ќ":"\u040C","Κ":"\u039A","Ķ":"\u0136","К":"\u041A","𝔎":"\u{1D50E}","𝕂":"\u{1D542}","𝒦":"\u{1D4A6}","Љ":"\u0409","<":"<","<":"<","Ĺ":"\u0139","Λ":"\u039B","⟪":"\u27EA","ℒ":"\u2112","↞":"\u219E","Ľ":"\u013D","Ļ":"\u013B","Л":"\u041B","⟨":"\u27E8","←":"\u2190","⇤":"\u21E4","⇆":"\u21C6","⌈":"\u2308","⟦":"\u27E6","⥡":"\u2961","⇃":"\u21C3","⥙":"\u2959","⌊":"\u230A","↔":"\u2194","⥎":"\u294E","⊣":"\u22A3","↤":"\u21A4","⥚":"\u295A","⊲":"\u22B2","⧏":"\u29CF","⊴":"\u22B4","⥑":"\u2951","⥠":"\u2960","↿":"\u21BF","⥘":"\u2958","↼":"\u21BC","⥒":"\u2952","⇐":"\u21D0","⇔":"\u21D4","⋚":"\u22DA","≦":"\u2266","≶":"\u2276","⪡":"\u2AA1","⩽":"\u2A7D","≲":"\u2272","𝔏":"\u{1D50F}","⋘":"\u22D8","⇚":"\u21DA","Ŀ":"\u013F","⟵":"\u27F5","⟷":"\u27F7","⟶":"\u27F6","⟸":"\u27F8","⟺":"\u27FA","⟹":"\u27F9","𝕃":"\u{1D543}","↙":"\u2199","↘":"\u2198","ℒ":"\u2112","↰":"\u21B0","Ł":"\u0141","≪":"\u226A","⤅":"\u2905","М":"\u041C"," ":"\u205F","ℳ":"\u2133","𝔐":"\u{1D510}","∓":"\u2213","𝕄":"\u{1D544}","ℳ":"\u2133","Μ":"\u039C","Њ":"\u040A","Ń":"\u0143","Ň":"\u0147","Ņ":"\u0145","Н":"\u041D","​":"\u200B","​":"\u200B","​":"\u200B","​":"\u200B","≫":"\u226B","≪":"\u226A","
":`
|
|
162
|
+
`,"𝔑":"\u{1D511}","⁠":"\u2060"," ":"\xA0","ℕ":"\u2115","⫬":"\u2AEC","≢":"\u2262","≭":"\u226D","∦":"\u2226","∉":"\u2209","≠":"\u2260","≂̸":"\u2242\u0338","∄":"\u2204","≯":"\u226F","≱":"\u2271","≧̸":"\u2267\u0338","≫̸":"\u226B\u0338","≹":"\u2279","⩾̸":"\u2A7E\u0338","≵":"\u2275","≎̸":"\u224E\u0338","≏̸":"\u224F\u0338","⋪":"\u22EA","⧏̸":"\u29CF\u0338","⋬":"\u22EC","≮":"\u226E","≰":"\u2270","≸":"\u2278","≪̸":"\u226A\u0338","⩽̸":"\u2A7D\u0338","≴":"\u2274","⪢̸":"\u2AA2\u0338","⪡̸":"\u2AA1\u0338","⊀":"\u2280","⪯̸":"\u2AAF\u0338","⋠":"\u22E0","∌":"\u220C","⋫":"\u22EB","⧐̸":"\u29D0\u0338","⋭":"\u22ED","⊏̸":"\u228F\u0338","⋢":"\u22E2","⊐̸":"\u2290\u0338","⋣":"\u22E3","⊂⃒":"\u2282\u20D2","⊈":"\u2288","⊁":"\u2281","⪰̸":"\u2AB0\u0338","⋡":"\u22E1","≿̸":"\u227F\u0338","⊃⃒":"\u2283\u20D2","⊉":"\u2289","≁":"\u2241","≄":"\u2244","≇":"\u2247","≉":"\u2249","∤":"\u2224","𝒩":"\u{1D4A9}","Ñ":"\xD1","Ñ":"\xD1","Ν":"\u039D","Œ":"\u0152","Ó":"\xD3","Ó":"\xD3","Ô":"\xD4","Ô":"\xD4","О":"\u041E","Ő":"\u0150","𝔒":"\u{1D512}","Ò":"\xD2","Ò":"\xD2","Ō":"\u014C","Ω":"\u03A9","Ο":"\u039F","𝕆":"\u{1D546}","“":"\u201C","‘":"\u2018","⩔":"\u2A54","𝒪":"\u{1D4AA}","Ø":"\xD8","Ø":"\xD8","Õ":"\xD5","Õ":"\xD5","⨷":"\u2A37","Ö":"\xD6","Ö":"\xD6","‾":"\u203E","⏞":"\u23DE","⎴":"\u23B4","⏜":"\u23DC","∂":"\u2202","П":"\u041F","𝔓":"\u{1D513}","Φ":"\u03A6","Π":"\u03A0","±":"\xB1","ℌ":"\u210C","ℙ":"\u2119","⪻":"\u2ABB","≺":"\u227A","⪯":"\u2AAF","≼":"\u227C","≾":"\u227E","″":"\u2033","∏":"\u220F","∷":"\u2237","∝":"\u221D","𝒫":"\u{1D4AB}","Ψ":"\u03A8",""":'"',""":'"',"𝔔":"\u{1D514}","ℚ":"\u211A","𝒬":"\u{1D4AC}","⤐":"\u2910","®":"\xAE","®":"\xAE","Ŕ":"\u0154","⟫":"\u27EB","↠":"\u21A0","⤖":"\u2916","Ř":"\u0158","Ŗ":"\u0156","Р":"\u0420","ℜ":"\u211C","∋":"\u220B","⇋":"\u21CB","⥯":"\u296F","ℜ":"\u211C","Ρ":"\u03A1","⟩":"\u27E9","→":"\u2192","⇥":"\u21E5","⇄":"\u21C4","⌉":"\u2309","⟧":"\u27E7","⥝":"\u295D","⇂":"\u21C2","⥕":"\u2955","⌋":"\u230B","⊢":"\u22A2","↦":"\u21A6","⥛":"\u295B","⊳":"\u22B3","⧐":"\u29D0","⊵":"\u22B5","⥏":"\u294F","⥜":"\u295C","↾":"\u21BE","⥔":"\u2954","⇀":"\u21C0","⥓":"\u2953","⇒":"\u21D2","ℝ":"\u211D","⥰":"\u2970","⇛":"\u21DB","ℛ":"\u211B","↱":"\u21B1","⧴":"\u29F4","Щ":"\u0429","Ш":"\u0428","Ь":"\u042C","Ś":"\u015A","⪼":"\u2ABC","Š":"\u0160","Ş":"\u015E","Ŝ":"\u015C","С":"\u0421","𝔖":"\u{1D516}","↓":"\u2193","←":"\u2190","→":"\u2192","↑":"\u2191","Σ":"\u03A3","∘":"\u2218","𝕊":"\u{1D54A}","√":"\u221A","□":"\u25A1","⊓":"\u2293","⊏":"\u228F","⊑":"\u2291","⊐":"\u2290","⊒":"\u2292","⊔":"\u2294","𝒮":"\u{1D4AE}","⋆":"\u22C6","⋐":"\u22D0","⋐":"\u22D0","⊆":"\u2286","≻":"\u227B","⪰":"\u2AB0","≽":"\u227D","≿":"\u227F","∋":"\u220B","∑":"\u2211","⋑":"\u22D1","⊃":"\u2283","⊇":"\u2287","⋑":"\u22D1","Þ":"\xDE","Þ":"\xDE","™":"\u2122","Ћ":"\u040B","Ц":"\u0426","	":" ","Τ":"\u03A4","Ť":"\u0164","Ţ":"\u0162","Т":"\u0422","𝔗":"\u{1D517}","∴":"\u2234","Θ":"\u0398","  ":"\u205F\u200A"," ":"\u2009","∼":"\u223C","≃":"\u2243","≅":"\u2245","≈":"\u2248","𝕋":"\u{1D54B}","⃛":"\u20DB","𝒯":"\u{1D4AF}","Ŧ":"\u0166","Ú":"\xDA","Ú":"\xDA","↟":"\u219F","⥉":"\u2949","Ў":"\u040E","Ŭ":"\u016C","Û":"\xDB","Û":"\xDB","У":"\u0423","Ű":"\u0170","𝔘":"\u{1D518}","Ù":"\xD9","Ù":"\xD9","Ū":"\u016A","_":"_","⏟":"\u23DF","⎵":"\u23B5","⏝":"\u23DD","⋃":"\u22C3","⊎":"\u228E","Ų":"\u0172","𝕌":"\u{1D54C}","↑":"\u2191","⤒":"\u2912","⇅":"\u21C5","↕":"\u2195","⥮":"\u296E","⊥":"\u22A5","↥":"\u21A5","⇑":"\u21D1","⇕":"\u21D5","↖":"\u2196","↗":"\u2197","ϒ":"\u03D2","Υ":"\u03A5","Ů":"\u016E","𝒰":"\u{1D4B0}","Ũ":"\u0168","Ü":"\xDC","Ü":"\xDC","⊫":"\u22AB","⫫":"\u2AEB","В":"\u0412","⊩":"\u22A9","⫦":"\u2AE6","⋁":"\u22C1","‖":"\u2016","‖":"\u2016","∣":"\u2223","|":"|","❘":"\u2758","≀":"\u2240"," ":"\u200A","𝔙":"\u{1D519}","𝕍":"\u{1D54D}","𝒱":"\u{1D4B1}","⊪":"\u22AA","Ŵ":"\u0174","⋀":"\u22C0","𝔚":"\u{1D51A}","𝕎":"\u{1D54E}","𝒲":"\u{1D4B2}","𝔛":"\u{1D51B}","Ξ":"\u039E","𝕏":"\u{1D54F}","𝒳":"\u{1D4B3}","Я":"\u042F","Ї":"\u0407","Ю":"\u042E","Ý":"\xDD","Ý":"\xDD","Ŷ":"\u0176","Ы":"\u042B","𝔜":"\u{1D51C}","𝕐":"\u{1D550}","𝒴":"\u{1D4B4}","Ÿ":"\u0178","Ж":"\u0416","Ź":"\u0179","Ž":"\u017D","З":"\u0417","Ż":"\u017B","​":"\u200B","Ζ":"\u0396","ℨ":"\u2128","ℤ":"\u2124","𝒵":"\u{1D4B5}","á":"\xE1","á":"\xE1","ă":"\u0103","∾":"\u223E","∾̳":"\u223E\u0333","∿":"\u223F","â":"\xE2","â":"\xE2","´":"\xB4","´":"\xB4","а":"\u0430","æ":"\xE6","æ":"\xE6","⁡":"\u2061","𝔞":"\u{1D51E}","à":"\xE0","à":"\xE0","ℵ":"\u2135","ℵ":"\u2135","α":"\u03B1","ā":"\u0101","⨿":"\u2A3F","&":"&","&":"&","∧":"\u2227","⩕":"\u2A55","⩜":"\u2A5C","⩘":"\u2A58","⩚":"\u2A5A","∠":"\u2220","⦤":"\u29A4","∠":"\u2220","∡":"\u2221","⦨":"\u29A8","⦩":"\u29A9","⦪":"\u29AA","⦫":"\u29AB","⦬":"\u29AC","⦭":"\u29AD","⦮":"\u29AE","⦯":"\u29AF","∟":"\u221F","⊾":"\u22BE","⦝":"\u299D","∢":"\u2222","Å":"\xC5","⍼":"\u237C","ą":"\u0105","𝕒":"\u{1D552}","≈":"\u2248","⩰":"\u2A70","⩯":"\u2A6F","≊":"\u224A","≋":"\u224B","'":"'","≈":"\u2248","≊":"\u224A","å":"\xE5","å":"\xE5","𝒶":"\u{1D4B6}","*":"*","≈":"\u2248","≍":"\u224D","ã":"\xE3","ã":"\xE3","ä":"\xE4","ä":"\xE4","∳":"\u2233","⨑":"\u2A11","⫭":"\u2AED","≌":"\u224C","϶":"\u03F6","‵":"\u2035","∽":"\u223D","⋍":"\u22CD","⊽":"\u22BD","⌅":"\u2305","⌅":"\u2305","⎵":"\u23B5","⎶":"\u23B6","≌":"\u224C","б":"\u0431","„":"\u201E","∵":"\u2235","∵":"\u2235","⦰":"\u29B0","϶":"\u03F6","ℬ":"\u212C","β":"\u03B2","ℶ":"\u2136","≬":"\u226C","𝔟":"\u{1D51F}","⋂":"\u22C2","◯":"\u25EF","⋃":"\u22C3","⨀":"\u2A00","⨁":"\u2A01","⨂":"\u2A02","⨆":"\u2A06","★":"\u2605","▽":"\u25BD","△":"\u25B3","⨄":"\u2A04","⋁":"\u22C1","⋀":"\u22C0","⤍":"\u290D","⧫":"\u29EB","▪":"\u25AA","▴":"\u25B4","▾":"\u25BE","◂":"\u25C2","▸":"\u25B8","␣":"\u2423","▒":"\u2592","░":"\u2591","▓":"\u2593","█":"\u2588","=⃥":"=\u20E5","≡⃥":"\u2261\u20E5","⌐":"\u2310","𝕓":"\u{1D553}","⊥":"\u22A5","⊥":"\u22A5","⋈":"\u22C8","╗":"\u2557","╔":"\u2554","╖":"\u2556","╓":"\u2553","═":"\u2550","╦":"\u2566","╩":"\u2569","╤":"\u2564","╧":"\u2567","╝":"\u255D","╚":"\u255A","╜":"\u255C","╙":"\u2559","║":"\u2551","╬":"\u256C","╣":"\u2563","╠":"\u2560","╫":"\u256B","╢":"\u2562","╟":"\u255F","⧉":"\u29C9","╕":"\u2555","╒":"\u2552","┐":"\u2510","┌":"\u250C","─":"\u2500","╥":"\u2565","╨":"\u2568","┬":"\u252C","┴":"\u2534","⊟":"\u229F","⊞":"\u229E","⊠":"\u22A0","╛":"\u255B","╘":"\u2558","┘":"\u2518","└":"\u2514","│":"\u2502","╪":"\u256A","╡":"\u2561","╞":"\u255E","┼":"\u253C","┤":"\u2524","├":"\u251C","‵":"\u2035","˘":"\u02D8","¦":"\xA6","¦":"\xA6","𝒷":"\u{1D4B7}","⁏":"\u204F","∽":"\u223D","⋍":"\u22CD","\":"\\","⧅":"\u29C5","⟈":"\u27C8","•":"\u2022","•":"\u2022","≎":"\u224E","⪮":"\u2AAE","≏":"\u224F","≏":"\u224F","ć":"\u0107","∩":"\u2229","⩄":"\u2A44","⩉":"\u2A49","⩋":"\u2A4B","⩇":"\u2A47","⩀":"\u2A40","∩︀":"\u2229\uFE00","⁁":"\u2041","ˇ":"\u02C7","⩍":"\u2A4D","č":"\u010D","ç":"\xE7","ç":"\xE7","ĉ":"\u0109","⩌":"\u2A4C","⩐":"\u2A50","ċ":"\u010B","¸":"\xB8","¸":"\xB8","⦲":"\u29B2","¢":"\xA2","¢":"\xA2","·":"\xB7","𝔠":"\u{1D520}","ч":"\u0447","✓":"\u2713","✓":"\u2713","χ":"\u03C7","○":"\u25CB","⧃":"\u29C3","ˆ":"\u02C6","≗":"\u2257","↺":"\u21BA","↻":"\u21BB","®":"\xAE","Ⓢ":"\u24C8","⊛":"\u229B","⊚":"\u229A","⊝":"\u229D","≗":"\u2257","⨐":"\u2A10","⫯":"\u2AEF","⧂":"\u29C2","♣":"\u2663","♣":"\u2663",":":":","≔":"\u2254","≔":"\u2254",",":",","@":"@","∁":"\u2201","∘":"\u2218","∁":"\u2201","ℂ":"\u2102","≅":"\u2245","⩭":"\u2A6D","∮":"\u222E","𝕔":"\u{1D554}","∐":"\u2210","©":"\xA9","©":"\xA9","℗":"\u2117","↵":"\u21B5","✗":"\u2717","𝒸":"\u{1D4B8}","⫏":"\u2ACF","⫑":"\u2AD1","⫐":"\u2AD0","⫒":"\u2AD2","⋯":"\u22EF","⤸":"\u2938","⤵":"\u2935","⋞":"\u22DE","⋟":"\u22DF","↶":"\u21B6","⤽":"\u293D","∪":"\u222A","⩈":"\u2A48","⩆":"\u2A46","⩊":"\u2A4A","⊍":"\u228D","⩅":"\u2A45","∪︀":"\u222A\uFE00","↷":"\u21B7","⤼":"\u293C","⋞":"\u22DE","⋟":"\u22DF","⋎":"\u22CE","⋏":"\u22CF","¤":"\xA4","¤":"\xA4","↶":"\u21B6","↷":"\u21B7","⋎":"\u22CE","⋏":"\u22CF","∲":"\u2232","∱":"\u2231","⌭":"\u232D","⇓":"\u21D3","⥥":"\u2965","†":"\u2020","ℸ":"\u2138","↓":"\u2193","‐":"\u2010","⊣":"\u22A3","⤏":"\u290F","˝":"\u02DD","ď":"\u010F","д":"\u0434","ⅆ":"\u2146","‡":"\u2021","⇊":"\u21CA","⩷":"\u2A77","°":"\xB0","°":"\xB0","δ":"\u03B4","⦱":"\u29B1","⥿":"\u297F","𝔡":"\u{1D521}","⇃":"\u21C3","⇂":"\u21C2","⋄":"\u22C4","⋄":"\u22C4","♦":"\u2666","♦":"\u2666","¨":"\xA8","ϝ":"\u03DD","⋲":"\u22F2","÷":"\xF7","÷":"\xF7","÷":"\xF7","⋇":"\u22C7","⋇":"\u22C7","ђ":"\u0452","⌞":"\u231E","⌍":"\u230D","$":"$","𝕕":"\u{1D555}","˙":"\u02D9","≐":"\u2250","≑":"\u2251","∸":"\u2238","∔":"\u2214","⊡":"\u22A1","⌆":"\u2306","↓":"\u2193","⇊":"\u21CA","⇃":"\u21C3","⇂":"\u21C2","⤐":"\u2910","⌟":"\u231F","⌌":"\u230C","𝒹":"\u{1D4B9}","ѕ":"\u0455","⧶":"\u29F6","đ":"\u0111","⋱":"\u22F1","▿":"\u25BF","▾":"\u25BE","⇵":"\u21F5","⥯":"\u296F","⦦":"\u29A6","џ":"\u045F","⟿":"\u27FF","⩷":"\u2A77","≑":"\u2251","é":"\xE9","é":"\xE9","⩮":"\u2A6E","ě":"\u011B","≖":"\u2256","ê":"\xEA","ê":"\xEA","≕":"\u2255","э":"\u044D","ė":"\u0117","ⅇ":"\u2147","≒":"\u2252","𝔢":"\u{1D522}","⪚":"\u2A9A","è":"\xE8","è":"\xE8","⪖":"\u2A96","⪘":"\u2A98","⪙":"\u2A99","⏧":"\u23E7","ℓ":"\u2113","⪕":"\u2A95","⪗":"\u2A97","ē":"\u0113","∅":"\u2205","∅":"\u2205","∅":"\u2205"," ":"\u2004"," ":"\u2005"," ":"\u2003","ŋ":"\u014B"," ":"\u2002","ę":"\u0119","𝕖":"\u{1D556}","⋕":"\u22D5","⧣":"\u29E3","⩱":"\u2A71","ε":"\u03B5","ε":"\u03B5","ϵ":"\u03F5","≖":"\u2256","≕":"\u2255","≂":"\u2242","⪖":"\u2A96","⪕":"\u2A95","=":"=","≟":"\u225F","≡":"\u2261","⩸":"\u2A78","⧥":"\u29E5","≓":"\u2253","⥱":"\u2971","ℯ":"\u212F","≐":"\u2250","≂":"\u2242","η":"\u03B7","ð":"\xF0","ð":"\xF0","ë":"\xEB","ë":"\xEB","€":"\u20AC","!":"!","∃":"\u2203","ℰ":"\u2130","ⅇ":"\u2147","≒":"\u2252","ф":"\u0444","♀":"\u2640","ffi":"\uFB03","ff":"\uFB00","ffl":"\uFB04","𝔣":"\u{1D523}","fi":"\uFB01","fj":"fj","♭":"\u266D","fl":"\uFB02","▱":"\u25B1","ƒ":"\u0192","𝕗":"\u{1D557}","∀":"\u2200","⋔":"\u22D4","⫙":"\u2AD9","⨍":"\u2A0D","½":"\xBD","½":"\xBD","⅓":"\u2153","¼":"\xBC","¼":"\xBC","⅕":"\u2155","⅙":"\u2159","⅛":"\u215B","⅔":"\u2154","⅖":"\u2156","¾":"\xBE","¾":"\xBE","⅗":"\u2157","⅜":"\u215C","⅘":"\u2158","⅚":"\u215A","⅝":"\u215D","⅞":"\u215E","⁄":"\u2044","⌢":"\u2322","𝒻":"\u{1D4BB}","≧":"\u2267","⪌":"\u2A8C","ǵ":"\u01F5","γ":"\u03B3","ϝ":"\u03DD","⪆":"\u2A86","ğ":"\u011F","ĝ":"\u011D","г":"\u0433","ġ":"\u0121","≥":"\u2265","⋛":"\u22DB","≥":"\u2265","≧":"\u2267","⩾":"\u2A7E","⩾":"\u2A7E","⪩":"\u2AA9","⪀":"\u2A80","⪂":"\u2A82","⪄":"\u2A84","⋛︀":"\u22DB\uFE00","⪔":"\u2A94","𝔤":"\u{1D524}","≫":"\u226B","⋙":"\u22D9","ℷ":"\u2137","ѓ":"\u0453","≷":"\u2277","⪒":"\u2A92","⪥":"\u2AA5","⪤":"\u2AA4","≩":"\u2269","⪊":"\u2A8A","⪊":"\u2A8A","⪈":"\u2A88","⪈":"\u2A88","≩":"\u2269","⋧":"\u22E7","𝕘":"\u{1D558}","`":"`","ℊ":"\u210A","≳":"\u2273","⪎":"\u2A8E","⪐":"\u2A90",">":">",">":">","⪧":"\u2AA7","⩺":"\u2A7A","⋗":"\u22D7","⦕":"\u2995","⩼":"\u2A7C","⪆":"\u2A86","⥸":"\u2978","⋗":"\u22D7","⋛":"\u22DB","⪌":"\u2A8C","≷":"\u2277","≳":"\u2273","≩︀":"\u2269\uFE00","≩︀":"\u2269\uFE00","⇔":"\u21D4"," ":"\u200A","½":"\xBD","ℋ":"\u210B","ъ":"\u044A","↔":"\u2194","⥈":"\u2948","↭":"\u21AD","ℏ":"\u210F","ĥ":"\u0125","♥":"\u2665","♥":"\u2665","…":"\u2026","⊹":"\u22B9","𝔥":"\u{1D525}","⤥":"\u2925","⤦":"\u2926","⇿":"\u21FF","∻":"\u223B","↩":"\u21A9","↪":"\u21AA","𝕙":"\u{1D559}","―":"\u2015","𝒽":"\u{1D4BD}","ℏ":"\u210F","ħ":"\u0127","⁃":"\u2043","‐":"\u2010","í":"\xED","í":"\xED","⁣":"\u2063","î":"\xEE","î":"\xEE","и":"\u0438","е":"\u0435","¡":"\xA1","¡":"\xA1","⇔":"\u21D4","𝔦":"\u{1D526}","ì":"\xEC","ì":"\xEC","ⅈ":"\u2148","⨌":"\u2A0C","∭":"\u222D","⧜":"\u29DC","℩":"\u2129","ij":"\u0133","ī":"\u012B","ℑ":"\u2111","ℐ":"\u2110","ℑ":"\u2111","ı":"\u0131","⊷":"\u22B7","Ƶ":"\u01B5","∈":"\u2208","℅":"\u2105","∞":"\u221E","⧝":"\u29DD","ı":"\u0131","∫":"\u222B","⊺":"\u22BA","ℤ":"\u2124","⊺":"\u22BA","⨗":"\u2A17","⨼":"\u2A3C","ё":"\u0451","į":"\u012F","𝕚":"\u{1D55A}","ι":"\u03B9","⨼":"\u2A3C","¿":"\xBF","¿":"\xBF","𝒾":"\u{1D4BE}","∈":"\u2208","⋹":"\u22F9","⋵":"\u22F5","⋴":"\u22F4","⋳":"\u22F3","∈":"\u2208","⁢":"\u2062","ĩ":"\u0129","і":"\u0456","ï":"\xEF","ï":"\xEF","ĵ":"\u0135","й":"\u0439","𝔧":"\u{1D527}","ȷ":"\u0237","𝕛":"\u{1D55B}","𝒿":"\u{1D4BF}","ј":"\u0458","є":"\u0454","κ":"\u03BA","ϰ":"\u03F0","ķ":"\u0137","к":"\u043A","𝔨":"\u{1D528}","ĸ":"\u0138","х":"\u0445","ќ":"\u045C","𝕜":"\u{1D55C}","𝓀":"\u{1D4C0}","⇚":"\u21DA","⇐":"\u21D0","⤛":"\u291B","⤎":"\u290E","≦":"\u2266","⪋":"\u2A8B","⥢":"\u2962","ĺ":"\u013A","⦴":"\u29B4","ℒ":"\u2112","λ":"\u03BB","⟨":"\u27E8","⦑":"\u2991","⟨":"\u27E8","⪅":"\u2A85","«":"\xAB","«":"\xAB","←":"\u2190","⇤":"\u21E4","⤟":"\u291F","⤝":"\u291D","↩":"\u21A9","↫":"\u21AB","⤹":"\u2939","⥳":"\u2973","↢":"\u21A2","⪫":"\u2AAB","⤙":"\u2919","⪭":"\u2AAD","⪭︀":"\u2AAD\uFE00","⤌":"\u290C","❲":"\u2772","{":"{","[":"[","⦋":"\u298B","⦏":"\u298F","⦍":"\u298D","ľ":"\u013E","ļ":"\u013C","⌈":"\u2308","{":"{","л":"\u043B","⤶":"\u2936","“":"\u201C","„":"\u201E","⥧":"\u2967","⥋":"\u294B","↲":"\u21B2","≤":"\u2264","←":"\u2190","↢":"\u21A2","↽":"\u21BD","↼":"\u21BC","⇇":"\u21C7","↔":"\u2194","⇆":"\u21C6","⇋":"\u21CB","↭":"\u21AD","⋋":"\u22CB","⋚":"\u22DA","≤":"\u2264","≦":"\u2266","⩽":"\u2A7D","⩽":"\u2A7D","⪨":"\u2AA8","⩿":"\u2A7F","⪁":"\u2A81","⪃":"\u2A83","⋚︀":"\u22DA\uFE00","⪓":"\u2A93","⪅":"\u2A85","⋖":"\u22D6","⋚":"\u22DA","⪋":"\u2A8B","≶":"\u2276","≲":"\u2272","⥼":"\u297C","⌊":"\u230A","𝔩":"\u{1D529}","≶":"\u2276","⪑":"\u2A91","↽":"\u21BD","↼":"\u21BC","⥪":"\u296A","▄":"\u2584","љ":"\u0459","≪":"\u226A","⇇":"\u21C7","⌞":"\u231E","⥫":"\u296B","◺":"\u25FA","ŀ":"\u0140","⎰":"\u23B0","⎰":"\u23B0","≨":"\u2268","⪉":"\u2A89","⪉":"\u2A89","⪇":"\u2A87","⪇":"\u2A87","≨":"\u2268","⋦":"\u22E6","⟬":"\u27EC","⇽":"\u21FD","⟦":"\u27E6","⟵":"\u27F5","⟷":"\u27F7","⟼":"\u27FC","⟶":"\u27F6","↫":"\u21AB","↬":"\u21AC","⦅":"\u2985","𝕝":"\u{1D55D}","⨭":"\u2A2D","⨴":"\u2A34","∗":"\u2217","_":"_","◊":"\u25CA","◊":"\u25CA","⧫":"\u29EB","(":"(","⦓":"\u2993","⇆":"\u21C6","⌟":"\u231F","⇋":"\u21CB","⥭":"\u296D","‎":"\u200E","⊿":"\u22BF","‹":"\u2039","𝓁":"\u{1D4C1}","↰":"\u21B0","≲":"\u2272","⪍":"\u2A8D","⪏":"\u2A8F","[":"[","‘":"\u2018","‚":"\u201A","ł":"\u0142","<":"<","<":"<","⪦":"\u2AA6","⩹":"\u2A79","⋖":"\u22D6","⋋":"\u22CB","⋉":"\u22C9","⥶":"\u2976","⩻":"\u2A7B","⦖":"\u2996","◃":"\u25C3","⊴":"\u22B4","◂":"\u25C2","⥊":"\u294A","⥦":"\u2966","≨︀":"\u2268\uFE00","≨︀":"\u2268\uFE00","∺":"\u223A","¯":"\xAF","¯":"\xAF","♂":"\u2642","✠":"\u2720","✠":"\u2720","↦":"\u21A6","↦":"\u21A6","↧":"\u21A7","↤":"\u21A4","↥":"\u21A5","▮":"\u25AE","⨩":"\u2A29","м":"\u043C","—":"\u2014","∡":"\u2221","𝔪":"\u{1D52A}","℧":"\u2127","µ":"\xB5","µ":"\xB5","∣":"\u2223","*":"*","⫰":"\u2AF0","·":"\xB7","·":"\xB7","−":"\u2212","⊟":"\u229F","∸":"\u2238","⨪":"\u2A2A","⫛":"\u2ADB","…":"\u2026","∓":"\u2213","⊧":"\u22A7","𝕞":"\u{1D55E}","∓":"\u2213","𝓂":"\u{1D4C2}","∾":"\u223E","μ":"\u03BC","⊸":"\u22B8","⊸":"\u22B8","⋙̸":"\u22D9\u0338","≫⃒":"\u226B\u20D2","≫̸":"\u226B\u0338","⇍":"\u21CD","⇎":"\u21CE","⋘̸":"\u22D8\u0338","≪⃒":"\u226A\u20D2","≪̸":"\u226A\u0338","⇏":"\u21CF","⊯":"\u22AF","⊮":"\u22AE","∇":"\u2207","ń":"\u0144","∠⃒":"\u2220\u20D2","≉":"\u2249","⩰̸":"\u2A70\u0338","≋̸":"\u224B\u0338","ʼn":"\u0149","≉":"\u2249","♮":"\u266E","♮":"\u266E","ℕ":"\u2115"," ":"\xA0"," ":"\xA0","≎̸":"\u224E\u0338","≏̸":"\u224F\u0338","⩃":"\u2A43","ň":"\u0148","ņ":"\u0146","≇":"\u2247","⩭̸":"\u2A6D\u0338","⩂":"\u2A42","н":"\u043D","–":"\u2013","≠":"\u2260","⇗":"\u21D7","⤤":"\u2924","↗":"\u2197","↗":"\u2197","≐̸":"\u2250\u0338","≢":"\u2262","⤨":"\u2928","≂̸":"\u2242\u0338","∄":"\u2204","∄":"\u2204","𝔫":"\u{1D52B}","≧̸":"\u2267\u0338","≱":"\u2271","≱":"\u2271","≧̸":"\u2267\u0338","⩾̸":"\u2A7E\u0338","⩾̸":"\u2A7E\u0338","≵":"\u2275","≯":"\u226F","≯":"\u226F","⇎":"\u21CE","↮":"\u21AE","⫲":"\u2AF2","∋":"\u220B","⋼":"\u22FC","⋺":"\u22FA","∋":"\u220B","њ":"\u045A","⇍":"\u21CD","≦̸":"\u2266\u0338","↚":"\u219A","‥":"\u2025","≰":"\u2270","↚":"\u219A","↮":"\u21AE","≰":"\u2270","≦̸":"\u2266\u0338","⩽̸":"\u2A7D\u0338","⩽̸":"\u2A7D\u0338","≮":"\u226E","≴":"\u2274","≮":"\u226E","⋪":"\u22EA","⋬":"\u22EC","∤":"\u2224","𝕟":"\u{1D55F}","¬":"\xAC","¬":"\xAC","∉":"\u2209","⋹̸":"\u22F9\u0338","⋵̸":"\u22F5\u0338","∉":"\u2209","⋷":"\u22F7","⋶":"\u22F6","∌":"\u220C","∌":"\u220C","⋾":"\u22FE","⋽":"\u22FD","∦":"\u2226","∦":"\u2226","⫽⃥":"\u2AFD\u20E5","∂̸":"\u2202\u0338","⨔":"\u2A14","⊀":"\u2280","⋠":"\u22E0","⪯̸":"\u2AAF\u0338","⊀":"\u2280","⪯̸":"\u2AAF\u0338","⇏":"\u21CF","↛":"\u219B","⤳̸":"\u2933\u0338","↝̸":"\u219D\u0338","↛":"\u219B","⋫":"\u22EB","⋭":"\u22ED","⊁":"\u2281","⋡":"\u22E1","⪰̸":"\u2AB0\u0338","𝓃":"\u{1D4C3}","∤":"\u2224","∦":"\u2226","≁":"\u2241","≄":"\u2244","≄":"\u2244","∤":"\u2224","∦":"\u2226","⋢":"\u22E2","⋣":"\u22E3","⊄":"\u2284","⫅̸":"\u2AC5\u0338","⊈":"\u2288","⊂⃒":"\u2282\u20D2","⊈":"\u2288","⫅̸":"\u2AC5\u0338","⊁":"\u2281","⪰̸":"\u2AB0\u0338","⊅":"\u2285","⫆̸":"\u2AC6\u0338","⊉":"\u2289","⊃⃒":"\u2283\u20D2","⊉":"\u2289","⫆̸":"\u2AC6\u0338","≹":"\u2279","ñ":"\xF1","ñ":"\xF1","≸":"\u2278","⋪":"\u22EA","⋬":"\u22EC","⋫":"\u22EB","⋭":"\u22ED","ν":"\u03BD","#":"#","№":"\u2116"," ":"\u2007","⊭":"\u22AD","⤄":"\u2904","≍⃒":"\u224D\u20D2","⊬":"\u22AC","≥⃒":"\u2265\u20D2",">⃒":">\u20D2","⧞":"\u29DE","⤂":"\u2902","≤⃒":"\u2264\u20D2","<⃒":"<\u20D2","⊴⃒":"\u22B4\u20D2","⤃":"\u2903","⊵⃒":"\u22B5\u20D2","∼⃒":"\u223C\u20D2","⇖":"\u21D6","⤣":"\u2923","↖":"\u2196","↖":"\u2196","⤧":"\u2927","Ⓢ":"\u24C8","ó":"\xF3","ó":"\xF3","⊛":"\u229B","⊚":"\u229A","ô":"\xF4","ô":"\xF4","о":"\u043E","⊝":"\u229D","ő":"\u0151","⨸":"\u2A38","⊙":"\u2299","⦼":"\u29BC","œ":"\u0153","⦿":"\u29BF","𝔬":"\u{1D52C}","˛":"\u02DB","ò":"\xF2","ò":"\xF2","⧁":"\u29C1","⦵":"\u29B5","Ω":"\u03A9","∮":"\u222E","↺":"\u21BA","⦾":"\u29BE","⦻":"\u29BB","‾":"\u203E","⧀":"\u29C0","ō":"\u014D","ω":"\u03C9","ο":"\u03BF","⦶":"\u29B6","⊖":"\u2296","𝕠":"\u{1D560}","⦷":"\u29B7","⦹":"\u29B9","⊕":"\u2295","∨":"\u2228","↻":"\u21BB","⩝":"\u2A5D","ℴ":"\u2134","ℴ":"\u2134","ª":"\xAA","ª":"\xAA","º":"\xBA","º":"\xBA","⊶":"\u22B6","⩖":"\u2A56","⩗":"\u2A57","⩛":"\u2A5B","ℴ":"\u2134","ø":"\xF8","ø":"\xF8","⊘":"\u2298","õ":"\xF5","õ":"\xF5","⊗":"\u2297","⨶":"\u2A36","ö":"\xF6","ö":"\xF6","⌽":"\u233D","∥":"\u2225","¶":"\xB6","¶":"\xB6","∥":"\u2225","⫳":"\u2AF3","⫽":"\u2AFD","∂":"\u2202","п":"\u043F","%":"%",".":".","‰":"\u2030","⊥":"\u22A5","‱":"\u2031","𝔭":"\u{1D52D}","φ":"\u03C6","ϕ":"\u03D5","ℳ":"\u2133","☎":"\u260E","π":"\u03C0","⋔":"\u22D4","ϖ":"\u03D6","ℏ":"\u210F","ℎ":"\u210E","ℏ":"\u210F","+":"+","⨣":"\u2A23","⊞":"\u229E","⨢":"\u2A22","∔":"\u2214","⨥":"\u2A25","⩲":"\u2A72","±":"\xB1","±":"\xB1","⨦":"\u2A26","⨧":"\u2A27","±":"\xB1","⨕":"\u2A15","𝕡":"\u{1D561}","£":"\xA3","£":"\xA3","≺":"\u227A","⪳":"\u2AB3","⪷":"\u2AB7","≼":"\u227C","⪯":"\u2AAF","≺":"\u227A","⪷":"\u2AB7","≼":"\u227C","⪯":"\u2AAF","⪹":"\u2AB9","⪵":"\u2AB5","⋨":"\u22E8","≾":"\u227E","′":"\u2032","ℙ":"\u2119","⪵":"\u2AB5","⪹":"\u2AB9","⋨":"\u22E8","∏":"\u220F","⌮":"\u232E","⌒":"\u2312","⌓":"\u2313","∝":"\u221D","∝":"\u221D","≾":"\u227E","⊰":"\u22B0","𝓅":"\u{1D4C5}","ψ":"\u03C8"," ":"\u2008","𝔮":"\u{1D52E}","⨌":"\u2A0C","𝕢":"\u{1D562}","⁗":"\u2057","𝓆":"\u{1D4C6}","ℍ":"\u210D","⨖":"\u2A16","?":"?","≟":"\u225F",""":'"',""":'"',"⇛":"\u21DB","⇒":"\u21D2","⤜":"\u291C","⤏":"\u290F","⥤":"\u2964","∽̱":"\u223D\u0331","ŕ":"\u0155","√":"\u221A","⦳":"\u29B3","⟩":"\u27E9","⦒":"\u2992","⦥":"\u29A5","⟩":"\u27E9","»":"\xBB","»":"\xBB","→":"\u2192","⥵":"\u2975","⇥":"\u21E5","⤠":"\u2920","⤳":"\u2933","⤞":"\u291E","↪":"\u21AA","↬":"\u21AC","⥅":"\u2945","⥴":"\u2974","↣":"\u21A3","↝":"\u219D","⤚":"\u291A","∶":"\u2236","ℚ":"\u211A","⤍":"\u290D","❳":"\u2773","}":"}","]":"]","⦌":"\u298C","⦎":"\u298E","⦐":"\u2990","ř":"\u0159","ŗ":"\u0157","⌉":"\u2309","}":"}","р":"\u0440","⤷":"\u2937","⥩":"\u2969","”":"\u201D","”":"\u201D","↳":"\u21B3","ℜ":"\u211C","ℛ":"\u211B","ℜ":"\u211C","ℝ":"\u211D","▭":"\u25AD","®":"\xAE","®":"\xAE","⥽":"\u297D","⌋":"\u230B","𝔯":"\u{1D52F}","⇁":"\u21C1","⇀":"\u21C0","⥬":"\u296C","ρ":"\u03C1","ϱ":"\u03F1","→":"\u2192","↣":"\u21A3","⇁":"\u21C1","⇀":"\u21C0","⇄":"\u21C4","⇌":"\u21CC","⇉":"\u21C9","↝":"\u219D","⋌":"\u22CC","˚":"\u02DA","≓":"\u2253","⇄":"\u21C4","⇌":"\u21CC","‏":"\u200F","⎱":"\u23B1","⎱":"\u23B1","⫮":"\u2AEE","⟭":"\u27ED","⇾":"\u21FE","⟧":"\u27E7","⦆":"\u2986","𝕣":"\u{1D563}","⨮":"\u2A2E","⨵":"\u2A35",")":")","⦔":"\u2994","⨒":"\u2A12","⇉":"\u21C9","›":"\u203A","𝓇":"\u{1D4C7}","↱":"\u21B1","]":"]","’":"\u2019","’":"\u2019","⋌":"\u22CC","⋊":"\u22CA","▹":"\u25B9","⊵":"\u22B5","▸":"\u25B8","⧎":"\u29CE","⥨":"\u2968","℞":"\u211E","ś":"\u015B","‚":"\u201A","≻":"\u227B","⪴":"\u2AB4","⪸":"\u2AB8","š":"\u0161","≽":"\u227D","⪰":"\u2AB0","ş":"\u015F","ŝ":"\u015D","⪶":"\u2AB6","⪺":"\u2ABA","⋩":"\u22E9","⨓":"\u2A13","≿":"\u227F","с":"\u0441","⋅":"\u22C5","⊡":"\u22A1","⩦":"\u2A66","⇘":"\u21D8","⤥":"\u2925","↘":"\u2198","↘":"\u2198","§":"\xA7","§":"\xA7",";":";","⤩":"\u2929","∖":"\u2216","∖":"\u2216","✶":"\u2736","𝔰":"\u{1D530}","⌢":"\u2322","♯":"\u266F","щ":"\u0449","ш":"\u0448","∣":"\u2223","∥":"\u2225","­":"\xAD","­":"\xAD","σ":"\u03C3","ς":"\u03C2","ς":"\u03C2","∼":"\u223C","⩪":"\u2A6A","≃":"\u2243","≃":"\u2243","⪞":"\u2A9E","⪠":"\u2AA0","⪝":"\u2A9D","⪟":"\u2A9F","≆":"\u2246","⨤":"\u2A24","⥲":"\u2972","←":"\u2190","∖":"\u2216","⨳":"\u2A33","⧤":"\u29E4","∣":"\u2223","⌣":"\u2323","⪪":"\u2AAA","⪬":"\u2AAC","⪬︀":"\u2AAC\uFE00","ь":"\u044C","/":"/","⧄":"\u29C4","⌿":"\u233F","𝕤":"\u{1D564}","♠":"\u2660","♠":"\u2660","∥":"\u2225","⊓":"\u2293","⊓︀":"\u2293\uFE00","⊔":"\u2294","⊔︀":"\u2294\uFE00","⊏":"\u228F","⊑":"\u2291","⊏":"\u228F","⊑":"\u2291","⊐":"\u2290","⊒":"\u2292","⊐":"\u2290","⊒":"\u2292","□":"\u25A1","□":"\u25A1","▪":"\u25AA","▪":"\u25AA","→":"\u2192","𝓈":"\u{1D4C8}","∖":"\u2216","⌣":"\u2323","⋆":"\u22C6","☆":"\u2606","★":"\u2605","ϵ":"\u03F5","ϕ":"\u03D5","¯":"\xAF","⊂":"\u2282","⫅":"\u2AC5","⪽":"\u2ABD","⊆":"\u2286","⫃":"\u2AC3","⫁":"\u2AC1","⫋":"\u2ACB","⊊":"\u228A","⪿":"\u2ABF","⥹":"\u2979","⊂":"\u2282","⊆":"\u2286","⫅":"\u2AC5","⊊":"\u228A","⫋":"\u2ACB","⫇":"\u2AC7","⫕":"\u2AD5","⫓":"\u2AD3","≻":"\u227B","⪸":"\u2AB8","≽":"\u227D","⪰":"\u2AB0","⪺":"\u2ABA","⪶":"\u2AB6","⋩":"\u22E9","≿":"\u227F","∑":"\u2211","♪":"\u266A","¹":"\xB9","¹":"\xB9","²":"\xB2","²":"\xB2","³":"\xB3","³":"\xB3","⊃":"\u2283","⫆":"\u2AC6","⪾":"\u2ABE","⫘":"\u2AD8","⊇":"\u2287","⫄":"\u2AC4","⟉":"\u27C9","⫗":"\u2AD7","⥻":"\u297B","⫂":"\u2AC2","⫌":"\u2ACC","⊋":"\u228B","⫀":"\u2AC0","⊃":"\u2283","⊇":"\u2287","⫆":"\u2AC6","⊋":"\u228B","⫌":"\u2ACC","⫈":"\u2AC8","⫔":"\u2AD4","⫖":"\u2AD6","⇙":"\u21D9","⤦":"\u2926","↙":"\u2199","↙":"\u2199","⤪":"\u292A","ß":"\xDF","ß":"\xDF","⌖":"\u2316","τ":"\u03C4","⎴":"\u23B4","ť":"\u0165","ţ":"\u0163","т":"\u0442","⃛":"\u20DB","⌕":"\u2315","𝔱":"\u{1D531}","∴":"\u2234","∴":"\u2234","θ":"\u03B8","ϑ":"\u03D1","ϑ":"\u03D1","≈":"\u2248","∼":"\u223C"," ":"\u2009","≈":"\u2248","∼":"\u223C","þ":"\xFE","þ":"\xFE","˜":"\u02DC","×":"\xD7","×":"\xD7","⊠":"\u22A0","⨱":"\u2A31","⨰":"\u2A30","∭":"\u222D","⤨":"\u2928","⊤":"\u22A4","⌶":"\u2336","⫱":"\u2AF1","𝕥":"\u{1D565}","⫚":"\u2ADA","⤩":"\u2929","‴":"\u2034","™":"\u2122","▵":"\u25B5","▿":"\u25BF","◃":"\u25C3","⊴":"\u22B4","≜":"\u225C","▹":"\u25B9","⊵":"\u22B5","◬":"\u25EC","≜":"\u225C","⨺":"\u2A3A","⨹":"\u2A39","⧍":"\u29CD","⨻":"\u2A3B","⏢":"\u23E2","𝓉":"\u{1D4C9}","ц":"\u0446","ћ":"\u045B","ŧ":"\u0167","≬":"\u226C","↞":"\u219E","↠":"\u21A0","⇑":"\u21D1","⥣":"\u2963","ú":"\xFA","ú":"\xFA","↑":"\u2191","ў":"\u045E","ŭ":"\u016D","û":"\xFB","û":"\xFB","у":"\u0443","⇅":"\u21C5","ű":"\u0171","⥮":"\u296E","⥾":"\u297E","𝔲":"\u{1D532}","ù":"\xF9","ù":"\xF9","↿":"\u21BF","↾":"\u21BE","▀":"\u2580","⌜":"\u231C","⌜":"\u231C","⌏":"\u230F","◸":"\u25F8","ū":"\u016B","¨":"\xA8","¨":"\xA8","ų":"\u0173","𝕦":"\u{1D566}","↑":"\u2191","↕":"\u2195","↿":"\u21BF","↾":"\u21BE","⊎":"\u228E","υ":"\u03C5","ϒ":"\u03D2","υ":"\u03C5","⇈":"\u21C8","⌝":"\u231D","⌝":"\u231D","⌎":"\u230E","ů":"\u016F","◹":"\u25F9","𝓊":"\u{1D4CA}","⋰":"\u22F0","ũ":"\u0169","▵":"\u25B5","▴":"\u25B4","⇈":"\u21C8","ü":"\xFC","ü":"\xFC","⦧":"\u29A7","⇕":"\u21D5","⫨":"\u2AE8","⫩":"\u2AE9","⊨":"\u22A8","⦜":"\u299C","ϵ":"\u03F5","ϰ":"\u03F0","∅":"\u2205","ϕ":"\u03D5","ϖ":"\u03D6","∝":"\u221D","↕":"\u2195","ϱ":"\u03F1","ς":"\u03C2","⊊︀":"\u228A\uFE00","⫋︀":"\u2ACB\uFE00","⊋︀":"\u228B\uFE00","⫌︀":"\u2ACC\uFE00","ϑ":"\u03D1","⊲":"\u22B2","⊳":"\u22B3","в":"\u0432","⊢":"\u22A2","∨":"\u2228","⊻":"\u22BB","≚":"\u225A","⋮":"\u22EE","|":"|","|":"|","𝔳":"\u{1D533}","⊲":"\u22B2","⊂⃒":"\u2282\u20D2","⊃⃒":"\u2283\u20D2","𝕧":"\u{1D567}","∝":"\u221D","⊳":"\u22B3","𝓋":"\u{1D4CB}","⫋︀":"\u2ACB\uFE00","⊊︀":"\u228A\uFE00","⫌︀":"\u2ACC\uFE00","⊋︀":"\u228B\uFE00","⦚":"\u299A","ŵ":"\u0175","⩟":"\u2A5F","∧":"\u2227","≙":"\u2259","℘":"\u2118","𝔴":"\u{1D534}","𝕨":"\u{1D568}","℘":"\u2118","≀":"\u2240","≀":"\u2240","𝓌":"\u{1D4CC}","⋂":"\u22C2","◯":"\u25EF","⋃":"\u22C3","▽":"\u25BD","𝔵":"\u{1D535}","⟺":"\u27FA","⟷":"\u27F7","ξ":"\u03BE","⟸":"\u27F8","⟵":"\u27F5","⟼":"\u27FC","⋻":"\u22FB","⨀":"\u2A00","𝕩":"\u{1D569}","⨁":"\u2A01","⨂":"\u2A02","⟹":"\u27F9","⟶":"\u27F6","𝓍":"\u{1D4CD}","⨆":"\u2A06","⨄":"\u2A04","△":"\u25B3","⋁":"\u22C1","⋀":"\u22C0","ý":"\xFD","ý":"\xFD","я":"\u044F","ŷ":"\u0177","ы":"\u044B","¥":"\xA5","¥":"\xA5","𝔶":"\u{1D536}","ї":"\u0457","𝕪":"\u{1D56A}","𝓎":"\u{1D4CE}","ю":"\u044E","ÿ":"\xFF","ÿ":"\xFF","ź":"\u017A","ž":"\u017E","з":"\u0437","ż":"\u017C","ℨ":"\u2128","ζ":"\u03B6","𝔷":"\u{1D537}","ж":"\u0436","⇝":"\u21DD","𝕫":"\u{1D56B}","𝓏":"\u{1D4CF}","‍":"\u200D","‌":"\u200C"},qn=Nd;function Bd(e){return e.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(t,r)=>{if(typeof qn[t]=="string")return qn[t];if(r.charAt(0)!=="#"||t.charAt(t.length-1)!==";")return t;let n;r.charAt(1)==="x"?n=parseInt(r.substr(2),16):n=parseInt(r.substr(1),10);let o="";return n>=55296&&n<=57343||n>1114111?"\uFFFD":(n>65535&&(n-=65536,o+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),o+=String.fromCharCode(n),o)})}function Ct(e){return e.trim().replace(/[<>"'?&]/g,t=>{let r=t.charCodeAt(0).toString(16);return r.length<2&&(r="0"+r),"&#x"+r.toUpperCase()+";"})}function Pi(e){return"<div>"+Ct(e).replace(/\n/g,"<br />")+"</div>"}function ji(e){return e=e.replace(/\r?\n/g,"").replace(/<\!\-\-.*?\-\->/gi," ").replace(/<br\b[^>]*>/gi,`
|
|
163
163
|
`).replace(/<\/?(p|div|table|tr|td|th)\b[^>]*>/gi,`
|
|
164
164
|
|
|
165
165
|
`).replace(/<script\b[^>]*>.*?<\/script\b[^>]*>/gi," ").replace(/^.*<body\b[^>]*>/i,"").replace(/^.*<\/head\b[^>]*>/i,"").replace(/^.*<\!doctype\b[^>]*>/i,"").replace(/<\/body\b[^>]*>.*$/i,"").replace(/<\/html\b[^>]*>.*$/i,"").replace(/<a\b[^>]*href\s*=\s*["']?([^\s"']+)[^>]*>/gi," ($1) ").replace(/<\/?(span|em|i|strong|b|u|a)\b[^>]*>/gi,"").replace(/<li\b[^>]*>[\n\u0001\s]*/gi,"* ").replace(/<hr\b[^>]*>/g,`
|
|
@@ -169,59 +169,60 @@ ${a}
|
|
|
169
169
|
|
|
170
170
|
`).replace(/^\n+/,`
|
|
171
171
|
`).replace(/\n+$/,`
|
|
172
|
-
`),
|
|
173
|
-
`)}return
|
|
174
|
-
${
|
|
175
|
-
${
|
|
172
|
+
`),e=Bd(e),e}function Ri(e){return[].concat(e.name||[]).concat(e.name?`<${e.address}>`:e.address).join(" ")}function Un(e){let t=[],r=(n,o)=>{if(o&&t.push(", "),n.group){let i=`${n.name}:`,s=";";t.push(i),n.group.forEach(r),t.push(s)}else t.push(Ri(n))};return e.forEach(r),t.join("")}function Fi(e){return`<a href="mailto:${Ct(e.address)}" class="postal-email-address">${Ct(e.name||`<${e.address}>`)}</a>`}function Wn(e){let t=[],r=(n,o)=>{if(o&&t.push('<span class="postal-email-address-separator">, </span>'),n.group){let i=`<span class="postal-email-address-group">${Ct(n.name)}:</span>`,s='<span class="postal-email-address-group">;</span>';t.push(i),n.group.forEach(r),t.push(s)}else t.push(Fi(n))};return e.forEach(r),t.join(" ")}function Gd(e,t,r){e=(e||"").toString(),t=t||76;let n=0,o=e.length,i="",s,a;for(;n<o;){if(s=e.substr(n,t),s.length<t){i+=s;break}if(a=s.match(/^[^\n\r]*(\r?\n|\r)/)){s=a[0],i+=s,n+=s.length;continue}else(a=s.match(/(\s+)[^\s]*$/))&&a[0].length-(r?(a[1]||"").length:0)<s.length?s=s.substr(0,s.length-(a[0].length-(r?(a[1]||"").length:0))):(a=e.substr(n+s.length).match(/^[^\s]+(\s*)/))&&(s=s+a[0].substr(0,a[0].length-(r?0:(a[1]||"").length)));i+=s,n+=s.length,n<o&&(i+=`\r
|
|
173
|
+
`)}return i}function Vn(e){let t=[];if(e.from&&t.push({key:"From",val:Ri(e.from)}),e.subject&&t.push({key:"Subject",val:e.subject}),e.date){let s={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},a=typeof Intl>"u"?e.date:new Intl.DateTimeFormat("default",s).format(new Date(e.date));t.push({key:"Date",val:a})}e.to&&e.to.length&&t.push({key:"To",val:Un(e.to)}),e.cc&&e.cc.length&&t.push({key:"Cc",val:Un(e.cc)}),e.bcc&&e.bcc.length&&t.push({key:"Bcc",val:Un(e.bcc)});let r=t.map(s=>s.key.length).reduce((s,a)=>a>s?a:s,0);t=t.flatMap(s=>{let a=r-s.key.length,l=`${s.key}: ${" ".repeat(a)}`,d=`${" ".repeat(s.key.length+1)} ${" ".repeat(a)}`;return Gd(s.val,80,!0).split(/\r?\n/).map(u=>u.trim()).map((u,p)=>`${p?d:l}${u}`)});let n=t.map(s=>s.length).reduce((s,a)=>a>s?a:s,0),o="-".repeat(n);return`
|
|
174
|
+
${o}
|
|
175
|
+
${t.join(`
|
|
176
176
|
`)}
|
|
177
|
-
${
|
|
178
|
-
`}function
|
|
179
|
-
<div class="postal-email-header-row">`)}${
|
|
180
|
-
`,",",";"].includes(r)&&(this.node.noBreak=!0),this.list.push(this.node),this.node=null,this.operatorExpecting="",this.escaped=!1;return}else if(!this.operatorExpecting&&
|
|
181
|
-
`&&(
|
|
177
|
+
${o}
|
|
178
|
+
`}function Kn(e){let t=[];if(e.from&&t.push(`<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${Fi(e.from)}</div>`),e.subject&&t.push(`<div class="postal-email-header-key">Subject</div><div class="postal-email-header-value postal-email-header-subject">${Ct(e.subject)}</div>`),e.date){let n={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},o=typeof Intl>"u"?e.date:new Intl.DateTimeFormat("default",n).format(new Date(e.date));t.push(`<div class="postal-email-header-key">Date</div><div class="postal-email-header-value postal-email-header-date" data-date="${Ct(e.date)}">${Ct(o)}</div>`)}return e.to&&e.to.length&&t.push(`<div class="postal-email-header-key">To</div><div class="postal-email-header-value">${Wn(e.to)}</div>`),e.cc&&e.cc.length&&t.push(`<div class="postal-email-header-key">Cc</div><div class="postal-email-header-value">${Wn(e.cc)}</div>`),e.bcc&&e.bcc.length&&t.push(`<div class="postal-email-header-key">Bcc</div><div class="postal-email-header-value">${Wn(e.bcc)}</div>`),`<div class="postal-email-header">${t.length?'<div class="postal-email-header-row">':""}${t.join(`</div>
|
|
179
|
+
<div class="postal-email-header-row">`)}${t.length?"</div>":""}</div>`}function Ld(e,t){let r=!1,n="text",o,i=[],s={address:[],comment:[],group:[],text:[],textWasQuoted:[]},a,l,d=!1;for(a=0,l=e.length;a<l;a++){let c=e[a],u=a?e[a-1]:null;if(c.type==="operator")switch(c.value){case"<":n="address",d=!1;break;case"(":n="comment",d=!1;break;case":":n="group",r=!0,d=!1;break;case'"':d=!d,n="text";break;default:n="text",d=!1;break}else c.value&&(n==="address"&&(c.value=c.value.replace(/^[^<]*<\s*/,"")),u&&u.noBreak&&s[n].length?(s[n][s[n].length-1]+=c.value,n==="text"&&d&&(s.textWasQuoted[s.textWasQuoted.length-1]=!0)):(s[n].push(c.value),n==="text"&&s.textWasQuoted.push(d)))}if(!s.text.length&&s.comment.length&&(s.text=s.comment,s.comment=[]),r){s.text=s.text.join(" ");let c=[];s.group.length&&Jn(s.group.join(","),{_depth:t+1}).forEach(p=>{p.group?c=c.concat(p.group):c.push(p)}),i.push({name:vt(s.text||o&&o.name),group:c})}else{if(!s.address.length&&s.text.length){for(a=s.text.length-1;a>=0;a--)if(!s.textWasQuoted[a]&&s.text[a].match(/^[^@\s]+@[^@\s]+$/)){s.address=s.text.splice(a,1),s.textWasQuoted.splice(a,1);break}let c=function(u){return s.address.length?u:(s.address=[u.trim()]," ")};if(!s.address.length)for(a=s.text.length-1;a>=0&&!(!s.textWasQuoted[a]&&(s.text[a]=s.text[a].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,c).trim(),s.address.length));a--);}if(!s.text.length&&s.comment.length&&(s.text=s.comment,s.comment=[]),s.address.length>1&&(s.text=s.text.concat(s.address.splice(1))),s.text=s.text.join(" "),s.address=s.address.join(" "),!s.address&&/^=\?[^=]+?=$/.test(s.text.trim())){let c=vt(s.text);if(/<[^<>]+@[^<>]+>/.test(c)){let u=Jn(c);if(u&&u.length)return u}return[{address:"",name:c}]}o={address:s.address||s.text||"",name:vt(s.text||s.address||"")},o.address===o.name&&((o.address||"").match(/@/)?o.name="":o.address=""),i.push(o)}return i}var zn=class{constructor(t){this.str=(t||"").toString(),this.operatorCurrent="",this.operatorExpecting="",this.node=null,this.escaped=!1,this.list=[],this.operators={'"':'"',"(":")","<":">",",":"",":":";",";":""}}tokenize(){let t=[];for(let r=0,n=this.str.length;r<n;r++){let o=this.str.charAt(r),i=r<n-1?this.str.charAt(r+1):null;this.checkChar(o,i)}return this.list.forEach(r=>{r.value=(r.value||"").toString().trim(),r.value&&t.push(r)}),t}checkChar(t,r){if(!this.escaped){if(t===this.operatorExpecting){this.node={type:"operator",value:t},r&&![" "," ","\r",`
|
|
180
|
+
`,",",";"].includes(r)&&(this.node.noBreak=!0),this.list.push(this.node),this.node=null,this.operatorExpecting="",this.escaped=!1;return}else if(!this.operatorExpecting&&t in this.operators){this.node={type:"operator",value:t},this.list.push(this.node),this.node=null,this.operatorExpecting=this.operators[t],this.escaped=!1;return}else if(this.operatorExpecting==='"'&&t==="\\"){this.escaped=!0;return}}this.node||(this.node={type:"text",value:""},this.list.push(this.node)),t===`
|
|
181
|
+
`&&(t=" "),(t.charCodeAt(0)>=33||[" "," "].includes(t))&&(this.node.value+=t),this.escaped=!1}},Hd=50;function Jn(e,t){t=t||{};let r=t._depth||0;if(r>Hd)return[];let o=new zn(e).tokenize(),i=[],s=[],a=[];if(o.forEach(l=>{l.type==="operator"&&(l.value===","||l.value===";")?(s.length&&i.push(s),s=[]):s.push(l)}),s.length&&i.push(s),i.forEach(l=>{l=Ld(l,r),l.length&&(a=a.concat(l))}),t.flatten){let l=[],d=c=>{c.forEach(u=>{if(u.group)return d(u.group);l.push(u)})};return d(a),l}return a}var Tr=Jn;function Ni(e){for(var t="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(e),o=n.byteLength,i=o%3,s=o-i,a,l,d,c,u,p=0;p<s;p=p+3)u=n[p]<<16|n[p+1]<<8|n[p+2],a=(u&16515072)>>18,l=(u&258048)>>12,d=(u&4032)>>6,c=u&63,t+=r[a]+r[l]+r[d]+r[c];return i==1?(u=n[s],a=(u&252)>>2,l=(u&3)<<4,t+=r[a]+r[l]+"=="):i==2&&(u=n[s]<<8|n[s+1],a=(u&64512)>>10,l=(u&1008)>>4,d=(u&15)<<2,t+=r[a]+r[l]+r[d]+"="),t}var Md=256,qd=2*1024*1024;function Yn(e){return e.replace(/-(.)/g,(t,r)=>r.toUpperCase())}var rr=class e{static parse(t,r){return new e(r).parse(t)}constructor(t){this.options=t||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||Md,maxHeadersSize:this.options.maxHeadersSize||qd},this.root=this.currentNode=new $t({postalMime:this,...this.mimeOptions}),this.boundaries=[],this.textContent={},this.attachments=[],this.attachmentEncoding=(this.options.attachmentEncoding||"").toString().replace(/[-_\s]/g,"").trim().toLowerCase()||"arraybuffer",this.started=!1}async finalize(){await this.root.finalize()}async processLine(t,r){let n=this.boundaries;if(n.length&&t.length>2&&t[0]===45&&t[1]===45)for(let o=n.length-1;o>=0;o--){let i=n[o];if(t.length<i.value.length+2)continue;let s=!0;for(let c=0;c<i.value.length;c++)if(t[c+2]!==i.value[c]){s=!1;break}if(!s)continue;let a=i.value.length+2,l=!1;t.length>=i.value.length+4&&t[i.value.length+2]===45&&t[i.value.length+3]===45&&(l=!0,a=i.value.length+4);let d=!0;for(let c=a;c<t.length;c++)if(t[c]!==32&&t[c]!==9){d=!1;break}if(d)return l?(await i.node.finalize(),this.currentNode=i.node.parentNode||this.root):(await i.node.finalizeChildNodes(),this.currentNode=new $t({postalMime:this,parentNode:i.node,parentMultipartType:i.node.contentType.multipart,...this.mimeOptions})),r?this.finalize():void 0}if(this.currentNode.feed(t),r)return this.finalize()}readLine(){let t=this.readPos,r=this.readPos;for(;this.readPos<this.av.length;){let n=this.av[this.readPos++];if(n!==13&&n!==10&&(r=this.readPos),n===10)return{bytes:new Uint8Array(this.buf,t,r-t),done:this.readPos>=this.av.length}}return{bytes:new Uint8Array(this.buf,t,r-t),done:this.readPos>=this.av.length}}async processNodeTree(){let t={},r=new Set,n=this.textMap=new Map,o=this.forceRfc822Attachments(),i=async(s,a,l)=>{if(a=a||!1,l=l||!1,s.contentType.multipart)s.contentType.multipart==="alternative"?a=s:s.contentType.multipart==="related"&&(l=s);else if(this.isInlineMessageRfc822(s)&&!o){let d=new e;s.subMessage=await d.parse(s.content),n.has(s)||n.set(s,{});let c=n.get(s);(s.subMessage.text||!s.subMessage.html)&&(c.plain=c.plain||[],c.plain.push({type:"subMessage",value:s.subMessage}),r.add("plain")),s.subMessage.html&&(c.html=c.html||[],c.html.push({type:"subMessage",value:s.subMessage}),r.add("html")),d.textMap&&d.textMap.forEach((u,p)=>{n.set(p,u)});for(let u of s.subMessage.attachments||[])this.attachments.push(u)}else if(this.isInlineTextNode(s)){let d=s.contentType.parsed.value.substr(s.contentType.parsed.value.indexOf("/")+1),c=a||s;n.has(c)||n.set(c,{});let u=n.get(c);u[d]=u[d]||[],u[d].push({type:"text",value:s.getTextContent()}),r.add(d)}else if(s.content){let d=s.contentDisposition?.parsed?.params?.filename||s.contentType.parsed.params.name||null,c={filename:d?vt(d):null,mimeType:s.contentType.parsed.value,disposition:s.contentDisposition?.parsed?.value||null};switch(l&&s.contentId&&(c.related=!0),s.contentDescription&&(c.description=s.contentDescription),s.contentId&&(c.contentId=s.contentId),s.contentType.parsed.value){case"text/calendar":case"application/ics":{s.contentType.parsed.params.method&&(c.method=s.contentType.parsed.params.method.toString().toUpperCase().trim());let u=s.getTextContent().replace(/\r?\n/g,`
|
|
182
182
|
`).replace(/\n*$/,`
|
|
183
|
-
`);c.content=
|
|
184
|
-
`)}),this.textContent=e}isInlineTextNode(e){if(e.contentDisposition?.parsed?.value==="attachment")return!1;switch(e.contentType.parsed?.value){case"text/html":case"text/plain":return!0;default:return!1}}isInlineMessageRfc822(e){return e.contentType.parsed?.value!=="message/rfc822"?!1:(e.contentDisposition?.parsed?.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}forceRfc822Attachments(){if(this.options.forceRfc822Attachments)return!0;let e=!1,r=n=>{n.contentType.multipart||n.contentType.parsed&&["message/delivery-status","message/feedback-report"].includes(n.contentType.parsed.value)&&(e=!0);for(let i of n.childNodes)r(i)};return r(this.root),e}async resolveStream(e){let r=0,n=[],i=e.getReader();for(;;){let{done:a,value:l}=await i.read();if(a)break;n.push(l),r+=l.length}let o=new Uint8Array(r),s=0;for(let a of n)o.set(a,s),s+=a.length;return o}async parse(e){if(this.started)throw new Error("Can not reuse parser, create a new PostalMime object");for(this.started=!0,e&&typeof e.getReader=="function"&&(e=await this.resolveStream(e)),e=e||new ArrayBuffer(0),typeof e=="string"&&(e=nt.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await it(e)),e.buffer instanceof ArrayBuffer&&(e=new Uint8Array(e).buffer),this.buf=e,this.av=new Uint8Array(e),this.readPos=0;this.readPos<this.av.length;){let i=this.readLine();await this.processLine(i.bytes,i.done)}await this.processNodeTree();let r={headers:this.root.headers.map(i=>({key:i.key,originalKey:i.originalKey,value:i.value})).reverse()};for(let i of["from","sender"]){let o=this.root.headers.find(s=>s.key===i);if(o&&o.value){let s=Dr(o.value);s&&s.length&&(r[i]=s[0])}}for(let i of["delivered-to","return-path"]){let o=this.root.headers.find(s=>s.key===i);if(o&&o.value){let s=Dr(o.value);if(s&&s.length&&s[0].address){let a=Wn(i);r[a]=s[0].address}}}for(let i of["to","cc","bcc","reply-to"]){let o=this.root.headers.filter(a=>a.key===i),s=[];if(o.filter(a=>a&&a.value).map(a=>Dr(a.value)).forEach(a=>s=s.concat(a||[])),s&&s.length){let a=Wn(i);r[a]=s}}for(let i of["subject","message-id","in-reply-to","references"]){let o=this.root.headers.find(s=>s.key===i);if(o&&o.value){let s=Wn(i);r[s]=gt(o.value)}}let n=this.root.headers.find(i=>i.key==="date");if(n){let i=new Date(n.value);i.toString()==="Invalid Date"?i=n.value:i=i.toISOString(),r.date=i}switch(this.textContent?.html&&(r.html=this.textContent.html),this.textContent?.plain&&(r.text=this.textContent.plain),r.attachments=this.attachments,r.headerLines=(this.root.rawHeaderLines||[]).slice().reverse(),this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let o of r.attachments||[])o?.content&&(o.content=Do(o.content),o.encoding="base64");break;case"utf8":let i=new TextDecoder("utf8");for(let o of r.attachments||[])o?.content&&(o.content=i.decode(o.content),o.encoding="utf8");break;default:throw new Error("Unknown attachment encoding")}return r}};var Wo=pe(No(),1),Td="6.14.0";function oe(t){let e=new URLSearchParams;return t.limit!==void 0&&e.set("limit",t.limit.toString()),"after"in t&&t.after!==void 0&&e.set("after",t.after),"before"in t&&t.before!==void 0&&e.set("before",t.before),e.toString()}var Od=class{constructor(t){this.resend=t}async create(t,e={}){return await this.resend.post("/api-keys",t,e)}async list(t={}){let e=oe(t),r=e?`/api-keys?${e}`:"/api-keys";return await this.resend.get(r)}async remove(t){return await this.resend.delete(`/api-keys/${t}`)}},Id=class{constructor(t){this.resend=t}async get(t){return await this.resend.get(`/automations/${t.automationId}/runs/${t.runId}`)}async list(t){let e=oe(t),r=new URLSearchParams(e);if(t.status){let o=Array.isArray(t.status)?t.status.join(","):t.status;r.set("status",o)}let n=r.toString(),i=n?`/automations/${t.automationId}/runs?${n}`:`/automations/${t.automationId}/runs`;return await this.resend.get(i)}};function Vo(t){switch(t.type){case"trigger":return{key:t.key,type:t.type,config:{event_name:t.config.eventName}};case"delay":return{key:t.key,type:t.type,config:t.config};case"send_email":return{key:t.key,type:t.type,config:{template:t.config.template,subject:t.config.subject,from:t.config.from,reply_to:t.config.replyTo}};case"wait_for_event":return{key:t.key,type:t.type,config:{event_name:t.config.eventName,timeout:t.config.timeout,filter_rule:t.config.filterRule}};case"condition":return{key:t.key,type:t.type,config:t.config};case"contact_update":return{key:t.key,type:t.type,config:{first_name:t.config.firstName,last_name:t.config.lastName,unsubscribed:t.config.unsubscribed,properties:t.config.properties}};case"contact_delete":return{key:t.key,type:t.type,config:t.config};case"add_to_segment":return{key:t.key,type:t.type,config:{segment_id:t.config.segmentId}}}}function Ko(t){return{from:t.from,to:t.to,type:t.type}}function jd(t){return{name:t.name,status:t.status,steps:t.steps.map(Vo),connections:t.connections.map(Ko)}}function Pd(t){return{event:t.event,contact_id:t.contactId,email:t.email,payload:t.payload}}var Rd=class{constructor(t){this.resend=t,this.runs=new Id(this.resend)}async create(t){return await this.resend.post("/automations",jd(t))}async list(t={}){let e=[oe(t)];t.status&&e.push(`status=${encodeURIComponent(t.status)}`);let r=e.filter(Boolean).join("&"),n=r?`/automations?${r}`:"/automations";return await this.resend.get(n)}async get(t){return await this.resend.get(`/automations/${t}`)}async remove(t){return await this.resend.delete(`/automations/${t}`)}async update(t,e){let r={};return e.name!==void 0&&(r.name=e.name),e.status!==void 0&&(r.status=e.status),e.steps!==void 0&&(r.steps=e.steps.map(Vo)),e.connections!==void 0&&(r.connections=e.connections.map(Ko)),await this.resend.patch(`/automations/${t}`,r)}async stop(t){return await this.resend.post(`/automations/${t}/stop`)}};function Fd(t){return t?.map(e=>({content:e.content,filename:e.filename,path:e.path,content_type:e.contentType,content_id:e.contentId}))}function zo(t){return{attachments:Fd(t.attachments),bcc:t.bcc,cc:t.cc,from:t.from,headers:t.headers,html:t.html,reply_to:t.replyTo,scheduled_at:t.scheduledAt,subject:t.subject,tags:t.tags,text:t.text,to:t.to,template:t.template?{id:t.template.id,variables:t.template.variables}:void 0,topic_id:t.topicId}}async function ir(t){let e;try{({render:e}=await import("@react-email/render"))}catch{throw new Error("Failed to render React component. Make sure to install `@react-email/render` or `@react-email/components`.")}return e(t)}var Bd=class{constructor(t){this.resend=t}async send(t,e){return this.create(t,e)}async create(t,e){let r=[];for(let n of t)n.react&&(n.html=await ir(n.react),n.react=void 0),r.push(zo(n));return await this.resend.post("/emails/batch",r,{...e,headers:{"x-batch-validation":e?.batchValidation??"strict",...e?.headers}})}},Nd=class{constructor(t){this.resend=t}async create(t,e={}){let r=t.react?await ir(t.react):t.html;return await this.resend.post("/broadcasts",{name:t.name,segment_id:t.segmentId,audience_id:t.audienceId,preview_text:t.previewText,from:t.from,html:r,reply_to:t.replyTo,subject:t.subject,text:t.text,topic_id:t.topicId,send:t.send,scheduled_at:t.scheduledAt},e)}async send(t,e){return await this.resend.post(`/broadcasts/${t}/send`,{scheduled_at:e?.scheduledAt})}async list(t={}){let e=oe(t),r=e?`/broadcasts?${e}`:"/broadcasts";return await this.resend.get(r)}async get(t){return await this.resend.get(`/broadcasts/${t}`)}async remove(t){return await this.resend.delete(`/broadcasts/${t}`)}async update(t,e){let r=e.react?await ir(e.react):e.html;return await this.resend.patch(`/broadcasts/${t}`,{name:e.name,segment_id:e.segmentId,audience_id:e.audienceId,from:e.from,html:r,text:e.text,subject:e.subject,reply_to:e.replyTo,preview_text:e.previewText,topic_id:e.topicId})}};function Ho(t){return{id:t.id,key:t.key,createdAt:t.created_at,type:t.type,fallbackValue:t.fallback_value}}function Go(t){return"key"in t?{key:t.key,type:t.type,fallback_value:t.fallbackValue}:{fallback_value:t.fallbackValue}}var Hd=class{constructor(t){this.resend=t}async create(t){let e=Go(t);return await this.resend.post("/contact-properties",e)}async list(t={}){let e=oe(t),r=e?`/contact-properties?${e}`:"/contact-properties",n=await this.resend.get(r);return n.data?{data:{...n.data,data:n.data.data.map(i=>Ho(i))},headers:n.headers,error:null}:n}async get(t){if(!t)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};let e=await this.resend.get(`/contact-properties/${t}`);return e.data?{data:{object:"contact_property",...Ho(e.data)},headers:e.headers,error:null}:e}async update(t){if(!t.id)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};let e=Go(t);return await this.resend.patch(`/contact-properties/${t.id}`,e)}async remove(t){return t?await this.resend.delete(`/contact-properties/${t}`):{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}}}},Gd=class{constructor(t){this.resend=t}async create(t,e={}){let r=this.buildCreateFormData(t);return this.resend.post("/contacts/imports",r,e)}async list(t={}){let e=new URLSearchParams(oe(t));t.status!==void 0&&e.set("status",t.status);let r=e.toString(),n=r?`/contacts/imports?${r}`:"/contacts/imports";return this.resend.get(n)}async get(t){return this.resend.get(`/contacts/imports/${t}`)}buildCreateFormData(t){let e=new FormData;return e.append("file",t.file),this.appendField(e,"column_map",this.buildColumnMap(t.columnMap??null)),this.appendField(e,"on_conflict",t.onConflict??null),this.appendField(e,"segments",t.segments??null),this.appendField(e,"topics",t.topics??null),e}buildColumnMap(t){return t===null?null:{email:t.email,first_name:t.firstName,last_name:t.lastName,unsubscribed:t.unsubscribed,properties:t.properties}}appendField(t,e,r){r!==null&&t.append(e,typeof r=="string"?r:JSON.stringify(r))}},Ld=class{constructor(t){this.resend=t}async list(t){if(!t.contactId&&!t.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let e=t.email?t.email:t.contactId,r=oe(t),n=r?`/contacts/${e}/segments?${r}`:`/contacts/${e}/segments`;return await this.resend.get(n)}async add(t){if(!t.contactId&&!t.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let e=t.email?t.email:t.contactId;return this.resend.post(`/contacts/${e}/segments/${t.segmentId}`)}async remove(t){if(!t.contactId&&!t.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let e=t.email?t.email:t.contactId;return this.resend.delete(`/contacts/${e}/segments/${t.segmentId}`)}},Md=class{constructor(t){this.resend=t}async update(t){if(!t.id&&!t.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let e=t.email?t.email:t.id;return this.resend.patch(`/contacts/${e}/topics`,t.topics)}async list(t){if(!t.id&&!t.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let e=t.email?t.email:t.id,r=oe(t),n=r?`/contacts/${e}/topics?${r}`:`/contacts/${e}/topics`;return this.resend.get(n)}},qd=class{constructor(t){this.resend=t,this.imports=new Gd(this.resend),this.topics=new Md(this.resend),this.segments=new Ld(this.resend)}async create(t,e={}){return"audienceId"in t?"segments"in t||"topics"in t?{data:null,headers:null,error:{message:"`audienceId` is deprecated, and cannot be used together with `segments` or `topics`. Use `segments` instead to add one or more segments to the new contact.",statusCode:null,name:"invalid_parameter"}}:await this.resend.post(`/audiences/${t.audienceId}/contacts`,{unsubscribed:t.unsubscribed,email:t.email,first_name:t.firstName,last_name:t.lastName,properties:t.properties},e):await this.resend.post("/contacts",{unsubscribed:t.unsubscribed,email:t.email,first_name:t.firstName,last_name:t.lastName,properties:t.properties,segments:t.segments,topics:t.topics},e)}async list(t={}){let e=t.segmentId??t.audienceId;if(!e){let i=oe(t),o=i?`/contacts?${i}`:"/contacts";return await this.resend.get(o)}let r=oe(t),n=r?`/segments/${e}/contacts?${r}`:`/segments/${e}/contacts`;return await this.resend.get(n)}async get(t){return typeof t=="string"?this.resend.get(`/contacts/${t}`):!t.id&&!t.email?{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}}:t.audienceId?this.resend.get(`/audiences/${t.audienceId}/contacts/${t?.email?t?.email:t?.id}`):this.resend.get(`/contacts/${t?.email?t?.email:t?.id}`)}async update(t){return!t.id&&!t.email?{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}}:t.audienceId?await this.resend.patch(`/audiences/${t.audienceId}/contacts/${t?.email?t?.email:t?.id}`,{unsubscribed:t.unsubscribed,first_name:t.firstName,last_name:t.lastName,properties:t.properties}):await this.resend.patch(`/contacts/${t?.email?t?.email:t?.id}`,{unsubscribed:t.unsubscribed,first_name:t.firstName,last_name:t.lastName,properties:t.properties})}async remove(t){return typeof t=="string"?this.resend.delete(`/contacts/${t}`):!t.id&&!t.email?{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}}:t.audienceId?this.resend.delete(`/audiences/${t.audienceId}/contacts/${t?.email?t?.email:t?.id}`):this.resend.delete(`/contacts/${t?.email?t?.email:t?.id}`)}};function Ud(t){return{name:t.name,region:t.region,custom_return_path:t.customReturnPath,capabilities:t.capabilities,open_tracking:t.openTracking,click_tracking:t.clickTracking,tls:t.tls,tracking_subdomain:t.trackingSubdomain}}var Wd=class{constructor(t){this.resend=t}async create(t,e={}){return await this.resend.post("/domains/claim",{name:t.name,region:t.region,custom_return_path:t.customReturnPath,open_tracking:t.openTracking,click_tracking:t.clickTracking,tracking_subdomain:t.trackingSubdomain},e)}async get(t){return await this.resend.get(`/domains/${t}/claim`)}async verify(t){return await this.resend.post(`/domains/${t}/claim/verify`)}},Vd=class{constructor(t){this.resend=t,this.claims=new Wd(this.resend)}async create(t,e={}){return await this.resend.post("/domains",Ud(t),e)}async list(t={}){let e=oe(t),r=e?`/domains?${e}`:"/domains";return await this.resend.get(r)}async get(t){return await this.resend.get(`/domains/${t}`)}async update(t){return await this.resend.patch(`/domains/${t.id}`,{click_tracking:t.clickTracking,open_tracking:t.openTracking,tls:t.tls,capabilities:t.capabilities,tracking_subdomain:t.trackingSubdomain})}async remove(t){return await this.resend.delete(`/domains/${t}`)}async verify(t){return await this.resend.post(`/domains/${t}/verify`)}},Kd=class{constructor(t){this.resend=t}async get(t){let{emailId:e,id:r}=t;return await this.resend.get(`/emails/${e}/attachments/${r}`)}async list(t){let{emailId:e}=t,r=oe(t),n=r?`/emails/${e}/attachments?${r}`:`/emails/${e}/attachments`;return await this.resend.get(n)}},zd=class{constructor(t){this.resend=t}async get(t){let{emailId:e,id:r}=t;return await this.resend.get(`/emails/receiving/${e}/attachments/${r}`)}async list(t){let{emailId:e}=t,r=oe(t),n=r?`/emails/receiving/${e}/attachments?${r}`:`/emails/receiving/${e}/attachments`;return await this.resend.get(n)}},Jd=class{constructor(t){this.resend=t,this.attachments=new zd(t)}async get(t,e={}){let r=new URLSearchParams;e.html_format!==void 0&&r.set("html_format",e.html_format);let n=r.toString(),i=n?`/emails/receiving/${t}?${n}`:`/emails/receiving/${t}`;return await this.resend.get(i)}async list(t={}){let e=oe(t),r=e?`/emails/receiving?${e}`:"/emails/receiving";return await this.resend.get(r)}async forward(t){let{emailId:e,to:r,from:n}=t,i=t.passthrough!==!1,o=await this.get(e);if(o.error)return{data:null,error:o.error,headers:o.headers};let s=o.data,a=s.subject||"(no subject)";if(i)return this.forwardPassthrough(s,{to:r,from:n,subject:a});let l=a.startsWith("Fwd:")?a:`Fwd: ${a}`;return this.forwardWrapped(s,{to:r,from:n,subject:l,text:"text"in t?t.text:void 0,html:"html"in t?t.html:void 0})}async forwardPassthrough(t,e){let{to:r,from:n,subject:i}=e;if(!t.raw?.download_url)return{data:null,error:{name:"validation_error",message:"Raw email content is not available for this email",statusCode:400},headers:null};let o=await fetch(t.raw.download_url);if(!o.ok)return{data:null,error:{name:"application_error",message:"Failed to download raw email content",statusCode:o.status},headers:null};let s=await o.text(),a=await rr.parse(s,{attachmentEncoding:"base64"}),l=a.attachments.map(d=>{let c=d.contentId?d.contentId.replace(/^<|>$/g,""):void 0;return{filename:d.filename,content:d.content.toString(),content_type:d.mimeType,content_id:c||void 0}});return await this.resend.post("/emails",{from:n,to:r,subject:i,text:a.text||void 0,html:a.html||void 0,attachments:l.length>0?l:void 0})}async forwardWrapped(t,e){let{to:r,from:n,subject:i,text:o,html:s}=e;if(!t.raw?.download_url)return{data:null,error:{name:"validation_error",message:"Raw email content is not available for this email",statusCode:400},headers:null};let a=await fetch(t.raw.download_url);if(!a.ok)return{data:null,error:{name:"application_error",message:"Failed to download raw email content",statusCode:a.status},headers:null};let l=await a.text();return await this.resend.post("/emails",{from:n,to:r,subject:i,text:o,html:s,attachments:[{filename:"forwarded_message.eml",content:Buffer.from(l).toString("base64"),content_type:"message/rfc822"}]})}},Yd=class{constructor(t){this.resend=t,this.attachments=new Kd(t),this.receiving=new Jd(t)}async send(t,e={}){return this.create(t,e)}async create(t,e={}){let r={...t};return t.react&&(r.html=await ir(t.react)),await this.resend.post("/emails",zo(r),e)}async get(t){return await this.resend.get(`/emails/${t}`)}async list(t={}){let e=oe(t),r=e?`/emails?${e}`:"/emails";return await this.resend.get(r)}async update(t){return await this.resend.patch(`/emails/${t.id}`,{scheduled_at:t.scheduledAt})}async cancel(t){return await this.resend.post(`/emails/${t}/cancel`)}},Qd=class{constructor(t){this.resend=t}async send(t){return await this.resend.post("/events/send",Pd(t))}async create(t){return await this.resend.post("/events",t)}async get(t){return await this.resend.get(`/events/${encodeURIComponent(t)}`)}async list(t={}){let e=oe(t),r=e?`/events?${e}`:"/events";return await this.resend.get(r)}async update(t,e){return await this.resend.patch(`/events/${encodeURIComponent(t)}`,e)}async remove(t){return await this.resend.delete(`/events/${encodeURIComponent(t)}`)}},Xd=class{constructor(t){this.resend=t}async list(t={}){let e=oe(t),r=e?`/logs?${e}`:"/logs";return await this.resend.get(r)}async get(t){return await this.resend.get(`/logs/${t}`)}},Zd=class{constructor(t){this.resend=t}async create(t,e={}){return await this.resend.post("/segments",t,e)}async list(t={}){let e=oe(t),r=e?`/segments?${e}`:"/segments";return await this.resend.get(r)}async get(t){return await this.resend.get(`/segments/${t}`)}async remove(t){return await this.resend.delete(`/segments/${t}`)}};function em(t={}){let e=new URLSearchParams;return t.before&&e.set("before",t.before),t.after&&e.set("after",t.after),t.limit&&e.set("limit",t.limit.toString()),e.size>0?`?${e.toString()}`:""}function tm(t){return t?.map(e=>({key:e.key,type:e.type,fallback_value:e.fallbackValue}))}function Lo(t){return{name:"name"in t?t.name:void 0,subject:t.subject,html:t.html,text:t.text,alias:t.alias,from:t.from,reply_to:t.replyTo,variables:tm(t.variables)}}var Mo=class{constructor(t,e){this.promise=t,this.publishFn=e}then(t,e){return this.promise.then(t,e)}async publish(){let{data:t,error:e}=await this.promise;return e?{data:null,headers:null,error:e}:this.publishFn(t.id)}},rm=class{constructor(t){this.resend=t}create(t){return new Mo(this.performCreate(t),this.publish.bind(this))}async performCreate(t){let e={...t};return t.react&&(e.html=await ir(t.react)),this.resend.post("/templates",Lo(e))}async remove(t){return await this.resend.delete(`/templates/${t}`)}async get(t){return await this.resend.get(`/templates/${t}`)}async list(t={}){return this.resend.get(`/templates${em(t)}`)}duplicate(t){return new Mo(this.resend.post(`/templates/${t}/duplicate`),this.publish.bind(this))}async publish(t){return await this.resend.post(`/templates/${t}/publish`)}async update(t,e){return await this.resend.patch(`/templates/${t}`,Lo(e))}},nm=class{constructor(t){this.resend=t}async create(t){let{defaultSubscription:e,...r}=t;return await this.resend.post("/topics",{...r,default_subscription:e})}async list(){return await this.resend.get("/topics")}async get(t){return t?await this.resend.get(`/topics/${t}`):{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}}}async update(t){return t.id?await this.resend.patch(`/topics/${t.id}`,t):{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}}}async remove(t){return t?await this.resend.delete(`/topics/${t}`):{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}}}},im=class{constructor(t){this.resend=t}async create(t,e={}){return await this.resend.post("/webhooks",t,e)}async get(t){return await this.resend.get(`/webhooks/${t}`)}async list(t={}){let e=oe(t),r=e?`/webhooks?${e}`:"/webhooks";return await this.resend.get(r)}async update(t,e){return await this.resend.patch(`/webhooks/${t}`,e)}async remove(t){return await this.resend.delete(`/webhooks/${t}`)}verify(t){return new Wo.Webhook(t.webhookSecret).verify(t.payload,{"webhook-id":t.headers.id,"webhook-timestamp":t.headers.timestamp,"webhook-signature":t.headers.signature})}},qo="https://api.resend.com",Uo=`resend-node:${Td}`;function om(){return typeof process<"u"&&process.env&&process.env.RESEND_BASE_URL||qo}function sm(){return typeof process<"u"&&process.env&&process.env.RESEND_USER_AGENT||Uo}var Dt=class{constructor(t,e){if(this.key=t,this.segments=new Zd(this),this.apiKeys=new Od(this),this.audiences=this.segments,this.automations=new Rd(this),this.batch=new Bd(this),this.broadcasts=new Nd(this),this.contactProperties=new Hd(this),this.contacts=new qd(this),this.domains=new Vd(this),this.emails=new Yd(this),this.events=new Qd(this),this.logs=new Xd(this),this.templates=new rm(this),this.topics=new nm(this),this.webhooks=new im(this),!t&&(typeof process<"u"&&process.env&&(this.key=process.env.RESEND_API_KEY),!this.key))throw new Error('Missing API key. Pass it to the constructor `new Resend("re_123")`');this.baseUrl=e?.baseUrl??om(),this.userAgent=e?.userAgent??sm(),this.headers=new Headers({Authorization:`Bearer ${this.key}`,"User-Agent":this.userAgent,"Content-Type":"application/json"})}async fetchRequest(t,e={}){try{let r=await fetch(`${this.baseUrl}${t}`,e);if(!r.ok)try{let n=await r.text();return{data:null,error:JSON.parse(n),headers:Object.fromEntries(r.headers.entries())}}catch(n){if(n instanceof SyntaxError)return{data:null,error:{name:"application_error",statusCode:r.status,message:"Internal server error. We are unable to process your request right now, please try again later."},headers:Object.fromEntries(r.headers.entries())};let i={message:r.statusText,statusCode:r.status,name:"application_error"};return n instanceof Error?{data:null,error:{...i,message:n.message},headers:Object.fromEntries(r.headers.entries())}:{data:null,error:i,headers:Object.fromEntries(r.headers.entries())}}return{data:await r.json(),error:null,headers:Object.fromEntries(r.headers.entries())}}catch{return{data:null,error:{name:"application_error",statusCode:null,message:"Unable to fetch data. The request could not be resolved."},headers:null}}}async post(t,e,r={}){let n=new Headers(this.headers),i=typeof FormData<"u"&&e instanceof FormData;if(i&&n.delete("Content-Type"),r.headers)for(let[s,a]of new Headers(r.headers).entries())n.set(s,a);r.idempotencyKey&&n.set("Idempotency-Key",r.idempotencyKey);let o={method:"POST",body:i?e:JSON.stringify(e),...r,headers:n};return this.fetchRequest(t,o)}async get(t,e={}){let r=new Headers(this.headers);if(e.headers)for(let[i,o]of new Headers(e.headers).entries())r.set(i,o);let n={method:"GET",...e,headers:r};return this.fetchRequest(t,n)}async put(t,e,r={}){let n=new Headers(this.headers);if(r.headers)for(let[o,s]of new Headers(r.headers).entries())n.set(o,s);let i={method:"PUT",body:JSON.stringify(e),...r,headers:n};return this.fetchRequest(t,i)}async patch(t,e,r={}){let n=new Headers(this.headers);if(r.headers)for(let[o,s]of new Headers(r.headers).entries())n.set(o,s);let i={method:"PATCH",body:JSON.stringify(e),...r,headers:n};return this.fetchRequest(t,i)}async delete(t,e,r={}){let n=new Headers(this.headers);if(r.headers)for(let[o,s]of new Headers(r.headers).entries())n.set(o,s);let i={method:"DELETE",body:e===void 0?void 0:JSON.stringify(e),...r,headers:n};return this.fetchRequest(t,i)}};ye();var oi=pe(et(),1);function K(t,e){return t instanceof Error?t.message:e}function gs(t){return!!(t||!process.stdout.isTTY)}function N(t,e={}){gs(e.json)?console.log(JSON.stringify(t,null,2)):console.log(typeof t=="string"?t:JSON.stringify(t,null,2)),e.exitCode!==void 0&&process.exit(e.exitCode)}var hm=new Set(["content-type","retry-after"]);function gm(t){let e={};for(let[r,n]of Object.entries(t)){let i=r.toLowerCase();(hm.has(i)||i.startsWith("x-"))&&(e[i]=n)}return e}function h(t,e={}){let r=e.exitCode??1,n=t.headers&&Object.keys(t.headers).length>0?gm(t.headers):void 0,i=n!==void 0&&Object.keys(n).length>0;if(gs(e.json)){let o={message:t.message,code:t.code??"unknown"};typeof t.statusCode=="number"&&(o.statusCode=t.statusCode),i&&(o.headers=n),typeof t.body=="string"&&t.body.length>0&&(o.body=t.body),console.error(JSON.stringify({error:o},null,2))}else{console.error(`${oi.default.red("Error:")} ${t.message}`);let o=[];if(typeof t.statusCode=="number"&&o.push(`HTTP ${t.statusCode}`),i)for(let[s,a]of Object.entries(n))o.push(`${s}: ${a}`);o.length>0&&console.error(oi.default.dim(`[${o.join("; ")}]`))}process.exit(r)}var bs={sending_access:0,full_access:1};function bm(t,e){return bs[t]>=bs[e]}async function Z(t,e){let r=t.profile;try{let n=await _t(t.apiKey,r);if(!n){if(r){let i=we();if(!i.some(s=>s.name===r))throw new Error(`Profile "${r}" not found. Available profiles: ${i.map(s=>s.name).join(", ")||"(none)"}`)}throw new Error("No API key found. Set RESEND_API_KEY, use --api-key, or run: resend login")}if(n.permission){let i=e?.permission??"full_access";bm(n.permission,i)||h({message:`This command requires a full access API key. Your current key has sending access only.
|
|
185
|
-
${Tt}`,code:"insufficient_permissions"},{json:
|
|
186
|
-
`):process.stderr.write("\r\x1B[2K")},clear(){clearInterval(s),process.stderr.write("\r\x1B[2K")},warn(a){clearInterval(s),process.stderr.write(`\r\x1B[2K ${
|
|
187
|
-
`)},fail(a){clearInterval(s),process.stderr.write(`\r\x1B[2K ${
|
|
188
|
-
`)}}}J();function S(
|
|
183
|
+
`);c.content=it.encode(u);break}default:c.content=s.content}this.attachments.push(c)}for(let d of s.childNodes)await i(d,a,l)};await i(this.root,!1,!1),n.forEach(s=>{r.forEach(a=>{if(t[a]||(t[a]=[]),s[a])s[a].forEach(l=>{switch(l.type){case"text":t[a].push(l.value);break;case"subMessage":switch(a){case"html":t[a].push(Kn(l.value));break;case"plain":t[a].push(Vn(l.value));break}break}});else{let l;switch(a){case"html":l="plain";break;case"plain":l="html";break}(s[l]||[]).forEach(d=>{switch(d.type){case"text":switch(a){case"html":t[a].push(Pi(d.value));break;case"plain":t[a].push(ji(d.value));break}break;case"subMessage":switch(a){case"html":t[a].push(Kn(d.value));break;case"plain":t[a].push(Vn(d.value));break}break}})}})}),Object.keys(t).forEach(s=>{t[s]=t[s].join(`
|
|
184
|
+
`)}),this.textContent=t}isInlineTextNode(t){if(t.contentDisposition?.parsed?.value==="attachment")return!1;switch(t.contentType.parsed?.value){case"text/html":case"text/plain":return!0;default:return!1}}isInlineMessageRfc822(t){return t.contentType.parsed?.value!=="message/rfc822"?!1:(t.contentDisposition?.parsed?.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}forceRfc822Attachments(){if(this.options.forceRfc822Attachments)return!0;let t=!1,r=n=>{n.contentType.multipart||n.contentType.parsed&&["message/delivery-status","message/feedback-report"].includes(n.contentType.parsed.value)&&(t=!0);for(let o of n.childNodes)r(o)};return r(this.root),t}async resolveStream(t){let r=0,n=[],o=t.getReader();for(;;){let{done:a,value:l}=await o.read();if(a)break;n.push(l),r+=l.length}let i=new Uint8Array(r),s=0;for(let a of n)i.set(a,s),s+=a.length;return i}async parse(t){if(this.started)throw new Error("Can not reuse parser, create a new PostalMime object");for(this.started=!0,t&&typeof t.getReader=="function"&&(t=await this.resolveStream(t)),t=t||new ArrayBuffer(0),typeof t=="string"&&(t=it.encode(t)),(t instanceof Blob||Object.prototype.toString.call(t)==="[object Blob]")&&(t=await st(t)),t.buffer instanceof ArrayBuffer&&(t=new Uint8Array(t).buffer),this.buf=t,this.av=new Uint8Array(t),this.readPos=0;this.readPos<this.av.length;){let o=this.readLine();await this.processLine(o.bytes,o.done)}await this.processNodeTree();let r={headers:this.root.headers.map(o=>({key:o.key,originalKey:o.originalKey,value:o.value})).reverse()};for(let o of["from","sender"]){let i=this.root.headers.find(s=>s.key===o);if(i&&i.value){let s=Tr(i.value);s&&s.length&&(r[o]=s[0])}}for(let o of["delivered-to","return-path"]){let i=this.root.headers.find(s=>s.key===o);if(i&&i.value){let s=Tr(i.value);if(s&&s.length&&s[0].address){let a=Yn(o);r[a]=s[0].address}}}for(let o of["to","cc","bcc","reply-to"]){let i=this.root.headers.filter(a=>a.key===o),s=[];if(i.filter(a=>a&&a.value).map(a=>Tr(a.value)).forEach(a=>s=s.concat(a||[])),s&&s.length){let a=Yn(o);r[a]=s}}for(let o of["subject","message-id","in-reply-to","references"]){let i=this.root.headers.find(s=>s.key===o);if(i&&i.value){let s=Yn(o);r[s]=vt(i.value)}}let n=this.root.headers.find(o=>o.key==="date");if(n){let o=new Date(n.value);o.toString()==="Invalid Date"?o=n.value:o=o.toISOString(),r.date=o}switch(this.textContent?.html&&(r.html=this.textContent.html),this.textContent?.plain&&(r.text=this.textContent.plain),r.attachments=this.attachments,r.headerLines=(this.root.rawHeaderLines||[]).slice().reverse(),this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let i of r.attachments||[])i?.content&&(i.content=Ni(i.content),i.encoding="base64");break;case"utf8":let o=new TextDecoder("utf8");for(let i of r.attachments||[])i?.content&&(i.content=o.decode(i.content),i.encoding="utf8");break;default:throw new Error("Unknown attachment encoding")}return r}};var es=pe(Ki(),1),Xd="6.14.0";function ae(e){let t=new URLSearchParams;return e.limit!==void 0&&t.set("limit",e.limit.toString()),"after"in e&&e.after!==void 0&&t.set("after",e.after),"before"in e&&e.before!==void 0&&t.set("before",e.before),t.toString()}var Zd=class{constructor(e){this.resend=e}async create(e,t={}){return await this.resend.post("/api-keys",e,t)}async list(e={}){let t=ae(e),r=t?`/api-keys?${t}`:"/api-keys";return await this.resend.get(r)}async remove(e){return await this.resend.delete(`/api-keys/${e}`)}},em=class{constructor(e){this.resend=e}async get(e){return await this.resend.get(`/automations/${e.automationId}/runs/${e.runId}`)}async list(e){let t=ae(e),r=new URLSearchParams(t);if(e.status){let i=Array.isArray(e.status)?e.status.join(","):e.status;r.set("status",i)}let n=r.toString(),o=n?`/automations/${e.automationId}/runs?${n}`:`/automations/${e.automationId}/runs`;return await this.resend.get(o)}};function ts(e){switch(e.type){case"trigger":return{key:e.key,type:e.type,config:{event_name:e.config.eventName}};case"delay":return{key:e.key,type:e.type,config:e.config};case"send_email":return{key:e.key,type:e.type,config:{template:e.config.template,subject:e.config.subject,from:e.config.from,reply_to:e.config.replyTo}};case"wait_for_event":return{key:e.key,type:e.type,config:{event_name:e.config.eventName,timeout:e.config.timeout,filter_rule:e.config.filterRule}};case"condition":return{key:e.key,type:e.type,config:e.config};case"contact_update":return{key:e.key,type:e.type,config:{first_name:e.config.firstName,last_name:e.config.lastName,unsubscribed:e.config.unsubscribed,properties:e.config.properties}};case"contact_delete":return{key:e.key,type:e.type,config:e.config};case"add_to_segment":return{key:e.key,type:e.type,config:{segment_id:e.config.segmentId}}}}function rs(e){return{from:e.from,to:e.to,type:e.type}}function tm(e){return{name:e.name,status:e.status,steps:e.steps.map(ts),connections:e.connections.map(rs)}}function rm(e){return{event:e.event,contact_id:e.contactId,email:e.email,payload:e.payload}}var nm=class{constructor(e){this.resend=e,this.runs=new em(this.resend)}async create(e){return await this.resend.post("/automations",tm(e))}async list(e={}){let t=[ae(e)];e.status&&t.push(`status=${encodeURIComponent(e.status)}`);let r=t.filter(Boolean).join("&"),n=r?`/automations?${r}`:"/automations";return await this.resend.get(n)}async get(e){return await this.resend.get(`/automations/${e}`)}async remove(e){return await this.resend.delete(`/automations/${e}`)}async update(e,t){let r={};return t.name!==void 0&&(r.name=t.name),t.status!==void 0&&(r.status=t.status),t.steps!==void 0&&(r.steps=t.steps.map(ts)),t.connections!==void 0&&(r.connections=t.connections.map(rs)),await this.resend.patch(`/automations/${e}`,r)}async stop(e){return await this.resend.post(`/automations/${e}/stop`)}};function om(e){return e?.map(t=>({content:t.content,filename:t.filename,path:t.path,content_type:t.contentType,content_id:t.contentId}))}function ns(e){return{attachments:om(e.attachments),bcc:e.bcc,cc:e.cc,from:e.from,headers:e.headers,html:e.html,reply_to:e.replyTo,scheduled_at:e.scheduledAt,subject:e.subject,tags:e.tags,text:e.text,to:e.to,template:e.template?{id:e.template.id,variables:e.template.variables}:void 0,topic_id:e.topicId}}async function or(e){let t;try{({render:t}=await import("@react-email/render"))}catch{throw new Error("Failed to render React component. Make sure to install `@react-email/render` or `@react-email/components`.")}return t(e)}var im=class{constructor(e){this.resend=e}async send(e,t){return this.create(e,t)}async create(e,t){let r=[];for(let n of e)n.react&&(n.html=await or(n.react),n.react=void 0),r.push(ns(n));return await this.resend.post("/emails/batch",r,{...t,headers:{"x-batch-validation":t?.batchValidation??"strict",...t?.headers}})}},sm=class{constructor(e){this.resend=e}async create(e,t={}){let r=e.react?await or(e.react):e.html;return await this.resend.post("/broadcasts",{name:e.name,segment_id:e.segmentId,audience_id:e.audienceId,preview_text:e.previewText,from:e.from,html:r,reply_to:e.replyTo,subject:e.subject,text:e.text,topic_id:e.topicId,send:e.send,scheduled_at:e.scheduledAt},t)}async send(e,t){return await this.resend.post(`/broadcasts/${e}/send`,{scheduled_at:t?.scheduledAt})}async list(e={}){let t=ae(e),r=t?`/broadcasts?${t}`:"/broadcasts";return await this.resend.get(r)}async get(e){return await this.resend.get(`/broadcasts/${e}`)}async remove(e){return await this.resend.delete(`/broadcasts/${e}`)}async update(e,t){let r=t.react?await or(t.react):t.html;return await this.resend.patch(`/broadcasts/${e}`,{name:t.name,segment_id:t.segmentId,audience_id:t.audienceId,from:t.from,html:r,text:t.text,subject:t.subject,reply_to:t.replyTo,preview_text:t.previewText,topic_id:t.topicId})}};function zi(e){return{id:e.id,key:e.key,createdAt:e.created_at,type:e.type,fallbackValue:e.fallback_value}}function Ji(e){return"key"in e?{key:e.key,type:e.type,fallback_value:e.fallbackValue}:{fallback_value:e.fallbackValue}}var am=class{constructor(e){this.resend=e}async create(e){let t=Ji(e);return await this.resend.post("/contact-properties",t)}async list(e={}){let t=ae(e),r=t?`/contact-properties?${t}`:"/contact-properties",n=await this.resend.get(r);return n.data?{data:{...n.data,data:n.data.data.map(o=>zi(o))},headers:n.headers,error:null}:n}async get(e){if(!e)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};let t=await this.resend.get(`/contact-properties/${e}`);return t.data?{data:{object:"contact_property",...zi(t.data)},headers:t.headers,error:null}:t}async update(e){if(!e.id)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};let t=Ji(e);return await this.resend.patch(`/contact-properties/${e.id}`,t)}async remove(e){return e?await this.resend.delete(`/contact-properties/${e}`):{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}}}},lm=class{constructor(e){this.resend=e}async create(e,t={}){let r=this.buildCreateFormData(e);return this.resend.post("/contacts/imports",r,t)}async list(e={}){let t=new URLSearchParams(ae(e));e.status!==void 0&&t.set("status",e.status);let r=t.toString(),n=r?`/contacts/imports?${r}`:"/contacts/imports";return this.resend.get(n)}async get(e){return this.resend.get(`/contacts/imports/${e}`)}buildCreateFormData(e){let t=new FormData;return t.append("file",e.file),this.appendField(t,"column_map",this.buildColumnMap(e.columnMap??null)),this.appendField(t,"on_conflict",e.onConflict??null),this.appendField(t,"segments",e.segments??null),this.appendField(t,"topics",e.topics??null),t}buildColumnMap(e){return e===null?null:{email:e.email,first_name:e.firstName,last_name:e.lastName,unsubscribed:e.unsubscribed,properties:e.properties}}appendField(e,t,r){r!==null&&e.append(t,typeof r=="string"?r:JSON.stringify(r))}},cm=class{constructor(e){this.resend=e}async list(e){if(!e.contactId&&!e.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let t=e.email?e.email:e.contactId,r=ae(e),n=r?`/contacts/${t}/segments?${r}`:`/contacts/${t}/segments`;return await this.resend.get(n)}async add(e){if(!e.contactId&&!e.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let t=e.email?e.email:e.contactId;return this.resend.post(`/contacts/${t}/segments/${e.segmentId}`)}async remove(e){if(!e.contactId&&!e.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let t=e.email?e.email:e.contactId;return this.resend.delete(`/contacts/${t}/segments/${e.segmentId}`)}},um=class{constructor(e){this.resend=e}async update(e){if(!e.id&&!e.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let t=e.email?e.email:e.id;return this.resend.patch(`/contacts/${t}/topics`,e.topics)}async list(e){if(!e.id&&!e.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let t=e.email?e.email:e.id,r=ae(e),n=r?`/contacts/${t}/topics?${r}`:`/contacts/${t}/topics`;return this.resend.get(n)}},dm=class{constructor(e){this.resend=e,this.imports=new lm(this.resend),this.topics=new um(this.resend),this.segments=new cm(this.resend)}async create(e,t={}){return"audienceId"in e?"segments"in e||"topics"in e?{data:null,headers:null,error:{message:"`audienceId` is deprecated, and cannot be used together with `segments` or `topics`. Use `segments` instead to add one or more segments to the new contact.",statusCode:null,name:"invalid_parameter"}}:await this.resend.post(`/audiences/${e.audienceId}/contacts`,{unsubscribed:e.unsubscribed,email:e.email,first_name:e.firstName,last_name:e.lastName,properties:e.properties},t):await this.resend.post("/contacts",{unsubscribed:e.unsubscribed,email:e.email,first_name:e.firstName,last_name:e.lastName,properties:e.properties,segments:e.segments,topics:e.topics},t)}async list(e={}){let t=e.segmentId??e.audienceId;if(!t){let o=ae(e),i=o?`/contacts?${o}`:"/contacts";return await this.resend.get(i)}let r=ae(e),n=r?`/segments/${t}/contacts?${r}`:`/segments/${t}/contacts`;return await this.resend.get(n)}async get(e){return typeof e=="string"?this.resend.get(`/contacts/${e}`):!e.id&&!e.email?{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}}:e.audienceId?this.resend.get(`/audiences/${e.audienceId}/contacts/${e?.email?e?.email:e?.id}`):this.resend.get(`/contacts/${e?.email?e?.email:e?.id}`)}async update(e){return!e.id&&!e.email?{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}}:e.audienceId?await this.resend.patch(`/audiences/${e.audienceId}/contacts/${e?.email?e?.email:e?.id}`,{unsubscribed:e.unsubscribed,first_name:e.firstName,last_name:e.lastName,properties:e.properties}):await this.resend.patch(`/contacts/${e?.email?e?.email:e?.id}`,{unsubscribed:e.unsubscribed,first_name:e.firstName,last_name:e.lastName,properties:e.properties})}async remove(e){return typeof e=="string"?this.resend.delete(`/contacts/${e}`):!e.id&&!e.email?{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}}:e.audienceId?this.resend.delete(`/audiences/${e.audienceId}/contacts/${e?.email?e?.email:e?.id}`):this.resend.delete(`/contacts/${e?.email?e?.email:e?.id}`)}};function mm(e){return{name:e.name,region:e.region,custom_return_path:e.customReturnPath,capabilities:e.capabilities,open_tracking:e.openTracking,click_tracking:e.clickTracking,tls:e.tls,tracking_subdomain:e.trackingSubdomain}}var pm=class{constructor(e){this.resend=e}async create(e,t={}){return await this.resend.post("/domains/claim",{name:e.name,region:e.region,custom_return_path:e.customReturnPath,open_tracking:e.openTracking,click_tracking:e.clickTracking,tracking_subdomain:e.trackingSubdomain},t)}async get(e){return await this.resend.get(`/domains/${e}/claim`)}async verify(e){return await this.resend.post(`/domains/${e}/claim/verify`)}},fm=class{constructor(e){this.resend=e,this.claims=new pm(this.resend)}async create(e,t={}){return await this.resend.post("/domains",mm(e),t)}async list(e={}){let t=ae(e),r=t?`/domains?${t}`:"/domains";return await this.resend.get(r)}async get(e){return await this.resend.get(`/domains/${e}`)}async update(e){return await this.resend.patch(`/domains/${e.id}`,{click_tracking:e.clickTracking,open_tracking:e.openTracking,tls:e.tls,capabilities:e.capabilities,tracking_subdomain:e.trackingSubdomain})}async remove(e){return await this.resend.delete(`/domains/${e}`)}async verify(e){return await this.resend.post(`/domains/${e}/verify`)}},hm=class{constructor(e){this.resend=e}async get(e){let{emailId:t,id:r}=e;return await this.resend.get(`/emails/${t}/attachments/${r}`)}async list(e){let{emailId:t}=e,r=ae(e),n=r?`/emails/${t}/attachments?${r}`:`/emails/${t}/attachments`;return await this.resend.get(n)}},gm=class{constructor(e){this.resend=e}async get(e){let{emailId:t,id:r}=e;return await this.resend.get(`/emails/receiving/${t}/attachments/${r}`)}async list(e){let{emailId:t}=e,r=ae(e),n=r?`/emails/receiving/${t}/attachments?${r}`:`/emails/receiving/${t}/attachments`;return await this.resend.get(n)}},bm=class{constructor(e){this.resend=e,this.attachments=new gm(e)}async get(e,t={}){let r=new URLSearchParams;t.html_format!==void 0&&r.set("html_format",t.html_format);let n=r.toString(),o=n?`/emails/receiving/${e}?${n}`:`/emails/receiving/${e}`;return await this.resend.get(o)}async list(e={}){let t=ae(e),r=t?`/emails/receiving?${t}`:"/emails/receiving";return await this.resend.get(r)}async forward(e){let{emailId:t,to:r,from:n}=e,o=e.passthrough!==!1,i=await this.get(t);if(i.error)return{data:null,error:i.error,headers:i.headers};let s=i.data,a=s.subject||"(no subject)";if(o)return this.forwardPassthrough(s,{to:r,from:n,subject:a});let l=a.startsWith("Fwd:")?a:`Fwd: ${a}`;return this.forwardWrapped(s,{to:r,from:n,subject:l,text:"text"in e?e.text:void 0,html:"html"in e?e.html:void 0})}async forwardPassthrough(e,t){let{to:r,from:n,subject:o}=t;if(!e.raw?.download_url)return{data:null,error:{name:"validation_error",message:"Raw email content is not available for this email",statusCode:400},headers:null};let i=await fetch(e.raw.download_url);if(!i.ok)return{data:null,error:{name:"application_error",message:"Failed to download raw email content",statusCode:i.status},headers:null};let s=await i.text(),a=await rr.parse(s,{attachmentEncoding:"base64"}),l=a.attachments.map(d=>{let c=d.contentId?d.contentId.replace(/^<|>$/g,""):void 0;return{filename:d.filename,content:d.content.toString(),content_type:d.mimeType,content_id:c||void 0}});return await this.resend.post("/emails",{from:n,to:r,subject:o,text:a.text||void 0,html:a.html||void 0,attachments:l.length>0?l:void 0})}async forwardWrapped(e,t){let{to:r,from:n,subject:o,text:i,html:s}=t;if(!e.raw?.download_url)return{data:null,error:{name:"validation_error",message:"Raw email content is not available for this email",statusCode:400},headers:null};let a=await fetch(e.raw.download_url);if(!a.ok)return{data:null,error:{name:"application_error",message:"Failed to download raw email content",statusCode:a.status},headers:null};let l=await a.text();return await this.resend.post("/emails",{from:n,to:r,subject:o,text:i,html:s,attachments:[{filename:"forwarded_message.eml",content:Buffer.from(l).toString("base64"),content_type:"message/rfc822"}]})}},ym=class{constructor(e){this.resend=e,this.attachments=new hm(e),this.receiving=new bm(e)}async send(e,t={}){return this.create(e,t)}async create(e,t={}){let r={...e};return e.react&&(r.html=await or(e.react)),await this.resend.post("/emails",ns(r),t)}async get(e){return await this.resend.get(`/emails/${e}`)}async list(e={}){let t=ae(e),r=t?`/emails?${t}`:"/emails";return await this.resend.get(r)}async update(e){return await this.resend.patch(`/emails/${e.id}`,{scheduled_at:e.scheduledAt})}async cancel(e){return await this.resend.post(`/emails/${e}/cancel`)}},vm=class{constructor(e){this.resend=e}async send(e){return await this.resend.post("/events/send",rm(e))}async create(e){return await this.resend.post("/events",e)}async get(e){return await this.resend.get(`/events/${encodeURIComponent(e)}`)}async list(e={}){let t=ae(e),r=t?`/events?${t}`:"/events";return await this.resend.get(r)}async update(e,t){return await this.resend.patch(`/events/${encodeURIComponent(e)}`,t)}async remove(e){return await this.resend.delete(`/events/${encodeURIComponent(e)}`)}},Cm=class{constructor(e){this.resend=e}async list(e={}){let t=ae(e),r=t?`/logs?${t}`:"/logs";return await this.resend.get(r)}async get(e){return await this.resend.get(`/logs/${e}`)}},wm=class{constructor(e){this.resend=e}async create(e,t={}){return await this.resend.post("/segments",e,t)}async list(e={}){let t=ae(e),r=t?`/segments?${t}`:"/segments";return await this.resend.get(r)}async get(e){return await this.resend.get(`/segments/${e}`)}async remove(e){return await this.resend.delete(`/segments/${e}`)}};function _m(e={}){let t=new URLSearchParams;return e.before&&t.set("before",e.before),e.after&&t.set("after",e.after),e.limit&&t.set("limit",e.limit.toString()),t.size>0?`?${t.toString()}`:""}function xm(e){return e?.map(t=>({key:t.key,type:t.type,fallback_value:t.fallbackValue}))}function Yi(e){return{name:"name"in e?e.name:void 0,subject:e.subject,html:e.html,text:e.text,alias:e.alias,from:e.from,reply_to:e.replyTo,variables:xm(e.variables)}}var Qi=class{constructor(e,t){this.promise=e,this.publishFn=t}then(e,t){return this.promise.then(e,t)}async publish(){let{data:e,error:t}=await this.promise;return t?{data:null,headers:null,error:t}:this.publishFn(e.id)}},km=class{constructor(e){this.resend=e}create(e){return new Qi(this.performCreate(e),this.publish.bind(this))}async performCreate(e){let t={...e};return e.react&&(t.html=await or(e.react)),this.resend.post("/templates",Yi(t))}async remove(e){return await this.resend.delete(`/templates/${e}`)}async get(e){return await this.resend.get(`/templates/${e}`)}async list(e={}){return this.resend.get(`/templates${_m(e)}`)}duplicate(e){return new Qi(this.resend.post(`/templates/${e}/duplicate`),this.publish.bind(this))}async publish(e){return await this.resend.post(`/templates/${e}/publish`)}async update(e,t){return await this.resend.patch(`/templates/${e}`,Yi(t))}},Am=class{constructor(e){this.resend=e}async create(e){let{defaultSubscription:t,...r}=e;return await this.resend.post("/topics",{...r,default_subscription:t})}async list(){return await this.resend.get("/topics")}async get(e){return e?await this.resend.get(`/topics/${e}`):{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}}}async update(e){return e.id?await this.resend.patch(`/topics/${e.id}`,e):{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}}}async remove(e){return e?await this.resend.delete(`/topics/${e}`):{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}}}},$m=class{constructor(e){this.resend=e}async create(e,t={}){return await this.resend.post("/webhooks",e,t)}async get(e){return await this.resend.get(`/webhooks/${e}`)}async list(e={}){let t=ae(e),r=t?`/webhooks?${t}`:"/webhooks";return await this.resend.get(r)}async update(e,t){return await this.resend.patch(`/webhooks/${e}`,t)}async remove(e){return await this.resend.delete(`/webhooks/${e}`)}verify(e){return new es.Webhook(e.webhookSecret).verify(e.payload,{"webhook-id":e.headers.id,"webhook-timestamp":e.headers.timestamp,"webhook-signature":e.headers.signature})}},Xi="https://api.resend.com",Zi=`resend-node:${Xd}`;function Em(){return typeof process<"u"&&process.env&&process.env.RESEND_BASE_URL||Xi}function Dm(){return typeof process<"u"&&process.env&&process.env.RESEND_USER_AGENT||Zi}var Dt=class{constructor(e,t){if(this.key=e,this.segments=new wm(this),this.apiKeys=new Zd(this),this.audiences=this.segments,this.automations=new nm(this),this.batch=new im(this),this.broadcasts=new sm(this),this.contactProperties=new am(this),this.contacts=new dm(this),this.domains=new fm(this),this.emails=new ym(this),this.events=new vm(this),this.logs=new Cm(this),this.templates=new km(this),this.topics=new Am(this),this.webhooks=new $m(this),!e&&(typeof process<"u"&&process.env&&(this.key=process.env.RESEND_API_KEY),!this.key))throw new Error('Missing API key. Pass it to the constructor `new Resend("re_123")`');this.baseUrl=t?.baseUrl??Em(),this.userAgent=t?.userAgent??Dm(),this.headers=new Headers({Authorization:`Bearer ${this.key}`,"User-Agent":this.userAgent,"Content-Type":"application/json"})}async fetchRequest(e,t={}){try{let r=await fetch(`${this.baseUrl}${e}`,t);if(!r.ok)try{let n=await r.text();return{data:null,error:JSON.parse(n),headers:Object.fromEntries(r.headers.entries())}}catch(n){if(n instanceof SyntaxError)return{data:null,error:{name:"application_error",statusCode:r.status,message:"Internal server error. We are unable to process your request right now, please try again later."},headers:Object.fromEntries(r.headers.entries())};let o={message:r.statusText,statusCode:r.status,name:"application_error"};return n instanceof Error?{data:null,error:{...o,message:n.message},headers:Object.fromEntries(r.headers.entries())}:{data:null,error:o,headers:Object.fromEntries(r.headers.entries())}}return{data:await r.json(),error:null,headers:Object.fromEntries(r.headers.entries())}}catch{return{data:null,error:{name:"application_error",statusCode:null,message:"Unable to fetch data. The request could not be resolved."},headers:null}}}async post(e,t,r={}){let n=new Headers(this.headers),o=typeof FormData<"u"&&t instanceof FormData;if(o&&n.delete("Content-Type"),r.headers)for(let[s,a]of new Headers(r.headers).entries())n.set(s,a);r.idempotencyKey&&n.set("Idempotency-Key",r.idempotencyKey);let i={method:"POST",body:o?t:JSON.stringify(t),...r,headers:n};return this.fetchRequest(e,i)}async get(e,t={}){let r=new Headers(this.headers);if(t.headers)for(let[o,i]of new Headers(t.headers).entries())r.set(o,i);let n={method:"GET",...t,headers:r};return this.fetchRequest(e,n)}async put(e,t,r={}){let n=new Headers(this.headers);if(r.headers)for(let[i,s]of new Headers(r.headers).entries())n.set(i,s);let o={method:"PUT",body:JSON.stringify(t),...r,headers:n};return this.fetchRequest(e,o)}async patch(e,t,r={}){let n=new Headers(this.headers);if(r.headers)for(let[i,s]of new Headers(r.headers).entries())n.set(i,s);let o={method:"PATCH",body:JSON.stringify(t),...r,headers:n};return this.fetchRequest(e,o)}async delete(e,t,r={}){let n=new Headers(this.headers);if(r.headers)for(let[i,s]of new Headers(r.headers).entries())n.set(i,s);let o={method:"DELETE",body:t===void 0?void 0:JSON.stringify(t),...r,headers:n};return this.fetchRequest(e,o)}};fe();var go=pe(rt(),1);function q(e,t){return e instanceof Error?e.message:t}function Rs(e){return!!(e||!process.stdout.isTTY)}function N(e,t={}){Rs(t.json)?console.log(JSON.stringify(e,null,2)):console.log(typeof e=="string"?e:JSON.stringify(e,null,2)),t.exitCode!==void 0&&process.exit(t.exitCode)}var Hm=new Set(["content-type","retry-after"]);function Mm(e){let t={};for(let[r,n]of Object.entries(e)){let o=r.toLowerCase();(Hm.has(o)||o.startsWith("x-"))&&(t[o]=n)}return t}function h(e,t={}){let r=t.exitCode??1,n=e.headers&&Object.keys(e.headers).length>0?Mm(e.headers):void 0,o=n!==void 0&&Object.keys(n).length>0;if(Rs(t.json)){let i={message:e.message,code:e.code??"unknown"};typeof e.statusCode=="number"&&(i.statusCode=e.statusCode),o&&(i.headers=n),typeof e.body=="string"&&e.body.length>0&&(i.body=e.body),console.error(JSON.stringify({error:i},null,2))}else{console.error(`${go.default.red("Error:")} ${e.message}`);let i=[];if(typeof e.statusCode=="number"&&i.push(`HTTP ${e.statusCode}`),o)for(let[s,a]of Object.entries(n))i.push(`${s}: ${a}`);i.length>0&&console.error(go.default.dim(`[${i.join("; ")}]`))}process.exit(r)}var Fs={sending_access:0,full_access:1};function qm(e,t){return Fs[e]>=Fs[t]}async function Z(e,t){let r=e.profile;try{let n=await _t(e.apiKey,r);if(!n){if(r){let s=xe();if(!s.some(l=>l.name===r))throw new Error(`Profile "${r}" not found. Available profiles: ${s.map(l=>l.name).join(", ")||"(none)"}`)}throw new Error("No API key found. Set RESEND_API_KEY, use --api-key, or run: resend login")}let o;if(n.type==="api_key")o=n.permission;else{let s=n.scope.split(" ").filter(Boolean);s.includes("full_access")?o="full_access":s.includes("emails:send")?o="sending_access":h({message:`Unrecognized credential scope${n.scope?` "${n.scope}"`:""}. Run \`resend login\` to re-authenticate.`,code:"unrecognized_scope"},{json:e.json})}if(o){let s=t?.permission??"full_access";qm(o,s)||h({message:`This command requires full access. Your current credential has sending access only.
|
|
185
|
+
${Tt}`,code:"insufficient_permissions"},{json:e.json})}let i=n.type==="api_key"?n.key:n.access_token;return new Dt(i)}catch(n){h({message:q(n,"Failed to create client"),code:"auth_error"},{json:e.json})}}var Ns=130;function Um(){process.stderr.isTTY&&process.stderr.write("\r\x1B[2K"),console.error("Cancelled."),process.exit(Ns)}var Ot;function Bs(){Ot=Um,process.on("SIGINT",Ot),process.on("uncaughtException",e=>{h({message:q(e,"An unexpected error occurred"),code:"unexpected_error"},{}),process.exit(1)})}function Wr(e){Ot&&process.removeListener("SIGINT",Ot),Ot=e,process.on("SIGINT",Ot)}function It(){return Ns}fe();var Vr=pe(rt(),1);J();var Gs=[1,2,4],Wm=Gs.length,Vm=new Set(["internal_server_error","service_unavailable","gateway_timeout"]),Km=(e,t)=>!!(e==="rate_limit_exceeded"||t&&e!==void 0&&Vm.has(e)),zm=e=>{let t=e?.["retry-after"];if(!t)return;let r=Number(t);if(Number.isFinite(r)&&r>=0)return r;let n=Date.parse(t);if(!Number.isNaN(n)){let o=(n-Date.now())/1e3;return o>0?o:0}},Jm=e=>new Promise(t=>setTimeout(t,e)),lr=async(e,t,r=0)=>{let n=await e(),o=t?.retryTransient??!1;if(n.error&&r<Wm&&Km(n.error.name,o)){let i=zm(n.headers)??Gs[r];return t?.onRetry?.(r,i,n.error.name??""),await Jm(i*1e3),lr(e,t,r+1)}return n};var Ls=(e,t)=>new Promise((r,n)=>{let o=setTimeout(()=>{n(new Error(`Request timed out after ${t/1e3}s`))},t);o.unref(),e.then(i=>{clearTimeout(o),r(i)},i=>{clearTimeout(o),n(i)})});var Qm=Ze?String.fromCodePoint(10004):"v",Xm=Ze?String.fromCodePoint(9888):"!",Zm=Ze?String.fromCodePoint(10007):"x",ep=["\u2839","\u2838","\u2834","\u2826","\u2807","\u280F","\u2819","\u2839"],tp=80;async function Ee(e,t,r,n,o={}){let i=re(e,n.quiet);try{let{data:s,error:a,headers:l}=await lr(()=>Ls(t(),3e4),{retryTransient:o.retryTransient,onRetry:(d,c,u)=>{i.update(u==="rate_limit_exceeded"?`Rate limited, retrying in ${c}s...`:`Server error, retrying in ${c}s...`)}});return a&&(i.stop(),h({message:a.message,code:r,statusCode:a.statusCode,headers:l},{json:n.json})),s===null&&(i.stop(),h({message:"Unexpected empty response",code:r,headers:l},{json:n.json})),i.stop(),s}catch(s){return i.stop(),h({message:q(s,"Unknown error"),code:r},{json:n.json})}}function re(e,t){if(t||!w())return{update(a){},stop(a){},clear(){},warn(a){},fail(a){}};let r=Ze?ep:["-","\\","|","/"],n=tp,o=0,i=e,s=setInterval(()=>{process.stderr.write(`\r\x1B[2K ${r[o++%r.length]} ${i}`)},n);return{update(a){i=a},stop(a){clearInterval(s),a?process.stderr.write(`\r\x1B[2K ${Vr.default.green(Qm)} ${a}
|
|
186
|
+
`):process.stderr.write("\r\x1B[2K")},clear(){clearInterval(s),process.stderr.write("\r\x1B[2K")},warn(a){clearInterval(s),process.stderr.write(`\r\x1B[2K ${Vr.default.yellow(Xm)} ${a}
|
|
187
|
+
`)},fail(a){clearInterval(s),process.stderr.write(`\r\x1B[2K ${Vr.default.red(Zm)} ${a}
|
|
188
|
+
`)}}}J();function S(e){xi(e),process.exit(It())}async function qs(e,t,r){(!w()||r.json)&&h({message:"Use --yes to confirm deletion in non-interactive mode.",code:"confirmation_required"},{json:r.json});let n=await ot({message:t});($(n)||!n)&&S("Deletion cancelled.")}async function Kr(e,t){let r=ie(e);if(!r)return e;if(!w()||t.json)return h({message:`Profile "${e}" has an invalid name: ${r}`,code:"invalid_profile_name"},{json:t.json}),null;Q.warn(`Profile "${e}" has an invalid name: ${r}`);let n=await X({message:"Enter a new name for this profile:",placeholder:e.replace(/[^a-zA-Z0-9._-]/g,"-"),validate:o=>ie(o)});$(n)&&S("Rename cancelled.");try{await Ur(e,n)}catch(o){return h({message:q(o,"Failed to rename profile"),code:"rename_failed"},{json:t.json}),null}return Q.success(`Profile renamed to '${n}'.`),n}async function U(e,t,r,n){if(e!==void 0)return e;(!w()||n.json)&&h(r,{json:n.json});let o=await X({message:t.message,placeholder:t.placeholder,defaultValue:t.defaultValue,validate:t.validate??(i=>!t.defaultValue&&(!i||i.length===0)?`${t.message} is required`:void 0)});return $(o)&&S("Cancelled."),o}async function Pt(e,t,r,n){if(e!==void 0)return e;(!w()||n.json)&&h(r,{json:n.json});let o=await se({message:t.message,options:t.options});return $(o)&&S("Cancelled."),o}async function Us(e,t,r){let n=t.filter(s=>s.required!==!1&&e[s.flag]==="");if(n.length>0){let s=n.map(a=>`--${a.flag}`).join(", ");h({message:`Empty value for required flags: ${s}`,code:"invalid_options"},{json:r.json})}let o=t.filter(s=>s.required!==!1&&!e[s.flag]);if(o.length===0)return e;if(!w()||r.json){let s=o.map(a=>`--${a.flag}`).join(", ");h({message:`Missing required flags: ${s}`,code:"missing_flags"},{json:r.json})}let i=await _i(Object.fromEntries(o.map(s=>[s.flag,()=>X({message:s.message,placeholder:s.placeholder,defaultValue:s.defaultValue,validate:s.validate??(a=>!s.defaultValue&&(!a||a.length===0)?`${s.message} is required`:void 0)})])),{onCancel:()=>S("Operation cancelled.")});return{...e,...i}}var rp=20,Hs="__fetch_more__",Ms="__none__";async function le(e,t,r,n){if(e)return{id:e,label:e};let o=n?.optional??!1;if(!w()||r.json){if(o)return;h({message:"Missing required argument: id",code:"missing_id"},{json:r.json})}let i=await Z(r),s=[];for(;;){let a=s.at(-1)?.id,l=re(s.length===0?`Fetching ${t.resourcePlural}...`:`Fetching more ${t.resourcePlural}...`,r.quiet),d=await t.fetchItems(i,{limit:rp,...a&&{after:a}});if(d.error||!d.data){if(o){l.clear();return}l.fail(`Failed to fetch ${t.resourcePlural}`),h({message:d.error?.message??"Unexpected empty response",code:"list_error"},{json:r.json})}s.push(...d.data.data);let c=d.data.has_more??!1,u=t.filter?s.filter(t.filter):s;if(u.length===0&&!c&&o){l.clear();return}if(l.stop(s.length===u.length?`${t.resourcePlural} fetched`:`More ${t.resourcePlural} fetched`),u.length===0&&!c&&(Q.warn(`No ${t.resourcePlural} found.`),h({message:`No ${t.resourcePlural} found.`,code:"no_items"},{json:r.json})),u.length===0&&c&&!o)continue;let p=u.map(b=>({item:b,...t.display(b)})),y=p.map(({item:b,label:_,hint:k})=>({value:b.id,label:_,hint:k}));o&&y.unshift({value:Ms,label:"None"}),c&&y.push({value:Hs,label:"Fetch more..."});let g=await se({message:`Select a ${t.resource}`,options:y});if($(g)&&S("Cancelled."),g===Ms)return;if(g!==Hs){let b=p.find(({item:_})=>_.id===g);return{id:g,label:b?.label??g}}}}async function C(e,t,r,n){return(await le(e,t,r,n))?.id}var Ws=require("node:util"),np=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]|\r(?!\n)/g,ke=e=>(0,Ws.stripVTControlCharacters)(String(e)).replace(np,"");function jt(e){return typeof e=="string"?ke(e):Array.isArray(e)?e.map(jt):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,r])=>[t,jt(r)])):e}J();async function G(e,t){let r=e.permission?{permission:e.permission}:void 0,n=await Z(t,r),o=await Ee(e.loading,()=>e.sdkCall(n),"fetch_error",t,{retryTransient:!0});!t.json&&w()?e.onInteractive(jt(o)):N(o,{json:t.json})}async function ne(e,t,r,n){let o=r.permission?{permission:r.permission}:void 0,i=await Z(n,o);t||await qs(e,r.confirmMessage,n),await Ee(r.loading,()=>r.sdkCall(i),"delete_error",n),!n.json&&w()?console.log(r.successMsg):N({object:r.object,id:e,deleted:!0},{json:n.json})}async function K(e,t){let r=e.permission?{permission:e.permission}:void 0,n=await Z(t,r),o=await Ee(e.loading,()=>e.sdkCall(n),"create_error",t);!t.json&&w()?e.onInteractive(jt(o)):N(o,{json:t.json})}async function R(e,t){let r=e.permission?{permission:e.permission}:void 0,n=await Z(t,r),o=await Ee(e.loading,()=>e.sdkCall(n),e.errorCode,t,{retryTransient:e.retryTransient});!t.json&&w()?console.log(e.successMsg):N(o,{json:t.json})}async function O(e,t){let r=e.permission?{permission:e.permission}:void 0,n=await Z(t,r),o=await Ee(e.loading,()=>e.sdkCall(n),"list_error",t,{retryTransient:!0});!t.json&&w()?e.onInteractive(jt(o)):N(o,{json:t.json})}J();J();var ue=Ze?{h:String.fromCodePoint(9472),v:String.fromCodePoint(9474),tl:String.fromCodePoint(9484),tr:String.fromCodePoint(9488),bl:String.fromCodePoint(9492),br:String.fromCodePoint(9496),lm:String.fromCodePoint(9500),rm:String.fromCodePoint(9508),tm:String.fromCodePoint(9516),bm:String.fromCodePoint(9524),mm:String.fromCodePoint(9532)}:{h:"-",v:"|",tl:"+",tr:"+",bl:"+",br:"+",lm:"+",rm:"+",tm:"+",bm:"+",mm:"+"};function op(){return process.stdout.columns}function ip(e,t,r){let n=Math.max(...e.map(i=>i.length)),o=Math.max(20,Math.min(r,60));return t.map((i,s)=>{let a=String(s+1),l=`${ue.h}${ue.h} ${a} ${ue.h.repeat(Math.max(0,o-a.length-4))}`,d=e.map((c,u)=>` ${c.padEnd(n)} ${i[u]}`);return[l,...d].join(`
|
|
189
189
|
`)}).join(`
|
|
190
190
|
|
|
191
|
-
`)}function F(t,
|
|
192
|
-
`)}J();var
|
|
191
|
+
`)}function F(e,t,r="(no results)"){if(t.length===0)return r;let n=t.map(c=>c.map(ke)),o=e.map((c,u)=>Math.max(c.length,...n.map(p=>p[u].length))),i=op();if(i!==void 0&&o.reduce((u,p)=>u+p,0)+3*o.length+1>i)return ip(e,n,i);let s=ue.tl+o.map(c=>ue.h.repeat(c+2)).join(ue.tm)+ue.tr,a=ue.lm+o.map(c=>ue.h.repeat(c+2)).join(ue.mm)+ue.rm,l=ue.bl+o.map(c=>ue.h.repeat(c+2)).join(ue.bm)+ue.br,d=c=>ue.v+" "+c.map((u,p)=>u.padEnd(o[p])).join(` ${ue.v} `)+" "+ue.v;return[s,d(e),a,...n.map(d),l].join(`
|
|
192
|
+
`)}J();var bo=Ze?String.fromCodePoint(9472):"-";function zr(e,t){return e.length===0?"(no DNS records)":e.map(n=>{let o=n.name?n.name.includes(".")?n.name:`${n.name}.${t}`:t;return[`${bo}${bo} ${n.type} ${bo.repeat(40)}`,` Name ${o}`,` TTL ${n.ttl}`,` Value ${n.value}`].join(`
|
|
193
193
|
`)}).join(`
|
|
194
194
|
|
|
195
|
-
`)}function
|
|
195
|
+
`)}function Vs(e){let t=e.map(r=>[r.name,r.status,r.region,r.id]);return F(["Name","Status","Region","ID"],t,"(no domains)")}function Ks(e){switch(e){case"verified":return"\u2713 Verified";case"pending":return"\u23F3 Pending";case"not_started":return"\u25CB Not started";case"partially_verified":return"\u25D0 Partially verified";case"partially_failed":return"\u25D0 Partially failed";case"failed":case"temporary_failure":return"\u2717 Failed";default:return e}}var De={resource:"domain",resourcePlural:"domains",fetchItems:(e,{limit:t,after:r})=>e.domains.list({limit:t,...r&&{after:r}}),display:e=>({label:e.name,hint:e.id})};var zs=new m("create").description("Create a new API key and display the token (shown once \u2014 store it immediately)").option("--name <name>","API key name (max 50 characters)").addOption(new Y("--permission <permission>","Permission level").choices(["full_access","sending_access"])).option("--domain-id <id>","Restrict a sending_access key to a single domain ID").addHelpText("after",f({context:`Non-interactive: --name is required (no prompts when stdin/stdout is not a TTY).
|
|
196
196
|
|
|
197
197
|
Permissions:
|
|
198
198
|
full_access Full API access (default)
|
|
199
199
|
sending_access Send-only access; optionally scope to a domain with --domain-id`,output:` {"id":"<id>","token":"<token>"}
|
|
200
|
-
The token is only returned at creation time and cannot be retrieved again.`,errorCodes:["auth_error","missing_name","invalid_flags","create_error"],examples:['resend api-keys create --name "Production"','resend api-keys create --name "CI Token" --permission sending_access','resend api-keys create --name "Domain Token" --permission sending_access --domain-id <domain-id>','resend api-keys create --name "Production" --json']})).action(async(t
|
|
201
|
-
${
|
|
200
|
+
The token is only returned at creation time and cannot be retrieved again.`,errorCodes:["auth_error","missing_name","invalid_flags","create_error"],examples:['resend api-keys create --name "Production"','resend api-keys create --name "CI Token" --permission sending_access','resend api-keys create --name "Domain Token" --permission sending_access --domain-id <domain-id>','resend api-keys create --name "Production" --json']})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=e.name,o=e.permission;if(!n){(!w()||r.json)&&h({message:"Missing --name flag.",code:"missing_name"},{json:r.json});let s=await X({message:"Key name",placeholder:"e.g. My API Key",validate:l=>{if(!l)return"Name is required";if(l.length>50)return"Name must be 50 characters or less"}});$(s)&&S("Cancelled."),n=s;let a=await se({message:"Permission level",options:[{value:"full_access",label:"Full access"},{value:"sending_access",label:"Sending access only"}]});$(a)&&S("Cancelled."),o=a}let i=e.domainId;i!==void 0&&o!=="sending_access"&&h({message:"--domain-id requires --permission sending_access",code:"invalid_flags"},{json:r.json}),!i&&o==="sending_access"&&(i=await C(void 0,De,r,{optional:!0})),await K({loading:"Creating API key...",sdkCall:s=>s.apiKeys.create({name:n,...o&&{permission:o},...i&&{domain_id:i}}),onInteractive:s=>{console.log(` ${cr.default.gray("Name:")} ${n}`),console.log(` ${cr.default.gray("ID:")} ${s.id}`),console.log(` ${cr.default.gray("Token:")} ${s.token}`),console.log(`
|
|
201
|
+
${cr.default.yellow("\u26A0")} Store this token now \u2014 it cannot be retrieved again.`)}},r)});var Js={resource:"API key",resourcePlural:"API keys",fetchItems:(e,{limit:t,after:r})=>e.apiKeys.list({limit:t,...r&&{after:r}}),display:e=>({label:e.name,hint:e.id})};function Ys(e){let t=e.map(r=>[r.name,r.id,r.created_at,r.last_used_at??""]);return F(["Name","ID","Created","Last used"],t,"(no API keys)")}var Qs=new m("delete").alias("rm").description("Delete an API key \u2014 any services using it will immediately lose access").argument("[id]","API key ID").option("--yes","Skip confirmation prompt").addHelpText("after",f({context:`Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.
|
|
202
202
|
|
|
203
203
|
Warning: Deleting a key is immediate and irreversible. Any service using this key
|
|
204
204
|
will stop authenticating instantly. The current key (used to call this command)
|
|
205
|
-
can delete itself \u2014 the API does not prevent self-deletion.`,output:' {"object":"api-key","id":"<id>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend api-keys delete dacf4072-aa82-4ff3-97de-514ae3000ee0 --yes","resend api-keys delete dacf4072-aa82-4ff3-97de-514ae3000ee0 --yes --json"]})).action(async(t,
|
|
206
|
-
ID: ${
|
|
207
|
-
Any services using this key will stop working.`,loading:"Deleting API key...",object:"api-key",successMsg:"API key deleted",sdkCall:
|
|
205
|
+
can delete itself \u2014 the API does not prevent self-deletion.`,output:' {"object":"api-key","id":"<id>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend api-keys delete dacf4072-aa82-4ff3-97de-514ae3000ee0 --yes","resend api-keys delete dacf4072-aa82-4ff3-97de-514ae3000ee0 --yes --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await le(e,Js,n);await ne(o.id,!!t.yes,{confirmMessage:`Delete API key "${o.label}"?
|
|
206
|
+
ID: ${o.id}
|
|
207
|
+
Any services using this key will stop working.`,loading:"Deleting API key...",object:"api-key",successMsg:"API key deleted",sdkCall:i=>i.apiKeys.remove(o.id)},n)});fe();function L(e,t){let r=parseInt(e,10);return(Number.isNaN(r)||r<1||r>100)&&h({message:"--limit must be an integer between 1 and 100",code:"invalid_limit"},{json:t.json}),r}function H(e,t,r,n){return t!==void 0&&r!==void 0&&h({message:"Cannot use --after and --before together. Pass only one cursor.",code:"invalid_pagination"},{json:n.json}),t!==void 0?{limit:e,after:t}:r!==void 0?{limit:e,before:r}:{limit:e}}function M(e,t,r){if(!e.has_more||e.data.length===0)return;let n=!!r.before,o=n?e.data[0].id:e.data[e.data.length-1].id,i=n?"--before":"--after",s=r.limit?` --limit ${r.limit}`:"",a=r.apiKey?` --api-key ${dt(r.apiKey)}`:"",l=r.profile?` --profile ${r.profile}`:"";console.log(`
|
|
208
208
|
Fetch the next page:
|
|
209
|
-
$ resend ${
|
|
210
|
-
Tokens are never included in list responses.`,errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend api-keys list","resend api-keys list --limit 25 --json","resend api-keys list --after <cursor> --json"]})).action(async(t
|
|
209
|
+
$ resend ${t} ${i} ${o}${s}${a}${l}`)}var Xs=new m("list").alias("ls").description("List all API keys (IDs and names \u2014 tokens are never returned by this endpoint)").option("--limit <n>","Maximum number of API keys to return (1-100)","10").option("--after <cursor>","Cursor for forward pagination \u2014 list items after this ID").option("--before <cursor>","Cursor for backward pagination \u2014 list items before this ID").addHelpText("after",f({output:` {"object":"list","has_more":false,"data":[{"id":"<id>","name":"<name>","created_at":"<date>","last_used_at":"<date>|null"}]}
|
|
210
|
+
Tokens are never included in list responses.`,errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend api-keys list","resend api-keys list --limit 25 --json","resend api-keys list --after <cursor> --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching API keys...",sdkCall:i=>i.apiKeys.list(o),onInteractive:i=>{console.log(Ys(i.data)),M(i,"api-keys list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var Zs=new m("api-keys").description("Manage API keys for authentication").addHelpText("after",f({context:`Security notes:
|
|
211
211
|
- Tokens are only shown at creation time and cannot be retrieved again.
|
|
212
212
|
- Use sending_access keys with --domain-id for per-domain CI tokens.
|
|
213
|
-
- Deleting a key is immediate \u2014 any service using it loses access instantly.`,examples:["resend api-keys list",'resend api-keys create --name "Production"','resend api-keys create --name "CI Token" --permission sending_access --domain-id <domain-id>',"resend api-keys delete <id> --yes"]})).addCommand(
|
|
213
|
+
- Deleting a key is immediate \u2014 any service using it loses access instantly.`,examples:["resend api-keys list",'resend api-keys create --name "Production"','resend api-keys create --name "CI Token" --permission sending_access --domain-id <domain-id>',"resend api-keys delete <id> --yes"]})).addCommand(zs).addCommand(Xs,{isDefault:!0}).addCommand(Qs);fe();J();function sp(e){let t=xe();if(e.json){N({profiles:t},{json:!0});return}if(t.length===0){console.log("No profiles configured. Run: resend login");return}w()&&console.log(`
|
|
214
214
|
Profiles
|
|
215
|
-
`);let r=!1;for(let n of
|
|
216
|
-
${
|
|
215
|
+
`);let r=!1;for(let n of t){let o=n.active?" (active)":"",i=ie(n.name)!==void 0;i&&(r=!0),console.log(` ${n.active?"\u25B8":" "} ${n.name}${o}${i?" (invalid name)":""}`)}r&&w()&&console.log("\n Profiles with invalid names can be renamed via `resend auth rename`."),w()&&console.log("")}var ea=new m("list").description("List all profiles").action((e,t)=>{sp(t.optsWithGlobals())});var ta=require("node:child_process"),ur=pe(rt(),1),Me="https://resend.com";function Jr(e){return new Promise(t=>{let r=process.platform==="win32"?"cmd.exe":process.platform==="darwin"?"open":"xdg-open",n=e.replaceAll('"',""),o=process.platform==="win32"?["/c","start",'""',`"${n}"`]:[e];(0,ta.execFile)(r,o,{timeout:5e3,windowsVerbatimArguments:!0},i=>t(!i))})}async function Se(e,t){let r=await Jr(e);t?.json||t?.quiet||(r?console.log(ur.default.dim("Opened"),ur.default.blue(e)):console.warn(ur.default.yellow("Could not open browser. Visit this link:"),ur.default.blue(e)))}var de={emails:`${Me}/emails`,logs:`${Me}/logs`,log:e=>`${Me}/logs/${e}`,templates:`${Me}/templates`,template:e=>`${Me}/templates/${e}`,broadcasts:`${Me}/broadcasts`,broadcast:e=>`${Me}/broadcasts/${e}`,documentation:`${Me}/docs`,automations:`${Me}/automations`,automation:e=>`${Me}/automations/${e}/editor`,events:`${Me}/automations/events`};fe();Lr();J();var yo="https://resend.com/api-keys?new=true";async function ra(e,t){let r=e.profile!==void 0?e.profile.trim():void 0;if(r!==void 0){let o=ie(r);return o&&h({message:o,code:"invalid_profile_name"},{json:e.json}),r}if(!w()||e.json)return r;let n=xe();if(n.length>0){let o=[...n.map(s=>({value:s.name,label:`${s.name} (overwrite)`,hint:ie(s.name)?"invalid name":void 0})),{value:"__new__",label:"+ Create new profile"}],i=await se({message:t,options:o});if($(i)&&S("Login cancelled."),i==="__new__"){let s=await X({message:"Enter a name for the new profile:",validate:l=>ie((l??"").trim())});if($(s)&&S("Login cancelled."),r=(s??"").trim()||"default",n.some(l=>l.name===r)){let l=await ot({message:`Profile '${r}' already exists. Overwrite?`});($(l)||!l)&&S("Login cancelled.")}}else if(ie(i)){let s=await Kr(i,e);if(!s)return;r=s}else r=i}else r="default";return r}function na(e){let{noun:t,profileLabel:r,configPath:n,backend:o}=e,i=o.isSecure?`in ${o.name}`:`at ${n}`,s=`${t} stored for profile '${r}' ${i}`;if(w()?Dr(s):console.log(s),!o.isSecure&&process.platform==="linux"){let a="Tip: Install libsecret-tools and a Secret Service provider (e.g. gnome-keyring) to store credentials in secure storage instead of a plaintext file.";w()?Q.info(a):console.log(a)}}async function ap(e){let{codeVerifier:t,codeChallenge:r,state:n}=xs(),o=re("Starting local callback server...",e.quiet),i,s;try{({port:i,waitForCallback:s}=await ks()),o.stop("")}catch(A){o.fail("Failed to start callback server"),h({message:q(A,"Failed to start callback server"),code:"oauth_error"},{json:e.json})}let a=`http://127.0.0.1:${i}/oauth/callback`,l=process.env.RESEND_BASE_URL??"https://api.resend.com",d=new URL(`${l}/oauth/authorize`);d.search=new URLSearchParams({client_id:Gr,response_type:"code",redirect_uri:a,scope:"full_access",state:n,code_challenge:r,code_challenge_method:"S256"}).toString(),await Jr(d.toString())?Q.info("Browser opened. Complete authentication to continue."):Q.warn(`Could not open browser. Visit this URL to authenticate:
|
|
216
|
+
${d.toString()}`);let u=re("Waiting for browser authentication...",e.quiet),p;try{p=await s}catch(A){u.fail("Authentication failed"),h({message:q(A,"Authentication failed"),code:"oauth_error"},{json:e.json})}p.state!==n&&(u.fail("Authentication failed"),h({message:"State mismatch in OAuth callback. Possible CSRF attack.",code:"oauth_state_mismatch"},{json:e.json})),u.stop("Browser authentication complete");let y=re("Exchanging authorization code...",e.quiet),g;try{g=await As({code:p.code,codeVerifier:t,redirectUri:a,clientId:Gr,baseUrl:l})}catch(A){y.fail("Token exchange failed"),h({message:q(A,"Token exchange failed"),code:"oauth_error"},{json:e.json})}y.stop("Authenticated successfully");let b=await ra(e,"Save credentials to which profile?"),_=b||"default",{configPath:k,backend:x}=await Hr({access_token:g.access_token,access_token_expires_at:mo(g.access_token),refresh_token:g.refresh_token,scope:g.scope},b);if(b)try{ar(_)}catch(A){h({message:q(A,"Failed to switch profile"),code:"switch_failed"},{json:e.json})}e.json?N({success:!0,config_path:k,profile:_,storage:x.name,scope:g.scope},{json:!0}):na({noun:"Credentials",profileLabel:_,configPath:k,backend:x})}var Yr=new m("login").description("Save a Resend API key").option("--key <key>","API key to store (required in non-interactive mode)").addHelpText("after",f({setup:!0,context:"Non-interactive: --key is required (no prompts will appear when stdin/stdout is not a TTY).",output:' {"success":true,"config_path":"<path>","profile":"<name>"}',errorCodes:["missing_key","invalid_key_format","validation_failed","invalid_profile_name","switch_failed","write_failed","oauth_error","oauth_state_mismatch"],examples:["resend login --key re_123456789","resend login (interactive \u2014 prompts and opens browser)","RESEND_API_KEY=re_123 resend emails send ... (skip login; use env var directly)"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=typeof e.key=="string"?e.key.trim():e.key;if(!n){(!w()||r.json)&&h({message:"Missing --key flag. Provide your API key in non-interactive mode.",code:"missing_key"},{json:r.json}),ki("Resend Authentication");let c=await se({message:"How would you like to authenticate?",options:[{value:"oauth",label:"Login with Resend (opens browser)"},{value:"browser",label:"Get API key from resend.com (opens browser)"},{value:"manual",label:"Enter API key manually"}]});if($(c)&&S("Login cancelled."),c==="oauth"){await ap(r);return}Q.info(`Use a full access API key for complete CLI access.
|
|
217
|
+
${Tt}`),c==="browser"&&(await Jr(yo)?Q.info(`Opened ${yo}`):Q.warn(`Could not open browser. Visit ${yo} manually.`));let u=await $i({message:"Enter your Resend API key:",validate:p=>{if(!p)return"API key is required";if(!p.startsWith("re_"))return"API key must start with re_"}});$(u)&&S("Login cancelled."),n=u.trim()}(!n||!n.startsWith("re_"))&&h({message:"Invalid API key format. Key must start with re_",code:"invalid_key_format"},{json:r.json});let o=re("Validating API key...",r.quiet),i="full_access";try{let c=new Dt(n),{error:u}=await c.domains.list();if(u){let p=u;p.name==="restricted_api_key"?(i="sending_access",o.warn("API key is valid (sending access only)")):(o.fail("API key validation failed"),h({message:p.message||"Failed to validate API key",code:"validation_failed"},{json:r.json}))}else o.stop("API key is valid (full access)")}catch(c){o.fail("API key validation failed"),h({message:q(c,"Failed to validate API key"),code:"validation_failed"},{json:r.json})}let s=await ra(r,"Save API key to which profile?"),{configPath:a,backend:l}=await Ps(n,s,i),d=s||"default";if(s)try{ar(d)}catch(c){h({message:q(c,"Failed to switch profile"),code:"switch_failed"},{json:r.json})}r.json?N({success:!0,config_path:a,profile:d,storage:l.name,permission:i},{json:!0}):na({noun:"API key",profileLabel:d,configPath:a,backend:l})});var oa=require("node:fs");fe();J();var Qr=new m("logout").description("Remove your saved Resend API key").addHelpText("after",f({setup:!0,context:`Removes the saved API key from secure storage and the credentials file.
|
|
217
218
|
|
|
218
219
|
When --profile is specified, only that profile's entry is removed.
|
|
219
220
|
When no profile is specified, all profiles are removed.
|
|
220
221
|
|
|
221
|
-
If no credentials file exists, exits cleanly with no error.`,output:' {"success":true,"config_path":"<path>"}',errorCodes:["remove_failed"],examples:["resend logout","resend logout --profile staging","resend logout --json"]})).action(async(t
|
|
222
|
+
If no credentials file exists, exits cleanly with no error.`,output:' {"success":true,"config_path":"<path>"}',errorCodes:["remove_failed"],examples:["resend logout","resend logout --profile staging","resend logout --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=wt(),o=fo();if(!o&&!(0,oa.existsSync)(n)){!r.json&&w()?console.log("No saved credentials found. Nothing to remove."):N({success:!0,already_logged_out:!0},{json:r.json});return}let i=r.profile,s=!i,a=i??"all";if(!s&&o&&!o.profiles[a]&&h({message:`Profile "${a}" not found. Available profiles: ${Object.keys(o.profiles).join(", ")}`,code:"remove_failed"},{json:r.json}),!r.json&&w()){let l=s?"Remove all saved API keys?":`Remove saved API key for profile '${a}'?`,d=await ot({message:l});($(d)||!d)&&S("Logout cancelled.")}try{s?await js():await qr(a)}catch(l){h({message:q(l,"Failed to remove credentials"),code:"remove_failed"},{json:r.json})}if(!r.json&&w()){let l=s?"Logged out. All API keys removed.":`Logged out. API key removed for profile '${a}'.`;Dr(l)}else N({success:!0,config_path:n,profile:s?"all":a},{json:r.json})});fe();J();async function lp(e,t){let r=e;if(!r){if(!w()||t.json){h({message:"Missing profile name. Provide a profile name in non-interactive mode.",code:"missing_name"},{json:t.json});return}let n=xe();if(n.length===0){h({message:"No profiles configured. Run `resend login` first.",code:"no_profiles"},{json:t.json});return}let o=await se({message:"Remove which profile?",options:n.map(i=>({value:i.name,label:i.name,hint:i.active?"active":void 0}))});$(o)&&S("Remove cancelled."),r=o}if(!t.json&&w()){let n=await ot({message:`Remove profile '${r}' and its API key?`});($(n)||!n)&&S("Remove cancelled.")}try{await qr(r)}catch(n){h({message:q(n,"Failed to remove profile"),code:"remove_failed"},{json:t.json});return}t.json?N({success:!0,removed_profile:r},{json:!0}):console.log(`Profile '${r}' removed.`)}var ia=new m("remove").description("Remove a profile").argument("[name]","Profile name to remove").action(async(e,t,r)=>{await lp(e,r.optsWithGlobals())});fe();J();async function cp(e,t,r){let n=e,o=t;if(!n){if(!w()||r.json){h({message:"Missing profile name. Provide old and new names in non-interactive mode.",code:"missing_name"},{json:r.json});return}let i=xe();if(i.length===0){h({message:"No profiles configured. Run `resend login` first.",code:"no_profiles"},{json:r.json});return}let s=await se({message:"Rename which profile?",options:i.map(a=>({value:a.name,label:a.name,hint:a.active?"active":ie(a.name)?"invalid name":void 0}))});$(s)&&S("Rename cancelled."),n=s}if(!o){if(!w()||r.json){h({message:"Missing new name. Provide old and new names in non-interactive mode.",code:"missing_name"},{json:r.json});return}let i=await X({message:`Enter new name for '${n}':`,placeholder:n.replace(/[^a-zA-Z0-9._-]/g,"-"),validate:s=>ie(s)});$(i)&&S("Rename cancelled."),o=i}try{await Ur(n,o)}catch(i){h({message:q(i,"Failed to rename profile"),code:"rename_failed"},{json:r.json});return}r.json?N({success:!0,old_name:n,new_name:o},{json:!0}):console.log(`Profile '${n}' renamed to '${o}'.`)}var sa=new m("rename").description("Rename a profile").argument("[old-name]","Current profile name").argument("[new-name]","New profile name").action(async(e,t,r,n)=>{await cp(e,t,n.optsWithGlobals())});fe();J();async function up(e,t){let r=e;if(!r){if(!w()||t.json){h({message:"Missing profile name. Provide a profile name in non-interactive mode.",code:"missing_name"},{json:t.json});return}let i=xe();if(i.length===0){h({message:"No profiles configured. Run `resend login` first.",code:"no_profiles"},{json:t.json});return}let s=await se({message:"Switch to which profile?",options:i.map(a=>({value:a.name,label:a.name,hint:a.active?"active":ie(a.name)?"invalid name":void 0}))});$(s)&&S("Switch cancelled."),r=s}if(xe().some(i=>i.name===r)){let i=await Kr(r,t);if(!i)return;r=i}try{ar(r)}catch(i){h({message:q(i,"Failed to switch profile"),code:"switch_failed"},{json:t.json});return}t.json?N({success:!0,active_profile:r},{json:!0}):console.log(`Switched to profile '${r}'.`)}var aa=new m("switch").description("Switch the active profile").argument("[name]","Profile name to switch to").action(async(e,t,r)=>{await up(e,r.optsWithGlobals())});var la=new m("auth").description("Manage authentication and profiles").addHelpText("after",f({setup:!0,context:`Environment variables:
|
|
222
223
|
RESEND_API_KEY API key (overrides stored credentials)
|
|
223
224
|
RESEND_PROFILE Profile name (overrides config default)
|
|
224
|
-
RESEND_CREDENTIAL_STORE Storage method: "secure_storage" or "file"`,examples:["resend login","resend login --key re_123456789","resend logout","resend auth list","resend auth switch staging","resend auth rename staging production","resend auth remove staging"]})).addCommand(
|
|
225
|
+
RESEND_CREDENTIAL_STORE Storage method: "secure_storage" or "file"`,examples:["resend login","resend login --key re_123456789","resend logout","resend auth list","resend auth switch staging","resend auth rename staging production","resend auth remove staging"]})).addCommand(Yr).addCommand(Qr).addCommand(ea,{isDefault:!0}).addCommand(aa).addCommand(sa).addCommand(ia);var vo=require("node:fs");function ce(e,t){if(e==="-"){process.stdin.isTTY&&h({message:"No input piped to stdin",code:"stdin_read_error"},{json:t.json});try{return(0,vo.readFileSync)(0,"utf-8")}catch{h({message:"Failed to read from stdin",code:"stdin_read_error"},{json:t.json})}}try{return(0,vo.readFileSync)(e,"utf-8")}catch{h({message:`Failed to read file: ${e}`,code:"file_read_error"},{json:t.json})}}function xt(e,t,r){if(e!==void 0)try{return JSON.parse(e)}catch(n){h({message:`Invalid JSON for ${t}: ${n instanceof Error?n.message:"parse error"}`,code:"invalid_json"},{json:r.json})}}var ca=new m("create").description("Create a new automation").option("--name <name>","Automation name").addOption(new Y("--status <status>","Initial status").choices(["enabled","disabled"])).option("--steps <json>","Steps array as JSON string").option("--connections <json>","Connections array as JSON string").option("--file <path>",'Path to a JSON file containing the full automation payload (use "-" for stdin)').addHelpText("after",f({context:`Non-interactive: --name and --steps/--connections (or --file) are required.
|
|
225
226
|
|
|
226
227
|
Payload format:
|
|
227
228
|
--file accepts a JSON object with { name, status?, steps, connections }.
|
|
@@ -229,17 +230,17 @@ Payload format:
|
|
|
229
230
|
When using --file, --name/--status/--steps/--connections flags override file values.
|
|
230
231
|
|
|
231
232
|
Step types: trigger, delay, send_email, wait_for_event, condition
|
|
232
|
-
Connection types: default, condition_met, condition_not_met, timeout, event_received`,output:' {"object":"automation","id":"<id>"}',errorCodes:["auth_error","missing_name","missing_steps","missing_connections","invalid_json","file_read_error","create_error"],examples:["resend automations create --file automation.json","cat automation.json | resend automations create --file -","resend automations create --file automation.json --status disabled",`resend automations create --name "Welcome Flow" --steps '[...]' --connections '[...]'`]})).action(async(t
|
|
233
|
-
This cannot be undone.`,loading:"Deleting automation...",object:"automation",successMsg:"Automation deleted",sdkCall:
|
|
233
|
+
Connection types: default, condition_met, condition_not_met, timeout, event_received`,output:' {"object":"automation","id":"<id>"}',errorCodes:["auth_error","missing_name","missing_steps","missing_connections","invalid_json","file_read_error","create_error"],examples:["resend automations create --file automation.json","cat automation.json | resend automations create --file -","resend automations create --file automation.json --status disabled",`resend automations create --name "Welcome Flow" --steps '[...]' --connections '[...]'`]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n={};if(e.file){let l=ce(e.file,r);try{n=JSON.parse(l)}catch(d){h({message:`Invalid JSON in --file: ${d instanceof Error?d.message:"parse error"}`,code:"invalid_json"},{json:r.json})}(typeof n!="object"||n===null||Array.isArray(n))&&h({message:"--file must contain a JSON object with automation properties (name, steps, connections).",code:"invalid_json"},{json:r.json})}let o=await U(e.name??n.name,{message:"Automation name",placeholder:"e.g. Welcome Flow"},{message:"Missing --name flag.",code:"missing_name"},r),i=xt(e.steps,"--steps",r)??n.steps;(!i||!Array.isArray(i)||i.length===0)&&h({message:"Missing or empty steps. Provide --steps as a JSON array or use --file.",code:"missing_steps"},{json:r.json});let s=xt(e.connections,"--connections",r)??n.connections;s||h({message:"Missing connections. Provide --connections as a JSON array or use --file (empty array is valid for single-step automations).",code:"missing_connections"},{json:r.json}),Array.isArray(s)||h({message:"--connections must be a JSON array.",code:"invalid_json"},{json:r.json});let a=e.status??n.status;await K({loading:"Creating automation...",sdkCall:l=>l.automations.create({name:o,steps:i,connections:s,...a&&{status:a}}),onInteractive:l=>{console.log(`Automation created: ${l.id}`)}},r)});function ua(e){let t=e.map(r=>[r.name,Co(r.status),r.created_at,r.id]);return F(["Name","Status","Created","ID"],t,"(no automations)")}function Co(e){switch(e){case"enabled":return"\u2713 Enabled";case"disabled":return"\u25CB Disabled";default:return e}}var Ke={resource:"automation",resourcePlural:"automations",fetchItems:(e,{limit:t,after:r})=>e.automations.list({limit:t,...r&&{after:r}}),display:e=>({label:e.name,hint:e.id})};var da=new m("delete").alias("rm").description("Delete an automation").argument("[id]","Automation ID").option("--yes","Skip confirmation prompt").addHelpText("after",f({context:"Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.",output:' {"object":"automation","id":"<id>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend automations delete <id> --yes","resend automations delete <id> --yes --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Ke,n);await ne(o,!!t.yes,{confirmMessage:`Delete automation ${o}?
|
|
234
|
+
This cannot be undone.`,loading:"Deleting automation...",object:"automation",successMsg:"Automation deleted",sdkCall:i=>i.automations.remove(o)},n)});var ma=new m("get").description("Retrieve an automation with its steps and connections").argument("[id]","Automation ID").addHelpText("after",f({output:` Full automation object including steps and connections arrays.
|
|
234
235
|
|
|
235
|
-
Automation status values: enabled | disabled`,errorCodes:["auth_error","fetch_error"],examples:["resend automations get <id>","resend automations get <id> --json"]})).action(async(t,
|
|
236
|
-
Steps:`);let s=
|
|
237
|
-
Connections:`);let s=
|
|
236
|
+
Automation status values: enabled | disabled`,errorCodes:["auth_error","fetch_error"],examples:["resend automations get <id>","resend automations get <id> --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Ke,n);await G({loading:"Fetching automation...",sdkCall:i=>i.automations.get(o),onInteractive:i=>{if(console.log(`${i.name} \u2014 ${Co(i.status)}`),console.log(`ID: ${i.id}`),console.log(`Created: ${i.created_at}`),i.updated_at&&console.log(`Updated: ${i.updated_at}`),i.steps.length>0){console.log(`
|
|
237
|
+
Steps:`);let s=i.steps.map(a=>[a.key,a.type]);console.log(F(["Key","Type"],s,"(no steps)"))}if(i.connections.length>0){console.log(`
|
|
238
|
+
Connections:`);let s=i.connections.map(a=>[a.from,a.to,a.type]);console.log(F(["From","To","Type"],s,"(no connections)"))}}},n)});var pa=new m("list").alias("ls").description("List all automations").option("--limit <n>","Maximum number of automations to return (1-100)","10").option("--after <cursor>","Return automations after this cursor (next page)").option("--before <cursor>","Return automations before this cursor (previous page)").addHelpText("after",f({output:' {"object":"list","data":[...],"has_more":true}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend automations list","resend automations list --limit 25 --json","resend automations list --after <cursor> --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching automations...",sdkCall:i=>i.automations.list(o),onInteractive:i=>{console.log(ua(i.data)),M(i,"automations list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var fa=new m("open").description("Open an automation or the automations list in the Resend dashboard").argument("[id]","Automation ID \u2014 omit to open the automations list").addHelpText("after",f({context:`Opens the Resend dashboard in your default browser.
|
|
238
239
|
With an ID: opens that automation's editor.
|
|
239
|
-
Without an ID: opens the automations list.`,examples:["resend automations open","resend automations open 019d4ef1-8266-71d4-a1aa-60ce5d0eaea7"]})).action(async(t,
|
|
240
|
+
Without an ID: opens the automations list.`,examples:["resend automations open","resend automations open 019d4ef1-8266-71d4-a1aa-60ce5d0eaea7"]})).action(async(e,t,r)=>{let n=e?de.automation(e):de.automations,o=r.optsWithGlobals();await Se(n,o)});var ha=new m("get").description("Retrieve details of a specific automation run").option("--automation-id <id>","Automation ID").option("--run-id <id>","Run ID").addHelpText("after",f({output:" Full automation run object with status, trigger, and timestamps.",errorCodes:["auth_error","missing_automation_id","missing_run_id","fetch_error"],examples:["resend automations runs get --automation-id <id> --run-id <id>","resend automations runs get --automation-id <id> --run-id <id> --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=await U(e.automationId,{message:"Automation ID"},{message:"Missing --automation-id flag.",code:"missing_automation_id"},r),o=await U(e.runId,{message:"Run ID"},{message:"Missing --run-id flag.",code:"missing_run_id"},r);await G({loading:"Fetching automation run...",sdkCall:i=>i.automations.runs.get({automationId:n,runId:o}),onInteractive:i=>{console.log(`Run: ${i.id}`),console.log(`Status: ${i.status}`),i.started_at&&console.log(`Started: ${i.started_at}`),i.completed_at&&console.log(`Completed: ${i.completed_at}`),console.log(`Created: ${i.created_at}`)}},r)});var ga=new m("list").alias("ls").description("List runs for an automation").argument("[automation-id]","Automation ID").option("--status <status>","Filter by status (running, completed, failed, cancelled). Comma-separated.").option("--limit <n>","Maximum number of runs to return (1-100)","10").option("--after <cursor>","Return runs after this cursor (next page)").option("--before <cursor>","Return runs before this cursor (previous page)").addHelpText("after",f({output:' {"object":"list","data":[...],"has_more":true}',errorCodes:["auth_error","missing_id","invalid_limit","list_error"],examples:["resend automations runs <automation-id>","resend automations runs list <automation-id>","resend automations runs list <automation-id> --status running","resend automations runs list <automation-id> --limit 25 --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Ke,n),i=L(t.limit,n),s=H(i,t.after,t.before,n);await O({loading:"Fetching automation runs...",sdkCall:a=>a.automations.runs.list({automationId:o,...s,...t.status?{status:t.status}:{}}),onInteractive:a=>{let l=a.data.map(d=>[d.id,d.status,d.started_at??"-",d.completed_at??"-"]);console.log(F(["ID","Status","Started","Completed"],l,"(no runs)")),M(a,`automations runs list ${o}`,{limit:i,before:t.before,apiKey:n.apiKey,profile:n.profile})}},n)});var ba=new m("runs").description("Manage automation runs").addHelpText("after",f({context:`Runs represent individual executions of an automation.
|
|
240
241
|
Each run is triggered by an event and progresses through the automation's steps.
|
|
241
242
|
|
|
242
|
-
Run status values: running | completed | failed | cancelled`,examples:["resend automations runs <automation-id>","resend automations runs list <automation-id> --limit 25","resend automations runs get --automation-id <id> --run-id <id>"]})).addCommand(
|
|
243
|
+
Run status values: running | completed | failed | cancelled`,examples:["resend automations runs <automation-id>","resend automations runs list <automation-id> --limit 25","resend automations runs get --automation-id <id> --run-id <id>"]})).addCommand(ga,{isDefault:!0}).addCommand(ha);var ya=new m("stop").description("Stop a running automation").argument("[id]","Automation ID").addHelpText("after",f({context:"Stops a running automation by setting its status to disabled and cancelling active runs.",output:' {"object":"automation","id":"<id>","status":"disabled"}',errorCodes:["auth_error","stop_error"],examples:["resend automations stop <id>","resend automations stop <id> --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Ke,n);await R({loading:"Stopping automation...",sdkCall:i=>i.automations.stop(o),errorCode:"stop_error",successMsg:"Automation stopped"},n)});var va=new m("update").description("Update an automation status (enable or disable)").argument("[id]","Automation ID").addOption(new Y("--status <status>","New status").choices(["enabled","disabled"])).addHelpText("after",f({output:' {"object":"automation","id":"<id>","status":"<status>"}',errorCodes:["auth_error","missing_status","update_error"],examples:["resend automations update <id> --status enabled","resend automations update <id> --status disabled --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Ke,n),i=await Pt(t.status,{message:"Status",options:[{value:"enabled",label:"Enabled"},{value:"disabled",label:"Disabled"}]},{message:"Missing --status flag.",code:"missing_status"},n);await R({loading:"Updating automation...",sdkCall:s=>s.automations.update(o,{status:i}),errorCode:"update_error",successMsg:`Automation updated: ${o} (${i})`},n)});var Ca=new m("automations").description("Manage automations").addHelpText("after",f({context:`Automations are event-driven workflows composed of steps and connections.
|
|
243
244
|
|
|
244
245
|
Steps define the actions (trigger, delay, send_email, wait_for_event, condition).
|
|
245
246
|
Connections define the flow between steps (default, condition_met, condition_not_met, timeout, event_received).
|
|
@@ -249,10 +250,10 @@ Lifecycle:
|
|
|
249
250
|
2. resend automations update <id> --status enabled
|
|
250
251
|
3. resend automations stop <id> (stop automation)
|
|
251
252
|
4. resend automations runs <id> (inspect runs)
|
|
252
|
-
5. resend automations open <id> (view in dashboard)`,examples:["resend automations list",'resend automations create --name "Welcome Flow" --file workflow.json',"resend automations get <id>","resend automations update <id> --status enabled","resend automations stop <id>","resend automations delete <id> --yes","resend automations runs <automation-id>","resend automations runs get --automation-id <id> --run-id <id>","resend automations open <id>"]})).addCommand(
|
|
253
|
+
5. resend automations open <id> (view in dashboard)`,examples:["resend automations list",'resend automations create --name "Welcome Flow" --file workflow.json',"resend automations get <id>","resend automations update <id> --status enabled","resend automations stop <id>","resend automations delete <id> --yes","resend automations runs <automation-id>","resend automations runs get --automation-id <id> --run-id <id>","resend automations open <id>"]})).addCommand(ca).addCommand(ma).addCommand(pa,{isDefault:!0}).addCommand(va).addCommand(da).addCommand(ya).addCommand(fa).addCommand(ba);async function Xr(e){try{let{data:t,error:r}=await e.domains.list();return r||!t?[]:t.data.filter(n=>n.status==="verified"&&n.capabilities.sending==="enabled").map(n=>n.name)}catch{return[]}}var dp=["noreply","hello"];async function Zr(e){let t;if(e.length===1)t=e[0];else{let o=await se({message:"Select a verified domain",options:e.map(i=>({value:i,label:i}))});$(o)&&S("Send cancelled."),t=o}let r=dp.map(o=>({value:`${o}@${t}`,label:`${o}@${t}`}));r.push({value:null,label:"Custom address..."});let n=await se({message:`From address (@${t})`,options:r});if($(n)&&S("Send cancelled."),n===null){let o=await X({message:"From address",placeholder:`e.g. you@${t}`,validate:i=>!i||!i.includes("@")?"Enter a valid email address":void 0});return $(o)&&S("Send cancelled."),o}return n}var Ft=require("node:fs"),Ta=require("node:path");var en=require("node:fs"),$a=require("node:os"),Rt=pe(require("node:path"),1);function wa(){return"pkg"in process?require("esbuild-wasm"):require("esbuild")}var xa=require("node:fs"),ka=pe(require("node:path"),1);function _a(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Aa=e=>({name:"rendering-utilities-exporter",setup:t=>{t.onLoad({filter:new RegExp(e.map(r=>_a(r)).join("|"))},async({path:r})=>({contents:`${await xa.promises.readFile(r,"utf8")};
|
|
253
254
|
export { render } from 'react-email-module-that-will-export-render'
|
|
254
255
|
export { createElement as reactEmailCreateReactElement } from 'react';
|
|
255
|
-
`,loader:
|
|
256
|
+
`,loader:ka.default.extname(r).slice(1)})),t.onResolve({filter:/^react-email-module-that-will-export-render$/},async r=>{let n={kind:"import-statement",importer:r.importer,resolveDir:r.resolveDir,namespace:r.namespace},o=await t.resolve("react-email",n);return o.errors.length===0||(o=await t.resolve("@react-email/components",n),o.errors.length===0)||(o=await t.resolve("@react-email/render",n),o.errors.length>0&&o.errors[0]&&(o.errors[0].text="Failed to import `render` from `react-email` (6.0+), `@react-email/components` (5.x), or `@react-email/render`. Install one of them in your project.")),o})}});async function Ea(e){let t=Rt.default.resolve(e),r=(0,en.mkdtempSync)(Rt.default.join((0,$a.tmpdir)(),"resend-react-email-"));try{let{build:i}=wa();await i({bundle:!0,entryPoints:[t],format:"cjs",jsx:"automatic",logLevel:"silent",outExtension:{".js":".cjs"},outdir:r,platform:"node",plugins:[Aa([t])],write:!0})}catch(i){throw(0,en.rmSync)(r,{recursive:!0,force:!0}),i}let n=Rt.default.basename(t,Rt.default.extname(t));return{cjsPath:Rt.default.join(r,`${n}.cjs`),tmpDir:r}}var Da=require("node:module");async function Sa(e){let t=(0,Da.createRequire)(e);delete t.cache[e];let r=t(e);return r.render(r.reactEmailCreateReactElement(r.default,{}),{})}var wo=e=>{e&&(0,Ft.rmSync)(e,{recursive:!0,force:!0})},Be=async(e,t)=>{if(e.trim()==="")return h({message:"--react-email path cannot be empty",code:"react_email_build_error"},{json:t.json});let r=(0,Ta.resolve)(e);if(!(0,Ft.existsSync)(r))return h({message:`File not found: ${e}`,code:"react_email_build_error"},{json:t.json});if(!(0,Ft.statSync)(r).isFile())return h({message:`--react-email path must be a file, got a directory: ${e}`,code:"react_email_build_error"},{json:t.json});let n=re("Bundling React Email template...",t.quiet),o;try{let i=await Ea(e);o=i.tmpDir,n.stop("Bundled React Email template");let s=re("Rendering React Email template...",t.quiet);try{let a=await Sa(i.cjsPath);return s.stop("Rendered React Email template"),wo(o),a}catch(a){return s.fail("Failed to render React Email template"),wo(o),h({message:q(a,"Failed to render React Email template"),code:"react_email_render_error"},{json:t.json})}}catch(i){return n.fail("Failed to bundle React Email template"),wo(o),h({message:q(i,"Failed to bundle React Email template"),code:"react_email_build_error"},{json:t.json})}};J();var Ge={resource:"segment",resourcePlural:"segments",fetchItems:(e,{limit:t,after:r})=>e.segments.list({limit:t,...r&&{after:r}}),display:e=>({label:e.name,hint:e.id})};function tn(e){let t=e.map(r=>[r.name,r.id,r.created_at]);return F(["Name","ID","Created"],t,"(no segments)")}var mt={resource:"topic",resourcePlural:"topics",fetchItems:e=>e.topics.list().then(t=>({...t,data:t.data?{data:t.data.data,has_more:!1}:null})),display:e=>({label:e.name,hint:e.id})};function Oa(e){let t=e.map(r=>[r.name,r.description??"",r.id,r.created_at]);return F(["Name","Description","ID","Created"],t,"(no topics)")}var Ia=new m("create").description("Create a broadcast draft (or send immediately with --send)").option("--from <address>","Sender address \u2014 required").option("--subject <subject>","Email subject \u2014 required").option("--segment-id <id>","Target segment ID \u2014 required").option("--html <html>","HTML body (supports {{{FIRST_NAME|fallback}}} triple-brace variable interpolation)").option("--html-file <path>",'Path to an HTML file for the body (use "-" for stdin, supports {{{FIRST_NAME|fallback}}} variable interpolation)').option("--text <text>","Plain-text body").option("--text-file <path>",'Path to a plain-text file for the body (use "-" for stdin)').option("--react-email <path>","Path to a React Email template (.tsx) to bundle, render, and use as HTML body").option("--name <name>","Internal label for the broadcast (optional)").option("--reply-to <address>","Reply-to address (optional)").option("--preview-text <text>","Preview text shown in inbox below the subject line (optional)").option("--topic-id <id>","Associate with a topic for subscription filtering (optional)").option("--send","Send immediately on create instead of saving as draft").option("--scheduled-at <datetime>",'Schedule delivery \u2014 ISO 8601 or natural language e.g. "in 1 hour", "tomorrow at 9am ET" (only valid with --send)').option("--dry-run","Validate input and print the create request JSON without calling the API (interactive: type segment/topic IDs; lists are not fetched)").addHelpText("after",f({context:`Non-interactive: --from, --subject, and --segment-id are required.
|
|
256
257
|
Body: provide at least one of --html, --html-file, --text, --text-file, or --react-email.
|
|
257
258
|
|
|
258
259
|
Use --dry-run to print the request JSON without creating a broadcast.
|
|
@@ -264,26 +265,26 @@ Variable interpolation:
|
|
|
264
265
|
Scheduling:
|
|
265
266
|
Use --scheduled-at with --send to schedule delivery.
|
|
266
267
|
Accepts ISO 8601 (e.g. 2026-08-05T11:52:01Z) or natural language (e.g. "in 1 hour").
|
|
267
|
-
--scheduled-at without --send is ignored.`,output:' {"id":"<broadcast-id>"}',errorCodes:["auth_error","missing_from","missing_subject","missing_segment","missing_body","file_read_error","invalid_options","stdin_read_error","react_email_build_error","react_email_render_error","create_error"],examples:['resend broadcasts create --from onboarding@resend.com --subject "Weekly Update" --segment-id 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d --html "<p>Hello {{{FIRST_NAME|there}}}</p>"','resend broadcasts create --from onboarding@resend.com --subject "Launch" --segment-id 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d --html-file ./email.html --send','resend broadcasts create --from onboarding@resend.com --subject "Launch" --segment-id 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d --text "Hello!" --send --scheduled-at "tomorrow at 9am ET"']})).action(async(t
|
|
268
|
+
--scheduled-at without --send is ignored.`,output:' {"id":"<broadcast-id>"}',errorCodes:["auth_error","missing_from","missing_subject","missing_segment","missing_body","file_read_error","invalid_options","stdin_read_error","react_email_build_error","react_email_render_error","create_error"],examples:['resend broadcasts create --from onboarding@resend.com --subject "Weekly Update" --segment-id 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d --html "<p>Hello {{{FIRST_NAME|there}}}</p>"','resend broadcasts create --from onboarding@resend.com --subject "Launch" --segment-id 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d --html-file ./email.html --send','resend broadcasts create --from onboarding@resend.com --subject "Launch" --segment-id 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d --text "Hello!" --send --scheduled-at "tomorrow at 9am ET"']})).action(async(e,t)=>{let r=t.optsWithGlobals();e.htmlFile==="-"&&e.textFile==="-"&&h({message:"Cannot read both --html-file and --text-file from stdin. Pipe to one and pass the other as a file path.",code:"invalid_options"},{json:r.json}),e.reactEmail&&(e.html||e.htmlFile)&&h({message:"Cannot use --react-email with --html or --html-file",code:"invalid_options"},{json:r.json}),e.html!==void 0&&e.htmlFile!==void 0&&h({message:"--html and --html-file are mutually exclusive.",code:"invalid_options"},{json:r.json}),e.text!==void 0&&e.textFile!==void 0&&h({message:"--text and --text-file are mutually exclusive.",code:"invalid_options"},{json:r.json});let n=e.from,o=e.subject,i=e.segmentId;if(!n&&w()&&!r.json&&!e.dryRun){let c=await Z(r),u=await Xr(c);u.length>0&&(n=await Zr(u))}if(!n){(!w()||r.json)&&h({message:"Missing --from flag.",code:"missing_from"},{json:r.json});let c=await X({message:"From address",placeholder:"e.g. onboarding@resend.com",validate:u=>u?void 0:"Required"});$(c)&&S("Cancelled."),n=c}if(!o){(!w()||r.json)&&h({message:"Missing --subject flag.",code:"missing_subject"},{json:r.json});let c=await X({message:"Subject",placeholder:"e.g. Weekly Newsletter",validate:u=>u?void 0:"Required"});$(c)&&S("Cancelled."),o=c}if(!i)if((!w()||r.json)&&h({message:"Missing --segment-id flag.",code:"missing_segment"},{json:r.json}),e.dryRun){let c=await X({message:"Segment ID",placeholder:"e.g. 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d",validate:u=>u?void 0:"Required"});$(c)&&S("Cancelled."),i=c}else i=await C(void 0,Ge,r);let s=e.reactEmail?await Be(e.reactEmail,r):e.htmlFile?ce(e.htmlFile,r):e.html,a=e.textFile?ce(e.textFile,r):e.text;if(!s&&!a){(!w()||r.json)&&h({message:"Missing body. Provide --html, --html-file, --text, --text-file, or --react-email.",code:"missing_body"},{json:r.json});let c=await X({message:"Body (plain text)",placeholder:"e.g. Hello {{{FIRST_NAME|there}}}!",validate:u=>u?void 0:"Required"});$(c)&&S("Cancelled."),a=c}let l=e.topicId;if(!l&&w()&&!r.json)if(e.dryRun){let c=await X({message:"Topic ID (optional)",placeholder:"Press Enter to skip"});$(c)&&S("Cancelled."),l=c.trim()||void 0}else l=await C(void 0,mt,r,{optional:!0});let d={from:n,subject:o,segmentId:i,...s&&{html:s},...a&&{text:a},...e.name&&{name:e.name},...e.replyTo&&{replyTo:e.replyTo},...e.previewText&&{previewText:e.previewText},...l&&{topicId:l},...e.send&&{send:!0},...e.send&&e.scheduledAt&&{scheduledAt:e.scheduledAt}};if(e.dryRun){N({dryRun:!0,request:d},{json:r.json});return}await K({loading:"Creating broadcast...",sdkCall:c=>c.broadcasts.create(d),onInteractive:c=>{e.send?e.scheduledAt?console.log(`Broadcast scheduled: ${c.id}`):console.log(`Broadcast sent: ${c.id}`):(console.log(`Broadcast created: ${c.id}`),console.log("Status: draft"),console.log(`Send it with: resend broadcasts send ${c.id}`))}},r)});function _o(e){switch(e){case"draft":return"\u25CB Draft";case"queued":return"\u23F3 Queued";case"sent":return"\u2713 Sent";default:return e}}var Nt={resource:"broadcast",resourcePlural:"broadcasts",fetchItems:(e,{limit:t,after:r})=>e.broadcasts.list({limit:t,...r&&{after:r}}),display:e=>({label:e.name??"(untitled)",hint:e.id})},Pa={resource:"broadcast",resourcePlural:"broadcasts",fetchItems:(e,{limit:t,after:r})=>e.broadcasts.list({limit:t,...r&&{after:r}}),display:e=>({label:e.name??"(untitled)",hint:`${_o(e.status)} ${e.id}`}),filter:e=>e.status==="draft"};function ja(e){let t=e.map(r=>[r.name??"(untitled)",r.status,r.created_at,r.id]);return F(["Name","Status","Created","ID"],t,"(no broadcasts)")}var Ra=new m("delete").alias("rm").description("Delete a broadcast \u2014 draft broadcasts are removed; scheduled broadcasts are cancelled before delivery").argument("[id]","Broadcast ID").option("--yes","Skip confirmation prompt").addHelpText("after",f({context:`Warning: Deleting a scheduled broadcast cancels its delivery immediately.
|
|
268
269
|
Only draft and scheduled broadcasts can be deleted; sent broadcasts cannot.
|
|
269
270
|
|
|
270
|
-
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"broadcast","id":"<id>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend broadcasts delete d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --yes","resend broadcasts delete d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --yes --json"]})).action(async(t,
|
|
271
|
-
ID: ${
|
|
272
|
-
If scheduled, delivery will be cancelled.`,loading:"Deleting broadcast...",object:"broadcast",successMsg:"Broadcast deleted",sdkCall:
|
|
273
|
-
Use this command to retrieve the full broadcast payload.`,output:' {"id":"...","object":"broadcast","name":"...","segment_id":"...","from":"...","subject":"...","status":"draft|queued|sent","created_at":"...","scheduled_at":null,"sent_at":null}',errorCodes:["auth_error","fetch_error"],examples:["resend broadcasts get d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6","resend broadcasts get d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --json"]})).action(async(t,
|
|
274
|
-
To retrieve full details (html, from, subject), use: resend broadcasts get <id>`,output:' {"object":"list","has_more":false,"data":[{"id":"...","name":"...","status":"draft|queued|sent","created_at":"..."}]}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend broadcasts list","resend broadcasts list --limit 5","resend broadcasts list --after d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --limit 10","resend broadcasts list --json"]})).action(async(t
|
|
271
|
+
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"broadcast","id":"<id>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend broadcasts delete d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --yes","resend broadcasts delete d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --yes --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await le(e,Nt,n);await ne(o.id,!!t.yes,{confirmMessage:`Delete broadcast "${o.label}"?
|
|
272
|
+
ID: ${o.id}
|
|
273
|
+
If scheduled, delivery will be cancelled.`,loading:"Deleting broadcast...",object:"broadcast",successMsg:"Broadcast deleted",sdkCall:i=>i.broadcasts.remove(o.id)},n)});var Fa=new m("get").description("Retrieve full details for a broadcast including HTML body, status, and delivery times").argument("[id]","Broadcast ID").addHelpText("after",f({context:`Note: The list command returns summary objects without html/text/from/subject.
|
|
274
|
+
Use this command to retrieve the full broadcast payload.`,output:' {"id":"...","object":"broadcast","name":"...","segment_id":"...","from":"...","subject":"...","status":"draft|queued|sent","created_at":"...","scheduled_at":null,"sent_at":null}',errorCodes:["auth_error","fetch_error"],examples:["resend broadcasts get d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6","resend broadcasts get d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Nt,n);await G({loading:"Fetching broadcast...",sdkCall:i=>i.broadcasts.get(o),onInteractive:i=>{console.log(`Broadcast: ${i.id}`),console.log(` Status: ${_o(i.status)}`),console.log(` Name: ${i.name??"(untitled)"}`),console.log(` From: ${i.from??"\u2014"}`),console.log(` Subject: ${i.subject??"\u2014"}`),console.log(` Segment: ${i.segment_id??"\u2014"}`),i.preview_text&&console.log(` Preview: ${i.preview_text}`),i.topic_id&&console.log(` Topic: ${i.topic_id}`),console.log(` Created: ${i.created_at}`),i.scheduled_at&&console.log(` Scheduled: ${i.scheduled_at}`),i.sent_at&&console.log(` Sent: ${i.sent_at}`)}},n)});var Na=new m("list").alias("ls").description('List broadcasts \u2014 returns summary objects (use "get <id>" for full details including html/text)').option("--limit <n>","Maximum number of results to return (1-100)","10").option("--after <cursor>","Cursor for forward pagination \u2014 list items after this ID").option("--before <cursor>","Cursor for backward pagination \u2014 list items before this ID").addHelpText("after",f({context:`Note: List results include name, status, created_at, and id only.
|
|
275
|
+
To retrieve full details (html, from, subject), use: resend broadcasts get <id>`,output:' {"object":"list","has_more":false,"data":[{"id":"...","name":"...","status":"draft|queued|sent","created_at":"..."}]}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend broadcasts list","resend broadcasts list --limit 5","resend broadcasts list --after d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --limit 10","resend broadcasts list --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching broadcasts...",sdkCall:i=>i.broadcasts.list(o),onInteractive:i=>{console.log(ja(i.data)),M(i,"broadcasts list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var Ba=new m("open").description("Open a broadcast or the broadcasts list in the Resend dashboard").argument("[id]","Broadcast ID \u2014 omit to open the broadcasts list").addHelpText("after",f({context:`Opens the Resend dashboard in your default browser.
|
|
275
276
|
With an ID: opens that broadcast's page for viewing or editing.
|
|
276
|
-
Without an ID: opens the broadcasts list.`,examples:["resend broadcasts open","resend broadcasts open d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6"]})).action(async(t,
|
|
277
|
+
Without an ID: opens the broadcasts list.`,examples:["resend broadcasts open","resend broadcasts open d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6"]})).action(async(e,t,r)=>{let n=e?de.broadcast(e):de.broadcasts,o=r.optsWithGlobals();await Se(n,o)});var Ga=new m("send").description("Send a draft broadcast (API-created drafts only \u2014 dashboard broadcasts cannot be sent via API)").argument("[id]","Broadcast ID").option("--scheduled-at <datetime>",'Schedule delivery \u2014 ISO 8601 or natural language e.g. "in 1 hour", "tomorrow at 9am ET"').addHelpText("after",f({context:`Note: Only broadcasts created via the API can be sent via this command.
|
|
277
278
|
Broadcasts created in the Resend dashboard cannot be sent programmatically.
|
|
278
279
|
|
|
279
280
|
Scheduling:
|
|
280
281
|
--scheduled-at accepts ISO 8601 (e.g. 2026-08-05T11:52:01Z) or
|
|
281
|
-
natural language (e.g. "in 1 hour", "tomorrow at 9am ET").`,output:' {"id":"<broadcast-id>"}',errorCodes:["auth_error","send_error"],examples:["resend broadcasts send d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6",'resend broadcasts send d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --scheduled-at "in 1 hour"','resend broadcasts send d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --scheduled-at "2026-08-05T11:52:01Z" --json']})).action(async(t,
|
|
282
|
+
natural language (e.g. "in 1 hour", "tomorrow at 9am ET").`,output:' {"id":"<broadcast-id>"}',errorCodes:["auth_error","send_error"],examples:["resend broadcasts send d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6",'resend broadcasts send d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --scheduled-at "in 1 hour"','resend broadcasts send d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --scheduled-at "2026-08-05T11:52:01Z" --json']})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Pa,n);await R({loading:t.scheduledAt?"Scheduling broadcast...":"Sending broadcast...",sdkCall:i=>i.broadcasts.send(o,{...t.scheduledAt&&{scheduledAt:t.scheduledAt}}),errorCode:"send_error",successMsg:t.scheduledAt?"Broadcast scheduled":"Broadcast sent",permission:"sending_access"},n)});var La=new m("update").description("Update a draft broadcast \u2014 only drafts can be updated; sent broadcasts are immutable").argument("[id]","Broadcast ID").option("--from <address>","Update sender address").option("--subject <subject>","Update subject").option("--html <html>","Update HTML body (supports {{{FIRST_NAME|fallback}}} variable interpolation)").option("--html-file <path>",'Path to an HTML file to replace the body (use "-" for stdin, supports {{{FIRST_NAME|fallback}}} variable interpolation)').option("--text <text>","Update plain-text body").option("--text-file <path>",'Path to a plain-text file to replace the body (use "-" for stdin)').option("--react-email <path>","Path to a React Email template (.tsx) to bundle, render, and use as HTML body").option("--name <name>","Update internal label").addHelpText("after",f({context:`Note: Only draft broadcasts can be updated.
|
|
282
283
|
If the broadcast is already sent or sending, the API will return an error.
|
|
283
284
|
|
|
284
285
|
Variable interpolation:
|
|
285
286
|
HTML bodies support triple-brace syntax for contact properties.
|
|
286
|
-
Example: {{{FIRST_NAME|Friend}}} \u2014 uses FIRST_NAME or falls back to "Friend".`,output:' {"id":"<broadcast-id>"}',errorCodes:["auth_error","no_changes","file_read_error","invalid_options","stdin_read_error","react_email_build_error","react_email_render_error","update_error"],examples:['resend broadcasts update d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --subject "Updated Subject"',"resend broadcasts update d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --html-file ./new-email.html",'resend broadcasts update d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --name "Q1 Newsletter" --from "onboarding@resend.com" --json','echo "<p>New content</p>" | resend broadcasts update d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --html-file -']})).action(async(t,
|
|
287
|
+
Example: {{{FIRST_NAME|Friend}}} \u2014 uses FIRST_NAME or falls back to "Friend".`,output:' {"id":"<broadcast-id>"}',errorCodes:["auth_error","no_changes","file_read_error","invalid_options","stdin_read_error","react_email_build_error","react_email_render_error","update_error"],examples:['resend broadcasts update d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --subject "Updated Subject"',"resend broadcasts update d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --html-file ./new-email.html",'resend broadcasts update d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --name "Q1 Newsletter" --from "onboarding@resend.com" --json','echo "<p>New content</p>" | resend broadcasts update d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --html-file -']})).action(async(e,t,r)=>{let n=r.optsWithGlobals();t.from==null&&t.subject==null&&t.html==null&&t.htmlFile==null&&t.text==null&&t.textFile==null&&t.reactEmail==null&&t.name==null&&h({message:"Provide at least one option to update: --from, --subject, --html, --html-file, --text, --text-file, --react-email, or --name.",code:"no_changes"},{json:n.json}),t.htmlFile==="-"&&t.textFile==="-"&&h({message:"Cannot read both --html-file and --text-file from stdin. Pipe to one and pass the other as a file path.",code:"invalid_options"},{json:n.json}),t.reactEmail!=null&&(t.html!=null||t.htmlFile!=null)&&h({message:"Cannot use --react-email with --html or --html-file",code:"invalid_options"},{json:n.json}),t.html!=null&&t.htmlFile!=null&&h({message:"--html and --html-file are mutually exclusive.",code:"invalid_options"},{json:n.json}),t.text!=null&&t.textFile!=null&&h({message:"--text and --text-file are mutually exclusive.",code:"invalid_options"},{json:n.json});let o=await C(e,Nt,n),i=t.reactEmail!=null?await Be(t.reactEmail,n):t.htmlFile!=null?ce(t.htmlFile,n):t.html,s=t.textFile!=null?ce(t.textFile,n):t.text;await R({loading:"Updating broadcast...",sdkCall:a=>a.broadcasts.update(o,{...t.from!=null&&{from:t.from},...t.subject!=null&&{subject:t.subject},...i!=null&&{html:i},...s!=null&&{text:s},...t.name!=null&&{name:t.name}}),errorCode:"update_error",successMsg:`Broadcast updated: ${o}`},n)});var Ha=new m("broadcasts").description("Manage broadcasts").addHelpText("after",f({context:`Lifecycle:
|
|
287
288
|
Broadcasts follow a draft \u2192 send flow:
|
|
288
289
|
1. create \u2014 creates a draft (or sends immediately with --send)
|
|
289
290
|
2. send \u2014 sends an API-created draft (dashboard broadcasts cannot be sent via API)
|
|
@@ -294,25 +295,25 @@ Template variables:
|
|
|
294
295
|
Example: {{{FIRST_NAME|Friend}}} \u2014 uses FIRST_NAME or falls back to "Friend".
|
|
295
296
|
|
|
296
297
|
Scheduling:
|
|
297
|
-
--scheduled-at accepts ISO 8601 or natural language e.g. "in 1 hour", "tomorrow at 9am ET".`,examples:["resend broadcasts list",'resend broadcasts create --from onboarding@resend.com --subject "Launch" --segment-id 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d --html "<p>Hi {{{FIRST_NAME|there}}}</p>"',"resend broadcasts send d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6",'resend broadcasts send d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --scheduled-at "in 1 hour"',"resend broadcasts get d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6",'resend broadcasts update d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --subject "Updated Subject"',"resend broadcasts delete d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --yes","resend broadcasts open","resend broadcasts open d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6"]})).addCommand(
|
|
298
|
-
`)}function
|
|
299
|
-
`)}function
|
|
300
|
-
`)}function
|
|
301
|
-
`)}var
|
|
302
|
-
In machine mode (piped, CI, or --json), the tree is JSON you can feed to agents or scripts.`,examples:["resend commands","resend commands --json",'resend commands | jq ".subcommands[].name"']})).action((t
|
|
303
|
-
`),process.exit(1));let r=await
|
|
304
|
-
`),n}function
|
|
298
|
+
--scheduled-at accepts ISO 8601 or natural language e.g. "in 1 hour", "tomorrow at 9am ET".`,examples:["resend broadcasts list",'resend broadcasts create --from onboarding@resend.com --subject "Launch" --segment-id 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d --html "<p>Hi {{{FIRST_NAME|there}}}</p>"',"resend broadcasts send d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6",'resend broadcasts send d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --scheduled-at "in 1 hour"',"resend broadcasts get d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6",'resend broadcasts update d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --subject "Updated Subject"',"resend broadcasts delete d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --yes","resend broadcasts open","resend broadcasts open d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6"]})).addCommand(Ia).addCommand(Ba).addCommand(Ga).addCommand(Fa).addCommand(Na,{isDefault:!0}).addCommand(La).addCommand(Ra);function dr(e){let t=[];for(let n of e.commands)n._hidden||t.push(dr(n));let r=[];for(let n of e.options)n.hidden||r.push({long:n.long,short:n.short,description:n.description,takesValue:n.required||n.optional,choices:n.argChoices});return{name:e.name(),aliases:e.aliases(),description:e.description(),subcommands:t,options:r}}function mr(e,t,r){let n=t?`${t} ${e.name}`:e.name,o=[],i=[];for(let a of e.subcommands){i.push({name:a.name,description:a.description});for(let l of a.aliases)i.push({name:l,description:a.description})}let s=[...e.options,...r];o.push({path:n,subcommands:i,options:s});for(let a of e.subcommands)o.push(...mr(a,n,r));return o}function xo(e){let t=new Set;function r(n){for(let o of n.options)o.takesValue&&(o.long&&t.add(o.long),o.short&&t.add(o.short));for(let o of n.subcommands)r(o)}return r(e),[...t]}function qa(e){let t=mr(e,"",[]),r=[],n=e.name;r.push(`# bash completion for ${n}`),r.push(`# Generated by: ${n} completion bash`),r.push(""),r.push(`_${n}_completions() {`),r.push(" local cur prev words cword"),r.push(" if type _init_completion &>/dev/null; then _init_completion || return; else"),r.push(' cur="${COMP_WORDS[COMP_CWORD]}"'),r.push(' prev="${COMP_WORDS[COMP_CWORD-1]}"'),r.push(' words=("${COMP_WORDS[@]}")'),r.push(" cword=$COMP_CWORD"),r.push(" fi"),r.push("");let i=xo(e).join("|");r.push(' local cmd_path=""'),r.push(" local i=1"),r.push(" while [ $i -lt $cword ]; do"),r.push(' case "${words[$i]}" in'),i&&r.push(` ${i}) i=$((i + 1)) ;;`),r.push(" -*) ;;"),r.push(' *) cmd_path="${cmd_path:+$cmd_path }${words[$i]}" ;;'),r.push(" esac"),r.push(" i=$((i + 1))"),r.push(" done"),r.push(""),r.push(' case "$cmd_path" in');for(let s of t){let a=s.path===e.name?"":s.path.replace(`${e.name} `,""),l=s.options.filter(b=>b.choices&&b.long),d=s.options.map(b=>b.long).filter(Boolean).join(" "),c=s.subcommands.map(b=>b.name).join(" "),u=l.length>0,p=d.length>0,y=c.length>0;if(!u&&!p&&!y)continue;r.push(` "${a}")`);let g=s.options.filter(b=>b.takesValue&&!b.choices);if(u||g.length>0){r.push(' case "$prev" in');for(let b of l)r.push(` ${b.long}) COMPREPLY=($(compgen -W "${b.choices?.join(" ")}" -- "$cur")); return ;;`);if(g.length>0){let b=g.flatMap(_=>[_.long,_.short].filter(Boolean)).join("|");r.push(` ${b}) return ;;`)}r.push(" esac")}p&&(r.push(' if [[ "$cur" == -* ]]; then'),r.push(` COMPREPLY=($(compgen -W "${d}" -- "$cur")); return`),r.push(" fi")),y&&r.push(` COMPREPLY=($(compgen -W "${c}" -- "$cur"))`),r.push(" ;;")}return r.push(" esac"),r.push("}"),r.push(""),r.push(`complete -o default -F _${n}_completions ${n}`),r.join(`
|
|
299
|
+
`)}function Ua(e){let t=mr(e,"",[]),r=[],n=e.name;r.push(`#compdef ${n}`),r.push(`# zsh completion for ${n}`),r.push(`# Generated by: ${n} completion zsh`),r.push(""),r.push(`_${n}() {`),r.push(" local cur prev cmd_path"),r.push(' cur="${words[$CURRENT]}"'),r.push(' prev="${words[$CURRENT-1]}"'),r.push("");let i=xo(e).join("|");r.push(' cmd_path=""'),r.push(" for ((i=2; i < CURRENT; i++)); do"),r.push(' case "${words[$i]}" in'),i&&r.push(` ${i}) ((i++)) ;;`),r.push(" -*) ;;"),r.push(' *) cmd_path="${cmd_path:+$cmd_path }${words[$i]}" ;;'),r.push(" esac"),r.push(" done"),r.push(""),r.push(' case "$cmd_path" in');for(let s of t){let a=s.path===e.name?"":s.path.replace(`${e.name} `,""),l=s.options.filter(p=>p.choices&&p.long),d=s.options.filter(p=>p.long),c=s.subcommands.length>0;r.push(` "${a}")`);let u=s.options.filter(p=>p.takesValue&&!p.choices);if(l.length>0||u.length>0){r.push(' case "$prev" in');for(let p of l)r.push(` ${p.long}) compadd -- ${p.choices?.join(" ")}; return ;;`);if(u.length>0){let p=u.flatMap(y=>[y.long,y.short].filter(Boolean)).join("|");r.push(` ${p}) _files; return ;;`)}r.push(" esac")}if(d.length>0){r.push(' if [[ "$cur" == -* ]]; then');let p=d.map(y=>`"${y.long}:${Ma(y.description)}"`).join(" ");r.push(` local -a opts=(${p}); _describe 'option' opts; return`),r.push(" fi")}if(c){let p=s.subcommands.map(y=>`"${y.name}:${Ma(y.description)}"`).join(" ");r.push(` local -a cmds=(${p}); _describe 'command' cmds`)}else r.push(" _files");r.push(" ;;")}return r.push(" esac"),r.push("}"),r.push(""),r.push(`compdef _${n} ${n}`),r.join(`
|
|
300
|
+
`)}function Wa(e){let t=e.name,r=mr(e,"",[]),n=[];n.push(`# fish completion for ${t}`),n.push(`# Generated by: ${t} completion fish`),n.push("");let o=r[0];for(let i of o.subcommands)n.push(`complete -c ${t} -n "__fish_use_subcommand" -a "${i.name}" -d "${rn(i.description)}"`);for(let i of e.options)if(i.long){let s=i.long.replace("--",""),a=`complete -c ${t} -l "${s}"`;i.short&&(a+=` -s "${i.short.replace("-","")}"`),i.takesValue&&(a+=" -r"),i.choices&&(a+=` -a "${i.choices.join(" ")}"`),a+=` -d "${rn(i.description)}"`,n.push(a)}for(let i of r.slice(1)){let s=i.path.split(" ").slice(1),l=`__fish_seen_subcommand_from ${s[s.length-1]}`;for(let d of i.subcommands)n.push(`complete -c ${t} -n "${l}" -a "${d.name}" -d "${rn(d.description)}"`);for(let d of i.options)if(d.long){let c=d.long.replace("--",""),u=`complete -c ${t} -n "${l}" -l "${c}"`;d.short&&(u+=` -s "${d.short.replace("-","")}"`),d.takesValue&&(u+=" -r"),d.choices&&(u+=` -a "${d.choices.join(" ")}"`),u+=` -d "${rn(d.description)}"`,n.push(u)}}return n.join(`
|
|
301
|
+
`)}function Ma(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/:/g,"\\:")}function rn(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Va(e){let t=e.name,r=mr(e,"",[]),n=[];n.push(`# PowerShell completion for ${t}`),n.push(`# Generated by: ${t} completion powershell`),n.push(""),n.push(`Register-ArgumentCompleter -Native -CommandName ${t} -ScriptBlock {`),n.push(" param($wordToComplete, $commandAst, $cursorPosition)"),n.push(""),n.push(' $words = $commandAst.ToString().Substring(0, $cursorPosition) -split "\\s+"');let i=xo(e).map(s=>`"${s}"`).join(", ");n.push(" $cmdPath = @()"),n.push(` $valueFlags = @(${i})`),n.push(" for ($i = 1; $i -lt $words.Count - 1; $i++) {"),n.push(" if ($valueFlags -contains $words[$i]) { $i++; continue }"),n.push(' if ($words[$i] -notlike "-*") { $cmdPath += $words[$i] }'),n.push(" }"),n.push(' $joined = $cmdPath -join " "'),n.push(" $cur = $words[-1]"),n.push(' if ($words.Count -eq 1) { $cur = "" }'),n.push(""),n.push(' $prev = if ($words.Count -ge 2) { $words[-2] } else { "" }'),n.push(""),n.push(" switch ($joined) {");for(let s of r){let a=s.path===e.name?"":s.path.replace(`${e.name} `,""),l=s.options.filter(b=>b.choices&&b.long),d=s.options.map(b=>b.long).filter(Boolean).map(b=>`"${b}"`).join(", "),c=s.subcommands.map(b=>`"${b.name}"`).join(", "),u=l.length>0,p=d.length>0,y=c.length>0;if(!u&&!p&&!y)continue;n.push(` "${a}" {`);let g=s.options.filter(b=>b.takesValue&&!b.choices);if(u||g.length>0){n.push(" switch ($prev) {");for(let b of l){let _=b.choices?.map(k=>`"${k}"`).join(", ");n.push(` "${b.long}" { @(${_}) | Where-Object { $_ -like "$cur*" } | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_) }; return }`)}if(g.length>0){let b=g.flatMap(_=>[_.long,_.short].filter(Boolean)).map(_=>`"${_}"`).join(", ");n.push(` { $_ -in @(${b}) } { return }`)}n.push(" }")}p&&(n.push(' if ($cur -like "-*") {'),n.push(` @(${d}) | Where-Object { $_ -like "$cur*" } | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_) }; return`),n.push(" }")),y&&n.push(` @(${c}) | Where-Object { $_ -like "$cur*" } | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_) }`),n.push(" }")}return n.push(" }"),n.push("}"),n.join(`
|
|
302
|
+
`)}var Ka=new m("commands").description("Print the full command tree as JSON (for agents and tooling)").addHelpText("after",f({context:`Outputs every subcommand, option, and description from the CLI definition.
|
|
303
|
+
In machine mode (piped, CI, or --json), the tree is JSON you can feed to agents or scripts.`,examples:["resend commands","resend commands --json",'resend commands | jq ".subcommands[].name"']})).action((e,t)=>{let r=t.parent;if(!r)throw new Error("commands must be registered on the root program");let n=t.optsWithGlobals(),o=dr(r);N(o,{json:n.json})});var me=require("node:fs"),pt=require("node:os"),je=require("node:path");J();var Ya=["bash","zsh","fish","powershell"],nn="# resend shell completion";function mp(){let e=process.env.SHELL;if(e){let t=(0,je.basename)(e);if(t==="bash")return"bash";if(t==="zsh")return"zsh";if(t==="fish")return"fish"}if(process.env.PSModulePath)return"powershell"}async function pp(e){if(e)return e;let t=mp();if(t)return t;w()||(process.stderr.write(`error: could not detect shell. Pass the shell name explicitly.
|
|
304
|
+
`),process.exit(1));let r=await se({message:"Which shell do you use?",options:Ya.map(n=>({value:n,label:n}))});return $(r)&&S("Cancelled."),r}function za(e){switch(e){case"bash":return process.platform==="darwin"?(0,je.join)((0,pt.homedir)(),".bash_profile"):(0,je.join)((0,pt.homedir)(),".bashrc");case"zsh":return(0,je.join)((0,pt.homedir)(),".zshrc");case"powershell":return process.platform==="win32"?(0,je.join)((0,pt.homedir)(),"Documents","PowerShell","Microsoft.PowerShell_profile.ps1"):(0,je.join)((0,pt.homedir)(),".config","powershell","Microsoft.PowerShell_profile.ps1")}}function fp(e,t){switch(e){case"bash":return qa(t);case"zsh":return Ua(t);case"fish":return Wa(t);case"powershell":return Va(t)}}function Ja(e,t,r){(0,me.existsSync)(e)||(0,me.mkdirSync)(e,{recursive:!0});let n=(0,je.join)(e,t);return(0,me.writeFileSync)(n,`${r}
|
|
305
|
+
`),n}function hp(e,t){switch(e){case"zsh":{let r=(0,je.join)((0,pt.homedir)(),".zsh","completions"),n=Ja(r,"_resend",t);Q.success(`Completions written to ${n}`);let o=za(e),i=!0;if((0,me.existsSync)(o)&&(0,me.readFileSync)(o,"utf8").includes(r)&&(i=!1),i){let s=`${nn}
|
|
305
306
|
fpath=(${r} $fpath)
|
|
306
|
-
`,a=(0,me.existsSync)(
|
|
307
|
+
`,a=(0,me.existsSync)(o)?(0,me.readFileSync)(o,"utf8"):"",l=a.match(/^.*compinit.*$/m);if(l){let d=a.indexOf(l[0]),c=a.slice(0,d),u=a.slice(d);(0,me.writeFileSync)(o,`${c}${s}
|
|
307
308
|
${u}`)}else{let d=`
|
|
308
309
|
${s}autoload -Uz compinit && compinit
|
|
309
|
-
`;(0,me.writeFileSync)(
|
|
310
|
-
${
|
|
310
|
+
`;(0,me.writeFileSync)(o,d,{flag:"a"})}Q.info(`Added completion path to ${o}`)}Q.info("Restart your shell to activate completions.");return}case"fish":{let r=(0,je.join)((0,pt.homedir)(),".config","fish","completions"),n=Ja(r,"resend.fish",t);Q.success(`Completions written to ${n}`),Q.info("Completions will be available in new fish sessions.");return}case"bash":case"powershell":{let r=za(e),n=e==="powershell"?`
|
|
311
|
+
${nn}
|
|
311
312
|
resend completion powershell | Invoke-Expression
|
|
312
313
|
`:`
|
|
313
|
-
${
|
|
314
|
-
eval "$(resend completion ${
|
|
315
|
-
`;if((0,me.existsSync)(r)&&(0,me.readFileSync)(r,"utf8").includes(
|
|
314
|
+
${nn}
|
|
315
|
+
eval "$(resend completion ${e})"
|
|
316
|
+
`;if((0,me.existsSync)(r)&&(0,me.readFileSync)(r,"utf8").includes(nn)){Q.info(`Completions already installed in ${r}`);return}let o=(0,je.dirname)(r);(0,me.existsSync)(o)||(0,me.mkdirSync)(o,{recursive:!0}),(0,me.writeFileSync)(r,n,{flag:"a"}),Q.success(`Completions added to ${r}`),Q.info("Restart your shell to activate completions.");return}}}var Qa=new m("completion").description("Generate shell completion script").addArgument(new Jo("[shell]","Shell type").choices(Ya)).option("--install","Install completions into your shell profile").addHelpText("after",f({context:`Outputs a completion script for the given shell. The shell is auto-detected
|
|
316
317
|
from $SHELL when not specified.
|
|
317
318
|
|
|
318
319
|
Quick setup:
|
|
@@ -332,7 +333,7 @@ Manual setup:
|
|
|
332
333
|
PowerShell (add to $PROFILE):
|
|
333
334
|
resend completion powershell >> $PROFILE
|
|
334
335
|
|
|
335
|
-
Homebrew users: completions may be configured automatically by your formula.`,examples:["resend completion --install","resend completion bash","resend completion zsh",'eval "$(resend completion bash)"']})).action(async(t,
|
|
336
|
+
Homebrew users: completions may be configured automatically by your formula.`,examples:["resend completion --install","resend completion bash","resend completion zsh",'eval "$(resend completion bash)"']})).action(async(e,t,r)=>{let n=await pp(e),o=r.parent;if(!o)throw new Error("completion command must be registered under a parent");let i=dr(o),s=fp(n,i);if(t.install){hp(n,s);return}if(!e&&w()){r.help();return}console.log(s)});var Xa=new m("create").description("Create a new contact property definition").addOption(new Y("--key <key>","Property key name, used in broadcast template interpolation (e.g. company_name, department)")).addOption(new Y("--type <type>","Property data type: 'string' for text values, 'number' for numeric values").choices(["string","number"])).option("--fallback-value <value>","Default value used in broadcast templates when a contact has no value set for this property").addHelpText("after",f({context:`Property keys are used as identifiers in broadcast HTML template interpolation:
|
|
336
337
|
{{{PROPERTY_NAME|fallback}}} \u2014 triple-brace syntax substitutes the contact's value
|
|
337
338
|
{{{company_name|Unknown}}} \u2014 falls back to "Unknown" if the property is not set
|
|
338
339
|
|
|
@@ -340,20 +341,20 @@ Reserved keys (cannot be used): FIRST_NAME, LAST_NAME, EMAIL, UNSUBSCRIBE_URL
|
|
|
340
341
|
|
|
341
342
|
Non-interactive: --key and --type are required. --fallback-value is optional.
|
|
342
343
|
Warning: do not create properties with reserved key names \u2014 they will conflict with
|
|
343
|
-
built-in contact fields and may cause unexpected behavior in broadcasts.`,output:' {"object":"contact_property","id":"<id>"}',errorCodes:["auth_error","missing_key","missing_type","invalid_fallback_value","create_error"],examples:["resend contact-properties create --key company_name --type string",'resend contact-properties create --key company_name --type string --fallback-value "Unknown"',"resend contact-properties create --key employee_count --type number --fallback-value 0","resend contact-properties create --key department --type string --json"]})).action(async(t
|
|
344
|
+
built-in contact fields and may cause unexpected behavior in broadcasts.`,output:' {"object":"contact_property","id":"<id>"}',errorCodes:["auth_error","missing_key","missing_type","invalid_fallback_value","create_error"],examples:["resend contact-properties create --key company_name --type string",'resend contact-properties create --key company_name --type string --fallback-value "Unknown"',"resend contact-properties create --key employee_count --type number --fallback-value 0","resend contact-properties create --key department --type string --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=await U(e.key,{message:"Property key",placeholder:"e.g. company_name"},{message:"Missing --key flag.",code:"missing_key"},r),o=await Pt(e.type,{message:"Property data type",options:[{value:"string",label:"string \u2014 text values"},{value:"number",label:"number \u2014 numeric values"}]},{message:"Missing --type flag.",code:"missing_type"},r),i;if(e.fallbackValue!==void 0)if(o==="number"){let a=parseFloat(e.fallbackValue);Number.isNaN(a)&&h({message:"--fallback-value must be a valid number for number-type properties.",code:"invalid_fallback_value"},{json:r.json}),i=a}else i=e.fallbackValue;let s={key:n,type:o,...i!==void 0&&{fallbackValue:i}};await K({loading:"Creating contact property...",sdkCall:a=>a.contactProperties.create(s),onInteractive:a=>{console.log(`Contact property created: ${a.id}`)}},r)});var Bt={resource:"contact property",resourcePlural:"contact properties",fetchItems:(e,{limit:t,after:r})=>e.contactProperties.list({limit:t,...r&&{after:r}}),display:e=>({label:`${e.key} (${e.type})`,hint:e.id})};function Za(e){let t=e.map(r=>[r.key,r.type,r.fallbackValue!=null?String(r.fallbackValue):"",r.id,r.createdAt]);return F(["Key","Type","Fallback Value","ID","Created"],t,"(no contact properties)")}var el=new m("delete").alias("rm").description("Delete a contact property definition").argument("[id]","Contact property UUID").option("--yes","Skip the confirmation prompt (required in non-interactive mode)").addHelpText("after",f({context:`WARNING: Deleting a property definition removes that property value from ALL contacts
|
|
344
345
|
permanently. This cannot be undone, and any broadcasts that reference this property key
|
|
345
346
|
via {{{PROPERTY_NAME}}} will render an empty string or their inline fallback instead.
|
|
346
347
|
|
|
347
|
-
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"contact_property","id":"<id>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend contact-properties delete b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --yes","resend contact-properties delete b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --yes --json"]})).action(async(t,
|
|
348
|
-
ID: ${
|
|
349
|
-
This will remove this property from ALL contacts permanently.`,loading:"Deleting contact property...",object:"contact_property",successMsg:"Contact property deleted",sdkCall:
|
|
348
|
+
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"contact_property","id":"<id>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend contact-properties delete b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --yes","resend contact-properties delete b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --yes --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await le(e,Bt,n);await ne(o.id,!!t.yes,{confirmMessage:`Delete contact property "${o.label}"?
|
|
349
|
+
ID: ${o.id}
|
|
350
|
+
This will remove this property from ALL contacts permanently.`,loading:"Deleting contact property...",object:"contact_property",successMsg:"Contact property deleted",sdkCall:i=>i.contactProperties.remove(o.id)},n)});var tl=new m("get").description("Retrieve a contact property definition by ID").argument("[id]","Contact property UUID").addHelpText("after",f({output:` {
|
|
350
351
|
"object": "contact_property",
|
|
351
352
|
"id": "<uuid>",
|
|
352
353
|
"key": "company_name",
|
|
353
354
|
"type": "string",
|
|
354
355
|
"fallbackValue": null,
|
|
355
356
|
"createdAt": "2026-01-01T00:00:00.000Z"
|
|
356
|
-
}`,errorCodes:["auth_error","fetch_error"],examples:["resend contact-properties get b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d","resend contact-properties get b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --json"]})).action(async(t,
|
|
357
|
+
}`,errorCodes:["auth_error","fetch_error"],examples:["resend contact-properties get b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d","resend contact-properties get b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Bt,n);await G({loading:"Fetching contact property...",sdkCall:i=>i.contactProperties.get(o),onInteractive:i=>{console.log(`${i.key} (${i.type})`),console.log(`ID: ${i.id}`),console.log(`Created: ${i.createdAt}`),console.log(`Fallback value: ${i.fallbackValue??"(none)"}`)}},n)});var rl=new m("list").alias("ls").description("List all contact property definitions").option("--limit <n>","Maximum number of contact properties to return (1-100)","10").option("--after <cursor>","Return contact properties after this cursor (next page)").option("--before <cursor>","Return contact properties before this cursor (previous page)").addHelpText("after",f({context:`Pagination: use --after or --before with a contact property ID as the cursor.
|
|
357
358
|
Only one of --after or --before may be used at a time.
|
|
358
359
|
The response includes has_more: true when additional pages exist.`,output:` {
|
|
359
360
|
"object": "list",
|
|
@@ -361,14 +362,14 @@ This will remove this property from ALL contacts permanently.`,loading:"Deleting
|
|
|
361
362
|
"data": [
|
|
362
363
|
{ "id": "<uuid>", "key": "company_name", "type": "string", "fallbackValue": null, "createdAt": "..." }
|
|
363
364
|
]
|
|
364
|
-
}`,errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend contact-properties list","resend contact-properties list --limit 25 --json","resend contact-properties list --after b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --json"]})).action(async(t
|
|
365
|
+
}`,errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend contact-properties list","resend contact-properties list --limit 25 --json","resend contact-properties list --after b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching contact properties...",sdkCall:i=>i.contactProperties.list(o),onInteractive:i=>{console.log(Za(i.data)),M(i,"contact-properties list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var nl=new m("update").description("Update a contact property definition").argument("[id]","Contact property UUID").option("--fallback-value <value>","New fallback value used in broadcast templates when a contact has no value set for this property").option("--clear-fallback-value","Remove the fallback value (sets it to null)").addHelpText("after",f({context:`Note: the property key and type cannot be changed after creation. Only the fallback value
|
|
365
366
|
is updatable. Renaming a property would break existing broadcasts that reference the old key.
|
|
366
367
|
|
|
367
368
|
--fallback-value and --clear-fallback-value are mutually exclusive.
|
|
368
369
|
|
|
369
370
|
The fallback value is used in broadcast template interpolation when a contact has no value:
|
|
370
371
|
{{{company_name|Unknown}}} \u2014 inline fallback (takes precedence over the property's fallback)
|
|
371
|
-
{{{company_name}}} \u2014 uses the property's stored fallback value if set`,output:' {"object":"contact_property","id":"<id>"}',errorCodes:["auth_error","no_changes","conflicting_flags","fetch_error","invalid_fallback_value","update_error"],examples:['resend contact-properties update b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --fallback-value "Acme Corp"',"resend contact-properties update b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --fallback-value 42","resend contact-properties update b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --clear-fallback-value",'resend contact-properties update b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --fallback-value "Unknown" --json']})).action(async(t,
|
|
372
|
+
{{{company_name}}} \u2014 uses the property's stored fallback value if set`,output:' {"object":"contact_property","id":"<id>"}',errorCodes:["auth_error","no_changes","conflicting_flags","fetch_error","invalid_fallback_value","update_error"],examples:['resend contact-properties update b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --fallback-value "Acme Corp"',"resend contact-properties update b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --fallback-value 42","resend contact-properties update b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --clear-fallback-value",'resend contact-properties update b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --fallback-value "Unknown" --json']})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Bt,n);t.fallbackValue===void 0&&!t.clearFallbackValue&&h({message:"Provide at least one option to update: --fallback-value or --clear-fallback-value.",code:"no_changes"},{json:n.json}),t.fallbackValue!==void 0&&t.clearFallbackValue&&h({message:"--fallback-value and --clear-fallback-value are mutually exclusive.",code:"conflicting_flags"},{json:n.json});let i=t.clearFallbackValue?null:t.fallbackValue;if(typeof i=="string"){let s=await Z(n);if((await Ee("Fetching contact property...",()=>s.contactProperties.get(o),"fetch_error",n,{retryTransient:!0})).type==="number"){let l=parseFloat(i);Number.isNaN(l)&&h({message:"--fallback-value must be a valid number for number-type properties.",code:"invalid_fallback_value"},{json:n.json}),i=l}}await R({loading:"Updating contact property...",sdkCall:s=>s.contactProperties.update({id:o,...i!==void 0&&{fallbackValue:i}}),errorCode:"update_error",successMsg:`Contact property updated: ${o}`},n)});var ol=new m("contact-properties").description("Manage contact property definitions").addHelpText("after",f({context:`Contact properties define the schema for custom data stored on contacts.
|
|
372
373
|
Think of them as column definitions \u2014 you create a property definition (e.g. company_name)
|
|
373
374
|
and then set values for that property on individual contacts via "resend contacts update --properties".
|
|
374
375
|
|
|
@@ -383,9 +384,9 @@ Supported types:
|
|
|
383
384
|
number \u2014 numeric values (useful for counts, scores, thresholds)
|
|
384
385
|
|
|
385
386
|
Note: property keys and types are immutable after creation. Only the fallback value can
|
|
386
|
-
be updated. Deleting a property removes it from all contacts.`,examples:["resend contact-properties list","resend contact-properties create --key company_name --type string",'resend contact-properties create --key plan --type string --fallback-value "free"',"resend contact-properties create --key score --type number --fallback-value 0","resend contact-properties get b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d",'resend contact-properties update b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --fallback-value "Unknown"',"resend contact-properties update b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --clear-fallback-value","resend contact-properties delete b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --yes"]})).addCommand(
|
|
387
|
+
be updated. Deleting a property removes it from all contacts.`,examples:["resend contact-properties list","resend contact-properties create --key company_name --type string",'resend contact-properties create --key plan --type string --fallback-value "free"',"resend contact-properties create --key score --type number --fallback-value 0","resend contact-properties get b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d",'resend contact-properties update b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --fallback-value "Unknown"',"resend contact-properties update b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --clear-fallback-value","resend contact-properties delete b4a3c2d1-6e5f-8a7b-0c9d-2e1f4a3b6c5d --yes"]})).addCommand(Xa).addCommand(tl).addCommand(rl,{isDefault:!0}).addCommand(nl).addCommand(el);function on(e){let t=e.map(r=>[r.email,r.first_name??"",r.last_name??"",r.unsubscribed?"yes":"no",r.id]);return F(["Email","First Name","Last Name","Unsubscribed","ID"],t,"(no contacts)")}function il(e){let t=e.map(r=>[r.name,r.subscription,r.id,r.description??""]);return F(["Name","Subscription","ID","Description"],t,"(no topic subscriptions)")}var he={resource:"contact",resourcePlural:"contacts",fetchItems:(e,{limit:t,after:r})=>e.contacts.list({limit:t,...r&&{after:r}}),display:e=>({label:e.email,hint:e.id})};function Gt(e){return e.includes("@")?{email:e}:{id:e}}function Lt(e){return e.includes("@")?{email:e}:{contactId:e}}function sn(e,t){let r;try{r=JSON.parse(e)}catch{h({message:"Invalid --topics JSON. Expected an array of {id, subscription} objects.",code:"invalid_topics"},{json:t.json})}return Array.isArray(r)||h({message:"Invalid --topics JSON. Expected an array of {id, subscription} objects.",code:"invalid_topics"},{json:t.json}),r}function an(e,t){if(e)try{return JSON.parse(e)}catch{h({message:"Invalid --properties JSON.",code:"invalid_properties"},{json:t.json})}}var sl=new m("add-segment").description("Add a contact to a segment").argument("[contactId]","Contact UUID or email address").option("--segment-id <id>","Segment ID to add the contact to (required)").addHelpText("after",f({context:`The <contactId> argument accepts either a UUID or an email address.
|
|
387
388
|
|
|
388
|
-
Non-interactive: --segment-id is required.`,output:' {"id":"<segment-membership-id>"}',errorCodes:["auth_error","missing_segment_id","add_segment_error"],examples:["resend contacts add-segment e169aa45-1ecf-4183-9955-b1499d5701d3 --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend contacts add-segment steve.wozniak@gmail.com --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf --json"]})).action(async(t,
|
|
389
|
+
Non-interactive: --segment-id is required.`,output:' {"id":"<segment-membership-id>"}',errorCodes:["auth_error","missing_segment_id","add_segment_error"],examples:["resend contacts add-segment e169aa45-1ecf-4183-9955-b1499d5701d3 --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend contacts add-segment steve.wozniak@gmail.com --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,he,n),i=await C(t.segmentId,Ge,n),s={...Lt(o),segmentId:i};await R({loading:"Adding contact to segment...",sdkCall:a=>a.contacts.segments.add(s),errorCode:"add_segment_error",successMsg:`Contact added to segment: ${i}`},n)});J();var al=new m("create").description("Create a new contact").option("--email <email>","Contact email address (required)").option("--first-name <name>","First name").option("--last-name <name>","Last name").option("--unsubscribed","Globally unsubscribe the contact from all broadcasts").option("--properties <json>",`Custom properties as a JSON string (e.g. '{"company":"Acme"}')`).option("--segment-id <id...>","Segment ID to add the contact to on creation (repeatable: --segment-id abc --segment-id def)").addHelpText("after",f({context:`Non-interactive: --email is required. All other flags are optional.
|
|
389
390
|
|
|
390
391
|
Properties: pass a JSON object string to --properties (e.g. '{"plan":"pro","company":"Acme"}').
|
|
391
392
|
Properties are stored as custom contact attributes. To clear a property, set it to null.
|
|
@@ -393,11 +394,11 @@ Properties: pass a JSON object string to --properties (e.g. '{"plan":"pro","comp
|
|
|
393
394
|
|
|
394
395
|
Segments: use --segment-id once per segment to add the contact to one or more segments on creation.
|
|
395
396
|
|
|
396
|
-
Unsubscribed: setting --unsubscribed is a team-wide opt-out from all broadcasts, regardless of segments/topics.`,output:' {"object":"contact","id":"<id>"}',errorCodes:["auth_error","missing_email","invalid_properties","create_error"],examples:["resend contacts create --email steve.wozniak@gmail.com","resend contacts create --email steve.wozniak@gmail.com --first-name Steve --last-name Wozniak",`resend contacts create --email steve.wozniak@gmail.com --properties '{"company":"Acme","plan":"pro"}'`]})).action(async(t
|
|
397
|
+
Unsubscribed: setting --unsubscribed is a team-wide opt-out from all broadcasts, regardless of segments/topics.`,output:' {"object":"contact","id":"<id>"}',errorCodes:["auth_error","missing_email","invalid_properties","create_error"],examples:["resend contacts create --email steve.wozniak@gmail.com","resend contacts create --email steve.wozniak@gmail.com --first-name Steve --last-name Wozniak",`resend contacts create --email steve.wozniak@gmail.com --properties '{"company":"Acme","plan":"pro"}'`]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=await U(e.email,{message:"Email address",placeholder:"steve.wozniak@gmail.com"},{message:"Missing --email flag.",code:"missing_email"},r),o=e.firstName,i=e.lastName;if(w()&&!r.json&&!e.firstName){let l=await X({message:"First name (optional)"});$(l)&&S("Cancelled."),l&&(o=l)}if(w()&&!r.json&&!e.lastName){let l=await X({message:"Last name (optional)"});$(l)&&S("Cancelled."),l&&(i=l)}let s=an(e.properties,r),a=e.segmentId??[];await K({loading:"Creating contact...",sdkCall:l=>l.contacts.create({email:n,...o&&{firstName:o},...i&&{lastName:i},...e.unsubscribed&&{unsubscribed:!0},...s&&{properties:s},...a.length>0&&{segments:a.map(d=>({id:d}))}}),onInteractive:l=>{console.log(`Contact created: ${l.id}`)}},r)});var ll=new m("delete").alias("rm").description("Delete a contact").argument("[id]","Contact UUID or email address \u2014 both are accepted by the API").option("--yes","Skip the confirmation prompt (required in non-interactive mode)").addHelpText("after",f({context:`The <id> argument accepts either a UUID or an email address.
|
|
397
398
|
|
|
398
|
-
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"contact","id":"<id>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend contacts delete 520784e2-887d-4c25-b53c-4ad46ad38100 --yes","resend contacts delete acme@example.com --yes --json"]})).action(async(t,
|
|
399
|
-
ID: ${
|
|
400
|
-
This cannot be undone.`,loading:"Deleting contact...",object:"contact",successMsg:"Contact deleted",sdkCall:
|
|
399
|
+
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"contact","id":"<id>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend contacts delete 520784e2-887d-4c25-b53c-4ad46ad38100 --yes","resend contacts delete acme@example.com --yes --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await le(e,he,n);await ne(o.id,!!t.yes,{confirmMessage:`Delete contact "${o.label}"?
|
|
400
|
+
ID: ${o.id}
|
|
401
|
+
This cannot be undone.`,loading:"Deleting contact...",object:"contact",successMsg:"Contact deleted",sdkCall:i=>i.contacts.remove(o.id)},n)});var cl=new m("get").description("Retrieve a contact by ID or email address").argument("[id]","Contact UUID or email address \u2014 both are accepted by the API").addHelpText("after",f({output:` {
|
|
401
402
|
"object": "contact",
|
|
402
403
|
"id": "e169aa45-1ecf-4183-9955-b1499d5701d3",
|
|
403
404
|
"email": "steve.wozniak@gmail.com",
|
|
@@ -406,7 +407,7 @@ This cannot be undone.`,loading:"Deleting contact...",object:"contact",successMs
|
|
|
406
407
|
"created_at": "2026-01-01T00:00:00.000Z",
|
|
407
408
|
"unsubscribed": false,
|
|
408
409
|
"properties": {}
|
|
409
|
-
}`,errorCodes:["auth_error","fetch_error"],examples:["resend contacts get e169aa45-1ecf-4183-9955-b1499d5701d3","resend contacts get steve.wozniak@gmail.com","resend contacts get e169aa45-1ecf-4183-9955-b1499d5701d3 --json"]})).action(async(t,
|
|
410
|
+
}`,errorCodes:["auth_error","fetch_error"],examples:["resend contacts get e169aa45-1ecf-4183-9955-b1499d5701d3","resend contacts get steve.wozniak@gmail.com","resend contacts get e169aa45-1ecf-4183-9955-b1499d5701d3 --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,he,n);await G({loading:"Fetching contact...",sdkCall:i=>i.contacts.get(o),onInteractive:i=>{let s=[i.first_name,i.last_name].filter(Boolean).join(" ");console.log(`${i.email}${s?` (${s})`:""}`),console.log(`ID: ${i.id}`),console.log(`Created: ${i.created_at}`),console.log(`Unsubscribed: ${i.unsubscribed?"yes":"no"}`);let a=Object.entries(i.properties??{});if(a.length>0){console.log("Properties:");for(let[l,d]of a)console.log(` ${l}: ${d.value}`)}}},n)});var pl=require("node:fs"),fl=require("node:path");function ul(e){let t=e.map(r=>[r.status,String(r.counts.total),String(r.counts.created),String(r.counts.updated),String(r.counts.skipped),String(r.counts.failed),r.created_at,r.id]);return F(["Status","Total","Created","Updated","Skipped","Failed","Created At","ID"],t,"(no contact imports)")}var dl={resource:"contact import",resourcePlural:"contact imports",fetchItems:(e,{limit:t,after:r})=>e.contacts.imports.list({limit:t,...r&&{after:r}}),display:e=>({label:`${e.status} - ${e.counts.total} contacts`,hint:e.id})};function ml(e,t){if(!e)return;let r;try{r=JSON.parse(e)}catch{h({message:"Invalid --column-map JSON.",code:"invalid_column_map"},{json:t.json})}return(typeof r!="object"||r===null||Array.isArray(r))&&h({message:"Invalid --column-map JSON. Expected an object mapping contact fields to CSV column headers.",code:"invalid_column_map"},{json:t.json}),r}var hl=new m("create").description("Import contacts in bulk from a local CSV file").option("--file <path>","Path to the CSV file to import (required)").option("--column-map <json>",`Map CSV columns to contact fields as a JSON object (e.g. '{"email":"Email","firstName":"First Name"}')`).addOption(new Y("--on-conflict <strategy>","How to handle contacts that already exist").choices(["upsert","skip"])).option("--segment-id <id...>","Segment ID to add imported contacts to (repeatable: --segment-id abc --segment-id def)").option("--topics <json>","Topic subscriptions as a JSON array of {id, subscription} objects").addHelpText("after",f({context:`Non-interactive: --file is required. All other flags are optional.
|
|
410
411
|
|
|
411
412
|
The CSV file is uploaded as multipart form data (max 100MB).
|
|
412
413
|
|
|
@@ -422,32 +423,32 @@ On conflict: --on-conflict upsert (default) updates existing contacts; skip leav
|
|
|
422
423
|
|
|
423
424
|
Segments: use --segment-id once per segment to add imported contacts to one or more segments.
|
|
424
425
|
|
|
425
|
-
Topics: pass a JSON array of {id, subscription} objects (subscription is "opt_in" or "opt_out").`,output:' {"object":"contact_import","id":"<id>"}',errorCodes:["auth_error","missing_file","file_read_error","invalid_column_map","invalid_topics","create_error"],examples:["resend contacts imports create --file ./contacts.csv",`resend contacts imports create --file ./contacts.csv --column-map '{"email":"Email","firstName":"First Name"}'`,"resend contacts imports create --file ./contacts.csv --on-conflict skip --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf"]})).action(async(t
|
|
426
|
+
Topics: pass a JSON array of {id, subscription} objects (subscription is "opt_in" or "opt_out").`,output:' {"object":"contact_import","id":"<id>"}',errorCodes:["auth_error","missing_file","file_read_error","invalid_column_map","invalid_topics","create_error"],examples:["resend contacts imports create --file ./contacts.csv",`resend contacts imports create --file ./contacts.csv --column-map '{"email":"Email","firstName":"First Name"}'`,"resend contacts imports create --file ./contacts.csv --on-conflict skip --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=await U(e.file,{message:"Path to the CSV file",placeholder:"./contacts.csv"},{message:"Missing --file flag.",code:"missing_file"},r),o;try{o=(0,pl.readFileSync)(n)}catch{h({message:`Failed to read file: ${n}`,code:"file_read_error"},{json:r.json})}let i=new File([new Uint8Array(o)],(0,fl.basename)(n),{type:"text/csv"}),s=ml(e.columnMap,r),a=(e.segmentId??[]).map(d=>({id:d})),l=e.topics!==void 0?sn(e.topics,r):void 0;await K({loading:"Starting contact import...",sdkCall:d=>d.contacts.imports.create({file:i,...s&&{columnMap:s},...e.onConflict&&{onConflict:e.onConflict},...a.length>0&&{segments:a},...l&&{topics:l}}),onInteractive:d=>{console.log(`Contact import started: ${d.id}`)}},r)});var gl=new m("get").description("Retrieve a contact import by ID").argument("[id]","Contact import ID").addHelpText("after",f({output:` {
|
|
426
427
|
"object": "contact_import",
|
|
427
428
|
"id": "479e3145-dd38-476b-932c-529ceb705947",
|
|
428
429
|
"status": "completed",
|
|
429
430
|
"created_at": "2026-05-15T18:32:37.823Z",
|
|
430
431
|
"completed_at": "2026-05-15T18:33:42.916Z",
|
|
431
432
|
"counts": {"total":1200,"created":800,"updated":300,"skipped":75,"failed":25}
|
|
432
|
-
}`,errorCodes:["auth_error","fetch_error"],examples:["resend contacts imports get 479e3145-dd38-476b-932c-529ceb705947","resend contacts imports get 479e3145-dd38-476b-932c-529ceb705947 --json"]})).action(async(t,
|
|
433
|
+
}`,errorCodes:["auth_error","fetch_error"],examples:["resend contacts imports get 479e3145-dd38-476b-932c-529ceb705947","resend contacts imports get 479e3145-dd38-476b-932c-529ceb705947 --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,dl,n);await G({loading:"Fetching contact import...",sdkCall:i=>i.contacts.imports.get(o),onInteractive:i=>{console.log(`${i.id} - ${i.status}`),console.log(`Created: ${i.created_at}`),i.completed_at&&console.log(`Completed: ${i.completed_at}`);let s=i.counts;console.log(`Counts: ${s.total} total, ${s.created} created, ${s.updated} updated, ${s.skipped} skipped, ${s.failed} failed`)}},n)});var bl=new m("list").alias("ls").description("List contact imports").option("--limit <n>","Maximum number of contact imports to return (1-100)","10").option("--after <cursor>","Return imports after this cursor (next page)").option("--before <cursor>","Return imports before this cursor (previous page)").addOption(new Y("--status <status>","Filter by import status").choices(["queued","in_progress","completed","failed"])).addHelpText("after",f({context:`Pagination: use --after or --before with a contact import ID as the cursor.
|
|
433
434
|
Only one of --after or --before may be used at a time.
|
|
434
|
-
The response includes has_more: true when additional pages exist.`,output:' {"object":"list","has_more":false,"data":[{"object":"contact_import","id":"...","status":"completed","counts":{"total":1200,"created":800,"updated":300,"skipped":75,"failed":25}}]}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend contacts imports list","resend contacts imports list --status completed --json","resend contacts imports list --after 479e3145-dd38-476b-932c-529ceb705947 --json"]})).action(async(t
|
|
435
|
+
The response includes has_more: true when additional pages exist.`,output:' {"object":"list","has_more":false,"data":[{"object":"contact_import","id":"...","status":"completed","counts":{"total":1200,"created":800,"updated":300,"skipped":75,"failed":25}}]}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend contacts imports list","resend contacts imports list --status completed --json","resend contacts imports list --after 479e3145-dd38-476b-932c-529ceb705947 --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching contact imports...",sdkCall:i=>i.contacts.imports.list({...o,...e.status&&{status:e.status}}),onInteractive:i=>{console.log(ul(i.data)),M(i,"contacts imports list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var yl=new m("imports").description("Import contacts in bulk from a CSV file").addHelpText("after",f({context:`Import lifecycle:
|
|
435
436
|
1. resend contacts imports create --file ./contacts.csv (returns the import id)
|
|
436
437
|
2. resend contacts imports get <id> (poll until "completed")
|
|
437
438
|
3. resend contacts imports list (review past imports)
|
|
438
439
|
|
|
439
440
|
Imports run asynchronously. The create command returns immediately with an id while
|
|
440
|
-
the file is processed in the background.`,examples:["resend contacts imports create --file ./contacts.csv","resend contacts imports get 479e3145-dd38-476b-932c-529ceb705947","resend contacts imports list --status completed"]})).addCommand(
|
|
441
|
+
the file is processed in the background.`,examples:["resend contacts imports create --file ./contacts.csv","resend contacts imports get 479e3145-dd38-476b-932c-529ceb705947","resend contacts imports list --status completed"]})).addCommand(hl).addCommand(gl).addCommand(bl,{isDefault:!0});var vl=new m("list").alias("ls").description("List all contacts").option("--limit <n>","Maximum number of contacts to return (1-100)","10").option("--after <cursor>","Return contacts after this cursor (next page)").option("--before <cursor>","Return contacts before this cursor (previous page)").addHelpText("after",f({context:`Contacts are global \u2014 they are not scoped to audiences or segments since the 2025 migration.
|
|
441
442
|
|
|
442
443
|
Pagination: use --after or --before with a contact ID as the cursor.
|
|
443
444
|
Only one of --after or --before may be used at a time.
|
|
444
|
-
The response includes has_more: true when additional pages exist.`,output:' {"object":"list","data":[{"id":"...","email":"...","first_name":"...","last_name":"...","unsubscribed":false}],"has_more":false}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend contacts list","resend contacts list --limit 25 --json","resend contacts list --after 479e3145-dd38-4932-8c0c-e58b548c9e76 --json"]})).action(async(t
|
|
445
|
-
The <segmentId> argument must be a segment UUID (not an email).`,output:' {"id":"<segment-id>","deleted":true}',errorCodes:["auth_error","remove_segment_error"],examples:["resend contacts remove-segment e169aa45-1ecf-4183-9955-b1499d5701d3 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend contacts remove-segment steve.wozniak@gmail.com 78261eea-8f8b-4381-83c6-79fa7120f1cf --json"]})).action(async(t,
|
|
445
|
+
The response includes has_more: true when additional pages exist.`,output:' {"object":"list","data":[{"id":"...","email":"...","first_name":"...","last_name":"...","unsubscribed":false}],"has_more":false}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend contacts list","resend contacts list --limit 25 --json","resend contacts list --after 479e3145-dd38-4932-8c0c-e58b548c9e76 --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching contacts...",sdkCall:i=>i.contacts.list(o),onInteractive:i=>{console.log(on(i.data)),M(i,"contacts list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var Cl=new m("remove-segment").description("Remove a contact from a segment").argument("[contactId]","Contact UUID or email address").argument("[segmentId]","Segment ID to remove the contact from").addHelpText("after",f({context:`The <contactId> argument accepts either a UUID or an email address.
|
|
446
|
+
The <segmentId> argument must be a segment UUID (not an email).`,output:' {"id":"<segment-id>","deleted":true}',errorCodes:["auth_error","remove_segment_error"],examples:["resend contacts remove-segment e169aa45-1ecf-4183-9955-b1499d5701d3 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend contacts remove-segment steve.wozniak@gmail.com 78261eea-8f8b-4381-83c6-79fa7120f1cf --json"]})).action(async(e,t,r,n)=>{let o=n.optsWithGlobals(),i=await C(e,he,o),s=await C(t,Ge,o),a={...Lt(i),segmentId:s};await R({loading:"Removing contact from segment...",sdkCall:l=>l.contacts.segments.remove(a),errorCode:"remove_segment_error",successMsg:`Contact removed from segment: ${s}`},o)});var wl=new m("segments").description("List the segments a contact belongs to").argument("[id]","Contact UUID or email address").addHelpText("after",f({context:"The <id> argument accepts either a UUID or an email address.",output:' {"object":"list","data":[{"id":"<segment-uuid>","name":"Newsletter Subscribers","created_at":"..."}],"has_more":false}',errorCodes:["auth_error","list_error"],examples:["resend contacts segments e169aa45-1ecf-4183-9955-b1499d5701d3","resend contacts segments steve.wozniak@gmail.com","resend contacts segments e169aa45-1ecf-4183-9955-b1499d5701d3 --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,he,n);await O({loading:"Fetching segments...",sdkCall:i=>i.contacts.segments.list(Lt(o)),onInteractive:i=>console.log(tn(i.data))},n)});var _l=new m("topics").description("List a contact's topic subscriptions").argument("[id]","Contact UUID or email address").addHelpText("after",f({context:`The <id> argument accepts either a UUID or an email address.
|
|
446
447
|
|
|
447
448
|
Topics control which broadcast email types a contact receives.
|
|
448
449
|
subscription values: "opt_in" (receiving) | "opt_out" (not receiving)
|
|
449
450
|
|
|
450
|
-
Use "resend contacts update-topics <id>" to change subscription statuses.`,output:' {"object":"list","data":[{"id":"...","name":"Product Updates","description":"...","subscription":"opt_in"}],"has_more":false}',errorCodes:["auth_error","list_error"],examples:["resend contacts topics e169aa45-1ecf-4183-9955-b1499d5701d3","resend contacts topics steve.wozniak@gmail.com","resend contacts topics e169aa45-1ecf-4183-9955-b1499d5701d3 --json"]})).action(async(t,
|
|
451
|
+
Use "resend contacts update-topics <id>" to change subscription statuses.`,output:' {"object":"list","data":[{"id":"...","name":"Product Updates","description":"...","subscription":"opt_in"}],"has_more":false}',errorCodes:["auth_error","list_error"],examples:["resend contacts topics e169aa45-1ecf-4183-9955-b1499d5701d3","resend contacts topics steve.wozniak@gmail.com","resend contacts topics e169aa45-1ecf-4183-9955-b1499d5701d3 --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,he,n);await O({loading:"Fetching topic subscriptions...",sdkCall:i=>i.contacts.topics.list(Gt(o)),onInteractive:i=>console.log(il(i.data))},n)});var xl=new m("update").description("Update a contact's subscription status or custom properties").argument("[id]","Contact UUID or email address \u2014 both are accepted by the API").option("--unsubscribed","Globally unsubscribe the contact from all broadcasts").option("--no-unsubscribed","Re-subscribe the contact (clears the global unsubscribe flag)").option("--properties <json>",`JSON object of properties to merge (e.g. '{"company":"Acme"}'); set a key to null to clear it`).addHelpText("after",f({context:`The <id> argument accepts either a UUID or an email address.
|
|
451
452
|
|
|
452
453
|
Subscription toggle:
|
|
453
454
|
--unsubscribed Sets unsubscribed: true \u2014 contact will not receive any broadcasts.
|
|
@@ -455,7 +456,7 @@ Subscription toggle:
|
|
|
455
456
|
Omitting both flags leaves the subscription status unchanged.
|
|
456
457
|
|
|
457
458
|
Properties: --properties merges the given JSON object with existing properties.
|
|
458
|
-
Set a key to null to clear it: '{"company":null}'.`,output:' {"object":"contact","id":"<id>"}',errorCodes:["auth_error","invalid_properties","update_error"],examples:["resend contacts update e169aa45-1ecf-4183-9955-b1499d5701d3 --unsubscribed","resend contacts update acme@example.com --no-unsubscribed",`resend contacts update e169aa45-1ecf-4183-9955-b1499d5701d3 --properties '{"plan":"pro"}'`,"resend contacts update acme@example.com --unsubscribed --json"]})).action(async(t,
|
|
459
|
+
Set a key to null to clear it: '{"company":null}'.`,output:' {"object":"contact","id":"<id>"}',errorCodes:["auth_error","invalid_properties","update_error"],examples:["resend contacts update e169aa45-1ecf-4183-9955-b1499d5701d3 --unsubscribed","resend contacts update acme@example.com --no-unsubscribed",`resend contacts update e169aa45-1ecf-4183-9955-b1499d5701d3 --properties '{"plan":"pro"}'`,"resend contacts update acme@example.com --unsubscribed --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,he,n),i=an(t.properties,n),s={...Gt(o),...t.unsubscribed!==void 0&&{unsubscribed:t.unsubscribed},...i&&{properties:i}};await R({loading:"Updating contact...",sdkCall:a=>a.contacts.update(s),errorCode:"update_error",successMsg:`Contact updated: ${o}`},n)});J();var kl=new m("update-topics").description("Update a contact's topic subscription statuses").argument("[id]","Contact UUID or email address").option("--topics <json>",`JSON array of topic subscriptions (required) \u2014 e.g. '[{"id":"topic-uuid","subscription":"opt_in"}]'`).addHelpText("after",f({context:`The <id> argument accepts either a UUID or an email address.
|
|
459
460
|
|
|
460
461
|
Non-interactive: --topics is required.
|
|
461
462
|
|
|
@@ -464,7 +465,7 @@ Topics JSON format:
|
|
|
464
465
|
subscription values: "opt_in" | "opt_out"
|
|
465
466
|
|
|
466
467
|
This operation replaces all topic subscriptions for the specified topics.
|
|
467
|
-
Topics not included in the array are left unchanged.`,output:' {"id":"<contact-id>"}',errorCodes:["auth_error","missing_topics","invalid_topics","update_topics_error"],examples:[`resend contacts update-topics e169aa45-1ecf-4183-9955-b1499d5701d3 --topics '[{"id":"b6d24b8e-af0b-4c3c-be0c-359bbd97381e","subscription":"opt_in"}]'`,`resend contacts update-topics steve.wozniak@gmail.com --topics '[{"id":"b6d24b8e-af0b-4c3c-be0c-359bbd97381e","subscription":"opt_out"},{"id":"07d84122-7224-4881-9c31-1c048e204602","subscription":"opt_in"}]' --json`]})).action(async(t,
|
|
468
|
+
Topics not included in the array are left unchanged.`,output:' {"id":"<contact-id>"}',errorCodes:["auth_error","missing_topics","invalid_topics","update_topics_error"],examples:[`resend contacts update-topics e169aa45-1ecf-4183-9955-b1499d5701d3 --topics '[{"id":"b6d24b8e-af0b-4c3c-be0c-359bbd97381e","subscription":"opt_in"}]'`,`resend contacts update-topics steve.wozniak@gmail.com --topics '[{"id":"b6d24b8e-af0b-4c3c-be0c-359bbd97381e","subscription":"opt_out"},{"id":"07d84122-7224-4881-9c31-1c048e204602","subscription":"opt_in"}]' --json`]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,he,n),i=await Z(n),s=t.topics;if(!s){(!w()||n.json)&&h({message:"Missing --topics flag.",code:"missing_topics"},{json:n.json});let d=await X({message:`Topics JSON (e.g. '[{"id":"topic-uuid","subscription":"opt_in"}]')`,placeholder:'[{"id":"topic-uuid","subscription":"opt_in"}]',validate:c=>c?void 0:"Required"});$(d)&&S("Cancelled."),s=d}let a=sn(s,n),l=await Ee("Updating topic subscriptions...",()=>i.contacts.topics.update({...Gt(o),topics:a}),"update_topics_error",n);!n.json&&w()?console.log(`Topic subscriptions updated for contact: ${o}`):N(l,{json:n.json})});var Al=new m("contacts").description("Manage contacts").addHelpText("after",f({context:`Contacts are global entities (not audience-scoped since the 2025 migration).
|
|
468
469
|
Each contact is identified by a UUID or email address \u2014 both are accepted in all subcommands.
|
|
469
470
|
|
|
470
471
|
Properties:
|
|
@@ -481,7 +482,7 @@ Segments:
|
|
|
481
482
|
Manage membership with "resend contacts add-segment" and "resend contacts remove-segment".
|
|
482
483
|
|
|
483
484
|
Imports:
|
|
484
|
-
Bulk-import contacts from a CSV file with "resend contacts imports create --file <path>".`,examples:["resend contacts list","resend contacts create --email steve.wozniak@gmail.com --first-name Steve","resend contacts get e169aa45-1ecf-4183-9955-b1499d5701d3","resend contacts get steve.wozniak@gmail.com","resend contacts update acme@example.com --unsubscribed","resend contacts delete e169aa45-1ecf-4183-9955-b1499d5701d3 --yes","resend contacts segments steve.wozniak@gmail.com","resend contacts add-segment steve.wozniak@gmail.com --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend contacts remove-segment steve.wozniak@gmail.com 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend contacts topics steve.wozniak@gmail.com",`resend contacts update-topics steve.wozniak@gmail.com --topics '[{"id":"b6d24b8e-af0b-4c3c-be0c-359bbd97381e","subscription":"opt_in"}]'`,"resend contacts imports create --file ./contacts.csv"]})).addCommand(
|
|
485
|
+
Bulk-import contacts from a CSV file with "resend contacts imports create --file <path>".`,examples:["resend contacts list","resend contacts create --email steve.wozniak@gmail.com --first-name Steve","resend contacts get e169aa45-1ecf-4183-9955-b1499d5701d3","resend contacts get steve.wozniak@gmail.com","resend contacts update acme@example.com --unsubscribed","resend contacts delete e169aa45-1ecf-4183-9955-b1499d5701d3 --yes","resend contacts segments steve.wozniak@gmail.com","resend contacts add-segment steve.wozniak@gmail.com --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend contacts remove-segment steve.wozniak@gmail.com 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend contacts topics steve.wozniak@gmail.com",`resend contacts update-topics steve.wozniak@gmail.com --topics '[{"id":"b6d24b8e-af0b-4c3c-be0c-359bbd97381e","subscription":"opt_in"}]'`,"resend contacts imports create --file ./contacts.csv"]})).addCommand(al).addCommand(cl).addCommand(vl,{isDefault:!0}).addCommand(xl).addCommand(ll).addCommand(wl).addCommand(sl).addCommand(Cl).addCommand(_l).addCommand(kl).addCommand(yl);var $l=new m("docs").description("Open the Resend documentation in your browser").addHelpText("after",f({context:"Opens https://resend.com/docs in your default browser.",examples:["resend docs"]})).action(async(e,t)=>{let r=t.optsWithGlobals();await Se(de.documentation,r)});fe();ao();Lr();J();pr();yt();var $o="TimeoutError",Il=(e,t)=>{let r,n=new Promise((o,i)=>{r=setTimeout(()=>{let s=new Error(`Operation timed out after ${t}ms`);s.name=$o,i(s)},t)});return Promise.race([e,n]).finally(()=>{clearTimeout(r)})};var Cp=5e3;function wp(e){return e instanceof Error&&e.name===po}async function _p(){try{let e=await fetch(ko,{headers:{Accept:"application/vnd.github.v3+json"},signal:AbortSignal.timeout(5e3)});if(!e.ok)return{name:"CLI Version",status:"warn",message:`v${te} (could not check for updates)`};let t=await e.json();if(t.prerelease||t.draft)return{name:"CLI Version",status:"warn",message:`v${te} (could not check for updates)`};let r=t.tag_name?.replace(/^v/,"")??"unknown";return r===te?{name:"CLI Version",status:"pass",message:`v${te} (latest)`}:{name:"CLI Version",status:"warn",message:`v${te} (latest: v${r})`,detail:"Update available"}}catch{return{name:"CLI Version",status:"warn",message:`v${te} (could not check for updates)`}}}async function xp(e){let t;try{t=await _t(e,void 0,{refresh:!1})}catch(i){return{name:"API Key",status:"fail",message:q(i,"Authentication failed"),detail:"Run: resend login"}}if(!t)return{name:"API Key",status:"fail",message:"No API key found",detail:"Run: resend login"};let r=t.type==="api_key"?t.key:t.access_token,n=t.profile?`, profile: ${t.profile}`:"",o=t.type==="oauth_grant"?`${t.source} (oauth)`:t.source;return{name:"API Key",status:"pass",message:`${dt(r)} (source: ${o}${n})`}}async function kp(e){let t;try{t=await _t(e)}catch(o){let i=wp(o);return{name:"API Validation",status:i?"warn":"fail",message:q(o,"Authentication failed"),...i?{}:{detail:"Run: resend login"}}}if(!t)return{name:"API Validation",status:"fail",message:"Skipped \u2014 no API key"};let r=t.type==="api_key"?t.key:t.access_token,n=t.type==="api_key"?"API key":"credential";try{let o=new Dt(r),{data:i,error:s}=await Il(o.domains.list(),Cp);if(s){let c=s;return c.name==="restricted_api_key"?{name:"API Validation",status:"warn",message:`Sending-only ${n}`,detail:Tt}:c.name==="application_error"?{name:"API Validation",status:"warn",message:"Network error. Check your connection and try again"}:{name:"API Validation",status:"fail",message:`Invalid ${n}: ${s.message}`}}let a=i?.data??[],l=a.filter(c=>c.status==="verified"),d=a.filter(c=>c.status!=="verified");return a.length===0?{name:"Domains",status:"warn",message:"No domains configured",detail:"Add a domain at https://resend.com/domains"}:l.length===0?{name:"Domains",status:"warn",message:`${d.length} domain(s) pending verification`,detail:a.map(c=>`${c.name} (${c.status})`).join(", ")}:{name:"Domains",status:"pass",message:`${l.length} verified, ${d.length} pending`,detail:a.map(c=>`${c.name} (${c.status})`).join(", ")}}catch(o){return o instanceof Error&&o.name===$o?{name:"API Validation",status:"warn",message:"Request timed out"}:{name:"API Validation",status:"fail",message:q(o,`Failed to validate ${n}`)}}}var Pl=new m("doctor").description("Check CLI version, API key, and domain status").addHelpText("after",f({setup:!0,context:`Checks performed:
|
|
485
486
|
CLI Version Is the installed version up to date?
|
|
486
487
|
API Key Is a key present (--api-key, RESEND_API_KEY, or credentials file)?
|
|
487
488
|
Credential Storage Which backend is storing credentials (secure storage vs plaintext file)?
|
|
@@ -494,39 +495,39 @@ Imports:
|
|
|
494
495
|
]
|
|
495
496
|
}
|
|
496
497
|
status values: "pass" | "warn" | "fail"
|
|
497
|
-
Exit code 1 if any check has status "fail"`,examples:["resend doctor","resend doctor --json"]})).action(async(t
|
|
498
|
+
Exit code 1 if any check has status "fail"`,examples:["resend doctor","resend doctor --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=[],o=w()&&!r.json;o&&console.log(`
|
|
498
499
|
Resend Doctor
|
|
499
|
-
`);let o
|
|
500
|
-
Add this TXT record at your DNS provider:`),console.log(` ${
|
|
501
|
-
Then run \`resend domains claim verify ${
|
|
500
|
+
`);let i=o?re("Checking CLI version..."):null,s=await _p();n.push(s),s.status==="warn"?i?.warn(s.message):i?.stop(s.message),i=o?re("Checking API key..."):null;let a=await xp(r.apiKey);n.push(a),a.status==="fail"?i?.fail(a.message):i?.stop(a.message),i=o?re("Checking credential storage..."):null;let l=await Qe(),d=Ce(),c=l.isSecure,u={name:"Credential Storage",status:c?"pass":"warn",message:c?l.name:"plaintext file",...!c&&process.env.RESEND_CREDENTIAL_STORE!=="file"&&(d?.storage==="secure_storage"||process.env.RESEND_CREDENTIAL_STORE==="secure_storage")?{detail:"Secure backend unavailable despite secure storage preference \u2014 falling back to plaintext"}:{}};n.push(u),u.status==="warn"?i?.warn(u.message):i?.stop(u.message),i=o?re("Validating API key & domains..."):null;let p=await kp(r.apiKey);n.push(p),p.status==="fail"?i?.fail(p.message):p.status==="warn"?i?.warn(p.message):i?.stop(p.message);let y=n.some(g=>g.status==="fail");!r.json&&w()?console.log(""):N({ok:!y,checks:n},{json:r.json}),y&&process.exit(1)});var jl=new m("create").description("Start a claim for a domain another Resend account has verified").option("--name <domain>","Domain name to claim (e.g. example.com)").addOption(new Y("--region <region>","Sending region").choices(["us-east-1","eu-west-1","sa-east-1","ap-northeast-1"])).option("--tracking-subdomain <subdomain>","Subdomain for click and open tracking (e.g. track)").option("--custom-return-path <subdomain>","Subdomain for the Return-Path address (e.g. bounce)").option("--open-tracking","Enable open tracking").option("--no-open-tracking","Disable open tracking").option("--click-tracking","Enable click tracking").option("--no-click-tracking","Disable click tracking").addHelpText("after",f({context:"Non-interactive: --name is required (no prompts when stdin/stdout is not a TTY)",output:" domain_claim object with the placeholder domain_id and the TXT record to add to DNS.",errorCodes:["auth_error","missing_name","create_error"],examples:["resend domains claim create --name example.com","resend domains claim create --name example.com --region eu-west-1","resend domains claim create --name example.com --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=await U(e.name,{message:"Domain name to claim",placeholder:"example.com"},{message:"Missing --name flag.",code:"missing_name"},r);await K({loading:"Starting domain claim...",sdkCall:o=>o.domains.claims.create({name:n,...e.region&&{region:e.region},...e.customReturnPath!==void 0&&{customReturnPath:e.customReturnPath},...e.openTracking!==void 0&&{openTracking:e.openTracking},...e.clickTracking!==void 0&&{clickTracking:e.clickTracking},...e.trackingSubdomain!==void 0&&{trackingSubdomain:e.trackingSubdomain}}),onInteractive:o=>{console.log(`Claim started for ${o.name} (claim id: ${o.id}, domain id: ${o.domain_id})`),console.log(`Status: ${o.status}`),console.log(`
|
|
501
|
+
Add this TXT record at your DNS provider:`),console.log(` ${o.record.name} TXT ${o.record.value}`),console.log(`
|
|
502
|
+
Then run \`resend domains claim verify ${o.domain_id}\`.`)}},r)});var Rl=new m("get").description("Retrieve the latest claim for a domain").argument("[id]","Domain ID (the placeholder domain created by the claim)").addHelpText("after",f({output:` domain_claim object: status, domain_id, the TXT record, blocked_reason, expires_at.
|
|
502
503
|
|
|
503
|
-
Claim status values: pending | verified | completed | blocked | expired | superseded | canceled | failed`,errorCodes:["auth_error","fetch_error","not_found"],examples:["resend domains claim get 4dd369bc-aa82-4ff3-97de-514ae3000ee0","resend domains claim get 4dd369bc-aa82-4ff3-97de-514ae3000ee0 --json"]})).action(async(t,
|
|
504
|
-
TXT record:`),console.log(` ${
|
|
504
|
+
Claim status values: pending | verified | completed | blocked | expired | superseded | canceled | failed`,errorCodes:["auth_error","fetch_error","not_found"],examples:["resend domains claim get 4dd369bc-aa82-4ff3-97de-514ae3000ee0","resend domains claim get 4dd369bc-aa82-4ff3-97de-514ae3000ee0 --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,De,n);await G({loading:"Fetching domain claim...",sdkCall:i=>i.domains.claims.get(o),onInteractive:i=>{console.log(`${i.name} \u2014 ${i.status}`),console.log(`Claim ID: ${i.id}`),console.log(`Domain ID: ${i.domain_id}`),i.blocked_reason&&console.log(`Blocked: ${i.blocked_reason}`),console.log(`Expires: ${i.expires_at}`),console.log(`
|
|
505
|
+
TXT record:`),console.log(` ${i.record.name} TXT ${i.record.value}`)}},n)});var Fl=new m("verify").description("Trigger DNS verification and transfer for a domain claim").argument("[id]","Domain ID (the placeholder domain created by the claim)").addHelpText("after",f({output:" domain_claim object (status stays pending while verification runs async).",errorCodes:["auth_error","verify_error","not_found"],examples:["resend domains claim verify 4dd369bc-aa82-4ff3-97de-514ae3000ee0"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,De,n);await R({loading:"Verifying domain claim...",sdkCall:i=>i.domains.claims.verify(o),errorCode:"verify_error",successMsg:`Domain claim verification started. Check status with resend domains claim get ${o}.`},n)});var Nl=new m("claim").description("Claim a domain already verified by another Resend account").addHelpText("after",f({context:`Claim lifecycle:
|
|
505
506
|
1. resend domains claim create --name example.com (returns the TXT record)
|
|
506
507
|
2. Configure the TXT record at your DNS provider
|
|
507
508
|
3. resend domains claim verify <domain-id> (trigger verification + transfer)
|
|
508
509
|
4. resend domains claim get <domain-id> (poll until "completed")
|
|
509
510
|
5. The transferred domain has NEW DKIM records \u2014 update DNS, then run:
|
|
510
|
-
resend domains verify <domain-id>`,examples:["resend domains claim create --name example.com","resend domains claim get 4dd369bc-aa82-4ff3-97de-514ae3000ee0","resend domains claim verify 4dd369bc-aa82-4ff3-97de-514ae3000ee0"]})).addCommand(
|
|
511
|
-
DNS Records to configure:`),console.log(
|
|
512
|
-
Run \`resend domains verify ${
|
|
513
|
-
ID: ${
|
|
514
|
-
This cannot be undone.`,loading:"Deleting domain...",object:"domain",successMsg:"Domain deleted",sdkCall:
|
|
515
|
-
|
|
516
|
-
Domain status values: not_started | pending | verified | failed | partially_verified | partially_failed`,errorCodes:["auth_error","fetch_error"],examples:["resend domains get 4dd369bc-aa82-4ff3-97de-514ae3000ee0","resend domains get 4dd369bc-aa82-4ff3-97de-514ae3000ee0 --json"]})).action(async(t,
|
|
517
|
-
DNS Records:`),console.log(
|
|
518
|
-
The list response does not include DNS records \u2014 use "resend domains get <id>" for that.`,errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend domains list","resend domains list --limit 25 --json","resend domains list --after <cursor> --json"]})).action(async(t
|
|
519
|
-
Poll the status with: resend domains get <id>`,output:' {"object":"domain","id":"<id>"}',errorCodes:["auth_error","verify_error"],examples:["resend domains verify 4dd369bc-aa82-4ff3-97de-514ae3000ee0","resend domains verify 4dd369bc-aa82-4ff3-97de-514ae3000ee0 --json"]})).action(async(t,
|
|
511
|
+
resend domains verify <domain-id>`,examples:["resend domains claim create --name example.com","resend domains claim get 4dd369bc-aa82-4ff3-97de-514ae3000ee0","resend domains claim verify 4dd369bc-aa82-4ff3-97de-514ae3000ee0"]})).addCommand(jl).addCommand(Rl).addCommand(Fl);var Bl=new m("create").description("Create a new domain and receive DNS records to configure").option("--name <domain>","Domain name (e.g. example.com)").addOption(new Y("--region <region>","Sending region").choices(["us-east-1","eu-west-1","sa-east-1","ap-northeast-1"])).addOption(new Y("--tls <mode>","TLS mode (default: opportunistic)").choices(["opportunistic","enforced"])).option("--tracking-subdomain <subdomain>","Subdomain for click and open tracking (e.g. track)").option("--sending","Enable sending capability (default: enabled)").option("--receiving","Enable receiving capability (default: disabled)").addHelpText("after",f({context:"Non-interactive: --name is required (no prompts when stdin/stdout is not a TTY)",output:" Full domain object with DNS records array to configure in your DNS provider.",errorCodes:["auth_error","missing_name","create_error"],examples:["resend domains create --name example.com","resend domains create --name example.com --region eu-west-1 --tls enforced","resend domains create --name example.com --tracking-subdomain track","resend domains create --name example.com --receiving --json","resend domains create --name example.com --sending --receiving --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=await U(e.name,{message:"Domain name",placeholder:"example.com"},{message:"Missing --name flag.",code:"missing_name"},r);await K({loading:"Creating domain...",sdkCall:o=>o.domains.create({name:n,...e.region&&{region:e.region},...e.tls&&{tls:e.tls},...e.trackingSubdomain&&{trackingSubdomain:e.trackingSubdomain},...(e.sending||e.receiving)&&{capabilities:{...e.sending&&{sending:"enabled"},...e.receiving&&{receiving:"enabled"}}}}),onInteractive:o=>{console.log(`Domain created: ${o.name} (id: ${o.id})`),console.log(`
|
|
512
|
+
DNS Records to configure:`),console.log(zr(o.records,o.name)),console.log(`
|
|
513
|
+
Run \`resend domains verify ${o.id}\` after configuring DNS.`)}},r)});var Gl=new m("delete").alias("rm").description("Delete a domain").argument("[id]","Domain ID").option("--yes","Skip confirmation prompt").addHelpText("after",f({context:"Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.",output:' {"object":"domain","id":"<id>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend domains delete 4dd369bc-aa82-4ff3-97de-514ae3000ee0 --yes","resend domains delete 4dd369bc-aa82-4ff3-97de-514ae3000ee0 --yes --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await le(e,De,n);await ne(o.id,!!t.yes,{confirmMessage:`Delete domain "${o.label}"?
|
|
514
|
+
ID: ${o.id}
|
|
515
|
+
This cannot be undone.`,loading:"Deleting domain...",object:"domain",successMsg:"Domain deleted",sdkCall:i=>i.domains.remove(o.id)},n)});var Ll=new m("get").description("Retrieve a domain with its DNS records and current verification status").argument("[id]","Domain ID").addHelpText("after",f({output:` Full domain object including records array and current status.
|
|
516
|
+
|
|
517
|
+
Domain status values: not_started | pending | verified | failed | partially_verified | partially_failed`,errorCodes:["auth_error","fetch_error"],examples:["resend domains get 4dd369bc-aa82-4ff3-97de-514ae3000ee0","resend domains get 4dd369bc-aa82-4ff3-97de-514ae3000ee0 --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,De,n);await G({loading:"Fetching domain...",sdkCall:i=>i.domains.get(o),onInteractive:i=>{console.log(`${i.name} \u2014 ${Ks(i.status)}`),console.log(`ID: ${i.id}`),console.log(`Region: ${i.region}`),console.log(`Created: ${i.created_at}`),i.open_tracking!==void 0&&console.log(`Open tracking: ${i.open_tracking?"enabled":"disabled"}`),i.click_tracking!==void 0&&console.log(`Click tracking: ${i.click_tracking?"enabled":"disabled"}`),i.tracking_subdomain&&console.log(`Tracking subdomain: ${i.tracking_subdomain}`),i.records.length>0&&(console.log(`
|
|
518
|
+
DNS Records:`),console.log(zr(i.records,i.name)))}},n)});var Hl=new m("list").alias("ls").description("List all domains").option("--limit <n>","Maximum number of domains to return (1-100)","10").option("--after <cursor>","Return domains after this cursor (next page)").option("--before <cursor>","Return domains before this cursor (previous page)").addHelpText("after",f({output:` {"object":"list","data":[...],"has_more":true}
|
|
519
|
+
The list response does not include DNS records \u2014 use "resend domains get <id>" for that.`,errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend domains list","resend domains list --limit 25 --json","resend domains list --after <cursor> --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching domains...",sdkCall:i=>i.domains.list(o),onInteractive:i=>{console.log(Vs(i.data)),M(i,"domains list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var Ml=new m("update").description("Update domain settings: TLS mode, tracking, and tracking subdomain").argument("[id]","Domain ID").addOption(new Y("--tls <mode>","TLS mode").choices(["opportunistic","enforced"])).option("--open-tracking","Enable open tracking").option("--no-open-tracking","Disable open tracking").option("--click-tracking","Enable click tracking").option("--no-click-tracking","Disable click tracking").option("--tracking-subdomain <subdomain>","Subdomain for click and open tracking (e.g. track)").addHelpText("after",f({output:' {"object":"domain","id":"<id>"}',errorCodes:["auth_error","no_changes","update_error"],examples:["resend domains update <id> --tls enforced","resend domains update <id> --open-tracking --click-tracking","resend domains update <id> --tracking-subdomain track","resend domains update <id> --no-open-tracking --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,De,n),{tls:i,openTracking:s,clickTracking:a,trackingSubdomain:l}=t;!i&&s===void 0&&a===void 0&&!l&&h({message:"Provide at least one option to update: --tls, --open-tracking, --click-tracking, or --tracking-subdomain.",code:"no_changes"},{json:n.json});let d={id:o};i&&(d.tls=i),s!==void 0&&(d.openTracking=s),a!==void 0&&(d.clickTracking=a),l&&(d.trackingSubdomain=l),await R({loading:"Updating domain...",sdkCall:c=>c.domains.update(d),errorCode:"update_error",successMsg:`Domain updated: ${o}`},n)});var ql=new m("verify").description("Trigger async DNS verification for a domain").argument("[id]","Domain ID").addHelpText("after",f({context:`Verification is async \u2014 the domain enters "pending" status while DNS records are checked.
|
|
520
|
+
Poll the status with: resend domains get <id>`,output:' {"object":"domain","id":"<id>"}',errorCodes:["auth_error","verify_error"],examples:["resend domains verify 4dd369bc-aa82-4ff3-97de-514ae3000ee0","resend domains verify 4dd369bc-aa82-4ff3-97de-514ae3000ee0 --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,De,n);await R({loading:"Verifying domain...",sdkCall:i=>i.domains.verify(o),errorCode:"verify_error",successMsg:`Domain verification started. Check status with resend domains get ${o}.`},n)});var Ul=new m("domains").description("Manage verified sending and receiving domains").addHelpText("after",f({context:`Domain lifecycle:
|
|
520
521
|
1. resend domains create --name example.com (get DNS records)
|
|
521
522
|
2. Configure DNS records at your DNS provider
|
|
522
523
|
3. resend domains verify <id> (trigger verification)
|
|
523
|
-
4. resend domains get <id> (poll until "verified")`,examples:["resend domains list","resend domains create --name example.com --region us-east-1","resend domains verify 4dd369bc-aa82-4ff3-97de-514ae3000ee0","resend domains get 4dd369bc-aa82-4ff3-97de-514ae3000ee0","resend domains update <id> --tls enforced --open-tracking","resend domains delete <id> --yes","resend domains claim create --name example.com"]})).addCommand(
|
|
524
|
-
resend emails attachment <emailId> <attachmentId> --json | jq -r .download_url | xargs curl -O`,output:' {"object":"attachment","id":"<uuid>","filename":"invoice.pdf","size":51200,"content_type":"application/pdf","content_disposition":"attachment","content_id":null,"download_url":"<signed-url>","expires_at":"<iso-date>"}',errorCodes:["auth_error","fetch_error"],examples:["resend emails attachment <email-id> <attachment-id>","resend emails attachment <email-id> <attachment-id> --json"]})).action(async(t,
|
|
524
|
+
4. resend domains get <id> (poll until "verified")`,examples:["resend domains list","resend domains create --name example.com --region us-east-1","resend domains verify 4dd369bc-aa82-4ff3-97de-514ae3000ee0","resend domains get 4dd369bc-aa82-4ff3-97de-514ae3000ee0","resend domains update <id> --tls enforced --open-tracking","resend domains delete <id> --yes","resend domains claim create --name example.com"]})).addCommand(Bl).addCommand(ql).addCommand(Ll).addCommand(Hl,{isDefault:!0}).addCommand(Ml).addCommand(Gl).addCommand(Nl);var ze={resource:"email",resourcePlural:"emails",fetchItems:(e,{limit:t,after:r})=>e.emails.list({limit:t,...r&&{after:r}}),display:e=>({label:e.subject||"(no subject)",hint:e.id})};function Wl(e){return{resource:"attachment",resourcePlural:"attachments",fetchItems:(t,{limit:r,after:n})=>t.emails.attachments.list({emailId:e,limit:r,...n&&{after:n}}),display:t=>({label:t.filename??"(unnamed)",hint:t.id})}}function un(e){let t=e.map(r=>[r.filename??"(unnamed)",r.content_type,String(r.size),r.id]);return F(["Filename","Content-Type","Size (bytes)","ID"],t,"(no attachments)")}var Vl=new m("attachment").description("Retrieve a single attachment from a sent (outbound) email").argument("[emailId]","Email UUID").argument("[attachmentId]","Attachment UUID").addHelpText("after",f({context:`The download_url is a signed URL that expires in ~1 hour. Download the file directly:
|
|
525
|
+
resend emails attachment <emailId> <attachmentId> --json | jq -r .download_url | xargs curl -O`,output:' {"object":"attachment","id":"<uuid>","filename":"invoice.pdf","size":51200,"content_type":"application/pdf","content_disposition":"attachment","content_id":null,"download_url":"<signed-url>","expires_at":"<iso-date>"}',errorCodes:["auth_error","fetch_error"],examples:["resend emails attachment <email-id> <attachment-id>","resend emails attachment <email-id> <attachment-id> --json"]})).action(async(e,t,r,n)=>{let o=n.optsWithGlobals(),i=await C(e,ze,o),s=await C(t,Wl(i),o);await G({loading:"Fetching attachment...",sdkCall:a=>a.emails.attachments.get({emailId:i,id:s}),onInteractive:a=>{console.log(`${a.filename??"(unnamed)"}`),console.log(`ID: ${a.id}`),console.log(`Content-Type: ${a.content_type}`),console.log(`Size: ${a.size} bytes`),console.log(`Disposition: ${a.content_disposition}`),console.log(`Download URL: ${a.download_url}`),console.log(`Expires: ${a.expires_at}`)}},o)});var Kl=new m("attachments").description("List attachments on a sent (outbound) email").argument("[emailId]","Email UUID").option("--limit <n>","Maximum number of attachments to return (1-100)","10").option("--after <cursor>","Return attachments after this cursor (next page)").option("--before <cursor>","Return attachments before this cursor (previous page)").addHelpText("after",f({context:`Each attachment has a download_url (signed, expires ~1 hour).
|
|
525
526
|
Use the attachment sub-command to retrieve a single attachment with its download URL:
|
|
526
527
|
resend emails attachment <emailId> <attachmentId>
|
|
527
528
|
|
|
528
529
|
content_disposition: "inline" means the attachment is embedded in the HTML body (e.g. an image).
|
|
529
|
-
content_disposition: "attachment" means it is a standalone file download.`,output:' {"object":"list","has_more":false,"data":[{"id":"<uuid>","filename":"invoice.pdf","size":51200,"content_type":"application/pdf","content_disposition":"attachment","content_id":null,"download_url":"<url>","expires_at":"<iso-date>"}]}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend emails attachments <email-id>","resend emails attachments <email-id> --json","resend emails attachments <email-id> --limit 25 --json"]})).action(async(t,
|
|
530
|
+
content_disposition: "attachment" means it is a standalone file download.`,output:' {"object":"list","has_more":false,"data":[{"id":"<uuid>","filename":"invoice.pdf","size":51200,"content_type":"application/pdf","content_disposition":"attachment","content_id":null,"download_url":"<url>","expires_at":"<iso-date>"}]}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend emails attachments <email-id>","resend emails attachments <email-id> --json","resend emails attachments <email-id> --limit 25 --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,ze,n),i=L(t.limit,n),s=H(i,t.after,t.before,n);await O({loading:"Fetching attachments...",sdkCall:a=>a.emails.attachments.list({emailId:o,...s}),onInteractive:a=>{console.log(un(a.data)),M(a,`emails attachments ${o}`,{limit:i,before:t.before,apiKey:n.apiKey,profile:n.profile})}},n)});J();var zl=new m("batch").description("Send up to 100 emails in a single API request from a JSON file").option("--file <path>",'Path to a JSON file containing an array of email objects (use "-" for stdin; required in non-interactive mode)').option("--react-email <path>","Path to a React Email template (.tsx) \u2014 rendered HTML is set on every email in the batch").option("--idempotency-key <key>","Deduplicate this batch request using this key").addOption(new Y("--batch-validation <mode>","Validation mode: strict (default, fail all on error) or permissive (partial success)").choices(["strict","permissive"])).addHelpText("after",f({context:`Non-interactive: --file
|
|
530
531
|
Limit: 100 emails per request (API hard limit \u2014 warned if exceeded)
|
|
531
532
|
Unsupported per-email fields: attachments, scheduled_at
|
|
532
533
|
|
|
@@ -534,53 +535,53 @@ File format (--file path):
|
|
|
534
535
|
[
|
|
535
536
|
{"from":"onboarding@resend.com","to":["delivered@resend.com"],"subject":"Hello","text":"Hi"},
|
|
536
537
|
{"from":"onboarding@resend.com","to":["delivered@resend.com"],"subject":"Hello","html":"<b>Hi</b>"}
|
|
537
|
-
]`,output:' [{"id":"<email-id>"},{"id":"<email-id>"}]',errorCodes:["auth_error","missing_file","file_read_error","stdin_read_error","invalid_json","invalid_format","react_email_build_error","react_email_render_error","batch_error"],examples:["resend emails batch --file ./emails.json","resend emails batch --file ./emails.json --batch-validation permissive",`echo '[{"from":"onboarding@resend.com","to":["delivered@resend.com"],"subject":"Hi","text":"Hello"}]' | resend emails batch --file -`]})).action(async(t
|
|
538
|
-
${c.length} email${c.length===1?"":"s"} failed:`);for(let u of c)console.warn(` [${u.index}] ${u.message}`)}}else N(c&&c.length>0?{data:d,errors:c}:d,{json:r.json})});var
|
|
539
|
-
resend emails receiving attachment <emailId> <attachmentId> --json | jq -r .download_url | xargs curl -O`,output:' {"object":"attachment","id":"<uuid>","filename":"invoice.pdf","size":51200,"content_type":"application/pdf","content_disposition":"attachment","content_id":null,"download_url":"<signed-url>","expires_at":"<iso-date>"}',errorCodes:["auth_error","fetch_error"],examples:["resend emails receiving attachment <email-id> <attachment-id>","resend emails receiving attachment <email-id> <attachment-id> --json"]})).action(async(t,
|
|
538
|
+
]`,output:' [{"id":"<email-id>"},{"id":"<email-id>"}]',errorCodes:["auth_error","missing_file","file_read_error","stdin_read_error","invalid_json","invalid_format","react_email_build_error","react_email_render_error","batch_error"],examples:["resend emails batch --file ./emails.json","resend emails batch --file ./emails.json --batch-validation permissive",`echo '[{"from":"onboarding@resend.com","to":["delivered@resend.com"],"subject":"Hi","text":"Hello"}]' | resend emails batch --file -`]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=await Z(r,{permission:"sending_access"}),o=await U(e.file,{message:"Path to JSON file",placeholder:"./emails.json"},{message:"Missing --file flag. Provide a JSON file with an array of email objects.",code:"missing_file"},r),i=ce(o,r),s;try{s=JSON.parse(i)}catch{h({message:"File content is not valid JSON.",code:"invalid_json"},{json:r.json})}Array.isArray(s)||h({message:"File content must be a JSON array of email objects.",code:"invalid_format"},{json:r.json});let a=s;if(a.length>100&&console.warn(`Warning: ${a.length} emails exceeds the 100-email limit. The API may reject this request.`),e.reactEmail){let u=await Be(e.reactEmail,r);for(let p of a)p.html=u}for(let u=0;u<a.length;u++){let p=a[u];(p===null||typeof p!="object"||Array.isArray(p))&&h({message:`Email at index ${u} must be a JSON object.`,code:"invalid_format"},{json:r.json}),"attachments"in p&&h({message:`Email at index ${u} contains "attachments", which is not supported in batch sends.`,code:"batch_error"},{json:r.json}),"scheduled_at"in p&&h({message:`Email at index ${u} contains "scheduled_at", which is not supported in batch sends.`,code:"batch_error"},{json:r.json})}let l=await Ee("Sending batch...",()=>{let u={...e.idempotencyKey&&{idempotencyKey:e.idempotencyKey},...e.batchValidation&&{batchValidation:e.batchValidation}};return n.batch.send(a,Object.keys(u).length>0?u:void 0)},"batch_error",r),d=l.data,c=l.errors;if(!r.json&&w()){console.log(`Sent ${d.length} email${d.length===1?"":"s"}`);for(let u of d)console.log(` ${u.id}`);if(c&&c.length>0){console.warn(`
|
|
539
|
+
${c.length} email${c.length===1?"":"s"} failed:`);for(let u of c)console.warn(` [${u.index}] ${u.message}`)}}else N(c&&c.length>0?{data:d,errors:c}:d,{json:r.json})});var Jl=new m("cancel").description("Cancel a scheduled email").argument("[id]","Email ID").addHelpText("after",f({output:' {"object":"email","id":"<email-id>"}',errorCodes:["auth_error","cancel_error"],examples:["resend emails cancel <email-id>","resend emails cancel <email-id> --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,ze,n);await R({loading:"Cancelling email...",sdkCall:i=>i.emails.cancel(o),errorCode:"cancel_error",successMsg:`Email cancelled: ${o}`},n)});var Yl=new m("get").description("Retrieve a sent email by ID").argument("[id]","Email ID").addHelpText("after",f({output:' {"object":"email","id":"<uuid>","from":"onboarding@resend.com","to":["delivered@resend.com"],"subject":"Hello","html":"<p>Hi</p>","text":"Hi","last_event":"delivered","created_at":"<iso-date>","scheduled_at":null,"bcc":null,"cc":null,"reply_to":null}',errorCodes:["auth_error","fetch_error"],examples:["resend emails get <email-id>","resend emails get <email-id> --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,ze,n);await G({loading:"Fetching email...",sdkCall:i=>i.emails.get(o),onInteractive:i=>{console.log(`From: ${i.from}`),console.log(`To: ${i.to.join(", ")}`),console.log(`Subject: ${i.subject}`),console.log(`Status: ${i.last_event}`),console.log(`Date: ${i.created_at}`),i.scheduled_at&&console.log(`Scheduled: ${i.scheduled_at}`)}},n)});function Ap(e){let t=e.map(r=>{let n=r.to.join(", "),o=n.length>40?`${n.slice(0,37)}...`:n,i=r.subject.length>50?`${r.subject.slice(0,47)}...`:r.subject;return[r.from,o,i,r.last_event??"\u2014",r.created_at,r.id]});return F(["From","To","Subject","Status","Created","ID"],t,"(no sent emails)")}var Ql=new m("list").alias("ls").description('List sent emails \u2014 returns summary (use "get <id>" for full details)').option("--limit <n>","Maximum number of emails to return (1-100)","10").option("--after <cursor>","Cursor for forward pagination \u2014 list items after this ID").option("--before <cursor>","Cursor for backward pagination \u2014 list items before this ID").addHelpText("after",f({context:"Lists emails sent by your team. For emails received by your domain, use: resend emails receiving list",output:' {"object":"list","has_more":false,"data":[{"id":"...","to":["..."],"from":"...","subject":"...","created_at":"...","last_event":"delivered|opened|...","scheduled_at":null}]}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend emails list","resend emails list --limit 5","resend emails list --after <email-id> --limit 10","resend emails list --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching sent emails...",sdkCall:i=>i.emails.list(o),onInteractive:i=>{console.log(Ap(i.data)),M(i,"emails list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var ft={resource:"received email",resourcePlural:"received emails",fetchItems:(e,{limit:t,after:r})=>e.emails.receiving.list({limit:t,...r&&{after:r}}),display:e=>({label:e.subject||"(no subject)",hint:e.id})};function Xl(e){return{resource:"attachment",resourcePlural:"attachments",fetchItems:(t,{limit:r,after:n})=>t.emails.receiving.attachments.list({emailId:e,limit:r,...n&&{after:n}}),display:t=>({label:t.filename??"(unnamed)",hint:t.id})}}function Zl(e){let t=e.map(r=>{let n=r.to.join(", "),o=n.length>40?`${n.slice(0,37)}...`:n,i=r.subject.length>50?`${r.subject.slice(0,47)}...`:r.subject;return[r.from,o,i,r.created_at,r.id]});return F(["From","To","Subject","Created At","ID"],t,"(no received emails)")}var ec=new m("attachment").description("Retrieve a single attachment from a received (inbound) email").argument("[emailId]","Received email UUID").argument("[attachmentId]","Attachment UUID").addHelpText("after",f({context:`The download_url is a signed URL that expires in ~1 hour. Download the file directly:
|
|
540
|
+
resend emails receiving attachment <emailId> <attachmentId> --json | jq -r .download_url | xargs curl -O`,output:' {"object":"attachment","id":"<uuid>","filename":"invoice.pdf","size":51200,"content_type":"application/pdf","content_disposition":"attachment","content_id":null,"download_url":"<signed-url>","expires_at":"<iso-date>"}',errorCodes:["auth_error","fetch_error"],examples:["resend emails receiving attachment <email-id> <attachment-id>","resend emails receiving attachment <email-id> <attachment-id> --json"]})).action(async(e,t,r,n)=>{let o=n.optsWithGlobals(),i=await C(e,ft,o),s=await C(t,Xl(i),o);await G({loading:"Fetching attachment...",sdkCall:a=>a.emails.receiving.attachments.get({emailId:i,id:s}),onInteractive:a=>{console.log(`${a.filename??"(unnamed)"}`),console.log(`ID: ${a.id}`),console.log(`Content-Type: ${a.content_type}`),console.log(`Size: ${a.size} bytes`),console.log(`Disposition: ${a.content_disposition}`),console.log(`Download URL: ${a.download_url}`),console.log(`Expires: ${a.expires_at}`)}},o)});var tc=new m("attachments").description("List attachments on a received (inbound) email").argument("[emailId]","Received email UUID").option("--limit <n>","Maximum number of attachments to return (1-100)","10").option("--after <cursor>","Return attachments after this cursor (next page)").option("--before <cursor>","Return attachments before this cursor (previous page)").addHelpText("after",f({context:`Each attachment has a download_url (signed, expires ~1 hour).
|
|
540
541
|
Use the attachment sub-command to retrieve a single attachment with its download URL:
|
|
541
542
|
resend emails receiving attachment <emailId> <attachmentId>
|
|
542
543
|
|
|
543
544
|
content_disposition: "inline" means the attachment is embedded in the HTML body (e.g. an image).
|
|
544
|
-
content_disposition: "attachment" means it is a standalone file download.`,output:' {"object":"list","has_more":false,"data":[{"id":"<uuid>","filename":"invoice.pdf","size":51200,"content_type":"application/pdf","content_disposition":"attachment","content_id":null,"download_url":"<url>","expires_at":"<iso-date>"}]}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend emails receiving attachments <email-id>","resend emails receiving attachments <email-id> --json","resend emails receiving attachments <email-id> --limit 25 --json"]})).action(async(t,
|
|
545
|
-
Forwards the original email content (passthrough mode).`,output:' {"id":"<email-id>"}',errorCodes:["auth_error","create_error"],examples:["resend emails receiving forward <email-id> --to delivered@resend.com --from onboarding@resend.com","resend emails receiving forward <email-id> --to delivered@resend.com --from onboarding@resend.com --json"]})).action(async(t,
|
|
545
|
+
content_disposition: "attachment" means it is a standalone file download.`,output:' {"object":"list","has_more":false,"data":[{"id":"<uuid>","filename":"invoice.pdf","size":51200,"content_type":"application/pdf","content_disposition":"attachment","content_id":null,"download_url":"<url>","expires_at":"<iso-date>"}]}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend emails receiving attachments <email-id>","resend emails receiving attachments <email-id> --json","resend emails receiving attachments <email-id> --limit 25 --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,ft,n),i=L(t.limit,n),s=H(i,t.after,t.before,n);await O({loading:"Fetching attachments...",sdkCall:a=>a.emails.receiving.attachments.list({emailId:o,...s}),onInteractive:a=>{console.log(un(a.data)),M(a,`emails receiving attachments ${o}`,{limit:i,before:t.before,apiKey:n.apiKey,profile:n.profile})}},n)});var rc=new m("forward").description("Forward a received email").argument("[id]","Received email ID").requiredOption("--to <addresses...>","Recipient address(es)").requiredOption("--from <address>","Sender address").addHelpText("after",f({context:`Required: --to, --from
|
|
546
|
+
Forwards the original email content (passthrough mode).`,output:' {"id":"<email-id>"}',errorCodes:["auth_error","create_error"],examples:["resend emails receiving forward <email-id> --to delivered@resend.com --from onboarding@resend.com","resend emails receiving forward <email-id> --to delivered@resend.com --from onboarding@resend.com --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,ft,n);await K({loading:"Forwarding email...",sdkCall:i=>i.emails.receiving.forward({emailId:o,to:t.to,from:t.from}),onInteractive:i=>{console.log(`Email forwarded: ${i.id}`)}},n)});var nc=new m("get").description("Retrieve a single received (inbound) email with full details including HTML, text, and headers").argument("[id]","Received email UUID").addHelpText("after",f({context:`The raw.download_url field is a signed URL (expires ~1 hour) containing the full RFC 2822
|
|
546
547
|
MIME message. Pipe it to curl to save the original email:
|
|
547
548
|
resend emails receiving get <id> --json | jq -r .raw.download_url | xargs curl > email.eml
|
|
548
549
|
|
|
549
550
|
Attachments are listed in the attachments array. Use the attachments sub-command to get
|
|
550
551
|
download URLs:
|
|
551
|
-
resend emails receiving attachments <id>`,output:' {"object":"email","id":"<uuid>","to":["inbox@example.com"],"from":"sender@external.com","subject":"Hello","html":"<p>Hello!</p>","text":"Hello!","headers":{"x-mailer":"..."},"message_id":"<str>","bcc":[],"cc":[],"reply_to":[],"raw":{"download_url":"<url>","expires_at":"<iso-date>"},"attachments":[]}',errorCodes:["auth_error","fetch_error"],examples:["resend emails receiving get <email-id>","resend emails receiving get <email-id> --json"]})).action(async(t,
|
|
552
|
-
(HTML body only \u2014 use --json to view or pipe to a browser)`)}},n)});var
|
|
552
|
+
resend emails receiving attachments <id>`,output:' {"object":"email","id":"<uuid>","to":["inbox@example.com"],"from":"sender@external.com","subject":"Hello","html":"<p>Hello!</p>","text":"Hello!","headers":{"x-mailer":"..."},"message_id":"<str>","bcc":[],"cc":[],"reply_to":[],"raw":{"download_url":"<url>","expires_at":"<iso-date>"},"attachments":[]}',errorCodes:["auth_error","fetch_error"],examples:["resend emails receiving get <email-id>","resend emails receiving get <email-id> --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,ft,n);await G({loading:"Fetching received email...",sdkCall:i=>i.emails.receiving.get(o),onInteractive:i=>{if(console.log(`From: ${i.from}`),console.log(`To: ${i.to.join(", ")}`),console.log(`Subject: ${i.subject}`),console.log(`Date: ${i.created_at}`),i.attachments.length>0&&console.log(`Files: ${i.attachments.length} attachment(s)`),i.text){let s=i.text.length>200?`${i.text.slice(0,197)}...`:i.text;console.log(`${s}`)}else i.html&&console.log(`
|
|
553
|
+
(HTML body only \u2014 use --json to view or pipe to a browser)`)}},n)});var oc=new m("list").alias("ls").description("List received (inbound) emails for domains with receiving enabled").option("--limit <n>","Maximum number of emails to return (1-100)","10").option("--after <cursor>","Return emails after this cursor (next page)").option("--before <cursor>","Return emails before this cursor (previous page)").addHelpText("after",f({context:`Receiving must be enabled on the domain first:
|
|
553
554
|
resend domains update <id> --receiving enabled
|
|
554
555
|
|
|
555
556
|
Pagination: use --after or --before with a received email ID as the cursor.
|
|
556
557
|
Only one of --after or --before may be used at a time.
|
|
557
|
-
The response includes has_more: true when additional pages exist.`,output:' {"object":"list","has_more":false,"data":[{"id":"<uuid>","to":["inbox@example.com"],"from":"sender@external.com","subject":"Hello","created_at":"<iso-date>","message_id":"<str>","bcc":null,"cc":null,"reply_to":null,"attachments":[]}]}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend emails receiving list","resend emails receiving list --limit 25 --json","resend emails receiving list --after <email-id> --json"]})).action(async(t
|
|
558
|
-
`)}},
|
|
558
|
+
The response includes has_more: true when additional pages exist.`,output:' {"object":"list","has_more":false,"data":[{"id":"<uuid>","to":["inbox@example.com"],"from":"sender@external.com","subject":"Hello","created_at":"<iso-date>","message_id":"<str>","bcc":null,"cc":null,"reply_to":null,"attachments":[]}]}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend emails receiving list","resend emails receiving list --limit 25 --json","resend emails receiving list --after <email-id> --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching received emails...",sdkCall:i=>i.emails.receiving.list(o),onInteractive:i=>{console.log(Zl(i.data)),M(i,"emails receiving list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var et=pe(rt(),1);J();var ic=(e=1e4)=>{if(!Number.isInteger(e)||e<1)throw new RangeError(`maxSize must be a positive integer, got ${e}`);let t=new Map,r=()=>{let n=t.keys().next();n.done||t.delete(n.value)};return{has:n=>t.has(n)?(t.delete(n),t.set(n,!0),!0):!1,add:n=>{if(t.has(n)){t.delete(n),t.set(n,!0);return}t.size>=e&&r(),t.set(n,!0)},size:()=>t.size}};var Eo=100,sc=5,Do=()=>new Date().toLocaleTimeString("en-GB",{hour12:!1}),$p=(e,t)=>{if(t)console.log(JSON.stringify(e));else{let r=e.to.map(ke).join(", "),n=et.default.dim(`[${Do()}]`),o=ke(e.subject),i=o.length>50?`${o.slice(0,47)}...`:o,s=ke(e.from),a=ke(e.id);process.stderr.write(`${n} ${s} -> ${r} ${et.default.bold(`"${i}"`)} ${et.default.dim(a)}
|
|
559
|
+
`)}},Ep=(e,t)=>{let r=e.findIndex(n=>t.has(n.id));return r===-1?{newEmails:e,foundSeen:!1}:{newEmails:e.slice(0,r),foundSeen:!0}},ac=new m("listen").description("Poll for new inbound emails and display them as they arrive").option("--interval <seconds>","Polling interval in seconds (minimum 2)","5").addHelpText("after",f({context:`Long-running command that polls the receiving API at a fixed
|
|
559
560
|
interval and prints each new email as it arrives.
|
|
560
561
|
|
|
561
562
|
Interactive output shows one line per email. When piped (or with --json),
|
|
562
563
|
output is NDJSON (one JSON object per line).
|
|
563
564
|
|
|
564
|
-
Ctrl+C exits cleanly.`,examples:["resend emails receiving listen","resend emails receiving listen --interval 10","resend emails receiving listen --json | head -3"]})).action(async(t
|
|
565
|
-
`),process.stderr.write(` ${
|
|
565
|
+
Ctrl+C exits cleanly.`,examples:["resend emails receiving listen","resend emails receiving listen --interval 10","resend emails receiving listen --json | head -3"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=Number.parseInt(e.interval??"5",10);(Number.isNaN(n)||n<2)&&h({message:"Polling interval must be at least 2 seconds.",code:"invalid_interval"},{json:r.json});let o=await Z(r),i=r.json||!w(),s=re("Connecting...",r.quiet||i),a=ic(),l=0;try{let{data:b,error:_}=await o.emails.receiving.list({limit:1});(_||!b)&&(s.fail("Failed to connect"),h({message:_?.message??"Unexpected empty response",code:"list_error"},{json:r.json}));for(let k of b.data)a.add(k.id);s.stop("Ready")}catch(b){s.fail("Failed to connect"),h({message:q(b,"Unknown error"),code:"list_error"},{json:r.json})}i||(process.stderr.write(`
|
|
566
|
+
`),process.stderr.write(` ${et.default.bold("Polling:")} every ${n}s
|
|
566
567
|
`),process.stderr.write(`
|
|
567
568
|
Listening for new inbound emails. Press Ctrl+C to stop.
|
|
568
569
|
|
|
569
|
-
`));let d=b=>{l++,
|
|
570
|
-
`),l>=5&&h({message:"Exiting after 5 consecutive API failures.",code:"poll_error"},{json:r.json})},c=async(b,_,k)=>{if(k<=0)return{emails:_,hasMore:!0};let x=b?{limit:
|
|
571
|
-
`)},y=async()=>{try{let b=await c(void 0,[],
|
|
570
|
+
`));let d=b=>{l++,i||process.stderr.write(`${et.default.dim(`[${Do()}]`)} ${et.default.yellow("Warning:")} ${b}
|
|
571
|
+
`),l>=5&&h({message:"Exiting after 5 consecutive API failures.",code:"poll_error"},{json:r.json})},c=async(b,_,k)=>{if(k<=0)return{emails:_,hasMore:!0};let x=b?{limit:Eo,after:b}:{limit:Eo},{data:A,error:B}=await lr(()=>o.emails.receiving.list(x));if(B||!A)return{emails:_,error:B?.message??"Empty response",hasMore:!1};let{newEmails:D,foundSeen:I}=Ep(A.data,a),T=[..._,...D];if(I||!A.has_more)return{emails:T,hasMore:!1};let E=A.data[A.data.length-1]?.id;return E?c(E,T,k-1):{emails:T,hasMore:!0}},u,p=()=>{let b=`Hit page cap of ${sc*Eo} emails this poll; remaining will be picked up next tick.`;i?console.log(JSON.stringify({warning:"page_cap_reached",message:b})):process.stderr.write(`${et.default.dim(`[${Do()}]`)} ${et.default.yellow("Warning:")} ${b}
|
|
572
|
+
`)},y=async()=>{try{let b=await c(void 0,[],sc);b.error&&d(b.error),b.hasMore&&p();let _=b.emails.toReversed();for(let k of _)a.add(k.id);if(b.emails.length>0){l=0;for(let k of _)$p(k,i)}else b.error||(l=0)}catch(b){d(q(b,"Unknown error"))}finally{u=setTimeout(y,n*1e3)}};u=setTimeout(y,n*1e3);let g=()=>{clearTimeout(u),i||process.stderr.write(`
|
|
572
573
|
Stopped listening.
|
|
573
|
-
`),process.exit(It())};
|
|
574
|
-
resend domains update <id> --receiving enabled`,examples:["resend emails receiving list","resend emails receiving listen","resend emails receiving get <email-id>","resend emails receiving attachments <email-id>","resend emails receiving attachment <email-id> <attachment-id>","resend emails receiving forward <email-id> --to delivered@resend.com --from onboarding@resend.com"]})).addCommand(
|
|
575
|
-
Use --dry-run to print the request JSON without sending (attachments show filename and byteLength only).`,output:' {"id":"<email-id>"}',errorCodes:["auth_error","missing_body","file_read_error","invalid_options","stdin_read_error","invalid_header","invalid_tag","invalid_var","template_body_conflict","template_attachment_conflict","react_email_build_error","react_email_render_error","send_error"],examples:['resend emails send --from onboarding@resend.com --to delivered@resend.com --subject "Hello" --text "Hi"','resend emails send --from onboarding@resend.com --to delivered@resend.com --subject "Hello" --html "<b>Hi</b>"','resend emails send --from onboarding@resend.com --to delivered@resend.com --subject "Hello" --text "Hi" --attachment ./report.pdf',"resend emails send --template tmpl_123 --to delivered@resend.com"]})).action(async(t
|
|
576
|
-
`),l=ce(
|
|
577
|
-
`),d=ce(
|
|
574
|
+
`),process.exit(It())};Wr(g),process.on("SIGTERM",g),await new Promise(()=>{})});var lc=new m("receiving").description("Manage received (inbound) emails \u2014 requires domain receiving to be enabled").addHelpText("after",f({context:`Receiving must be enabled on the domain first:
|
|
575
|
+
resend domains update <id> --receiving enabled`,examples:["resend emails receiving list","resend emails receiving listen","resend emails receiving get <email-id>","resend emails receiving attachments <email-id>","resend emails receiving attachment <email-id> <attachment-id>","resend emails receiving forward <email-id> --to delivered@resend.com --from onboarding@resend.com"]})).addCommand(oc,{isDefault:!0}).addCommand(nc).addCommand(ac).addCommand(tc).addCommand(ec).addCommand(rc);var cc=require("node:fs"),uc=require("node:path");J();function Dp(e){let{attachments:t,...r}=e;return t?.length?{...r,attachments:t.map(n=>({filename:n.filename,byteLength:Buffer.isBuffer(n.content)?n.content.byteLength:Buffer.byteLength(String(n.content),"utf8")}))}:r}var dc=new m("send").description("Send an email").option("--from <address>","Sender address (required unless using --template)").option("--to <addresses...>","Recipient address(es) (required)").option("--subject <subject>","Email subject (required unless using --template)").option("--html <html>","HTML body").option("--html-file <path>",'Path to an HTML file for the body (use "-" for stdin)').option("--text <text>","Plain-text body").option("--text-file <path>",'Path to a plain-text file for the body (use "-" for stdin)').option("--react-email <path>","Path to a React Email template (.tsx) to bundle, render, and send").option("--cc <addresses...>","CC recipients").option("--bcc <addresses...>","BCC recipients").option("--reply-to <address>","Reply-to address").option("--scheduled-at <datetime>",'Schedule email for later \u2014 ISO 8601 or natural language e.g. "in 1 hour", "tomorrow at 9am ET"').option("--attachment <paths...>","File path(s) to attach").option("--headers <key=value...>","Custom headers as key=value pairs (e.g. X-Entity-Ref-ID=123)").option("--tags <name=value...>","Email tags as name=value pairs (e.g. category=marketing)").option("--idempotency-key <key>","Deduplicate this send request using this key").option("--dry-run","Validate input and print the request JSON without calling the API (interactive: verified-domain list is not fetched)").option("--template <id>","Template ID to use").option("--var <key=value...>","Template variables as key=value pairs (repeatable, e.g. --var name=John --var count=42)").addHelpText("after",f({context:`Required: --to and either --template, --react-email, or (--from, --subject, and one of --text | --text-file | --html | --html-file).
|
|
576
|
+
Use --dry-run to print the request JSON without sending (attachments show filename and byteLength only).`,output:' {"id":"<email-id>"}',errorCodes:["auth_error","missing_body","file_read_error","invalid_options","stdin_read_error","invalid_header","invalid_tag","invalid_var","template_body_conflict","template_attachment_conflict","react_email_build_error","react_email_render_error","send_error"],examples:['resend emails send --from onboarding@resend.com --to delivered@resend.com --subject "Hello" --text "Hi"','resend emails send --from onboarding@resend.com --to delivered@resend.com --subject "Hello" --html "<b>Hi</b>"','resend emails send --from onboarding@resend.com --to delivered@resend.com --subject "Hello" --text "Hi" --attachment ./report.pdf',"resend emails send --template tmpl_123 --to delivered@resend.com"]})).action(async(e,t)=>{let r=t.optsWithGlobals();e.htmlFile==="-"&&e.textFile==="-"&&h({message:"Cannot read both --html-file and --text-file from stdin. Pipe to one and pass the other as a file path.",code:"invalid_options"},{json:r.json}),e.from===""&&h({message:"--from cannot be empty",code:"invalid_options"},{json:r.json});let n=!!e.template;e.var&&!n&&h({message:"--var can only be used with --template",code:"invalid_var"},{json:r.json}),e.reactEmail&&(e.html||e.htmlFile||n)&&h({message:"Cannot use --react-email with --html, --html-file, or --template",code:"invalid_options"},{json:r.json}),n&&(e.html||e.htmlFile||e.text||e.textFile)&&h({message:"Cannot use --template with --html, --html-file, --text, or --text-file",code:"template_body_conflict"},{json:r.json}),n&&e.attachment&&h({message:"Cannot use --attachment with --template",code:"template_attachment_conflict"},{json:r.json});let o=e.var?Object.fromEntries(e.var.map(x=>{let A=x.indexOf("=");A<1&&h({message:`Invalid var format: "${x}". Expected key=value.`,code:"invalid_var"},{json:r.json});let B=x.slice(0,A),D=x.slice(A+1);return[B,D]})):void 0,i=e.from;if(!e.dryRun&&!i&&!n&&w()&&!r.json){let x=await Z(r,{permission:"sending_access"}),A=await Xr(x);A.length>0&&(i=await Zr(A))}let s=[{flag:"from",message:"From address",placeholder:"onboarding@resend.dev",defaultValue:"onboarding@resend.dev",required:!n},{flag:"to",message:"To address",placeholder:"delivered@resend.dev",defaultValue:"delivered@resend.dev"},{flag:"subject",message:"Subject",placeholder:"Hello!",defaultValue:"Hello!",required:!n}],a=await Us({from:i,to:e.to?.[0],subject:e.subject},s,r),l=e.html,d=e.text;e.htmlFile&&(e.html&&process.stderr.write(`Warning: both --html and --html-file provided; using --html-file
|
|
577
|
+
`),l=ce(e.htmlFile,r)),e.textFile&&(e.text&&process.stderr.write(`Warning: both --text and --text-file provided; using --text-file
|
|
578
|
+
`),d=ce(e.textFile,r)),e.reactEmail&&(l=await Be(e.reactEmail,r));let c=d;!n&&!e.reactEmail&&!l&&!d&&(c=await U(void 0,{message:"Email body (plain text)",placeholder:"Hello, World!",defaultValue:"Hello, World!"},{message:"Missing email body. Provide --html, --html-file, --text, --text-file, or --react-email",code:"missing_body"},r));let u=e.to??[a.to],p=e.attachment?.map(x=>{try{let A=(0,cc.readFileSync)(x);return{filename:(0,uc.basename)(x),content:A}}catch{return h({message:`Failed to read file: ${x}`,code:"file_read_error"},{json:r.json})}}),y=e.headers?Object.fromEntries(e.headers.map(x=>{let A=x.indexOf("=");return A<1&&h({message:`Invalid header format: "${x}". Expected key=value.`,code:"invalid_header"},{json:r.json}),[x.slice(0,A),x.slice(A+1)]})):void 0,g=e.tags?.map(x=>{let A=x.indexOf("=");return A<1&&h({message:`Invalid tag format: "${x}". Expected name=value.`,code:"invalid_tag"},{json:r.json}),{name:x.slice(0,A),value:x.slice(A+1)}}),b;if(n?b={template:{id:e.template,...o&&{variables:o}},to:u,...a.from&&{from:a.from},...a.subject&&{subject:a.subject},...e.cc&&{cc:e.cc},...e.bcc&&{bcc:e.bcc},...e.replyTo&&{replyTo:e.replyTo},...e.scheduledAt&&{scheduledAt:e.scheduledAt},...y&&{headers:y},...g&&{tags:g}}:b={from:a.from,to:u,subject:a.subject,...l&&{html:l},...c&&{text:c},...e.cc&&{cc:e.cc},...e.bcc&&{bcc:e.bcc},...e.replyTo&&{replyTo:e.replyTo},...e.scheduledAt&&{scheduledAt:e.scheduledAt},...p&&{attachments:p},...y&&{headers:y},...g&&{tags:g}},e.dryRun){N({dryRun:!0,request:Dp(b)},{json:r.json});return}let _=await Z(r,{permission:"sending_access"}),k=await Ee(e.scheduledAt?"Scheduling email...":"Sending email...",()=>_.emails.send(b,e.idempotencyKey?{idempotencyKey:e.idempotencyKey}:void 0),"send_error",r);!r.json&&w()?e.scheduledAt?console.log(`Email scheduled: ${k.id}`):console.log(`Email sent: ${k.id}`):N(k,{json:r.json})});var mc=new m("update").description("Update a scheduled email").argument("[id]","Email ID").requiredOption("--scheduled-at <datetime>","New scheduled date in ISO 8601 format (e.g. 2024-08-05T11:52:01.858Z)").addHelpText("after",f({context:"Required: --scheduled-at",output:' {"object":"email","id":"<email-id>"}',errorCodes:["auth_error","update_error"],examples:["resend emails update <email-id> --scheduled-at 2024-08-05T11:52:01.858Z","resend emails update <email-id> --scheduled-at 2024-08-05T11:52:01.858Z --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,ze,n);await R({loading:"Updating email...",sdkCall:i=>i.emails.update({id:o,scheduledAt:t.scheduledAt}),errorCode:"update_error",successMsg:`Email updated: ${o}`},n)});var pc=new m("emails").description("Send and manage emails").addHelpText("after",f({examples:['resend emails send --from onboarding@resend.com --to delivered@resend.com --subject "Hello" --text "Hi"',"resend emails get <email-id>","resend emails batch --file ./emails.json","resend emails cancel <email-id>","resend emails attachments <email-id>","resend emails attachment <email-id> <attachment-id>","resend emails receiving list","resend emails receiving forward <email-id> --to delivered@resend.com --from onboarding@resend.com"]})).addCommand(Ql,{isDefault:!0}).addCommand(dc).addCommand(Yl).addCommand(zl).addCommand(Jl).addCommand(mc).addCommand(Kl).addCommand(Vl).addCommand(lc);var Sp=new Set(["string","number","boolean","date"]);function So(e){if(!e)return"(none)";let t=Object.entries(e);return t.length===0?"(empty)":t.map(([r,n])=>`${r}:${n}`).join(", ")}function fc(e){let t=e.map(r=>[r.name,So(r.schema),r.created_at,r.id]);return F(["Name","Schema","Created","ID"],t,"(no events)")}function dn(e,t){if(e==="null")return null;let r=xt(e,"--schema",t);(typeof r!="object"||r===null||Array.isArray(r))&&h({message:"--schema must be a JSON object mapping field names to types (string | number | boolean | date).",code:"invalid_schema"},{json:t.json});for(let[n,o]of Object.entries(r))(typeof o!="string"||!Sp.has(o))&&h({message:`Invalid schema type for "${n}": "${o}". Must be one of: string, number, boolean, date.`,code:"invalid_schema"},{json:t.json});return r}var Mt={resource:"event",resourcePlural:"events",fetchItems:(e,{limit:t,after:r})=>e.events.list({limit:t,...r&&{after:r}}),display:e=>({label:e.name,hint:e.id})};var hc=new m("create").description("Create a new event definition").option("--name <name>","Event name (e.g. user.signed_up)").option("--schema <json>","Schema as JSON mapping field names to types (string | number | boolean | date)").addHelpText("after",f({context:`Non-interactive: --name is required. --schema is optional.
|
|
578
579
|
|
|
579
580
|
Schema format:
|
|
580
581
|
A JSON object mapping field names to type strings.
|
|
581
582
|
Valid types: string, number, boolean, date.
|
|
582
|
-
Example: '{"plan":"string","age":"number","active":"boolean"}'`,output:' {"object":"event","id":"<id>"}',errorCodes:["auth_error","missing_name","invalid_schema","create_error"],examples:['resend events create --name "user.signed_up"',`resend events create --name "order.completed" --schema '{"amount":"number","currency":"string"}'`,'resend events create --name "user.signed_up" --json']})).action(async(t
|
|
583
|
-
This cannot be undone.`,loading:"Deleting event...",object:"event",successMsg:"Event deleted",sdkCall:
|
|
583
|
+
Example: '{"plan":"string","age":"number","active":"boolean"}'`,output:' {"object":"event","id":"<id>"}',errorCodes:["auth_error","missing_name","invalid_schema","create_error"],examples:['resend events create --name "user.signed_up"',`resend events create --name "order.completed" --schema '{"amount":"number","currency":"string"}'`,'resend events create --name "user.signed_up" --json']})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=await U(e.name,{message:"Event name",placeholder:"e.g. user.signed_up"},{message:"Missing --name flag.",code:"missing_name"},r),o=e.schema?dn(e.schema,r):void 0;await K({loading:"Creating event...",sdkCall:i=>i.events.create({name:n,...o!==void 0&&{schema:o}}),onInteractive:i=>{console.log(`Event created: ${i.id}`)}},r)});var gc=new m("delete").alias("rm").description("Delete an event definition").argument("[id]","Event ID").option("--yes","Skip confirmation prompt").addHelpText("after",f({context:"Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.",output:' {"object":"event","id":"<id>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend events delete <id> --yes","resend events delete <id> --yes --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Mt,n);await ne(o,!!t.yes,{confirmMessage:`Delete event ${o}?
|
|
584
|
+
This cannot be undone.`,loading:"Deleting event...",object:"event",successMsg:"Event deleted",sdkCall:i=>i.events.remove(o)},n)});var bc=new m("get").description("Retrieve an event definition").argument("[id]","Event ID").addHelpText("after",f({output:" Full event object including schema.",errorCodes:["auth_error","fetch_error"],examples:["resend events get <id>","resend events get <id> --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Mt,n);await G({loading:"Fetching event...",sdkCall:i=>i.events.get(o),onInteractive:i=>{console.log(i.name),console.log(`ID: ${i.id}`),console.log(`Schema: ${So(i.schema)}`),console.log(`Created: ${i.created_at}`),i.updated_at&&console.log(`Updated: ${i.updated_at}`)}},n)});var yc=new m("list").alias("ls").description("List all events").option("--limit <n>","Maximum number of events to return (1-100)","10").option("--after <cursor>","Return events after this cursor (next page)").option("--before <cursor>","Return events before this cursor (previous page)").addHelpText("after",f({output:' {"object":"list","data":[...],"has_more":true}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend events list","resend events list --limit 25 --json","resend events list --after <cursor> --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching events...",sdkCall:i=>i.events.list(o),onInteractive:i=>{console.log(fc(i.data)),M(i,"events list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var vc=new m("open").description("Open the events page in the Resend dashboard").addHelpText("after",f({context:"Opens the events management page in the Resend dashboard in your default browser.",examples:["resend events open"]})).action(async(e,t)=>{let r=t.optsWithGlobals();await Se(de.events,r)});var Cc=new m("send").description("Send an event to trigger automations for a contact").option("--event <name>","Event name (e.g. user.signed_up)").option("--contact-id <id>","Contact ID (mutually exclusive with --email)").option("--email <email>","Contact email (mutually exclusive with --contact-id)").option("--payload <json>","Event payload as JSON string").addHelpText("after",f({context:`Sends an event for a specific contact, triggering any automations listening for it.
|
|
584
585
|
|
|
585
586
|
Contact targeting:
|
|
586
587
|
Provide exactly one of --contact-id or --email to identify the contact.
|
|
@@ -588,12 +589,12 @@ Contact targeting:
|
|
|
588
589
|
|
|
589
590
|
Payload:
|
|
590
591
|
Optional JSON object with event-specific data.
|
|
591
|
-
Must match the event's schema if one is defined.`,output:' {"object":"event","event":"<name>"}',errorCodes:["auth_error","missing_event","missing_contact","conflicting_contact","invalid_json","send_error"],examples:['resend events send --event "user.signed_up" --contact-id <id>','resend events send --event "user.signed_up" --email user@example.com',`resend events send --event "order.completed" --contact-id <id> --payload '{"amount":99,"currency":"usd"}'`]})).action(async(t
|
|
592
|
+
Must match the event's schema if one is defined.`,output:' {"object":"event","event":"<name>"}',errorCodes:["auth_error","missing_event","missing_contact","conflicting_contact","invalid_json","send_error"],examples:['resend events send --event "user.signed_up" --contact-id <id>','resend events send --event "user.signed_up" --email user@example.com',`resend events send --event "order.completed" --contact-id <id> --payload '{"amount":99,"currency":"usd"}'`]})).action(async(e,t)=>{let r=t.optsWithGlobals();e.contactId!==void 0&&e.email!==void 0&&h({message:"Cannot use both --contact-id and --email. Provide only one.",code:"conflicting_contact"},{json:r.json});let n=await U(e.event,{message:"Event name",placeholder:"e.g. user.signed_up"},{message:"Missing --event flag.",code:"missing_event"},r),o=e.contactId,i=e.email;!o&&!i&&(await Pt(void 0,{message:"Identify contact by",options:[{value:"contact-id",label:"Contact ID"},{value:"email",label:"Email address"}]},{message:"Missing --contact-id or --email flag.",code:"missing_contact"},r)==="contact-id"?o=await U(void 0,{message:"Contact ID"},{message:"Missing contact ID.",code:"missing_contact"},r):i=await U(void 0,{message:"Email address",placeholder:"user@example.com"},{message:"Missing email.",code:"missing_contact"},r));let s=xt(e.payload,"--payload",r),a=o?{event:n,contactId:o,...s&&{payload:s}}:{event:n,email:i,...s&&{payload:s}};await R({loading:"Sending event...",sdkCall:l=>l.events.send(a),errorCode:"send_error",successMsg:`Event sent: ${n}`},r)});J();var wc=new m("update").description("Update an event schema").argument("[id]","Event ID").option("--schema <json>",'New schema as JSON (or "null" to clear the schema)').addHelpText("after",f({context:`Non-interactive: --schema is required. Pass "null" to remove the schema.
|
|
592
593
|
|
|
593
594
|
Schema format:
|
|
594
595
|
A JSON object mapping field names to type strings.
|
|
595
596
|
Valid types: string, number, boolean, date.
|
|
596
|
-
Example: '{"plan":"string","age":"number"}'`,output:' {"object":"event","id":"<id>"}',errorCodes:["auth_error","missing_schema","invalid_schema","update_error"],examples:[`resend events update <id> --schema '{"plan":"string","age":"number"}'`,"resend events update <id> --schema null",`resend events update <id> --schema '{"plan":"string"}' --json`]})).action(async(t,
|
|
597
|
+
Example: '{"plan":"string","age":"number"}'`,output:' {"object":"event","id":"<id>"}',errorCodes:["auth_error","missing_schema","invalid_schema","update_error"],examples:[`resend events update <id> --schema '{"plan":"string","age":"number"}'`,"resend events update <id> --schema null",`resend events update <id> --schema '{"plan":"string"}' --json`]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Mt,n),i=t.schema;i===void 0&&((!w()||n.json)&&h({message:"Missing --schema flag.",code:"missing_schema"},{json:n.json}),i=await U(void 0,{message:'Schema JSON (or "null" to clear)',placeholder:'{"field":"string"}'},{message:"Missing --schema flag.",code:"missing_schema"},n));let s=dn(i,n);await R({loading:"Updating event...",sdkCall:a=>a.events.update(o,{schema:s}),errorCode:"update_error",successMsg:`Event updated: ${o}`},n)});var _c=new m("events").description("Manage events").addHelpText("after",f({context:`Events define the signals that trigger automations.
|
|
597
598
|
Each event has a name and an optional typed schema (string | number | boolean | date fields).
|
|
598
599
|
|
|
599
600
|
Lifecycle:
|
|
@@ -602,33 +603,33 @@ Lifecycle:
|
|
|
602
603
|
3. resend events list
|
|
603
604
|
4. resend events get <id>
|
|
604
605
|
5. resend events update <id> --schema '{"plan":"string","trial":"boolean"}'
|
|
605
|
-
6. resend events delete <id> --yes`,examples:["resend events list",'resend events create --name "user.signed_up"',`resend events create --name "order.completed" --schema '{"amount":"number","currency":"string"}'`,"resend events get <id>",`resend events update <id> --schema '{"plan":"string"}'`,"resend events update <id> --schema null","resend events delete <id> --yes",'resend events send --event "user.signed_up" --contact-id <id>',`resend events send --event "user.signed_up" --email user@example.com --payload '{"plan":"pro"}'`]})).addCommand(
|
|
606
|
+
6. resend events delete <id> --yes`,examples:["resend events list",'resend events create --name "user.signed_up"',`resend events create --name "order.completed" --schema '{"amount":"number","currency":"string"}'`,"resend events get <id>",`resend events update <id> --schema '{"plan":"string"}'`,"resend events update <id> --schema null","resend events delete <id> --yes",'resend events send --event "user.signed_up" --contact-id <id>',`resend events send --event "user.signed_up" --email user@example.com --payload '{"plan":"pro"}'`]})).addCommand(hc).addCommand(bc).addCommand(yc,{isDefault:!0}).addCommand(wc).addCommand(gc).addCommand(vc).addCommand(Cc);function xc(e){let t=e.map(r=>[r.method,r.endpoint,String(r.response_status),r.created_at,r.id]);return F(["Method","Endpoint","Status","Created","ID"],t,"(no logs)")}var kc={resource:"log",resourcePlural:"logs",fetchItems:(e,{limit:t,after:r})=>e.logs.list({limit:t,...r&&{after:r}}),display:e=>({label:`${e.method} ${e.endpoint}`,hint:e.id})};var Ac=new m("get").description("Retrieve a single API request log with full request/response bodies").argument("[id]","Log ID").addHelpText("after",f({output:" Full log object including request_body and response_body.",errorCodes:["auth_error","fetch_error"],examples:["resend logs get 3d4a472d-bc6d-4dd2-aa9d-d3d11b549e55","resend logs get 3d4a472d-bc6d-4dd2-aa9d-d3d11b549e55 --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,kc,n);await G({loading:"Fetching log...",sdkCall:i=>i.logs.get(o),onInteractive:i=>{console.log(`${i.method} ${i.endpoint} \u2014 ${i.response_status}`),console.log(`ID: ${i.id}`),console.log(`Created: ${i.created_at}`),console.log(`User-Agent: ${i.user_agent??"(none)"}`),i.request_body&&console.log(`
|
|
606
607
|
Request Body:
|
|
607
|
-
${JSON.stringify(
|
|
608
|
+
${JSON.stringify(i.request_body,null,2)}`),i.response_body&&console.log(`
|
|
608
609
|
Response Body:
|
|
609
|
-
${JSON.stringify(
|
|
610
|
-
The list response does not include request/response bodies \u2014 use "resend logs get <id>" for that.`,errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend logs list","resend logs list --limit 25 --json","resend logs list --after <cursor> --json"]})).action(async(t
|
|
610
|
+
${JSON.stringify(i.response_body,null,2)}`)}},n)});var $c=new m("list").alias("ls").description("List API request logs").option("--limit <n>","Maximum number of logs to return (1-100)","10").option("--after <cursor>","Return logs after this cursor (next page)").option("--before <cursor>","Return logs before this cursor (previous page)").addHelpText("after",f({output:` {"object":"list","data":[...],"has_more":true}
|
|
611
|
+
The list response does not include request/response bodies \u2014 use "resend logs get <id>" for that.`,errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend logs list","resend logs list --limit 25 --json","resend logs list --after <cursor> --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching logs...",sdkCall:i=>i.logs.list(o),onInteractive:i=>{console.log(xc(i.data)),M(i,"logs list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var Ec=new m("open").description("Open a log or the logs list in the Resend dashboard").argument("[id]","Log ID \u2014 omit to open the logs list").addHelpText("after",f({context:`Opens the Resend dashboard in your default browser.
|
|
611
612
|
With an ID: opens that log's detail page.
|
|
612
|
-
Without an ID: opens the logs list.`,examples:["resend logs open","resend logs open 3d4a472d-bc6d-4dd2-aa9d-d3d11b549e55"]})).action(async(t,
|
|
613
|
+
Without an ID: opens the logs list.`,examples:["resend logs open","resend logs open 3d4a472d-bc6d-4dd2-aa9d-d3d11b549e55"]})).action(async(e,t,r)=>{let n=e?de.log(e):de.logs,o=r.optsWithGlobals();await Se(n,o)});var Dc=new m("logs").description("View API request logs").addHelpText("after",f({examples:["resend logs list","resend logs list --limit 25 --json","resend logs get 3d4a472d-bc6d-4dd2-aa9d-d3d11b549e55","resend logs open","resend logs open 3d4a472d-bc6d-4dd2-aa9d-d3d11b549e55"]})).addCommand(Ac).addCommand($c,{isDefault:!0}).addCommand(Ec);var Sc=new m("open").description("Open the Resend dashboard in your browser").addHelpText("after",f({context:"Opens https://resend.com/emails in your default browser.",examples:["resend open"]})).action(async(e,t)=>{let r=t.optsWithGlobals();await Se(de.emails,r)});var Tc=new m("contacts").description("List contacts belonging to a segment").argument("[segmentId]","ID of the segment").option("--limit <n>","Maximum number of contacts to return (1-100)","10").option("--after <cursor>","Return contacts after this cursor (next page)").option("--before <cursor>","Return contacts before this cursor (previous page)").addHelpText("after",f({context:`Lists all contacts that belong to the given segment.
|
|
613
614
|
|
|
614
615
|
If no segment ID is provided interactively, a picker will prompt you to choose one.
|
|
615
616
|
|
|
616
617
|
Pagination: use --after or --before with a contact ID as the cursor.
|
|
617
618
|
Only one of --after or --before may be used at a time.
|
|
618
|
-
The response includes has_more: true when additional pages exist.`,output:' {"object":"list","data":[{"id":"...","email":"...","first_name":"...","last_name":"...","unsubscribed":false}],"has_more":false}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend segments contacts 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend segments contacts 78261eea-8f8b-4381-83c6-79fa7120f1cf --limit 25 --json","resend segments contacts 78261eea-8f8b-4381-83c6-79fa7120f1cf --after 479e3145-dd38-4932-8c0c-e58b548c9e76"]})).action(async(t,
|
|
619
|
+
The response includes has_more: true when additional pages exist.`,output:' {"object":"list","data":[{"id":"...","email":"...","first_name":"...","last_name":"...","unsubscribed":false}],"has_more":false}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend segments contacts 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend segments contacts 78261eea-8f8b-4381-83c6-79fa7120f1cf --limit 25 --json","resend segments contacts 78261eea-8f8b-4381-83c6-79fa7120f1cf --after 479e3145-dd38-4932-8c0c-e58b548c9e76"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Ge,n),i=L(t.limit,n),s=H(i,t.after,t.before,n);await O({loading:"Fetching segment contacts...",sdkCall:a=>a.contacts.list({segmentId:o,...s}),onInteractive:a=>{console.log(on(a.data)),M(a,`segments contacts ${o}`,{limit:i,before:t.before,apiKey:n.apiKey,profile:n.profile})}},n)});var Oc=new m("create").description("Create a new segment").option("--name <name>","Segment name (required)").addHelpText("after",f({context:`Segments are named groups of contacts. Broadcasts target segments via segment_id.
|
|
619
620
|
Contacts can belong to multiple segments. Audiences are deprecated \u2014 use segments instead.
|
|
620
621
|
|
|
621
|
-
Non-interactive: --name is required.`,output:' {"object":"segment","id":"<uuid>","name":"<name>"}',errorCodes:["auth_error","missing_name","create_error"],examples:['resend segments create --name "Newsletter Subscribers"','resend segments create --name "Beta Users" --json']})).action(async(t
|
|
622
|
+
Non-interactive: --name is required.`,output:' {"object":"segment","id":"<uuid>","name":"<name>"}',errorCodes:["auth_error","missing_name","create_error"],examples:['resend segments create --name "Newsletter Subscribers"','resend segments create --name "Beta Users" --json']})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=await U(e.name,{message:"Segment name",placeholder:"e.g. Newsletter Subscribers"},{message:"Missing --name flag.",code:"missing_name"},r);await K({loading:"Creating segment...",sdkCall:o=>o.segments.create({name:n}),onInteractive:o=>{console.log(`Segment created: ${o.id}`),console.log(`Name: ${o.name}`)}},r)});var Ic=new m("delete").alias("rm").description("Delete a segment").argument("[id]","Segment UUID").option("--yes","Skip the confirmation prompt (required in non-interactive mode)").addHelpText("after",f({context:`Warning: Deleting a segment removes it as a target for future broadcasts,
|
|
622
623
|
but does NOT delete the contacts within it.
|
|
623
624
|
|
|
624
|
-
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"segment","id":"<uuid>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend segments delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes","resend segments delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes --json"]})).action(async(t,
|
|
625
|
-
ID: ${
|
|
626
|
-
Contacts will not be deleted, but broadcasts targeting this segment will no longer work.`,loading:"Deleting segment...",object:"segment",successMsg:"Segment deleted",sdkCall:
|
|
625
|
+
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"segment","id":"<uuid>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend segments delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes","resend segments delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await le(e,Ge,n);await ne(o.id,!!t.yes,{confirmMessage:`Delete segment "${o.label}"?
|
|
626
|
+
ID: ${o.id}
|
|
627
|
+
Contacts will not be deleted, but broadcasts targeting this segment will no longer work.`,loading:"Deleting segment...",object:"segment",successMsg:"Segment deleted",sdkCall:i=>i.segments.remove(o.id)},n)});var Pc=new m("get").description("Retrieve a segment by ID").argument("[id]","Segment UUID").addHelpText("after",f({output:' {"object":"segment","id":"<uuid>","name":"<name>","created_at":"<iso-date>"}',errorCodes:["auth_error","fetch_error"],examples:["resend segments get 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend segments get 78261eea-8f8b-4381-83c6-79fa7120f1cf --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Ge,n);await G({loading:"Fetching segment...",sdkCall:i=>i.segments.get(o),onInteractive:i=>{console.log(`${i.name}`),console.log(`ID: ${i.id}`),console.log(`Created: ${i.created_at}`)}},n)});var jc=new m("list").alias("ls").description("List all segments").option("--limit <n>","Maximum number of segments to return (1-100)","10").option("--after <cursor>","Return segments after this cursor (next page)").option("--before <cursor>","Return segments before this cursor (previous page)").addHelpText("after",f({context:`Pagination: use --after or --before with a segment ID as the cursor.
|
|
627
628
|
Only one of --after or --before may be used at a time.
|
|
628
629
|
The response includes has_more: true when additional pages exist.
|
|
629
630
|
|
|
630
631
|
Use "resend segments list" to discover segment IDs for use with broadcasts
|
|
631
|
-
or "resend contacts add-segment".`,output:' {"object":"list","data":[{"id":"<uuid>","name":"<name>","created_at":"<iso-date>"}],"has_more":false}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend segments list","resend segments list --limit 25 --json","resend segments list --after 78261eea-8f8b-4381-83c6-79fa7120f1cf --json"]})).action(async(t
|
|
632
|
+
or "resend contacts add-segment".`,output:' {"object":"list","data":[{"id":"<uuid>","name":"<name>","created_at":"<iso-date>"}],"has_more":false}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend segments list","resend segments list --limit 25 --json","resend segments list --after 78261eea-8f8b-4381-83c6-79fa7120f1cf --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching segments...",sdkCall:i=>i.segments.list(o),onInteractive:i=>{console.log(tn(i.data)),M(i,"segments list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var Rc=new m("segments").description("Manage segments").addHelpText("after",f({context:`Segments are the modern replacement for Audiences (deprecated).
|
|
632
633
|
A segment is a named group of contacts. Broadcasts target segments via segment_id.
|
|
633
634
|
Contacts can belong to multiple segments.
|
|
634
635
|
|
|
@@ -637,7 +638,7 @@ Segment membership is managed through the contacts namespace:
|
|
|
637
638
|
resend contacts remove-segment <contactId> <segmentId>
|
|
638
639
|
resend contacts segments <contactId>
|
|
639
640
|
|
|
640
|
-
There is no "update" endpoint \u2014 to rename a segment, delete it and recreate.`,examples:["resend segments list",'resend segments create --name "Newsletter Subscribers"',"resend segments get 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend segments contacts 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend segments delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes"]})).addCommand(
|
|
641
|
+
There is no "update" endpoint \u2014 to rename a segment, delete it and recreate.`,examples:["resend segments list",'resend segments create --name "Newsletter Subscribers"',"resend segments get 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend segments contacts 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend segments delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes"]})).addCommand(Tc).addCommand(Oc).addCommand(Pc).addCommand(jc,{isDefault:!0}).addCommand(Ic);J();function mn(e){return e.map(t=>{let[r,n,...o]=t.split(":");if(!r)throw new Error(`Invalid --var "${t}": key is required.`);if(n!=="string"&&n!=="number")throw new Error(`Invalid --var "${t}": type must be "string" or "number".`);let i=o.length?o.join(":"):void 0;if(i!=null&&i==="")throw new Error(`Invalid --var "${t}": fallback value cannot be empty.`);let s=i;if(n==="number"){if(s!=null&&Number.isNaN(Number(s)))throw new Error(`Invalid --var "${t}": fallback "${s}" is not a valid number.`);return{key:r,type:"number",...s!=null?{fallbackValue:Number(s)}:{}}}return{key:r,type:"string",...s!=null?{fallbackValue:s}:{}}})}var Je={resource:"template",resourcePlural:"templates",fetchItems:(e,{limit:t,after:r})=>e.templates.list({limit:t,...r&&{after:r}}),display:e=>({label:e.name,hint:e.id})};function Fc(e){let t=e.map(r=>[r.name,r.status,r.alias??"",r.id,r.created_at]);return F(["Name","Status","Alias","ID","Created"],t,"(no templates)")}var Nc=new m("create").description("Create a new template").option("--name <name>","Template name \u2014 required").option("--html <html>","HTML body").option("--html-file <path>",'Path to an HTML file for the body (use "-" for stdin)').option("--subject <subject>","Email subject").option("--text <text>","Plain-text body").option("--text-file <path>",'Path to a plain-text file for the body (use "-" for stdin)').option("--react-email <path>","Path to a React Email template (.tsx) to bundle, render, and use as HTML body").option("--from <address>","Sender address").option("--reply-to <address>","Reply-to address").option("--alias <alias>","Template alias for lookup by name").option("--var <var...>","Template variable: KEY:type or KEY:type:fallback (repeatable)").addHelpText("after",f({context:`Creates a new draft template. Use "resend templates publish" to make it available for sending.
|
|
641
642
|
|
|
642
643
|
--name is required. Body: provide --html, --html-file, or --react-email. Optionally add --text or --text-file for plain-text.
|
|
643
644
|
|
|
@@ -647,24 +648,24 @@ There is no "update" endpoint \u2014 to rename a segment, delete it and recreate
|
|
|
647
648
|
--html "<p>Hi {{{NAME}}}, your total is {{{PRICE}}}</p>"
|
|
648
649
|
--var NAME:string --var PRICE:number:0
|
|
649
650
|
|
|
650
|
-
Non-interactive: --name and a body (--html, --html-file, or --react-email) are required. --text-file provides a plain-text fallback.`,output:' {"object":"template","id":"<template-id>"}',errorCodes:["auth_error","missing_name","missing_body","file_read_error","invalid_options","stdin_read_error","react_email_build_error","react_email_render_error","create_error"],examples:['resend templates create --name "Welcome" --html "<h1>Hello</h1>" --subject "Welcome!"','resend templates create --name "Newsletter" --html-file ./template.html --from acme@example.com','resend templates create --name "Onboarding" --html "<p>Hi</p>" --alias onboarding --json','resend templates create --name "Order" --html "<p>{{{PRODUCT}}}: {{{PRICE}}}</p>" --var PRODUCT:string:item --var PRICE:number:25']})).action(async(t
|
|
651
|
-
`),
|
|
652
|
-
`),
|
|
651
|
+
Non-interactive: --name and a body (--html, --html-file, or --react-email) are required. --text-file provides a plain-text fallback.`,output:' {"object":"template","id":"<template-id>"}',errorCodes:["auth_error","missing_name","missing_body","file_read_error","invalid_options","stdin_read_error","react_email_build_error","react_email_render_error","create_error"],examples:['resend templates create --name "Welcome" --html "<h1>Hello</h1>" --subject "Welcome!"','resend templates create --name "Newsletter" --html-file ./template.html --from acme@example.com','resend templates create --name "Onboarding" --html "<p>Hi</p>" --alias onboarding --json','resend templates create --name "Order" --html "<p>{{{PRODUCT}}}: {{{PRICE}}}</p>" --var PRODUCT:string:item --var PRICE:number:25']})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=e.name;if(!n){(!w()||r.json)&&h({message:"Missing --name flag.",code:"missing_name"},{json:r.json});let s=await X({message:"Template name",placeholder:"e.g. Welcome Email",validate:a=>a?void 0:"Required"});$(s)&&S("Cancelled."),n=s}e.htmlFile==="-"&&e.textFile==="-"&&h({message:"Cannot read both --html-file and --text-file from stdin. Pipe to one and pass the other as a file path.",code:"invalid_options"},{json:r.json}),e.reactEmail&&(e.html||e.htmlFile)&&h({message:"Cannot use --react-email with --html or --html-file",code:"invalid_options"},{json:r.json});let o=e.html,i=e.text;if(e.htmlFile&&(e.html&&process.stderr.write(`Warning: both --html and --html-file provided; using --html-file
|
|
652
|
+
`),o=ce(e.htmlFile,r)),e.textFile&&(e.text&&process.stderr.write(`Warning: both --text and --text-file provided; using --text-file
|
|
653
|
+
`),i=ce(e.textFile,r)),e.reactEmail&&(o=await Be(e.reactEmail,r)),!o){(!w()||r.json)&&h({message:"Missing body. Provide --html, --html-file, or --react-email.",code:"missing_body"},{json:r.json});let s=await X({message:"HTML body",placeholder:"<h1>Hello {{name}}</h1>",validate:a=>a?void 0:"Required"});$(s)&&S("Cancelled."),o=s}await K({loading:"Creating template...",sdkCall:s=>Promise.resolve(s.templates.create({name:n,html:o,...e.subject&&{subject:e.subject},...i&&{text:i},...e.from&&{from:e.from},...e.replyTo&&{replyTo:e.replyTo},...e.alias&&{alias:e.alias},...e.var&&{variables:mn(e.var)}})),onInteractive:s=>{console.log(`Template created: ${s.id}`)}},r)});var Bc=new m("delete").alias("rm").description("Delete a template").argument("[id]","Template ID or alias").option("--yes","Skip the confirmation prompt (required in non-interactive mode)").addHelpText("after",f({context:`Warning: Deleting a template is permanent and cannot be undone.
|
|
653
654
|
|
|
654
|
-
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"template","id":"<uuid>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend templates delete 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend templates delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes","resend templates rm my-template-alias --yes","resend templates delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes --json"]})).action(async(t,
|
|
655
|
-
ID: ${
|
|
656
|
-
This action is permanent and cannot be undone.`,loading:"Deleting template...",object:"template",successMsg:"Template deleted",sdkCall:
|
|
655
|
+
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"template","id":"<uuid>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend templates delete 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend templates delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes","resend templates rm my-template-alias --yes","resend templates delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await le(e,Je,n);await ne(o.id,!!t.yes,{confirmMessage:`Delete template "${o.label}"?
|
|
656
|
+
ID: ${o.id}
|
|
657
|
+
This action is permanent and cannot be undone.`,loading:"Deleting template...",object:"template",successMsg:"Template deleted",sdkCall:i=>i.templates.remove(o.id)},n)});var Gc=new m("duplicate").description("Duplicate a template").argument("[id]","Template ID or alias to duplicate").addHelpText("after",f({context:`Creates a copy of an existing template and returns the new template ID.
|
|
657
658
|
The duplicate is created as a draft with " (Copy)" appended to the original name.
|
|
658
|
-
All fields (HTML, subject, variables, etc.) are copied to the new template.`,output:' {"object":"template","id":"<new-template-id>"}',errorCodes:["auth_error","create_error"],examples:["resend templates duplicate 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend templates duplicate my-template-alias --json"]})).action(async(t,
|
|
659
|
+
All fields (HTML, subject, variables, etc.) are copied to the new template.`,output:' {"object":"template","id":"<new-template-id>"}',errorCodes:["auth_error","create_error"],examples:["resend templates duplicate 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend templates duplicate my-template-alias --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Je,n);await K({loading:"Duplicating template...",sdkCall:i=>Promise.resolve(i.templates.duplicate(o)),onInteractive:i=>{console.log(`Template duplicated: ${i.id}`)}},n)});var Lc=new m("get").description("Retrieve a template by ID or alias").argument("[id]","Template ID or alias").addHelpText("after",f({context:"Returns the full template including HTML body, variables, and publication status.",output:' {"object":"template","id":"...","name":"...","subject":"...","status":"draft|published","html":"...","alias":"...","from":"...","reply_to":["..."],"variables":[...],"created_at":"...","updated_at":"..."}',errorCodes:["auth_error","fetch_error"],examples:["resend templates get 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend templates get my-template-alias","resend templates get 78261eea-8f8b-4381-83c6-79fa7120f1cf --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Je,n);await G({loading:"Fetching template...",sdkCall:i=>i.templates.get(o),onInteractive:i=>{if(console.log(`${i.name}`),console.log(`ID: ${i.id}`),console.log(`Status: ${i.status}`),i.alias&&console.log(`Alias: ${i.alias}`),i.subject&&console.log(`Subject: ${i.subject}`),i.from&&console.log(`From: ${i.from}`),i.reply_to?.length&&console.log(`Reply-To: ${i.reply_to.join(", ")}`),i.html){let s=i.html.length>200?`${i.html.slice(0,197)}...`:i.html;console.log(`HTML: ${s}`)}i.variables?.length&&console.log(`Variables: ${i.variables.map(s=>s.key).join(", ")}`),i.published_at&&console.log(`Published: ${i.published_at}`),console.log(`Created: ${i.created_at}`),console.log(`Updated: ${i.updated_at}`)}},n)});var Hc=new m("list").alias("ls").description("List all templates").option("--limit <n>","Maximum number of templates to return (1-100)","10").option("--after <cursor>","Cursor for forward pagination \u2014 list items after this ID").option("--before <cursor>","Cursor for backward pagination \u2014 list items before this ID").addHelpText("after",f({output:' {"object":"list","has_more":false,"data":[{"id":"...","name":"...","status":"draft|published","alias":"...","created_at":"..."}]}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend templates list","resend templates list --limit 5","resend templates list --after <template-id> --limit 10","resend templates list --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching templates...",sdkCall:i=>i.templates.list(o),onInteractive:i=>{console.log(Fc(i.data)),M(i,"templates list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var Mc=new m("open").description("Open a template or the templates list in the Resend dashboard").argument("[id]","Template ID \u2014 omit to open the templates list").addHelpText("after",f({context:`Opens the Resend dashboard in your default browser.
|
|
659
660
|
With an ID: opens that template's page for editing or viewing.
|
|
660
|
-
Without an ID: opens the templates list.`,examples:["resend templates open","resend templates open 78261eea-8f8b-4381-83c6-79fa7120f1cf"]})).action(async(t,
|
|
661
|
+
Without an ID: opens the templates list.`,examples:["resend templates open","resend templates open 78261eea-8f8b-4381-83c6-79fa7120f1cf"]})).action(async(e,t,r)=>{let n=e?de.template(e):de.templates,o=r.optsWithGlobals();await Se(n,o)});var qc=new m("publish").description("Publish a draft template").argument("[id]","Template ID or alias").addHelpText("after",f({context:`Promotes a draft template to published status, making it available for use in emails.
|
|
661
662
|
After updating a published template, re-publish to make the changes live.
|
|
662
|
-
Publishing an already-published template re-publishes it with the latest draft changes.`,output:' {"object":"template","id":"<template-id>"}',errorCodes:["auth_error","publish_error"],examples:["resend templates publish 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend templates publish 78261eea-8f8b-4381-83c6-79fa7120f1cf --json"]})).action(async(t,
|
|
663
|
+
Publishing an already-published template re-publishes it with the latest draft changes.`,output:' {"object":"template","id":"<template-id>"}',errorCodes:["auth_error","publish_error"],examples:["resend templates publish 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend templates publish 78261eea-8f8b-4381-83c6-79fa7120f1cf --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Je,n);await R({loading:"Publishing template...",sdkCall:i=>i.templates.publish(o),errorCode:"publish_error",successMsg:`Template published: ${o}`,retryTransient:!0},n)});var Uc=new m("update").description("Update an existing template").argument("[id]","Template ID or alias").option("--name <name>","Update template name").option("--html <html>","Update HTML body").option("--html-file <path>",'Path to an HTML file to replace the body (use "-" for stdin)').option("--subject <subject>","Update subject").option("--text <text>","Update plain-text body").option("--text-file <path>",'Path to a plain-text file to replace the body (use "-" for stdin)').option("--react-email <path>","Path to a React Email template (.tsx) to bundle, render, and use as HTML body").option("--from <address>","Update sender address").option("--reply-to <address>","Update reply-to address").option("--alias <alias>","Update template alias").option("--var <var...>","Template variable: KEY:type or KEY:type:fallback (repeatable)").addHelpText("after",f({context:`At least one option is required. Only the provided fields are changed; others are left as-is.
|
|
663
664
|
|
|
664
665
|
--var declares a template variable using the format KEY:type or KEY:type:fallback.
|
|
665
666
|
Valid types: string, number.
|
|
666
|
-
Variables must match {{{KEY}}} placeholders in the HTML body.`,output:' {"object":"template","id":"<template-id>"}',errorCodes:["auth_error","no_changes","file_read_error","invalid_options","stdin_read_error","react_email_build_error","react_email_render_error","update_error"],examples:['resend templates update 78261eea-8f8b-4381-83c6-79fa7120f1cf --name "Updated Name"',"resend templates update 78261eea-8f8b-4381-83c6-79fa7120f1cf --html-file ./new-template.html",'resend templates update 78261eea-8f8b-4381-83c6-79fa7120f1cf --subject "New Subject" --from "acme@example.com" --json',"resend templates update 78261eea-8f8b-4381-83c6-79fa7120f1cf --var PRODUCT:string:item --var PRICE:number:25"]})).action(async(t,
|
|
667
|
-
`),s=ce(
|
|
667
|
+
Variables must match {{{KEY}}} placeholders in the HTML body.`,output:' {"object":"template","id":"<template-id>"}',errorCodes:["auth_error","no_changes","file_read_error","invalid_options","stdin_read_error","react_email_build_error","react_email_render_error","update_error"],examples:['resend templates update 78261eea-8f8b-4381-83c6-79fa7120f1cf --name "Updated Name"',"resend templates update 78261eea-8f8b-4381-83c6-79fa7120f1cf --html-file ./new-template.html",'resend templates update 78261eea-8f8b-4381-83c6-79fa7120f1cf --subject "New Subject" --from "acme@example.com" --json',"resend templates update 78261eea-8f8b-4381-83c6-79fa7120f1cf --var PRODUCT:string:item --var PRICE:number:25"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals();t.name==null&&t.html==null&&t.htmlFile==null&&t.reactEmail==null&&t.subject==null&&t.text==null&&t.textFile==null&&t.from==null&&t.replyTo==null&&t.alias==null&&t.var==null&&h({message:"Provide at least one option to update: --name, --html, --html-file, --react-email, --subject, --text, --text-file, --from, --reply-to, --alias, or --var.",code:"no_changes"},{json:n.json}),t.reactEmail!=null&&(t.html!=null||t.htmlFile!=null)&&h({message:"Cannot use --react-email with --html or --html-file",code:"invalid_options"},{json:n.json}),t.html!=null&&t.htmlFile!=null&&h({message:"--html and --html-file are mutually exclusive.",code:"invalid_options"},{json:n.json}),t.htmlFile==="-"&&t.textFile==="-"&&h({message:"Cannot read both --html-file and --text-file from stdin. Pipe to one and pass the other as a file path.",code:"invalid_options"},{json:n.json});let o=await C(e,Je,n),i=t.html,s=t.text;t.htmlFile!=null&&(i=ce(t.htmlFile,n)),t.textFile!=null&&(t.text!=null&&process.stderr.write(`Warning: both --text and --text-file provided; using --text-file
|
|
668
|
+
`),s=ce(t.textFile,n)),t.reactEmail!=null&&(i=await Be(t.reactEmail,n)),await R({loading:"Updating template...",sdkCall:a=>a.templates.update(o,{...t.name!=null&&{name:t.name},...i!=null&&{html:i},...t.subject!=null&&{subject:t.subject},...s!=null&&{text:s},...t.from!=null&&{from:t.from},...t.replyTo!=null&&{replyTo:t.replyTo},...t.alias!=null&&{alias:t.alias},...t.var!=null&&{variables:mn(t.var)}}),errorCode:"update_error",successMsg:`Template updated: ${o}`,retryTransient:!0},n)});var Wc=new m("templates").description("Manage templates").addHelpText("after",f({context:`Lifecycle:
|
|
668
669
|
Templates follow a draft \u2192 published workflow:
|
|
669
670
|
1. create \u2014 creates a draft template
|
|
670
671
|
2. update \u2014 edits name, subject, HTML, variables, etc.
|
|
@@ -678,7 +679,7 @@ Template variables:
|
|
|
678
679
|
Each variable must be declared with --var when creating or updating:
|
|
679
680
|
--var KEY:type e.g. --var NAME:string
|
|
680
681
|
--var KEY:type:fallback e.g. --var PRICE:number:25
|
|
681
|
-
Valid types: string, number.`,examples:["resend templates list",'resend templates create --name "Welcome" --html "<h1>Hello {{{NAME}}}</h1>" --subject "Welcome!" --var NAME:string',"resend templates get 78261eea-8f8b-4381-83c6-79fa7120f1cf",'resend templates update 78261eea-8f8b-4381-83c6-79fa7120f1cf --subject "Updated Subject"',"resend templates publish 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend templates duplicate 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend templates delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes","resend templates open","resend templates open 78261eea-8f8b-4381-83c6-79fa7120f1cf"]})).addCommand(
|
|
682
|
+
Valid types: string, number.`,examples:["resend templates list",'resend templates create --name "Welcome" --html "<h1>Hello {{{NAME}}}</h1>" --subject "Welcome!" --var NAME:string',"resend templates get 78261eea-8f8b-4381-83c6-79fa7120f1cf",'resend templates update 78261eea-8f8b-4381-83c6-79fa7120f1cf --subject "Updated Subject"',"resend templates publish 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend templates duplicate 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend templates delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes","resend templates open","resend templates open 78261eea-8f8b-4381-83c6-79fa7120f1cf"]})).addCommand(Nc).addCommand(Lc).addCommand(Mc).addCommand(Hc,{isDefault:!0}).addCommand(Uc).addCommand(Bc).addCommand(qc).addCommand(Gc);var Vc=new m("create").description("Create a new topic for subscription management").option("--name <name>","Topic name (required)").option("--description <description>","Description shown to contacts when managing subscriptions").addOption(new Y("--default-subscription <mode>","Default subscription state for contacts").choices(["opt_in","opt_out"]).default("opt_in")).addHelpText("after",f({context:`Topics enable fine-grained subscription management. Contacts can opt in or out of
|
|
682
683
|
individual topics. Broadcasts can target only contacts opted into a specific topic.
|
|
683
684
|
|
|
684
685
|
Example topics: "Product Updates", "Security Alerts", "Weekly Digest".
|
|
@@ -687,16 +688,16 @@ Example topics: "Product Updates", "Security Alerts", "Weekly Digest".
|
|
|
687
688
|
opt_in Contacts receive broadcasts unless they explicitly opt out (default)
|
|
688
689
|
opt_out Contacts do NOT receive broadcasts unless they explicitly opt in
|
|
689
690
|
|
|
690
|
-
Non-interactive: --name is required.`,output:' {"id":"<uuid>"}',errorCodes:["auth_error","missing_name","create_error"],examples:['resend topics create --name "Product Updates"','resend topics create --name "Weekly Digest" --default-subscription opt_out','resend topics create --name "Security Alerts" --description "Critical security notices" --json']})).action(async(t
|
|
691
|
+
Non-interactive: --name is required.`,output:' {"id":"<uuid>"}',errorCodes:["auth_error","missing_name","create_error"],examples:['resend topics create --name "Product Updates"','resend topics create --name "Weekly Digest" --default-subscription opt_out','resend topics create --name "Security Alerts" --description "Critical security notices" --json']})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=await U(e.name,{message:"Topic name",placeholder:"e.g. Product Updates"},{message:"Missing --name flag.",code:"missing_name"},r);await K({loading:"Creating topic...",sdkCall:o=>o.topics.create({name:n,defaultSubscription:e.defaultSubscription,...e.description&&{description:e.description}}),onInteractive:o=>{console.log(`Topic created: ${o.id}`)}},r)});var Kc=new m("delete").alias("rm").description("Delete a topic").argument("[id]","Topic UUID").option("--yes","Skip the confirmation prompt (required in non-interactive mode)").addHelpText("after",f({context:`Warning: Deleting a topic removes all contact subscriptions to that topic and may affect
|
|
691
692
|
broadcasts that reference this topic_id. Contacts themselves are not deleted.
|
|
692
693
|
|
|
693
|
-
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"topic","id":"<uuid>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend topics delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes","resend topics delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes --json"]})).action(async(t,
|
|
694
|
-
ID: ${
|
|
695
|
-
All contact subscriptions and broadcast associations will be removed.`,loading:"Deleting topic...",object:"topic",successMsg:"Topic deleted",sdkCall:
|
|
696
|
-
contacts is handled via "resend contacts topics <contactId>".`,output:' {"data":[{"id":"<uuid>","name":"<name>","description":"<desc>","default_subscription":"opt_in|opt_out","created_at":"<iso-date>"}]}',errorCodes:["auth_error","list_error"],examples:["resend topics list","resend topics list --json"]})).action(async(t
|
|
694
|
+
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"topic","id":"<uuid>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend topics delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes","resend topics delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await le(e,mt,n);await ne(o.id,!!t.yes,{confirmMessage:`Delete topic "${o.label}"?
|
|
695
|
+
ID: ${o.id}
|
|
696
|
+
All contact subscriptions and broadcast associations will be removed.`,loading:"Deleting topic...",object:"topic",successMsg:"Topic deleted",sdkCall:i=>i.topics.remove(o.id)},n)});var zc=new m("get").description("Retrieve a topic by ID").argument("[id]","Topic UUID").addHelpText("after",f({output:' {"id":"<uuid>","name":"<name>","description":"<desc>","default_subscription":"opt_in|opt_out","created_at":"<iso-date>"}',errorCodes:["auth_error","fetch_error"],examples:["resend topics get 78261eea-8f8b-4381-83c6-79fa7120f1cf","resend topics get 78261eea-8f8b-4381-83c6-79fa7120f1cf --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,mt,n);await G({loading:"Fetching topic...",sdkCall:i=>i.topics.get(o),onInteractive:i=>{console.log(`${i.name}`),console.log(`ID: ${i.id}`),i.description&&console.log(`Description: ${i.description}`),console.log(`Default subscription: ${i.default_subscription}`),console.log(`Created: ${i.created_at}`)}},n)});var Jc=new m("list").alias("ls").description("List all topics").addHelpText("after",f({context:`Returns all topics in your account. Topic subscription management for individual
|
|
697
|
+
contacts is handled via "resend contacts topics <contactId>".`,output:' {"data":[{"id":"<uuid>","name":"<name>","description":"<desc>","default_subscription":"opt_in|opt_out","created_at":"<iso-date>"}]}',errorCodes:["auth_error","list_error"],examples:["resend topics list","resend topics list --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals();await O({loading:"Fetching topics...",sdkCall:n=>n.topics.list(),onInteractive:n=>console.log(Oa(n.data))},r)});var Yc=new m("update").description("Update a topic's name or description").argument("[id]","Topic UUID").option("--name <name>","New topic name").option("--description <description>","New description shown to contacts").addHelpText("after",f({context:`At least one of --name or --description must be provided to update the topic.
|
|
697
698
|
|
|
698
699
|
Note: --default-subscription cannot be changed after creation.
|
|
699
|
-
To change the default subscription, delete the topic and recreate it.`,output:' {"id":"<uuid>"}',errorCodes:["auth_error","no_changes","update_error"],examples:['resend topics update 78261eea-8f8b-4381-83c6-79fa7120f1cf --name "Security Alerts"','resend topics update 78261eea-8f8b-4381-83c6-79fa7120f1cf --description "Critical notices" --json']})).action(async(t,
|
|
700
|
+
To change the default subscription, delete the topic and recreate it.`,output:' {"id":"<uuid>"}',errorCodes:["auth_error","no_changes","update_error"],examples:['resend topics update 78261eea-8f8b-4381-83c6-79fa7120f1cf --name "Security Alerts"','resend topics update 78261eea-8f8b-4381-83c6-79fa7120f1cf --description "Critical notices" --json']})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,mt,n);!t.name&&!t.description&&h({message:"Provide at least one option to update: --name or --description.",code:"no_changes"},{json:n.json}),await R({loading:"Updating topic...",sdkCall:i=>i.topics.update({id:o,...t.name&&{name:t.name},...t.description&&{description:t.description}}),errorCode:"update_error",successMsg:`Topic updated: ${o}`},n)});var Qc=new m("topics").description("Manage topics for contact subscription preferences").addHelpText("after",f({context:`Topics enable fine-grained subscription management beyond the global unsubscribe flag.
|
|
700
701
|
A contact can opt in or out of individual topics independently.
|
|
701
702
|
|
|
702
703
|
Broadcasts can target a topic_id so only contacts who have opted into that topic
|
|
@@ -709,11 +710,11 @@ Subscription states:
|
|
|
709
710
|
|
|
710
711
|
Contact topic subscriptions are managed via the contacts namespace:
|
|
711
712
|
resend contacts topics <contactId>
|
|
712
|
-
resend contacts update-topics <contactId> --topic-id <id> --subscription opt_in`,examples:["resend topics list",'resend topics create --name "Product Updates"','resend topics create --name "Weekly Digest" --default-subscription opt_out',"resend topics get 78261eea-8f8b-4381-83c6-79fa7120f1cf",'resend topics update 78261eea-8f8b-4381-83c6-79fa7120f1cf --name "Security Alerts"',"resend topics delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes"]})).addCommand(
|
|
713
|
+
resend contacts update-topics <contactId> --topic-id <id> --subscription opt_in`,examples:["resend topics list",'resend topics create --name "Product Updates"','resend topics create --name "Weekly Digest" --default-subscription opt_out',"resend topics get 78261eea-8f8b-4381-83c6-79fa7120f1cf",'resend topics update 78261eea-8f8b-4381-83c6-79fa7120f1cf --name "Security Alerts"',"resend topics delete 78261eea-8f8b-4381-83c6-79fa7120f1cf --yes"]})).addCommand(Vc).addCommand(zc).addCommand(Jc,{isDefault:!0}).addCommand(Yc).addCommand(Kc);J();pr();yt();var Xc=new m("update").description("Check for available CLI updates").addHelpText("after",f({context:`Checks the latest release on GitHub (bypasses the cache).
|
|
713
714
|
Shows the current version, latest version, and how to upgrade.`,output:` {"current":"1.4.0","latest":"1.5.0","update_available":true,"upgrade_command":"npm install -g resend-cli"}
|
|
714
|
-
{"current":"1.5.0","latest":"1.5.0","update_available":false}`,examples:["resend update","resend update --json"]})).action(async(t
|
|
715
|
+
{"current":"1.5.0","latest":"1.5.0","update_available":false}`,examples:["resend update","resend update --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),o=w()&&!r.json?re("Checking for updates..."):null,i=await Ao();if(!i){o?.fail("Could not check for updates"),h({message:"Could not reach GitHub releases",code:"fetch_failed"},{json:r.json});return}let s=ln(te,i),a=cn();if(r.json||!w()){N({current:te,latest:i,update_available:s,...s?{upgrade_command:a}:{}},{json:r.json});return}if(s){let l=a.startsWith("http");o?.warn(`Update available: v${te} \u2192 v${i}`),console.log(`
|
|
715
716
|
${l?"Visit":"Run"}: \x1B[36m${a}\x1B[0m
|
|
716
|
-
`)}else
|
|
717
|
+
`)}else o?.stop(`Already up to date (v${te})`)});J();var tt=["email.sent","email.delivered","email.delivery_delayed","email.bounced","email.complained","email.opened","email.clicked","email.failed","email.scheduled","email.suppressed","email.received","contact.created","contact.updated","contact.deleted","domain.created","domain.updated","domain.deleted"];function qt(e){return e.flatMap(t=>t.split(",")).map(t=>t.trim()).filter(Boolean)}var Ut={resource:"webhook",resourcePlural:"webhooks",fetchItems:(e,{limit:t,after:r})=>e.webhooks.list({limit:t,...r&&{after:r}}),display:e=>({label:e.endpoint,hint:e.id})};function Zc(e){let t=e.map(r=>{let n=(r.events??[]).join(", "),o=n.length>60?`${n.slice(0,57)}...`:n;return[r.endpoint,o,r.status,r.id]});return F(["Endpoint","Events","Status","ID"],t,"(no webhooks)")}var eu=new m("create").description("Register a new webhook endpoint to receive real-time event notifications").option("--endpoint <endpoint>","HTTPS URL to receive webhook events (required)").option("--events <events...>",'Event types to subscribe to (comma or space-separated). Use "all" for all 17 events.').addHelpText("after",f({context:`Webhooks deliver real-time event notifications to your HTTPS endpoint.
|
|
717
718
|
Events fire per-recipient: a batch email to 3 recipients generates 3 email.sent events.
|
|
718
719
|
|
|
719
720
|
--endpoint must use HTTPS.
|
|
@@ -734,20 +735,20 @@ The signing_secret in the response is shown ONCE \u2014 save it immediately to v
|
|
|
734
735
|
webhook payloads using Svix signature headers (svix-id, svix-timestamp, svix-signature).
|
|
735
736
|
Use resend.webhooks.verify() in your application to validate incoming payloads.
|
|
736
737
|
|
|
737
|
-
Non-interactive: --endpoint and --events are required.`,output:' {"object":"webhook","id":"<uuid>","signing_secret":"<whsec_...>"}',errorCodes:["auth_error","missing_endpoint","missing_events","create_error"],examples:["resend webhooks create --endpoint https://app.example.com/hooks/resend --events all","resend webhooks create --endpoint https://app.example.com/hooks/resend --events email.sent email.bounced","resend webhooks create --endpoint https://app.example.com/hooks/resend --events all --json"]})).action(async(t
|
|
738
|
+
Non-interactive: --endpoint and --events are required.`,output:' {"object":"webhook","id":"<uuid>","signing_secret":"<whsec_...>"}',errorCodes:["auth_error","missing_endpoint","missing_events","create_error"],examples:["resend webhooks create --endpoint https://app.example.com/hooks/resend --events all","resend webhooks create --endpoint https://app.example.com/hooks/resend --events email.sent email.bounced","resend webhooks create --endpoint https://app.example.com/hooks/resend --events all --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=await U(e.endpoint,{message:"Webhook endpoint URL",placeholder:"https://your-app.com/webhooks/resend",validate:s=>{if(!s)return"Endpoint URL is required";if(!s.startsWith("https://"))return"Endpoint must use HTTPS"}},{message:"Missing --endpoint flag.",code:"missing_endpoint"},r),o,i=e.events?.length?qt(e.events):void 0;if(i?.includes("all"))o=tt;else if(i?.length)o=i;else{(!w()||r.json)&&h({message:"Missing --events flag.",code:"missing_events"},{json:r.json});let s=await Ai({message:"Select event types to subscribe to",options:tt.map(a=>({value:a,label:a}))});$(s)&&S("Cancelled."),o=s}await K({loading:"Creating webhook...",sdkCall:s=>s.webhooks.create({endpoint:n,events:o}),onInteractive:s=>{console.log("Webhook created"),console.log(`ID: ${s.id}`),console.log(`Signing Secret: ${s.signing_secret}`),console.log("Save the signing secret \u2014 it is only shown once.")}},r)});var tu=new m("delete").alias("rm").description("Delete a webhook endpoint and stop all event deliveries to it").argument("[id]","Webhook UUID").option("--yes","Skip the confirmation prompt (required in non-interactive mode)").addHelpText("after",f({context:`Warning: Deleting a webhook immediately stops event delivery to the endpoint.
|
|
738
739
|
In-flight events may still be attempted once before the deletion takes effect.
|
|
739
740
|
To temporarily pause delivery without losing configuration, use:
|
|
740
741
|
resend webhooks update <id> --status disabled
|
|
741
742
|
|
|
742
|
-
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"webhook","id":"<uuid>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend webhooks delete wh_abc123 --yes","resend webhooks delete wh_abc123 --yes --json"]})).action(async(t,
|
|
743
|
-
ID: ${
|
|
744
|
-
Events will no longer be delivered to this endpoint.`,loading:"Deleting webhook...",object:"webhook",successMsg:"Webhook deleted",sdkCall:
|
|
745
|
-
To rotate secrets, delete the webhook and recreate it.`,output:' {"object":"webhook","id":"<uuid>","endpoint":"<url>","events":["<event>"],"status":"enabled|disabled","created_at":"<iso-date>","signing_secret":"<whsec_...>"}',errorCodes:["auth_error","fetch_error"],examples:["resend webhooks get wh_abc123","resend webhooks get wh_abc123 --json"]})).action(async(t,
|
|
743
|
+
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,output:' {"object":"webhook","id":"<uuid>","deleted":true}',errorCodes:["auth_error","confirmation_required","delete_error"],examples:["resend webhooks delete wh_abc123 --yes","resend webhooks delete wh_abc123 --yes --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await le(e,Ut,n);await ne(o.id,!!t.yes,{confirmMessage:`Delete webhook "${o.label}"?
|
|
744
|
+
ID: ${o.id}
|
|
745
|
+
Events will no longer be delivered to this endpoint.`,loading:"Deleting webhook...",object:"webhook",successMsg:"Webhook deleted",sdkCall:i=>i.webhooks.remove(o.id)},n)});var ru=new m("get").description("Retrieve a webhook endpoint configuration by ID").argument("[id]","Webhook UUID").addHelpText("after",f({context:`Note: The signing_secret is not returned by the get endpoint.
|
|
746
|
+
To rotate secrets, delete the webhook and recreate it.`,output:' {"object":"webhook","id":"<uuid>","endpoint":"<url>","events":["<event>"],"status":"enabled|disabled","created_at":"<iso-date>","signing_secret":"<whsec_...>"}',errorCodes:["auth_error","fetch_error"],examples:["resend webhooks get wh_abc123","resend webhooks get wh_abc123 --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Ut,n);await G({loading:"Fetching webhook...",sdkCall:i=>i.webhooks.get(o),onInteractive:i=>{console.log(`${i.endpoint}`),console.log(`ID: ${i.id}`),console.log(`Status: ${i.status}`),console.log(`Events: ${(i.events??[]).join(", ")||"(none)"}`),console.log(`Created: ${i.created_at}`)}},n)});var nu=new m("list").alias("ls").description("List all registered webhook endpoints").option("--limit <n>","Maximum number of webhooks to return (1-100)","10").option("--after <cursor>","Return webhooks after this cursor (next page)").option("--before <cursor>","Return webhooks before this cursor (previous page)").addHelpText("after",f({context:`Pagination: use --after or --before with a webhook ID as the cursor.
|
|
746
747
|
Only one of --after or --before may be used at a time.
|
|
747
|
-
The response includes has_more: true when additional pages exist.`,output:' {"object":"list","data":[{"id":"<uuid>","endpoint":"<url>","events":["<event>"],"status":"enabled","created_at":"<iso-date>"}],"has_more":false}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend webhooks list","resend webhooks list --limit 25 --json","resend webhooks list --after wh_abc123 --json"]})).action(async(t
|
|
748
|
-
Cleaning up...`);try{await
|
|
749
|
-
`)}catch{process.stderr.write(` Failed to delete webhook ${
|
|
750
|
-
`)}r.close()}var
|
|
748
|
+
The response includes has_more: true when additional pages exist.`,output:' {"object":"list","data":[{"id":"<uuid>","endpoint":"<url>","events":["<event>"],"status":"enabled","created_at":"<iso-date>"}],"has_more":false}',errorCodes:["auth_error","invalid_limit","list_error"],examples:["resend webhooks list","resend webhooks list --limit 25 --json","resend webhooks list --after wh_abc123 --json"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=L(e.limit,r),o=H(n,e.after,e.before,r);await O({loading:"Fetching webhooks...",sdkCall:i=>i.webhooks.list(o),onInteractive:i=>{console.log(Zc(i.data)),M(i,"webhooks list",{limit:n,before:e.before,apiKey:r.apiKey,profile:r.profile})}},r)});var iu=require("node:http");var ge=pe(rt(),1);J();function ou(e){return e?"error"in e?e.timeout?{status:504,body:"Forward target timed out"}:{status:502,body:"Forward target unreachable"}:e.status>=200&&e.status<300?{status:200,body:"OK"}:{status:e.status,body:"Forward target failed"}:{status:200,body:"OK"}}var su=["svix-id","svix-timestamp","svix-signature"],Tp=3e4;function Op(){return new Date().toLocaleTimeString("en-GB",{hour12:!1})}function Ip(e){let t=ke(e.type??"unknown"),r=e.data??{},n=ke(r.id??""),o="";if(t.startsWith("email.")){let i=ke(r.from??""),s=ke(Array.isArray(r.to)?r.to[0]:"");(i||s)&&(o=`${i} -> ${s}`)}else t.startsWith("domain.")?o=ke(r.name??""):t.startsWith("contact.")&&(o=ke(r.email??""));return{type:t,resourceId:n,detail:o}}function Pp(e){let t=`${e} ${jp(e)}`;return e>=200&&e<300?ge.default.green(t):e>=400&&e<500?ge.default.yellow(t):ge.default.red(t)}function jp(e){return{200:"OK",201:"Created",204:"No Content",400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"}[e]??""}async function Rp(e,t,r){let n={"content-type":"application/json"};for(let s of su){let a=r[s];a&&(n[s]=a)}let o=e.startsWith("http")?e:`http://${e}`;return{status:(await fetch(o,{method:"POST",headers:n,body:t,signal:AbortSignal.timeout(Tp)})).status}}function Fp(e){return new Promise((t,r)=>{let n=[];e.on("data",o=>n.push(o)),e.on("end",()=>t(Buffer.concat(n).toString())),e.on("error",r)})}async function Np(e,t,r){process.stderr.write(`
|
|
749
|
+
Cleaning up...`);try{await e.webhooks.remove(t),process.stderr.write(` Webhook ${t} deleted.
|
|
750
|
+
`)}catch{process.stderr.write(` Failed to delete webhook ${t}.
|
|
751
|
+
`)}r.close()}var au=new m("listen").description("Listen for webhook events locally during development").option("--url <url>","Public URL for receiving webhooks (your tunnel URL)").option("--forward-to <url>","Forward payloads to this local URL").option("--events <events...>","Event types to listen for (default: all)").option("--port <port>","Local server port","4318").addHelpText("after",f({context:`Start a local server that receives Resend webhook events in real time.
|
|
751
752
|
|
|
752
753
|
You must provide a public URL (e.g. from ngrok or localtunnel) that
|
|
753
754
|
points to the local server port. The CLI will:
|
|
@@ -758,26 +759,26 @@ points to the local server port. The CLI will:
|
|
|
758
759
|
5. Delete the temporary webhook on exit (Ctrl+C)
|
|
759
760
|
|
|
760
761
|
Important: your tunnel must forward traffic to the same port as --port (default 4318).
|
|
761
|
-
For example, if using ngrok: ngrok http 4318`,examples:["resend webhooks listen --url https://example.ngrok-free.app","resend webhooks listen --url https://example.ngrok-free.app --forward-to localhost:3000/webhook","resend webhooks listen --url https://example.ngrok-free.app --events email.sent email.bounced","resend webhooks listen --url https://example.ngrok-free.app --port 8080"]})).action(async(t
|
|
762
|
-
`),
|
|
763
|
-
`):process.stderr.write(`${
|
|
764
|
-
`)}}let T=
|
|
765
|
-
`),process.stderr.write(` ${
|
|
766
|
-
`),process.stderr.write(` ${
|
|
767
|
-
`),process.stderr.write(` ${
|
|
768
|
-
`),process.stderr.write(` ${
|
|
769
|
-
`),
|
|
762
|
+
For example, if using ngrok: ngrok http 4318`,examples:["resend webhooks listen --url https://example.ngrok-free.app","resend webhooks listen --url https://example.ngrok-free.app --forward-to localhost:3000/webhook","resend webhooks listen --url https://example.ngrok-free.app --events email.sent email.bounced","resend webhooks listen --url https://example.ngrok-free.app --port 8080"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=await U(e.url,{message:"Public tunnel URL",placeholder:"https://example.ngrok-free.app",validate:g=>{if(!g)return"URL is required";if(!g.startsWith("https://")&&!g.startsWith("http://"))return"URL must start with http:// or https://"}},{message:"Missing --url flag.",code:"missing_url"},r),o=Number.parseInt(e.port??"4318",10);(Number.isNaN(o)||o<1||o>65535)&&h({message:"Invalid port number.",code:"invalid_port"},{json:r.json});let i=e.events?.length?qt(e.events):void 0,s;i?.includes("all")?s=tt:i?.length?s=i:s=tt;let a=await Z(r),l=r.json||!w(),d=(0,iu.createServer)(async(g,b)=>{try{if(g.method!=="POST"){b.writeHead(405).end("Method not allowed");return}let _=await Fp(g),k;try{k=JSON.parse(_)}catch{b.writeHead(400).end("Invalid JSON");return}let x={};for(let E of su){let P=g.headers[E];x[E]=Array.isArray(P)?P[0]:P}let{type:A,resourceId:B,detail:D}=Ip(k),I;if(e.forwardTo)try{let{status:E}=await Rp(e.forwardTo,_,x);I={status:E}}catch(E){let P=E instanceof DOMException&&E.name==="TimeoutError";I={error:E instanceof Error?E.message:"Unknown error",timeout:P}}if(l){let E={timestamp:new Date().toISOString(),type:A,resource_id:B,payload:k};e.forwardTo&&I&&(E.forwarded="error"in I?{url:e.forwardTo,error:I.error}:{url:e.forwardTo,status:I.status}),console.log(JSON.stringify(E))}else{let E=ge.default.dim(`[${Op()}]`),P=A.padEnd(20),be=B.padEnd(14);if(process.stderr.write(`${E} ${ge.default.bold(P)} ${ge.default.cyan(be)} ${D}
|
|
763
|
+
`),e.forwardTo&&I){let ee=e.forwardTo.startsWith("http")?e.forwardTo:`http://${e.forwardTo}`;"error"in I?process.stderr.write(`${ge.default.dim(" -> POST")} ${ee} ${ge.default.red(`[Error: ${I.error}]`)}
|
|
764
|
+
`):process.stderr.write(`${ge.default.dim(" -> POST")} ${ee} ${ge.default.dim(`[${Pp(I.status)}]`)}
|
|
765
|
+
`)}}let T=ou(I);b.writeHead(T.status).end(T.body)}catch{b.headersSent||b.writeHead(500).end("Internal error")}});try{await new Promise((g,b)=>{d.on("error",b),d.listen(o,g)})}catch(g){h({message:g instanceof Error?`Failed to start local server on port ${o}: ${g.message}`:`Failed to start local server on port ${o}`,code:"server_listen_error"},{json:r.json})}let c=re("Setting up webhook listener...",r.quiet),u;try{let{data:g,error:b}=await a.webhooks.create({endpoint:n,events:s});(b||!g)&&(c.fail("Failed to create webhook"),d.close(),h({message:b?.message??"Unexpected empty response",code:"create_error"},{json:r.json})),u=g.id}catch(g){c.fail("Failed to create webhook"),d.close(),h({message:g instanceof Error?g.message:"Unknown error",code:"create_error"},{json:r.json})}if(c.stop("Webhook listener ready"),!l){let g=s.length===tt.length?"all events":s.length<=3?s.join(", "):`${s.slice(0,3).join(", ")} (+${s.length-3} more)`;if(process.stderr.write(`
|
|
766
|
+
`),process.stderr.write(` ${ge.default.bold("Webhook:")} ${u}
|
|
767
|
+
`),process.stderr.write(` ${ge.default.bold("Endpoint:")} ${n}
|
|
768
|
+
`),process.stderr.write(` ${ge.default.bold("Events:")} ${g}
|
|
769
|
+
`),process.stderr.write(` ${ge.default.bold("Server:")} http://localhost:${o}
|
|
770
|
+
`),e.forwardTo){let b=e.forwardTo.startsWith("http")?e.forwardTo:`http://${e.forwardTo}`;process.stderr.write(` ${ge.default.bold("Forward:")} ${b}
|
|
770
771
|
`)}process.stderr.write(`
|
|
771
772
|
Ready! Listening for webhook events. Press Ctrl+C to stop.
|
|
772
773
|
|
|
773
|
-
`)}let p=!1,y=async()=>{p||(p=!0,await
|
|
774
|
+
`)}let p=!1,y=async()=>{p||(p=!0,await Np(a,u,d),process.exit(It()))};Wr(y),process.on("SIGTERM",y),await new Promise(()=>{})});var lu=new m("update").description("Update a webhook's endpoint URL, event subscriptions, or enabled status").argument("[id]","Webhook UUID").option("--endpoint <endpoint>","New HTTPS URL for this webhook").option("--events <events...>",'Replace the full event subscription list (comma or space-separated). Use "all" for all 17 events.').addOption(new Y("--status <status>","Enable or disable event delivery for this webhook").choices(["enabled","disabled"])).addHelpText("after",f({context:`At least one of --endpoint, --events, or --status must be provided.
|
|
774
775
|
|
|
775
776
|
--events replaces the entire event list (it is not additive).
|
|
776
777
|
Use "all" as a shorthand for all 17 event types.
|
|
777
778
|
|
|
778
779
|
--status controls whether events are delivered to this endpoint:
|
|
779
780
|
enabled Events are delivered (default on creation)
|
|
780
|
-
disabled Events are suppressed without deleting the webhook`,output:' {"object":"webhook","id":"<uuid>"}',errorCodes:["auth_error","no_changes","update_error"],examples:["resend webhooks update wh_abc123 --endpoint https://new-app.example.com/hooks/resend","resend webhooks update wh_abc123 --events email.sent email.bounced","resend webhooks update wh_abc123 --events all","resend webhooks update wh_abc123 --status disabled","resend webhooks update wh_abc123 --endpoint https://new-app.example.com/hooks/resend --events all --json"]})).action(async(t,
|
|
781
|
+
disabled Events are suppressed without deleting the webhook`,output:' {"object":"webhook","id":"<uuid>"}',errorCodes:["auth_error","no_changes","update_error"],examples:["resend webhooks update wh_abc123 --endpoint https://new-app.example.com/hooks/resend","resend webhooks update wh_abc123 --events email.sent email.bounced","resend webhooks update wh_abc123 --events all","resend webhooks update wh_abc123 --status disabled","resend webhooks update wh_abc123 --endpoint https://new-app.example.com/hooks/resend --events all --json"]})).action(async(e,t,r)=>{let n=r.optsWithGlobals(),o=await C(e,Ut,n),i=t.events?.length?qt(t.events):void 0,s=i!==void 0;!t.endpoint&&!s&&!t.status&&h({message:"Provide at least one option to update: --endpoint, --events, or --status.",code:"no_changes"},{json:n.json}),s&&!i.length&&h({message:"Missing --events values.",code:"no_changes"},{json:n.json});let a=i?.includes("all")?tt:i?.length?i:void 0;await R({loading:"Updating webhook...",sdkCall:l=>l.webhooks.update(o,{...t.endpoint&&{endpoint:t.endpoint},...a?.length&&{events:a},...t.status&&{status:t.status}}),errorCode:"update_error",successMsg:`Webhook updated: ${o}`},n)});var cu=new m("webhooks").description("Manage webhook endpoints for real-time event notifications").addHelpText("after",f({context:`Webhooks let you receive real-time event notifications from Resend at an HTTPS endpoint.
|
|
781
782
|
Payloads are signed with Svix headers for verification.
|
|
782
783
|
|
|
783
784
|
Event categories (17 total):
|
|
@@ -789,18 +790,18 @@ Event categories (17 total):
|
|
|
789
790
|
|
|
790
791
|
Signature verification (Svix):
|
|
791
792
|
Each delivery includes headers: svix-id, svix-timestamp, svix-signature
|
|
792
|
-
Verify payloads in your application using: resend.webhooks.verify({ payload, headers, webhookSecret })`,examples:["resend webhooks list","resend webhooks create --endpoint https://app.example.com/hooks/resend --events all","resend webhooks get wh_abc123","resend webhooks update wh_abc123 --status disabled","resend webhooks delete wh_abc123 --yes"]})).addCommand(
|
|
793
|
-
Shows which profile is active and where the
|
|
794
|
-
Available profiles: ${
|
|
793
|
+
Verify payloads in your application using: resend.webhooks.verify({ payload, headers, webhookSecret })`,examples:["resend webhooks list","resend webhooks create --endpoint https://app.example.com/hooks/resend --events all","resend webhooks get wh_abc123","resend webhooks update wh_abc123 --status disabled","resend webhooks delete wh_abc123 --yes"]})).addCommand(eu).addCommand(ru).addCommand(au).addCommand(nu,{isDefault:!0}).addCommand(lu).addCommand(tu);var du=require("node:path");fe();J();var uu={flag:"flag",env:"environment variable",config:"config file",secure_storage:"secure storage"},Bp={full_access:"full access",sending_access:"sending access"},mu=new m("whoami").description("Show current authentication status").addHelpText("after",f({setup:!0,context:`Local only \u2014 no network calls.
|
|
794
|
+
Shows which profile is active and where the active credential comes from.`,output:' {"authenticated":true,"profile":"production","api_key":"re_...abcd","source":"config","config_path":"/Users/you/.config/resend/credentials.json"}\n {"error":{"message":"Not authenticated.\\nRun `resend login` to get started.","code":"not_authenticated"}}',examples:["resend whoami","resend whoami --json","resend whoami --profile production"]})).action(async(e,t)=>{let r=t.optsWithGlobals(),n=r.profile,o=await _t(r.apiKey,n,{refresh:!1});if(!o){let p=n||Mr(n),y=xe(),g=y.some(x=>x.name===p),b=n||process.env.RESEND_PROFILE,_=b&&!g?`Profile "${p}" not found.
|
|
795
|
+
Available profiles: ${y.map(x=>x.name).join(", ")||"(none)"}`:"Not authenticated.\nRun `resend login` to get started.",k=b&&!g?"profile_not_found":"not_authenticated";r.json||!w()?h({message:_,code:k},{json:r.json}):h({message:_,code:k},{json:!1})}let i=o.profile??Mr(n),s=(0,du.join)(Ne(),"credentials.json"),a=o.type==="api_key"?o.key:o.access_token,l=o.source,d=o.type==="api_key"?o.permission:void 0;if(r.json||!w()){N({authenticated:!0,profile:i,api_key:dt(a),source:l,...d&&{permission:d},config_path:s},{json:r.json});return}let c=o.type==="oauth_grant"?`${uu[l]} (oauth)`:uu[l],u=d?Bp[d]:void 0;console.log(""),console.log(` Profile: ${i}`),console.log(o.type==="oauth_grant"?` Token: ${dt(a)}`:` API Key: ${dt(a)}`),console.log(` Source: ${c}`),u&&console.log(` Access: ${u}`),console.log(` Config: ${s}`),console.log("")});function pu(e,t={}){let r=t.getArgv??(()=>process.argv.slice(2)),n=[],o=[e];for(;o.length>0;){let i=o.pop();if(!i)break;n.push(i);for(let s of i.commands)o.push(s)}for(let i of n){let a=i.configureOutput().outputError??((l,d)=>d(l));i.configureOutput({outputError:(l,d)=>{a(Gp(l,e,r()),d)}})}}function Gp(e,t,r){if(!Hp(e))return e;let n=Lp(t,r);return n?Mp(e,n):e}function Lp(e,t){let r=e,n=[];for(let o=0;o<t.length;o+=1){let i=t[o];if(!i||i==="--")return;let s=o;if(i.startsWith("-")&&i!=="-"){let d=i.startsWith("--")?i.split("=",1)[0]:i.length>2?i.slice(0,2):i,c;for(let u of qp(r)){for(let p of u.createHelp().visibleOptions(u))if(p.long===d||p.short===d){c=p;break}if(c)break}if(!c)s=void 0;else if(!c.required&&!c.optional)s=o+1;else if(c.variadic)s=t.length;else if(i.startsWith("--")&&i.includes("="))s=o+1;else if(!i.startsWith("--")&&i.length>2)s=o+1;else{let u=t[o+1];c.optional&&(u===void 0||u.startsWith("-"))?s=o+1:s=Math.min(o+2,t.length)}}if(s===void 0)return;if(s!==o){o=s-1;continue}if(i.startsWith("-"))return;let a=Up(r).find(d=>hu(d).has(i));if(a){r=a,n.push(a.name());continue}let l=Wp(i,fu(r)).map(d=>[e.name(),...n,d.name()].join(" "));return l.length===0?void 0:{unknownCommand:i,suggestions:l}}}function Hp(e){return/^error: unknown command /.test(e)||/^error: too many arguments/.test(e)}function Mp(e,t){let r=e.endsWith(`
|
|
795
796
|
`)?`
|
|
796
|
-
`:"",{suggestions:n}=
|
|
797
|
-
`);return`error: unknown command '${
|
|
797
|
+
`:"",{suggestions:n}=t,o=n.length===1?"Did you mean this?":"Did you mean one of these?",i=n.map(s=>` ${s}`).join(`
|
|
798
|
+
`);return`error: unknown command '${t.unknownCommand}'
|
|
798
799
|
|
|
799
|
-
${
|
|
800
|
-
${
|
|
801
|
-
`);for(let
|
|
800
|
+
${o}
|
|
801
|
+
${i}${r}`}function qp(e){let t=[];for(let r=e;r;r=r.parent)t.push(r);return t}function fu(e){return e.createHelp().visibleCommands(e).filter(t=>!t._hidden)}function Up(e){let t=[...e.commands];for(let r of fu(e))t.includes(r)||t.push(r);return t}function hu(e){return new Set([e.name(),...e.aliases()])}function Wp(e,t){let r=t.map(o=>{let i=Number.POSITIVE_INFINITY;for(let s of hu(o)){if(s.length<=1)continue;let a=Vp(e,s,3),l=Math.max(e.length,s.length),d=(l-a)/l;a<=3&&d>.4&&a<i&&(i=a)}return{command:o,distance:i}}).filter(o=>Number.isFinite(o.distance));if(r.length===0)return[];let n=Math.min(...r.map(o=>o.distance));return r.filter(o=>o.distance===n).sort((o,i)=>o.command.name().localeCompare(i.command.name())).map(o=>o.command)}function Vp(e,t,r=Number.POSITIVE_INFINITY){if(Math.abs(e.length-t.length)>r)return Math.max(e.length,t.length);let n=[];for(let o=0;o<=e.length;o+=1)n[o]=[o];for(let o=0;o<=t.length;o+=1)n[0][o]=o;for(let o=1;o<=t.length;o+=1)for(let i=1;i<=e.length;i+=1){let s=e[i-1]===t[o-1]?0:1;n[i][o]=Math.min(n[i-1][o]+1,n[i][o-1]+1,n[i-1][o-1]+s),i>1&&o>1&&e[i-1]===t[o-2]&&e[i-2]===t[o-1]&&(n[i][o]=Math.min(n[i][o],n[i-2][o-2]+1))}return n[e.length][t.length]}var Kp=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 "," \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557"," \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551"," \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551"," \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D"," \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D "];function gu(){process.stdout.write(`
|
|
802
|
+
`);for(let e of Kp)process.stdout.write(`${e}
|
|
802
803
|
`);process.stdout.write(`
|
|
803
|
-
`)}
|
|
804
|
+
`)}Io();pr();yt();Bs();var Po="",ku=[],Au=[],ht=new m().name("resend").description("Resend CLI \u2014 email for developers").configureHelp({showGlobalOptions:!0,styleTitle:e=>Wt.default.gray(e)}).configureOutput({writeErr:e=>{process.stderr.write(e.replace(/^error:/,()=>Wt.default.red("error:")))}}).helpCommand(!0).version(`${Di} v${te}`,"-v, --version","Output the current version").option("--api-key <key>","Resend API key (overrides env/config)").option("-p, --profile <name>","Profile to use (overrides RESEND_PROFILE)").option("--json","Force JSON output").option("-q, --quiet","Suppress spinners and status output (implies --json)").option("--insecure-storage","Save API key as plaintext instead of secure storage").hook("preAction",(e,t)=>{let r=[];for(let o=t;o?.parent;o=o.parent)r.unshift(o.name());Po=r.join(" ");let n=o=>o.options.filter(i=>o.getOptionValueSource(i.attributeName())==="cli").map(i=>i.long?.replace(/^--/,"")??i.short?.replace(/^-/,"")??"").filter(Boolean);ku=n(t),Au=n(e),t.optsWithGlobals().quiet&&e.setOptionValue("json",!0),t.optsWithGlobals().insecureStorage&&(process.env.RESEND_CREDENTIAL_STORE="file")}).addHelpText("after",`
|
|
804
805
|
${Wt.default.gray("Examples:")}
|
|
805
806
|
|
|
806
807
|
- Login to Resend
|
|
@@ -810,4 +811,4 @@ ${Wt.default.gray("Examples:")}
|
|
|
810
811
|
- Send an email
|
|
811
812
|
|
|
812
813
|
${Wt.default.blue("$ resend emails send")}
|
|
813
|
-
`).action(()=>{process.stdout.isTTY&&
|
|
814
|
+
`).action(()=>{process.stdout.isTTY&&gu();let e=ht.opts();e.apiKey&&h({message:"--api-key is a per-command override and was not saved. To store your API key, run `resend login`.",code:"missing_command"},{json:e.json}),ht.help()}).addCommand(Yr).addCommand(pc).addCommand(Ha).addCommand(Ca).addCommand(_c).addCommand(Wc).addCommand(Al).addCommand(ol).addCommand(Rc).addCommand(Qc).addCommand(Ul).addCommand(Dc).addCommand(Zs).addCommand(cu).addCommand(la).addCommand(Qr).addCommand(mu).addCommand(Pl).addCommand(Sc).addCommand($l).addCommand(Xc).addCommand(Ka).addCommand(Qa),$u=new m("telemetry").description("Telemetry management").helpCommand(!1);$u.command("flush").argument("<file>").action(async e=>{let{flushFromFile:t}=await Promise.resolve().then(()=>(Io(),xu));await t(e)});ht.addCommand($u,{hidden:!0});pu(ht);ht.parseAsync().then(()=>{let e=ht.args[0];if(e==="update"||e==="telemetry")return;Po&&Oo(Po,{...ht.opts(),flags:ku,globalFlags:Au});let t=ht.opts();Ol({json:!!(t.json||t.quiet)}).catch(()=>{})}).catch(e=>{h({message:q(e,"An unexpected error occurred"),code:"unexpected_error"})});
|