@sequenzy/cli 0.0.213 → 0.0.215
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/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -329,7 +329,7 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
329
329
|
`)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
330
330
|
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;if((Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment")n?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(r&&t.sep&&!t.value){let o=[];for(let c=0;c<t.sep.length;++c){let l=t.sep[c];switch(l.type){case"newline":o.push(c);break;case"space":break;case"comment":if(l.indent>e.indent)o.length=0;break;default:o.length=0}}if(o.length>=2)i=t.sep.splice(o[1])}switch(this.type){case"anchor":case"tag":if(r||t.value)i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0;else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"explicit-key-ind":if(!t.sep&&!t.explicitKey)t.start.push(this.sourceToken),t.explicitKey=!0;else if(r||t.value)i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(!t.sep)if(Hl(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Rm(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Hl(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(X6(t.key)&&!Hl(t.sep,"newline")){let o=Rm(t.start),{key:c,sep:l}=t;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:c,sep:l}]})}else if(i.length>0)t.sep=t.sep.concat(i,this.sourceToken);else t.sep.push(this.sourceToken);else if(!t.sep)Object.assign(t,{key:null,sep:[this.sourceToken]});else if(t.value||r)e.items.push({start:i,key:null,sep:[this.sourceToken]});else if(Hl(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else t.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);if(r||t.value)e.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0;else if(t.sep)this.stack.push(o);else Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0;return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!Hl(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(n)e.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;if((Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment")n?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;if(t.value||Hl(t.start,"seq-item-ind"))e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!t||t.sep)e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return;case"map-value-ind":if(!t||t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!t||t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);if(!t||t.value)e.items.push({start:[],key:r,sep:[]});else if(t.sep)this.stack.push(r);else Object.assign(t,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);if(n)this.stack.push(n);else yield*this.pop(),yield*this.step()}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let r=jI(n),i=Rm(r);Z6(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let c={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=c}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
331
331
|
`)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
332
|
-
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=jI(e),n=Rm(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=jI(e),n=Rm(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){if(this.type!=="comment")return!1;if(this.indent<=t)return!1;return e.every((n)=>n.type==="newline"||n.type==="space")}*documentEnd(e){if(this.type!=="doc-mode"){if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}LNe.Parser=e9});var o9=P(function(VNe){var t9=tR(),MNe=NA(),LA=$A(),jNe=dk(),zNe=nn(),GNe=dR(),n9=pR();function r9(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new GNe.LineCounter||null,prettyErrors:t}}function HNe(e,t={}){let{lineCounter:n,prettyErrors:r}=r9(t),i=new n9.Parser(n?.addNewLine),o=new t9.Composer(t),c=Array.from(o.compose(i.parse(e)));if(r&&n)for(let l of c)l.errors.forEach(LA.prettifyError(e,n)),l.warnings.forEach(LA.prettifyError(e,n));if(c.length>0)return c;return Object.assign([],{empty:!0},o.streamInfo())}function i9(e,t={}){let{lineCounter:n,prettyErrors:r}=r9(t),i=new n9.Parser(n?.addNewLine),o=new t9.Composer(t),c=null;for(let l of o.compose(i.parse(e),!0,e.length))if(!c)c=l;else if(c.options.logLevel!=="silent"){c.errors.push(new LA.YAMLParseError(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(r&&n)c.errors.forEach(LA.prettifyError(e,n)),c.warnings.forEach(LA.prettifyError(e,n));return c}function JNe(e,t,n){let r=void 0;if(typeof t==="function")r=t;else if(n===void 0&&t&&typeof t==="object")n=t;let i=i9(e,n);if(!i)return null;if(i.warnings.forEach((o)=>jNe.warn(i.options.logLevel,o)),i.errors.length>0)if(i.options.logLevel!=="silent")throw i.errors[0];else i.errors=[];return i.toJS(Object.assign({reviver:r},n))}function KNe(e,t,n){let r=null;if(typeof t==="function"||Array.isArray(t))r=t;else if(n===void 0&&t)n=t;if(typeof n==="string")n=n.length;if(typeof n==="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){let{keepUndefined:i}=n??t??{};if(!i)return}if(zNe.isDocument(e)&&!r)return e.toString(n);return new MNe.Document(e,r,n).toString(n)}VNe.parse=JNe;VNe.parseAllDocuments=HNe;VNe.parseDocument=i9;VNe.stringify=KNe});var P0={};Vne(P0,{program:()=>oP,createCommand:()=>sP,createOption:()=>aP,createArgument:()=>cP,Command:()=>lP,Option:()=>uP,Argument:()=>dP,Help:()=>pP,CommanderError:()=>mP,InvalidArgumentError:()=>fP,InvalidOptionArgumentError:()=>gP},{program:(Qje)=>oP=Qje,createCommand:(Qje)=>sP=Qje,createOption:(Qje)=>aP=Qje,createArgument:(Qje)=>cP=Qje,Command:(Qje)=>lP=Qje,Option:(Qje)=>uP=Qje,Argument:(Qje)=>dP=Qje,Help:(Qje)=>pP=Qje,CommanderError:(Qje)=>mP=Qje,InvalidArgumentError:(Qje)=>fP=Qje,InvalidOptionArgumentError:(Qje)=>gP=Qje});var{Argument:nP}=Jy(),{Command:$0}=tP(),{CommanderError:Sre,InvalidArgumentError:rP}=Wf(),{Help:Dre}=R0(),{Option:iP}=T0();var oP=new $0,sP=(e)=>new $0(e),aP=(e,t)=>new iP(e,t),cP=(e,t)=>new nP(e,t),lP=$0,uP=iP,dP=nP,pP=Dre,mP=Sre,fP=rP,gP=rP;var{program:Fje,createCommand:Lje,createArgument:Uje,createOption:Mje,CommanderError:AP,InvalidArgumentError:jje,InvalidOptionArgumentError:zje,Command:hP,Argument:Gje,Option:Hje,Help:Jje}=P0;var Ky={name:"@sequenzy/cli",version:"0.0.213",description:"Sequenzy CLI for email marketing from the terminal",type:"module",bin:{sequenzy:"./dist/index.js"},main:"./src/index.tsx",types:"./src/index.tsx",exports:{".":"./src/index.tsx"},scripts:{dev:"bun --watch src/index.tsx",build:"bun ../../scripts/build-ink-cli.ts",start:"node dist/index.js",lint:"eslint src","type-check":"bun check",test:"sh ../../scripts/run-package-tests.sh src","test:watch":"bun test --watch",prepublishOnly:"bun run build"},dependencies:{commander:"^12.1.0",ink:"^5.0.1","ink-spinner":"^5.0.0","ink-text-input":"^6.0.0","ink-select-input":"^6.0.0","ink-table":"^3.1.0",open:"^10.1.0",react:"^18.3.1",conf:"^13.0.0",yaml:"^2.8.2"},devDependencies:{"@emailer/shared":"workspace:*","@types/bun":"latest","@types/node":"^22.0.0","@types/react":"^18.3.0","bun-types":"latest",typescript:"^7.0.2"},files:["dist"],keywords:["sequenzy","email","cli","marketing"],license:"MIT",repository:{type:"git",url:"https://github.com/sequenzy/sequenzy"}};import{isDeepStrictEqual as Lge}from"node:util";import uj from"node:process";import Fu from"node:fs";import dj from"node:path";import Eg from"node:crypto";import Uge from"node:assert";var Tu=(e)=>{let t=typeof e;return e!==null&&(t==="object"||t==="function")};var Q0=new Set(["__proto__","prototype","constructor"]),xre=new Set("0123456789");function Vy(e){let t=[],n="",r="start",i=!1;for(let o of e)switch(o){case"\\":{if(r==="index")throw Error("Invalid character in an index");if(r==="indexEnd")throw Error("Invalid character after an index");if(i)n+=o;r="property",i=!i;break}case".":{if(r==="index")throw Error("Invalid character in an index");if(r==="indexEnd"){r="property";break}if(i){i=!1,n+=o;break}if(Q0.has(n))return[];t.push(n),n="",r="property";break}case"[":{if(r==="index")throw Error("Invalid character in an index");if(r==="indexEnd"){r="index";break}if(i){i=!1,n+=o;break}if(r==="property"){if(Q0.has(n))return[];t.push(n),n=""}r="index";break}case"]":{if(r==="index"){t.push(Number.parseInt(n,10)),n="",r="indexEnd";break}if(r==="indexEnd")throw Error("Invalid character after an index")}default:{if(r==="index"&&!xre.has(o))throw Error("Invalid character in an index");if(r==="indexEnd")throw Error("Invalid character after an index");if(r==="start")r="property";if(i)i=!1,n+="\\";n+=o}}if(i)n+="\\";switch(r){case"property":{if(Q0.has(n))return[];t.push(n);break}case"index":throw Error("Index was not closed");case"start":{t.push("");break}}return t}function q0(e,t){if(typeof t!=="number"&&Array.isArray(e)){let n=Number.parseInt(t,10);return Number.isInteger(n)&&e[n]===e[t]}return!1}function yP(e,t){if(q0(e,t))throw Error("Cannot use string index")}function bP(e,t,n){if(!Tu(e)||typeof t!=="string")return n===void 0?e:n;let r=Vy(t);if(r.length===0)return n;for(let i=0;i<r.length;i++){let o=r[i];if(q0(e,o))e=i===r.length-1?void 0:null;else e=e[o];if(e===void 0||e===null){if(i!==r.length-1)return n;break}}return e===void 0?n:e}function F0(e,t,n){if(!Tu(e)||typeof t!=="string")return e;let r=e,i=Vy(t);for(let o=0;o<i.length;o++){let c=i[o];if(yP(e,c),o===i.length-1)e[c]=n;else if(!Tu(e[c]))e[c]=typeof i[o+1]==="number"?[]:{};e=e[c]}return r}function vP(e,t){if(!Tu(e)||typeof t!=="string")return!1;let n=Vy(t);for(let r=0;r<n.length;r++){let i=n[r];if(yP(e,i),r===n.length-1)return delete e[i],!0;if(e=e[i],!Tu(e))return!1}}function EP(e,t){if(!Tu(e)||typeof t!=="string")return!1;let n=Vy(t);if(n.length===0)return!1;for(let r of n){if(!Tu(e)||!(r in e)||q0(e,r))return!1;e=e[r]}return!0}import er from"node:path";import IP from"node:os";import L0 from"node:process";var tl=IP.homedir(),U0=IP.tmpdir(),{env:fp}=L0,Bre=(e)=>{let t=er.join(tl,"Library");return{data:er.join(t,"Application Support",e),config:er.join(t,"Preferences",e),cache:er.join(t,"Caches",e),log:er.join(t,"Logs",e),temp:er.join(U0,e)}},kre=(e)=>{let t=fp.APPDATA||er.join(tl,"AppData","Roaming"),n=fp.LOCALAPPDATA||er.join(tl,"AppData","Local");return{data:er.join(n,e,"Data"),config:er.join(t,e,"Config"),cache:er.join(n,e,"Cache"),log:er.join(n,e,"Log"),temp:er.join(U0,e)}},Rre=(e)=>{let t=er.basename(tl);return{data:er.join(fp.XDG_DATA_HOME||er.join(tl,".local","share"),e),config:er.join(fp.XDG_CONFIG_HOME||er.join(tl,".config"),e),cache:er.join(fp.XDG_CACHE_HOME||er.join(tl,".cache"),e),log:er.join(fp.XDG_STATE_HOME||er.join(tl,".local","state"),e),temp:er.join(U0,t,e)}};function M0(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(L0.platform==="darwin")return Bre(e);if(L0.platform==="win32")return kre(e);return Rre(e)}import Fre from"node:path";import an from"node:fs";import{promisify as Bi}from"node:util";var Tre=(e,t)=>{let{onError:n}=t;return function(...i){return e.apply(void 0,i).catch(n)}},ha=Tre;var Ore=(e,t)=>{let{onError:n}=t;return function(...i){try{return e.apply(void 0,i)}catch(o){return n(o)}}},ks=Ore;var CP=250;var Nre=(e,t)=>{let{isRetriable:n}=t;return function(i){let{timeout:o}=i,c=i.interval??CP,l=Date.now()+o;return function d(...m){return e.apply(void 0,m).catch((A)=>{if(!n(A))throw A;if(Date.now()>=l)throw A;let y=Math.round(c*Math.random());if(y>0)return new Promise((v)=>setTimeout(v,y)).then(()=>d.apply(void 0,m));else return d.apply(void 0,m)})}}},ya=Nre;var $re=(e,t)=>{let{isRetriable:n}=t;return function(i){let{timeout:o}=i,c=Date.now()+o;return function(...d){while(!0)try{return e.apply(void 0,d)}catch(m){if(!n(m))throw m;if(Date.now()>=c)throw m;continue}}}},ba=$re;import SP from"node:process";var Yf={isChangeErrorOk:(e)=>{if(!Yf.isNodeError(e))return!1;let{code:t}=e;if(t==="ENOSYS")return!0;if(!wP&&(t==="EINVAL"||t==="EPERM"))return!0;return!1},isNodeError:(e)=>e instanceof Error,isRetriableError:(e)=>{if(!Yf.isNodeError(e))return!1;let{code:t}=e;if(t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM")return!0;return!1},onChangeError:(e)=>{if(!Yf.isNodeError(e))throw e;if(Yf.isChangeErrorOk(e))return;throw e}},j0=Yf;var Zf={onError:j0.onChangeError},ao={onError:()=>{return}},wP=SP.getuid?!SP.getuid():!1,Ii={isRetriable:j0.isRetriableError};var Pre={attempt:{chmod:ha(Bi(an.chmod),Zf),chown:ha(Bi(an.chown),Zf),close:ha(Bi(an.close),ao),fsync:ha(Bi(an.fsync),ao),mkdir:ha(Bi(an.mkdir),ao),realpath:ha(Bi(an.realpath),ao),stat:ha(Bi(an.stat),ao),unlink:ha(Bi(an.unlink),ao),chmodSync:ks(an.chmodSync,Zf),chownSync:ks(an.chownSync,Zf),closeSync:ks(an.closeSync,ao),existsSync:ks(an.existsSync,ao),fsyncSync:ks(an.fsync,ao),mkdirSync:ks(an.mkdirSync,ao),realpathSync:ks(an.realpathSync,ao),statSync:ks(an.statSync,ao),unlinkSync:ks(an.unlinkSync,ao)},retry:{close:ya(Bi(an.close),Ii),fsync:ya(Bi(an.fsync),Ii),open:ya(Bi(an.open),Ii),readFile:ya(Bi(an.readFile),Ii),rename:ya(Bi(an.rename),Ii),stat:ya(Bi(an.stat),Ii),write:ya(Bi(an.write),Ii),writeFile:ya(Bi(an.writeFile),Ii),closeSync:ba(an.closeSync,Ii),fsyncSync:ba(an.fsyncSync,Ii),openSync:ba(an.openSync,Ii),readFileSync:ba(an.readFileSync,Ii),renameSync:ba(an.renameSync,Ii),statSync:ba(an.statSync,Ii),writeSync:ba(an.writeSync,Ii),writeFileSync:ba(an.writeFileSync,Ii)}},oi=Pre;import Ou from"node:process";var DP="utf8",z0=438,_P=511;var xP={},BP=Ou.geteuid?Ou.geteuid():-1,kP=Ou.getegid?Ou.getegid():-1;var RP=1000,TP=!!Ou.getuid,wze=Ou.getuid?!Ou.getuid():!1,G0=128;var OP=(e)=>e instanceof Error&&("code"in e);var H0=(e)=>typeof e==="string",Wy=(e)=>e===void 0;import qre from"node:path";import gp from"node:process";import NP from"node:process";var $P=NP.platform==="linux",Yy=NP.platform==="win32";var J0=["SIGHUP","SIGINT","SIGTERM"];if(!Yy)J0.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if($P)J0.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var PP=J0;class QP{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=(e)=>{if(this.exited)return;this.exited=!0;for(let t of this.callbacks)t();if(e)if(Yy&&(e!=="SIGINT"&&e!=="SIGTERM"&&e!=="SIGKILL"))gp.kill(gp.pid,"SIGTERM");else gp.kill(gp.pid,e)},this.hook=()=>{gp.once("exit",()=>this.exit());for(let e of PP)try{gp.once(e,()=>this.exit(e))}catch{}},this.register=(e)=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}}var qP=new QP;var Qre=qP.register,FP=Qre;var Oo={store:{},create:(e)=>{let t=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),n=Date.now().toString().slice(-10),r="tmp-",i=`.tmp-${n}${t}`;return`${e}${i}`},get:(e,t,n=!0)=>{let r=Oo.truncate(t(e));if(r in Oo.store)return Oo.get(e,t,n);return Oo.store[r]=n,[r,()=>delete Oo.store[r]]},purge:(e)=>{if(!Oo.store[e])return;delete Oo.store[e],oi.attempt.unlink(e)},purgeSync:(e)=>{if(!Oo.store[e])return;delete Oo.store[e],oi.attempt.unlinkSync(e)},purgeSyncAll:()=>{for(let e in Oo.store)Oo.purgeSync(e)},truncate:(e)=>{let t=qre.basename(e);if(t.length<=G0)return e;let n=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!n)return e;let r=t.length-G0;return`${e.slice(0,-t.length)}${n[1]}${n[2].slice(0,-r)}${n[3]}`}};FP(Oo.purgeSyncAll);var Xf=Oo;function K0(e,t,n=xP){if(H0(n))return K0(e,t,{encoding:n});let i={timeout:n.timeout??RP},o=null,c=null,l=null;try{let d=oi.attempt.realpathSync(e),m=!!d;e=d||e,[c,o]=Xf.get(e,n.tmpCreate||Xf.create,n.tmpPurge!==!1);let A=TP&&Wy(n.chown),y=Wy(n.mode);if(m&&(A||y)){let b=oi.attempt.statSync(e);if(b){if(n={...n},A)n.chown={uid:b.uid,gid:b.gid};if(y)n.mode=b.mode}}if(!m){let b=Fre.dirname(e);oi.attempt.mkdirSync(b,{mode:_P,recursive:!0})}if(l=oi.retry.openSync(i)(c,"w",n.mode||z0),n.tmpCreated)n.tmpCreated(c);if(H0(t))oi.retry.writeSync(i)(l,t,0,n.encoding||DP);else if(!Wy(t))oi.retry.writeSync(i)(l,t,0,t.length,0);if(n.fsync!==!1)if(n.fsyncWait!==!1)oi.retry.fsyncSync(i)(l);else oi.attempt.fsync(l);if(oi.retry.closeSync(i)(l),l=null,n.chown&&(n.chown.uid!==BP||n.chown.gid!==kP))oi.attempt.chownSync(c,n.chown.uid,n.chown.gid);if(n.mode&&n.mode!==z0)oi.attempt.chmodSync(c,n.mode);try{oi.retry.renameSync(i)(c,e)}catch(b){if(!OP(b))throw b;if(b.code!=="ENAMETOOLONG")throw b;oi.retry.renameSync(i)(c,Xf.truncate(e))}o(),c=null}finally{if(l)oi.attempt.closeSync(l);if(c)Xf.purge(c)}}var mj=Et(WL(),1),fj=Et(yU(),1);var Ope=(e,t,n,r)=>{if(n==="length"||n==="prototype")return;if(n==="arguments"||n==="caller")return;let i=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);if(!Npe(i,o)&&r)return;Object.defineProperty(e,n,o)},Npe=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},$pe=(e,t)=>{let n=Object.getPrototypeOf(t);if(n===Object.getPrototypeOf(e))return;Object.setPrototypeOf(e,n)},Ppe=(e,t)=>`/* Wrapped ${e}*/
|
|
332
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=jI(e),n=Rm(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=jI(e),n=Rm(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){if(this.type!=="comment")return!1;if(this.indent<=t)return!1;return e.every((n)=>n.type==="newline"||n.type==="space")}*documentEnd(e){if(this.type!=="doc-mode"){if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}LNe.Parser=e9});var o9=P(function(VNe){var t9=tR(),MNe=NA(),LA=$A(),jNe=dk(),zNe=nn(),GNe=dR(),n9=pR();function r9(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new GNe.LineCounter||null,prettyErrors:t}}function HNe(e,t={}){let{lineCounter:n,prettyErrors:r}=r9(t),i=new n9.Parser(n?.addNewLine),o=new t9.Composer(t),c=Array.from(o.compose(i.parse(e)));if(r&&n)for(let l of c)l.errors.forEach(LA.prettifyError(e,n)),l.warnings.forEach(LA.prettifyError(e,n));if(c.length>0)return c;return Object.assign([],{empty:!0},o.streamInfo())}function i9(e,t={}){let{lineCounter:n,prettyErrors:r}=r9(t),i=new n9.Parser(n?.addNewLine),o=new t9.Composer(t),c=null;for(let l of o.compose(i.parse(e),!0,e.length))if(!c)c=l;else if(c.options.logLevel!=="silent"){c.errors.push(new LA.YAMLParseError(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(r&&n)c.errors.forEach(LA.prettifyError(e,n)),c.warnings.forEach(LA.prettifyError(e,n));return c}function JNe(e,t,n){let r=void 0;if(typeof t==="function")r=t;else if(n===void 0&&t&&typeof t==="object")n=t;let i=i9(e,n);if(!i)return null;if(i.warnings.forEach((o)=>jNe.warn(i.options.logLevel,o)),i.errors.length>0)if(i.options.logLevel!=="silent")throw i.errors[0];else i.errors=[];return i.toJS(Object.assign({reviver:r},n))}function KNe(e,t,n){let r=null;if(typeof t==="function"||Array.isArray(t))r=t;else if(n===void 0&&t)n=t;if(typeof n==="string")n=n.length;if(typeof n==="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){let{keepUndefined:i}=n??t??{};if(!i)return}if(zNe.isDocument(e)&&!r)return e.toString(n);return new MNe.Document(e,r,n).toString(n)}VNe.parse=JNe;VNe.parseAllDocuments=HNe;VNe.parseDocument=i9;VNe.stringify=KNe});var P0={};Vne(P0,{program:()=>oP,createCommand:()=>sP,createOption:()=>aP,createArgument:()=>cP,Command:()=>lP,Option:()=>uP,Argument:()=>dP,Help:()=>pP,CommanderError:()=>mP,InvalidArgumentError:()=>fP,InvalidOptionArgumentError:()=>gP},{program:(Qje)=>oP=Qje,createCommand:(Qje)=>sP=Qje,createOption:(Qje)=>aP=Qje,createArgument:(Qje)=>cP=Qje,Command:(Qje)=>lP=Qje,Option:(Qje)=>uP=Qje,Argument:(Qje)=>dP=Qje,Help:(Qje)=>pP=Qje,CommanderError:(Qje)=>mP=Qje,InvalidArgumentError:(Qje)=>fP=Qje,InvalidOptionArgumentError:(Qje)=>gP=Qje});var{Argument:nP}=Jy(),{Command:$0}=tP(),{CommanderError:Sre,InvalidArgumentError:rP}=Wf(),{Help:Dre}=R0(),{Option:iP}=T0();var oP=new $0,sP=(e)=>new $0(e),aP=(e,t)=>new iP(e,t),cP=(e,t)=>new nP(e,t),lP=$0,uP=iP,dP=nP,pP=Dre,mP=Sre,fP=rP,gP=rP;var{program:Fje,createCommand:Lje,createArgument:Uje,createOption:Mje,CommanderError:AP,InvalidArgumentError:jje,InvalidOptionArgumentError:zje,Command:hP,Argument:Gje,Option:Hje,Help:Jje}=P0;var Ky={name:"@sequenzy/cli",version:"0.0.215",description:"Sequenzy CLI for email marketing from the terminal",type:"module",bin:{sequenzy:"./dist/index.js"},main:"./src/index.tsx",types:"./src/index.tsx",exports:{".":"./src/index.tsx"},scripts:{dev:"bun --watch src/index.tsx",build:"bun ../../scripts/build-ink-cli.ts",start:"node dist/index.js",lint:"eslint src","type-check":"bun check",test:"sh ../../scripts/run-package-tests.sh src","test:watch":"bun test --watch",prepublishOnly:"bun run build"},dependencies:{commander:"^12.1.0",ink:"^5.0.1","ink-spinner":"^5.0.0","ink-text-input":"^6.0.0","ink-select-input":"^6.0.0","ink-table":"^3.1.0",open:"^10.1.0",react:"^18.3.1",conf:"^13.0.0",yaml:"^2.8.2"},devDependencies:{"@emailer/shared":"workspace:*","@types/bun":"latest","@types/node":"^22.0.0","@types/react":"^18.3.0","bun-types":"latest",typescript:"^7.0.2"},files:["dist"],keywords:["sequenzy","email","cli","marketing"],license:"MIT",repository:{type:"git",url:"https://github.com/sequenzy/sequenzy"}};import{isDeepStrictEqual as Lge}from"node:util";import uj from"node:process";import Fu from"node:fs";import dj from"node:path";import Eg from"node:crypto";import Uge from"node:assert";var Tu=(e)=>{let t=typeof e;return e!==null&&(t==="object"||t==="function")};var Q0=new Set(["__proto__","prototype","constructor"]),xre=new Set("0123456789");function Vy(e){let t=[],n="",r="start",i=!1;for(let o of e)switch(o){case"\\":{if(r==="index")throw Error("Invalid character in an index");if(r==="indexEnd")throw Error("Invalid character after an index");if(i)n+=o;r="property",i=!i;break}case".":{if(r==="index")throw Error("Invalid character in an index");if(r==="indexEnd"){r="property";break}if(i){i=!1,n+=o;break}if(Q0.has(n))return[];t.push(n),n="",r="property";break}case"[":{if(r==="index")throw Error("Invalid character in an index");if(r==="indexEnd"){r="index";break}if(i){i=!1,n+=o;break}if(r==="property"){if(Q0.has(n))return[];t.push(n),n=""}r="index";break}case"]":{if(r==="index"){t.push(Number.parseInt(n,10)),n="",r="indexEnd";break}if(r==="indexEnd")throw Error("Invalid character after an index")}default:{if(r==="index"&&!xre.has(o))throw Error("Invalid character in an index");if(r==="indexEnd")throw Error("Invalid character after an index");if(r==="start")r="property";if(i)i=!1,n+="\\";n+=o}}if(i)n+="\\";switch(r){case"property":{if(Q0.has(n))return[];t.push(n);break}case"index":throw Error("Index was not closed");case"start":{t.push("");break}}return t}function q0(e,t){if(typeof t!=="number"&&Array.isArray(e)){let n=Number.parseInt(t,10);return Number.isInteger(n)&&e[n]===e[t]}return!1}function yP(e,t){if(q0(e,t))throw Error("Cannot use string index")}function bP(e,t,n){if(!Tu(e)||typeof t!=="string")return n===void 0?e:n;let r=Vy(t);if(r.length===0)return n;for(let i=0;i<r.length;i++){let o=r[i];if(q0(e,o))e=i===r.length-1?void 0:null;else e=e[o];if(e===void 0||e===null){if(i!==r.length-1)return n;break}}return e===void 0?n:e}function F0(e,t,n){if(!Tu(e)||typeof t!=="string")return e;let r=e,i=Vy(t);for(let o=0;o<i.length;o++){let c=i[o];if(yP(e,c),o===i.length-1)e[c]=n;else if(!Tu(e[c]))e[c]=typeof i[o+1]==="number"?[]:{};e=e[c]}return r}function vP(e,t){if(!Tu(e)||typeof t!=="string")return!1;let n=Vy(t);for(let r=0;r<n.length;r++){let i=n[r];if(yP(e,i),r===n.length-1)return delete e[i],!0;if(e=e[i],!Tu(e))return!1}}function EP(e,t){if(!Tu(e)||typeof t!=="string")return!1;let n=Vy(t);if(n.length===0)return!1;for(let r of n){if(!Tu(e)||!(r in e)||q0(e,r))return!1;e=e[r]}return!0}import er from"node:path";import IP from"node:os";import L0 from"node:process";var tl=IP.homedir(),U0=IP.tmpdir(),{env:fp}=L0,Bre=(e)=>{let t=er.join(tl,"Library");return{data:er.join(t,"Application Support",e),config:er.join(t,"Preferences",e),cache:er.join(t,"Caches",e),log:er.join(t,"Logs",e),temp:er.join(U0,e)}},kre=(e)=>{let t=fp.APPDATA||er.join(tl,"AppData","Roaming"),n=fp.LOCALAPPDATA||er.join(tl,"AppData","Local");return{data:er.join(n,e,"Data"),config:er.join(t,e,"Config"),cache:er.join(n,e,"Cache"),log:er.join(n,e,"Log"),temp:er.join(U0,e)}},Rre=(e)=>{let t=er.basename(tl);return{data:er.join(fp.XDG_DATA_HOME||er.join(tl,".local","share"),e),config:er.join(fp.XDG_CONFIG_HOME||er.join(tl,".config"),e),cache:er.join(fp.XDG_CACHE_HOME||er.join(tl,".cache"),e),log:er.join(fp.XDG_STATE_HOME||er.join(tl,".local","state"),e),temp:er.join(U0,t,e)}};function M0(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(L0.platform==="darwin")return Bre(e);if(L0.platform==="win32")return kre(e);return Rre(e)}import Fre from"node:path";import an from"node:fs";import{promisify as Bi}from"node:util";var Tre=(e,t)=>{let{onError:n}=t;return function(...i){return e.apply(void 0,i).catch(n)}},ha=Tre;var Ore=(e,t)=>{let{onError:n}=t;return function(...i){try{return e.apply(void 0,i)}catch(o){return n(o)}}},ks=Ore;var CP=250;var Nre=(e,t)=>{let{isRetriable:n}=t;return function(i){let{timeout:o}=i,c=i.interval??CP,l=Date.now()+o;return function d(...m){return e.apply(void 0,m).catch((A)=>{if(!n(A))throw A;if(Date.now()>=l)throw A;let y=Math.round(c*Math.random());if(y>0)return new Promise((v)=>setTimeout(v,y)).then(()=>d.apply(void 0,m));else return d.apply(void 0,m)})}}},ya=Nre;var $re=(e,t)=>{let{isRetriable:n}=t;return function(i){let{timeout:o}=i,c=Date.now()+o;return function(...d){while(!0)try{return e.apply(void 0,d)}catch(m){if(!n(m))throw m;if(Date.now()>=c)throw m;continue}}}},ba=$re;import SP from"node:process";var Yf={isChangeErrorOk:(e)=>{if(!Yf.isNodeError(e))return!1;let{code:t}=e;if(t==="ENOSYS")return!0;if(!wP&&(t==="EINVAL"||t==="EPERM"))return!0;return!1},isNodeError:(e)=>e instanceof Error,isRetriableError:(e)=>{if(!Yf.isNodeError(e))return!1;let{code:t}=e;if(t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM")return!0;return!1},onChangeError:(e)=>{if(!Yf.isNodeError(e))throw e;if(Yf.isChangeErrorOk(e))return;throw e}},j0=Yf;var Zf={onError:j0.onChangeError},ao={onError:()=>{return}},wP=SP.getuid?!SP.getuid():!1,Ii={isRetriable:j0.isRetriableError};var Pre={attempt:{chmod:ha(Bi(an.chmod),Zf),chown:ha(Bi(an.chown),Zf),close:ha(Bi(an.close),ao),fsync:ha(Bi(an.fsync),ao),mkdir:ha(Bi(an.mkdir),ao),realpath:ha(Bi(an.realpath),ao),stat:ha(Bi(an.stat),ao),unlink:ha(Bi(an.unlink),ao),chmodSync:ks(an.chmodSync,Zf),chownSync:ks(an.chownSync,Zf),closeSync:ks(an.closeSync,ao),existsSync:ks(an.existsSync,ao),fsyncSync:ks(an.fsync,ao),mkdirSync:ks(an.mkdirSync,ao),realpathSync:ks(an.realpathSync,ao),statSync:ks(an.statSync,ao),unlinkSync:ks(an.unlinkSync,ao)},retry:{close:ya(Bi(an.close),Ii),fsync:ya(Bi(an.fsync),Ii),open:ya(Bi(an.open),Ii),readFile:ya(Bi(an.readFile),Ii),rename:ya(Bi(an.rename),Ii),stat:ya(Bi(an.stat),Ii),write:ya(Bi(an.write),Ii),writeFile:ya(Bi(an.writeFile),Ii),closeSync:ba(an.closeSync,Ii),fsyncSync:ba(an.fsyncSync,Ii),openSync:ba(an.openSync,Ii),readFileSync:ba(an.readFileSync,Ii),renameSync:ba(an.renameSync,Ii),statSync:ba(an.statSync,Ii),writeSync:ba(an.writeSync,Ii),writeFileSync:ba(an.writeFileSync,Ii)}},oi=Pre;import Ou from"node:process";var DP="utf8",z0=438,_P=511;var xP={},BP=Ou.geteuid?Ou.geteuid():-1,kP=Ou.getegid?Ou.getegid():-1;var RP=1000,TP=!!Ou.getuid,wze=Ou.getuid?!Ou.getuid():!1,G0=128;var OP=(e)=>e instanceof Error&&("code"in e);var H0=(e)=>typeof e==="string",Wy=(e)=>e===void 0;import qre from"node:path";import gp from"node:process";import NP from"node:process";var $P=NP.platform==="linux",Yy=NP.platform==="win32";var J0=["SIGHUP","SIGINT","SIGTERM"];if(!Yy)J0.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if($P)J0.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var PP=J0;class QP{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=(e)=>{if(this.exited)return;this.exited=!0;for(let t of this.callbacks)t();if(e)if(Yy&&(e!=="SIGINT"&&e!=="SIGTERM"&&e!=="SIGKILL"))gp.kill(gp.pid,"SIGTERM");else gp.kill(gp.pid,e)},this.hook=()=>{gp.once("exit",()=>this.exit());for(let e of PP)try{gp.once(e,()=>this.exit(e))}catch{}},this.register=(e)=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}}var qP=new QP;var Qre=qP.register,FP=Qre;var Oo={store:{},create:(e)=>{let t=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),n=Date.now().toString().slice(-10),r="tmp-",i=`.tmp-${n}${t}`;return`${e}${i}`},get:(e,t,n=!0)=>{let r=Oo.truncate(t(e));if(r in Oo.store)return Oo.get(e,t,n);return Oo.store[r]=n,[r,()=>delete Oo.store[r]]},purge:(e)=>{if(!Oo.store[e])return;delete Oo.store[e],oi.attempt.unlink(e)},purgeSync:(e)=>{if(!Oo.store[e])return;delete Oo.store[e],oi.attempt.unlinkSync(e)},purgeSyncAll:()=>{for(let e in Oo.store)Oo.purgeSync(e)},truncate:(e)=>{let t=qre.basename(e);if(t.length<=G0)return e;let n=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!n)return e;let r=t.length-G0;return`${e.slice(0,-t.length)}${n[1]}${n[2].slice(0,-r)}${n[3]}`}};FP(Oo.purgeSyncAll);var Xf=Oo;function K0(e,t,n=xP){if(H0(n))return K0(e,t,{encoding:n});let i={timeout:n.timeout??RP},o=null,c=null,l=null;try{let d=oi.attempt.realpathSync(e),m=!!d;e=d||e,[c,o]=Xf.get(e,n.tmpCreate||Xf.create,n.tmpPurge!==!1);let A=TP&&Wy(n.chown),y=Wy(n.mode);if(m&&(A||y)){let b=oi.attempt.statSync(e);if(b){if(n={...n},A)n.chown={uid:b.uid,gid:b.gid};if(y)n.mode=b.mode}}if(!m){let b=Fre.dirname(e);oi.attempt.mkdirSync(b,{mode:_P,recursive:!0})}if(l=oi.retry.openSync(i)(c,"w",n.mode||z0),n.tmpCreated)n.tmpCreated(c);if(H0(t))oi.retry.writeSync(i)(l,t,0,n.encoding||DP);else if(!Wy(t))oi.retry.writeSync(i)(l,t,0,t.length,0);if(n.fsync!==!1)if(n.fsyncWait!==!1)oi.retry.fsyncSync(i)(l);else oi.attempt.fsync(l);if(oi.retry.closeSync(i)(l),l=null,n.chown&&(n.chown.uid!==BP||n.chown.gid!==kP))oi.attempt.chownSync(c,n.chown.uid,n.chown.gid);if(n.mode&&n.mode!==z0)oi.attempt.chmodSync(c,n.mode);try{oi.retry.renameSync(i)(c,e)}catch(b){if(!OP(b))throw b;if(b.code!=="ENAMETOOLONG")throw b;oi.retry.renameSync(i)(c,Xf.truncate(e))}o(),c=null}finally{if(l)oi.attempt.closeSync(l);if(c)Xf.purge(c)}}var mj=Et(WL(),1),fj=Et(yU(),1);var Ope=(e,t,n,r)=>{if(n==="length"||n==="prototype")return;if(n==="arguments"||n==="caller")return;let i=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);if(!Npe(i,o)&&r)return;Object.defineProperty(e,n,o)},Npe=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},$pe=(e,t)=>{let n=Object.getPrototypeOf(t);if(n===Object.getPrototypeOf(e))return;Object.setPrototypeOf(e,n)},Ppe=(e,t)=>`/* Wrapped ${e}*/
|
|
333
333
|
${t}`,Qpe=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),qpe=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Fpe=(e,t,n)=>{let r=n===""?"":`with ${n.trim()}() `,i=Ppe.bind(null,r,t.toString());Object.defineProperty(i,"name",qpe);let{writable:o,enumerable:c,configurable:l}=Qpe;Object.defineProperty(e,"toString",{value:i,writable:o,enumerable:c,configurable:l})};function WD(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let i of Reflect.ownKeys(t))Ope(e,t,i,n);return $pe(e,t),Fpe(e,t,r),e}var Lpe=(e,t={})=>{if(typeof e!=="function")throw TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);let{wait:n=0,maxWait:r=Number.POSITIVE_INFINITY,before:i=!1,after:o=!0}=t;if(n<0||r<0)throw RangeError("`wait` and `maxWait` must not be negative.");if(!i&&!o)throw Error("Both `before` and `after` are false, function wouldn't be called.");let c,l,d,m=function(...A){let y=this,b=()=>{if(c=void 0,l)clearTimeout(l),l=void 0;if(o)d=e.apply(y,A)},v=()=>{if(l=void 0,c)clearTimeout(c),c=void 0;if(o)d=e.apply(y,A)},k=i&&!c;if(clearTimeout(c),c=setTimeout(b,n),r>0&&r!==Number.POSITIVE_INFINITY&&!l)l=setTimeout(v,r);if(k)d=e.apply(y,A);return d};return WD(m,e),m.cancel=()=>{if(c)clearTimeout(c),c=void 0;if(l)clearTimeout(l),l=void 0},m},YD=Lpe;var Lu=Et(sj(),1);var Oge=Object.prototype.toString;function cj(e,t,n){if(!e)return!1;if(e.constructor===t)return!0;return Oge.call(e)===n}function lj(e){return cj(e,Uint8Array,"[object Uint8Array]")}function Nge(e){return cj(e,ArrayBuffer,"[object ArrayBuffer]")}function $ge(e){return lj(e)||Nge(e)}function Pge(e){if(!lj(e))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof e}\``)}function Qge(e){if(!$ge(e))throw TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``)}function d_(e,t){if(e.length===0)return new Uint8Array(0);t??=e.reduce((i,o)=>i+o.length,0);let n=new Uint8Array(t),r=0;for(let i of e)Pge(i),n.set(i,r),r+=i.length;return n}var aj={utf8:new globalThis.TextDecoder("utf8")};function p_(e,t="utf8"){return Qge(e),aj[t]??=new globalThis.TextDecoder(t),aj[t].decode(e)}function qge(e){if(typeof e!=="string")throw TypeError(`Expected \`string\`, got \`${typeof e}\``)}var Fge=new globalThis.TextEncoder;function lv(e){return qge(e),Fge.encode(e)}var dJe=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));var Mge=fj.default.default,pj="aes-256-cbc",Mp=()=>Object.create(null),jge=(e)=>e!==void 0&&e!==null,zge=(e,t)=>{let n=new Set(["undefined","symbol","function"]),r=typeof t;if(n.has(r))throw TypeError(`Setting a value of type \`${r}\` for key \`${e}\` is not allowed as it's not supported by JSON`)},uv="__internal__",m_=`${uv}.migrations.version`;class dv{path;events;#r;#t;#e;#n={};constructor(e={}){let t={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:!1,accessPropertiesByDotNotation:!0,configFileMode:438,...e};if(!t.cwd){if(!t.projectName)throw Error("Please specify the `projectName` option.");t.cwd=M0(t.projectName,{suffix:t.projectSuffix}).config}if(this.#e=t,t.schema??t.ajvOptions??t.rootSchema){if(t.schema&&typeof t.schema!=="object")throw TypeError("The `schema` option must be an object.");let o=new mj.Ajv2020({allErrors:!0,useDefaults:!0,...t.ajvOptions});Mge(o);let c={...t.rootSchema,type:"object",properties:t.schema};this.#r=o.compile(c);for(let[l,d]of Object.entries(t.schema??{}))if(d?.default)this.#n[l]=d.default}if(t.defaults)this.#n={...this.#n,...t.defaults};if(t.serialize)this._serialize=t.serialize;if(t.deserialize)this._deserialize=t.deserialize;this.events=new EventTarget,this.#t=t.encryptionKey;let n=t.fileExtension?`.${t.fileExtension}`:"";this.path=dj.resolve(t.cwd,`${t.configName??"config"}${n}`);let r=this.store,i=Object.assign(Mp(),t.defaults,r);if(t.migrations){if(!t.projectVersion)throw Error("Please specify the `projectVersion` option.");this._migrate(t.migrations,t.projectVersion,t.beforeEachMigration)}this._validate(i);try{Uge.deepEqual(r,i)}catch{this.store=i}if(t.watch)this._watch()}get(e,t){if(this.#e.accessPropertiesByDotNotation)return this._get(e,t);let{store:n}=this;return e in n?n[e]:t}set(e,t){if(typeof e!=="string"&&typeof e!=="object")throw TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof e}`);if(typeof e!=="object"&&t===void 0)throw TypeError("Use `delete()` to clear values");if(this._containsReservedKey(e))throw TypeError(`Please don't use the ${uv} key, as it's used to manage this module internal operations.`);let{store:n}=this,r=(i,o)=>{if(zge(i,o),this.#e.accessPropertiesByDotNotation)F0(n,i,o);else n[i]=o};if(typeof e==="object"){let i=e;for(let[o,c]of Object.entries(i))r(o,c)}else r(e,t);this.store=n}has(e){if(this.#e.accessPropertiesByDotNotation)return EP(this.store,e);return e in this.store}reset(...e){for(let t of e)if(jge(this.#n[t]))this.set(t,this.#n[t])}delete(e){let{store:t}=this;if(this.#e.accessPropertiesByDotNotation)vP(t,e);else delete t[e];this.store=t}clear(){this.store=Mp();for(let e of Object.keys(this.#n))this.reset(e)}onDidChange(e,t){if(typeof e!=="string")throw TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof e}`);if(typeof t!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`);return this._handleChange(()=>this.get(e),t)}onDidAnyChange(e){if(typeof e!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof e}`);return this._handleChange(()=>this.store,e)}get size(){return Object.keys(this.store).length}get store(){try{let e=Fu.readFileSync(this.path,this.#t?null:"utf8"),t=this._encryptData(e),n=this._deserialize(t);return this._validate(n),Object.assign(Mp(),n)}catch(e){if(e?.code==="ENOENT")return this._ensureDirectory(),Mp();if(this.#e.clearInvalidConfig&&e.name==="SyntaxError")return Mp();throw e}}set store(e){this._ensureDirectory(),this._validate(e),this._write(e),this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(let[e,t]of Object.entries(this.store))yield[e,t]}_encryptData(e){if(!this.#t)return typeof e==="string"?e:p_(e);try{let t=e.slice(0,16),n=Eg.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512"),r=Eg.createDecipheriv(pj,n,t),i=e.slice(17),o=typeof i==="string"?lv(i):i;return p_(d_([r.update(o),r.final()]))}catch{}return e.toString()}_handleChange(e,t){let n=e(),r=()=>{let i=n,o=e();if(Lge(o,i))return;n=o,t.call(this,o,i)};return this.events.addEventListener("change",r),()=>{this.events.removeEventListener("change",r)}}_deserialize=(e)=>JSON.parse(e);_serialize=(e)=>JSON.stringify(e,void 0,"\t");_validate(e){if(!this.#r)return;if(this.#r(e)||!this.#r.errors)return;let n=this.#r.errors.map(({instancePath:r,message:i=""})=>`\`${r.slice(1)}\` ${i}`);throw Error("Config schema violation: "+n.join("; "))}_ensureDirectory(){Fu.mkdirSync(dj.dirname(this.path),{recursive:!0})}_write(e){let t=this._serialize(e);if(this.#t){let n=Eg.randomBytes(16),r=Eg.pbkdf2Sync(this.#t,n.toString(),1e4,32,"sha512"),i=Eg.createCipheriv(pj,r,n);t=d_([n,lv(":"),i.update(lv(t)),i.final()])}if(uj.env.SNAP)Fu.writeFileSync(this.path,t,{mode:this.#e.configFileMode});else try{K0(this.path,t,{mode:this.#e.configFileMode})}catch(n){if(n?.code==="EXDEV"){Fu.writeFileSync(this.path,t,{mode:this.#e.configFileMode});return}throw n}}_watch(){if(this._ensureDirectory(),!Fu.existsSync(this.path))this._write(Mp());if(uj.platform==="win32")Fu.watch(this.path,{persistent:!1},YD(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));else Fu.watchFile(this.path,{persistent:!1},YD(()=>{this.events.dispatchEvent(new Event("change"))},{wait:5000}))}_migrate(e,t,n){let r=this._get(m_,"0.0.0"),i=Object.keys(e).filter((c)=>this._shouldPerformMigration(c,r,t)),o={...this.store};for(let c of i)try{if(n)n(this,{fromVersion:r,toVersion:c,finalVersion:t,versions:i});let l=e[c];l?.(this),this._set(m_,c),r=c,o={...this.store}}catch(l){throw this.store=o,Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${l}`)}if(this._isVersionInRangeFormat(r)||!Lu.default.eq(r,t))this._set(m_,t)}_containsReservedKey(e){if(typeof e==="object"){if(Object.keys(e)[0]===uv)return!0}if(typeof e!=="string")return!1;if(this.#e.accessPropertiesByDotNotation){if(e.startsWith(`${uv}.`))return!0;return!1}return!1}_isVersionInRangeFormat(e){return Lu.default.clean(e)===null}_shouldPerformMigration(e,t,n){if(this._isVersionInRangeFormat(e)){if(t!=="0.0.0"&&Lu.default.satisfies(t,e))return!1;return Lu.default.satisfies(n,e)}if(Lu.default.lte(e,t))return!1;if(Lu.default.gt(e,n))return!1;return!0}_get(e,t){return bP(this.store,e,t)}_set(e,t){let{store:n}=this;F0(n,e,t),this.store=n}}var f_="com.sequenzy.cli",g_="api-key",A_=typeof globalThis.Bun<"u",Il=new dv({projectName:"sequenzy",schema:{userId:{type:"string"},userEmail:{type:"string"},_apiKey:{type:"string"}}});async function h_(){let e=process.env.SEQUENZY_API_KEY;if(e)return e;if(A_)try{let t=await globalThis.Bun.secrets.get({service:f_,name:g_});if(t)return t}catch{}return Il.get("_apiKey")}async function gj(e){if(A_)try{await globalThis.Bun.secrets.set({service:f_,name:g_,value:e,allowUnrestrictedAccess:!1});return}catch{}Il.set("_apiKey",e)}async function Aj(){if(A_)try{await globalThis.Bun.secrets.delete({service:f_,name:g_})}catch{}Il.delete("_apiKey")}async function j(){return!!await h_()}function pv(){return{userId:Il.get("userId"),userEmail:Il.get("userEmail")}}function hj(e){if(e.userId!==void 0)Il.set("userId",e.userId);if(e.userEmail!==void 0)Il.set("userEmail",e.userEmail)}function yj(){Il.clear()}function mv(e,t=Date.now()){if(!e?.trim())return;let n=e.trim();if(/^\d+$/.test(n)){let i=Number(n);return Number.isSafeInteger(i)?i:void 0}if(!/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{2} [A-Z][a-z]{2} \d{4} \d{2}:\d{2}:\d{2} GMT$/.test(n))return;let r=Date.parse(n);if(!Number.isFinite(r)||new Date(r).toUTCString().slice(5)!==n.slice(5))return;return Math.max(0,Math.ceil((r-t)/1000))}function bj(e,t,n){if(e&&/^[A-Z][A-Z0-9_]{1,95}$/.test(e))return e;switch(t){case 0:return"NETWORK_ERROR";case 400:case 422:return"VALIDATION_ERROR";case 401:return"UNAUTHORIZED";case 403:return"FORBIDDEN";case 404:return"NOT_FOUND";case 409:return"CONFLICT";case 429:return"RATE_LIMITED";default:return t!==void 0?t>=500?"SERVER_ERROR":"HTTP_ERROR":n}}var vj=!1;function y_(e){vj=e}function jp(){return vj}var Gge=new Set([502,503,504]),Hge=[250,1000,2000],Jge=5000,Kge=(e)=>new Promise((t)=>setTimeout(t,e));async function Ej(e,t,{delaysMs:n=Hge,sleep:r=Kge}={}){let i=e==="GET"?n.length:0;for(let o=0;o<i;o+=1){let c=n[o]??0,l;try{l=await t()}catch{await r(c);continue}if(!Gge.has(l.status))return l;let d=(mv(l.headers.get("Retry-After"))??0)*1000;if(d>Jge)return l;await l.body?.cancel().catch(()=>{return}),await r(Math.max(c,d))}return t()}var Vge=process.env.SEQUENZY_API_URL??"https://api.sequenzy.com";class g extends Error{statusCode;rawDetails;code;retryAfterSeconds;constructor(e,t,n,r,i){super(e);this.statusCode=t;this.rawDetails=n;this.code=r;this.retryAfterSeconds=i;this.name="ApiError"}}function Wge(e,t){if(typeof e!=="string")return;if(typeof t!=="string"||t==="root")return e;let n=t.slice(1).replaceAll("/",".");return e.includes(`'${n}'`)?e:`${n}: ${e}`}function Yge(e){if(!e.trim())return{message:"Request failed"};try{let t=JSON.parse(e);if(typeof t==="string")return{message:t};if(!t||typeof t!=="object"||Array.isArray(t))return{message:"Request failed"};let n=t,r=n.error&&typeof n.error==="object"?n.error:void 0,i=r?.code??n.code,o=n.type==="validation"?Wge(n.summary,n.property):void 0,c=typeof n.error==="string"?n.error:typeof o==="string"?o:r?.message??n.message;return{message:typeof c==="string"?c:"Request failed",...typeof i==="string"?{code:i}:{}}}catch{return{message:e}}}var Ij=!1;function Zge(e,t){if(t||Ij)return;if(e.headers.get("x-sequenzy-company-defaulted")!=="true")return;let n=e.headers.get("x-sequenzy-company-id");if(!n||jp())return;Ij=!0,console.error(`Note: no --company was given, so this account API key used its default company ${n}. Pass --company <id> to choose one (sequenzy companies list shows the options).`)}async function E(e,t,n,r,i){let o=await h_();if(!o)throw new g("Not logged in. Run `sequenzy login` first.",401);let c={"Content-Type":"application/json",Authorization:`Bearer ${o}`,"x-sequenzy-client":`cli/${Ky.version}`};if(r)c["x-company-id"]=r;Object.assign(c,i);let l;try{l=await Ej(e,()=>fetch(`${Vge}${t}`,{method:e,headers:c,body:n?JSON.stringify(n):void 0}))}catch(d){throw new g(d instanceof Error?d.message:"Failed to reach Sequenzy API",0,void 0,"NETWORK_ERROR")}if(Zge(l,r),!l.ok){let d=await l.text(),m=Yge(d);throw new g(m.message,l.status,d,m.code,mv(l.headers.get("Retry-After")))}return l.json()}var v_="https://docs.sequenzy.com",pc=`${v_}/concepts/cli`,b_=`${v_}/authentication`,Cj="https://sequenzy.com/dashboard";function wj(e){if(e instanceof g)return{message:e.message,statusCode:e.statusCode,code:e.code,rawDetails:e.rawDetails};if(e instanceof Error)return{message:e.message};return{message:String(e)}}function Xge(e){let t=e.match(/api key is missing required scopes?:\s*(.+)$/i);if(!t?.[1])return[];return[...new Set(t[1].match(/[a-z_]+:[a-z_]+/gi)??[])]}function Sj(e){let t=wj(e),n=t.message.trim()||"Unknown error",r=n.toLowerCase(),i=t.rawDetails?.trim()||n;if(t.code==="CLI_AUTH_REQUIRED"||r.includes("not logged in"))return{title:"Authentication required",description:"This command needs a Sequenzy API key, but the CLI could not find one in your local login state or environment.",howToFix:"Run `sequenzy login` and approve the session, or set `SEQUENZY_API_KEY` for non-interactive environments.",docsUrl:pc,details:i};if(r.includes("already logged in"))return{title:"CLI already authenticated",description:"The CLI already has a saved Sequenzy login for this machine.",howToFix:"Run `sequenzy logout` first if you want to switch accounts, then run `sequenzy login` again.",docsUrl:pc,details:i};if(t.statusCode===401||t.code==="UNAUTHORIZED")return{title:"Authentication failed",description:"The request reached Sequenzy, but the current API key was rejected.",howToFix:"Run `sequenzy login` again, or replace the key with a valid personal API key that still has access to your account.",docsUrl:b_,details:i};if(t.code==="COMPANY_CREATE_REQUIRES_PERSONAL_KEY")return{title:"Personal account key required",description:"Company creation is account-level and cannot be performed with a company/workspace-scoped API key.",howToFix:"Create or use a personal account key beginning with `seq_user_` from Account → API Keys, replace `SEQUENZY_API_KEY`, and retry the same command; alternatively, create the company in the Sequenzy dashboard. Widening the current company key or switching companies will not fix this restriction.",docsUrl:b_,details:i};let o=Xge(n);if(o.length>0){let c=o.map((m)=>`\`${m}\``).join(", "),l=o.every((m)=>m.endsWith(":read"))?"the Read-only or Safer agent access preset":"Safer agent access when it covers the task, or Custom permissions",d=o.includes("api_keys:manage")?` This command manages API keys, so the missing scope cannot be granted through the API by the key that is missing it. If the active key has \`account:read\`, run \`sequenzy api-keys handoff\` (add \`--replaces current\` when rotating) to get a dashboard link that opens the create-key form prefilled, then give it to the workspace owner. It creates nothing and never prints a key. If handoff is also denied because \`account:read\` is missing, open ${Cj} directly and choose the matching API Keys page.`:"";return{title:"API key permission required",description:`The current API key is valid, but this operation requires the missing ${o.length===1?"scope":"scopes"}: ${c}.`,howToFix:`Permissions can be widened on the key you are already using - no new key and no re-login. Run \`sequenzy account\` to see the active key, its type, and its API Keys settings URL, then have the key owner enable ${c} there. Personal keys open Account → API Keys; company keys open workspace Settings → API Keys. If account metadata is unavailable, open ${Cj} directly and choose the matching API Keys page. When the active key type is \`company\` and it holds \`api_keys:manage\`, run \`sequenzy api-keys list --json\` and then \`sequenzy api-keys update <api-key-id> --scopes\` with the current scopes plus ${c}, or \`--preset\` covering all of them (${l}). Personal keys cannot be changed through \`sequenzy api-keys update\`. Both options replace the whole selection rather than merging. Retry the same command once the key is updated. Issuing a replacement key and swapping \`SEQUENZY_API_KEY\` also works but is not required.${d}`,docsUrl:pc,details:i}}if(t.statusCode===403||r.includes("access denied"))return{title:"Access denied",description:"The current API key is valid, but it does not have permission to perform this action or access the requested company.",howToFix:"Use an API key with access to the target company, or switch to a company you can access before retrying.",docsUrl:b_,details:i};if(t.statusCode===404||r.includes("not found"))return{title:"Requested resource not found",description:"Sequenzy could not find the company, template, campaign, sequence, or subscriber you asked for.",howToFix:"Double-check the ID or email value and list the resource first before retrying the command.",docsUrl:pc,details:i};if(t.statusCode===429||r.includes("rate limit"))return{title:"Rate limited",description:"Sequenzy temporarily slowed this request because too many requests were sent in a short period.",howToFix:"Wait a moment and retry. If an agent is looping, reduce the retry frequency before calling the CLI again.",docsUrl:pc,details:i};if(t.code==="AB_TEST_VARIANT_CONTENT_EDIT"||r.includes("update_ab_test_variant")&&(r.includes("a/b test")||r.includes("ab test")))return{title:"A/B variant copy cannot be edited here",description:n,howToFix:"Use `sequenzy ab-tests update-variant` with the `abTestId` and `variantId` from `sequenzy sequences get` or `sequenzy ab-tests get`. Repeat once per variant for a whole-step rewrite. If the sequence is live or the test has activity, pass `--confirm-live-change`. Do not retry with `sequenzy templates update` or `sequenzy sequences update-node`.",docsUrl:`${v_}/concepts/cli#editing-the-copy-of-a-sequence-ab-step`,details:i};if(r.includes("--subject")||r.includes("--template")||r.includes("is required"))return{title:"Invalid command input",description:"The CLI command arguments are incomplete or incompatible for this action.",howToFix:"Review the flags you passed, add the missing values, and run the command again.",docsUrl:pc,details:i};if(t.code==="NETWORK_ERROR"||r.includes("fetch failed")||r.includes("failed to initiate login"))return{title:"Network or configuration error",description:"The CLI could not reach the Sequenzy API or app URL from this environment.",howToFix:"Check your network connection and verify `SEQUENZY_API_URL` or `SEQUENZY_APP_URL` if you override them locally.",docsUrl:pc,details:i};if(t.statusCode&&t.statusCode>=500)return{title:"Sequenzy server error",description:"The request reached Sequenzy, but the server could not complete it successfully.",howToFix:"Retry once. If the error persists, keep the details below and check the docs before escalating.",docsUrl:pc,details:i};return{title:"Command failed",description:"The CLI could not complete the requested operation.",howToFix:"Review the details below, adjust the command or credentials, and retry.",docsUrl:pc,details:i}}function z(){return new g("Not logged in. Run `sequenzy login` first.",401,void 0,"CLI_AUTH_REQUIRED")}function Ig(e){let t=Sj(e);return[`Sequenzy CLI error: ${t.title}`,`Description: ${t.description}`,`How to fix: ${t.howToFix}`,`Docs: ${t.docsUrl}`,`Details: ${t.details}`].join(`
|
|
334
334
|
`)}function eAe(e){let t=wj(e),n=Sj(e),r=(t.rawDetails===t.message?n.description:t.message.trim())||n.description;return{success:!1,error:{code:bj(t.code,t.statusCode,"CLI_ERROR"),message:r.replace(/\bBearer\s+[^\s]+/gi,"Bearer [redacted]").replace(/\bseq_(?:user_)?[A-Za-z0-9_-]{8,}\b/g,"[redacted key]"),...t.statusCode!==void 0?{statusCode:t.statusCode}:{},howToFix:n.howToFix,docsUrl:n.docsUrl,...e instanceof g&&e.retryAfterSeconds!==void 0?{retryAfterSeconds:e.retryAfterSeconds}:{}}}}function T(e,t={}){console.error(t.json??jp()?JSON.stringify(eAe(e)):Ig(e))}import{readFileSync as tAe}from"node:fs";import{isatty as Dj}from"node:tty";var Cl;function _j(){Cl=void 0}function E_(e){if(new Set(e).size>1)throw new g("Only one text input may read stdin (-) per command. Use regular files for the other inputs.",400,void 0,"CLI_INVALID_INPUT")}async function xj(){if(Dj(0))throw new g("Pipe text into stdin when using a text file '-'.",400,void 0,"CLI_INVALID_INPUT");try{process.stdin.setEncoding("utf8");let e="";for await(let t of process.stdin)e+=String(t);Cl={text:e}}catch(e){throw new g(`Failed to read stdin: ${e instanceof Error?e.message:"Unknown error"}`,400,void 0,"CLI_INPUT_READ_FAILED")}}function Bj(e,t){if(e==="-"){if(Cl){if(Cl.field)E_([Cl.field,t]);return Cl.field=t,Cl.text}if(Dj(0))throw new g(`Pipe text into stdin when using ${t} file '-'.`,400,void 0,"CLI_INVALID_INPUT")}try{let n=tAe(e==="-"?0:e,"utf8");if(e==="-")Cl={field:t,text:n};return n}catch(n){throw new g(`Failed to read ${t} file '${e}': ${n instanceof Error?n.message:"Unknown error"}`,400,void 0,"CLI_INPUT_READ_FAILED")}}function fv(e){return e.optsWithGlobals().json===!0||e.commands.some(fv)}async function nAe(e){y_(e.optsWithGlobals().json===!0),_j();let t=Object.entries(e.optsWithGlobals()).filter(([n,r])=>r==="-"&&n.endsWith("File")||n==="audienceJson"&&r==="@-").map(([n])=>n);if(e.parent?.name()==="subscribers"&&["import","events-import"].includes(e.name())&&e.args[0]==="-")t.push("subscriber import");if(E_(t),t.length>0)await xj()}function kj(e){let t=e.configureOutput().writeErr;e.configureOutput({writeErr:(n)=>{if(!fv(e))t?.(n)}}),e.exitOverride(),e.hook("preAction",(n,r)=>nAe(r))}async function Rj(e,t){y_(!1);try{await e.parseAsync(t)}catch(n){if(n instanceof AP){if(n.exitCode===0)return;if(fv(e))T(new g(n.message,400,void 0,"CLI_INVALID_INPUT"),{json:!0});process.exitCode=n.exitCode;return}T(n,{json:fv(e)}),process.exitCode=1}}var gv="Variant copy is edited with `sequenzy ab-tests update-variant`, not with `sequenzy sequences update-node`.";var Tj;function de(e,t,n){function r(l,d){if(!l._zod)Object.defineProperty(l,"_zod",{value:{def:d,constr:c,traits:new Set},enumerable:!1});if(l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,d);let m=c.prototype,A=Object.keys(m);for(let y=0;y<A.length;y++){let b=A[y];if(!(b in l))l[b]=m[b].bind(l)}}let i=n?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function c(l){var d;let m=n?.Parent?new o:this;r(m,l),(d=m._zod).deferred??(d.deferred=[]);for(let A of m._zod.deferred)A();return m}return Object.defineProperty(c,"init",{value:r}),Object.defineProperty(c,Symbol.hasInstance,{value:(l)=>{if(n?.Parent&&l instanceof n.Parent)return!0;return l?._zod?.traits?.has(e)}}),Object.defineProperty(c,"name",{value:e}),c}var ZJe=Symbol("zod_brand");class mc extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Cg extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Tj=globalThis).__zod_globalConfig??(Tj.__zod_globalConfig={});var zp=globalThis.__zod_globalConfig;function fc(e){if(e)Object.assign(zp,e);return zp}function hv(e){let t=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function Sg(e,t){if(typeof t==="bigint")return t.toString();return t}function yv(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function bv(e){return e===null||e===void 0}function vv(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}var Oj=Symbol("evaluating");function Cn(e,t,n){let r=void 0;Object.defineProperty(e,t,{get(){if(r===Oj)return;if(r===void 0)r=Oj,r=n();return r},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Uu(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function wl(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function C_(e){return JSON.stringify(e)}function Nj(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var w_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function wg(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var $j=yv(()=>{if(zp.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Gp(e){if(wg(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(wg(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function S_(e){if(Gp(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Pj=new Set(["string","number","symbol"]);function Sl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Na(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function It(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Qj(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var rAe={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function iAe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let o=wl(e._zod.def,{get shape(){let c={};for(let l in t){if(!(l in n.shape))throw Error(`Unrecognized key: "${l}"`);if(!t[l])continue;c[l]=n.shape[l]}return Uu(this,"shape",c),c},checks:[]});return Na(e,o)}function oAe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let o=wl(e._zod.def,{get shape(){let c={...e._zod.def.shape};for(let l in t){if(!(l in n.shape))throw Error(`Unrecognized key: "${l}"`);if(!t[l])continue;delete c[l]}return Uu(this,"shape",c),c},checks:[]});return Na(e,o)}function sAe(e,t){if(!Gp(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=e._zod.def.shape;for(let c in t)if(Object.getOwnPropertyDescriptor(o,c)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=wl(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Uu(this,"shape",o),o}});return Na(e,i)}function aAe(e,t){if(!Gp(t))throw Error("Invalid input to safeExtend: expected a plain object");let n=wl(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return Uu(this,"shape",r),r}});return Na(e,n)}function cAe(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=wl(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Uu(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Na(e,n)}function lAe(e,t,n){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let c=wl(t._zod.def,{get shape(){let l=t._zod.def.shape,d={...l};if(n)for(let m in n){if(!(m in l))throw Error(`Unrecognized key: "${m}"`);if(!n[m])continue;d[m]=e?new e({type:"optional",innerType:l[m]}):l[m]}else for(let m in l)d[m]=e?new e({type:"optional",innerType:l[m]}):l[m];return Uu(this,"shape",d),d},checks:[]});return Na(t,c)}function uAe(e,t,n){let r=wl(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(n)for(let c in n){if(!(c in o))throw Error(`Unrecognized key: "${c}"`);if(!n[c])continue;o[c]=new e({type:"nonoptional",innerType:i[c]})}else for(let c in i)o[c]=new e({type:"nonoptional",innerType:i[c]});return Uu(this,"shape",o),o}});return Na(t,r)}function Mu(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function qj(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Ev(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Av(e){return typeof e==="string"?e:e?.message}function gc(e,t,n){let r=e.message?e.message:Av(e.inst?._zod.def?.error?.(e))??Av(t?.error?.(e))??Av(n.customError?.(e))??Av(n.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:c,...l}=e;if(l.path??(l.path=[]),l.message=r,t?.reportInput)l.input=c;return l}function Iv(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ju(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}var Fj=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Sg,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Cv=de("$ZodError",Fj),D_=de("$ZodError",Fj,{Parent:Error});function Lj(e,t=(n)=>n.message){let n={},r=[];for(let i of e.issues)if(i.path.length>0)n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i));else r.push(t(i));return{formErrors:r,fieldErrors:n}}function Uj(e,t=(n)=>n.message){let n={_errors:[]},r=(i,o=[])=>{for(let c of i.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map((l)=>r({issues:l},[...o,...c.path]));else if(c.code==="invalid_key")r({issues:c.issues},[...o,...c.path]);else if(c.code==="invalid_element")r({issues:c.issues},[...o,...c.path]);else{let l=[...o,...c.path];if(l.length===0)n._errors.push(t(c));else{let d=n,m=0;while(m<l.length){let A=l[m];if(m!==l.length-1)d[A]=d[A]||{_errors:[]};else d[A]=d[A]||{_errors:[]},d[A]._errors.push(t(c));d=d[A],m++}}}};return r(e),n}var wv=(e)=>(t,n,r,i)=>{let o=r?{...r,async:!1}:{async:!1},c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise)throw new mc;if(c.issues.length){let l=new(i?.Err??e)(c.issues.map((d)=>gc(d,o,fc())));throw w_(l,i?.callee),l}return c.value};var Sv=(e)=>async(t,n,r,i)=>{let o=r?{...r,async:!0}:{async:!0},c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise)c=await c;if(c.issues.length){let l=new(i?.Err??e)(c.issues.map((d)=>gc(d,o,fc())));throw w_(l,i?.callee),l}return c.value};var Dg=(e)=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new mc;return o.issues.length?{success:!1,error:new(e??Cv)(o.issues.map((c)=>gc(c,i,fc())))}:{success:!0,data:o.value}},Mj=Dg(D_),_g=(e)=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)o=await o;return o.issues.length?{success:!1,error:new e(o.issues.map((c)=>gc(c,i,fc())))}:{success:!0,data:o.value}},jj=_g(D_),zj=(e)=>(t,n,r)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return wv(e)(t,n,i)};var Gj=(e)=>(t,n,r)=>wv(e)(t,n,r);var Hj=(e)=>async(t,n,r)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return Sv(e)(t,n,i)};var Jj=(e)=>async(t,n,r)=>Sv(e)(t,n,r);var Kj=(e)=>(t,n,r)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return Dg(e)(t,n,i)};var Vj=(e)=>(t,n,r)=>Dg(e)(t,n,r);var Wj=(e)=>async(t,n,r)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return _g(e)(t,n,i)};var Yj=(e)=>async(t,n,r)=>_g(e)(t,n,r);var Zj=/^[cC][0-9a-z]{6,}$/,Xj=/^[0-9a-z]+$/,ez=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,tz=/^[0-9a-vA-V]{20}$/,nz=/^[A-Za-z0-9]{27}$/,rz=/^[a-zA-Z0-9_-]{21}$/,iz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var oz=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,__=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var sz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var pAe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function az(){return new RegExp(pAe,"u")}var cz=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,lz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var uz=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,dz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,x_=/^[A-Za-z0-9_-]*$/;var mz=/^https?$/,fz=/^\+[1-9]\d{6,14}$/,gz="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Az=new RegExp(`^${gz}$`);function hz(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function yz(e){return new RegExp(`^${hz(e)}$`)}function bz(e){let t=hz({precision:e.precision}),n=["Z"];if(e.local)n.push("");if(e.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${t}(?:${n.join("|")})`;return new RegExp(`^${gz}T(?:${r})$`)}var vz=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Ez=/^[^A-Z]*$/,Iz=/^[^a-z]*$/;var No=de("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var Cz=de("$ZodCheckMaxLength",(e,t)=>{var n;No.init(e,t),(n=e._zod.def).when??(n.when=(r)=>{let i=r.value;return!bv(i)&&i.length!==void 0}),e._zod.onattach.push((r)=>{let i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<i)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let i=r.value;if(i.length<=t.maximum)return;let c=Iv(i);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),wz=de("$ZodCheckMinLength",(e,t)=>{var n;No.init(e,t),(n=e._zod.def).when??(n.when=(r)=>{let i=r.value;return!bv(i)&&i.length!==void 0}),e._zod.onattach.push((r)=>{let i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>i)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let i=r.value;if(i.length>=t.minimum)return;let c=Iv(i);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Sz=de("$ZodCheckLengthEquals",(e,t)=>{var n;No.init(e,t),(n=e._zod.def).when??(n.when=(r)=>{let i=r.value;return!bv(i)&&i.length!==void 0}),e._zod.onattach.push((r)=>{let i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=(r)=>{let i=r.value,o=i.length;if(o===t.length)return;let c=Iv(i),l=o>t.length;r.issues.push({origin:c,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),xg=de("$ZodCheckStringFormat",(e,t)=>{var n,r;if(No.init(e,t),e._zod.onattach.push((i)=>{let o=i._zod.bag;if(o.format=t.format,t.pattern)o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern)}),t.pattern)(n=e._zod).check??(n.check=(i)=>{if(t.pattern.lastIndex=0,t.pattern.test(i.value))return;i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),Dz=de("$ZodCheckRegex",(e,t)=>{xg.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_z=de("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ez),xg.init(e,t)}),xz=de("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Iz),xg.init(e,t)}),Bz=de("$ZodCheckIncludes",(e,t)=>{No.init(e,t);let n=Sl(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push((i)=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(i)=>{if(i.value.includes(t.includes,t.position))return;i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),kz=de("$ZodCheckStartsWith",(e,t)=>{No.init(e,t);let n=new RegExp(`^${Sl(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((r)=>{let i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=(r)=>{if(r.value.startsWith(t.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Rz=de("$ZodCheckEndsWith",(e,t)=>{No.init(e,t);let n=new RegExp(`.*${Sl(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((r)=>{let i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=(r)=>{if(r.value.endsWith(t.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});var Tz=de("$ZodCheckOverwrite",(e,t)=>{No.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class B_{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
335
335
|
`).filter((o)=>o),r=Math.min(...n.map((o)=>o.length-o.trimStart().length)),i=n.map((o)=>o.slice(r)).map((o)=>" ".repeat(this.indent*2)+o);for(let o of i)this.content.push(o)}compile(){let e=Function,t=this?.args,r=[...(this?.content??[""]).map((i)=>` ${i}`)];return new e(...t,r.join(`
|