@doguyilmaz/tapster 0.0.0-stage → 1.0.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +216 -2
  3. package/dist/cli.js +1001 -0
  4. package/package.json +32 -4
package/dist/cli.js ADDED
@@ -0,0 +1,1001 @@
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+ var Hm=Object.defineProperty;var A=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Wm=(e)=>e;function Vm(e,t){this[e]=Wm.bind(null,t)}var ma=(e,t)=>{for(var r in t)Hm(e,r,{get:t[r],enumerable:!0,configurable:!0,set:Vm.bind(t,r)})};var he=import.meta.require;var I=A(function(ng){var zs=Symbol.for("yaml.alias"),ga=Symbol.for("yaml.document"),Hr=Symbol.for("yaml.map"),ya=Symbol.for("yaml.pair"),Ls=Symbol.for("yaml.scalar"),Wr=Symbol.for("yaml.seq"),ze=Symbol.for("yaml.node.type"),Ym=(e)=>!!e&&typeof e==="object"&&e[ze]===zs,Jm=(e)=>!!e&&typeof e==="object"&&e[ze]===ga,Qm=(e)=>!!e&&typeof e==="object"&&e[ze]===Hr,Xm=(e)=>!!e&&typeof e==="object"&&e[ze]===ya,wa=(e)=>!!e&&typeof e==="object"&&e[ze]===Ls,eg=(e)=>!!e&&typeof e==="object"&&e[ze]===Wr;function ba(e){if(e&&typeof e==="object")switch(e[ze]){case Hr:case Wr:return!0}return!1}function tg(e){if(e&&typeof e==="object")switch(e[ze]){case zs:case Hr:case Ls:case Wr:return!0}return!1}var rg=(e)=>(wa(e)||ba(e))&&!!e.anchor;ng.ALIAS=zs;ng.DOC=ga;ng.MAP=Hr;ng.NODE_TYPE=ze;ng.PAIR=ya;ng.SCALAR=Ls;ng.SEQ=Wr;ng.hasAnchor=rg;ng.isAlias=Ym;ng.isCollection=ba;ng.isDocument=Jm;ng.isMap=Qm;ng.isNode=tg;ng.isPair=Xm;ng.isScalar=wa;ng.isSeq=eg});var Vt=A(function(_g){var W=I(),Q=Symbol("break visit"),_a=Symbol("skip children"),ve=Symbol("remove node");function Vr(e,t){let r=va(t);if(W.isDocument(e)){if(At(null,e.contents,r,Object.freeze([e]))===ve)e.contents=null}else At(null,e,r,Object.freeze([]))}Vr.BREAK=Q;Vr.SKIP=_a;Vr.REMOVE=ve;function At(e,t,r,n){let s=ka(e,t,r,n);if(W.isNode(s)||W.isPair(s))return xa(e,n,s),At(e,s,r,n);if(typeof s!=="symbol"){if(W.isCollection(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let i=At(o,t.items[o],r,n);if(typeof i==="number")o=i-1;else if(i===Q)return Q;else if(i===ve)t.items.splice(o,1),o-=1}}else if(W.isPair(t)){n=Object.freeze(n.concat(t));let o=At("key",t.key,r,n);if(o===Q)return Q;else if(o===ve)t.key=null;let i=At("value",t.value,r,n);if(i===Q)return Q;else if(i===ve)t.value=null}}return s}async function Yr(e,t){let r=va(t);if(W.isDocument(e)){if(await $t(null,e.contents,r,Object.freeze([e]))===ve)e.contents=null}else await $t(null,e,r,Object.freeze([]))}Yr.BREAK=Q;Yr.SKIP=_a;Yr.REMOVE=ve;async function $t(e,t,r,n){let s=await ka(e,t,r,n);if(W.isNode(s)||W.isPair(s))return xa(e,n,s),$t(e,s,r,n);if(typeof s!=="symbol"){if(W.isCollection(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let i=await $t(o,t.items[o],r,n);if(typeof i==="number")o=i-1;else if(i===Q)return Q;else if(i===ve)t.items.splice(o,1),o-=1}}else if(W.isPair(t)){n=Object.freeze(n.concat(t));let o=await $t("key",t.key,r,n);if(o===Q)return Q;else if(o===ve)t.key=null;let i=await $t("value",t.value,r,n);if(i===Q)return Q;else if(i===ve)t.value=null}}return s}function va(e){if(typeof e==="object"&&(e.Collection||e.Node||e.Value))return Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e);return e}function ka(e,t,r,n){if(typeof r==="function")return r(e,t,n);if(W.isMap(t))return r.Map?.(e,t,n);if(W.isSeq(t))return r.Seq?.(e,t,n);if(W.isPair(t))return r.Pair?.(e,t,n);if(W.isScalar(t))return r.Scalar?.(e,t,n);if(W.isAlias(t))return r.Alias?.(e,t,n);return}function xa(e,t,r){let n=t[t.length-1];if(W.isCollection(n))n.items[e]=r;else if(W.isPair(n))if(e==="key")n.key=r;else n.value=r;else if(W.isDocument(n))n.contents=r;else{let s=W.isAlias(n)?"alias":"scalar";throw Error(`Cannot replace node with ${s} parent`)}}_g.visit=Vr;_g.visitAsync=Yr});var Ds=A(function($g){var Sa=I(),xg=Vt(),Sg={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Ag=(e)=>e.replace(/[!,[\]{}]/g,(t)=>Sg[t]);class ce{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},ce.defaultYaml,e),this.tags=Object.assign({},ce.defaultTags,t)}clone(){let e=new ce(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new ce(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:ce.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},ce.defaultTags);break}return e}add(e,t){if(this.atNextDocument)this.yaml={explicit:ce.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},ce.defaultTags),this.atNextDocument=!1;let r=e.trim().split(/[ \t]+/),n=r.shift();switch(n){case"%TAG":{if(r.length!==2){if(t(0,"%TAG directive should contain exactly two parts"),r.length<2)return!1}let[s,o]=r;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;else{let o=/^\d+\.\d+$/.test(s);return t(6,`Unsupported YAML version ${s}`,o),!1}}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);if(o==="!"||o==="!!")return t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null;if(e[e.length-1]!==">")t("Verbatim tags must end with a >");return o}let[,r,n]=e.match(/^(.*!)([^!]*)$/s);if(!n)t(`The ${e} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(n)}catch(o){return t(String(o)),null}if(r==="!")return e;return t(`Could not resolve tag: ${e}`),null}tagString(e){for(let[t,r]of Object.entries(this.tags))if(e.startsWith(r))return t+Ag(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(e&&r.length>0&&Sa.isNode(e.contents)){let s={};xg.visit(e.contents,(o,i)=>{if(Sa.isNode(i)&&i.tag)s[i.tag]=!0}),n=Object.keys(s)}else n=[];for(let[s,o]of r){if(s==="!!"&&o==="tag:yaml.org,2002:")continue;if(!e||n.some((i)=>i.startsWith(o)))t.push(`%TAG ${s} ${o}`)}return t.join(`
4
+ `)}}ce.defaultYaml={explicit:!1,version:"1.2"};ce.defaultTags={"!!":"tag:yaml.org,2002:"};$g.Directives=ce});var Jr=A(function(Ig){var Aa=I(),Eg=Vt();function Tg(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(r)}return!0}function $a(e){let t=new Set;return Eg.visit(e,{Value(r,n){if(n.anchor)t.add(n.anchor)}}),t}function Pa(e,t){for(let r=1;;++r){let n=`${e}${r}`;if(!t.has(n))return n}}function Og(e,t){let r=[],n=new Map,s=null;return{onAnchor:(o)=>{r.push(o),s??(s=$a(e));let i=Pa(t,s);return s.add(i),i},setAnchors:()=>{for(let o of r){let i=n.get(o);if(typeof i==="object"&&i.anchor&&(Aa.isScalar(i.node)||Aa.isCollection(i.node)))i.node.anchor=i.anchor;else{let a=Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}Ig.anchorIsValid=Tg;Ig.anchorNames=$a;Ig.createNodeAnchors=Og;Ig.findNewAnchor=Pa});var js=A(function(Lg){function Yt(e,t,r,n){if(n&&typeof n==="object")if(Array.isArray(n))for(let s=0,o=n.length;s<o;++s){let i=n[s],a=Yt(e,n,String(s),i);if(a===void 0)delete n[s];else if(a!==i)n[s]=a}else if(n instanceof Map)for(let s of Array.from(n.keys())){let o=n.get(s),i=Yt(e,n,s,o);if(i===void 0)n.delete(s);else if(i!==o)n.set(s,i)}else if(n instanceof Set)for(let s of Array.from(n)){let o=Yt(e,n,s,s);if(o===void 0)n.delete(s);else if(o!==s)n.delete(s),n.add(o)}else for(let[s,o]of Object.entries(n)){let i=Yt(e,n,s,o);if(i===void 0)delete n[s];else if(i!==o)n[s]=i}return e.call(t,r,n)}Lg.applyReviver=Yt});var Be=A(function(Ug){var jg=I();function Ea(e,t,r){if(Array.isArray(e))return e.map((n,s)=>Ea(n,String(s),r));if(e&&typeof e.toJSON==="function"){if(!r||!jg.hasAnchor(e))return e.toJSON(t,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(e,n),r.onCreate=(o)=>{n.res=o,delete r.onCreate};let s=e.toJSON(t,r);if(r.onCreate)r.onCreate(s);return s}if(typeof e==="bigint"&&!r?.keep)return Number(e);return e}Ug.toJS=Ea});var Qr=A(function(Bg){var Mg=js(),Ta=I(),qg=Be();class Oa{constructor(e){Object.defineProperty(this,Ta.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)e.range=this.range.slice();return e}toJS(e,{mapAsMap:t,maxAliasCount:r,onAnchor:n,reviver:s}={}){if(!Ta.isDocument(e))throw TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof r==="number"?r:100},i=qg.toJS(this,"",o);if(typeof n==="function")for(let{count:a,res:c}of o.anchors.values())n(c,a);return typeof s==="function"?Mg.applyReviver(s,{"":i},"",i):i}}Bg.NodeBase=Oa});var Jt=A(function(Vg){var Fg=Jr(),Gg=Vt(),Pt=I(),Hg=Qr(),Wg=Be();class Ia extends Hg.NodeBase{constructor(e){super(Pt.ALIAS);this.source=e,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let r;if(t?.aliasResolveCache)r=t.aliasResolveCache;else if(r=[],Gg.visit(e,{Node:(s,o)=>{if(Pt.isAlias(o)||Pt.hasAnchor(o))r.push(o)}}),t)t.aliasResolveCache=r;let n=void 0;for(let s of r){if(s===this)break;if(s.anchor===this.source)n=s}if(n&&t){let{anchors:s,doc:o,maxAliasCount:i}=t,a=s.get(n);if(!a)Wg.toJS(n,null,t),a=s.get(n);if(a?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(i>=0){if(a.count+=1,a.aliasCount===0)a.aliasCount=Xr(o,n,s);if(a.count*a.aliasCount>i)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}}return n}toJSON(e,t){if(!t)return{source:this.source};let r=this.resolve(t.doc,t);if(!r){let n=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(n)}return t.anchors.get(r).res}toString(e,t,r){let n=`*${this.source}`;if(e){if(Fg.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(s)}if(e.implicitKey)return`${n} `}return n}}function Xr(e,t,r){if(Pt.isAlias(t)){let n=t.resolve(e),s=r&&n&&r.get(n);return s?s.count*s.aliasCount:0}else if(Pt.isCollection(t)){let n=0;for(let s of t.items){let o=Xr(e,s,r);if(o>n)n=o}return n}else if(Pt.isPair(t)){let n=Xr(e,t.key,r),s=Xr(e,t.value,r);return Math.max(n,s)}return 1}Vg.Alias=Ia});var H=A(function(ty){var Jg=I(),Qg=Qr(),Xg=Be(),ey=(e)=>!e||typeof e!=="function"&&typeof e!=="object";class it extends Qg.NodeBase{constructor(e){super(Jg.SCALAR);this.value=e}toJSON(e,t){return t?.keep?this.value:Xg.toJS(this.value,e,t)}toString(){return String(this.value)}}it.BLOCK_FOLDED="BLOCK_FOLDED";it.BLOCK_LITERAL="BLOCK_LITERAL";it.PLAIN="PLAIN";it.QUOTE_DOUBLE="QUOTE_DOUBLE";it.QUOTE_SINGLE="QUOTE_SINGLE";ty.Scalar=it;ty.isScalarValue=ey});var Qt=A(function(cy){var sy=Jt(),at=I(),Na=H(),oy="tag:yaml.org,2002:";function iy(e,t,r){if(t){let n=r.filter((o)=>o.tag===t),s=n.find((o)=>!o.format)??n[0];if(!s)throw Error(`Tag ${t} not found`);return s}return r.find((n)=>n.identify?.(e)&&!n.format)}function ay(e,t,r){if(at.isDocument(e))e=e.contents;if(at.isNode(e))return e;if(at.isPair(e)){let f=r.schema[at.MAP].createNode?.(r.schema,null,r);return f.items.push(e),f}if(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)e=e.valueOf();let{aliasDuplicateObjects:n,onAnchor:s,onTagObj:o,schema:i,sourceObjects:a}=r,c=void 0;if(n&&e&&typeof e==="object")if(c=a.get(e),c)return c.anchor??(c.anchor=s(e)),new sy.Alias(c.anchor);else c={anchor:null,node:null},a.set(e,c);if(t?.startsWith("!!"))t=oy+t.slice(2);let u=iy(e,t,i.tags);if(!u){if(e&&typeof e.toJSON==="function")e=e.toJSON();if(!e||typeof e!=="object"){let f=new Na.Scalar(e);if(c)c.node=f;return f}u=e instanceof Map?i[at.MAP]:(Symbol.iterator in Object(e))?i[at.SEQ]:i[at.MAP]}if(o)o(u),delete r.onTagObj;let l=u?.createNode?u.createNode(r.schema,e,r):typeof u?.nodeClass?.from==="function"?u.nodeClass.from(r.schema,e,r):new Na.Scalar(e);if(t)l.tag=t;else if(!u.default)l.tag=u.tag;if(c)c.node=l;return l}cy.createNode=ay});var en=A(function(fy){var ly=Qt(),ke=I(),py=Qr();function Us(e,t,r){let n=r;for(let s=t.length-1;s>=0;--s){let o=t[s];if(typeof o==="number"&&Number.isInteger(o)&&o>=0){let i=[];i[o]=n,n=i}else n=new Map([[o,n]])}return ly.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Ra=(e)=>e==null||typeof e==="object"&&!!e[Symbol.iterator]().next().done;class Ca extends py.NodeBase{constructor(e,t){super(e);Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(e)t.schema=e;if(t.items=t.items.map((r)=>ke.isNode(r)||ke.isPair(r)?r.clone(e):r),this.range)t.range=this.range.slice();return t}addIn(e,t){if(Ra(e))this.add(t);else{let[r,...n]=e,s=this.get(r,!0);if(ke.isCollection(s))s.addIn(n,t);else if(s===void 0&&this.schema)this.set(r,Us(this.schema,n,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let n=this.get(t,!0);if(ke.isCollection(n))return n.deleteIn(r);else throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...n]=e,s=this.get(r,!0);if(n.length===0)return!t&&ke.isScalar(s)?s.value:s;else return ke.isCollection(s)?s.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every((t)=>{if(!ke.isPair(t))return!1;let r=t.value;return r==null||e&&ke.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let n=this.get(t,!0);return ke.isCollection(n)?n.hasIn(r):!1}setIn(e,t){let[r,...n]=e;if(n.length===0)this.set(r,t);else{let s=this.get(r,!0);if(ke.isCollection(s))s.setIn(n,t);else if(s===void 0&&this.schema)this.set(r,Us(this.schema,n,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}}fy.Collection=Ca;fy.collectionFromPath=Us;fy.isEmptyPath=Ra});var Xt=A(function(wy){var gy=(e)=>e.replace(/^(?!$)(?: $)?/gm,"#");function Zs(e,t){if(/^\n+$/.test(e))return e.substring(1);return t?e.replace(/^(?! *$)/gm,t):e}var yy=(e,t,r)=>e.endsWith(`
5
+ `)?Zs(r,t):r.includes(`
6
+ `)?`
7
+ `+Zs(r,t):(e.endsWith(" ")?"":" ")+r;wy.indentComment=Zs;wy.lineComment=yy;wy.stringifyComment=gy});var La=A(function(xy){function ky(e,t,r="flow",{indentAtStart:n,lineWidth:s=80,minContentWidth:o=20,onFold:i,onOverflow:a}={}){if(!s||s<0)return e;if(s<o)o=0;let c=Math.max(1+o,1+s-t.length);if(e.length<=c)return e;let u=[],l={},f=s-t.length;if(typeof n==="number")if(n>s-Math.max(2,o))u.push(0);else f=s-n;let p=void 0,d=void 0,h=!1,m=-1,g=-1,_=-1;if(r==="block"){if(m=za(e,m,t.length),m!==-1)f=m+c}for(let x;x=e[m+=1];){if(r==="quoted"&&x==="\\"){switch(g=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}_=m}if(x===`
8
+ `){if(r==="block")m=za(e,m,t.length);f=m+t.length+c,p=void 0}else{if(x===" "&&d&&d!==" "&&d!==`
9
+ `&&d!=="\t"){let b=e[m+1];if(b&&b!==" "&&b!==`
10
+ `&&b!=="\t")p=m}if(m>=f)if(p)u.push(p),f=p+c,p=void 0;else if(r==="quoted"){while(d===" "||d==="\t")d=x,x=e[m+=1],h=!0;let b=m>_+1?m-2:g-1;if(l[b])return e;u.push(b),l[b]=!0,f=b+c,p=void 0}else h=!0}d=x}if(h&&a)a();if(u.length===0)return e;if(i)i();let S=e.slice(0,u[0]);for(let x=0;x<u.length;++x){let b=u[x],v=u[x+1]||e.length;if(b===0)S=`
11
+ ${t}${e.slice(0,v)}`;else{if(r==="quoted"&&l[b])S+=`${e[b]}\\`;S+=`
12
+ ${t}${e.slice(b+1,v)}`}}return S}function za(e,t,r){let n=t,s=t+1,o=e[s];while(o===" "||o==="\t")if(t<s+r)o=e[++t];else{do o=e[++t];while(o&&o!==`
13
+ `);n=t,s=t+1,o=e[s]}return n}xy.FOLD_BLOCK="block";xy.FOLD_FLOW="flow";xy.FOLD_QUOTED="quoted";xy.foldFlowLines=ky});var tr=A(function(Iy){var me=H(),Ke=La(),rn=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),nn=(e)=>/^(%|---|\.\.\.)/m.test(e);function Ey(e,t,r){if(!t||t<0)return!1;let n=t-r,s=e.length;if(s<=n)return!1;for(let o=0,i=0;o<s;++o)if(e[o]===`
14
+ `){if(o-i>n)return!0;if(i=o+1,s-i<=n)return!1}return!0}function er(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=t,s=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(nn(e)?" ":""),i="",a=0;for(let c=0,u=r[c];u;u=r[++c]){if(u===" "&&r[c+1]==="\\"&&r[c+2]==="n")i+=r.slice(a,c)+"\\ ",c+=1,a=c,u="\\";if(u==="\\")switch(r[c+1]){case"u":{i+=r.slice(a,c);let l=r.substr(c+2,4);switch(l){case"0000":i+="\\0";break;case"0007":i+="\\a";break;case"000b":i+="\\v";break;case"001b":i+="\\e";break;case"0085":i+="\\N";break;case"00a0":i+="\\_";break;case"2028":i+="\\L";break;case"2029":i+="\\P";break;default:if(l.substr(0,2)==="00")i+="\\x"+l.substr(2);else i+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length<s)c+=1;else{i+=r.slice(a,c)+`
15
+
16
+ `;while(r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"')i+=`
17
+ `,c+=2;if(i+=o,r[c+2]===" ")i+="\\";c+=1,a=c+1}break;default:c+=1}}return i=a?i+r.slice(a):r,n?i:Ke.foldFlowLines(i,o,Ke.FOLD_QUOTED,rn(t,!1))}function Ms(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
18
+ `)||/[ \t]\n|\n[ \t]/.test(e))return er(e,t);let r=t.indent||(nn(e)?" ":""),n="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
19
+ ${r}`)+"'";return t.implicitKey?n:Ke.foldFlowLines(n,r,Ke.FOLD_FLOW,rn(t,!1))}function Et(e,t){let{singleQuote:r}=t.options,n;if(r===!1)n=er;else{let s=e.includes('"'),o=e.includes("'");if(s&&!o)n=Ms;else if(o&&!s)n=er;else n=r?Ms:er}return n(e,t)}var qs;try{qs=new RegExp(`(^|(?<!
20
+ ))
21
+ +(?!
22
+ |$)`,"g")}catch{qs=/\n+(?!\n|$)/g}function tn({comment:e,type:t,value:r},n,s,o){let{blockQuote:i,commentString:a,lineWidth:c}=n.options;if(!i||/\n[\t ]+$/.test(r))return Et(r,n);let u=n.indent||(n.forceBlockIndent||nn(r)?" ":""),l=i==="literal"?!0:i==="folded"||t===me.Scalar.BLOCK_FOLDED?!1:t===me.Scalar.BLOCK_LITERAL?!0:!Ey(r,c,u.length);if(!r)return l?`|
23
+ `:`>
24
+ `;let f,p;for(p=r.length;p>0;--p){let v=r[p-1];if(v!==`
25
+ `&&v!=="\t"&&v!==" ")break}let d=r.substring(p),h=d.indexOf(`
26
+ `);if(h===-1)f="-";else if(r===d||h!==d.length-1){if(f="+",o)o()}else f="";if(d){if(r=r.slice(0,-d.length),d[d.length-1]===`
27
+ `)d=d.slice(0,-1);d=d.replace(qs,`$&${u}`)}let m=!1,g,_=-1;for(g=0;g<r.length;++g){let v=r[g];if(v===" ")m=!0;else if(v===`
28
+ `)_=g;else break}let S=r.substring(0,_<g?_+1:g);if(S)r=r.substring(S.length),S=S.replace(/\n+/g,`$&${u}`);let b=(m?u?"2":"1":"")+f;if(e){if(b+=" "+a(e.replace(/ ?[\r\n]+/g," ")),s)s()}if(!l){let v=r.replace(/\n+/g,`
29
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),k=!1,T=rn(n,!0);if(i!=="folded"&&t!==me.Scalar.BLOCK_FOLDED)T.onOverflow=()=>{k=!0};let P=Ke.foldFlowLines(`${S}${v}${d}`,u,Ke.FOLD_BLOCK,T);if(!k)return`>${b}
30
+ ${u}${P}`}return r=r.replace(/\n+/g,`$&${u}`),`|${b}
31
+ ${u}${S}${r}${d}`}function Ty(e,t,r,n){let{type:s,value:o}=e,{actualString:i,implicitKey:a,indent:c,indentStep:u,inFlow:l}=t;if(a&&o.includes(`
32
+ `)||l&&/[[\]{},]/.test(o))return Et(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||l||!o.includes(`
33
+ `)?Et(o,t):tn(e,t,r,n);if(!a&&!l&&s!==me.Scalar.PLAIN&&o.includes(`
34
+ `))return tn(e,t,r,n);if(nn(o)){if(c==="")return t.forceBlockIndent=!0,tn(e,t,r,n);else if(a&&c===u)return Et(o,t)}let f=o.replace(/\n+/g,`$&
35
+ ${c}`);if(i){let p=(m)=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:d,tags:h}=t.doc.schema;if(h.some(p)||d?.some(p))return Et(o,t)}return a?f:Ke.foldFlowLines(f,c,Ke.FOLD_FLOW,rn(t,!1))}function Oy(e,t,r,n){let{implicitKey:s,inFlow:o}=t,i=typeof e.value==="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;if(a!==me.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(i.value))a=me.Scalar.QUOTE_DOUBLE}let c=(l)=>{switch(l){case me.Scalar.BLOCK_FOLDED:case me.Scalar.BLOCK_LITERAL:return s||o?Et(i.value,t):tn(i,t,r,n);case me.Scalar.QUOTE_DOUBLE:return er(i.value,t);case me.Scalar.QUOTE_SINGLE:return Ms(i.value,t);case me.Scalar.PLAIN:return Ty(i,t,r,n);default:return null}},u=c(a);if(u===null){let{defaultKeyType:l,defaultStringType:f}=t.options,p=s&&l||f;if(u=c(p),u===null)throw Error(`Unsupported default string type ${p}`)}return u}Iy.stringifyString=Oy});var rr=A(function(Zy){var Ry=Jr(),Fe=I(),Cy=Xt(),zy=tr();function Ly(e,t){let r=Object.assign({blockQuote:!0,commentString:Cy.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent==="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function Dy(e,t){if(t.tag){let s=e.filter((o)=>o.tag===t.tag);if(s.length>0)return s.find((o)=>o.format===t.format)??s[0]}let r=void 0,n;if(Fe.isScalar(t)){n=t.value;let s=e.filter((o)=>o.identify?.(n));if(s.length>1){let o=s.filter((i)=>i.test);if(o.length>0)s=o}r=s.find((o)=>o.format===t.format)??s.find((o)=>!o.format)}else n=t,r=e.find((s)=>s.nodeClass&&n instanceof s.nodeClass);if(!r){let s=n?.constructor?.name??(n===null?"null":typeof n);throw Error(`Tag not resolved for ${s} value`)}return r}function jy(e,t,{anchors:r,doc:n}){if(!n.directives)return"";let s=[],o=(Fe.isScalar(e)||Fe.isCollection(e))&&e.anchor;if(o&&Ry.anchorIsValid(o))r.add(o),s.push(`&${o}`);let i=e.tag??(t.default?null:t.tag);if(i)s.push(n.directives.tagString(i));return s.join(" ")}function Uy(e,t,r,n){if(Fe.isPair(e))return e.toString(t,r,n);if(Fe.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(t.resolvedAliases)t.resolvedAliases.add(e);else t.resolvedAliases=new Set([e]);e=e.resolve(t.doc)}}let s=void 0,o=Fe.isNode(e)?e:t.doc.createNode(e,{onTagObj:(c)=>s=c});s??(s=Dy(t.doc.schema.tags,o));let i=jy(o,s,t);if(i.length>0)t.indentAtStart=(t.indentAtStart??0)+i.length+1;let a=typeof s.stringify==="function"?s.stringify(o,t,r,n):Fe.isScalar(o)?zy.stringifyString(o,t,r,n):o.toString(t,r,n);if(!i)return a;return Fe.isScalar(o)||a[0]==="{"||a[0]==="["?`${i} ${a}`:`${i}
36
+ ${t.indent}${a}`}Zy.createStringifyContext=Ly;Zy.stringify=Uy});var Ua=A(function(Ky){var Le=I(),Da=H(),ja=rr(),nr=Xt();function By({key:e,value:t},r,n,s){let{allNullValues:o,doc:i,indent:a,indentStep:c,options:{commentString:u,indentSeq:l,simpleKeys:f}}=r,p=Le.isNode(e)&&e.comment||null;if(f){if(p)throw Error("With simple keys, key nodes cannot have comments");if(Le.isCollection(e)||!Le.isNode(e)&&typeof e==="object")throw Error("With simple keys, collection cannot be used as a key value")}let d=!f&&(!e||p&&t==null&&!r.inFlow||Le.isCollection(e)||(Le.isScalar(e)?e.type===Da.Scalar.BLOCK_FOLDED||e.type===Da.Scalar.BLOCK_LITERAL:typeof e==="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!d&&(f||!o),indent:a+c});let h=!1,m=!1,g=ja.stringify(e,r,()=>h=!0,()=>m=!0);if(!d&&!r.inFlow&&g.length>1024){if(f)throw Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(r.inFlow){if(o||t==null){if(h&&n)n();return g===""?"?":d?`? ${g}`:g}}else if(o&&!f||t==null&&d){if(g=`? ${g}`,p&&!h)g+=nr.lineComment(g,r.indent,u(p));else if(m&&s)s();return g}if(h)p=null;if(d){if(p)g+=nr.lineComment(g,r.indent,u(p));g=`? ${g}
37
+ ${a}:`}else if(g=`${g}:`,p)g+=nr.lineComment(g,r.indent,u(p));let _,S,x;if(Le.isNode(t))_=!!t.spaceBefore,S=t.commentBefore,x=t.comment;else if(_=!1,S=null,x=null,t&&typeof t==="object")t=i.createNode(t);if(r.implicitKey=!1,!d&&!p&&Le.isScalar(t))r.indentAtStart=g.length+1;if(m=!1,!l&&c.length>=2&&!r.inFlow&&!d&&Le.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor)r.indent=r.indent.substring(2);let b=!1,v=ja.stringify(t,r,()=>b=!0,()=>m=!0),k=" ";if(p||_||S){if(k=_?`
38
+ `:"",S){let T=u(S);k+=`
39
+ ${nr.indentComment(T,r.indent)}`}if(v===""&&!r.inFlow){if(k===`
40
+ `&&x)k=`
41
+
42
+ `}else k+=`
43
+ ${r.indent}`}else if(!d&&Le.isCollection(t)){let T=v[0],P=v.indexOf(`
44
+ `),K=P!==-1,ae=r.inFlow??t.flow??t.items.length===0;if(K||!ae){let Ce=!1;if(K&&(T==="&"||T==="!")){let G=v.indexOf(" ");if(T==="&"&&G!==-1&&G<P&&v[G+1]==="!")G=v.indexOf(" ",G+1);if(G===-1||P<G)Ce=!0}if(!Ce)k=`
45
+ ${r.indent}`}}else if(v===""||v[0]===`
46
+ `)k="";if(g+=k+v,r.inFlow){if(b&&n)n()}else if(x&&!b)g+=nr.lineComment(g,r.indent,u(x));else if(m&&s)s();return g}Ky.stringifyPair=By});var Bs=A(function(Wy){var Za=he("process");function Gy(e,...t){if(e==="debug")console.log(...t)}function Hy(e,t){if(e==="debug"||e==="warn")if(typeof Za.emitWarning==="function")Za.emitWarning(t);else console.warn(t)}Wy.debug=Gy;Wy.warn=Hy});var cn=A(function(Qy){var an=I(),Ma=H(),sn="<<",on={identify:(e)=>e===sn||typeof e==="symbol"&&e.description===sn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ma.Scalar(Symbol(sn)),{addToJSMap:qa}),stringify:()=>sn},Jy=(e,t)=>(on.identify(t)||an.isScalar(t)&&(!t.type||t.type===Ma.Scalar.PLAIN)&&on.identify(t.value))&&e?.doc.schema.tags.some((r)=>r.tag===on.tag&&r.default);function qa(e,t,r){let n=Ba(e,r);if(an.isSeq(n))for(let s of n.items)Ks(e,t,s);else if(Array.isArray(n))for(let s of n)Ks(e,t,s);else Ks(e,t,n)}function Ks(e,t,r){let n=Ba(e,r);if(!an.isMap(n))throw Error("Merge sources must be maps or map aliases");let s=n.toJSON(null,e,Map);for(let[o,i]of s)if(t instanceof Map){if(!t.has(o))t.set(o,i)}else if(t instanceof Set)t.add(o);else if(!Object.prototype.hasOwnProperty.call(t,o))Object.defineProperty(t,o,{value:i,writable:!0,enumerable:!0,configurable:!0});return t}function Ba(e,t){return e&&an.isAlias(t)?t.resolve(e.doc,e):t}Qy.addMergeToJSMap=qa;Qy.isMergeKey=Jy;Qy.merge=on});var Gs=A(function(iw){var rw=Bs(),Ka=cn(),nw=rr(),Fa=I(),Fs=Be();function sw(e,t,{key:r,value:n}){if(Fa.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,n);else if(Ka.isMergeKey(e,r))Ka.addMergeToJSMap(e,t,n);else{let s=Fs.toJS(r,"",e);if(t instanceof Map)t.set(s,Fs.toJS(n,s,e));else if(t instanceof Set)t.add(s);else{let o=ow(r,s,e),i=Fs.toJS(n,o,e);if(o in t)Object.defineProperty(t,o,{value:i,writable:!0,enumerable:!0,configurable:!0});else t[o]=i}}return t}function ow(e,t,r){if(t===null)return"";if(typeof t!=="object")return String(t);if(Fa.isNode(e)&&r?.doc){let n=nw.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let s=e.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(s);if(o.length>40)o=o.substring(0,36)+'..."';rw.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return s}return JSON.stringify(t)}iw.addPairToJSMap=sw});var Ge=A(function(pw){var Ga=Qt(),cw=Ua(),uw=Gs(),un=I();function lw(e,t,r){let n=Ga.createNode(e,void 0,r),s=Ga.createNode(t,void 0,r);return new ln(n,s)}class ln{constructor(e,t=null){Object.defineProperty(this,un.NODE_TYPE,{value:un.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:r}=this;if(un.isNode(t))t=t.clone(e);if(un.isNode(r))r=r.clone(e);return new ln(t,r)}toJSON(e,t){let r=t?.mapAsMap?new Map:{};return uw.addPairToJSMap(t,r,this)}toString(e,t,r){return e?.doc?cw.stringifyPair(this,e,t,r):JSON.stringify(this)}}pw.Pair=ln;pw.createPair=lw});var Hs=A(function(yw){var ct=I(),Ha=rr(),pn=Xt();function hw(e,t,r){return(t.inFlow??e.flow?gw:mw)(e,t,r)}function mw({comment:e,items:t},r,{blockItemPrefix:n,flowChars:s,itemIndent:o,onChompKeep:i,onComment:a}){let{indent:c,options:{commentString:u}}=r,l=Object.assign({},r,{indent:o,type:null}),f=!1,p=[];for(let h=0;h<t.length;++h){let m=t[h],g=null;if(ct.isNode(m)){if(!f&&m.spaceBefore)p.push("");if(fn(r,p,m.commentBefore,f),m.comment)g=m.comment}else if(ct.isPair(m)){let S=ct.isNode(m.key)?m.key:null;if(S){if(!f&&S.spaceBefore)p.push("");fn(r,p,S.commentBefore,f)}}f=!1;let _=Ha.stringify(m,l,()=>g=null,()=>f=!0);if(g)_+=pn.lineComment(_,o,u(g));if(f&&g)f=!1;p.push(n+_)}let d;if(p.length===0)d=s.start+s.end;else{d=p[0];for(let h=1;h<p.length;++h){let m=p[h];d+=m?`
47
+ ${c}${m}`:`
48
+ `}}if(e){if(d+=`
49
+ `+pn.indentComment(u(e),c),a)a()}else if(f&&i)i();return d}function gw({items:e},t,{flowChars:r,itemIndent:n}){let{indent:s,indentStep:o,flowCollectionPadding:i,options:{commentString:a}}=t;n+=o;let c=Object.assign({},t,{indent:n,inFlow:!0,type:null}),u=!1,l=0,f=[];for(let h=0;h<e.length;++h){let m=e[h],g=null;if(ct.isNode(m)){if(m.spaceBefore)f.push("");if(fn(t,f,m.commentBefore,!1),m.comment)g=m.comment}else if(ct.isPair(m)){let S=ct.isNode(m.key)?m.key:null;if(S){if(S.spaceBefore)f.push("");if(fn(t,f,S.commentBefore,!1),S.comment)u=!0}let x=ct.isNode(m.value)?m.value:null;if(x){if(x.comment)g=x.comment;if(x.commentBefore)u=!0}else if(m.value==null&&S?.comment)g=S.comment}if(g)u=!0;let _=Ha.stringify(m,c,()=>g=null);if(u||(u=f.length>l||_.includes(`
50
+ `)),h<e.length-1)_+=",";else if(t.options.trailingComma){if(t.options.lineWidth>0)u||(u=f.reduce((S,x)=>S+x.length+2,2)+(_.length+2)>t.options.lineWidth);if(u)_+=","}if(g)_+=pn.lineComment(_,n,a(g));f.push(_),l=f.length}let{start:p,end:d}=r;if(f.length===0)return p+d;else{if(!u){let h=f.reduce((m,g)=>m+g.length+2,2);u=t.options.lineWidth>0&&h>t.options.lineWidth}if(u){let h=p;for(let m of f)h+=m?`
51
+ ${o}${s}${m}`:`
52
+ `;return`${h}
53
+ ${s}${d}`}else return`${p}${i}${f.join(" ")}${i}${d}`}}function fn({indent:e,options:{commentString:t}},r,n,s){if(n&&s)n=n.replace(/^\n+/,"");if(n){let o=pn.indentComment(t(n),e);r.push(o.trimStart())}}yw.stringifyCollection=hw});var We=A(function(xw){var bw=Hs(),_w=Gs(),vw=en(),He=I(),dn=Ge(),kw=H();function sr(e,t){let r=He.isScalar(t)?t.value:t;for(let n of e)if(He.isPair(n)){if(n.key===t||n.key===r)return n;if(He.isScalar(n.key)&&n.key.value===r)return n}return}class Wa extends vw.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(He.MAP,e);this.items=[]}static from(e,t,r){let{keepUndefined:n,replacer:s}=r,o=new this(e),i=(a,c)=>{if(typeof s==="function")c=s.call(t,a,c);else if(Array.isArray(s)&&!s.includes(a))return;if(c!==void 0||n)o.items.push(dn.createPair(a,c,r))};if(t instanceof Map)for(let[a,c]of t)i(a,c);else if(t&&typeof t==="object")for(let a of Object.keys(t))i(a,t[a]);if(typeof e.sortMapEntries==="function")o.items.sort(e.sortMapEntries);return o}add(e,t){let r;if(He.isPair(e))r=e;else if(!e||typeof e!=="object"||!("key"in e))r=new dn.Pair(e,e?.value);else r=new dn.Pair(e.key,e.value);let n=sr(this.items,r.key),s=this.schema?.sortMapEntries;if(n){if(!t)throw Error(`Key ${r.key} already set`);if(He.isScalar(n.value)&&kw.isScalarValue(r.value))n.value.value=r.value;else n.value=r.value}else if(s){let o=this.items.findIndex((i)=>s(r,i)<0);if(o===-1)this.items.push(r);else this.items.splice(o,0,r)}else this.items.push(r)}delete(e){let t=sr(this.items,e);if(!t)return!1;return this.items.splice(this.items.indexOf(t),1).length>0}get(e,t){let n=sr(this.items,e)?.value;return(!t&&He.isScalar(n)?n.value:n)??void 0}has(e){return!!sr(this.items,e)}set(e,t){this.add(new dn.Pair(e,t),!0)}toJSON(e,t,r){let n=r?new r:t?.mapAsMap?new Map:{};if(t?.onCreate)t.onCreate(n);for(let s of this.items)_w.addPairToJSMap(t,n,s);return n}toString(e,t,r){if(!e)return JSON.stringify(this);for(let n of this.items)if(!He.isPair(n))throw Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);if(!e.allNullValues&&this.hasAllNullValues(!1))e=Object.assign({},e,{allNullValues:!0});return bw.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:t})}}xw.YAMLMap=Wa;xw.findPair=sr});var Tt=A(function(Ew){var $w=I(),Va=We(),Pw={collection:"map",default:!0,nodeClass:Va.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){if(!$w.isMap(e))t("Expected a mapping for this tag");return e},createNode:(e,t,r)=>Va.YAMLMap.from(e,t,r)};Ew.map=Pw});var Ve=A(function(zw){var Ow=Qt(),Iw=Hs(),Nw=en(),mn=I(),Rw=H(),Cw=Be();class Ya extends Nw.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(mn.SEQ,e);this.items=[]}add(e){this.items.push(e)}delete(e){let t=hn(e);if(typeof t!=="number")return!1;return this.items.splice(t,1).length>0}get(e,t){let r=hn(e);if(typeof r!=="number")return;let n=this.items[r];return!t&&mn.isScalar(n)?n.value:n}has(e){let t=hn(e);return typeof t==="number"&&t<this.items.length}set(e,t){let r=hn(e);if(typeof r!=="number")throw Error(`Expected a valid index, not ${e}.`);let n=this.items[r];if(mn.isScalar(n)&&Rw.isScalarValue(t))n.value=t;else this.items[r]=t}toJSON(e,t){let r=[];if(t?.onCreate)t.onCreate(r);let n=0;for(let s of this.items)r.push(Cw.toJS(s,String(n++),t));return r}toString(e,t,r){if(!e)return JSON.stringify(this);return Iw.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:t})}static from(e,t,r){let{replacer:n}=r,s=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let i of t){if(typeof n==="function"){let a=t instanceof Set?i:String(o++);i=n.call(t,a,i)}s.items.push(Ow.createNode(i,void 0,r))}}return s}}function hn(e){let t=mn.isScalar(e)?e.value:e;if(t&&typeof t==="string")t=Number(t);return typeof t==="number"&&Number.isInteger(t)&&t>=0?t:null}zw.YAMLSeq=Ya});var Ot=A(function(Uw){var Dw=I(),Ja=Ve(),jw={collection:"seq",default:!0,nodeClass:Ja.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){if(!Dw.isSeq(e))t("Expected a sequence for this tag");return e},createNode:(e,t,r)=>Ja.YAMLSeq.from(e,t,r)};Uw.seq=jw});var or=A(function(Bw){var Mw=tr(),qw={identify:(e)=>typeof e==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(e)=>e,stringify(e,t,r,n){return t=Object.assign({actualString:!0},t),Mw.stringifyString(e,t,r,n)}};Bw.string=qw});var gn=A(function(Fw){var Qa=H(),Xa={identify:(e)=>e==null,createNode:()=>new Qa.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Qa.Scalar(null),stringify:({source:e},t)=>typeof e==="string"&&Xa.test.test(e)?e:t.options.nullStr};Fw.nullTag=Xa});var Ws=A(function(Ww){var Hw=H(),ec={identify:(e)=>typeof e==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(e)=>new Hw.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},r){if(e&&ec.test.test(e)){let n=e[0]==="t"||e[0]==="T";if(t===n)return e}return t?r.options.trueStr:r.options.falseStr}};Ww.boolTag=ec});var It=A(function(Jw){function Yw({format:e,minFractionDigits:t,tag:r,value:n}){if(typeof n==="bigint")return String(n);let s=typeof n==="number"?n:Number(n);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!e&&t&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let i=o.indexOf(".");if(i<0)i=o.length,o+=".";let a=t-(o.length-i-1);while(a-- >0)o+="0"}return o}Jw.stringifyNumber=Yw});var Ys=A(function(nb){var Xw=H(),Vs=It(),eb={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(e)=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Vs.stringifyNumber},tb={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:(e)=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Vs.stringifyNumber(e)}},rb={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Xw.Scalar(parseFloat(e)),r=e.indexOf(".");if(r!==-1&&e[e.length-1]==="0")t.minFractionDigits=e.length-r-1;return t},stringify:Vs.stringifyNumber};nb.float=rb;nb.floatExp=tb;nb.floatNaN=eb});var Qs=A(function(lb){var tc=It(),yn=(e)=>typeof e==="bigint"||Number.isInteger(e),Js=(e,t,r,{intAsBigInt:n})=>n?BigInt(e):parseInt(e.substring(t),r);function rc(e,t,r){let{value:n}=e;if(yn(n)&&n>=0)return r+n.toString(t);return tc.stringifyNumber(e)}var ab={identify:(e)=>yn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>Js(e,2,8,r),stringify:(e)=>rc(e,8,"0o")},cb={identify:yn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>Js(e,0,10,r),stringify:tc.stringifyNumber},ub={identify:(e)=>yn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>Js(e,2,16,r),stringify:(e)=>rc(e,16,"0x")};lb.int=cb;lb.intHex=ub;lb.intOct=ab});var nc=A(function(_b){var hb=Tt(),mb=gn(),gb=Ot(),yb=or(),wb=Ws(),Xs=Ys(),eo=Qs(),bb=[hb.map,gb.seq,yb.string,mb.nullTag,wb.boolTag,eo.intOct,eo.int,eo.intHex,Xs.floatNaN,Xs.floatExp,Xs.float];_b.schema=bb});var oc=A(function(Eb){var kb=H(),xb=Tt(),Sb=Ot();function sc(e){return typeof e==="bigint"||Number.isInteger(e)}var wn=({value:e})=>JSON.stringify(e),Ab=[{identify:(e)=>typeof e==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(e)=>e,stringify:wn},{identify:(e)=>e==null,createNode:()=>new kb.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:wn},{identify:(e)=>typeof e==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(e)=>e==="true",stringify:wn},{identify:sc,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:r})=>r?BigInt(e):parseInt(e,10),stringify:({value:e})=>sc(e)?e.toString():JSON.stringify(e)},{identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:(e)=>parseFloat(e),stringify:wn}],$b={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Pb=[xb.map,Sb.seq].concat(Ab,$b);Eb.schema=Pb});var ro=A(function(Nb){var ir=he("buffer"),to=H(),Ob=tr(),Ib={identify:(e)=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof ir.Buffer==="function")return ir.Buffer.from(e,"base64");else if(typeof atob==="function"){let r=atob(e.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let s=0;s<r.length;++s)n[s]=r.charCodeAt(s);return n}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:r},n,s,o){if(!r)return"";let i=r,a;if(typeof ir.Buffer==="function")a=i instanceof ir.Buffer?i.toString("base64"):ir.Buffer.from(i.buffer).toString("base64");else if(typeof btoa==="function"){let c="";for(let u=0;u<i.length;++u)c+=String.fromCharCode(i[u]);a=btoa(c)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=to.Scalar.BLOCK_LITERAL),t!==to.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),u=Math.ceil(a.length/c),l=Array(u);for(let f=0,p=0;f<u;++f,p+=c)l[f]=a.substr(p,c);a=l.join(t===to.Scalar.BLOCK_LITERAL?`
54
+ `:" ")}return Ob.stringifyString({comment:e,type:t,value:a},n,s,o)}};Nb.binary=Ib});var _n=A(function(Db){var bn=I(),no=Ge(),Cb=H(),zb=Ve();function ic(e,t){if(bn.isSeq(e))for(let r=0;r<e.items.length;++r){let n=e.items[r];if(bn.isPair(n))continue;else if(bn.isMap(n)){if(n.items.length>1)t("Each pair must have its own sequence indicator");let s=n.items[0]||new no.Pair(new Cb.Scalar(null));if(n.commentBefore)s.key.commentBefore=s.key.commentBefore?`${n.commentBefore}
55
+ ${s.key.commentBefore}`:n.commentBefore;if(n.comment){let o=s.value??s.key;o.comment=o.comment?`${n.comment}
56
+ ${o.comment}`:n.comment}n=s}e.items[r]=bn.isPair(n)?n:new no.Pair(n)}else t("Expected a sequence for this tag");return e}function ac(e,t,r){let{replacer:n}=r,s=new zb.YAMLSeq(e);s.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let i of t){if(typeof n==="function")i=n.call(t,String(o++),i);let a,c;if(Array.isArray(i))if(i.length===2)a=i[0],c=i[1];else throw TypeError(`Expected [key, value] tuple: ${i}`);else if(i&&i instanceof Object){let u=Object.keys(i);if(u.length===1)a=u[0],c=i[a];else throw TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=i;s.items.push(no.createPair(a,c,r))}return s}var Lb={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:ic,createNode:ac};Db.createPairs=ac;Db.pairs=Lb;Db.resolvePairs=ic});var oo=A(function(Bb){var cc=I(),so=Be(),ar=We(),Mb=Ve(),uc=_n();class ut extends Mb.YAMLSeq{constructor(){super();this.add=ar.YAMLMap.prototype.add.bind(this),this.delete=ar.YAMLMap.prototype.delete.bind(this),this.get=ar.YAMLMap.prototype.get.bind(this),this.has=ar.YAMLMap.prototype.has.bind(this),this.set=ar.YAMLMap.prototype.set.bind(this),this.tag=ut.tag}toJSON(e,t){if(!t)return super.toJSON(e);let r=new Map;if(t?.onCreate)t.onCreate(r);for(let n of this.items){let s,o;if(cc.isPair(n))s=so.toJS(n.key,"",t),o=so.toJS(n.value,s,t);else s=so.toJS(n,"",t);if(r.has(s))throw Error("Ordered maps must not include duplicate keys");r.set(s,o)}return r}static from(e,t,r){let n=uc.createPairs(e,t,r),s=new this;return s.items=n.items,s}}ut.tag="tag:yaml.org,2002:omap";var qb={collection:"seq",identify:(e)=>e instanceof Map,nodeClass:ut,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=uc.resolvePairs(e,t),n=[];for(let{key:s}of r.items)if(cc.isScalar(s))if(n.includes(s.value))t(`Ordered maps must not include duplicate keys: ${s.value}`);else n.push(s.value);return Object.assign(new ut,r)},createNode:(e,t,r)=>ut.from(e,t,r)};Bb.YAMLOMap=ut;Bb.omap=qb});var hc=A(function(Gb){var lc=H();function pc({value:e,source:t},r){if(t&&(e?fc:dc).test.test(t))return t;return e?r.options.trueStr:r.options.falseStr}var fc={identify:(e)=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new lc.Scalar(!0),stringify:pc},dc={identify:(e)=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new lc.Scalar(!1),stringify:pc};Gb.falseTag=dc;Gb.trueTag=fc});var mc=A(function(Xb){var Vb=H(),io=It(),Yb={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(e)=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:io.stringifyNumber},Jb={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(e)=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():io.stringifyNumber(e)}},Qb={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Vb.Scalar(parseFloat(e.replace(/_/g,""))),r=e.indexOf(".");if(r!==-1){let n=e.substring(r+1).replace(/_/g,"");if(n[n.length-1]==="0")t.minFractionDigits=n.length}return t},stringify:io.stringifyNumber};Xb.float=Qb;Xb.floatExp=Jb;Xb.floatNaN=Yb});var yc=A(function(a_){var gc=It(),cr=(e)=>typeof e==="bigint"||Number.isInteger(e);function vn(e,t,r,{intAsBigInt:n}){let s=e[0];if(s==="-"||s==="+")t+=1;if(e=e.substring(t).replace(/_/g,""),n){switch(r){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let i=BigInt(e);return s==="-"?BigInt(-1)*i:i}let o=parseInt(e,r);return s==="-"?-1*o:o}function ao(e,t,r){let{value:n}=e;if(cr(n)){let s=n.toString(t);return n<0?"-"+r+s.substr(1):r+s}return gc.stringifyNumber(e)}var n_={identify:cr,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>vn(e,2,2,r),stringify:(e)=>ao(e,2,"0b")},s_={identify:cr,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>vn(e,1,8,r),stringify:(e)=>ao(e,8,"0")},o_={identify:cr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>vn(e,0,10,r),stringify:gc.stringifyNumber},i_={identify:cr,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>vn(e,2,16,r),stringify:(e)=>ao(e,16,"0x")};a_.int=o_;a_.intBin=n_;a_.intHex=i_;a_.intOct=s_});var co=A(function(d_){var Sn=I(),kn=Ge(),xn=We();class lt extends xn.YAMLMap{constructor(e){super(e);this.tag=lt.tag}add(e){let t;if(Sn.isPair(e))t=e;else if(e&&typeof e==="object"&&"key"in e&&"value"in e&&e.value===null)t=new kn.Pair(e.key,null);else t=new kn.Pair(e,null);if(!xn.findPair(this.items,t.key))this.items.push(t)}get(e,t){let r=xn.findPair(this.items,e);return!t&&Sn.isPair(r)?Sn.isScalar(r.key)?r.key.value:r.key:r}set(e,t){if(typeof t!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let r=xn.findPair(this.items,e);if(r&&!t)this.items.splice(this.items.indexOf(r),1);else if(!r&&t)this.items.push(new kn.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,r);else throw Error("Set items must all have null values")}static from(e,t,r){let{replacer:n}=r,s=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t){if(typeof n==="function")o=n.call(t,o,o);s.items.push(kn.createPair(o,null,r))}return s}}lt.tag="tag:yaml.org,2002:set";var f_={collection:"map",identify:(e)=>e instanceof Set,nodeClass:lt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>lt.from(e,t,r),resolve(e,t){if(Sn.isMap(e))if(e.hasAllNullValues(!0))return Object.assign(new lt,e);else t("Set items must all have null values");else t("Expected a mapping for this tag");return e}};d_.YAMLSet=lt;d_.set=f_});var lo=A(function(b_){var g_=It();function uo(e,t){let r=e[0],n=r==="-"||r==="+"?e.substring(1):e,s=(i)=>t?BigInt(i):Number(i),o=n.replace(/_/g,"").split(":").reduce((i,a)=>i*s(60)+s(a),s(0));return r==="-"?s(-1)*o:o}function wc(e){let{value:t}=e,r=(i)=>i;if(typeof t==="bigint")r=(i)=>BigInt(i);else if(isNaN(t)||!isFinite(t))return g_.stringifyNumber(e);let n="";if(t<0)n="-",t*=r(-1);let s=r(60),o=[t%s];if(t<60)o.unshift(0);else if(t=(t-o[0])/s,o.unshift(t%s),t>=60)t=(t-o[0])/s,o.unshift(t);return n+o.map((i)=>String(i).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var y_={identify:(e)=>typeof e==="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:r})=>uo(e,r),stringify:wc},w_={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(e)=>uo(e,!1),stringify:wc},bc={identify:(e)=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(bc.test);if(!t)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,s,o,i,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,u=Date.UTC(r,n-1,s,o||0,i||0,a||0,c),l=t[8];if(l&&l!=="Z"){let f=uo(l,!1);if(Math.abs(f)<30)f*=60;u-=60000*f}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};b_.floatTime=w_;b_.intTime=y_;b_.timestamp=bc});var vc=A(function(R_){var x_=Tt(),S_=gn(),A_=Ot(),$_=or(),P_=ro(),_c=hc(),po=mc(),An=yc(),E_=cn(),T_=oo(),O_=_n(),I_=co(),fo=lo(),N_=[x_.map,A_.seq,$_.string,S_.nullTag,_c.trueTag,_c.falseTag,An.intBin,An.intOct,An.int,An.intHex,po.floatNaN,po.floatExp,po.float,P_.binary,E_.merge,T_.omap,O_.pairs,I_.set,fo.intTime,fo.floatTime,fo.timestamp];R_.schema=N_});var Ic=A(function(q_){var Ac=Tt(),z_=gn(),$c=Ot(),L_=or(),D_=Ws(),ho=Ys(),mo=Qs(),j_=nc(),U_=oc(),Pc=ro(),ur=cn(),Ec=oo(),Tc=_n(),kc=vc(),Oc=co(),$n=lo(),xc=new Map([["core",j_.schema],["failsafe",[Ac.map,$c.seq,L_.string]],["json",U_.schema],["yaml11",kc.schema],["yaml-1.1",kc.schema]]),Sc={binary:Pc.binary,bool:D_.boolTag,float:ho.float,floatExp:ho.floatExp,floatNaN:ho.floatNaN,floatTime:$n.floatTime,int:mo.int,intHex:mo.intHex,intOct:mo.intOct,intTime:$n.intTime,map:Ac.map,merge:ur.merge,null:z_.nullTag,omap:Ec.omap,pairs:Tc.pairs,seq:$c.seq,set:Oc.set,timestamp:$n.timestamp},Z_={"tag:yaml.org,2002:binary":Pc.binary,"tag:yaml.org,2002:merge":ur.merge,"tag:yaml.org,2002:omap":Ec.omap,"tag:yaml.org,2002:pairs":Tc.pairs,"tag:yaml.org,2002:set":Oc.set,"tag:yaml.org,2002:timestamp":$n.timestamp};function M_(e,t,r){let n=xc.get(t);if(n&&!e)return r&&!n.includes(ur.merge)?n.concat(ur.merge):n.slice();let s=n;if(!s)if(Array.isArray(e))s=[];else{let o=Array.from(xc.keys()).filter((i)=>i!=="yaml11").map((i)=>JSON.stringify(i)).join(", ");throw Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)s=s.concat(o);else if(typeof e==="function")s=e(s.slice());if(r)s=s.concat(ur.merge);return s.reduce((o,i)=>{let a=typeof i==="string"?Sc[i]:i;if(!a){let c=JSON.stringify(i),u=Object.keys(Sc).map((l)=>JSON.stringify(l)).join(", ");throw Error(`Unknown custom tag ${c}; use one of ${u}`)}if(!o.includes(a))o.push(a);return o},[])}q_.coreKnownTags=Z_;q_.getTags=M_});var wo=A(function(V_){var go=I(),F_=Tt(),G_=Ot(),H_=or(),Pn=Ic(),W_=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class yo{constructor({compat:e,customTags:t,merge:r,resolveKnownTags:n,schema:s,sortMapEntries:o,toStringDefaults:i}){this.compat=Array.isArray(e)?Pn.getTags(e,"compat"):e?Pn.getTags(null,e):null,this.name=typeof s==="string"&&s||"core",this.knownTags=n?Pn.coreKnownTags:{},this.tags=Pn.getTags(t,this.name,r),this.toStringOptions=i??null,Object.defineProperty(this,go.MAP,{value:F_.map}),Object.defineProperty(this,go.SCALAR,{value:H_.string}),Object.defineProperty(this,go.SEQ,{value:G_.seq}),this.sortMapEntries=typeof o==="function"?o:o===!0?W_:null}clone(){let e=Object.create(yo.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}V_.Schema=yo});var Nc=A(function(X_){var J_=I(),bo=rr(),lr=Xt();function Q_(e,t){let r=[],n=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);if(c)r.push(c),n=!0;else if(e.directives.docStart)n=!0}if(n)r.push("---");let s=bo.createStringifyContext(e,t),{commentString:o}=s.options;if(e.commentBefore){if(r.length!==1)r.unshift("");let c=o(e.commentBefore);r.unshift(lr.indentComment(c,""))}let i=!1,a=null;if(e.contents){if(J_.isNode(e.contents)){if(e.contents.spaceBefore&&n)r.push("");if(e.contents.commentBefore){let l=o(e.contents.commentBefore);r.push(lr.indentComment(l,""))}s.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>i=!0,u=bo.stringify(e.contents,s,()=>a=null,c);if(a)u+=lr.lineComment(u,"",o(a));if((u[0]==="|"||u[0]===">")&&r[r.length-1]==="---")r[r.length-1]=`--- ${u}`;else r.push(u)}else r.push(bo.stringify(e.contents,s));if(e.directives?.docEnd)if(e.comment){let c=o(e.comment);if(c.includes(`
57
+ `))r.push("..."),r.push(lr.indentComment(c,""));else r.push(`... ${c}`)}else r.push("...");else{let c=e.comment;if(c&&i)c=c.replace(/^\n+/,"");if(c){if((!i||a)&&r[r.length-1]!=="")r.push("");r.push(lr.indentComment(o(c),""))}}return r.join(`
58
+ `)+`
59
+ `}X_.stringifyDocument=Q_});var pr=A(function(cv){var tv=Jt(),Nt=en(),ue=I(),rv=Ge(),nv=Be(),sv=wo(),ov=Nc(),_o=Jr(),iv=js(),av=Qt(),vo=Ds();class ko{constructor(e,t,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ue.NODE_TYPE,{value:ue.DOC});let n=null;if(typeof t==="function"||Array.isArray(t))n=t;else if(r===void 0&&t)r=t,t=void 0;let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:o}=s;if(r?._directives){if(this.directives=r._directives.atDocument(),this.directives.yaml.explicit)o=this.directives.yaml.version}else this.directives=new vo.Directives({version:o});this.setSchema(o,r),this.contents=e===void 0?null:this.createNode(e,n,r)}clone(){let e=Object.create(ko.prototype,{[ue.NODE_TYPE]:{value:ue.DOC}});if(e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives)e.directives=this.directives.clone();if(e.schema=this.schema.clone(),e.contents=ue.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range)e.range=this.range.slice();return e}add(e){if(Rt(this.contents))this.contents.add(e)}addIn(e,t){if(Rt(this.contents))this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let r=_o.anchorNames(this);e.anchor=!t||r.has(t)?_o.findNewAnchor(t||"a",r):t}return new tv.Alias(e.anchor)}createNode(e,t,r){let n=void 0;if(typeof t==="function")e=t.call({"":e},"",e),n=t;else if(Array.isArray(t)){let m=(_)=>typeof _==="number"||_ instanceof String||_ instanceof Number,g=t.filter(m).map(String);if(g.length>0)t=t.concat(g);n=t}else if(r===void 0&&t)r=t,t=void 0;let{aliasDuplicateObjects:s,anchorPrefix:o,flow:i,keepUndefined:a,onTagObj:c,tag:u}=r??{},{onAnchor:l,setAnchors:f,sourceObjects:p}=_o.createNodeAnchors(this,o||"a"),d={aliasDuplicateObjects:s??!0,keepUndefined:a??!1,onAnchor:l,onTagObj:c,replacer:n,schema:this.schema,sourceObjects:p},h=av.createNode(e,u,d);if(i&&ue.isCollection(h))h.flow=!0;return f(),h}createPair(e,t,r={}){let n=this.createNode(e,null,r),s=this.createNode(t,null,r);return new rv.Pair(n,s)}delete(e){return Rt(this.contents)?this.contents.delete(e):!1}deleteIn(e){if(Nt.isEmptyPath(e)){if(this.contents==null)return!1;return this.contents=null,!0}return Rt(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return ue.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){if(Nt.isEmptyPath(e))return!t&&ue.isScalar(this.contents)?this.contents.value:this.contents;return ue.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return ue.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){if(Nt.isEmptyPath(e))return this.contents!==void 0;return ue.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){if(this.contents==null)this.contents=Nt.collectionFromPath(this.schema,[e],t);else if(Rt(this.contents))this.contents.set(e,t)}setIn(e,t){if(Nt.isEmptyPath(e))this.contents=t;else if(this.contents==null)this.contents=Nt.collectionFromPath(this.schema,Array.from(e),t);else if(Rt(this.contents))this.contents.setIn(e,t)}setSchema(e,t={}){if(typeof e==="number")e=String(e);let r;switch(e){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new vo.Directives({version:"1.1"});r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=e;else this.directives=new vo.Directives({version:e});r={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;r=null;break;default:{let n=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(r)this.schema=new sv.Schema(Object.assign(r,t));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:r,maxAliasCount:n,onAnchor:s,reviver:o}={}){let i={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n==="number"?n:100},a=nv.toJS(this.contents,t??"",i);if(typeof s==="function")for(let{count:c,res:u}of i.anchors.values())s(u,c);return typeof o==="function"?iv.applyReviver(o,{"":a},"",a):a}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return ov.stringifyDocument(this,e)}}function Rt(e){if(ue.isCollection(e))return!0;throw Error("Expected a YAML collection as document contents")}cv.Document=ko});var fr=A(function(pv){class En extends Error{constructor(e,t,r,n){super();this.name=e,this.code=r,this.message=n,this.pos=t}}class Rc extends En{constructor(e,t,r){super("YAMLParseError",e,t,r)}}class Cc extends En{constructor(e,t,r){super("YAMLWarning",e,t,r)}}var lv=(e,t)=>(r)=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map((a)=>t.linePos(a));let{line:n,col:s}=r.linePos[0];r.message+=` at line ${n}, column ${s}`;let o=s-1,i=e.substring(t.lineStarts[n-1],t.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&i.length>80){let a=Math.min(o-39,i.length-79);i="\u2026"+i.substring(a),o-=a-1}if(i.length>80)i=i.substring(0,79)+"\u2026";if(n>1&&/^ *$/.test(i.substring(0,o))){let a=e.substring(t.lineStarts[n-2],t.lineStarts[n-1]);if(a.length>80)a=a.substring(0,79)+`\u2026
60
+ `;i=a+i}if(/[^ ]/.test(i)){let a=1,c=r.linePos[1];if(c?.line===n&&c.col>s)a=Math.max(1,Math.min(c.col-s,80-o));let u=" ".repeat(o)+"^".repeat(a);r.message+=`:
61
+
62
+ ${i}
63
+ ${u}
64
+ `}};pv.YAMLError=En;pv.YAMLParseError=Rc;pv.YAMLWarning=Cc;pv.prettifyError=lv});var dr=A(function(yv){function gv(e,{flow:t,indicator:r,next:n,offset:s,onError:o,parentIndent:i,startOnNewline:a}){let c=!1,u=a,l=a,f="",p="",d=!1,h=!1,m=null,g=null,_=null,S=null,x=null,b=null,v=null;for(let P of e){if(h){if(P.type!=="space"&&P.type!=="newline"&&P.type!=="comma")o(P.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");h=!1}if(m){if(u&&P.type!=="comment"&&P.type!=="newline")o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation");m=null}switch(P.type){case"space":if(!t&&(r!=="doc-start"||n?.type!=="flow-collection")&&P.source.includes("\t"))m=P;l=!0;break;case"comment":{if(!l)o(P,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let K=P.source.substring(1)||" ";if(!f)f=K;else f+=p+K;p="",u=!1;break}case"newline":if(u){if(f)f+=P.source;else if(!b||r!=="seq-item-ind")c=!0}else p+=P.source;if(u=!0,d=!0,g||_)S=P;l=!0;break;case"anchor":if(g)o(P,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(P.source.endsWith(":"))o(P.offset+P.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);g=P,v??(v=P.offset),u=!1,l=!1,h=!0;break;case"tag":{if(_)o(P,"MULTIPLE_TAGS","A node can have at most one tag");_=P,v??(v=P.offset),u=!1,l=!1,h=!0;break}case r:if(g||_)o(P,"BAD_PROP_ORDER",`Anchors and tags must be after the ${P.source} indicator`);if(b)o(P,"UNEXPECTED_TOKEN",`Unexpected ${P.source} in ${t??"collection"}`);b=P,u=r==="seq-item-ind"||r==="explicit-key-ind",l=!1;break;case"comma":if(t){if(x)o(P,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`);x=P,u=!1,l=!1;break}default:o(P,"UNEXPECTED_TOKEN",`Unexpected ${P.type} token`),u=!1,l=!1}}let k=e[e.length-1],T=k?k.offset+k.source.length:s;if(h&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!==""))o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(m&&(u&&m.indent<=i||n?.type==="block-map"||n?.type==="block-seq"))o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:x,found:b,spaceBefore:c,comment:f,hasNewline:d,anchor:g,tag:_,newlineAfterProp:S,end:T,start:v??T}}yv.resolveProps=gv});var Tn=A(function(bv){function xo(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
65
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let r of t.start)if(r.type==="newline")return!0;if(t.sep){for(let r of t.sep)if(r.type==="newline")return!0}if(xo(t.key)||xo(t.value))return!0}return!1;default:return!0}}bv.containsNewline=xo});var So=A(function(xv){var vv=Tn();function kv(e,t,r){if(t?.type==="flow-collection"){let n=t.end[0];if(n.indent===e&&(n.source==="]"||n.source==="}")&&vv.containsNewline(t))r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}xv.flowIndentCheck=kv});var Ao=A(function($v){var zc=I();function Av(e,t,r){let{uniqueKeys:n}=e.options;if(n===!1)return!1;let s=typeof n==="function"?n:(o,i)=>o===i||zc.isScalar(o)&&zc.isScalar(i)&&o.value===i.value;return t.some((o)=>s(o.key,r))}$v.mapIncludes=Av});var Zc=A(function(Nv){var Lc=Ge(),Ev=We(),Dc=dr(),Tv=Tn(),jc=So(),Ov=Ao(),Uc="All mapping items must start at the same column";function Iv({composeNode:e,composeEmptyNode:t},r,n,s,o){let a=new(o?.nodeClass??Ev.YAMLMap)(r.schema);if(r.atRoot)r.atRoot=!1;let c=n.offset,u=null;for(let l of n.items){let{start:f,key:p,sep:d,value:h}=l,m=Dc.resolveProps(f,{indicator:"explicit-key-ind",next:p??d?.[0],offset:c,onError:s,parentIndent:n.indent,startOnNewline:!0}),g=!m.found;if(g){if(p){if(p.type==="block-seq")s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in p&&p.indent!==n.indent)s(c,"BAD_INDENT",Uc)}if(!m.anchor&&!m.tag&&!d){if(u=m.end,m.comment)if(a.comment)a.comment+=`
66
+ `+m.comment;else a.comment=m.comment;continue}if(m.newlineAfterProp||Tv.containsNewline(p))s(p??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(m.found?.indent!==n.indent)s(c,"BAD_INDENT",Uc);r.atKey=!0;let _=m.end,S=p?e(r,p,m,s):t(r,_,f,null,m,s);if(r.schema.compat)jc.flowIndentCheck(n.indent,p,s);if(r.atKey=!1,Ov.mapIncludes(r,a.items,S))s(_,"DUPLICATE_KEY","Map keys must be unique");let x=Dc.resolveProps(d??[],{indicator:"map-value-ind",next:h,offset:S.range[2],onError:s,parentIndent:n.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=x.end,x.found){if(g){if(h?.type==="block-map"&&!x.hasNewline)s(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(r.options.strict&&m.start<x.found.offset-1024)s(S.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let b=h?e(r,h,x,s):t(r,c,d,null,x,s);if(r.schema.compat)jc.flowIndentCheck(n.indent,h,s);c=b.range[2];let v=new Lc.Pair(S,b);if(r.options.keepSourceTokens)v.srcToken=l;a.items.push(v)}else{if(g)s(S.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(x.comment)if(S.comment)S.comment+=`
67
+ `+x.comment;else S.comment=x.comment;let b=new Lc.Pair(S);if(r.options.keepSourceTokens)b.srcToken=l;a.items.push(b)}}if(u&&u<c)s(u,"IMPOSSIBLE","Map comment with trailing content");return a.range=[n.offset,c,u??c],a}Nv.resolveBlockMap=Iv});var Mc=A(function(jv){var Cv=Ve(),zv=dr(),Lv=So();function Dv({composeNode:e,composeEmptyNode:t},r,n,s,o){let a=new(o?.nodeClass??Cv.YAMLSeq)(r.schema);if(r.atRoot)r.atRoot=!1;if(r.atKey)r.atKey=!1;let c=n.offset,u=null;for(let{start:l,value:f}of n.items){let p=zv.resolveProps(l,{indicator:"seq-item-ind",next:f,offset:c,onError:s,parentIndent:n.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||f)if(f?.type==="block-seq")s(p.end,"BAD_INDENT","All sequence items must start at the same column");else s(c,"MISSING_CHAR","Sequence item without - indicator");else{if(u=p.end,p.comment)a.comment=p.comment;continue}let d=f?e(r,f,p,s):t(r,p.end,l,null,p,s);if(r.schema.compat)Lv.flowIndentCheck(n.indent,f,s);c=d.range[2],a.items.push(d)}return a.range=[n.offset,c,u??c],a}jv.resolveBlockSeq=Dv});var Ct=A(function(Mv){function Zv(e,t,r,n){let s="";if(e){let o=!1,i="";for(let a of e){let{source:c,type:u}=a;switch(u){case"space":o=!0;break;case"comment":{if(r&&!o)n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let l=c.substring(1)||" ";if(!s)s=l;else s+=i+l;i="";break}case"newline":if(s)i+=c;o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}t+=c.length}}return{comment:s,offset:t}}Mv.resolveEnd=Zv});var Kc=A(function(Yv){var Bv=I(),Kv=Ge(),qc=We(),Fv=Ve(),Gv=Ct(),Bc=dr(),Hv=Tn(),Wv=Ao(),$o="Block collections are not allowed within flow collections",Po=(e)=>e&&(e.type==="block-map"||e.type==="block-seq");function Vv({composeNode:e,composeEmptyNode:t},r,n,s,o){let i=n.start.source==="{",a=i?"flow map":"flow sequence",u=new(o?.nodeClass??(i?qc.YAMLMap:Fv.YAMLSeq))(r.schema);u.flow=!0;let l=r.atRoot;if(l)r.atRoot=!1;if(r.atKey)r.atKey=!1;let f=n.offset+n.start.source.length;for(let g=0;g<n.items.length;++g){let _=n.items[g],{start:S,key:x,sep:b,value:v}=_,k=Bc.resolveProps(S,{flow:a,indicator:"explicit-key-ind",next:x??b?.[0],offset:f,onError:s,parentIndent:n.indent,startOnNewline:!1});if(!k.found){if(!k.anchor&&!k.tag&&!b&&!v){if(g===0&&k.comma)s(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(g<n.items.length-1)s(k.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`);if(k.comment)if(u.comment)u.comment+=`
68
+ `+k.comment;else u.comment=k.comment;f=k.end;continue}if(!i&&r.options.strict&&Hv.containsNewline(x))s(x,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0){if(k.comma)s(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`)}else{if(!k.comma)s(k.start,"MISSING_CHAR",`Missing , between ${a} items`);if(k.comment){let T="";e:for(let P of S)switch(P.type){case"comma":case"space":break;case"comment":T=P.source.substring(1);break e;default:break e}if(T){let P=u.items[u.items.length-1];if(Bv.isPair(P))P=P.value??P.key;if(P.comment)P.comment+=`
69
+ `+T;else P.comment=T;k.comment=k.comment.substring(T.length+1)}}}if(!i&&!b&&!k.found){let T=v?e(r,v,k,s):t(r,k.end,b,null,k,s);if(u.items.push(T),f=T.range[2],Po(v))s(T.range,"BLOCK_IN_FLOW",$o)}else{r.atKey=!0;let T=k.end,P=x?e(r,x,k,s):t(r,T,S,null,k,s);if(Po(x))s(P.range,"BLOCK_IN_FLOW",$o);r.atKey=!1;let K=Bc.resolveProps(b??[],{flow:a,indicator:"map-value-ind",next:v,offset:P.range[2],onError:s,parentIndent:n.indent,startOnNewline:!1});if(K.found){if(!i&&!k.found&&r.options.strict){if(b)for(let G of b){if(G===K.found)break;if(G.type==="newline"){s(G,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(k.start<K.found.offset-1024)s(K.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(v)if("source"in v&&v.source?.[0]===":")s(v,"MISSING_CHAR",`Missing space after : in ${a}`);else s(K.start,"MISSING_CHAR",`Missing , or : between ${a} items`);let ae=v?e(r,v,K,s):K.found?t(r,K.end,b,null,K,s):null;if(ae){if(Po(v))s(ae.range,"BLOCK_IN_FLOW",$o)}else if(K.comment)if(P.comment)P.comment+=`
70
+ `+K.comment;else P.comment=K.comment;let Ce=new Kv.Pair(P,ae);if(r.options.keepSourceTokens)Ce.srcToken=_;if(i){let G=u;if(Wv.mapIncludes(r,G.items,P))s(T,"DUPLICATE_KEY","Map keys must be unique");G.items.push(Ce)}else{let G=new qc.YAMLMap(r.schema);G.flow=!0,G.items.push(Ce);let Gr=(ae??P).range;G.range=[P.range[0],Gr[1],Gr[2]],u.items.push(G)}f=ae?ae.range[2]:K.end}}let p=i?"}":"]",[d,...h]=n.end,m=f;if(d?.source===p)m=d.offset+d.source.length;else{let g=a[0].toUpperCase()+a.substring(1),_=l?`${g} must end with a ${p}`:`${g} in block collection must be sufficiently indented and end with a ${p}`;if(s(f,l?"MISSING_CHAR":"BAD_INDENT",_),d&&d.source.length!==1)h.unshift(d)}if(h.length>0){let g=Gv.resolveEnd(h,m,r.options.strict,s);if(g.comment)if(u.comment)u.comment+=`
71
+ `+g.comment;else u.comment=g.comment;u.range=[n.offset,m,g.offset]}else u.range=[n.offset,m,m];return u}Yv.resolveFlowCollection=Vv});var Fc=A(function(ik){var Qv=I(),Xv=H(),ek=We(),tk=Ve(),rk=Zc(),nk=Mc(),sk=Kc();function Eo(e,t,r,n,s,o){let i=r.type==="block-map"?rk.resolveBlockMap(e,t,r,n,o):r.type==="block-seq"?nk.resolveBlockSeq(e,t,r,n,o):sk.resolveFlowCollection(e,t,r,n,o),a=i.constructor;if(s==="!"||s===a.tagName)return i.tag=a.tagName,i;if(s)i.tag=s;return i}function ok(e,t,r,n,s){let o=n.tag,i=!o?null:t.directives.tagName(o.source,(p)=>s(o,"TAG_RESOLVE_FAILED",p));if(r.type==="block-seq"){let{anchor:p,newlineAfterProp:d}=n,h=p&&o?p.offset>o.offset?p:o:p??o;if(h&&(!d||d.offset<h.offset))s(h,"MISSING_CHAR","Missing newline after block sequence props")}let a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!o||!i||i==="!"||i===ek.YAMLMap.tagName&&a==="map"||i===tk.YAMLSeq.tagName&&a==="seq")return Eo(e,t,r,s,i);let c=t.schema.tags.find((p)=>p.tag===i&&p.collection===a);if(!c){let p=t.schema.knownTags[i];if(p?.collection===a)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else{if(p)s(o,"BAD_COLLECTION_TYPE",`${p.tag} used for ${a} collection, but expects ${p.collection??"scalar"}`,!0);else s(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,!0);return Eo(e,t,r,s,i)}}let u=Eo(e,t,r,s,i,c),l=c.resolve?.(u,(p)=>s(o,"TAG_RESOLVE_FAILED",p),t.options)??u,f=Qv.isNode(l)?l:new Xv.Scalar(l);if(f.range=u.range,f.tag=i,c?.format)f.format=c.format;return f}ik.composeCollection=ok});var Oo=A(function(pk){var To=H();function ck(e,t,r){let n=t.offset,s=uk(t,e.options.strict,r);if(!s)return{value:"",type:null,comment:"",range:[n,n,n]};let o=s.mode===">"?To.Scalar.BLOCK_FOLDED:To.Scalar.BLOCK_LITERAL,i=t.source?lk(t.source):[],a=i.length;for(let m=i.length-1;m>=0;--m){let g=i[m][1];if(g===""||g==="\r")a=m;else break}if(a===0){let m=s.chomp==="+"&&i.length>0?`
72
+ `.repeat(Math.max(1,i.length-1)):"",g=n+s.length;if(t.source)g+=t.source.length;return{value:m,type:o,comment:s.comment,range:[n,g,g]}}let c=t.indent+s.indent,u=t.offset+s.length,l=0;for(let m=0;m<a;++m){let[g,_]=i[m];if(_===""||_==="\r"){if(s.indent===0&&g.length>c)c=g.length}else{if(g.length<c)r(u+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(s.indent===0)c=g.length;if(l=m,c===0&&!e.atRoot)r(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=g.length+_.length+1}for(let m=i.length-1;m>=a;--m)if(i[m][0].length>c)a=m+1;let f="",p="",d=!1;for(let m=0;m<l;++m)f+=i[m][0].slice(c)+`
73
+ `;for(let m=l;m<a;++m){let[g,_]=i[m];u+=g.length+_.length+1;let S=_[_.length-1]==="\r";if(S)_=_.slice(0,-1);if(_&&g.length<c){let b=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;r(u-_.length-(S?2:1),"BAD_INDENT",b),g=""}if(o===To.Scalar.BLOCK_LITERAL)f+=p+g.slice(c)+_,p=`
74
+ `;else if(g.length>c||_[0]==="\t"){if(p===" ")p=`
75
+ `;else if(!d&&p===`
76
+ `)p=`
77
+
78
+ `;f+=p+g.slice(c)+_,p=`
79
+ `,d=!0}else if(_==="")if(p===`
80
+ `)f+=`
81
+ `;else p=`
82
+ `;else f+=p+_,p=" ",d=!1}switch(s.chomp){case"-":break;case"+":for(let m=a;m<i.length;++m)f+=`
83
+ `+i[m][0].slice(c);if(f[f.length-1]!==`
84
+ `)f+=`
85
+ `;break;default:f+=`
86
+ `}let h=n+s.length+t.source.length;return{value:f,type:o,comment:s.comment,range:[n,h,h]}}function uk({offset:e,props:t},r,n){if(t[0].type!=="block-scalar-header")return n(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:s}=t[0],o=s[0],i=0,a="",c=-1;for(let p=1;p<s.length;++p){let d=s[p];if(!a&&(d==="-"||d==="+"))a=d;else{let h=Number(d);if(!i&&h)i=h;else if(c===-1)c=e+p}}if(c!==-1)n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let u=!1,l="",f=s.length;for(let p=1;p<t.length;++p){let d=t[p];switch(d.type){case"space":u=!0;case"newline":f+=d.source.length;break;case"comment":if(r&&!u)n(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");f+=d.source.length,l=d.source.substring(1);break;case"error":n(d,"UNEXPECTED_TOKEN",d.message),f+=d.source.length;break;default:{let h=`Unexpected token in block scalar header: ${d.type}`;n(d,"UNEXPECTED_TOKEN",h);let m=d.source;if(m&&typeof m==="string")f+=m.length}}}return{mode:o,indent:i,chomp:a,comment:l,length:f}}function lk(e){let t=e.split(/\n( *)/),r=t[0],n=r.match(/^( *)/),o=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let i=1;i<t.length;i+=2)o.push([t[i],t[i+1]]);return o}pk.resolveBlockScalar=ck});var No=A(function(vk){var Io=H(),dk=Ct();function hk(e,t,r){let{offset:n,type:s,source:o,end:i}=e,a,c,u=(p,d,h)=>r(n+p,d,h);switch(s){case"scalar":a=Io.Scalar.PLAIN,c=mk(o,u);break;case"single-quoted-scalar":a=Io.Scalar.QUOTE_SINGLE,c=gk(o,u);break;case"double-quoted-scalar":a=Io.Scalar.QUOTE_DOUBLE,c=yk(o,u);break;default:return r(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let l=n+o.length,f=dk.resolveEnd(i,l,t,r);return{value:c,type:a,comment:f.comment,range:[n,l,f.offset]}}function mk(e,t){let r="";switch(e[0]){case"\t":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${e[0]}`;break}case"@":case"`":{r=`reserved character ${e[0]}`;break}}if(r)t(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`);return Gc(e)}function gk(e,t){if(e[e.length-1]!=="'"||e.length===1)t(e.length,"MISSING_CHAR","Missing closing 'quote");return Gc(e.slice(1,-1)).replace(/''/g,"'")}function Gc(e){let t=/(.*?)\r?\n/sy,r=t.exec(e);if(!r)return e;let n,s;try{n=new RegExp("(?<![ \t])[ \t]+$"),s=new RegExp("^[ \t]+|(?<![ \t])[ \t]+$","g")}catch{n=/[ \t]+$/,s=/^[ \t]+|[ \t]+$/g}let o=r[1].replace(n,""),i=" ",a=t.lastIndex;while(r=t.exec(e)){let u=r[1].replace(s,"");if(u==="")if(i===`
87
+ `)o+=i;else i=`
88
+ `;else o+=i+u,i=" ";a=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=a,r=c.exec(e),o+i+(r?.[1]??"")}function yk(e,t){let r="";for(let n=1;n<e.length-1;++n){let s=e[n];if(s==="\r"&&e[n+1]===`
89
+ `)continue;if(s===`
90
+ `){let{fold:o,offset:i}=wk(e,n);r+=o,n=i}else if(s==="\\"){let o=e[++n],i=bk[o];if(i)r+=i;else if(o===`
91
+ `){o=e[n+1];while(o===" "||o==="\t")o=e[++n+1]}else if(o==="\r"&&e[n+1]===`
92
+ `){o=e[++n+1];while(o===" "||o==="\t")o=e[++n+1]}else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=_k(e,n+1,a,t),n+=a}else{let a=e.substr(n-1,2);t(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(s===" "||s==="\t"){let o=n,i=e[n+1];while(i===" "||i==="\t")i=e[++n+1];if(i!==`
93
+ `&&!(i==="\r"&&e[n+2]===`
94
+ `))r+=n>o?e.slice(o,n+1):s}else r+=s}if(e[e.length-1]!=='"'||e.length===1)t(e.length,"MISSING_CHAR",'Missing closing "quote');return r}function wk(e,t){let r="",n=e[t+1];while(n===" "||n==="\t"||n===`
95
+ `||n==="\r"){if(n==="\r"&&e[t+2]!==`
96
+ `)break;if(n===`
97
+ `)r+=`
98
+ `;t+=1,n=e[t+1]}if(!r)r=" ";return{fold:r,offset:t}}var bk={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
99
+ `,r:"\r",t:"\t",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function _k(e,t,r,n){let s=e.substr(t,r),i=s.length===r&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;try{return String.fromCodePoint(i)}catch{let a=e.substr(t-2,r+2);return n(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}vk.resolveFlowScalar=hk});var Wc=A(function(Ek){var pt=I(),Hc=H(),xk=Oo(),Sk=No();function Ak(e,t,r,n){let{value:s,type:o,comment:i,range:a}=t.type==="block-scalar"?xk.resolveBlockScalar(e,t,n):Sk.resolveFlowScalar(t,e.options.strict,n),c=r?e.directives.tagName(r.source,(f)=>n(r,"TAG_RESOLVE_FAILED",f)):null,u;if(e.options.stringKeys&&e.atKey)u=e.schema[pt.SCALAR];else if(c)u=$k(e.schema,s,c,r,n);else if(t.type==="scalar")u=Pk(e,s,t,n);else u=e.schema[pt.SCALAR];let l;try{let f=u.resolve(s,(p)=>n(r??t,"TAG_RESOLVE_FAILED",p),e.options);l=pt.isScalar(f)?f:new Hc.Scalar(f)}catch(f){let p=f instanceof Error?f.message:String(f);n(r??t,"TAG_RESOLVE_FAILED",p),l=new Hc.Scalar(s)}if(l.range=a,l.source=s,o)l.type=o;if(c)l.tag=c;if(u.format)l.format=u.format;if(i)l.comment=i;return l}function $k(e,t,r,n,s){if(r==="!")return e[pt.SCALAR];let o=[];for(let a of e.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(t))return a;let i=e.knownTags[r];if(i&&!i.collection)return e.tags.push(Object.assign({},i,{default:!1,test:void 0})),i;return s(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),e[pt.SCALAR]}function Pk({atKey:e,directives:t,schema:r},n,s,o){let i=r.tags.find((a)=>(a.default===!0||e&&a.default==="key")&&a.test?.test(n))||r[pt.SCALAR];if(r.compat){let a=r.compat.find((c)=>c.default&&c.test?.test(n))??r[pt.SCALAR];if(i.tag!==a.tag){let c=t.tagString(i.tag),u=t.tagString(a.tag),l=`Value may be parsed as either ${c} or ${u}`;o(s,"TAG_RESOLVE_FAILED",l,!0)}}return i}Ek.composeScalar=Ak});var Vc=A(function(Ik){function Ok(e,t,r){if(t){r??(r=t.length);for(let n=r-1;n>=0;--n){let s=t[n];switch(s.type){case"space":case"comment":case"newline":e-=s.source.length;continue}s=t[++n];while(s?.type==="space")e+=s.source.length,s=t[++n];break}}return e}Ik.emptyScalarPosition=Ok});var Qc=A(function(Zk){var Rk=Jt(),Ck=I(),zk=Fc(),Yc=Wc(),Lk=Ct(),Dk=Vc(),jk={composeNode:Jc,composeEmptyNode:Ro};function Jc(e,t,r,n){let s=e.atKey,{spaceBefore:o,comment:i,anchor:a,tag:c}=r,u,l=!0;switch(t.type){case"alias":if(u=Uk(e,t,n),a||c)n(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(u=Yc.composeScalar(e,t,c,n),a)u.anchor=a.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(u=zk.composeCollection(jk,e,t,r,n),a)u.anchor=a.source.substring(1)}catch(f){let p=f instanceof Error?f.message:String(f);n(t,"RESOURCE_EXHAUSTION",p)}break;default:{let f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;n(t,"UNEXPECTED_TOKEN",f),l=!1}}if(u??(u=Ro(e,t.offset,void 0,null,r,n)),a&&u.anchor==="")n(a,"BAD_ALIAS","Anchor cannot be an empty string");if(s&&e.options.stringKeys&&(!Ck.isScalar(u)||typeof u.value!=="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str"))n(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(o)u.spaceBefore=!0;if(i)if(t.type==="scalar"&&t.source==="")u.comment=i;else u.commentBefore=i;if(e.options.keepSourceTokens&&l)u.srcToken=t;return u}function Ro(e,t,r,n,{spaceBefore:s,comment:o,anchor:i,tag:a,end:c},u){let l={type:"scalar",offset:Dk.emptyScalarPosition(t,r,n),indent:-1,source:""},f=Yc.composeScalar(e,l,a,u);if(i){if(f.anchor=i.source.substring(1),f.anchor==="")u(i,"BAD_ALIAS","Anchor cannot be an empty string")}if(s)f.spaceBefore=!0;if(o)f.comment=o,f.range[2]=c;return f}function Uk({options:e},{offset:t,source:r,end:n},s){let o=new Rk.Alias(r.substring(1));if(o.source==="")s(t,"BAD_ALIAS","Alias cannot be an empty string");if(o.source.endsWith(":"))s(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let i=t+r.length,a=Lk.resolveEnd(n,i,e.strict,s);if(o.range=[t,i,a.offset],a.comment)o.comment=a.comment;return o}Zk.composeEmptyNode=Ro;Zk.composeNode=Jc});var eu=A(function(Hk){var Bk=pr(),Xc=Qc(),Kk=Ct(),Fk=dr();function Gk(e,t,{offset:r,start:n,value:s,end:o},i){let a=Object.assign({_directives:t},e),c=new Bk.Document(void 0,a),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},l=Fk.resolveProps(n,{indicator:"doc-start",next:s??o?.[0],offset:r,onError:i,parentIndent:0,startOnNewline:!0});if(l.found){if(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!l.hasNewline)i(l.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}c.contents=s?Xc.composeNode(u,s,l,i):Xc.composeEmptyNode(u,l.end,n,null,l,i);let f=c.contents.range[2],p=Kk.resolveEnd(o,f,!1,i);if(p.comment)c.comment=p.comment;return c.range=[r,f,p.offset],c}Hk.composeDoc=Gk});var Co=A(function(ex){var Vk=he("process"),Yk=Ds(),Jk=pr(),hr=fr(),tu=I(),Qk=eu(),Xk=Ct();function mr(e){if(typeof e==="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:r}=e;return[t,t+(typeof r==="string"?r.length:1)]}function ru(e){let t="",r=!1,n=!1;for(let s=0;s<e.length;++s){let o=e[s];switch(o[0]){case"#":t+=(t===""?"":n?`
100
+
101
+ `:`
102
+ `)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":if(e[s+1]?.[0]!=="#")s+=1;r=!1;break;default:if(!r)n=!0;r=!1}}return{comment:t,afterEmptyLine:n}}class nu{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,r,n,s)=>{let o=mr(t);if(s)this.warnings.push(new hr.YAMLWarning(o,r,n));else this.errors.push(new hr.YAMLParseError(o,r,n))},this.directives=new Yk.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:r,afterEmptyLine:n}=ru(this.prelude);if(r){let s=e.contents;if(t)e.comment=e.comment?`${e.comment}
103
+ ${r}`:r;else if(n||e.directives.docStart||!s)e.commentBefore=r;else if(tu.isCollection(s)&&!s.flow&&s.items.length>0){let o=s.items[0];if(tu.isPair(o))o=o.key;let i=o.commentBefore;o.commentBefore=i?`${r}
104
+ ${i}`:r}else{let o=s.commentBefore;s.commentBefore=o?`${r}
105
+ ${o}`:r}}if(t){for(let s=0;s<this.errors.length;++s)e.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)e.warnings.push(this.warnings[s])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:ru(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,r=-1){for(let n of e)yield*this.next(n);yield*this.end(t,r)}*next(e){if(Vk.env.LOG_STREAM)console.dir(e,{depth:null});switch(e.type){case"directive":this.directives.add(e.source,(t,r,n)=>{let s=mr(e);s[0]+=t,this.onError(s,"BAD_DIRECTIVE",r,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Qk.composeDoc(this.options,this.directives,e,this.onError);if(this.atDirectives&&!t.directives.docStart)this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(t,!1),this.doc)yield this.doc;this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new hr.YAMLParseError(mr(e),"UNEXPECTED_TOKEN",t);if(this.atDirectives||!this.doc)this.errors.push(r);else this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){this.errors.push(new hr.YAMLParseError(mr(e),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let t=Xk.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
106
+ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new hr.YAMLParseError(mr(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),n=new Jk.Document(void 0,r);if(this.atDirectives)this.onError(t,"MISSING_CHAR","Missing directives-end indicator line");n.range=[0,t,t],this.decorate(n,!1),yield n}}}ex.Composer=nu});var iu=A(function(ux){var rx=Oo(),nx=No(),sx=fr(),su=tr();function ox(e,t=!0,r){if(e){let n=(s,o,i)=>{let a=typeof s==="number"?s:Array.isArray(s)?s[0]:s.offset;if(r)r(a,o,i);else throw new sx.YAMLParseError([a,a+1],o,i)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return nx.resolveFlowScalar(e,t,n);case"block-scalar":return rx.resolveBlockScalar({options:{strict:t}},e,n)}}return null}function ix(e,t){let{implicitKey:r=!1,indent:n,inFlow:s=!1,offset:o=-1,type:i="PLAIN"}=t,a=su.stringifyString({type:i,value:e},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:n,source:`
107
+ `}];switch(a[0]){case"|":case">":{let u=a.indexOf(`
108
+ `),l=a.substring(0,u),f=a.substring(u+1)+`
109
+ `,p=[{type:"block-scalar-header",offset:o,indent:n,source:l}];if(!ou(p,c))p.push({type:"newline",offset:-1,indent:n,source:`
110
+ `});return{type:"block-scalar",offset:o,indent:n,props:p,source:f}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function ax(e,t,r={}){let{afterKey:n=!1,implicitKey:s=!1,inFlow:o=!1,type:i}=r,a="indent"in e?e.indent:null;if(n&&typeof a==="number")a+=2;if(!i)switch(e.type){case"single-quoted-scalar":i="QUOTE_SINGLE";break;case"double-quoted-scalar":i="QUOTE_DOUBLE";break;case"block-scalar":{let u=e.props[0];if(u.type!=="block-scalar-header")throw Error("Invalid block scalar header");i=u.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:i="PLAIN"}let c=su.stringifyString({type:i,value:t},{implicitKey:s||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":cx(e,c);break;case'"':zo(e,c,"double-quoted-scalar");break;case"'":zo(e,c,"single-quoted-scalar");break;default:zo(e,c,"scalar")}}function cx(e,t){let r=t.indexOf(`
111
+ `),n=t.substring(0,r),s=t.substring(r+1)+`
112
+ `;if(e.type==="block-scalar"){let o=e.props[0];if(o.type!=="block-scalar-header")throw Error("Invalid block scalar header");o.source=n,e.source=s}else{let{offset:o}=e,i="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:i,source:n}];if(!ou(a,"end"in e?e.end:void 0))a.push({type:"newline",offset:-1,indent:i,source:`
113
+ `});for(let c of Object.keys(e))if(c!=="type"&&c!=="offset")delete e[c];Object.assign(e,{type:"block-scalar",indent:i,props:a,source:s})}}function ou(e,t){if(t)for(let r of t)switch(r.type){case"space":case"comment":e.push(r);break;case"newline":return e.push(r),!0}return!1}function zo(e,t,r){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=r,e.source=t;break;case"block-scalar":{let n=e.props.slice(1),s=t.length;if(e.props[0].type==="block-scalar-header")s-=e.props[0].source.length;for(let o of n)o.offset+=s;delete e.props,Object.assign(e,{type:r,source:t,end:n});break}case"block-map":case"block-seq":{let s={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
114
+ `};delete e.items,Object.assign(e,{type:r,source:t,end:[s]});break}default:{let n="indent"in e?e.indent:-1,s="end"in e&&Array.isArray(e.end)?e.end.filter((o)=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(e))if(o!=="type"&&o!=="offset")delete e[o];Object.assign(e,{type:r,indent:n,source:t,end:s})}}}ux.createScalarToken=ix;ux.resolveAsScalar=ox;ux.setScalarValue=ax});var au=A(function(hx){var dx=(e)=>("type"in e)?In(e):On(e);function In(e){switch(e.type){case"block-scalar":{let t="";for(let r of e.props)t+=In(r);return t+e.source}case"block-map":case"block-seq":{let t="";for(let r of e.items)t+=On(r);return t}case"flow-collection":{let t=e.start.source;for(let r of e.items)t+=On(r);for(let r of e.end)t+=r.source;return t}case"document":{let t=On(e);if(e.end)for(let r of e.end)t+=r.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let r of e.end)t+=r.source;return t}}}function On({start:e,key:t,sep:r,value:n}){let s="";for(let o of e)s+=o.source;if(t)s+=In(t);if(r)for(let o of r)s+=o.source;if(n)s+=In(n);return s}hx.stringify=dx});var lu=A(function(yx){var Lo=Symbol("break visit"),gx=Symbol("skip children"),cu=Symbol("remove item");function ft(e,t){if("type"in e&&e.type==="document")e={start:e.start,value:e.value};uu(Object.freeze([]),e,t)}ft.BREAK=Lo;ft.SKIP=gx;ft.REMOVE=cu;ft.itemAtPath=(e,t)=>{let r=e;for(let[n,s]of t){let o=r?.[n];if(o&&"items"in o)r=o.items[s];else return}return r};ft.parentCollection=(e,t)=>{let r=ft.itemAtPath(e,t.slice(0,-1)),n=t[t.length-1][0],s=r?.[n];if(s&&"items"in s)return s;throw Error("Parent collection not found")};function uu(e,t,r){let n=r(t,e);if(typeof n==="symbol")return n;for(let s of["key","value"]){let o=t[s];if(o&&"items"in o){for(let i=0;i<o.items.length;++i){let a=uu(Object.freeze(e.concat([[s,i]])),o.items[i],r);if(typeof a==="number")i=a-1;else if(a===Lo)return Lo;else if(a===cu)o.items.splice(i,1),i-=1}if(typeof n==="function"&&s==="key")n=n(t,e)}}return typeof n==="function"?n(t,e):n}yx.visit=ft});var Nn=A(function(Ax){var Do=iu(),bx=au(),_x=lu(),jo="\uFEFF",Uo="\x02",Zo="\x18",Mo="\x1F",vx=(e)=>!!e&&("items"in e),kx=(e)=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function xx(e){switch(e){case jo:return"<BOM>";case Uo:return"<DOC>";case Zo:return"<FLOW_END>";case Mo:return"<SCALAR>";default:return JSON.stringify(e)}}function Sx(e){switch(e){case jo:return"byte-order-mark";case Uo:return"doc-mode";case Zo:return"flow-error-end";case Mo:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
115
+ `:case`\r
116
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Ax.createScalarToken=Do.createScalarToken;Ax.resolveAsScalar=Do.resolveAsScalar;Ax.setScalarValue=Do.setScalarValue;Ax.stringify=bx.stringify;Ax.visit=_x.visit;Ax.BOM=jo;Ax.DOCUMENT=Uo;Ax.FLOW_END=Zo;Ax.SCALAR=Mo;Ax.isCollection=vx;Ax.isScalar=kx;Ax.prettyToken=xx;Ax.tokenType=Sx});var Bo=A(function(Mx){var gr=Nn();function ge(e){switch(e){case void 0:case" ":case`
117
+ `:case"\r":case"\t":return!0;default:return!1}}var pu=new Set("0123456789ABCDEFabcdef"),Ux=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Rn=new Set(",[]{}"),Zx=new Set(` ,[]{}
118
+ \r `),qo=(e)=>!e||Zx.has(e);class fu{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let r=this.next??"stream";while(r&&(t||this.hasChars(1)))r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,t=this.buffer[e];while(t===" "||t==="\t")t=this.buffer[++e];if(!t||t==="#"||t===`
119
+ `)return!0;if(t==="\r")return this.buffer[e+1]===`
120
+ `;return!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let r=0;while(t===" ")t=this.buffer[++r+e];if(t==="\r"){let n=this.buffer[r+e+1];if(n===`
121
+ `||!n&&!this.atEnd)return e+r+1}return t===`
122
+ `||r>=this.indentNext||!t&&!this.atEnd?e+r:-1}if(t==="-"||t==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&ge(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;if(typeof e!=="number"||e!==-1&&e<this.pos)e=this.buffer.indexOf(`
123
+ `,this.pos),this.lineEndPos=e;if(e===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[e-1]==="\r")e-=1;return this.buffer.substring(this.pos,e)}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===gr.BOM)yield*this.pushCount(1),e=e.substring(1);if(e[0]==="%"){let t=e.length,r=e.indexOf("#");while(r!==-1){let s=e[r-1];if(s===" "||s==="\t"){t=r-1;break}else r=e.indexOf("#",r+1)}while(!0){let s=e[t-1];if(s===" "||s==="\t")t-=1;else break}let n=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield gr.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&ge(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ge(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ge(t)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(qo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,r=-1;do{if(e=yield*this.pushNewline(),e>0)t=yield*this.pushSpaces(!1),this.indentValue=r=t;else t=0;t+=yield*this.pushSpaces(!0)}while(e+t>0);let n=this.getLine();if(n===null)return this.setNext("flow");if(r!==-1&&r<this.indentNext&&n[0]!=="#"||r===0&&(n.startsWith("---")||n.startsWith("..."))&&ge(n[3])){if(!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield gr.FLOW_END,yield*this.parseLineStart()}let s=0;while(n[s]===",")s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),n[s]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(qo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ge(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")while(t!==-1&&this.buffer[t+1]==="'")t=this.buffer.indexOf("'",t+2);else while(t!==-1){let s=0;while(this.buffer[t-1-s]==="\\")s+=1;if(s%2===0)break;t=this.buffer.indexOf('"',t+1)}let r=this.buffer.substring(0,t),n=r.indexOf(`
124
+ `,this.pos);if(n!==-1){while(n!==-1){let s=this.continueScalar(n+1);if(s===-1)break;n=r.indexOf(`
125
+ `,s)}if(n!==-1)t=n-(r[n-1]==="\r"?2:1)}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;while(!0){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil((t)=>ge(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":t+=1;break;case`
126
+ `:e=s,t=0;break;case"\r":{let o=this.buffer[s+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
127
+ `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=t;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(`
128
+ `,s)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let n=e+1;r=this.buffer[n];while(r===" ")r=this.buffer[++n];if(r==="\t"){while(r==="\t"||r===" "||r==="\r"||r===`
129
+ `)r=this.buffer[++n];e=n-1}else if(!this.blockScalarKeep)do{let s=e-1,o=this.buffer[s];if(o==="\r")o=this.buffer[--s];let i=s;while(o===" ")o=this.buffer[--s];if(o===`
130
+ `&&s>=this.pos&&s+1+t>i)e=s;else break}while(!0);return yield gr.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,r=this.pos-1,n;while(n=this.buffer[++r])if(n===":"){let s=this.buffer[r+1];if(ge(s)||e&&Rn.has(s))break;t=r}else if(ge(n)){let s=this.buffer[r+1];if(n==="\r")if(s===`
131
+ `)r+=1,n=`
132
+ `,s=this.buffer[r+1];else t=r;if(s==="#"||e&&Rn.has(s))break;if(n===`
133
+ `){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&Rn.has(n))break;t=r}if(!n&&!this.atEnd)return this.setNext("plain-scalar");return yield gr.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc"}*pushCount(e){if(e>0)return yield this.buffer.substr(this.pos,e),this.pos+=e,e;return 0}*pushToIndex(e,t){let r=this.buffer.slice(this.pos,e);if(r)return yield r,this.pos+=r.length,r.length;else if(t)yield"";return 0}*pushIndicators(){let e=0;e:while(!0){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(qo),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,r=this.charAt(1);if(ge(r)||t&&Rn.has(r)){if(!t)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];while(!ge(t)&&t!==">")t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];while(t)if(Ux.has(t))t=this.buffer[++e];else if(t==="%"&&pu.has(this.buffer[e+1])&&pu.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];if(e===`
134
+ `)return yield*this.pushCount(1);else if(e==="\r"&&this.charAt(1)===`
135
+ `)return yield*this.pushCount(2);else return 0}*pushSpaces(e){let t=this.pos-1,r;do r=this.buffer[++t];while(r===" "||e&&r==="\t");let n=t-this.pos;if(n>0)yield this.buffer.substr(this.pos,n),this.pos=t;return n}*pushUntil(e){let t=this.pos,r=this.buffer[t];while(!e(r))r=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}Mx.Lexer=fu});var Ko=A(function(Bx){class du{constructor(){this.lineStarts=[],this.addNewLine=(e)=>this.lineStarts.push(e),this.linePos=(e)=>{let t=0,r=this.lineStarts.length;while(t<r){let s=t+r>>1;if(this.lineStarts[s]<e)t=s+1;else r=s}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let n=this.lineStarts[t-1];return{line:t,col:e-n+1}}}}Bx.LineCounter=du});var Fo=A(function(Hx){var Fx=he("process"),hu=Nn(),Gx=Bo();function Ye(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function mu(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function yu(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Cn(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function zt(e){if(e.length===0)return[];let t=e.length;e:while(--t>=0)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}while(e[++t]?.type==="space");return e.splice(t,e.length)}function zn(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let r=0;r<t.length;++r)e.push(t[r])}function gu(e){if(e.start.type==="flow-seq-start"){for(let t of e.items)if(t.sep&&!t.value&&!Ye(t.start,"explicit-key-ind")&&!Ye(t.sep,"map-value-ind")){if(t.key)t.value=t.key;if(delete t.key,yu(t.value))if(t.value.end)zn(t.value.end,t.sep);else t.value.end=t.sep;else zn(t.start,t.sep);delete t.sep}}}class wu{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Gx.Lexer,this.onNewLine=e}*parse(e,t=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let r of this.lexer.lex(e,t))yield*this.next(r);if(!t)yield*this.end()}*next(e){if(this.source=e,Fx.env.LOG_TOKENS)console.log("|",hu.prettyToken(e));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=hu.tokenType(e);if(!t){let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}else if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+e.length);break;case"space":if(this.atNewLine&&e[0]===" ")this.indent+=e.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=e.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let r=this.peek(1);if(t.type==="block-scalar")t.indent="indent"in r?r.indent:0;else if(t.type==="flow-collection"&&r.type==="document")t.indent=0;if(t.type==="flow-collection")gu(t);switch(r.type){case"document":r.value=t;break;case"block-scalar":r.props.push(t);break;case"block-map":{let n=r.items[r.items.length-1];if(n.value){r.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=r.items[r.items.length-1];if(n.value)r.items.push({start:[],value:t});else n.value=t;break}case"flow-collection":{let n=r.items[r.items.length-1];if(!n||n.value)r.items.push({start:[],key:t,sep:[]});else if(n.sep)n.value=t;else Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let n=t.items[t.items.length-1];if(n&&!n.sep&&!n.value&&n.start.length>0&&mu(n.start)===-1&&(t.indent===0||n.start.every((s)=>s.type!=="comment"||s.indent<t.indent))){if(r.type==="document")r.end=n.start;else r.items.push({start:n.start});t.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")e.start.push(this.sourceToken);this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{if(mu(e.start)!==-1)yield*this.pop(),yield*this.step();else e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);if(t)this.stack.push(t);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=Cn(this.peek(2)),r=zt(t),n;if(e.end)n=e.end,n.push(this.sourceToken),delete e.end;else n=[this.sourceToken];let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
136
+ `)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
137
+ `,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 r="end"in t.value?t.value.end:void 0;if((Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment")r?.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 n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){zn(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,n=r&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",s=[];if(n&&t.sep&&!t.value){let o=[];for(let i=0;i<t.sep.length;++i){let a=t.sep[i];switch(a.type){case"newline":o.push(i);break;case"space":break;case"comment":if(a.indent>e.indent)o.length=0;break;default:o.length=0}}if(o.length>=2)s=t.sep.splice(o[1])}switch(this.type){case"anchor":case"tag":if(n||t.value)s.push(this.sourceToken),e.items.push({start:s}),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(n||t.value)s.push(this.sourceToken),e.items.push({start:s,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(Ye(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=zt(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(Ye(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(yu(t.key)&&!Ye(t.sep,"newline")){let o=zt(t.start),{key:i,sep:a}=t;a.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:i,sep:a}]})}else if(s.length>0)t.sep=t.sep.concat(s,this.sourceToken);else t.sep.push(this.sourceToken);else if(!t.sep)Object.assign(t,{key:null,sep:[this.sourceToken]});else if(t.value||n)e.items.push({start:s,key:null,sep:[this.sourceToken]});else if(Ye(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(n||t.value)e.items.push({start:s,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&&!Ye(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(r)e.items.push({start:s});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 r="end"in t.value?t.value.end:void 0;if((Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment")r?.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 n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){zn(n,t.start),n.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||Ye(t.start,"seq-item-ind"))e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.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 n=this.flowScalar(this.type);if(!t||t.value)e.items.push({start:[],key:n,sep:[]});else if(t.sep)this.stack.push(n);else Object.assign(t,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);if(r)this.stack.push(r);else yield*this.pop(),yield*this.step()}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let n=Cn(r),s=zt(n);gu(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
138
+ `)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
139
+ `,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=Cn(e),r=zt(t);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Cn(e),r=zt(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,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((r)=>r.type==="newline"||r.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()}}}Hx.Parser=wu});var xu=A(function(rS){var bu=Co(),Vx=pr(),yr=fr(),Yx=Bs(),Jx=I(),Qx=Ko(),_u=Fo();function vu(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Qx.LineCounter||null,prettyErrors:t}}function Xx(e,t={}){let{lineCounter:r,prettyErrors:n}=vu(t),s=new _u.Parser(r?.addNewLine),o=new bu.Composer(t),i=Array.from(o.compose(s.parse(e)));if(n&&r)for(let a of i)a.errors.forEach(yr.prettifyError(e,r)),a.warnings.forEach(yr.prettifyError(e,r));if(i.length>0)return i;return Object.assign([],{empty:!0},o.streamInfo())}function ku(e,t={}){let{lineCounter:r,prettyErrors:n}=vu(t),s=new _u.Parser(r?.addNewLine),o=new bu.Composer(t),i=null;for(let a of o.compose(s.parse(e),!0,e.length))if(!i)i=a;else if(i.options.logLevel!=="silent"){i.errors.push(new yr.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(n&&r)i.errors.forEach(yr.prettifyError(e,r)),i.warnings.forEach(yr.prettifyError(e,r));return i}function eS(e,t,r){let n=void 0;if(typeof t==="function")n=t;else if(r===void 0&&t&&typeof t==="object")r=t;let s=ku(e,r);if(!s)return null;if(s.warnings.forEach((o)=>Yx.warn(s.options.logLevel,o)),s.errors.length>0)if(s.options.logLevel!=="silent")throw s.errors[0];else s.errors=[];return s.toJS(Object.assign({reviver:n},r))}function tS(e,t,r){let n=null;if(typeof t==="function"||Array.isArray(t))n=t;else if(r===void 0&&t)r=t;if(typeof r==="string")r=r.length;if(typeof r==="number"){let s=Math.round(r);r=s<1?void 0:s>8?{indent:8}:{indent:s}}if(e===void 0){let{keepUndefined:s}=r??t??{};if(!s)return}if(Jx.isDocument(e)&&!n)return e.toString(r);return new Vx.Document(e,n,r).toString(r)}rS.parse=eS;rS.parseAllDocuments=Xx;rS.parseDocument=ku;rS.stringify=tS});var ea={};ma(ea,{default:()=>rP});var ta={};ma(ta,{default:()=>sP});class y extends Error{reason;fix;constructor(e,t){super(e);this.reason=e;this.fix=t;this.name="TapsterError"}}class D extends y{status;constructor(e,t,r){super(e,t);this.status=r;this.name="GitHubError"}}import{existsSync as be,readdirSync as lm,readFileSync as Wt}from"fs";import{mkdir as TP,readFile as As,writeFile as $s}from"fs/promises";import{basename as Ps,join as q}from"path";var aS=Co(),cS=pr(),uS=wo(),Go=fr(),lS=Jt(),Je=I(),pS=Ge(),fS=H(),dS=We(),hS=Ve(),_O=Nn(),mS=Bo(),gS=Ko(),yS=Fo(),Ln=xu(),Su=Vt();var wS=aS.Composer,bS=cS.Document,_S=uS.Schema,{YAMLError:vS,YAMLParseError:kS,YAMLWarning:xS}=Go,SS=lS.Alias,{isAlias:AS,isCollection:$S,isDocument:PS,isMap:ye,isNode:ES,isPair:TS,isScalar:OS,isSeq:dt}=Je,IS=pS.Pair,NS=fS.Scalar,RS=dS.YAMLMap,CS=hS.YAMLSeq;var zS=mS.Lexer,LS=gS.LineCounter,DS=yS.Parser,{parse:X,parseAllDocuments:jS,parseDocument:Qe,stringify:US}=Ln,{visit:ZS,visitAsync:MS}=Su;function br(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}function Wo(e,t="|"){return e.map((r)=>Jo(r)).join(t)}function _r(e,t){if(typeof t==="bigint")return t.toString();return t}class Au{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function vr(e){return new Au(e)}function $u(e){return e===null||e===void 0}function Dn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Pu(e,t){let r=e/t,n=Math.round(r),s=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<s)return 0;return r-n}function le(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function kr(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function De(e){return kr(e._zod.def)??e._zod.def.shape}function Eu(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return le(this,t,n),n},enumerable:!0,configurable:!0})}function Tu(e,t,r){if(t in e)le(e,t,r);else e[t]=r}function ht(e,t,r,n){let s=De(t);for(let o of r){let i=Object.getOwnPropertyDescriptor(s,o);if(!i.enumerable)continue;if(i.get)Eu(e,o,()=>{let a=t._zod.def.shape[o];return n?n(a,o):a});else Tu(e,o,n?n(i.value,o):i.value)}}function qS(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)Eu(e,r,()=>t[r]);else Tu(e,r,n.value)}}function re(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Ou(e){return JSON.stringify(e)}function Iu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Vo="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Lt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Nu=vr(()=>{if(Y.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function mt(e){if(Lt(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(Lt(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Yo(e){if(mt(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 Ru=new Set(["string","number","symbol"]);function et(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xe(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function E(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 Jo(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Cu(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var jn=(()=>({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]}))(),Qo={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function BS(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let o={};return ht(o,e,Un(e,t)),xe(e,re(r,{shape:o,checks:[]}))}function Un(e,t){let r=De(e),n=[];for(let s of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,s)?.enumerable)throw Error(`Unrecognized key: "${String(s)}"`);if(t[s])n.push(s)}return n}function KS(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let o=new Set(Un(e,t)),i={};return ht(i,e,Reflect.ownKeys(De(e)).filter((a)=>!o.has(a))),xe(e,re(r,{shape:i,checks:[]}))}function FS(e,t){if(!mt(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=De(e);for(let o of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xe(e,re(e._zod.def,{shape:zu(e,t)}))}function zu(e,t){let r={};return ht(r,e,Reflect.ownKeys(De(e))),qS(r,t),r}function GS(e,t){if(!mt(t))throw Error("Invalid input to safeExtend: expected a plain object");return xe(e,re(e._zod.def,{shape:zu(e,t)}))}function HS(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};ht(r,e,Reflect.ownKeys(De(e))),ht(r,t,Reflect.ownKeys(De(t)));let n=re(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return xe(e,n)}function Lu(e,t,r,n="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(Un(t,r)):void 0,c={};return ht(c,t,Reflect.ownKeys(De(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),xe(t,re(t._zod.def,{shape:c,checks:[]}))}function WS(e,t,r){let n=r?new Set(Un(t,r)):void 0,s={};return ht(s,t,Reflect.ownKeys(De(t)),(o,i)=>n&&!n.has(i)?o:new e({type:"nonoptional",innerType:o})),xe(t,re(t._zod.def,{shape:s}))}function pe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Du(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Se(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function wr(e){return typeof e==="string"?e:e?.message}function Xo(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let s=n.maximum??n.length??n.size;if(s>=0)t.push([s,r])}return t}function Zn(e,t,r){var n;for(let s=t;s<e.length;s++)(n=e[s]).schema??(n.schema=r)}function Ae(e,t,r){var n;let s=e.inst?._zod?.traits;if(s?.has("$ZodType"))if(s.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:wr(e.inst?._zod.def?.error?.(e))??wr(o?.(e))??wr(t?.error?.(e))??wr(r.customError?.(e))??wr(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=i,t?.reportInput)a.input=e.input;return a}var VS=/[\uD800-\uDBFF]/;function Mn(e){let t=e.length;if(!VS.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function qn(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ju(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function gt(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function Uu(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else YS(e,r,n.value)}}function je(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Bn(e,t,r){return je(e,t,r,!1)}function Zu(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return je(this,r,n(this))},set(s){je(this,r,s)}})}return t}function YS(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:je(this,t,r.bind(this))},set(n){je(this,t,n)}})}function JS(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Ho,Xe=!1,QS={configurable:!0,get(){Xe=!0;return}};function N(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Ho!==e._zod){Ho=void 0;return}Ho=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,QS);let s=Xe;Xe=!1;try{let o=r(this);if(Xe)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o});return Xe=Xe||s,o}catch(o){throw delete this[t],Xe=Xe||s,o}},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s})}})}function XS(e,t,r,n){let s=JS(e,t);if(!s)return;Object.defineProperty(s,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,o),o.value=r(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:o})}})}var e0="~constantCatch";function Mu(e){let t=()=>e;return t[e0]=!0,t}var qu;var ei={value:void 0,enumerable:!1},Bu="captureStackTrace"in Error?Error:null;function t0(e){let t=Bu;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Bu=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function w(e,t,r,n){let s={};function o(p){this.def=p,this.constr=f,this.traits=new Set}o.prototype=s;let i=r,a=i&&new WeakSet;function c(p,d){if(!p._zod){ei.value=new o(d);try{Object.defineProperty(p,"_zod",ei)}finally{ei.value=void 0}}else if(p._zod.traits.has(e))return;if(p._zod.traits.add(e),t(p,d),a){let m=Object.getPrototypeOf(p),g=p._zod.constr.prototype,_=m;while(_&&_!==g)_=Object.getPrototypeOf(_);let S=_??m;if(!a.has(S))a.add(S),Uu(S,i)}let h=f.prototype;for(let m in h){if(!Object.prototype.hasOwnProperty.call(h,m))continue;if(!(m in p))p[m]=h[m].bind(p)}}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(p){let d=n?.Parent?t0(l):this;c(d,p);let h=d._zod.deferred;if(h){for(let g of h)g();d._zod.deferred=void 0}let m=globalThis.__zod_globalConfig?.postProcessor;if(m)m(d);return d}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:(p)=>{if(n?.Parent&&p instanceof n.Parent)return!0;return p?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class $e extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class xr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(qu=globalThis).__zod_globalConfig??(qu.__zod_globalConfig={});var Y=globalThis.__zod_globalConfig;function ne(e){if(e)Object.assign(Y,e);return Y}function r0(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,_r,2)),e.message}function n0(e){this._zod.message=e}var s0={get:r0,set:n0,enumerable:!0,configurable:!0},ri={value:void 0,enumerable:!1},Ku=new WeakSet([Object.prototype,Error.prototype]),Fu=(e,t)=>{e.name="$ZodError",ri.value=t,Object.defineProperty(e,"issues",ri),ri.value=void 0,Object.defineProperty(e,"message",s0);let r=Object.getPrototypeOf(e);if(!Ku.has(r))Ku.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},Gu=w("$ZodError",Fu),AO=w("$ZodError",Fu,void 0,{Parent:Error});function o0(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function Hu(e,t=(r)=>r.message){let r={},n=[];for(let s of e.issues)if(s.path.length>0)o0(r,s.path[0],()=>[]).push(t(s));else n.push(t(s));return{formErrors:n,fieldErrors:r}}function Wu(e,t=(r)=>r.message){let r={_errors:[]},n=(s,o=[])=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>n({issues:a},[...o,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...o,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...o,...i.path]);else{let a=[...o,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;while(u<a.length){let l=a[u],f=u===a.length-1;if(l==="_errors"){if(f)c._errors.push(t(i));u++;continue}if(!Object.prototype.hasOwnProperty.call(c,l))Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[l];if(f)p._errors.push(t(i));c=p,u++}}}};return n(e),r}function Kn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Fn=(e)=>{let t=(r,n,s,o)=>{let i=s?{...s,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new $e;if(a.issues.length){let c=new(o?.Err??e)(a.issues.map((u)=>Ae(u,i,ne())));throw Vo(c,o?.callee??t),c}return a.value};return t};var Gn=(e)=>{let t=async(r,n,s,o)=>{let i=s?{...s,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(o?.Err??e)(a.issues.map((u)=>Ae(u,i,ne())));throw Vo(c,o?.callee??t),c}return a.value};return t};var Hn=(e)=>(t,r,n)=>{let s=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new $e;return o.issues.length?Vu(e,o.issues,s):{success:!0,data:o.value}};function Vu(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((s)=>Ae(s,r,ne()))),t=void 0,r=void 0;return n},set error(s){n=s,t=void 0,r=void 0}}}var Wn=(e)=>async(t,r,n)=>{let s=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)o=await o;return o.issues.length?Vu(e,o.issues,s):{success:!0,data:o.value}};var i0=Symbol.for("zod.compile.invalid"),a0=Symbol.for("zod.compile.fallback"),ni=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==i0)return!0;if(n.definite===!0&&r===void 0)return!1}return c0(e,t,r)};function c0(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},s=e._zod.bag.fallbackRun,o;if(s)n[a0]=!0,o=s({value:t,issues:[]},n);else o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)throw new $e;return o.issues.length===0}var si=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},s=e._zod.run({value:t,issues:[]},n);if(s instanceof Promise)s=await s;return s.issues.length===0},Yu=(e)=>{let t=Fn(e),r=(n,s,o,i)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return t(n,s,a,Kn(r,i))};return r};var Ju=(e)=>{let t=Fn(e),r=(n,s,o,i)=>t(n,s,o,Kn(r,i));return r};var Qu=(e)=>{let t=Gn(e),r=async(n,s,o,i)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return await t(n,s,a,Kn(r,i))};return r};var Xu=(e)=>{let t=Gn(e),r=async(n,s,o,i)=>await t(n,s,o,Kn(r,i));return r};var el=(e)=>(t,r,n)=>{let s=n?{...n,direction:"backward"}:{direction:"backward"};return Hn(e)(t,r,s)};var tl=(e)=>(t,r,n)=>Hn(e)(t,r,n);var rl=(e)=>async(t,r,n)=>{let s=n?{...n,direction:"backward"}:{direction:"backward"};return Wn(e)(t,r,s)};var nl=(e)=>async(t,r,n)=>Wn(e)(t,r,n);var sl=/^[cC][0-9a-z]{6,}$/,ol=/^[0-9a-z]+$/,il=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,al=/^[0-9a-vA-V]{20}$/,cl=/^[A-Za-z0-9]{27}$/,ul=/^[a-zA-Z0-9_-]{21}$/;function ll(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var pl=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var fl=/^([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})$/,ii=(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 dl=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var u0="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function hl(){return new RegExp(u0,"u")}var ml=/^(?:(?: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])$/,gl=/^(([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 yl=/^((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])$/,wl=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_l=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var vl=/^https?$/,kl=/^\+[1-9]\d{6,14}$/;var xl="(?:(?:\\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])))";function l0(e){return new RegExp(`^${e}$`)}var Sl=l0(xl);function oi(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}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Al(e){return new RegExp(`^${oi(e)}$`)}function $l(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${oi({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${oi({precision:e.precision})}`:r;return new RegExp(`^${xl}T(?:${n})$`)}var Pl=/^[\s\S]{0,}$/;var ai=/^-?\d+$/,Sr=/^-?\d+(?:\.\d+)?$/,El=/^(?:true|false)$/i;var Tl=/^[^A-Z]*$/,Ol=/^[^a-z]*$/;var V=w("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var ci=(e)=>{let t=e.value;return!$u(t)&&t.length!==void 0},Vn={number:"number",bigint:"bigint",object:"date"},ui=w("$ZodCheckLessThan",(e,t)=>{V.init(e,t);let r=Vn[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Vn[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),li=w("$ZodCheckGreaterThan",(e,t)=>{V.init(e,t);let r=Vn[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Vn[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Il=w("$ZodCheckMultipleOf",(e,t)=>{V.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Pu(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Nl=w("$ZodCheckNumberFormat",(e,t)=>{V.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[s,o]=jn[t.format];e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(a<s)i.issues.push({origin:"number",input:a,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort});if(a>o)i.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}});var Rl=w("$ZodCheckMaxLength",(e,t)=>{var r;V.init(e,t),(r=e._zod.def).when??(r.when=ci),e._zod.check=(n)=>{let s=n.value,o=s.length;if((typeof s==="string"&&o>t.maximum?Mn(s):o)<=t.maximum)return;let a=qn(s);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Cl=w("$ZodCheckMinLength",(e,t)=>{var r;V.init(e,t),(r=e._zod.def).when??(r.when=ci),e._zod.check=(n)=>{let s=n.value,o=s.length;if((typeof s==="string"&&o>=t.minimum&&o<t.minimum*2?Mn(s):o)>=t.minimum)return;let a=qn(s);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),zl=w("$ZodCheckLengthEquals",(e,t)=>{var r;V.init(e,t),(r=e._zod.def).when??(r.when=ci),e._zod.check=(n)=>{let s=n.value,o=s.length,i=typeof s==="string"&&o>=t.length&&o<=t.length*2?Mn(s):o;if(i===t.length)return;let a=qn(s),c=i>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),$r=w("$ZodCheckStringFormat",(e,t)=>{var r,n;if(V.init(e,t),t.pattern)(r=e._zod).check??(r.check=(s)=>{if(t.pattern.lastIndex=0,t.pattern.test(s.value))return;s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),Ll=w("$ZodCheckRegex",(e,t)=>{$r.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Dl=w("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Tl),$r.init(e,t)}),jl=w("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ol),$r.init(e,t)}),Ul=w("$ZodCheckIncludes",(e,t)=>{V.init(e,t);let r=et(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(s)=>{if(s.value.includes(t.includes,t.position))return;s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),Zl=w("$ZodCheckStartsWith",(e,t)=>{V.init(e,t);let r=new RegExp(`^${et(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ml=w("$ZodCheckEndsWith",(e,t)=>{V.init(e,t);let r=new RegExp(`.*${et(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var ql=w("$ZodCheckOverwrite",(e,t)=>{V.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class pi{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
140
+ `).filter((o)=>o),n=Math.min(...r.map((o)=>o.length-o.trimStart().length)),s=r.map((o)=>o.slice(n)).map((o)=>" ".repeat(this.indent*2)+o);for(let o of s)this.content.push(o)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
141
+ ${t.join(`
142
+ `)}
143
+ };`)(...Object.values(this.closed))}}var Kl={major:4,minor:6,patch:7};var L=w("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Kl;let n=e._zod.def.checks,s=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let o of s)for(let i of o._zod.onattach)i(e);if(s.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,c,u)=>{if(a.memo)return a;let l=pe(a),f;for(let p of c){if(p._zod.def.when){if(Du(a))continue;if(!p._zod.def.when(a))continue}else if(l)continue;let d=a.issues.length,h=p._zod.check(a);if(h instanceof Promise&&u?.async===!1)throw new $e;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,a.issues.length===d)return;if(Zn(a.issues,d,e),!l)l=pe(a,d)});else{if(a.issues.length===d)continue;if(Zn(a.issues,d,e),!l)l=pe(a,d)}}if(f)return f.then(()=>a);return a},i=(a,c,u)=>{if(pe(a))return a.aborted=!0,a;let l=o(c,s,u);if(l instanceof Promise){if(u.async===!1)throw new $e;return l.then((f)=>e._zod.parse(f,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(l instanceof Promise)return l.then((f)=>i(f,a,c));return i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new $e;return u.then((l)=>o(l,s,c))}return o(u,s,c)}}},{get "~standard"(){return Bn(this,"~standard",di(this))},set "~standard"(e){je(this,"~standard",e)}}),sp=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>Ae(r,t,ne()))}:{value:e.value};async function p0(e,t){let r={async:!0};return sp(await e._zod.run({value:t,issues:[]},r),r)}function di(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return sp(n,r)}catch(n){}return p0(e,t)},vendor:"zod",version:1}}var Xn=w("$ZodString",(e,t)=>{L.init(e,t),e._zod.pattern=t.pattern??Pl,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(s){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),j=w("$ZodStringFormat",(e,t)=>{$r.init(e,t),Xn.init(e,t)}),op=w("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=fl),j.init(e,t)}),ip=w("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ii(n))}else t.pattern??(t.pattern=ii());j.init(e,t)}),ap=w("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=dl),j.init(e,t)}),cp=1,Jn=2;function up(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function f0(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return up(e)||Jn;return d0(e,t)}function d0(e,t){if(!t.normalize&&t.protocol?.source===vl.source&&!/^https?:\/\//i.test(e))return cp;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Jn}return new URL(e)}catch{return Jn}}var h0=/[\t\n\r]/g;function Fl(e){return e.replace(h0,"")}function m0(e,t){return t.lastIndex=0,t.test(e.hostname)}function g0(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var lp=w("$ZodURL",(e,t)=>{j.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),s=f0(n,t);if(s===cp){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(s===Jn){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(s===!0){r.value=Fl(n);return}if(t.hostname&&!m0(s,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!g0(s,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?s.href:Fl(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),pp=w("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=hl()),j.init(e,t)}),fp=w("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?ul:ll(t.length)),j.init(e,t)}),dp=w("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=sl),j.init(e,t)}),hp=w("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ol),j.init(e,t)}),mp=w("$ZodULID",(e,t)=>{t.pattern??(t.pattern=il),j.init(e,t)}),gp=w("$ZodXID",(e,t)=>{t.pattern??(t.pattern=al),j.init(e,t)}),yp=w("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=cl),j.init(e,t)}),wp=w("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=$l(t)),j.init(e,t)}),bp=w("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Sl),j.init(e,t)}),_p=w("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Al(t)),j.init(e,t)}),vp=w("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=pl),j.init(e,t)}),kp=w("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ml),j.init(e,t)}),y0=/^[0-9a-fA-F:.]+$/;function xp(e){if(!y0.test(e))return!1;return up(`http://[${e}]`)}var Sp=w("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=gl),j.init(e,t),e._zod.check=(r)=>{if(!xp(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Ap=w("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=yl),j.init(e,t)});function w0(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let s=Number(n);if(`${s}`!==n)return!1;if(s<0||s>128)return!1;return xp(r)}var $p=w("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=wl),j.init(e,t),e._zod.check=(r)=>{if(!w0(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Pp(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var hi=/^[0-9a-zA-Z+/]*={0,2}$/,Ep=w("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=hi),j.init(e,t),e._zod.check=(r)=>{if(Pp(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),es=/^[A-Za-z0-9_-]*$/;function b0(e){if(!es.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Pp(r)}var Tp=w("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=es),j.init(e,t),e._zod.check=(r)=>{if(b0(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Op=w("$ZodE164",(e,t)=>{t.pattern??(t.pattern=kl),j.init(e,t)});function _0(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let s=JSON.parse(atob(n));if("typ"in s&&s?.typ!=="JWT")return!1;if(!s.alg)return!1;if(t&&(!("alg"in s)||s.alg!==t))return!1;return!0}catch{return!1}}var Ip=w("$ZodJWT",(e,t)=>{j.init(e,t),e._zod.check=(r)=>{if(_0(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var mi=w("$ZodNumber",(e,t)=>{L.init(e,t),e._zod.pattern=Sr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let s=r.value;if(typeof s==="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;let o=typeof s==="number"?Number.isNaN(s)?"NaN":!Number.isFinite(s)?String(s):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),r}}),Np=w("$ZodNumberFormat",(e,t)=>{Nl.init(e,t),mi.init(e,t)}),Rp=w("$ZodBoolean",(e,t)=>{L.init(e,t),e._zod.pattern=El,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(o){}let s=r.value;if(typeof s==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}});var Cp=w("$ZodUnknown",(e,t)=>{L.init(e,t),e._zod.parse=(r)=>r}),zp=w("$ZodNever",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function v0(e,t){let r=Xo(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((o)=>o[0])),s=e._zod.parse;e._zod.parse=(o,i)=>{let a=t(o.value);if(a>n&&!i?.skipChecks&&i?.direction!=="backward"){for(let[c,u]of Xo(e._zod.def.checks))if(a>c&&u._zod.def.when(o)){let l=o.issues.length;return u._zod.check(o),o.issues[l].continue=!1,Zn(o.issues,l,e),o}}return s(o,i)}}var k0=(e)=>Array.isArray(e)?e.length:-1;function Gl(e,t,r){if(e.issues.length)t.issues.push(...Se(r,e.issues));t.value[r]=e.value}var Lp=w("$ZodArray",(e,t)=>{L.init(e,t);let r=Y.memoizer;r?.attach(e),e._zod.parse=(n,s)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=r?r.alloc(e,n,Array(o.length),s):Array(o.length);let i=[],a=s?.abortEarly;for(let c=0;c<o.length;c++){let u=o[c],l=t.element._zod.run({value:u,issues:[]},s);if(l instanceof Promise)i.push(l.then((f)=>Gl(f,n,c)));else if(Gl(l,n,c),a&&l.issues.length!==0&&pe(l))break}if(i.length)return Promise.all(i).then(()=>n);return n},v0(e,k0)});function Qn(e,t,r,n,s,o){let i=r in n,a=o==="optional";if(!i&&a&&s==="optional")return;if(e.issues.length){if(s!==void 0&&a&&!i)return;t.issues.push(...Se(r,e.issues))}if(!i&&s===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i||s==="defaulted"&&!a)t.value[r]=void 0}else t.value[r]=e.value}var x0=[];function Dp(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:x0,s=n.length?[...t,...n]:t;for(let i of s)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let o=Cu(e.shape);return{...e,allKeys:s,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function jp(e,t,r,n,s,o,i){let a=[],c=s.keySet,u=s.catchall._zod,l=u.def.type,{optin:f,optout:p}=u,d=0;for(let h in t){if(i&&r.issues.length!==d){if(pe(r,d))break;d=r.issues.length}if(c.has(h))continue;if(h==="__proto__"){if(l==="never")a.push(h);continue}if(l==="never"){a.push(h);continue}let m=u.run({value:t[h],issues:[]},n);if(m instanceof Promise)e.push(m.then((g)=>Qn(g,r,h,t,f,p)));else Qn(m,r,h,t,f,p)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var S0=w("$ZodObject",(e,t)=>{L.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let s=vr(()=>Dp(t));N(e,"propValues",(u)=>{let l=u.def.shape,f={};for(let p in l){let d=l[p]._zod;if(d.values){if(!Object.prototype.hasOwnProperty.call(f,p))le(f,p,new Set);for(let h of d.values)f[p].add(h);if(d.optin!==void 0)f[p].add(void 0)}}return f});let o=Lt,i=t.catchall,a,c=Y.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=s.value);let f=u.value;if(!o(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let p=[],d=a.shape,h=l?.abortEarly,m=u.issues.length;for(let g of a.allKeys){if(h&&u.issues.length!==m){if(pe(u,m))break;m=u.issues.length}if(g==="__proto__")continue;let _=d[g],S=_._zod.optin,x=_._zod.optout,b=_._zod.run({value:f[g],issues:[]},l);if(b instanceof Promise)p.push(b.then((v)=>Qn(v,u,g,f,S,x)));else Qn(b,u,g,f,S,x)}if(!i)return p.length?Promise.all(p).then(()=>u):u;return jp(p,f,u,l,s.value,e,h===!0)}}),Up=w("$ZodObjectJIT",(e,t)=>{S0.init(e,t);let r=e._zod.parse,n=vr(()=>Dp(t)),s=Y.memoizer,o=(d)=>{let h=n.value,m=h.symbolKeys,g=new pi(["payload","ctx"],{shape:d,inst:e,memo:s,syms:m}),_=(v)=>`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`,S=(v,k)=>`
144
+ let ${v}_ab = false;
145
+ for (let i = 0; i < ${v}.issues.length; i++) {
146
+ const iss = ${v}.issues[i];
147
+ iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
148
+ payload.issues.push(iss);
149
+ if (iss.continue !== true) ${v}_ab = true;
150
+ }
151
+ if (${v}_ab && ctx && ctx.abortEarly) {
152
+ payload.value = newResult;
153
+ return payload;
154
+ }`;g.write("const input = payload.value;");let x=Object.create(null),b=0;for(let v of h.allKeys)x[v]=`key_${b++}`;g.write(s?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let v of h.allKeys){if(v==="__proto__")continue;let k=x[v],T=typeof v==="symbol"?`syms[${m.indexOf(v)}]`:Ou(v),P=`${T} in input`,K=d[v],ae=K?._zod?.optin,Ce=ae!==void 0,G=K?._zod?.optout==="optional";if(g.write(`const ${k} = ${_(T)};`),Ce&&G){let Gr=ae==="optional"?`${k}_present`:`${k}.value !== undefined || ${k}_present`;g.write(`
155
+ const ${k}_present = ${P};
156
+ if (!${k}.issues.length || ${k}_present) {
157
+ if (${k}.issues.length) {${S(k,T)}
158
+ }
159
+
160
+ if (${Gr}) {
161
+ newResult[${T}] = ${k}.value;
162
+ }
163
+ }
164
+
165
+ `)}else if(!Ce)g.write(`
166
+ const ${k}_present = ${P};
167
+ if (${k}.issues.length) {${S(k,T)}
168
+ }
169
+ if (!${k}_present && !${k}.issues.length) {
170
+ payload.issues.push({
171
+ code: "invalid_type",
172
+ expected: "nonoptional",
173
+ input: undefined,
174
+ path: [${T}]
175
+ });
176
+ if (ctx && ctx.abortEarly) {
177
+ payload.value = newResult;
178
+ return payload;
179
+ }
180
+ }
181
+
182
+ if (${k}_present) {
183
+ newResult[${T}] = ${k}.value;
184
+ }
185
+
186
+ `);else if(g.write(`
187
+ if (${k}.issues.length) {${S(k,T)}
188
+ }
189
+ `),ae==="defaulted")g.write(`newResult[${T}] = ${k}.value;`);else g.write(`
190
+ if (${k}.value !== undefined || ${P}) {
191
+ newResult[${T}] = ${k}.value;
192
+ }
193
+ `)}return g.write("payload.value = newResult;"),g.write("return payload;"),g.compile()},i,a=Lt,c=!Y.jitless,l=c&&Nu.value,f=t.catchall,p;e._zod.parse=(d,h)=>{p??(p=n.value);let m=d.value;if(!a(m))return d.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),d;if(c&&l&&h?.async===!1&&h.jitless!==!0){if(!i)i=o(t.shape);if(d=i(d,h),!f)return d;return jp([],m,d,h,p,e,h?.abortEarly===!0)}return r(d,h)}});function Hl(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let s=e.filter((o)=>!pe(o));if(s.length===1)return t.value=s[0].value,s[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((o)=>o.issues.map((i)=>Ae(i,n,ne())))}),t}var gi=w("$ZodUnion",(e,t)=>{L.init(e,t),N(e,"optin",(n)=>n.def.options.some((s)=>s._zod.optin==="defaulted")?"defaulted":n.def.options.some((s)=>s._zod.optin!==void 0)?"optional":void 0),N(e,"optout",(n)=>n.def.options.some((s)=>s._zod.optout==="optional")?"optional":void 0),N(e,"values",(n)=>{if(n.def.options.every((s)=>s._zod.values))return new Set(n.def.options.flatMap((s)=>Array.from(s._zod.values)));return}),N(e,"pattern",(n)=>{if(n.def.options.every((s)=>s._zod.pattern)){let s=n.def.options.map((o)=>o._zod.pattern);return new RegExp(`^(${s.map((o)=>Dn(o.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,s)=>{if(r)return r(n,s);let o=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},s);if(c instanceof Promise)i.push(c),o=!0;else{if(c.issues.length===0)return c;i.push(c)}}if(!o)return Hl(i,n,e,s);return Promise.all(i).then((a)=>Hl(a,n,e,s))}});function A0(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let s of n)if(t.has(s)){if(s!==void 0)throw Error(`Duplicate discriminator value "${String(s)}"`);t.set(s,null)}else t.set(s,r)}return t}var Zp=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,gi.init(e,t);let r=e._zod.parse;N(e,"propValues",(s)=>{let o={},i=0;for(let a of s.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${s.def.options.indexOf(a)}"`);if(c[s.def.discriminator]?.has(void 0))i++;for(let[u,l]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(o,u))le(o,u,new Set);for(let f of l)o[u].add(f)}}if(!s.def.unionFallback&&i>1)o[s.def.discriminator]?.delete(void 0);return o}),t.options.forEach((s,o)=>{let i=kr(s._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw Error(`Invalid discriminated union option at index "${o}"`)});let n=vr(()=>A0(t));e._zod.parse=(s,o)=>{let i=s.value;if(!Lt(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),s;let a=i?.[t.discriminator],c=n.value.get(a);if(c&&(a!==void 0||o.direction!=="backward"))return c._zod.run(s,o);if(t.unionFallback||o.direction==="backward")return r(s,o);return s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((u)=>n.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),s}}),Mp=w("$ZodIntersection",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let s=r.value,o=t.left._zod.run({value:s,issues:[]},n),i=t.right._zod.run({value:s,issues:[]},n);if(o instanceof Promise||i instanceof Promise)return Promise.all([o,i]).then(([c,u])=>Wl(r,c,u));return Wl(r,o,i)}});function fi(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(mt(e)&&mt(t)){let r=Object.keys(t),n=Object.keys(e).filter((o)=>r.indexOf(o)!==-1),s={...e,...t};if(Object.prototype.hasOwnProperty.call(s,"__proto__"))delete s.__proto__;for(let o of n){if(o==="__proto__")continue;let i=fi(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let s=e[n],o=t[n],i=fi(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Wl(e,t,r){let n=new Map,s,o=new Map,i=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)s??(s=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let p=String(u.path[0]);if(!o.has(p))o.set(p,u);f=[p]}else return!1;for(let p of f){if(!n.has(p))n.set(p,{});n.get(p)[l]=!0}return!0};for(let u of t.issues)if(!i(u,"l"))e.issues.push(u);for(let u of r.issues)if(!i(u,"r"))e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=s?a.filter((l)=>s.keys.includes(l)):[];if(u.length)e.issues.push({...s,keys:u});for(let l of a)if(!u.includes(l)&&o.has(l))e.issues.push(o.get(l))}let c=fi(t.value,r.value);if(!c.valid){if(pe(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var qp=w("$ZodTuple",(e,t)=>{L.init(e,t);let r=t.items,n=Y.memoizer;n?.attach(e),e._zod.parse=(s,o)=>{let i=s.value;if(!Array.isArray(i))return s.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),s;s.value=n?n.alloc(e,s,[],o):[];let a=[],c=Vl(r,"optin"),u=Vl(r,"optout");if(!t.rest){if(i.length<c)return s.issues.push({code:"too_small",minimum:c,inclusive:!0,input:i,inst:e,origin:"array"}),s;if(i.length>r.length)s.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:i,inst:e,origin:"array"})}let l=Array(r.length),f=t.rest?o?.abortEarly:void 0,p=!1;for(let d=0;d<r.length;d++){let h=r[d]._zod.run({value:i[d],issues:[]},o);if(h instanceof Promise)a.push(h.then((m)=>{l[d]=m}));else if(l[d]=h,f&&!p&&h.issues.length)p=pe(h)}if(t.rest&&!p){let d=r.length-1,h=i.slice(r.length),m=s.issues.length;for(let g of h){if(f&&s.issues.length!==m){if(pe(s,m))break;m=s.issues.length}d++;let _=t.rest._zod.run({value:g,issues:[]},o);if(_ instanceof Promise)a.push(_.then((S)=>Yl(S,s,d)));else Yl(_,s,d)}}if(a.length)return Promise.all(a).then(()=>Jl(l,s,r,i,u));return Jl(l,s,r,i,u)}});function Vl(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function Yl(e,t,r){if(e.issues.length)t.issues.push(...Se(r,e.issues));t.value[r]=e.value}function Jl(e,t,r,n,s){for(let o=0;o<r.length;o++){let i=e[o],a=o<n.length;if(!a&&o>=s&&r[o]._zod.optin==="optional"){t.value.length=o;break}if(i.issues.length){if(!a&&o>=s){t.value.length=o;break}t.issues.push(...Se(o,i.issues))}t.value[o]=i.value}for(let o=t.value.length-1;o>=n.length;o--)if(r[o]._zod.optout==="optional"&&t.value[o]===void 0)t.value.length=o;else break;return t}var Bp=w("$ZodRecord",(e,t)=>{L.init(e,t);let r=Y.memoizer;r?.attach(e),e._zod.parse=(n,s)=>{let o=n.value;if(!mt(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},s):{};let c=new Set;for(let l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(c.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let f=t.keyType._zod.run({value:l,issues:[]},s);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map((h)=>Ae(h,s,ne())),input:l,path:[l],inst:e});continue}let p=f.value;if(p==="__proto__")continue;let d=t.valueType._zod.run({value:o[l],issues:[]},s);if(d instanceof Promise)i.push(d.then((h)=>{if(h.issues.length)n.issues.push(...Se(l,h.issues));n.value[p]=h.value}));else{if(d.issues.length)n.issues.push(...Se(l,d.issues));n.value[p]=d.value}}let u;for(let l in o)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=o[l]}else u=u??[],u.push(l);if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},s):{};let c;for(let u of Reflect.ownKeys(o)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},s);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Sr.test(u)&&l.issues.length){let h=t.keyType._zod.run({value:Number(u),issues:[]},s);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length===0)l=h}if(l.issues.length){if(t.mode==="loose")n.value[u]=o[u];else if(a)c=c??[],c.push(u);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((h)=>Ae(h,s,ne())),input:u,path:[u],inst:e});continue}let p=l.value;if(p==="__proto__")continue;let d=t.valueType._zod.run({value:o[u],issues:[]},s);if(d instanceof Promise)i.push(d.then((h)=>{if(h.issues.length)n.issues.push(...Se(u,h.issues));n.value[p]=h.value}));else{if(d.issues.length)n.issues.push(...Se(u,d.issues));n.value[p]=d.value}}if(c&&c.length>0)n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c,continue:!0})}if(i.length)return Promise.all(i).then(()=>n);return n}});var Kp=w("$ZodEnum",(e,t)=>{L.init(e,t);let r=br(t.entries),n=new Set(r);e._zod.values=n,N(e,"pattern",(s)=>{let o=br(s.def.entries).filter((i)=>Ru.has(typeof i));return new RegExp(o.length?`^(${o.map((i)=>et(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(s,o)=>{let i=s.value;if(n.has(i))return s;return s.issues.push({code:"invalid_value",values:r,input:i,inst:e}),s}}),Fp=w("$ZodLiteral",(e,t)=>{L.init(e,t);let r=new Set(t.values);e._zod.values=r,N(e,"pattern",(n)=>{let s=n.def.values;return new RegExp(s.length?`^(${s.map((o)=>typeof o==="string"?et(o):o?et(o.toString()):String(o)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,s)=>{let o=n.value;if(r.has(o))return n;return n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}});var Gp=w("$ZodTransform",(e,t)=>{L.init(e,t),e._zod.optin="optional",Y.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new xr(e.constructor.name);let s=t.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then((i)=>(r.value=i,r));if(s instanceof Promise)throw new $e;return r.value=s,r}});function Ql(e,t){return e.value=t.issues.length?void 0:t.value,e}var yi=w("$ZodOptional",(e,t)=>{L.init(e,t),N(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",N(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),N(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Dn(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let s=t.innerType._zod.run({value:r.value,issues:[]},n);if(s instanceof Promise)return s.then((o)=>Ql(r,o));return Ql(r,s)}return t.innerType._zod.run(r,n)}}),Hp=w("$ZodExactOptional",(e,t)=>{yi.init(e,t),N(e,"values",(r)=>r.def.innerType._zod.values),N(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Wp=w("$ZodNullable",(e,t)=>{L.init(e,t),N(e,"optin",(r)=>r.def.innerType._zod.optin),N(e,"optout",(r)=>r.def.innerType._zod.optout),N(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Dn(n.source)}|null)$`):void 0}),N(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),Vp=w("$ZodDefault",(e,t)=>{L.init(e,t),e._zod.optin="defaulted",N(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let s=t.innerType._zod.run(r,n);if(s instanceof Promise)return s.then((o)=>Xl(o,t));return Xl(s,t)}});function Xl(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Yp=w("$ZodPrefault",(e,t)=>{L.init(e,t),e._zod.optin="defaulted",N(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Jp=w("$ZodNonOptional",(e,t)=>{L.init(e,t),N(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((s)=>s!==void 0)):void 0}),e._zod.parse=(r,n)=>{let s=t.innerType._zod.run(r,n);if(s instanceof Promise)return s.then((o)=>ep(o,e));return ep(s,e)}});function ep(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function tp(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((s)=>Ae(s,n,ne()))},input:e.value}),e}var Qp=w("$ZodCatch",(e,t)=>{L.init(e,t),N(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),N(e,"optout",(r)=>r.def.innerType._zod.optout),N(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let s=t.innerType._zod.run({value:r.value,issues:[]},n);if(s instanceof Promise)return s.then((o)=>tp(r,o,t,n));return tp(r,s,t,n)}});var wi=w("$ZodPipe",(e,t)=>{L.init(e,t),N(e,"values",(r)=>r.def.in._zod.values),N(e,"optin",(r)=>r.def.in._zod.optin),N(e,"optout",(r)=>r.def.out._zod.optout),N(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=t.out._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Yn(i,t.in,n));return Yn(o,t.in,n)}let s=t.in._zod.run(r,n);if(s instanceof Promise)return s.then((o)=>Yn(o,t.out,n));return Yn(s,t.out,n)}});function Yn(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Xp=w("$ZodPreprocess",(e,t)=>{wi.init(e,t)}),ef=w("$ZodReadonly",(e,t)=>{L.init(e,t),N(e,"propValues",(r)=>r.def.innerType._zod.propValues),N(e,"values",(r)=>r.def.innerType._zod.values),N(e,"optin",(r)=>r.def.innerType?._zod?.optin),N(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let s=t.innerType._zod.run(r,n);if(s instanceof Promise)return s.then(rp);return rp(s)}});function rp(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var tf=w("$ZodCustom",(e,t)=>{V.init(e,t),L.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,s=t.fn(n);if(s instanceof Promise)return s.then((o)=>np(o,r,n,e));np(s,r,n,e);return}});function np(e,t,r,n){if(!e){let s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)s.params=n._zod.def.params;t.issues.push(gt(s))}}class nf extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var _i="~memo",rf=[];function sf(e){return e!==null&&typeof e==="object"}function bi(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var of=new WeakMap,Pr=0,ns=1,Er=2;function ss(e,t,r){let n=of.get(e);if(n!==void 0)return n?Er:Pr;if(t.has(e))return Er;t.add(e);let s=Pr,o=(l)=>{if(s!==Er&&l?._zod){let f=ss(l,t,r);if(f>s)s=f}},i=(l,f)=>{let p=Pr;for(let d of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,d);if(f&&!h.enumerable)continue;let m=h.get?ns:h.value?._zod?ss(h.value,t,r):Pr;if(m>p)p=m}return p},a=(l)=>{if(l>s)s=l},c=e._zod.def,u=c.type;switch(u){case"object":{let l=kr(c);a(l?i(l,!0):ns),o(c.catchall);break}case"array":o(c.element);break;case"tuple":for(let l of c.items)o(l);o(c.rest);break;case"record":case"map":o(c.keyType),o(c.valueType);break;case"set":o(c.valueType);break;case"union":for(let l of c.options)o(l);break;case"intersection":o(c.left),o(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(c.innerType);break;case"pipe":o(c.in),o(c.out);break;case"function":o(c.input),o(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?ss(l,t,!1):ns);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let f=Object.getOwnPropertyDescriptor(c,l);if(!f||f.get)continue;let p=f.value;if(!p||typeof p!=="object")continue;if(p._zod)o(p);else if(Array.isArray(p))for(let d of p)o(d)}}return t.delete(e),$0(e,s)}function $0(e,t){if(t!==ns)of.set(e,t===Er);return t}function P0(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var ts,rs=[],E0={alloc(e,t,r){let n=ts;if(!n)return r;ts=void 0;let s={value:r,issues:null};return n.set(t.value,s),rs.push(s),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(s,o)=>{if(o.direction!=="backward"&&T0(o,s.value))throw new nf;return r(s,o)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,s,o;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let _=ss(e,new Set,!1);if(_===Pr){if(e._zod.parse=i,e._zod.run===a)e._zod.run=i;return i(c,u)}if(_===Er||n)r=!0;else n=!0}let l=c.value;if(!sf(l))return i(c,u);let f=u[_i];if(!f)f={buckets:new WeakMap,backEdges:void 0},u[_i]=f;let p;if(s===u)p=o;else p=P0(f,e),s=u,o=p;let d=p.get(l);if(d){if(c.value=d.value,d.issues){if(d.issues.length)c.issues.push(...bi(d.issues))}else c.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value);return c}ts=p;let h=rs.length,m=i(c,u);ts=void 0;let g=rs.length>h?rs.pop():void 0;if(m instanceof Promise)return m.then((_)=>{if(g)g.issues=_.issues.length?bi(_.issues):rf;return _});if(g)g.issues=m.issues.length?bi(m.issues):rf;return m};if(e._zod.parse=a,e._zod.run===i)e._zod.run=a})}};function af(){return E0}function T0(e,t){let r=e[_i]?.backEdges;return r!==void 0&&sf(t)&&r.has(t)}var O0=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function s(o,i){if(o==="number"&&typeof i==="number"&&!Number.isFinite(i))return String(i);return n[o]??o}return(o)=>{switch(o.code){case"invalid_type":{let i=s(o.expected),a=ju(o.input),c=s(a,o.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${Jo(o.values[0])}`;return`Invalid option: expected one of ${Wo(o.values,"|")}`;case"too_big":{let i=o.exact?"exactly ":o.inclusive?"<=":"<",a=t(o.origin);if(a)return`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.exact?"exactly ":o.inclusive?">=":">",a=t(o.origin);if(a)return`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`;return`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${Wo(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":if(o.options&&Array.isArray(o.options)&&o.options.length>0)return`Invalid discriminator value. Expected ${o.options.map((a)=>`'${a}'`).join(" | ")}`;if(o.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function vi(){return{localeError:O0()}}var cf;class uf{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function I0(){return new uf}(cf=globalThis).__zod_globalRegistry??(cf.__zod_globalRegistry=I0());var yt=globalThis.__zod_globalRegistry;function lf(e){if(e.checks)e.checks=[...e.checks];return e}function pf(e,t){return new e(lf({type:"string",...E(t)}))}function ff(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...E(t)})}function df(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...E(t)})}function hf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...E(t)})}function mf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(t)})}function gf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(t)})}function yf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(t)})}function ki(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...E(t)})}function wf(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...E(t)})}function bf(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(t)})}function _f(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...E(t)})}function vf(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(t)})}function kf(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...E(t)})}function xf(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...E(t)})}function Sf(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(t)})}function Af(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(t)})}function $f(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(t)})}function Pf(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(t)})}function Ef(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(t)})}function Tf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...E(t)})}function Of(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...E(t)})}function If(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...E(t)})}function Nf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...E(t)})}function Rf(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(t)})}function Cf(e,t){return new e({type:"string",format:"date",check:"string_format",...E(t)})}function zf(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...E(t)})}function Lf(e,t){return new e({type:"string",format:"duration",check:"string_format",...E(t)})}function Df(e,t){return new e(lf({type:"number",checks:[],...E(t)}))}function jf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...E(t)})}function Uf(e,t){return new e({type:"boolean",...E(t)})}function Zf(e){return new e({type:"unknown"})}function Mf(e,t){return new e({type:"never",...E(t)})}function os(e,t){return new ui({check:"less_than",...E(t),value:e,inclusive:!1})}function Tr(e,t){return new ui({check:"less_than",...E(t),value:e,inclusive:!0})}function is(e,t){return new li({check:"greater_than",...E(t),value:e,inclusive:!1})}function Or(e,t){return new li({check:"greater_than",...E(t),value:e,inclusive:!0})}function as(e,t){return new Il({check:"multiple_of",...E(t),value:e})}function cs(e,t){return new Rl({check:"max_length",...E(t),maximum:e})}function Dt(e,t){return new Cl({check:"min_length",...E(t),minimum:e})}function us(e,t){return new zl({check:"length_equals",...E(t),length:e})}function xi(e,t){return new Ll({check:"string_format",format:"regex",...E(t),pattern:e})}function Si(e){return new Dl({check:"string_format",format:"lowercase",...E(e)})}function Ai(e){return new jl({check:"string_format",format:"uppercase",...E(e)})}function $i(e,t){return new Ul({check:"string_format",format:"includes",...E(t),includes:e})}function Pi(e,t){return new Zl({check:"string_format",format:"starts_with",...E(t),prefix:e})}function Ei(e,t){return new Ml({check:"string_format",format:"ends_with",...E(t),suffix:e})}function tt(e){return new ql({check:"overwrite",tx:e})}function Ti(e){return tt((t)=>t.normalize(e))}function Oi(){return tt((e)=>e.trim())}function Ii(){return tt((e)=>e.toLowerCase())}function Ni(){return tt((e)=>e.toUpperCase())}function Ri(){return tt((e)=>Iu(e))}function qf(e,t,r){return new e({type:"array",element:t,...E(r)})}function Bf(e,t,r){return new e({type:"custom",check:"custom",fn:t,...E(r)})}function Kf(e,t){let r=N0((n)=>(n.addIssue=(s)=>{if(typeof s==="string")n.issues.push(gt(s,n.value,r._zod.def));else{let o=s;if(o.fatal)o.continue=!1;if(o.code??(o.code="custom"),!("input"in o))o.input=n.value;o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),n.issues.push(gt(o))}},e(n.value,n)),t);return r}function N0(e,t){let r=new V({check:"custom",...E(t)});return r._zod.check=e,r}function Ir(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))le(e,n,r[n]);return e}function zi(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??yt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ue(e,t,r,n,s){let o=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:s}):t.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw Error(s);return Object.assign(r,o),!0}function Z(e,t,r={path:[],schemaPath:[]}){var n;let s=e._zod.def,o=t.seen.get(e);if(o){if(o.count++,r.schemaPath.includes(e))o.cycle=r.path;return o.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let p=i.schema,d=t.processors[s.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);d(e,t,p,l)}let f=e._zod.parent;if(f){if(!i.ref)i.ref=f;Z(f,t,l),t.seen.get(f).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Ir(i.schema,c);if(t.io==="input"&&J(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(n=i.schema).default??(n.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function Ff(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Li(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let s=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(i[0])?.id,p=e.external.uri??((h)=>h);if(f)return{ref:p(f)};let d=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=d,{defId:d,ref:`${p("__shared")}#/${a}/${Ff(d)}`}}let c="#",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Ff(l)}},o=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=s(i);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let f in l)delete l[f];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
194
+
195
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){o(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){o(i);continue}}if(e.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}if(a.count>1){if(e.reused==="ref")o(i)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Wf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;Wf(n);let s=Object.keys(n);if(s.length!==1||s[0]!=="type")return;let o=n.type;for(let i of Array.isArray(o)?o:[o]){if(typeof i!=="string")return;if(!r.includes(i))r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Vf=new Set(["type","properties","required","additionalProperties"]),Gf=["oneOf","anyOf"];function Hf(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Ci(e){let t=[];for(let o of e){if(typeof o!=="object"||o.type!=="object")return null;for(let i in o)if(!Vf.has(i))return null;t.push(o)}let r={},n=new Set;for(let o of t){for(let i in o.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??Hf(u);if(l===null||l===void 0)continue;if(!a.some((f)=>JSON.stringify(f)===JSON.stringify(l)))a.push(l)}let c=a.length===1?a[0]:Ci(a)??{allOf:a};le(r,i,c)}for(let i of o.required??[])n.add(i)}let s={type:"object",properties:r};if(n.size)s.required=[...n];if(t.every((o)=>o.additionalProperties===!1))s.additionalProperties=!1;else{let o=[];for(let i of t){let a=Hf(i);if(a&&!o.some((c)=>JSON.stringify(c)===JSON.stringify(a)))o.push(a)}if(o.length===1)s.additionalProperties=o[0];else if(o.length>1)s.additionalProperties={allOf:o}}return s}function R0(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let s of Vf)if(s in e)return;let r=t.filter((s)=>Gf.some((o)=>Array.isArray(s[o]))),n=null;if(!r.length)n=Ci(t);else{let s=r[0],o=Gf.find((c)=>Array.isArray(s[c]));if(Object.keys(s).length!==1)return;let i=t.filter((c)=>c!==s),a=s[o].map((c)=>Ci([...i,c]));if(a.some((c)=>!c))return;n={[o]:a}}if(!n)return;delete e.allOf,Ir(e,n)}function Di(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},f=c.ref;if(c.ref=null,f){n(f);let d=e.seen.get(f),h=d.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(h);else Ir(u,h);if(Ir(u,l),a._zod.parent===f)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(!(g in l))delete u[g]}if(h.$ref&&d.def)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(g in d.def&&JSON.stringify(u[g])===JSON.stringify(d.def[g]))delete u[g]}}let p=a._zod.parent;if(p&&p!==f){n(p);let d=e.seen.get(p);if(d?.schema.$ref){if(u.$ref=d.schema.$ref,d.def)for(let h in u){if(h==="$ref"||h==="allOf")continue;if(h in d.def&&JSON.stringify(u[h])===JSON.stringify(d.def[h]))delete u[h]}}}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Wf(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=a.get(l);if(f)f.push(u);else a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])R0(u)}}let s={};if(e.target==="draft-2020-12")s.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")s.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")s.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");s.$id=e.external.uri(a)}Ir(s,r.defId?r.schema:r.def??r.schema);let o=e.metadataRegistry.get(t)?.id;if(o!==void 0&&s.id===o)delete s.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;le(i,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")s.$defs=i;else s.definitions=i;try{let a=JSON.parse(JSON.stringify(s));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Nr(t,"input",e.processors),output:Nr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function J(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return J(n.element,r);if(n.type==="set")return J(n.valueType,r);if(n.type==="lazy")return J(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return J(n.innerType,r);if(n.type==="intersection")return J(n.left,r)||J(n.right,r);if(n.type==="record"||n.type==="map")return J(n.keyType,r)||J(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return J(n.in,r)||J(n.out,r)}if(n.type==="object"){for(let s in n.shape)if(J(n.shape[s],r))return!0;return!1}if(n.type==="union"){for(let s of n.options)if(J(s,r))return!0;return!1}if(n.type==="tuple"){for(let s of n.items)if(J(s,r))return!0;if(n.rest&&J(n.rest,r))return!0;return!1}return!1}var Yf=(e,t={})=>(r)=>{let n=zi({...r,processors:t});return Z(e,n),Li(n,e),Di(n,e)},Nr=(e,t,r={})=>(n)=>{let{libraryOptions:s,target:o}=n??{},i=zi({...s??{},target:o,io:t,processors:r});return Z(e,i),Li(i,e),Di(i,e)};var jt=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Ut=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Jf=(e,t)=>{jt(e,"minimum",t),Ut(e,"maximum",t)},td=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},rd=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},nd=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},sd=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Qf=(e,t)=>jt(e,"minimum",t.minimum),Xf=(e,t)=>Ut(e,"maximum",t.maximum),ed=(e)=>(t,r)=>{sd(t,r.format);let[n,s]=e[r.format];jt(t,"minimum",n),Ut(t,"maximum",s)},C0={greater_than:(e,t)=>jt(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Ut(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>td(e,t.value),number_format:ed(jn),bigint_format:ed(Qo),min_length:Qf,max_length:Xf,length_equals:(e,t)=>Jf(e,t.length),min_size:Qf,max_size:Xf,size_equals:(e,t)=>Jf(e,t.size),string_format:(e,t)=>{if(sd(e,t.format),t.pattern)rd(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>nd(e,t.mime)};function se(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let o of n)C0[o._zod.def.check]?.(t,o._zod.def);let s=e._zod.bag;if(s.minimum!==void 0)jt(t,"minimum",s.minimum);if(s.exclusiveMinimum!==void 0)jt(t,"exclusiveMinimum",s.exclusiveMinimum);if(s.maximum!==void 0)Ut(t,"maximum",s.maximum);if(s.exclusiveMaximum!==void 0)Ut(t,"exclusiveMaximum",s.exclusiveMaximum);if(s.multipleOf!==void 0)td(t,s.multipleOf);if(s.format!==void 0){if(t.format??(t.format=s.format),s.format.includes("int"))t.isInt=!0}if(s.mime)nd(t,s.mime);for(let o of s.patterns??[])rd(t,o);return t}var z0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},L0=new Map([[hi,bl],[es,_l]]),od=(e)=>L0.get(e)??e,id=(e,t,r,n)=>{let s=r;s.type="string";let{minimum:o,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=se(e);if(typeof o==="number")s.minLength=o;if(typeof i==="number")s.maxLength=i;if(a){if(s.format=z0[a]??a,s.format==="")delete s.format;if(a==="time"||l)delete s.format}if(u)s.contentEncoding=u;if(c&&c.size>0){let f=[...c].map(od);if(f.length===1)s.pattern=f[0].source;else if(f.length>1)s.allOf=[...f.map((p)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))]}},ad=(e,t,r,n)=>{let s=r,{minimum:o,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=se(e);s.type=l?"integer":"number";let f=typeof u==="number"&&u>=(o??Number.NEGATIVE_INFINITY),p=typeof c==="number"&&c<=(i??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(d)s.minimum=u,s.exclusiveMinimum=!0;else s.exclusiveMinimum=u;else if(typeof o==="number")s.minimum=o;if(p)if(d)s.maximum=c,s.exclusiveMaximum=!0;else s.exclusiveMaximum=c;else if(typeof i==="number")s.maximum=i;if(a){let h=new Set;for(let _ of a)if(Number.isFinite(_)&&_!==0)h.add(Math.abs(_));else Ue(e,t,s,n,`A multipleOf divisor of ${_} cannot be represented in JSON Schema`);let[m,...g]=h;if(m!==void 0)s.multipleOf=m;if(g.length)s.allOf=[...s.allOf??[],...g.map((_)=>({multipleOf:_}))]}},cd=(e,t,r,n)=>{r.type="boolean"};var ud=(e,t,r,n)=>{r.not={}};var ld=(e,t,r,n)=>{};var pd=(e,t,r,n)=>{let s=e._zod.def,o=br(s.entries);if(o.length===0){r.not={};return}if(o.every((i)=>typeof i==="number"))r.type="number";if(o.every((i)=>typeof i==="string"))r.type="string";r.enum=o},fd=(e,t,r,n)=>{let s=e._zod.def;if(s.values.length===0){r.not={};return}let o=[];for(let i of s.values)if(i===void 0){if(Ue(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i==="bigint"){if(Ue(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(i))}else o.push(i);if(o.length===0);else if(o.length===1){let i=o[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(o.every((i)=>typeof i==="number"))r.type="number";if(o.every((i)=>typeof i==="string"))r.type="string";if(o.every((i)=>typeof i==="boolean"))r.type="boolean";if(o.every((i)=>i===null))r.type="null";r.enum=o}};var dd=(e,t,r,n)=>{Ue(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var hd=(e,t,r,n)=>{Ue(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var md=(e,t,r,n)=>{let s=r,o=e._zod.def,{minimum:i,maximum:a}=se(e);if(typeof i==="number")s.minItems=i;if(typeof a==="number")s.maxItems=a;s.type="array",s.items=Z(o.element,t,{...n,path:[...n.path,"items"]})};function Rr(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Rr(t.out);if(t.type==="catch")return Rr(t.innerType);return e._zod.optin}var gd=(e,t,r,n)=>{let s=r,o=e._zod.def,i=o.shape;if(Object.getOwnPropertySymbols(i).length&&Ue(e,t,s,n,"Symbol keys cannot be represented in JSON Schema"))return;s.type="object",s.properties={};for(let u in i)le(s.properties,u,Z(i[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(i)){let l=o.shape[u];if(t.io==="input"?Rr(l)===void 0:l._zod.optout===void 0)c.push(u)}if(c.length>0)s.required=c;if(o.catchall?._zod.def.type==="never")s.additionalProperties=!1;else if(!o.catchall){if(t.io==="output")s.additionalProperties=!1}else if(o.catchall)s.additionalProperties=Z(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},yd=(e,t,r,n)=>{let s=e._zod.def,o=s.inclusive===!1,i=s.options.map((a,c)=>Z(a,t,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));if(o)r.oneOf=i;else r.anyOf=i},wd=(e,t,r,n)=>{let s=e._zod.def,o=Z(s.left,t,{...n,path:[...n.path,"allOf",0]}),i=Z(s.right,t,{...n,path:[...n.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(o)?o.allOf:[o],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)},bd=(e,t,r,n)=>{let s=r,o=e._zod.def;s.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((m,g)=>Z(m,t,{...n,path:[...n.path,i,g]})),u=o.rest?Z(o.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,l=o.items.length;while(l>0){let m=o.items[l-1];if(!(t.io==="input"?Rr(m)!==void 0:m._zod.optout==="optional"))break;l--}let f=o.items.length,p=!o.rest;if(t.target==="draft-2020-12"){if(s.prefixItems=c,p)s.items=!1;else if(u)s.items=u;if(l>0)s.minItems=l;if(p)s.maxItems=f}else if(t.target==="openapi-3.0"){if(s.items={anyOf:c},u)s.items.anyOf.push(u);if(l>0)s.minItems=l;if(p)s.maxItems=f}else{if(s.items=c,p)s.additionalItems=!1;else if(u)s.additionalItems=u;if(l>0)s.minItems=l;if(p)s.maxItems=f}let{minimum:d,maximum:h}=se(e);if(typeof d==="number")s.minItems=d;if(typeof h==="number")s.maxItems=h};function ji(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let m=ji(e,h,r);return m===h?t:m}for(let h of["anyOf","oneOf"]){let m=t[h];if(!Array.isArray(m))continue;let g=m.map((_)=>ji(e,_,r));if(g.some((_,S)=>_!==m[S]))t={...t,[h]:g}}let n=Array.isArray(t.type)?t.type:[t.type],s=!n.includes("string")&&n.some((h)=>h==="number"||h==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!s&&!o?.some((h)=>typeof h==="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:f,id:p,...d}=t;if(d.enum)d.enum=d.enum.map((h)=>typeof h==="number"?String(h):h);else if(typeof d.const==="number")d.const=String(d.const);if(!s)return d;if(d.type="string",!o)d.pattern=(n.includes("number")?Sr:ai).source;return d}var Ui=new WeakMap;function D0(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of Ui.get(e)??[]){let s=e.seen.get(n),o=(s?.def??s?.schema)?.propertyNames;if(!o||o===!0||r.has(o))continue;let i=ji(t,o,new Set);if(i!==o)r.set(o,i)}if(!r.size)return;for(let n of e.seen.values())for(let s of[n.schema,n.def]){let o=s&&r.get(s.propertyNames);if(o)s.propertyNames=o}}var _d=(e,t,r,n)=>{let s=r,o=e._zod.def;s.type="object";let i=o.keyType,a=se(i).patterns;if(o.mode==="loose"&&a&&a.size>0){let l=Z(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});s.patternProperties={};for(let f of a)le(s.patternProperties,od(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){s.propertyNames=Z(o.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Ui.get(t);if(!l)l=[],Ui.set(t,l),t.deferred.push(()=>D0(t));l.push(e)}s.additionalProperties=Z(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=i._zod.values,u=t.io==="input"&&Rr(o.valueType)!==void 0;if(c&&!o.partial&&!u){let l=[...c].filter((f)=>typeof f==="string"||typeof f==="number");if(l.length>0)s.required=l.map(String)}},vd=(e,t,r,n)=>{let s=e._zod.def,o=Z(s.innerType,t,n),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=s.innerType,r.nullable=!0;else r.anyOf=[o,{type:"null"}]},kd=(e,t,r,n)=>{let s=e._zod.def;Z(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType},Zi=Symbol();function xd(e,t,r,n,s){let o=!1,i=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return o=!0,null});if(!o)return JSON.parse(i);return Ue(t,r,n,s,"BigInt defaults cannot be represented in JSON Schema"),Zi}var Sd=(e,t,r,n)=>{let s=e._zod.def;Z(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType;let i=xd(s.defaultValue,e,t,r,n);if(i!==Zi)r.default=i},Ad=(e,t,r,n)=>{let s=e._zod.def;Z(s.innerType,t,n);let o=t.seen.get(e);if(o.ref=s.innerType,t.io!=="input")return;let i=xd(s.defaultValue,e,t,r,n);if(i!==Zi)r._prefault=i},$d=(e,t,r,n)=>{let s=e._zod.def;Z(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{Ue(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},Pd=(e,t,r,n)=>{let s=e._zod.def,o=s.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?o?s.out:s.in:s.out;Z(i,t,n);let a=t.seen.get(e);a.ref=i},Ed=(e,t,r,n)=>{let s=e._zod.def;Z(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType,r.readOnly=!0};var Mi=(e,t,r,n)=>{let s=e._zod.def;Z(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType};var Td=new WeakSet([Object.prototype,Error.prototype]);function ls(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var F0=(e,t)=>{Gu.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Td.has(r))return;Td.add(r),ls(r,"format",(n)=>(s)=>Wu(n,s)),ls(r,"flatten",(n)=>(s)=>Hu(n,s)),ls(r,"addIssue",(n)=>(s)=>{n.issues.push(s),n.message=JSON.stringify(n.issues,_r,2)}),ls(r,"addIssues",(n)=>(s)=>{n.issues.push(...s),n.message=JSON.stringify(n.issues,_r,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var oe=w("ZodError",F0,void 0,{Parent:Error});var Od=Fn(oe),Id=Gn(oe),Nd=Hn(oe),Rd=Wn(oe),Cd=Yu(oe),zd=Ju(oe),Ld=Qu(oe),Dd=Xu(oe),jd=el(oe),Ud=tl(oe),Zd=rl(oe),Md=nl(oe);function H0(){if(!Y.localeError)ne(vi())}function Cr(){if(!Y.memoizer)ne({memoizer:af()})}var U=w("ZodType",(e,t)=>(H0(),L.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(re(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return xe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(FA(e,t))},superRefine(e,t){return this.check(GA(e,t))},overwrite(e){return this.check(tt(e))},optional(){return Bd(this)},exactOptional(){return NA(this)},nullable(){return Kd(this)},nullish(){return Bd(Kd(this))},nonoptional(e){return jA(this,e)},array(){return Pe(this)},or(e){return Jd([this,e])},and(e){return PA(this,e)},transform(e){return Fd(this,Xd(e))},default(e){return zA(this,e)},prefault(e){return DA(this,e)},catch(e){return ZA(this,e)},pipe(e){return Fd(this,e)},readonly(){return BA(this)},describe(e){let t=this.clone();return yt.add(t,{description:e}),t},meta(...e){if(e.length===0)return yt.get(this);let t=this.clone();return yt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Bn(this,"~standard",{...di(this),jsonSchema:{input:Nr(this,"input"),output:Nr(this,"output")}})},set "~standard"(e){je(this,"~standard",e)},parse:function e(t,r){return Od(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Id(this,t,r,{callee:e})},safeParse(e,t){return Nd(this,e,t)},async safeParseAsync(e,t){return Rd(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){je(this,"spa",e)},validate(e,t){return ni(this,e,t)},validateAsync(e,t){return si(this,e,t)},encode:function e(t,r){return Cd(this,t,r,{callee:e})},decode:function e(t,r){return zd(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Ld(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Dd(this,t,r,{callee:e})},safeEncode(e,t){return jd(this,e,t)},safeDecode(e,t){return Ud(this,e,t)},async safeEncodeAsync(e,t){return Zd(this,e,t)},async safeDecodeAsync(e,t){return Md(this,e,t)},toJSONSchema(e){return Yf(this,{})(e)},get description(){return yt.get(this)?.description},get _def(){return this._zod.def}}),Gd=w("_ZodString",(e,t)=>{Xn.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>id(e,r,n,s)},Zu({format:(e)=>se(e).format??null,minLength:(e)=>se(e).minimum??null,maxLength:(e)=>se(e).maximum??null},{regex(...e){return this.check(xi(...e))},includes(...e){return this.check($i(...e))},startsWith(...e){return this.check(Pi(...e))},endsWith(...e){return this.check(Ei(...e))},min(...e){return this.check(Dt(...e))},max(...e){return this.check(cs(...e))},length(...e){return this.check(us(...e))},nonempty(...e){return this.check(Dt(1,...e))},lowercase(e){return this.check(Si(e))},uppercase(e){return this.check(Ai(e))},trim(){return this.check(Oi())},normalize(...e){return this.check(Ti(...e))},toLowerCase(){return this.check(Ii())},toUpperCase(){return this.check(Ni())},slugify(){return this.check(Ri())}})),W0=w("ZodString",(e,t)=>{Xn.init(e,t),Gd.init(e,t)},{email(e){return this.check(ff(X0,e))},url(e){return this.check(ki(Hd,e))},jwt(e){return this.check(Nf(mA,e))},emoji(e){return this.check(wf(tA,e))},guid(e){return this.check(df(eA,e))},uuid(e){return this.check(hf(ps,e))},uuidv4(e){return this.check(mf(ps,e))},uuidv6(e){return this.check(gf(ps,e))},uuidv7(e){return this.check(yf(ps,e))},nanoid(e){return this.check(bf(rA,e))},cuid(e){return this.check(_f(nA,e))},cuid2(e){return this.check(vf(sA,e))},ulid(e){return this.check(kf(oA,e))},base64(e){return this.check(Tf(fA,e))},base64url(e){return this.check(Of(dA,e))},xid(e){return this.check(xf(iA,e))},ksuid(e){return this.check(Sf(aA,e))},ipv4(e){return this.check(Af(cA,e))},ipv6(e){return this.check($f(uA,e))},cidrv4(e){return this.check(Pf(lA,e))},cidrv6(e){return this.check(Ef(pA,e))},e164(e){return this.check(If(hA,e))},datetime(e){return this.check(Rf(V0,e))},date(e){return this.check(Cf(Y0,e))},time(e){return this.check(zf(J0,e))},duration(e){return this.check(Lf(Q0,e))}});function z(e){return pf(W0,e)}var M=w("ZodStringFormat",(e,t)=>{j.init(e,t),Gd.init(e,t)}),V0=w("ZodISODateTime",(e,t)=>{wp.init(e,t),M.init(e,t)}),Y0=w("ZodISODate",(e,t)=>{bp.init(e,t),M.init(e,t)}),J0=w("ZodISOTime",(e,t)=>{_p.init(e,t),M.init(e,t)}),Q0=w("ZodISODuration",(e,t)=>{vp.init(e,t),M.init(e,t)}),X0=w("ZodEmail",(e,t)=>{ap.init(e,t),M.init(e,t)});var eA=w("ZodGUID",(e,t)=>{op.init(e,t),M.init(e,t)});var ps=w("ZodUUID",(e,t)=>{ip.init(e,t),M.init(e,t)});var Hd=w("ZodURL",(e,t)=>{lp.init(e,t),M.init(e,t)});function Wd(e){return ki(Hd,e)}var tA=w("ZodEmoji",(e,t)=>{pp.init(e,t),M.init(e,t)});var rA=w("ZodNanoID",(e,t)=>{fp.init(e,t),M.init(e,t)});var nA=w("ZodCUID",(e,t)=>{dp.init(e,t),M.init(e,t)});var sA=w("ZodCUID2",(e,t)=>{hp.init(e,t),M.init(e,t)});var oA=w("ZodULID",(e,t)=>{mp.init(e,t),M.init(e,t)});var iA=w("ZodXID",(e,t)=>{gp.init(e,t),M.init(e,t)});var aA=w("ZodKSUID",(e,t)=>{yp.init(e,t),M.init(e,t)});var cA=w("ZodIPv4",(e,t)=>{kp.init(e,t),M.init(e,t)});var uA=w("ZodIPv6",(e,t)=>{Sp.init(e,t),M.init(e,t)});var lA=w("ZodCIDRv4",(e,t)=>{Ap.init(e,t),M.init(e,t)});var pA=w("ZodCIDRv6",(e,t)=>{$p.init(e,t),M.init(e,t)});var fA=w("ZodBase64",(e,t)=>{Ep.init(e,t),M.init(e,t)});var dA=w("ZodBase64URL",(e,t)=>{Tp.init(e,t),M.init(e,t)});var hA=w("ZodE164",(e,t)=>{Op.init(e,t),M.init(e,t)});var mA=w("ZodJWT",(e,t)=>{Ip.init(e,t),M.init(e,t)});var Vd=w("ZodNumber",(e,t)=>{mi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ad(e,r,n,s),e.isFinite=!0},Zu({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=se(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=se(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=se(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>se(e).format??null},{gt(e,t){return this.check(is(e,t))},gte(e,t){return this.check(Or(e,t))},min(e,t){return this.check(Or(e,t))},lt(e,t){return this.check(os(e,t))},lte(e,t){return this.check(Tr(e,t))},max(e,t){return this.check(Tr(e,t))},int(e){return this.check(qd(e))},safe(e){return this.check(qd(e))},positive(e){return this.check(is(0,e))},nonnegative(e){return this.check(Or(0,e))},negative(e){return this.check(os(0,e))},nonpositive(e){return this.check(Tr(0,e))},multipleOf(e,t){return this.check(as(e,t))},step(e,t){return this.check(as(e,t))},finite(){return this}}));function gA(e){return Df(Vd,e)}var yA=w("ZodNumberFormat",(e,t)=>{Np.init(e,t),Vd.init(e,t)});function qd(e){return jf(yA,e)}var wA=w("ZodBoolean",(e,t)=>{Rp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>cd(e,r,n,s)});function fs(e){return Uf(wA,e)}var bA=w("ZodUnknown",(e,t)=>{Cp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ld(e,r,n,s)});function Bi(){return Zf(bA)}var _A=w("ZodNever",(e,t)=>{zp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ud(e,r,n,s)});function vA(e){return Mf(_A,e)}var kA=w("ZodArray",(e,t)=>{Cr(),Lp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>md(e,r,n,s),e.element=t.element},{min(e,t){return this.check(Dt(e,t))},nonempty(e){return this.check(Dt(1,e))},max(e,t){return this.check(cs(e,t))},length(e,t){return this.check(us(e,t))},unwrap(){return this.element}});function Pe(e,t){return qf(kA,e,t)}var xA=w("ZodObject",(e,t)=>{Cr(),Up.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>gd(e,r,n,s),XS(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Zt(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(re(this._zod.def,{catchall:e}))},passthrough(){return this.clone(re(this._zod.def,{catchall:Bi()}))},loose(){return this.clone(re(this._zod.def,{catchall:Bi()}))},strict(){return this.clone(re(this._zod.def,{catchall:vA()}))},strip(){return this.clone(re(this._zod.def,{catchall:void 0}))},extend(e){return FS(this,e)},safeExtend(e){return GS(this,e)},merge(e){return HS(this,e)},pick(e){return BS(this,e)},omit(e){return KS(this,e)},partial(...e){return Lu(Wi,this,e[0])},exactPartial(...e){return Lu(eh,this,e[0],"exactPartial")},required(...e){return WS(th,this,e[0])}});function ie(e,t){let r={type:"object",shape:e??{},...E(t)};return new xA(r)}var Yd=w("ZodUnion",(e,t)=>{gi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>yd(e,r,n,s),e.options=t.options});function Jd(e,t){return new Yd({type:"union",options:e,...E(t)})}var SA=w("ZodDiscriminatedUnion",(e,t)=>{Yd.init(e,t),Zp.init(e,t)});function AA(e,t,r){return new SA({type:"union",options:t,discriminator:e,...E(r)})}var $A=w("ZodIntersection",(e,t)=>{Mp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>wd(e,r,n,s)});function PA(e,t){return new $A({type:"intersection",left:e,right:t})}var EA=w("ZodTuple",(e,t)=>{Cr(),qp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>bd(e,r,n,s)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new Wi({type:"optional",innerType:t}))})}});function Gi(e,t,r){let n=t instanceof L,s=n?r:t;return new EA({type:"tuple",items:e,rest:n?t:null,...E(s)})}var Ki=w("ZodRecord",(e,t)=>{Cr(),Bp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>_d(e,r,n,s),e.keyType=t.keyType,e.valueType=t.valueType});function Hi(e,t,r){if(!t||!t._zod)return new Ki({type:"record",keyType:z(),valueType:e,...E(t)});return new Ki({type:"record",keyType:e,valueType:t,...E(r)})}function TA(e,t,r){return new Ki({type:"record",keyType:e,valueType:t,...E(r),partial:!0})}var Fi=w("ZodEnum",(e,t)=>{Kp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,s,o)=>pd(e,n,s,o),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,s)=>{let o={};for(let i of n)if(r.has(i))o[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new Fi({...t,checks:[],...E(s),entries:o})},e.exclude=(n,s)=>{let o={...t.entries};for(let i of n)if(r.has(i))delete o[i];else throw Error(`Key ${i} not found in enum`);return new Fi({...t,checks:[],...E(s),entries:o})}});function Zt(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Fi({type:"enum",entries:r,...E(t)})}var OA=w("ZodLiteral",(e,t)=>{Fp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>fd(e,r,n,s),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Qd(e,t){return new OA({type:"literal",values:Array.isArray(e)?e:[e],...E(t)})}var IA=w("ZodTransform",(e,t)=>{Cr(),Gp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>hd(e,r,n,s),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new xr(e.constructor.name);r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(gt(o,r.value,t));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=e),r.issues.push(gt(i))}};let s=t.transform(r.value,r);if(s instanceof Promise)return s.then((o)=>(r.value=o,r));return r.value=s,r}});function Xd(e){return new IA({type:"transform",transform:e})}var Wi=w("ZodOptional",(e,t)=>{yi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Mi(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function Bd(e){return new Wi({type:"optional",innerType:e})}var eh=w("ZodExactOptional",(e,t)=>{Hp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Mi(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function NA(e){return new eh({type:"optional",innerType:e})}var RA=w("ZodNullable",(e,t)=>{Wp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>vd(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function Kd(e){return new RA({type:"nullable",innerType:e})}var CA=w("ZodDefault",(e,t)=>{Vp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Sd(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zA(e,t){return new CA({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Yo(t)}})}var LA=w("ZodPrefault",(e,t)=>{Yp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ad(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function DA(e,t){return new LA({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Yo(t)}})}var th=w("ZodNonOptional",(e,t)=>{Jp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>kd(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function jA(e,t){return new th({type:"nonoptional",innerType:e,...E(t)})}var UA=w("ZodCatch",(e,t)=>{Qp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>$d(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ZA(e,t){return new UA({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Mu(t)})}var rh=w("ZodPipe",(e,t)=>{wi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Pd(e,r,n,s),e.in=t.in,e.out=t.out});function Fd(e,t){return new rh({type:"pipe",in:e,out:t})}var MA=w("ZodPreprocess",(e,t)=>{rh.init(e,t),Xp.init(e,t)}),qA=w("ZodReadonly",(e,t)=>{ef.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ed(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function BA(e){return new qA({type:"readonly",innerType:e})}var KA=w("ZodCustom",(e,t)=>{tf.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>dd(e,r,n,s)});function FA(e,t={}){return Bf(KA,e,t)}function GA(e,t){return Kf(e,t)}function HA(e,t){return new MA({type:"pipe",in:Xd(e),out:t})}var VA=["iOS","iPhone","macOS"];function Ze(e,t){let r=[];if(e==="")return["it is empty"];if(/^\s/.test(e)||/\s$/.test(e))r.push("it has leading or trailing spaces");if(/command ?line/i.test(e))r.push('it should say "command-line"');if(/^(?:the|an?)(?=\s)/i.test(e))r.push("it starts with an article");if(/^[a-z]/.test(e)&&!VA.includes(e.split(/\s+/)[0]))r.push("it starts with a lowercase letter");if(new RegExp(`^${t.replaceAll("-","").split("").join("[\\s\\-]?")}\\b`,"i").test(e))r.push("it starts with the package name");let n=/\b(macOS|Mac(?: ?OS(?: ?X)?)?|OS ?X)(?! virtual machines?)\b/i.exec(e);if(n&&n[1]!=="MAC")r.push("it names the platform");if(/\.$/.test(e)&&!e.endsWith("etc."))r.push("it ends with a full stop");if(/\p{So}/u.test(e))r.push("it contains a symbol or emoji");if([...e].length>80)r.push("it is longer than 80 characters");return r}var oh=["darwin-universal","darwin-arm64","darwin-amd64","linux-arm64","linux-amd64","windows-amd64","windows-arm64"];var hs=/^[a-z0-9][a-z0-9-]*$/,YA=["com.apple.security.cs.allow-jit","com.apple.security.cs.allow-unsigned-executable-memory","com.apple.security.cs.disable-executable-page-protection","com.apple.security.cs.allow-dyld-environment-variables","com.apple.security.cs.disable-library-validation"],wt=z().regex(/^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/).refine((e)=>!e.split("/").includes(".."),"must stay inside the archive"),nh=z().regex(/^[A-Za-z0-9.-]+$/),ih={uninstall:ie({launchctl:Pe(nh).optional(),quit:Pe(nh).optional()}).strict().optional(),zap:ie({trash:Pe(z().regex(/^~\/[A-Za-z0-9 ._\/-]+$/))}).strict().optional(),caveats:z().min(1).max(2000).optional()},ah={name:z().regex(hs),repo:z().regex(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/),workflow:z().regex(/^[A-Za-z0-9._-]+\.ya?ml$/).default("release.yml"),assets:TA(Zt(oh),z().regex(/^[A-Za-z0-9._{}-]+$/)),description:z().min(1).max(200).optional(),homepage:Wd().optional(),license:z().regex(/^[A-Za-z0-9.+-]+$/).optional(),attestation:Zt(["auto","off"]).default("auto"),protection:Zt(["on","off","dependabot"]).default("on")},JA=ie({...ah,kind:Zt(["go","bun"]),binaries:Pe(wt).min(1),completions:ie({bash:wt.optional(),zsh:wt.optional(),fish:wt.optional()}).strict().optional(),scoop:fs().default(!1),entitlements:Pe(Zt(YA)).default([]),cask:ie(ih).strict().default({}),linux:fs().default(!1)}).strict(),ds=/^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$/,Me=gA().int().min(0).max(5000),QA=Jd([fs(),z().regex(/^[A-Za-z0-9._*{}-]+$/),Pe(z().regex(/^[A-Za-z0-9._*{}-]+$/))]),XA=ie({...ah,kind:Qd("app"),app:z().regex(/^[A-Za-z0-9 ._-]+\.app$/),bundle_id:z().regex(ds),carry:Hi(z().regex(/^[A-Za-z0-9._-]+$/),z().regex(/^sha256:[0-9a-f]{64}$/)).default({}),dmg:ie({name:z().regex(/^[A-Za-z0-9._{}-]+\.dmg$/),volume:z().regex(/^[A-Za-z0-9 ._-]{1,27}$/).optional(),volume_icon:wt.optional(),layout:ie({window:Gi([Me,Me,Me,Me]),icon_size:Me,app:Gi([Me,Me]),applications:Gi([Me,Me])}).strict().optional()}).strict(),sparkle:ie({key:z().regex(/^[a-z0-9]+$/),feed:z().regex(/^[A-Za-z0-9._-]+\.xml$/).default("appcast.xml"),public_key:z().regex(/^[A-Za-z0-9+/]{43}=$/),next_key:z().regex(/^[a-z0-9]+$/).optional(),next_public_key:z().regex(/^[A-Za-z0-9+/]{43}=$/).optional()}).strict().optional(),code:Hi(wt,ie({identifier:z().regex(ds).optional(),entitlements:Hi(z().regex(/^[A-Za-z0-9.-]+$/),QA).optional()}).strict()).default({}),cask:ie({...ih,binaries:Pe(wt).optional(),auto_updates:fs().optional()}).strict().default({})}).strict(),ch=HA((e)=>e&&typeof e==="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"go"}:e,AA("kind",[JA,XA])),e$=ie({version:Qd(1),tap:z().regex(/^[A-Za-z0-9-]+\/[a-z0-9-]+$/),linux:ie({maintainer:z().regex(/^[A-Za-z0-9 .'-]+ <[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}>$/),url:Wd({protocol:/^https$/}).regex(/^https:\/\/[A-Za-z0-9.-]+(\/[A-Za-z0-9._-]+)*$/).optional()}).strict().optional(),packages:Pe(ch)}).strict(),fe=(e)=>e.kind==="app",uh=(e)=>fe(e)||Object.keys(e.assets).some((t)=>t.startsWith("darwin")),sh=(e)=>e.map((t)=>`${t.path.join(".")||"(root)"}: ${t.message}`).join("; ");function t$(e,t,r){if(fe(e))n$(e);if(e.repo.split("/")[0].toLowerCase()!==r.toLowerCase())throw new y(`${e.name}: ${e.repo} is not owned by ${r}`,"tapster publishes only repositories of the hub's owner.");let n=e.description===void 0?[]:Ze(e.description,e.name);if(n.length)throw new y(`${e.name}: Homebrew rejects the description because ${n.join(" and ")}`,"Rewrite description in tapster.yml.");let s=Object.entries(e.assets);if(s.length===0)throw new y(`${e.name}: assets is empty`,"Map at least one platform to an asset name.");for(let[o,i]of s){if(i.replaceAll("{version}","").includes("{")||i.replaceAll("{version}","").includes("}"))throw new y(`${e.name}: ${i} uses a placeholder other than {version}`,"Only {version} is replaced in asset names.");if(o.startsWith("darwin")&&!i.endsWith(".tar.gz"))throw new y(`${e.name}: the ${o} asset must be a .tar.gz`,"Pack macOS builds as tar.gz; tapster reads them itself.")}if(fe(e)||!e.linux)return;if(!Object.keys(e.assets).some((o)=>o.startsWith("linux-")))throw new y(`${e.name}: linux needs a Linux asset`,"Map linux-amd64 or linux-arm64, or remove linux: true.");if(!t.linux)throw new y(`${e.name} ships Linux packages, but tapster.yml names no linux.maintainer`,'Add linux: { maintainer: "Name <address>" } at the top of tapster.yml.')}function r$(e){let t=new Map,r=(i,a)=>t.has(i)||t.set(i,a);for(let[i,a]of e)if(e.filter(([u,l])=>u!==i&&l.name===a.name).length)r(i,new y(`package ${a.name} is listed twice`,"Keep one entry per package."));let n=e.flatMap(([i,a])=>(fe(a)?a.cask.binaries??[]:a.binaries).map((c)=>({i,p:a,id:c.split("/").pop()})));for(let i of n)for(let a of n){if(i.i===a.i||i.id!==a.id||i.p.name===a.p.name)continue;r(i.i,new y(`${i.p.name} and ${a.p.name} both ship a binary named ${i.id}`,"Signed tools are identified by name, so each name may belong to one package."))}let s=(i,a)=>{let c=i.toLowerCase(),u=a.toLowerCase();return c===u||c.startsWith(`${u}.`)||u.startsWith(`${c}.`)},o=e.filter((i)=>fe(i[1]));for(let[i,a]of o){for(let[c,u]of o)if(i!==c&&s(a.bundle_id,u.bundle_id))r(i,new y(`${a.name} and ${u.name} have overlapping bundle ids`,"Each app needs its own bundle id, not one inside another."));for(let c of n){let u=c.id.toLowerCase();if(u!==a.bundle_id.toLowerCase()&&!u.startsWith(`${a.bundle_id.toLowerCase()}.`))continue;let l=new y(`the binary ${c.id} would carry ${a.name}'s identity`,"Rename the binary.");r(i,l),r(c.i,l)}}return t}function bt(e,t){let r;try{r=X(e)}catch{throw new y("tapster.yml is not valid YAML","Fix the YAML syntax; tapster doctor shows the line.")}let n=e$.extend({packages:Pe(Bi())}).safeParse(r);if(!n.success)throw new y(`tapster.yml is invalid: ${sh(n.error.issues)}`,"Fix the listed fields.");let{packages:s,...o}=n.data,i=new Map,a=(l)=>{let f=l&&typeof l==="object"&&"repo"in l?l.repo:void 0;return typeof f==="string"?f:null},c=(l,f)=>{let p=l&&typeof l==="object"&&"name"in l?l.name:void 0;return typeof p==="string"&&hs.test(p)?p:`packages[${f}]`},u=[];for(let[l,f]of s.entries()){let p=ch.safeParse(f);if(!p.success){i.set(l,{name:c(f,l),repo:a(f),reason:`${c(f,l)} is invalid: ${sh(p.error.issues)}`,fix:"Fix the listed fields in tapster.yml."});continue}let d=p.data;try{t$(d,o,t),u.push([l,d])}catch(h){if(!(h instanceof y))throw h;i.set(l,{name:d.name,repo:d.repo,reason:h.reason,fix:h.fix})}}for(let[l,f]of r$(u)){let p=u.find(([d])=>d===l)[1];i.set(l,{name:p.name,repo:p.repo,reason:f.reason,fix:f.fix})}return{config:{...o,packages:u.filter(([l])=>!i.has(l)).map(([,l])=>l)},invalid:[...i.entries()].sort(([l],[f])=>l-f).map(([,l])=>l)}}function n$(e){if(Object.keys(e.assets).filter((r)=>r.startsWith("darwin")).length!==1||Object.keys(e.assets).length!==1)throw new y(`${e.name}: an app needs exactly one darwin asset and nothing else`,"Map one of darwin-arm64, darwin-amd64 or darwin-universal to the app archive.");if(e.dmg.volume??=e.app.replace(/\.app$/,"").slice(0,27),e.sparkle&&e.sparkle.next_key===void 0!==(e.sparkle.next_public_key===void 0))throw new y(`${e.name}: a rotation needs both sparkle.next_key and next_public_key`,"Set both, or neither.");for(let[r,n]of Object.entries(e.code))if(n.identifier&&!n.identifier.startsWith(`${e.bundle_id}.`))throw new y(`${e.name}: the identifier for ${r} is outside ${e.bundle_id}`,`Use an identifier that starts with ${e.bundle_id}.`)}function lh(e,t){let[r,n]=t.split("/");return e.linux?.url??`https://${r.toLowerCase()}.github.io/${n}`}import{spawn as z$}from"child_process";import{existsSync as L$}from"fs";import*as fh from"os";function zr(e){if(e===null||e===void 0)return"";else if(typeof e==="string"||e instanceof String)return e;return JSON.stringify(e)}function dh(e,t,r){let n=new hh(e,t,r);process.stdout.write(n.toString()+fh.EOL)}var ph="::";class hh{constructor(e,t,r){if(!e)e="missing.command";this.command=e,this.properties=t,this.message=r}toString(){let e=ph+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let t=!0;for(let r in this.properties)if(this.properties.hasOwnProperty(r)){let n=this.properties[r];if(n){if(t)t=!1;else e+=",";e+=`${r}=${o$(n)}`}}}return e+=`${ph}${s$(this.message)}`,e}}function s$(e){return zr(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function o$(e){return zr(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}var nN=he("net"),sN=he("tls"),a$=he("http"),oN=he("https"),c$=he("events"),iN=he("assert"),u$=he("util");function ms(e){var t=this;t.options=e||{},t.proxyOptions=t.options.proxy||{},t.maxSockets=t.options.maxSockets||a$.Agent.defaultMaxSockets,t.requests=[],t.sockets=[],t.on("free",function(n,s,o,i){var a=mh(s,o,i);for(var c=0,u=t.requests.length;c<u;++c){var l=t.requests[c];if(l.host===a.host&&l.port===a.port){t.requests.splice(c,1),l.request.onSocket(n);return}}n.destroy(),t.removeSocket(n)})}u$.inherits(ms,c$.EventEmitter);ms.prototype.addRequest=function(t,r,n,s){var o=this,i=gh({request:t},o.options,mh(r,n,s));if(o.sockets.length>=this.maxSockets){o.requests.push(i);return}o.createSocket(i,function(a){a.on("free",c),a.on("close",u),a.on("agentRemove",u),t.onSocket(a);function c(){o.emit("free",a,i)}function u(l){o.removeSocket(a),a.removeListener("free",c),a.removeListener("close",u),a.removeListener("agentRemove",u)}})};ms.prototype.createSocket=function(t,r){var n=this,s={};n.sockets.push(s);var o=gh({},n.proxyOptions,{method:"CONNECT",path:t.host+":"+t.port,agent:!1,headers:{host:t.host+":"+t.port}});if(t.localAddress)o.localAddress=t.localAddress;if(o.proxyAuth)o.headers=o.headers||{},o.headers["Proxy-Authorization"]="Basic "+new Buffer(o.proxyAuth).toString("base64");_t("making CONNECT request");var i=n.request(o);i.useChunkedEncodingByDefault=!1,i.once("response",a),i.once("upgrade",c),i.once("connect",u),i.once("error",l),i.end();function a(f){f.upgrade=!0}function c(f,p,d){process.nextTick(function(){u(f,p,d)})}function u(f,p,d){if(i.removeAllListeners(),p.removeAllListeners(),f.statusCode!==200){_t("tunneling socket could not be established, statusCode=%d",f.statusCode),p.destroy();var h=Error("tunneling socket could not be established, statusCode="+f.statusCode);h.code="ECONNRESET",t.request.emit("error",h),n.removeSocket(s);return}if(d.length>0){_t("got illegal response body from proxy"),p.destroy();var h=Error("got illegal response body from proxy");h.code="ECONNRESET",t.request.emit("error",h),n.removeSocket(s);return}return _t("tunneling connection has established"),n.sockets[n.sockets.indexOf(s)]=p,r(p)}function l(f){i.removeAllListeners(),_t(`tunneling socket could not be established, cause=%s
196
+ `,f.message,f.stack);var p=Error("tunneling socket could not be established, cause="+f.message);p.code="ECONNRESET",t.request.emit("error",p),n.removeSocket(s)}};ms.prototype.removeSocket=function(t){var r=this.sockets.indexOf(t);if(r===-1)return;this.sockets.splice(r,1);var n=this.requests.shift();if(n)this.createSocket(n,function(s){n.request.onSocket(s)})};function mh(e,t,r){if(typeof e==="string")return{host:e,port:t,localAddress:r};return e}function gh(e){for(var t=1,r=arguments.length;t<r;++t){var n=arguments[t];if(typeof n==="object"){var s=Object.keys(n);for(var o=0,i=s.length;o<i;++o){var a=s[o];if(n[a]!==void 0)e[a]=n[a]}}}return e}var _t;if(process.env.NODE_DEBUG&&/\btunnel\b/.test(process.env.NODE_DEBUG))_t=function(){var e=Array.prototype.slice.call(arguments);if(typeof e[0]==="string")e[0]="TUNNEL: "+e[0];else e.unshift("TUNNEL:");console.error.apply(console,e)};else _t=function(){};var Ee;(function(e){e[e.OK=200]="OK",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.ResourceMoved=302]="ResourceMoved",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.SwitchProxy=306]="SwitchProxy",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.TooManyRequests=429]="TooManyRequests",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout"})(Ee||(Ee={}));var yh;(function(e){e.Accept="accept",e.ContentType="content-type"})(yh||(yh={}));var wh;(function(e){e.ApplicationJson="application/json"})(wh||(wh={}));var fN=[Ee.MovedPermanently,Ee.ResourceMoved,Ee.SeeOther,Ee.TemporaryRedirect,Ee.PermanentRedirect],dN=[Ee.BadGateway,Ee.ServiceUnavailable,Ee.GatewayTimeout];import{EOL as p$}from"os";import{constants as bh,promises as f$}from"fs";var Yi=function(e,t,r,n){function s(o){return o instanceof r?o:new r(function(i){i(o)})}return new(r||(r=Promise))(function(o,i){function a(l){try{u(n.next(l))}catch(f){i(f)}}function c(l){try{u(n.throw(l))}catch(f){i(f)}}function u(l){l.done?o(l.value):s(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},{access:d$,appendFile:h$,writeFile:m$}=f$,_h="GITHUB_STEP_SUMMARY";class vh{constructor(){this._buffer=""}filePath(){return Yi(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let e=process.env[_h];if(!e)throw Error(`Unable to find environment variable for $${_h}. Check if your runtime environment supports job summaries.`);try{yield d$(e,bh.R_OK|bh.W_OK)}catch(t){throw Error(`Unable to access summary file: '${e}'. Check if the file has correct read/write permissions.`)}return this._filePath=e,this._filePath})}wrap(e,t,r={}){let n=Object.entries(r).map(([s,o])=>` ${s}="${o}"`).join("");if(!t)return`<${e}${n}>`;return`<${e}${n}>${t}</${e}>`}write(e){return Yi(this,void 0,void 0,function*(){let t=!!(e===null||e===void 0?void 0:e.overwrite),r=yield this.filePath();return yield(t?m$:h$)(r,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return Yi(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(e,t=!1){return this._buffer+=e,t?this.addEOL():this}addEOL(){return this.addRaw(p$)}addCodeBlock(e,t){let r=Object.assign({},t&&{lang:t}),n=this.wrap("pre",this.wrap("code",e),r);return this.addRaw(n).addEOL()}addList(e,t=!1){let r=t?"ol":"ul",n=e.map((o)=>this.wrap("li",o)).join(""),s=this.wrap(r,n);return this.addRaw(s).addEOL()}addTable(e){let t=e.map((n)=>{let s=n.map((o)=>{if(typeof o==="string")return this.wrap("td",o);let{header:i,data:a,colspan:c,rowspan:u}=o,l=i?"th":"td",f=Object.assign(Object.assign({},c&&{colspan:c}),u&&{rowspan:u});return this.wrap(l,a,f)}).join("");return this.wrap("tr",s)}).join(""),r=this.wrap("table",t);return this.addRaw(r).addEOL()}addDetails(e,t){let r=this.wrap("details",this.wrap("summary",e)+t);return this.addRaw(r).addEOL()}addImage(e,t,r){let{width:n,height:s}=r||{},o=Object.assign(Object.assign({},n&&{width:n}),s&&{height:s}),i=this.wrap("img",null,Object.assign({src:e,alt:t},o));return this.addRaw(i).addEOL()}addHeading(e,t){let r=`h${t}`,n=["h1","h2","h3","h4","h5","h6"].includes(r)?r:"h1",s=this.wrap(n,e);return this.addRaw(s).addEOL()}addSeparator(){let e=this.wrap("hr",null);return this.addRaw(e).addEOL()}addBreak(){let e=this.wrap("br",null);return this.addRaw(e).addEOL()}addQuote(e,t){let r=Object.assign({},t&&{cite:t}),n=this.wrap("blockquote",e,r);return this.addRaw(n).addEOL()}addLink(e,t){let r=this.wrap("a",e,{href:t});return this.addRaw(r).addEOL()}}var AN=new vh;import xh from"os";import*as gs from"fs";var{chmod:g$,copyFile:y$,lstat:w$,mkdir:b$,open:EN,readdir:_$,rename:v$,rm:k$,rmdir:TN,stat:x$,symlink:S$,unlink:A$}=gs.promises,$$=process.platform==="win32";var ON=gs.constants.O_RDONLY;var zN=process.platform==="win32";var ZN=xh.platform(),MN=xh.arch();var Sh;(function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure"})(Sh||(Sh={}));function Vi(e){dh("add-mask",{},e)}var Ah=4,Ji=new Set;function C$(e){if(e.length<Ah)return[];let t=new Set,r=(s)=>{if(s.length>=Ah)t.add(s)};r(e);let n=Buffer.from(e,"utf8");r(n.toString("base64")),r(n.toString("hex")),r(n.toString("hex").toUpperCase()),r(encodeURIComponent(e));for(let s of e.split(/\r?\n/))r(s.trim());return[...t]}function Mt(e){for(let t of C$(e)){if(Ji.has(t))continue;if(Ji.add(t),process.env.GITHUB_ACTIONS==="true")Vi(t)}}function ys(e){let t=e;for(let r of[...Ji].sort((n,s)=>s.length-n.length))t=t.split(r).join("***");return t}var ws={codesign:"/usr/bin/codesign",security:"/usr/bin/security",xcrun:"/usr/bin/xcrun",openssl:"/usr/bin/openssl",ditto:"/usr/bin/ditto",git:"/usr/bin/git",hdiutil:"/usr/bin/hdiutil",xattr:"/usr/bin/xattr",plutil:"/usr/bin/plutil",spctl:"/usr/sbin/spctl",gpg:"/usr/bin/gpg",gpgconf:"/usr/bin/gpgconf",rpm:"/usr/bin/rpm",rpmsign:"/usr/bin/rpmsign",rpm2archive:"/usr/bin/rpm2archive","dpkg-deb":"/usr/bin/dpkg-deb",createrepo_c:"/usr/bin/createrepo_c","apt-ftparchive":"/usr/bin/apt-ftparchive"},D$=["/opt/homebrew/bin/gh","/usr/local/bin/gh","/usr/bin/gh"];function j$(e={}){return{PATH:"/usr/bin:/bin",HOME:process.env.HOME??"/tmp",TMPDIR:process.env.RUNNER_TEMP??process.env.TMPDIR??"/tmp",...e}}function U$(e,t=5){return ys(e).split(/\r?\n/).filter((r)=>r.trim()!==""&&!/keychain/i.test(r)).slice(-t).join(" | ")}function $h(e=D$){let t=e.find((r)=>L$(r));if(!t)throw new y("gh is not installed on this runner","Use a GitHub-hosted runner image, which ships gh.");return t}function Te(e,t,r={}){return C(ws[e],e,t,r)}function C(e,t,r,n={}){return new Promise((s,o)=>{let i=z$(e,r,{env:j$(n.env),cwd:n.cwd,shell:!1,stdio:["pipe","pipe","pipe"]}),a=[],c=[],u=0,l=null,f=(h)=>{l??=h,i.kill("SIGKILL")},p=n.timeoutMs?setTimeout(()=>f(new y(`${t} did not finish in time`,"Re-run the workflow; if it happens again, check the input it read.")),n.timeoutMs):null,d=(h)=>(m)=>{if(u+=m.length,n.maxOutput&&u>n.maxOutput)f(new y(`${t} wrote more output than tapster reads`,"Check the input it read."));else h.push(m)};i.stdout.on("data",d(a)),i.stderr.on("data",d(c)),i.on("error",()=>o(new y(`${t} could not start`,`Check that ${e} exists on this runner.`))),i.on("close",(h)=>{if(p)clearTimeout(p);if(l){o(l);return}let m=Buffer.concat(a),g={code:h??-1,stdout:m.toString("utf8"),stderr:Buffer.concat(c).toString("utf8"),bytes:m};if(g.code!==0&&!n.allowFail){o(new y(`${t} exited with ${g.code}`,U$(g.stderr)||"No error output."));return}s(g)}),i.stdin.end(n.stdin??"")})}var Z$=1048576,Ph=32,M$=1e5,O=(e)=>new y(`an Info.plist ${e}`,"Rebuild the app; tapster reads XML and binary property lists.");function Eh(e){if(e.length>Z$)throw O("is larger than 1 MiB");if(e.subarray(0,8).toString("latin1")==="bplist00")return G$(e);if(e[0]===254||e[0]===255||e[0]===0)throw O("is not UTF-8");let t=e.toString("utf8").replace(/^\ufeff/,""),r=/^\s*<\?xml[^>]*\bencoding\s*=\s*["']([^"']*)["']/.exec(t)?.[1];if(r!==void 0&&!/^utf-?8$/i.test(r))throw O(`declares the encoding ${r}, not UTF-8`);return F$(t)}var q$={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};function B$(e){return e.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-z]+);/g,(t,r)=>{if(r.startsWith("#x"))return String.fromCodePoint(Number.parseInt(r.slice(2),16));if(r.startsWith("#"))return String.fromCodePoint(Number.parseInt(r.slice(1),10));let n=q$[r];if(n===void 0)throw O(`uses an unknown entity ${t}`);return n})}function K$(e){let t=[],r=0;while(r<e.length)if(e.startsWith("<!--",r)){let n=e.indexOf("-->",r+4);if(n===-1)throw O("has an unclosed comment");r=n+3}else if(e.startsWith("<![CDATA[",r)){let n=e.indexOf("]]>",r+9);if(n===-1)throw O("has an unclosed CDATA section");t.push({kind:"text",text:e.slice(r+9,n)}),r=n+3}else if(e.startsWith("<?",r)||e.startsWith("<!",r)){let n=e.indexOf(">",r);if(n===-1)throw O("is not valid XML");r=n+1}else if(e[r]==="<"){let n=e.indexOf(">",r);if(n===-1)throw O("is not valid XML");let s=e.slice(r+1,n).trim(),o=/^(\/)?([A-Za-z]+)(?:\s[^/]*)?(\/)?$/.exec(s);if(!o)throw O("has a tag tapster does not read");t.push({kind:o[1]?"close":o[3]?"empty":"open",name:o[2]}),r=n+1}else{let n=e.indexOf("<",r),s=e.slice(r,n===-1?e.length:n);t.push({kind:"text",text:B$(s)}),r=n===-1?e.length:n}return t}function F$(e){let t=K$(e).filter((l)=>!(l.kind==="text"&&l.text.trim()==="")),r=0,n=()=>t[r++],s=()=>t[r],o=(l)=>{let f="";for(;;){let p=n();if(!p)throw O(`has an unclosed <${l}>`);if(p.kind==="text")f+=p.text;else if(p.kind==="close"&&p.name===l)return f;else throw O(`has markup inside <${l}>`)}},i=(l)=>{if(l>Ph)throw O("is nested too deeply");let f=n();if(!f||f.kind==="text"||f.kind==="close")throw O("is missing a value");if(f.kind==="empty"){if(f.name==="true")return!0;if(f.name==="false")return!1;if(f.name==="string")return"";if(f.name==="dict")return{};if(f.name==="array")return[];if(f.name==="data")return Buffer.alloc(0);throw O(`has an unknown <${f.name}/>`)}switch(f.name){case"string":return o("string");case"integer":{let p=o("integer").trim();if(!/^[+-]?\d{1,15}$/.test(p))throw O("has an integer tapster does not read");return Number(p)}case"real":{let p=Number(o("real").trim());if(!Number.isFinite(p))throw O("has an invalid real");return p}case"date":{let p=new Date(o("date").trim());if(Number.isNaN(p.getTime()))throw O("has an invalid date");return p}case"data":return Buffer.from(o("data").replace(/\s+/g,""),"base64");case"array":{let p=[];for(;;){let d=s();if(d?.kind==="close"&&d.name==="array")return r++,p;p.push(i(l+1))}}case"dict":{let p={};for(;;){let d=n();if(d?.kind==="close"&&d.name==="dict")return p;if(d?.kind!=="open"||d.name!=="key")throw O("has a dict entry without a key");let h=o("key");if(Object.hasOwn(p,h))throw O(`lists the key ${h} twice`);Object.defineProperty(p,h,{value:i(l+1),enumerable:!0,writable:!0,configurable:!0})}}default:throw O(`has an unknown <${f.name}>`)}},a=n();if(!a||a.kind!=="open"||a.name!=="plist")throw O("does not start with <plist>");let c=i(1),u=n();if(!u||u.kind!=="close"||u.name!=="plist"||r!==t.length)throw O("has content after its value");return c}function G$(e){if(e.length<40)throw O("is truncated");let t=e.subarray(e.length-32),r=t[6],n=t[7],s=Number(t.readBigUInt64BE(8)),o=Number(t.readBigUInt64BE(16)),i=Number(t.readBigUInt64BE(24));if(![1,2,4,8].includes(r)||![1,2,4,8].includes(n))throw O("has a damaged trailer");if(s<1||o>=s||i<8||i+s*r>e.length-32)throw O("has a damaged offset table");let a=(p,d)=>{if(p+d>e.length-32)throw O("is truncated");let h=d===8?e.readBigUInt64BE(p):BigInt(e.readUIntBE(p,d));if(h>BigInt(Number.MAX_SAFE_INTEGER))throw O("has a number tapster does not read");return Number(h)},c=(p)=>{if(p>=s)throw O("has a reference outside its objects");let d=a(i+p*r,r);if(d<8||d>=i)throw O("has an object outside its body");return d},u=new Set,l=0,f=(p,d)=>{if(d>Ph)throw O("is nested too deeply");if(++l>M$)throw O("has too many objects");if(u.has(p))throw O("refers to itself");u.add(p);try{let h=c(p),m=e[h],g=m>>4,_=m&15,S=()=>{if(_!==15)return[_,h+1];let x=e[h+1];if(x>>4!==1)throw O("has a damaged length");let b=1<<(x&15);return[a(h+2,b),h+2+b]};switch(g){case 0:if(m===8)return!1;if(m===9)return!0;throw O("has an object tapster does not read");case 1:{let x=1<<_;if(x===8){if(h+9>e.length-32)throw O("is truncated");let b=e.readBigInt64BE(h+1);if(b>BigInt(Number.MAX_SAFE_INTEGER)||b<BigInt(Number.MIN_SAFE_INTEGER))throw O("has a number tapster does not read");return Number(b)}if(x>8)throw O("has a number tapster does not read");return a(h+1,x)}case 2:{if(_===2)return e.readFloatBE(h+1);if(_===3)return e.readDoubleBE(h+1);throw O("has a real tapster does not read")}case 3:if(m!==51)throw O("has a damaged date");return new Date((978307200+e.readDoubleBE(h+1))*1000);case 4:{let[x,b]=S();if(b+x>i)throw O("is truncated");return Buffer.from(e.subarray(b,b+x))}case 5:{let[x,b]=S();if(b+x>i)throw O("is truncated");return e.subarray(b,b+x).toString("latin1")}case 6:{let[x,b]=S();if(b+x*2>i)throw O("is truncated");let v=Buffer.from(e.subarray(b,b+x*2));return v.swap16(),v.toString("utf16le")}case 10:{let[x,b]=S();if(b+x*n>i)throw O("is truncated");return Array.from({length:x},(v,k)=>f(a(b+k*n,n),d+1))}case 13:{let[x,b]=S();if(b+2*x*n>i)throw O("is truncated");let v={};for(let k=0;k<x;k++){let T=f(a(b+k*n,n),d+1);if(typeof T!=="string")throw O("has a dict key that is not a string");if(Object.hasOwn(v,T))throw O(`lists the key ${T} twice`);Object.defineProperty(v,T,{value:f(a(b+(x+k)*n,n),d+1),enumerable:!0,writable:!0,configurable:!0})}return v}default:throw O("has an object tapster does not read")}}finally{u.delete(p)}};return f(o,1)}var bs=[{actor_id:5,actor_type:"RepositoryRole",bypass_mode:"always"}],H$={actor_id:null,actor_type:"DeployKey",bypass_mode:"always"},Ih={name:"tapster tags",target:"tag",enforcement:"active",bypass_actors:bs,conditions:{ref_name:{include:["~ALL"],exclude:[]}},rules:[{type:"creation"},{type:"update"},{type:"deletion"}]},Nh={name:"tapster branches",target:"branch",enforcement:"active",bypass_actors:bs,conditions:{ref_name:{include:["~ALL"],exclude:[]}},rules:[{type:"creation"},{type:"update"},{type:"deletion"},{type:"non_fast_forward"}]},Rh="refs/heads/dependabot/**";function W$(e,t=!1){let r=e?[...bs,H$]:bs,n={ref_name:{include:["~ALL"],exclude:t?[Rh]:[]}};return[{...Ih,bypass_actors:r},{...Nh,bypass_actors:r,conditions:n}]}function Th(e,t){if(t==="app")return e.current_user_can_bypass!=="never";return(e.bypass_actors??[]).some((r)=>!(r.actor_type==="DeployKey"||r.actor_type==="RepositoryRole"&&r.actor_id===5))}async function Oh(e,t,r,n,s,o){let i;try{i=await e.json("GET",`/repos/${t}/rulesets?targets=${r}`)}catch(d){if(d instanceof D&&(d.status===403||d.status===404))return{problems:["GitHub offers no rulesets on this repository; private repositories need a paid plan for them"],ok:!1};throw d}let a=await Promise.all(i.filter((d)=>d.target===r&&d.enforcement==="active").map((d)=>e.json("GET",`/repos/${t}/rulesets/${d.id}`)));if(a.length===0)return{problems:[`no active ${r} ruleset protects every ${r}`],ok:!1};let c=r==="branch"&&o?[Rh]:[],u=a.filter((d)=>(d.conditions?.ref_name?.include??[]).includes("~ALL")&&(d.conditions?.ref_name?.exclude??[]).every((h)=>c.includes(h)));if(u.length===0)return{problems:[`no active ${r} ruleset covers every ${r} (~ALL) without exclusions`],ok:!1};let l=u.filter((d)=>Th(d,s)).map((d)=>`the App or another actor can bypass ${d.name}`),f=new Set(u.filter((d)=>!Th(d,s)).flatMap((d)=>(d.rules??[]).map((h)=>h.type))),p=n.filter((d)=>!f.has(d));if(p.length)l.push(`the ${r} rulesets do not restrict ${p.join(", ")}`);return{problems:l,ok:l.length===0}}async function Ch(e,t,r,n,s=!1){let o=await Oh(e,t,"tag",Ih.rules.map((a)=>a.type),n,!1),i=await Oh(e,t,"branch",Nh.rules.map((a)=>a.type),n,s);if(i.ok){let a=new Set((await e.json("GET",`/repos/${t}/rules/branches/${encodeURIComponent(r)}`)).map((c)=>c.type));if(!["update","deletion","non_fast_forward"].every((c)=>a.has(c)))i.problems.push("GitHub does not enforce rulesets on this repository; private repositories need a paid plan for them")}return{tag:o.problems,branch:i.problems}}async function Qi(e,t,r,n,s=!1){let o=await Ch(e,t,r,n,s);return[...o.tag,...o.branch]}async function zh(e,t,r,n=!1,s=!1){let o=await Ch(e,t,r,"admin",s);if(o.tag.concat(o.branch).some((l)=>l.includes("offers no rulesets")))return"unavailable";let i=await e.json("GET",`/repos/${t}/rulesets`),a=n||s;if(o.tag.length+o.branch.length===0&&!a)return"exists";let[c,u]=W$(n,s);try{for(let[l,f]of[[c,o.tag],[u,o.branch]]){if(f.length===0&&!a)continue;let p=i.find((d)=>d.name===l.name);if(p)await e.json("PUT",`/repos/${t}/rulesets/${p.id}`,l);else await e.json("POST",`/repos/${t}/rulesets`,l)}}catch(l){if(l instanceof D&&(l.status===403||l.status===422))return"unavailable";throw l}return(await Qi(e,t,r,"admin",s)).length===0?"created":"unavailable"}import{createPrivateKey as dP}from"crypto";import{spawn as hP}from"child_process";import{existsSync as Bh,readFileSync as mP}from"fs";import{readFile as gP,writeFile as jr}from"fs/promises";import{delimiter as sa,join as Ne}from"path";var V$={401:"Your GitHub sign-in was rejected; run gh auth login again.",403:"Your account may not do this here; check that you own the repository, then run gh auth refresh to renew the sign-in.",404:"Not found, or your gh sign-in cannot see it; check the name and run gh auth status.",409:"GitHub reported a conflict; run the command again.",422:"GitHub rejected the request."},Y$={401:"The credential was rejected; rotate it with tapster init --rotate.",403:"Access denied: check the App's permissions and that it is installed on this repository.",404:"Not found. The App may not be installed on this repository.",409:"GitHub reported a conflict; the next run retries.",422:"GitHub rejected the request."};function Xi(e){try{return new URL(e).pathname}catch{return"(url)"}}class Oe{token;fetchImpl;sleep;who;constructor(e,t=fetch,r=(s)=>new Promise((o)=>setTimeout(o,s)),n="app"){this.token=e;this.fetchImpl=t;this.sleep=r;this.who=n}async request(e,t,r={}){let n=t.startsWith("https://")?t:`https://api.github.com${t}`,s={Accept:r.accept??"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","User-Agent":"tapster"};if(r.auth!==!1)s.Authorization=`Bearer ${this.token}`;if(r.contentType)s["Content-Type"]=r.contentType;else if(r.body!==void 0)s["Content-Type"]="application/json";let o=r.raw??(r.body!==void 0?JSON.stringify(r.body):void 0);for(let i=0;;i++){let a;try{a=await this.fetchImpl(n,{method:e,headers:s,body:o,redirect:"manual"})}catch{if(i<4){await this.sleep(1000*2**i);continue}throw new D(`GitHub ${e} ${Xi(n)}: network error`,"GitHub did not answer; the next run retries.",0)}if((a.status>=500||a.status===429)&&i<4){await this.sleep(1000*2**i);continue}if(a.status>=400){await a.body?.cancel();let c=this.who==="user"?V$:Y$;throw new D(`GitHub ${e} ${Xi(n)} returned ${a.status}`,c[a.status]??(this.who==="user"?"Try again in a moment.":"The next run retries."),a.status)}return a}}async json(e,t,r){let n=await this.request(e,t,r===void 0?{}:{body:r});for(let s=0;n.status>=300&&n.status<400;s++){let o=n.headers.get("location"),i=null;try{i=o?new URL(o):null}catch{i=null}if(s>=3||!i||i.protocol!=="https:"||i.host!=="api.github.com")throw new D(`GitHub ${e} ${Xi(t)} moved somewhere tapster does not follow`,"Update the repository name in tapster.yml.",n.status);n=await this.request(e,i.toString(),r===void 0?{}:{body:r})}if(n.status===204)return;return await n.json()}async listReleases(e){let t=[];for(let r=1;r<=10;r++){let n=await this.json("GET",`/repos/${e}/releases?per_page=100&page=${r}`);if(t.push(...n),n.length<100)break}return t}getRelease=(e,t)=>this.json("GET",`/repos/${e}/releases/${t}`);getRepo=(e)=>this.json("GET",`/repos/${e}`);async downloadAsset(e,t){let r=await this.request("GET",`/repos/${e}/releases/assets/${t}`,{accept:"application/octet-stream"});if(r.status>=300&&r.status<400){let n=r.headers.get("location");if(!n)throw new D(`GitHub sent a redirect without a location for asset ${t}`,"The next run retries.",r.status);let s=await this.request("GET",n,{auth:!1,accept:"application/octet-stream"});return Buffer.from(await s.arrayBuffer())}return Buffer.from(await r.arrayBuffer())}async uploadAsset(e,t,r){let n=e.upload_url.replace(/\{.*\}$/,"");return await(await this.request("POST",`${n}?name=${encodeURIComponent(t)}`,{raw:r,contentType:"application/octet-stream"})).json()}deleteAsset=(e,t)=>this.request("DELETE",`/repos/${e}/releases/assets/${t}`).then(()=>{return});renameAsset=(e,t,r)=>this.json("PATCH",`/repos/${e}/releases/assets/${t}`,{name:r});updateRelease=(e,t,r,n)=>this.json("PATCH",`/repos/${e}/releases/${t}`,{...n,tag_name:r})}import{createSign as J$}from"crypto";var Lh=(e)=>Buffer.from(e).toString("base64url");function qt(e,t,r=Date.now()){let n=Math.floor(r/1000)-60,s=Lh(JSON.stringify({alg:"RS256",typ:"JWT"})),o=Lh(JSON.stringify({iat:n,exp:n+540,iss:e})),i=J$("RSA-SHA256").update(`${s}.${o}`).sign(t).toString("base64url"),a=`${s}.${o}.${i}`;return Mt(a),a}var Dh=`- name: Ring the tapster hub
197
+ if: \${{ vars.TAPSTER_DOORBELL != '' }}
198
+ continue-on-error: true
199
+ env: { DOORBELL: "\${{ vars.TAPSTER_DOORBELL }}" }
200
+ run: |
201
+ set -euo pipefail
202
+ token=$(curl -fsS -G --data-urlencode "audience=$DOORBELL" -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r .value)
203
+ echo "::add-mask::$token"
204
+ curl -fsS -X POST -H "Authorization: Bearer $token" "$DOORBELL"
205
+ `;var jh=`{
206
+ "lockfileVersion": 2,
207
+ "configVersion": 1,
208
+ "workspaces": {
209
+ "": {
210
+ "devDependencies": {
211
+ "wrangler": "4.151.1",
212
+ },
213
+ },
214
+ },
215
+ "packages": {
216
+ "@cloudflare/kv-asset-handler": ["@cloudflare/kv-asset-handler@0.5.0", "", {}, "sha512-jxQYkj8dSIzc0cD6cMMNdOc1UVjqSqu8BZdor5s8cGjW2I8BjODt/kWPVdY+u9zj3ms75Q5qaZgnxUad83+eAg=="],
217
+
218
+ "@cloudflare/unenv-preset": ["@cloudflare/unenv-preset@2.16.2", "", { "peerDependencies": { "unenv": "2.0.0-rc.24", "workerd": ">1.20260305.0 <2.0.0-0" }, "optionalPeers": ["workerd"] }, "sha512-JBP1+Z7ZSNG/d4mRP+y8VC5dka3tZVMLEZRvS+rzQ4DGV1EoxRFQckcJTTkXbHSQiTj0DtNI01Zwb/V2fX0mvQ=="],
219
+
220
+ "@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20261012.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-dkTL9aY3V4D40b+jBpGPCistWUPFQ/M61wlWi6i1o8MvHFFgEw7EQkcaYEv6Yd3bkPDD/3TFT4hRsMb2xVZSwQ=="],
221
+
222
+ "@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20261012.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-2/nVGcKXjNNI+DhxKSepTKvFng9H7aN2WXv6Zu67iqgI6JrxypNt5kTPv4ZHosxrcfyKMci/2RfN7GIrN0BitQ=="],
223
+
224
+ "@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20261012.1", "", { "os": "linux", "cpu": "x64" }, "sha512-uMe7ONHnLxStD1Ye0YFHBO36uj4cStv5P53rW+5GVWXFT8BRjqVixlH0IqCAHe1Pmcwyd1+7fVoGde89MZSCJg=="],
225
+
226
+ "@cloudflare/workerd-linux-arm64": ["@cloudflare/workerd-linux-arm64@1.20261012.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-I0VMdcXk7ygG5vYDce0ePTBFdnBXC0i9WiBY5mWiv0iTinbfea6/rHqSQ7B1UMpjgrYVs9E0m4bZ9ufsk5GCFA=="],
227
+
228
+ "@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20261012.1", "", { "os": "win32", "cpu": "x64" }, "sha512-c5hQvNx574UEoknaCFvMa/NdLrrYiALNbe6sx1okW8uOiRYWxrFuA8WpXFnBJ5XJypm0TEAHYaUTGv3rRLpY7Q=="],
229
+
230
+ "@cspotcode/source-map-support": ["@cspotcode/source-map-support@0.8.1", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.9" } }, "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw=="],
231
+
232
+ "@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="],
233
+
234
+ "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.28.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ=="],
235
+
236
+ "@esbuild/android-arm": ["@esbuild/android-arm@0.28.2", "", { "os": "android", "cpu": "arm" }, "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg=="],
237
+
238
+ "@esbuild/android-arm64": ["@esbuild/android-arm64@0.28.2", "", { "os": "android", "cpu": "arm64" }, "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A=="],
239
+
240
+ "@esbuild/android-x64": ["@esbuild/android-x64@0.28.2", "", { "os": "android", "cpu": "x64" }, "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q=="],
241
+
242
+ "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.28.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw=="],
243
+
244
+ "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.28.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw=="],
245
+
246
+ "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.28.2", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw=="],
247
+
248
+ "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.28.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg=="],
249
+
250
+ "@esbuild/linux-arm": ["@esbuild/linux-arm@0.28.2", "", { "os": "linux", "cpu": "arm" }, "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w=="],
251
+
252
+ "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.28.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug=="],
253
+
254
+ "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.28.2", "", { "os": "linux", "cpu": "ia32" }, "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ=="],
255
+
256
+ "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.28.2", "", { "os": "linux", "cpu": "none" }, "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ=="],
257
+
258
+ "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.28.2", "", { "os": "linux", "cpu": "none" }, "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA=="],
259
+
260
+ "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.28.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ=="],
261
+
262
+ "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.28.2", "", { "os": "linux", "cpu": "none" }, "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA=="],
263
+
264
+ "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.28.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg=="],
265
+
266
+ "@esbuild/linux-x64": ["@esbuild/linux-x64@0.28.2", "", { "os": "linux", "cpu": "x64" }, "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ=="],
267
+
268
+ "@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.28.2", "", { "os": "none", "cpu": "arm64" }, "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw=="],
269
+
270
+ "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.28.2", "", { "os": "none", "cpu": "x64" }, "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw=="],
271
+
272
+ "@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.28.2", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ=="],
273
+
274
+ "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.28.2", "", { "os": "openbsd", "cpu": "x64" }, "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw=="],
275
+
276
+ "@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.28.2", "", { "os": "none", "cpu": "arm64" }, "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q=="],
277
+
278
+ "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.28.2", "", { "os": "sunos", "cpu": "x64" }, "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g=="],
279
+
280
+ "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.28.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ=="],
281
+
282
+ "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.28.2", "", { "os": "win32", "cpu": "ia32" }, "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA=="],
283
+
284
+ "@esbuild/win32-x64": ["@esbuild/win32-x64@0.28.2", "", { "os": "win32", "cpu": "x64" }, "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g=="],
285
+
286
+ "@img/colour": ["@img/colour@1.1.0", "", {}, "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ=="],
287
+
288
+ "@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.3.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg=="],
289
+
290
+ "@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.3.4" }, "os": "darwin", "cpu": "x64" }, "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw=="],
291
+
292
+ "@img/sharp-freebsd-wasm32": ["@img/sharp-freebsd-wasm32@0.35.5", "", { "dependencies": { "@img/sharp-wasm32": "0.35.5" }, "os": "freebsd" }, "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw=="],
293
+
294
+ "@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.3.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw=="],
295
+
296
+ "@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.3.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ=="],
297
+
298
+ "@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.3.4", "", { "os": "linux", "cpu": "arm" }, "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw=="],
299
+
300
+ "@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.3.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A=="],
301
+
302
+ "@img/sharp-libvips-linux-ppc64": ["@img/sharp-libvips-linux-ppc64@1.3.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ=="],
303
+
304
+ "@img/sharp-libvips-linux-riscv64": ["@img/sharp-libvips-linux-riscv64@1.3.4", "", { "os": "linux", "cpu": "none" }, "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q=="],
305
+
306
+ "@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.3.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ=="],
307
+
308
+ "@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.3.4", "", { "os": "linux", "cpu": "x64" }, "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw=="],
309
+
310
+ "@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.3.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA=="],
311
+
312
+ "@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.3.4", "", { "os": "linux", "cpu": "x64" }, "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg=="],
313
+
314
+ "@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.3.4" }, "os": "linux", "cpu": "arm" }, "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ=="],
315
+
316
+ "@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.3.4" }, "os": "linux", "cpu": "arm64" }, "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ=="],
317
+
318
+ "@img/sharp-linux-ppc64": ["@img/sharp-linux-ppc64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.3.4" }, "os": "linux", "cpu": "ppc64" }, "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA=="],
319
+
320
+ "@img/sharp-linux-riscv64": ["@img/sharp-linux-riscv64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.3.4" }, "os": "linux", "cpu": "none" }, "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ=="],
321
+
322
+ "@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.3.4" }, "os": "linux", "cpu": "s390x" }, "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA=="],
323
+
324
+ "@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.3.4" }, "os": "linux", "cpu": "x64" }, "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog=="],
325
+
326
+ "@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.3.4" }, "os": "linux", "cpu": "arm64" }, "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg=="],
327
+
328
+ "@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.3.4" }, "os": "linux", "cpu": "x64" }, "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A=="],
329
+
330
+ "@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.5", "", { "dependencies": { "@emnapi/runtime": "^1.11.3" } }, "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ=="],
331
+
332
+ "@img/sharp-webcontainers-wasm32": ["@img/sharp-webcontainers-wasm32@0.35.5", "", { "dependencies": { "@img/sharp-wasm32": "0.35.5" }, "cpu": "none" }, "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA=="],
333
+
334
+ "@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.35.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q=="],
335
+
336
+ "@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.35.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A=="],
337
+
338
+ "@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.35.5", "", { "os": "win32", "cpu": "x64" }, "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg=="],
339
+
340
+ "@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],
341
+
342
+ "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.6.0", "", {}, "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw=="],
343
+
344
+ "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.9", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ=="],
345
+
346
+ "@poppinss/colors": ["@poppinss/colors@4.1.6", "", { "dependencies": { "kleur": "^4.1.5" } }, "sha512-H9xkIdFswbS8n1d6vmRd8+c10t2Qe+rZITbbDHHkQixH5+2x1FDGmi/0K+WgWiqQFKPSlIYB7jlH6Kpfn6Fleg=="],
347
+
348
+ "@poppinss/dumper": ["@poppinss/dumper@0.6.5", "", { "dependencies": { "@poppinss/colors": "^4.1.5", "@sindresorhus/is": "^7.0.2", "supports-color": "^10.0.0" } }, "sha512-NBdYIb90J7LfOI32dOewKI1r7wnkiH6m920puQ3qHUeZkxNkQiFnXVWoE6YtFSv6QOiPPf7ys6i+HWWecDz7sw=="],
349
+
350
+ "@poppinss/exception": ["@poppinss/exception@1.2.3", "", {}, "sha512-dCED+QRChTVatE9ibtoaxc+WkdzOSjYTKi/+uacHWIsfodVfpsueo3+DKpgU5Px8qXjgmXkSvhXvSCz3fnP9lw=="],
351
+
352
+ "@sindresorhus/is": ["@sindresorhus/is@7.2.0", "", {}, "sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw=="],
353
+
354
+ "@speed-highlight/core": ["@speed-highlight/core@1.2.24", "", {}, "sha512-qeW2e1l78afw8VhRPfPQ1Gjj+KU5XFQ/OFV5ti6eTa9bruO7mJyZtA4vw0ofqmA3tKCkROE9xLk3VZoeRc98nw=="],
355
+
356
+ "blake3-wasm": ["blake3-wasm@2.1.5", "", {}, "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g=="],
357
+
358
+ "cookie": ["cookie@1.1.1", "", {}, "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ=="],
359
+
360
+ "detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
361
+
362
+ "error-stack-parser-es": ["error-stack-parser-es@1.0.5", "", {}, "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA=="],
363
+
364
+ "esbuild": ["esbuild@0.28.2", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.28.2", "@esbuild/android-arm": "0.28.2", "@esbuild/android-arm64": "0.28.2", "@esbuild/android-x64": "0.28.2", "@esbuild/darwin-arm64": "0.28.2", "@esbuild/darwin-x64": "0.28.2", "@esbuild/freebsd-arm64": "0.28.2", "@esbuild/freebsd-x64": "0.28.2", "@esbuild/linux-arm": "0.28.2", "@esbuild/linux-arm64": "0.28.2", "@esbuild/linux-ia32": "0.28.2", "@esbuild/linux-loong64": "0.28.2", "@esbuild/linux-mips64el": "0.28.2", "@esbuild/linux-ppc64": "0.28.2", "@esbuild/linux-riscv64": "0.28.2", "@esbuild/linux-s390x": "0.28.2", "@esbuild/linux-x64": "0.28.2", "@esbuild/netbsd-arm64": "0.28.2", "@esbuild/netbsd-x64": "0.28.2", "@esbuild/openbsd-arm64": "0.28.2", "@esbuild/openbsd-x64": "0.28.2", "@esbuild/openharmony-arm64": "0.28.2", "@esbuild/sunos-x64": "0.28.2", "@esbuild/win32-arm64": "0.28.2", "@esbuild/win32-ia32": "0.28.2", "@esbuild/win32-x64": "0.28.2" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA=="],
365
+
366
+ "fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
367
+
368
+ "kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="],
369
+
370
+ "miniflare": ["miniflare@5.20261012.1-beta", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "sharp": "0.35.5", "undici": "7.29.1", "workerd": "1.20261012.1", "ws": "8.21.0", "youch": "4.1.0-beta.10" } }, "sha512-8Canhy6g9+vAhqMc0o80YphqYIwpiA3aAp8aX+uDXU7J/qbUeoZzcII9c2V1P4uT/eHD4SB93qet1o1bRY3BuQ=="],
371
+
372
+ "path-to-regexp": ["path-to-regexp@6.3.0", "", {}, "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ=="],
373
+
374
+ "pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="],
375
+
376
+ "semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],
377
+
378
+ "sharp": ["sharp@0.35.5", "", { "dependencies": { "@img/colour": "^1.1.0", "detect-libc": "^2.1.2", "semver": "^7.8.5" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.35.5", "@img/sharp-darwin-x64": "0.35.5", "@img/sharp-freebsd-wasm32": "0.35.5", "@img/sharp-libvips-darwin-arm64": "1.3.4", "@img/sharp-libvips-darwin-x64": "1.3.4", "@img/sharp-libvips-linux-arm": "1.3.4", "@img/sharp-libvips-linux-arm64": "1.3.4", "@img/sharp-libvips-linux-ppc64": "1.3.4", "@img/sharp-libvips-linux-riscv64": "1.3.4", "@img/sharp-libvips-linux-s390x": "1.3.4", "@img/sharp-libvips-linux-x64": "1.3.4", "@img/sharp-libvips-linuxmusl-arm64": "1.3.4", "@img/sharp-libvips-linuxmusl-x64": "1.3.4", "@img/sharp-linux-arm": "0.35.5", "@img/sharp-linux-arm64": "0.35.5", "@img/sharp-linux-ppc64": "0.35.5", "@img/sharp-linux-riscv64": "0.35.5", "@img/sharp-linux-s390x": "0.35.5", "@img/sharp-linux-x64": "0.35.5", "@img/sharp-linuxmusl-arm64": "0.35.5", "@img/sharp-linuxmusl-x64": "0.35.5", "@img/sharp-webcontainers-wasm32": "0.35.5", "@img/sharp-win32-arm64": "0.35.5", "@img/sharp-win32-ia32": "0.35.5", "@img/sharp-win32-x64": "0.35.5" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g=="],
379
+
380
+ "supports-color": ["supports-color@10.2.2", "", {}, "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g=="],
381
+
382
+ "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
383
+
384
+ "undici": ["undici@7.29.1", "", {}, "sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q=="],
385
+
386
+ "unenv": ["unenv@2.0.0-rc.24", "", { "dependencies": { "pathe": "^2.0.3" } }, "sha512-i7qRCmY42zmCwnYlh9H2SvLEypEFGye5iRmEMKjcGi7zk9UquigRjFtTLz0TYqr0ZGLZhaMHl/foy1bZR+Cwlw=="],
387
+
388
+ "workerd": ["workerd@1.20261012.1", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20261012.1", "@cloudflare/workerd-darwin-arm64": "1.20261012.1", "@cloudflare/workerd-linux-64": "1.20261012.1", "@cloudflare/workerd-linux-arm64": "1.20261012.1", "@cloudflare/workerd-windows-64": "1.20261012.1" }, "bin": { "workerd": "bin/workerd" } }, "sha512-tEHoMPsMga0seVjxfsR8Pd3f8IRqYwkq++dTUKI5Gdgj6zuSDluYwisydq+dn90SsIACwBquJUQ1nBpcOqaWTA=="],
389
+
390
+ "wrangler": ["wrangler@4.151.1", "", { "dependencies": { "@cloudflare/kv-asset-handler": "0.5.0", "@cloudflare/unenv-preset": "2.16.2", "blake3-wasm": "2.1.5", "esbuild": "0.28.2", "miniflare": "5.20261012.1-beta", "path-to-regexp": "6.3.0", "unenv": "2.0.0-rc.24", "workerd": "1.20261012.1" }, "optionalDependencies": { "fsevents": "2.3.3" }, "peerDependencies": { "@cloudflare/workers-types": "^5.20261006.1" }, "optionalPeers": ["@cloudflare/workers-types"], "bin": { "wrangler": "bin/wrangler.js", "wrangler2": "bin/wrangler.js", "cf-wrangler": "bin/cf-wrangler.js" } }, "sha512-OAsa9UAHZshM6mq2PXcVoyxXgWThAanZMBc/IirtqEWd/BauRtmUKzAniOu/pU0pd3pxKuMZ2vsbF4eo6RiNDA=="],
391
+
392
+ "ws": ["ws@8.21.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g=="],
393
+
394
+ "youch": ["youch@4.1.0-beta.10", "", { "dependencies": { "@poppinss/colors": "^4.1.5", "@poppinss/dumper": "^0.6.4", "@speed-highlight/core": "^1.2.7", "cookie": "^1.0.2", "youch-core": "^0.3.3" } }, "sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ=="],
395
+
396
+ "youch-core": ["youch-core@0.3.3", "", { "dependencies": { "@poppinss/exception": "^1.2.2", "error-stack-parser-es": "^1.0.5" } }, "sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA=="],
397
+ }
398
+ }
399
+ `;var Uh={private:!0,devDependencies:{wrangler:"4.151.1"}};var rP=`export class DoorbellError extends Error {
400
+ constructor(
401
+ readonly status: 401 | 409 | 502,
402
+ readonly reason: string,
403
+ ) {
404
+ super(reason);
405
+ }
406
+ }
407
+
408
+ export type Claims = Record<string, unknown>;
409
+ export type Jwk = { kty?: string; n?: string; e?: string; kid?: string };
410
+ export type KeySource = (kid: string) => Promise<Jwk | null>;
411
+
412
+ const ISSUER = "https://token.actions.githubusercontent.com";
413
+ const JWKS = \`\${ISSUER}/.well-known/jwks\`;
414
+ const SKEW = 60;
415
+ const MAX_TOKEN = 8192;
416
+ const KEYS_TTL = 3600;
417
+ const REFETCH_GAP = 300;
418
+ const FAILURE_GAP = 30;
419
+
420
+ const refuse = (reason: string) => new DoorbellError(401, reason);
421
+
422
+ function decode(part: string): Uint8Array<ArrayBuffer> {
423
+ return Uint8Array.from(atob(part.replace(/-/g, "+").replace(/_/g, "/")), (c) => c.charCodeAt(0));
424
+ }
425
+
426
+ function json(part: string): Record<string, unknown> {
427
+ try {
428
+ const v = JSON.parse(new TextDecoder().decode(decode(part)));
429
+ if (typeof v === "object" && v !== null && !Array.isArray(v)) return v as Record<string, unknown>;
430
+ } catch {}
431
+ throw refuse("malformed token");
432
+ }
433
+
434
+ export function jwksSource(fetchImpl: typeof fetch, clock: () => number): KeySource {
435
+ let keys = new Map<string, Jwk>();
436
+ let fetchedAt = -Infinity;
437
+ let failedAt = -Infinity;
438
+ let inflight: Promise<void> | null = null;
439
+ const refresh = () =>
440
+ (inflight ??= (async () => {
441
+ try {
442
+ const res = await fetchImpl(JWKS, { headers: { accept: "application/json" } }).catch(() => null);
443
+ if (!res?.ok) throw new DoorbellError(502, "GitHub's key set is unreachable");
444
+ const body = (await res.json().catch(() => null)) as { keys?: unknown } | null;
445
+ const list = Array.isArray(body?.keys) ? (body.keys as Jwk[]) : [];
446
+ const next = new Map(list.filter((k) => typeof k.kid === "string" && k.kty === "RSA").map((k) => [k.kid!, k]));
447
+ if (next.size === 0) throw new DoorbellError(502, "GitHub's key set is empty");
448
+ keys = next;
449
+ fetchedAt = clock();
450
+ } catch (e) {
451
+ failedAt = clock();
452
+ throw e;
453
+ } finally {
454
+ inflight = null;
455
+ }
456
+ })());
457
+ return async (kid) => {
458
+ const now = clock();
459
+ const stale = now - fetchedAt > KEYS_TTL || (!keys.has(kid) && now - fetchedAt > REFETCH_GAP);
460
+ if (stale && now - failedAt >= FAILURE_GAP) await refresh();
461
+ else if (stale && !keys.has(kid)) throw new DoorbellError(502, "GitHub's key set is unreachable");
462
+ return keys.get(kid) ?? null;
463
+ };
464
+ }
465
+
466
+ export async function verifyOidc(token: string, origin: string, ownerId: string, keys: KeySource, now: number): Promise<Claims> {
467
+ if (token.length > MAX_TOKEN) throw refuse("token too large");
468
+ const parts = token.split(".");
469
+ if (parts.length !== 3 || !parts.every((p) => /^[A-Za-z0-9_-]+$/.test(p))) throw refuse("malformed token");
470
+ const [h, p, s] = parts as [string, string, string];
471
+ const header = json(h);
472
+ if (header.alg !== "RS256" || typeof header.kid !== "string") throw refuse("unexpected algorithm");
473
+ const jwk = await keys(header.kid);
474
+ if (!jwk) throw refuse("unknown key");
475
+ let key: CryptoKey;
476
+ try {
477
+ key = await crypto.subtle.importKey("jwk", { kty: "RSA", n: jwk.n, e: jwk.e }, { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, false, ["verify"]);
478
+ } catch {
479
+ throw new DoorbellError(502, "GitHub's key could not be read");
480
+ }
481
+ const valid = await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key, decode(s), new TextEncoder().encode(\`\${h}.\${p}\`));
482
+ if (!valid) throw refuse("bad signature");
483
+ const c = json(p);
484
+ const num = (k: string) => (typeof c[k] === "number" ? (c[k] as number) : Number.NaN);
485
+ if (c.iss !== ISSUER) throw refuse("wrong issuer");
486
+ if (typeof c.aud !== "string" || c.aud !== origin) throw refuse("wrong audience");
487
+ if (typeof c.repository_owner_id !== "string" || c.repository_owner_id !== ownerId) throw refuse("wrong owner");
488
+ if (c.runner_environment !== "github-hosted") throw refuse("not a GitHub-hosted runner");
489
+ if (c.ref_type !== "tag" || typeof c.ref !== "string" || !c.ref.startsWith("refs/tags/v")) throw refuse("not a version tag");
490
+ if (c.event_name !== "push" && c.event_name !== "workflow_dispatch") throw refuse("unexpected event");
491
+ const [exp, nbf, iat] = [num("exp"), num("nbf"), num("iat")];
492
+ if (!(exp >= now - SKEW) || !(nbf <= now + SKEW) || !(iat <= now + SKEW) || !(exp - iat <= 3600)) throw refuse("token time is off");
493
+ return c;
494
+ }
495
+ `;var sP=`import { DoorbellError, type KeySource, jwksSource, verifyOidc } from "./jwt";
496
+
497
+ export type Env = { APP_ID: string; INSTALLATION_ID: string; HUB: string; HUB_ID: string; OWNER_ID: string; INTERVAL?: string; APP_KEY: string };
498
+
499
+ const API = "https://api.github.com";
500
+ const b64url = (data: Uint8Array | string) =>
501
+ btoa(typeof data === "string" ? data : String.fromCharCode(...data)).replace(/\\+/g, "-").replace(/\\//g, "_").replace(/=+$/, "");
502
+
503
+ async function appJwt(env: Env, now: number): Promise<string> {
504
+ const der = Uint8Array.from(atob(env.APP_KEY.replace(/-----[A-Z ]+-----/g, "").replace(/\\s+/g, "")), (c) => c.charCodeAt(0));
505
+ const key = await crypto.subtle.importKey("pkcs8", der, { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, false, ["sign"]);
506
+ const input = \`\${b64url(JSON.stringify({ alg: "RS256", typ: "JWT" }))}.\${b64url(JSON.stringify({ iat: now - 60, exp: now + 540, iss: env.APP_ID }))}\`;
507
+ const sig = new Uint8Array(await crypto.subtle.sign("RSASSA-PKCS1-v1_5", key, new TextEncoder().encode(input)));
508
+ return \`\${input}.\${b64url(sig)}\`;
509
+ }
510
+
511
+ async function github(fetchImpl: typeof fetch, method: string, path: string, auth: string, body?: unknown): Promise<Response> {
512
+ const res = await fetchImpl(\`\${API}\${path}\`, {
513
+ method,
514
+ headers: {
515
+ authorization: \`Bearer \${auth}\`,
516
+ accept: "application/vnd.github+json",
517
+ "x-github-api-version": "2022-11-28",
518
+ "user-agent": "tapster-doorbell",
519
+ ...(body ? { "content-type": "application/json" } : {}),
520
+ },
521
+ body: body ? JSON.stringify(body) : undefined,
522
+ }).catch(() => null);
523
+ if (!res) throw new DoorbellError(502, \`\${method} \${path.split("/").slice(0, 3).join("/")} failed\`);
524
+ return res;
525
+ }
526
+
527
+ export async function dispatch(env: Env, fetchImpl: typeof fetch, now: number, opts: { tick?: boolean } = {}): Promise<"dispatched" | "skipped"> {
528
+ const jwt = await appJwt(env, now);
529
+ const minted = await github(fetchImpl, "POST", \`/app/installations/\${env.INSTALLATION_ID}/access_tokens\`, jwt, { repository_ids: [Number(env.HUB_ID)], permissions: { actions: "write" } });
530
+ if (!minted.ok) throw new DoorbellError(502, \`GitHub refused a token (\${minted.status})\`);
531
+ const { token } = (await minted.json()) as { token: string };
532
+ const flow = \`/repos/\${env.HUB}/actions/workflows/tapster.yml\`;
533
+ try {
534
+ const wf = await github(fetchImpl, "GET", flow, token);
535
+ if (!wf.ok) throw new DoorbellError(502, \`GitHub did not show the hub workflow (\${wf.status})\`);
536
+ const { state } = (await wf.json()) as { state: string };
537
+ if (state === "disabled_inactivity") {
538
+ const on = await github(fetchImpl, "PUT", \`\${flow}/enable\`, token);
539
+ if (!on.ok) throw new DoorbellError(502, \`GitHub refused to turn the workflow back on (\${on.status})\`);
540
+ } else if (state !== "active") throw new DoorbellError(409, \`the hub workflow is \${state.replace(/_/g, " ")}\`);
541
+ if (opts.tick) {
542
+ const runs = await github(fetchImpl, "GET", \`\${flow}/runs?per_page=1\`, token);
543
+ if (!runs.ok) throw new DoorbellError(502, \`GitHub did not list the runs (\${runs.status})\`);
544
+ const last = ((await runs.json()) as { workflow_runs: { created_at: string }[] }).workflow_runs[0];
545
+ const interval = Number(env.INTERVAL ?? "10") * 60;
546
+ if (last && now - Date.parse(last.created_at) / 1000 < interval - 30) return "skipped";
547
+ }
548
+ const res = await github(fetchImpl, "POST", \`\${flow}/dispatches\`, token, { ref: "main" });
549
+ if (!res.ok) throw new DoorbellError(502, \`GitHub refused the dispatch (\${res.status})\`);
550
+ return "dispatched";
551
+ } finally {
552
+ await github(fetchImpl, "DELETE", "/installation/token", token).catch(() => null);
553
+ }
554
+ }
555
+
556
+ const clean = (v: unknown) => String(v).replace(/[^\\x20-\\x7e]/g, "").slice(0, 200);
557
+
558
+ export async function handle(request: Request, env: Env, fetchImpl: typeof fetch, now: number, log: (line: string) => void, keys?: KeySource): Promise<Response> {
559
+ if (request.method !== "POST") return new Response(null, { status: 405, headers: { allow: "POST" } });
560
+ const auth = request.headers.get("authorization") ?? "";
561
+ const token = auth.startsWith("Bearer ") ? auth.slice(7).trim() : "";
562
+ let claims: Record<string, unknown>;
563
+ try {
564
+ claims = await verifyOidc(token, new URL(request.url).origin, env.OWNER_ID, keys ?? jwksSource(fetchImpl, () => now), now);
565
+ } catch (e) {
566
+ const status = e instanceof DoorbellError ? e.status : 401;
567
+ log(\`refused: \${e instanceof DoorbellError ? e.reason : "unexpected error"} -> \${status}\`);
568
+ return new Response(null, { status });
569
+ }
570
+ const who = \`\${clean(claims.repository)} \${clean(claims.ref)}\`;
571
+ try {
572
+ await dispatch(env, fetchImpl, now);
573
+ } catch (e) {
574
+ log(\`rang: \${who} -> 502 (\${e instanceof DoorbellError ? e.reason : "unexpected error"})\`);
575
+ return new Response(null, { status: 502 });
576
+ }
577
+ log(\`rang: \${who} -> 202\`);
578
+ return new Response(null, { status: 202 });
579
+ }
580
+
581
+ const boundFetch = ((input, init) => fetch(input, init)) as typeof fetch;
582
+ let keys: KeySource | null = null;
583
+
584
+ export async function tick(env: Env, fetchImpl: typeof fetch, now: number, log: (line: string) => void): Promise<void> {
585
+ try {
586
+ log(\`tick: \${await dispatch(env, fetchImpl, now, { tick: true })}\`);
587
+ } catch (e) {
588
+ log(\`tick: failed (\${e instanceof DoorbellError ? e.reason : "unexpected error"})\`);
589
+ }
590
+ }
591
+
592
+ export default {
593
+ fetch(request: Request, env: Env): Promise<Response> {
594
+ keys ??= jwksSource(boundFetch, () => Math.floor(Date.now() / 1000));
595
+ return handle(request, env, boundFetch, Math.floor(Date.now() / 1000), (line) => console.log(line), keys);
596
+ },
597
+ scheduled(_event: unknown, env: Env, ctx: { waitUntil(p: Promise<unknown>): void }): void {
598
+ ctx.waitUntil(tick(env, boundFetch, Math.floor(Date.now() / 1000), (line) => console.log(line)));
599
+ },
600
+ };
601
+ `;import{randomBytes as oP}from"crypto";import{createServer as iP}from"http";function vt(e){console.log(` ${e}`),C(process.platform==="darwin"?"/usr/bin/open":"/usr/bin/xdg-open","open",[e],{allowFail:!0}).catch(()=>{return})}async function _s(e,t){let r=oP(16).toString("hex"),n=await new Promise((o,i)=>{let a=iP((c,u)=>{let l=new URL(c.url??"/","http://127.0.0.1");if(l.pathname==="/start"){let f=JSON.stringify(e(`http://127.0.0.1:${a.address().port}/callback`)).replaceAll('"',"&quot;");u.writeHead(200,{"content-type":"text/html"}),u.end(`<form id="f" method="post" action="https://github.com/settings/apps/new?state=${r}"><input type="hidden" name="manifest" value="${f}"></form><script>document.getElementById("f").submit()</script>`);return}if(l.pathname==="/callback"){if(u.writeHead(200,{"content-type":"text/plain"}),u.end("tapster: the App was created. You can close this tab."),a.close(),l.searchParams.get("state")!==r)i(new y("the App creation answer did not match","Run tapster init again."));else o(l.searchParams.get("code")??"");return}u.writeHead(404).end()});a.listen(0,"127.0.0.1",()=>{let c=a.address().port;console.log(`Opening GitHub to create ${t}. Click "Create GitHub App".`),vt(`http://127.0.0.1:${c}/start`)})}),s=await fetch(`https://api.github.com/app-manifests/${n}/conversions`,{method:"POST",headers:{Accept:"application/vnd.github+json"}});if(!s.ok)throw new y(`GitHub did not convert the App (status ${s.status})`,"Run tapster init again within an hour of creating the App.");return await s.json()}var Lr=()=>({HOME:process.env.HOME??"/tmp",...process.env.GH_CONFIG_DIR?{GH_CONFIG_DIR:process.env.GH_CONFIG_DIR}:{},GH_PROMPT_DISABLED:"1"});function Dr(e){try{return $h(e)}catch{throw new y("the GitHub CLI (gh) is not installed","Install it (brew install gh, or see https://cli.github.com), sign in with gh auth login, then run this again.")}}async function Bt(){let e=await C(Dr(),"gh",["auth","token"],{env:Lr(),allowFail:!0}),t=e.stdout.trim();if(e.code!==0||!t)throw new y("gh is not signed in","Run gh auth login, then try again.");return new Oe(t,fetch,void 0,"user")}async function Kt(e=process.cwd()){let t=(await Te("git",["-C",e,"remote","get-url","origin"],{allowFail:!0})).stdout.trim(),r=/github\.com[:/]([A-Za-z0-9-]+\/[A-Za-z0-9._-]+?)(?:\.git)?$/.exec(t);if(!r)throw new y("this folder is not a clone of a GitHub repository","Run tapster inside a clone (git remote origin on github.com).");return r[1]}async function ee(e,t,r,n="tapster"){await C(Dr(),"gh",["secret","set",t,"--env",n,"--repo",e],{env:Lr(),stdin:r})}async function Ie(e,t,r){await C(Dr(),"gh",["variable","set",t,"--env","tapster","--repo",e,"--body",r],{env:Lr()})}async function vs(e,t,r){await C(Dr(),"gh",["variable","set",t,"--repo",e,"--body",r],{env:Lr()})}async function Zh(e,t,r="tapster"){await C(Dr(),"gh",["secret","delete",t,"--env",r,"--repo",e],{env:Lr()})}async function ks(e,t={}){let{timeoutMs:r=600000,intervalMs:n=3000,sleep:s=(a)=>new Promise((c)=>setTimeout(c,a)),now:o=Date.now}=t,i=o()+r;for(;;){let a=await e();if(a!==null)return a;if(o()+n>i)return null;await s(n)}}import{createInterface as aP}from"readline";function te(e,t=!1){return new Promise((r)=>{let n=aP({input:process.stdin,output:process.stdout,terminal:!0});if(t)n._writeToOutput=(s)=>{if(s.includes(e))process.stdout.write(e)};n.question(e,(s)=>{if(n.close(),t)process.stdout.write(`
602
+ `);r(s.trim())})})}import{mkdtempSync as cP,rmSync as uP}from"fs";import{tmpdir as lP}from"os";import{join as pP}from"path";var ra=new Set;function Ft(e){let t=cP(pP(lP(),e));return ra.add(t),t}function rt(e){uP(e,{recursive:!0,force:!0}),ra.delete(e)}function fP(){for(let e of[...ra])rt(e)}process.on("SIGINT",()=>{fP(),process.exit(130)});function na(e){if(Number.isInteger(e)&&e>=5&&e<60&&60%e===0)return`7-59/${e} * * * *`;if(e===60)return"7 * * * *";let t=e/60;if(Number.isInteger(t)&&t>1&&t<=24&&24%t===0)return`7 */${t} * * *`;throw new y(`${e} minutes is not an interval tapster can schedule`,"Use 5, 10, 15, 20 or 30 minutes, or 60 minutes times a divisor of 24.")}function Gt(e){let t=X(e)?.on?.schedule?.[0]?.cron;if(!t)return null;let r=/^7-59\/(\d+) \* \* \* \*$/.exec(t)??null;if(r)return Number(r[1]);if(t==="7 * * * *")return 60;let n=/^7 \*\/(\d+) \* \* \*$/.exec(t);return n?Number(n[1])*60:null}function Mh(e){if(e<60)return`*/${e} * * * *`;return e===60?"0 * * * *":`0 */${e/60} * * *`}var qh=(e)=>e.default,Zr=(e)=>Dh.trimEnd().split(`
603
+ `).map((t)=>`${" ".repeat(e)}${t}`).join(`
604
+ `);function yP(e,t,r){return{name:`tapster-doorbell-${e}-${t.split("/")[1].replace(/^homebrew-/,"")}`.toLowerCase().slice(0,34),url:`https://github.com/${t}`,redirect_url:r,public:!1,default_permissions:{actions:"write",metadata:"read"},default_events:[],hook_attributes:{url:"https://example.com/tapster-has-no-webhook",active:!1}}}function wP(e){for(let r of["APP_ID","INSTALLATION_ID","HUB_ID","OWNER_ID","INTERVAL"])if(!/^[0-9]+$/.test(e[r]))throw new y(`${r} must be a number`,"Run tapster init --doorbell again.");if(!/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/.test(e.HUB))throw new y("the hub name is not owner/repo","Run it in the hub clone.");let t={crons:[Mh(Number(e.INTERVAL))]};return`${JSON.stringify({name:"tapster-doorbell",main:"worker.ts",compatibility_date:"2026-10-01",workers_dev:!0,vars:e,triggers:t},null,2)}
605
+ `}function bP(e){for(let t of e.split(`
606
+ `)){let r;try{r=JSON.parse(t)}catch{continue}if(r.type!=="deploy"||!Array.isArray(r.targets))continue;for(let n of r.targets)if(typeof n==="string"&&/^https:\/\/[a-z0-9-]+\.[a-z0-9-]+\.workers\.dev\/?$/.test(n))return new URL(n).origin}return null}var _P=(e)=>({PATH:e,BUN_BE_BUN:"1"});function Kh(e){let t=(r)=>e.variables.some((n)=>n.name===r);if(t("TAPSTER_DOORBELL"))return"done";return t("TAPSTER_DOORBELL_APP_ID")&&t("TAPSTER_DOORBELL_APP_SLUG")?"resume":"new"}var Ur="Run tapster init --doorbell again; it continues with the App it already created.";async function Fh(e,t){console.log(`Open the doorbell App's settings, scroll to "Private keys" and click "Generate a private key":`),vt(`https://github.com/settings/apps/${t}`);let r=(await te("Path of the downloaded .pem file: ")).replace(/^~(?=\/)/,process.env.HOME??"~"),n=await gP(r,"utf8");return await new Oe(qt(e,n)).json("GET","/app").catch(()=>{throw new y("that key does not belong to the doorbell App",`Generate the key on https://github.com/settings/apps/${t}.`)}),console.log(`Once tapster is done, delete ${r} and every older key on that page.`),n}function vP(){for(let e of(process.env.PATH??"").split(sa))if(e&&Bh(Ne(e,"node")))return Ne(e,"node");throw new y("Wrangler needs Node.js, which is not on PATH","Install Node.js 20 or newer, then run this again.")}async function Gh(){let e=Ft("tapster-doorbell-");await jr(Ne(e,"package.json"),`${JSON.stringify(Uh,null,2)}
607
+ `),await jr(Ne(e,"bun.lock"),jh),await C(process.execPath,"bun",["install","--frozen-lockfile","--ignore-scripts"],{cwd:e,env:_P(process.env.PATH??"")});let t=vP(),r=Ne(e,"node_modules","wrangler","bin","wrangler.js"),n=Object.fromEntries(["CLOUDFLARE_API_TOKEN","CLOUDFLARE_ACCOUNT_ID"].flatMap((o)=>process.env[o]?[[o,process.env[o]]]:[])),s={PATH:`${Ne(t,"..")}${sa}/usr/bin${sa}/bin`,WRANGLER_SEND_METRICS:"false",...n};return{dir:e,run(o,i={}){if(i.interactive)return new Promise((a)=>{hP(t,[r,...o],{cwd:e,stdio:"inherit",env:{HOME:process.env.HOME??"",...s,...i.env}}).on("close",(u)=>a({code:u??1,stdout:""}))});return C(t,"wrangler",[r,...o],{cwd:e,env:{...s,...i.env},stdin:i.stdin,allowFail:!0})}}}async function Hh(e){if((await e.run(["whoami"])).code===0)return;if(console.log("Sign in to Cloudflare in the browser that opens."),(await e.run(["login"],{interactive:!0})).code!==0)throw new y("Wrangler could not sign in to Cloudflare","Run tapster init --doorbell again.")}async function Wh(e,t,r){let n=new Oe(qt(e,t));console.log(`Waiting until the App is installed on ${r} (only that repository); tapster continues by itself.`);let s=await ks(()=>n.json("GET",`/repos/${r}/installation`).then((o)=>o.id,()=>null));if(s!==null)return s;throw new y(`the doorbell App was not installed on ${r} within 10 minutes`,`Install it on ${r}, then ${Ur.charAt(0).toLowerCase()}${Ur.slice(1)}`)}async function Vh(e,t,r,n,s,o,i){let a=(await t.json("GET",`/users/${r.split("/")[0]}`)).id,c=(await t.getRepo(r)).id;await jr(Ne(e.dir,"worker.ts"),qh(ta)),await jr(Ne(e.dir,"jwt.ts"),qh(ea)),await jr(Ne(e.dir,"wrangler.jsonc"),wP({APP_ID:n,INSTALLATION_ID:String(i),HUB:r,HUB_ID:String(c),OWNER_ID:String(a),INTERVAL:String(o)}));let u=Ne(e.dir,"out.ndjson");if((await e.run(["deploy"],{env:{WRANGLER_OUTPUT_FILE_PATH:u}})).code!==0)throw new y("Wrangler could not deploy the doorbell",`${Ur} Wrangler's own message is above.`);let f=bP(Bh(u)?mP(u,"utf8"):"");if(!f)throw new y("the doorbell has no workers.dev address",`Create your workers.dev subdomain in the Cloudflare dashboard (Workers & Pages). ${Ur}`);let p=dP(s).export({type:"pkcs8",format:"pem"}).toString();if((await e.run(["secret","put","APP_KEY"],{stdin:p})).code!==0)throw new y("Wrangler could not store the doorbell key",Ur);return await Ie(r,"TAPSTER_DOORBELL_EVERY",String(o)),f}async function Yh(e,t,r,n,s){let o=await e.json("GET",`/repos/${t}/environments/tapster/variables`),i=Kh(o);if(i==="done")throw new y("the hub already has a doorbell","Run tapster init --rotate doorbell to replace its key. To start over, delete the App and the TAPSTER_DOORBELL variables.");let a=await Gh();try{await Hh(a);let[c]=t.split("/"),u,l;if(i==="resume")u=o.variables.find((p)=>p.name==="TAPSTER_DOORBELL_APP_ID").value,console.log("Continuing with the doorbell App created earlier."),l=await Fh(u,o.variables.find((p)=>p.name==="TAPSTER_DOORBELL_APP_SLUG").value);else{let p=await _s((d)=>yP(c,t,d),"the doorbell App");u=String(p.id),l=p.pem,await Ie(t,"TAPSTER_DOORBELL_APP_ID",u),await Ie(t,"TAPSTER_DOORBELL_APP_SLUG",p.slug),vt(`https://github.com/apps/${p.slug}/installations/new`)}let f=await Vh(a,e,t,u,l,s,await Wh(u,l,t));for(let p of r.packages)await n(p.repo,"TAPSTER_DOORBELL",f);await Ie(t,"TAPSTER_DOORBELL",f),console.log(`The doorbell answers at ${f}. Projects ring it after opening a draft.`)}finally{rt(a.dir)}}async function Jh(e,t,r){let n=await e.json("GET",`/repos/${t}/environments/tapster/variables`);if(Kh(n)!=="done")throw new y("the hub has no working doorbell yet","Run tapster init --doorbell.");let s=n.variables.find((a)=>a.name==="TAPSTER_DOORBELL_APP_ID").value,o=await Fh(s,n.variables.find((a)=>a.name==="TAPSTER_DOORBELL_APP_SLUG").value),i=await Gh();try{await Hh(i),await Vh(i,e,t,s,o,r,await Wh(s,o,t))}finally{rt(i.dir)}console.log(`Deployed the doorbell again with the new key; it starts the hub every ${r} minutes. Now delete every other key on the App's settings page.`)}var Re={"actions/checkout":{tag:"v7.0.1",sha:"3d3c42e5aac5ba805825da76410c181273ba90b1"},"actions/attest-build-provenance":{tag:"v4.2.2",sha:"4d101475d8b20a2381f78447822ac1eab6504dd8"},"oven-sh/setup-bun":{tag:"v2.2.0",sha:"0c5077e51419868618aeaa5fe8019c62421857d6"},"actions/upload-artifact":{tag:"v7.0.1",sha:"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a"},"actions/download-artifact":{tag:"v8.0.1",sha:"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c"},"actions/upload-pages-artifact":{tag:"v5.0.0",sha:"fc324d3547104276b827a68afc52ff2a11cc49c9"},"actions/deploy-pages":{tag:"v5.0.1",sha:"368f82528645a54fb793d4d04e342629a3f51346"}};var Qh=`name: release
608
+ on:
609
+ push:
610
+ tags: ["v[0-9]+.[0-9]+.[0-9]+"]
611
+ workflow_dispatch:
612
+ permissions: {}
613
+ jobs:
614
+ build:
615
+ runs-on: __RUNNER__
616
+ permissions: { contents: read }
617
+ steps:
618
+ - name: Refuse anything but a tag
619
+ if: \${{ github.ref_type != 'tag' }}
620
+ run: |
621
+ echo "::error::Run this workflow on a tag like v1.2.3."
622
+ exit 1
623
+ - uses: actions/checkout@__CHECKOUT_SHA__ # __CHECKOUT_TAG__
624
+ with: { persist-credentials: false }
625
+ - name: Build the app, signed ad hoc
626
+ env: { TAG: "\${{ github.ref_name }}" }
627
+ run: |
628
+ set -euo pipefail
629
+ export VERSION="\${TAG#v}"
630
+ __BUILD__
631
+ - name: Pack the app
632
+ env: { TAG: "\${{ github.ref_name }}" }
633
+ run: |
634
+ set -euo pipefail
635
+ mkdir -p "$RUNNER_TEMP/out"
636
+ tar -C "$(dirname "__APP_PATH__")" --no-mac-metadata --no-xattrs -czf "$RUNNER_TEMP/out/__APP_NAME__-\${TAG#v}.app.tar.gz" "$(basename "__APP_PATH__")"
637
+ - uses: actions/upload-artifact@__UPLOAD_SHA__ # __UPLOAD_TAG__
638
+ with: { name: app, path: "\${{ runner.temp }}/out", if-no-files-found: error, retention-days: 1 }
639
+ release:
640
+ needs: build
641
+ runs-on: ubuntu-24.04
642
+ permissions: { contents: write, id-token: write, attestations: write }
643
+ steps:
644
+ - uses: actions/checkout@__CHECKOUT_SHA__ # __CHECKOUT_TAG__
645
+ with: { persist-credentials: false }
646
+ - uses: actions/download-artifact@__DOWNLOAD_SHA__ # __DOWNLOAD_TAG__
647
+ with: { name: app, path: dist }
648
+ - name: List the files
649
+ run: |
650
+ set -euo pipefail
651
+ __CARRY__
652
+ cd dist && sha256sum * > checksums.txt
653
+ - uses: actions/attest-build-provenance@__ATTEST_SHA__ # __ATTEST_TAG__
654
+ if: \${{ !github.event.repository.private }}
655
+ with: { subject-checksums: dist/checksums.txt }
656
+ - name: Hand the draft to the tapster hub
657
+ env: { GH_TOKEN: "\${{ github.token }}", TAG: "\${{ github.ref_name }}" }
658
+ run: gh release create "$TAG" dist/* --draft --verify-tag --generate-notes --title "$TAG"
659
+ __RING__
660
+ `;var Xh=`name: release
661
+ on:
662
+ push:
663
+ tags: ["v[0-9]+.[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+-*"]
664
+ permissions: {}
665
+ jobs:
666
+ build:
667
+ runs-on: ubuntu-24.04
668
+ permissions: { contents: read }
669
+ steps:
670
+ - uses: actions/checkout@__CHECKOUT_SHA__ # __CHECKOUT_TAG__
671
+ with: { persist-credentials: false }
672
+ - uses: oven-sh/setup-bun@__SETUP_BUN_SHA__ # __SETUP_BUN_TAG__
673
+ with: { bun-version: 1.4.3 }
674
+ - run: bun install --frozen-lockfile
675
+ - name: Build every target
676
+ env: { TAG: "\${{ github.ref_name }}" }
677
+ run: |
678
+ set -euo pipefail
679
+ v="\${TAG#v}"
680
+ mkdir -p dist
681
+ for t in darwin-arm64 darwin-x64 linux-arm64 linux-x64 windows-x64; do
682
+ exe=__NAME__; [ "\${t%%-*}" = windows ] && exe=__NAME__.exe
683
+ bun build __ENTRY__ --compile --target="bun-$t" --outfile "dist/$t/$exe"
684
+ done
685
+ mkdir -p out
686
+ for t in darwin-arm64 darwin-x64 linux-arm64 linux-x64; do
687
+ p="\${t/x64/amd64}"
688
+ tar -C "dist/$t" -czf "out/__NAME___\${v}_\${p/-/_}.tar.gz" __NAME__
689
+ done
690
+ (cd dist/windows-x64 && zip -qX "../../out/__NAME___\${v}_windows_amd64.zip" __NAME__.exe)
691
+ - uses: actions/upload-artifact@__UPLOAD_SHA__ # __UPLOAD_TAG__
692
+ with: { name: builds, path: out, if-no-files-found: error, retention-days: 1 }
693
+ release:
694
+ needs: build
695
+ runs-on: ubuntu-24.04
696
+ permissions: { contents: write, id-token: write, attestations: write }
697
+ steps:
698
+ - uses: actions/checkout@__CHECKOUT_SHA__ # __CHECKOUT_TAG__
699
+ with: { persist-credentials: false }
700
+ - uses: actions/download-artifact@__DOWNLOAD_SHA__ # __DOWNLOAD_TAG__
701
+ with: { name: builds, path: dist }
702
+ - name: List the files
703
+ run: cd dist && sha256sum *.tar.gz *.zip > checksums.txt
704
+ - uses: actions/attest-build-provenance@__ATTEST_SHA__ # __ATTEST_TAG__
705
+ if: \${{ !github.event.repository.private }}
706
+ with: { subject-checksums: dist/checksums.txt }
707
+ - name: Hand the draft to the tapster hub
708
+ env: { GH_TOKEN: "\${{ github.token }}", TAG: "\${{ github.ref_name }}" }
709
+ run: gh release create "$TAG" dist/*.tar.gz dist/*.zip dist/checksums.txt --draft --verify-tag --generate-notes --title "$TAG" $( [ "\${TAG#*-}" != "$TAG" ] && echo --prerelease )
710
+ __RING__
711
+ `;function Ss(e){if(!/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/.test(e))throw new y(`${e} is not a repository name`,"Name the hub as owner/repo, for example you/homebrew-tap.");return e}function em(e,t){let r=(s)=>s.replace(/^\.\//,"");if(typeof e.bin==="string")return{bin:(e.name??t).replace(/^@[^/]+\//,""),entry:r(e.bin)};let n=Object.entries(e.bin??{})[0];return n?{bin:n[0],entry:r(n[1])}:null}var AP=[["darwin-arm64","darwin_arm64.tar.gz"],["darwin-amd64","darwin_amd64.tar.gz"],["linux-arm64","linux_arm64.tar.gz"],["linux-amd64","linux_amd64.tar.gz"],["windows-amd64","windows_amd64.zip"]];function oa(e,t,r,n,s,o){return[` - name: ${e}`,` repo: ${t}`,` kind: ${r}`,` binaries: [${n.join(", ")}]`," assets:",...s.map(([i,a])=>` ${i}: "${a}"`),` scoop: ${o}`].join(`
712
+ `)}var tm=(e,t,r)=>oa(e,t,"bun",[r],AP.map(([n,s])=>[n,`${r}_{version}_${s}`]),!0),xs={darwin_all:"darwin-universal",darwin_universal:"darwin-universal",darwin_arm64:"darwin-arm64",darwin_amd64:"darwin-amd64",linux_arm64:"linux-arm64",linux_amd64:"linux-amd64",windows_amd64:"windows-amd64",windows_arm64:"windows-arm64"};function ia(e,t,r,n,s){if(!s)return{entry:null,reason:"the project has its own release workflow and no release yet; run tapster add again after the first draft"};let o=[];for(let i of s.assets){let a=Object.keys(xs).find((c)=>i.includes(c));if(a&&!o.some(([c])=>c===xs[a]))o.push([xs[a],i.replaceAll(s.version,"{version}")])}if(o.length===0)return{entry:null,reason:"the latest release has no archives tapster recognizes"};return{entry:oa(e,t,r,n,o,o.some(([i,a])=>i.startsWith("windows")&&a.endsWith(".zip"))),reason:null}}function rm(e,t,r,n){let s=(r?X(r):null)??{},o=s.project_name??e,i=[...new Set((s.builds??[]).map((d)=>d.binary??o))],a=i.length?i:[o];if(n)return ia(e,t,"go",a,n);if((s.archives??[]).some((d)=>d.name_template!==void 0))return{entry:null,reason:"GoReleaser names the archives with its own template; run tapster add again after the first draft"};let c=(s.archives??[]).some((d)=>(d.format_overrides??[]).some((h)=>h.goos==="windows"&&(h.format==="zip"||h.formats?.includes("zip")))),u=s.builds?.[0]?.goos??["linux","darwin","windows"],l=s.builds?.[0]?.goarch??["amd64","arm64"],f=[],p=s.universal_binaries?.[0];for(let d of u)for(let h of l){let m=xs[`${d}_${h}`];if(!m||d==="darwin"&&p?.replace)continue;f.push([m,`${o}_{version}_${d}_${h}.${d==="windows"&&c?"zip":"tar.gz"}`])}if(p&&u.includes("darwin"))f.unshift(["darwin-universal",`${o}_{version}_darwin_all.tar.gz`]);return{entry:oa(e,t,"go",a,f,c&&u.includes("windows")),reason:null}}function $P(e,t,r){let n=Qe(e);if((n.toJS().packages??[]).some((u)=>u?.name===r))throw new y(`${r} is already in the hub's tapster.yml`,"Edit its entry there instead.");let o=n.get("packages",!0);if(!dt(o))throw new y("the hub's tapster.yml has no packages list","Add packages: [] to it.");let[i,a]=o.range??[0,0];if(o.flow&&o.items.length===0)return`${e.slice(0,i).replace(/[ \t]+$/,"")}
713
+ ${t}${e.slice(a)}`;if(!o.flow){let u=e.slice(0,a);return`${u}${u.endsWith(`
714
+ `)?"":`
715
+ `}${t}
716
+ ${e.slice(a)}`}let c=Qe(t).contents;if(!dt(c)||c.items.length!==1)throw new y("the entry is not one package","Report this as a tapster bug.");return o.flow=!1,o.items.push(c.items[0]),n.toString()}function nm(e,t){if(!e||Ze(e,t).length===0)return null;let r=e.trim().replace(/^(?:the|an?)\s+/i,"").replace(/command ?line/gi,"command-line").replace(/\.$/,"");return r=r.charAt(0).toUpperCase()+r.slice(1),Ze(r,t).length===0?r:null}var PP=(e,t,r)=>`https://github.com/apps/${e}/installations/new/permissions?suggested_target_id=${t}&repository_ids[]=${r}`;function sm(e){return[" # in the job that decides the version, on the default branch:"," environment: release"," steps:",` - uses: actions/checkout@${e.sha} # ${e.tag}`,' with: { ssh-key: "${{ secrets.TAPSTER_TAG_KEY }}" }'," # ... compute VERSION ..."," - name: Push the release tag",' run: git tag "v$VERSION" && git push origin "v$VERSION"'].join(`
717
+ `)}async function EP(e,t){try{let r=await e.json("GET",`/repos/${t}/contents/tapster.yml?ref=main`);return{text:Buffer.from(r.content,"base64").toString("utf8"),sha:r.sha}}catch(r){if(r instanceof D&&r.status===404)throw new y(`${t} has no tapster.yml on main`,"Run tapster init in a clone of the hub and push it first.");throw r}}async function om(e,t,r,n,s){if(!hs.test(r))throw new y(`${r} is not a valid package name`,"Use lowercase letters, digits and dashes.");let{text:o,sha:i}=await EP(e,t),a=$P(o,s,r),{invalid:c}=bt(a,t.split("/")[0]),u=c.find((h)=>h.name===r);if(u)throw new y(`the hub would refuse this entry: ${u.reason}`,u.fix);let l=`tapster-add-${r}`,f=(await e.json("GET",`/repos/${t}/git/ref/heads/main`)).object.sha;try{await e.json("POST",`/repos/${t}/git/refs`,{ref:`refs/heads/${l}`,sha:f})}catch(h){if(h instanceof D&&h.status===422)throw new y(`the hub already has a branch ${l}`,`Merge or delete it on ${t}, then run tapster add again.`);throw h}await e.json("PUT",`/repos/${t}/contents/tapster.yml`,{message:`Add ${r}`,content:Buffer.from(a).toString("base64"),sha:i,branch:l});let p=[`tapster add prepared this entry for ${n}:`,"","```yaml",s,"```","",`Merge it to let the hub publish ${n}.`].join(`
718
+ `);return(await e.json("POST",`/repos/${t}/pulls`,{title:`Add ${r}`,head:l,base:"main",body:p})).html_url}async function im(e,t,r){let s=(await e.json("GET",`/repos/${t}/environments/tapster/variables`)).variables.find((a)=>a.name==="TAPSTER_APP_SLUG")?.value;if(!s)throw new y("the hub has no App yet","Run tapster init in a clone of the hub first.");let o=await e.getRepo(r),i=await e.json("GET",`/users/${r.split("/")[0]}`);return`- open this page and choose Install, unless the hub's App already reaches ${r}; the project is preselected (keep "Only select repositories"):
719
+ ${PP(s,i.id,o.id)}`}function OP(e){let t=Qe(e),r=[];t.setIn(["release","draft"],!0),r.push("release.draft: true; the tapster hub publishes after signing"),t.setIn(["checksum","name_template"],"checksums.txt"),r.push("checksum.name_template: checksums.txt; the hub reads this name");for(let n of["notarize","homebrew_casks","brews","scoops"])if(t.has(n))t.delete(n),r.push(`removed ${n}; the hub does this now`);return{text:t.toString(),notes:r}}var pm=(e)=>e.value,fm="Ring the tapster hub";function IP(e,t,r){let n=Qe(e),s=[],o=n.get("jobs");if(!ye(o))throw new y("the release workflow has no jobs","Add the GoReleaser job first.");for(let i of o.items){let a=i.value.get("steps");if(!dt(a))continue;let c=a.items.findIndex((g)=>ye(g)&&String(g.get("uses")??"").startsWith("goreleaser/goreleaser-action"));if(c===-1)continue;let l=a.items[c].get("env");if(ye(l))for(let g of[...l.items]){let _=String(g.key.value??g.key);if(/^(MACOS_|HOMEBREW_TAP_)/.test(_))l.delete(_),s.push(`removed ${_} from the GoReleaser step`)}let f=a.items.some((g)=>ye(g)&&String(g.get("uses")??"").startsWith("actions/attest-build-provenance@")),p=pm(i),d=p.get("permissions"),h=n.get("permissions"),m=d??h;if(m!=="write-all"){let g=ye(m)?m.toJSON():{};p.set("permissions",n.createNode({...g,contents:"write","id-token":"write",attestations:"write"}))}if(f)s.push("the attestation step is already there; permissions checked");else{let g=n.createNode({name:"Attest the archives for tapster",uses:`actions/attest-build-provenance@${t}`,if:"${{ !github.event.repository.private }}",with:{"subject-checksums":"dist/checksums.txt"}});g.get("uses",!0).comment=` ${r}`,a.items.splice(c+1,0,g),s.push(`added the attestation step (actions/attest-build-provenance ${r}) and its permissions`)}if(!a.items.some((g)=>ye(g)&&g.get("name")===fm))a.items.push(n.createNode(X(Zr(0))[0])),s.push("added the step that rings the hub's doorbell after the draft is open");return{text:n.toString(),notes:s}}throw new y("no GoReleaser step found in the release workflow","tapster add edits the job that runs goreleaser/goreleaser-action.")}function NP(e){let t;try{t=Qe(e)}catch{return null}let r=t.get("jobs");if(!ye(r))return null;for(let n of r.items){let s=pm(n).get("steps");if(!dt(s))continue;if(!s.items.some((i)=>ye(i)&&/gh release create[^\n]*--draft/.test(String(i.get("run")??""))))continue;if(s.items.some((i)=>ye(i)&&i.get("name")===fm))return e;return s.items.push(t.createNode(X(Zr(0))[0])),t.toString()}return null}function RP(e,t,r){return Xh.replaceAll("__CHECKOUT_SHA__",r["actions/checkout"].sha).replaceAll("__CHECKOUT_TAG__",r["actions/checkout"].tag).replaceAll("__SETUP_BUN_SHA__",r["oven-sh/setup-bun"].sha).replaceAll("__SETUP_BUN_TAG__",r["oven-sh/setup-bun"].tag).replaceAll("__UPLOAD_SHA__",r["actions/upload-artifact"].sha).replaceAll("__UPLOAD_TAG__",r["actions/upload-artifact"].tag).replaceAll("__DOWNLOAD_SHA__",r["actions/download-artifact"].sha).replaceAll("__DOWNLOAD_TAG__",r["actions/download-artifact"].tag).replaceAll("__ATTEST_SHA__",r["actions/attest-build-provenance"].sha).replaceAll("__ATTEST_TAG__",r["actions/attest-build-provenance"].tag).replaceAll("__NAME__",e).replaceAll("__ENTRY__",t).replace(`__RING__
720
+ `,`${Zr(6)}
721
+ `)}var CP=new Set([".git",".build","build","dist","DerivedData","node_modules","Pods","Carthage"]),Ht=(e)=>typeof e==="string"&&!e.includes("$(")?e:null,am=(e)=>typeof e==="string"?/\/releases\/latest\/download\/([A-Za-z0-9._-]+\.xml)$/.exec(e)?.[1]??null:null;function dm(e,t=0){if(t>5)return[];let r=[];for(let n of lm(e,{withFileTypes:!0})){if(n.isSymbolicLink()||CP.has(n.name)||n.name.endsWith(".app")||n.name.endsWith(".xcodeproj"))continue;if(n.isDirectory())r.push(...dm(q(e,n.name),t+1));else if(n.name==="Info.plist")r.push(q(e,n.name))}return r}function zP(e){let t=be(q(e,"Makefile"))?Wt(q(e,"Makefile"),"utf8"):"";return{build:/^app:/m.test(t)?"make app":null,appPath:/^APP\s*:?=\s*([^\s].*?\.app)\s*$/m.exec(t)?.[1]??null}}function LP(e){let t=lm(e);if(!t.some((s)=>s==="project.yml"||s==="Package.swift"||s.endsWith(".xcodeproj")))return null;let r=zP(e);if(be(q(e,"project.yml"))){let s=X(Wt(q(e,"project.yml"),"utf8"));for(let[o,i]of Object.entries(s?.targets??{})){if(i.type!=="application")continue;let a=i.info?.properties??{},c=am(a.SUFeedURL);if(!c)continue;let u={...s.settings?.base??{},...i.settings?.base??{}};return{name:Ht(u.PRODUCT_NAME)??o,bundleId:Ht(u.PRODUCT_BUNDLE_IDENTIFIER),feed:c,publicKey:Ht(a.SUPublicEDKey),universal:String(u.ARCHS??"").includes("x86_64"),...r}}}let n=t.find((s)=>s.endsWith(".xcodeproj"));for(let s of dm(e)){let o;try{o=Eh(Wt(s))}catch{continue}let i=am(o.SUFeedURL);if(!i)continue;let a=n&&be(q(e,n,"project.pbxproj"))?Wt(q(e,n,"project.pbxproj"),"utf8"):"",c=/PRODUCT_BUNDLE_IDENTIFIER = "?([A-Za-z0-9.-]+)"?;/.exec(a)?.[1]??null;return{name:Ht(o.CFBundleName)??(n?Ps(n,".xcodeproj"):Ps(e)),bundleId:Ht(o.CFBundleIdentifier)??c,feed:i,publicKey:Ht(o.SUPublicEDKey),universal:/ARCHS = [^;]*x86_64/.test(a),...r}}return null}function DP(e,t,r){let n={...r,name:r.appPath?Ps(r.appPath,".app"):r.name};return[` - name: ${e}`,` repo: ${t}`," kind: app",` app: ${n.name}.app`,` bundle_id: ${n.bundleId&&ds.test(n.bundleId)?n.bundleId:"<bundle id>"}`," assets:",` ${n.universal?"darwin-universal":"darwin-arm64"}: "${n.name}-{version}.app.tar.gz"`," dmg:",` name: "${n.name}-{version}.dmg"`," sparkle:",` key: ${e.replace(/[^a-z0-9]/g,"")}`,...n.feed==="appcast.xml"?[]:[` feed: ${n.feed}`],` public_key: "${n.publicKey??"<SUPublicEDKey>"}"`].join(`
722
+ `)}function jP(e,t){if(/[\r\n]/.test(e.build))throw new y("the build command must be one line","Wrap several steps in a make target or a script.");if(!/^[A-Za-z0-9 ._\/-]+\.app$/.test(e.appPath))throw new y(`${e.appPath} is not a path to an .app`,"Pass the path the build writes the app to.");if(!/^macos-[0-9a-z.-]+$/.test(e.runner))throw new y(`${e.runner} is not a macOS runner`,"Use a runner like macos-15.");let r=e.carry.map((n)=>{let[s,o]=n.split(":");if(!s||!o||!/^[A-Za-z0-9._\/-]+$/.test(s)||!/^[A-Za-z0-9._-]+$/.test(o))throw new y(`${n} is not <path>:<asset name>`,"Name each carried file as path:name.");return` cp "${s}" "dist/${o}"`});return Qh.replaceAll("__CHECKOUT_SHA__",t["actions/checkout"].sha).replaceAll("__CHECKOUT_TAG__",t["actions/checkout"].tag).replaceAll("__UPLOAD_SHA__",t["actions/upload-artifact"].sha).replaceAll("__UPLOAD_TAG__",t["actions/upload-artifact"].tag).replaceAll("__DOWNLOAD_SHA__",t["actions/download-artifact"].sha).replaceAll("__DOWNLOAD_TAG__",t["actions/download-artifact"].tag).replaceAll("__ATTEST_SHA__",t["actions/attest-build-provenance"].sha).replaceAll("__ATTEST_TAG__",t["actions/attest-build-provenance"].tag).replaceAll("__RUNNER__",e.runner).replaceAll("__BUILD__",e.build).replaceAll("__APP_PATH__",e.appPath).replaceAll("__APP_NAME__",Ps(e.appPath,".app")).replace(`__CARRY__
723
+ `,r.map((n)=>`${n}
724
+ `).join("")).replace(`__RING__
725
+ `,`${Zr(6)}
726
+ `)}async function UP(e,t,r=!1,n=!1){let s=(await e.getRepo(t)).default_branch,o=await zh(e,t,s,r,n);if(o==="exists")return`- ${t} is already protected: only an admin can create, move or delete its branches and tags`;if(o==="created")return`- protected ${t}: only you can create, move or delete branches and tags; workflows and Apps, the hub's included, cannot. Push release tags yourself; GitHub then notes "Bypassed rule violations", which is your admin right at work.${n?" Branches named dependabot/... stay open, so Dependabot can open pull requests; the hub accepts that only with protection: dependabot in its entry.":""}`;return`- GitHub does not enforce rulesets on ${t} (private repositories need a paid plan for them), so a stolen App key could tag code the hub would sign. Make it public, use a paid plan, or set protection: off for this package in the hub's tapster.yml to accept that; until then the hub refuses it.`}function ZP(e){let t={hub:null,force:!1,workflow:"release.yml",autoTag:!1,dependabot:!1};for(let r=0;r<e.length;r++){let n=e[r];if(n==="--force")t.force=!0;else if(n==="--auto-tag")t.autoTag=!0;else if(n==="--allow-dependabot")t.dependabot=!0;else if(n==="--hub"&&e[r+1])t.hub=Ss(e[++r]);else if(n==="--workflow"&&e[r+1]&&/^[A-Za-z0-9._-]+\.ya?ml$/.test(e[r+1]))t.workflow=e[++r];else throw new y(`unknown option ${n}`,"Run tapster add --help for the options.")}return t}async function cm(e,t,r,n){let s=q(e,".github/workflows",t);if(be(s)&&!n){let o=NP(await As(s,"utf8"));if(o===null)throw new y(`.github/workflows/${t} already exists`,"Move it aside and run tapster add again. To replace it, run tapster add --force.");return await $s(s,o),`- kept .github/workflows/${t}; it rings the hub after opening the draft`}return await TP(q(e,".github/workflows"),{recursive:!0}),await $s(s,r),`- wrote .github/workflows/${t} (build, attest, draft, ring the hub)`}async function MP(e,t,r,n){let s=LP(e);if(s){let i=s.build??'echo "Set the build command in .github/workflows/release.yml" && exit 1',a=s.appPath??`build/${s.name}.app`,c=[await cm(e,"release.yml",jP({build:i,appPath:a,runner:"macos-15",carry:[]},Re),n.force)];if(!s.build||!s.appPath)c.push("- set the build command and the app path in that file; the build must sign the app ad hoc");return c.push("- the app must set SURequireSignedFeed and SUVerifyUpdateBeforeExtraction to true and stamp both version keys with the tag"),c.push(`- store the Sparkle key in the hub with tapster init --sparkle ${r.replace(/[^a-z0-9]/g,"")} (add --new to create one)`),{kind:"app",entry:DP(r,t,s),reason:null,notes:c,goreleaser:null}}let o=[".goreleaser.yaml",".goreleaser.yml"].find((i)=>be(q(e,i)));if(o&&be(q(e,"go.mod"))){let i=OP(await As(q(e,o),"utf8"));await $s(q(e,o),i.text);let a=q(e,".github/workflows",n.workflow);if(!be(a))throw new y(`no .github/workflows/${n.workflow} found`,"Name the workflow that runs GoReleaser with --workflow.");let c=IP(await As(a,"utf8"),Re["actions/attest-build-provenance"].sha,Re["actions/attest-build-provenance"].tag);return await $s(a,c.text),{kind:"go",entry:null,reason:null,notes:[...i.notes,...c.notes].map((u)=>`- ${u}`),goreleaser:i.text}}if(be(q(e,"package.json"))&&(be(q(e,"bun.lock"))||be(q(e,"bun.lockb")))){let i=em(JSON.parse(await As(q(e,"package.json"),"utf8")),r);if(!i)throw new y("package.json has no bin entry","Add the CLI entry file to bin in package.json.");let a=await cm(e,"release.yml",RP(i.bin,i.entry,Re),n.force),c=a.startsWith("- kept");return{kind:"bun",entry:c?null:tm(r,t,i.bin),reason:null,notes:[a],goreleaser:null,bin:c?i.bin:null}}throw new y("this project is not a GoReleaser-based Go CLI, a Bun CLI or an app with a Sparkle feed","tapster add supports those three.")}async function qP(e,t){let r=(await Te("git",["-C",e,"config","--get","tapster.hub"],{allowFail:!0})).stdout.trim(),n=t??(r?Ss(r):Ss(await te("Which hub publishes this project (owner/repo)? ")));if(n!==r)await Te("git",["-C",e,"config","tapster.hub",n]);return n}async function BP(e,t,r){let n=await e.json("GET",`/repos/${t}/keys`);if(n.some((a)=>a.title==="tapster tags"))return'- the tag key already exists; to replace it, delete the deploy key "tapster tags" and run this again';try{await e.json("PUT",`/repos/${t}/environments/release`,{deployment_branch_policy:{protected_branches:!1,custom_branch_policies:!0}})}catch(a){if(a instanceof D&&[403,404,422].includes(a.status))throw new y(`GitHub refused environments on ${t}`,"Automatic tags keep their key in an environment, which private repositories get with GitHub Pro. Make the project public or upgrade.");throw a}if(!(await e.json("GET",`/repos/${t}/environments/release/deployment-branch-policies`)).branch_policies.some((a)=>a.name===r))await e.json("POST",`/repos/${t}/environments/release/deployment-branch-policies`,{name:r,type:"branch"});let o=Ft("tapster-tag-");try{await C("/usr/bin/ssh-keygen","ssh-keygen",["-q","-t","ed25519","-N","","-C",`tapster tags for ${t}`,"-f",q(o,"key")]),await ee(t,"TAPSTER_TAG_KEY",Wt(q(o,"key"),"utf8"),"release"),await e.json("POST",`/repos/${t}/keys`,{title:"tapster tags",key:Wt(q(o,"key.pub"),"utf8").trim(),read_only:!1})}finally{rt(o)}let i=n.filter((a)=>!a.read_only).map((a)=>a.title);return[`- automatic tags: a deploy key for ${t} lives in its "release" environment, which only ${r} may use, and the rulesets let deploy keys tag.`,...i.length?[` Every deploy key with write access can now tag too: ${i.join(", ")}. Remove the ones you do not need in the repository settings.`]:[]," Push tags from your release workflow like this:",sm(Re["actions/checkout"])].join(`
727
+ `)}async function KP(e,t){try{return(await e.json("GET",`/repos/${t}/environments/tapster/variables/TAPSTER_DOORBELL`)).value}catch(r){if(r instanceof D&&r.status===404)return null;throw r}}async function um(e,t){let n=(await e.listReleases(t)).filter((s)=>/^v\d/.test(s.tag_name)).sort((s,o)=>o.created_at.localeCompare(s.created_at))[0];return n?{assets:n.assets.map((s)=>s.name),version:n.tag_name.slice(1)}:null}async function hm(e){let t=ZP(e),r=process.cwd(),n=await Kt(r),s=n.split("/")[1].toLowerCase().replace(/[^a-z0-9-]/g,"-"),o=await MP(r,n,s,t);for(let d of o.notes)console.log(d);let i=await Bt(),a=await qP(r,t.hub),c=(await i.getRepo(n)).default_branch;if(console.log(await UP(i,n,t.autoTag,t.dependabot)),!t.dependabot&&[".github/dependabot.yml",".github/dependabot.yaml"].some((d)=>be(q(r,d))))console.log("- Dependabot cannot open pull requests here now: GitHub does not let personal repositories exempt it from the rules."),console.log(" To keep it, run tapster add --allow-dependabot. Branches named dependabot/... then stay open to anything with write access, the hub's App included, so a stolen App key could run your workflows on its own code there.");if(t.autoTag)console.log(await BP(i,n,c));let{entry:u,reason:l}=o;if(o.kind==="go")({entry:u,reason:l}=rm(s,n,o.goreleaser,await um(i,n)));if(o.kind==="bun"&&o.bin)({entry:u,reason:l}=ia(s,n,"bun",[o.bin],await um(i,n)));if(u&&t.dependabot)u=`${u}
728
+ protection: dependabot`;let f=(await i.getRepo(n)).description;if(u&&Ze(f??s,s).length){let d=nm(f,s);if(d)u=`${u}
729
+ description: ${JSON.stringify(d)}`,console.log(`- Homebrew would reject the repository's description (${Ze(f??s,s).join(" and ")}); the entry says "${d}" instead`);else console.log(`- Homebrew would reject the repository's description (${Ze(f??s,s).join(" and ")}); add description: to the hub entry before the first release`)}if(u)try{console.log(`- proposed the hub entry in ${await om(i,a,s,n,u)}; merge it to start publishing`)}catch(d){if(!(d instanceof y))throw d;console.log(`- the hub entry was not proposed: ${d.reason}. ${d.fix}
730
+ The entry for ${a}'s tapster.yml:
731
+ ${u}`)}else console.log(`- no hub entry yet: ${l}`);let p=await KP(i,a);if(p)await vs(n,"TAPSTER_DOORBELL",p),console.log("- the release workflow rings the hub's doorbell, so the hub publishes right after the draft opens");console.log(await im(i,a,n)),console.log(`
732
+ Review the changes with git diff, commit and push them, then push a tag to release.`)}async function aa(e,t,r,n){try{let s=await e.json("GET",`/repos/${t}/contents/${r}?ref=${n}`);return Buffer.from(s.content,"base64").toString("utf8")}catch(s){if(s instanceof D&&s.status===404)return null;throw s}}var nt={version:"1.0.0",sha:"61cd09df0198386185ff0c57598ed63f809e35d1"};var Es=`name: tapster
733
+ on:
734
+ schedule:
735
+ - cron: "__CRON__"
736
+ workflow_dispatch:
737
+ inputs:
738
+ package:
739
+ description: Only this package (optional)
740
+ required: false
741
+ default: ""
742
+ linux:
743
+ description: Rebuild the Linux repositories
744
+ type: boolean
745
+ default: false
746
+ permissions: {}
747
+ concurrency:
748
+ group: tapster
749
+ cancel-in-progress: false
750
+ jobs:
751
+ check:
752
+ runs-on: ubuntu-24.04
753
+ environment: { name: tapster, deployment: false }
754
+ permissions: { contents: read }
755
+ outputs:
756
+ work: \${{ steps.check.outputs.work }}
757
+ macos: \${{ steps.check.outputs.macos }}
758
+ render: \${{ steps.check.outputs.render }}
759
+ linux: \${{ steps.check.outputs.linux }}
760
+ steps:
761
+ - name: Check out the hub
762
+ uses: actions/checkout@__CHECKOUT_SHA__ # __CHECKOUT_TAG__
763
+ with: { persist-credentials: false, ref: main }
764
+ - name: Check the projects for drafts
765
+ id: check
766
+ uses: doguyilmaz/tapster@__TAPSTER_SHA__ # __TAPSTER_TAG__
767
+ with: { mode: check, template: 2, package: "\${{ inputs.package }}", linux: "\${{ inputs.linux }}" }
768
+ env:
769
+ TAPSTER_APP_ID: \${{ vars.TAPSTER_APP_ID }}
770
+ TAPSTER_APP_PRIVATE_KEY: \${{ secrets.TAPSTER_APP_PRIVATE_KEY }}
771
+ GITHUB_TOKEN: \${{ github.token }}
772
+ TAPSTER_TEAM_ID: \${{ vars.TAPSTER_TEAM_ID }}
773
+ TAPSTER_CERT_EXPIRES: \${{ vars.TAPSTER_CERT_EXPIRES }}
774
+ sign:
775
+ needs: check
776
+ if: \${{ !cancelled() && needs.check.outputs.work != '[]' && needs.check.outputs.work != '' }}
777
+ runs-on: \${{ needs.check.outputs.macos == 'false' && 'ubuntu-24.04' || 'macos-15' }}
778
+ environment: { name: tapster, deployment: false }
779
+ permissions: { contents: write }
780
+ outputs:
781
+ attest: \${{ steps.publish.outputs.attest }}
782
+ checksums: \${{ steps.publish.outputs.attest-checksums }}
783
+ steps:
784
+ - name: Check out the hub
785
+ uses: actions/checkout@__CHECKOUT_SHA__ # __CHECKOUT_TAG__
786
+ with: { persist-credentials: false, ref: main }
787
+ - name: Download the drafts and verify them
788
+ uses: doguyilmaz/tapster@__TAPSTER_SHA__ # __TAPSTER_TAG__
789
+ with: { mode: fetch, template: 2, work: "\${{ needs.check.outputs.work }}" }
790
+ env:
791
+ TAPSTER_APP_ID: \${{ vars.TAPSTER_APP_ID }}
792
+ TAPSTER_APP_PRIVATE_KEY: \${{ secrets.TAPSTER_APP_PRIVATE_KEY }}
793
+ - name: Sign and notarize macOS code
794
+ if: \${{ !cancelled() }}
795
+ uses: doguyilmaz/tapster@__TAPSTER_SHA__ # __TAPSTER_TAG__
796
+ with: { mode: sign, template: 2 }
797
+ env:
798
+ TAPSTER_TEAM_ID: \${{ vars.TAPSTER_TEAM_ID }}
799
+ MACOS_SIGN_P12: \${{ secrets.MACOS_SIGN_P12 }}
800
+ MACOS_SIGN_PASSWORD: \${{ secrets.MACOS_SIGN_PASSWORD }}
801
+ MACOS_NOTARY_KEY: \${{ secrets.MACOS_NOTARY_KEY }}
802
+ MACOS_NOTARY_KEY_ID: \${{ secrets.MACOS_NOTARY_KEY_ID }}
803
+ MACOS_NOTARY_ISSUER_ID: \${{ secrets.MACOS_NOTARY_ISSUER_ID }}
804
+ - name: Build the DMGs
805
+ if: \${{ !cancelled() }}
806
+ uses: doguyilmaz/tapster@__TAPSTER_SHA__ # __TAPSTER_TAG__
807
+ with: { mode: package, template: 2 }
808
+ - name: Sign, notarize and staple the DMGs
809
+ if: \${{ !cancelled() }}
810
+ uses: doguyilmaz/tapster@__TAPSTER_SHA__ # __TAPSTER_TAG__
811
+ with: { mode: seal, template: 2 }
812
+ env:
813
+ TAPSTER_TEAM_ID: \${{ vars.TAPSTER_TEAM_ID }}
814
+ MACOS_SIGN_P12: \${{ secrets.MACOS_SIGN_P12 }}
815
+ MACOS_SIGN_PASSWORD: \${{ secrets.MACOS_SIGN_PASSWORD }}
816
+ MACOS_NOTARY_KEY: \${{ secrets.MACOS_NOTARY_KEY }}
817
+ MACOS_NOTARY_KEY_ID: \${{ secrets.MACOS_NOTARY_KEY_ID }}
818
+ MACOS_NOTARY_ISSUER_ID: \${{ secrets.MACOS_NOTARY_ISSUER_ID }}
819
+ - name: Sign the Sparkle feeds
820
+ if: \${{ !cancelled() }}
821
+ uses: doguyilmaz/tapster@__TAPSTER_SHA__ # __TAPSTER_TAG__
822
+ with: { mode: sparkle, template: 2 }
823
+ env: __SPARKLE_ENV__
824
+ - name: Publish the signed releases
825
+ id: publish
826
+ if: \${{ !cancelled() }}
827
+ uses: doguyilmaz/tapster@__TAPSTER_SHA__ # __TAPSTER_TAG__
828
+ with: { mode: publish, template: 2 }
829
+ env:
830
+ TAPSTER_APP_ID: \${{ vars.TAPSTER_APP_ID }}
831
+ TAPSTER_APP_PRIVATE_KEY: \${{ secrets.TAPSTER_APP_PRIVATE_KEY }}
832
+ GITHUB_TOKEN: \${{ github.token }}
833
+ - name: Remove keychains and temporary files
834
+ if: always()
835
+ uses: doguyilmaz/tapster@__TAPSTER_SHA__ # __TAPSTER_TAG__
836
+ with: { mode: cleanup, template: 2 }
837
+ attest:
838
+ needs: sign
839
+ if: \${{ !cancelled() && needs.sign.outputs.attest == 'true' }}
840
+ runs-on: ubuntu-24.04
841
+ permissions: { contents: read, id-token: write, attestations: write }
842
+ steps:
843
+ - name: Write the checksums of the signed files
844
+ env: { CHECKSUMS: "\${{ needs.sign.outputs.checksums }}" }
845
+ run: printf '%s\\n' "$CHECKSUMS" > "$RUNNER_TEMP/checksums.txt"
846
+ - name: Attest the signed files
847
+ uses: actions/attest-build-provenance@__ATTEST_SHA__ # __ATTEST_TAG__
848
+ with: { subject-checksums: "\${{ runner.temp }}/checksums.txt" }
849
+ render:
850
+ needs: [check, sign]
851
+ if: \${{ !cancelled() && needs.check.outputs.render == 'true' }}
852
+ runs-on: ubuntu-24.04
853
+ permissions: { contents: write }
854
+ steps:
855
+ - name: Check out the hub
856
+ uses: actions/checkout@__CHECKOUT_SHA__ # __CHECKOUT_TAG__
857
+ with: { persist-credentials: false, ref: main }
858
+ - name: Write casks and the state
859
+ uses: doguyilmaz/tapster@__TAPSTER_SHA__ # __TAPSTER_TAG__
860
+ with: { mode: render, template: 2 }
861
+ env:
862
+ GITHUB_TOKEN: \${{ github.token }}
863
+ linux-build:
864
+ needs: [check, sign]
865
+ if: \${{ !cancelled() && needs.check.outputs.linux == 'true' }}
866
+ runs-on: ubuntu-24.04
867
+ permissions: { contents: read }
868
+ outputs:
869
+ changed: \${{ steps.build.outputs.changed }}
870
+ steps:
871
+ - name: Check out the hub
872
+ uses: actions/checkout@__CHECKOUT_SHA__ # __CHECKOUT_TAG__
873
+ with: { persist-credentials: false, ref: main }
874
+ - name: Build the Linux packages
875
+ id: build
876
+ uses: doguyilmaz/tapster@__TAPSTER_SHA__ # __TAPSTER_TAG__
877
+ with: { mode: linux-build, template: 2 }
878
+ - name: Keep the Linux files for the next job
879
+ if: \${{ steps.build.outputs.changed == 'true' }}
880
+ uses: actions/upload-artifact@__UPLOAD_SHA__ # __UPLOAD_TAG__
881
+ with: { name: linux-unsigned, path: "\${{ runner.temp }}/tapster-linux", if-no-files-found: error, retention-days: 1 }
882
+ linux-sign:
883
+ needs: linux-build
884
+ if: \${{ !cancelled() && needs.linux-build.result == 'success' && needs.linux-build.outputs.changed == 'true' }}
885
+ runs-on: ubuntu-24.04
886
+ environment: { name: tapster, deployment: false }
887
+ permissions: { contents: read }
888
+ steps:
889
+ - name: Install the signing tools from Ubuntu
890
+ run: sudo apt-get update -qq && sudo apt-get install -y -qq --no-install-recommends apt-utils rpm createrepo-c dpkg gnupg
891
+ - name: Check out the hub
892
+ uses: actions/checkout@__CHECKOUT_SHA__ # __CHECKOUT_TAG__
893
+ with: { persist-credentials: false, ref: main }
894
+ - name: Download the Linux files
895
+ uses: actions/download-artifact@__DOWNLOAD_SHA__ # __DOWNLOAD_TAG__
896
+ with: { name: linux-unsigned, path: "\${{ runner.temp }}/tapster-linux" }
897
+ - name: Sign the Linux repositories
898
+ uses: doguyilmaz/tapster@__TAPSTER_SHA__ # __TAPSTER_TAG__
899
+ with: { mode: linux-sign, template: 2 }
900
+ env:
901
+ TAPSTER_LINUX_KEY: \${{ secrets.TAPSTER_LINUX_KEY }}
902
+ TAPSTER_LINUX_KEY_PREVIOUS: \${{ secrets.TAPSTER_LINUX_KEY_PREVIOUS }}
903
+ - name: Keep the signed site for Pages
904
+ uses: actions/upload-artifact@__UPLOAD_SHA__ # __UPLOAD_TAG__
905
+ with: { name: linux-site, path: "\${{ runner.temp }}/tapster-linux", if-no-files-found: error, retention-days: 1 }
906
+ linux-pages:
907
+ needs: linux-sign
908
+ if: \${{ !cancelled() && needs.linux-sign.result == 'success' }}
909
+ runs-on: ubuntu-24.04
910
+ environment: { name: github-pages, url: "\${{ steps.deploy.outputs.page_url }}" }
911
+ permissions: { pages: write, id-token: write }
912
+ steps:
913
+ - name: Download the signed site
914
+ uses: actions/download-artifact@__DOWNLOAD_SHA__ # __DOWNLOAD_TAG__
915
+ with: { name: linux-site, path: site }
916
+ - name: Hand the site to GitHub Pages
917
+ uses: actions/upload-pages-artifact@__PAGES_UPLOAD_SHA__ # __PAGES_UPLOAD_TAG__
918
+ with: { path: site }
919
+ - name: Deploy the Linux repositories
920
+ id: deploy
921
+ uses: actions/deploy-pages@__PAGES_DEPLOY_SHA__ # __PAGES_DEPLOY_TAG__
922
+ `;import{createHash as uE,createPrivateKey as lE,createPublicKey as pE}from"crypto";import{existsSync as ot,readFileSync as Fr}from"fs";import{mkdir as jm,writeFile as da}from"fs/promises";import{join as de}from"path";import{createHash as GP,createPrivateKey as HP,createPublicKey as mm,sign as WP,verify as VP}from"crypto";var kt=2n**255n-19n,ca=2n**252n+27742317777372353535851937790883648493n,F=(e,t=kt)=>(e%t+t)%t,ua=(e,t)=>{let r=1n,n=F(e);for(let s=t;s>0n;s>>=1n){if(s&1n)r=r*n%kt;n=n*n%kt}return r},Is=(e)=>ua(e,kt-2n),wm=F(-121665n*Is(121666n));function gm([e,t,r,n],[s,o,i,a]){let c=F((t-e)*(o-s)),u=F((t+e)*(o+s)),l=F(2n*n*a*wm),f=F(2n*r*i),p=u-c,d=f-l,h=f+l,m=u+c;return[F(p*d),F(h*m),F(d*h),F(p*m)]}function bm(e,t){let r=[0n,1n,1n,0n],n=t;for(let s=e;s>0n;s>>=1n){if(s&1n)r=gm(r,n);n=gm(n,n)}return r}var _m=(()=>{let e=F(4n*Is(5n)),t=F(e*e-1n),r=F(wm*e*e+1n),n=ua(F(t*Is(r)),(kt+3n)/8n);if(F(n*n*r-t)!==0n)n=F(n*ua(2n,(kt-1n)/4n));if(n&1n)n=kt-n;return[n,e,1n,F(n*e)]})(),Os=(e)=>e.reduceRight((t,r)=>t<<8n|BigInt(r),0n);function vm(e){let t=Buffer.alloc(32),r=e;for(let n=0;n<32;n++)t[n]=Number(r&255n),r>>=8n;return t}function km([e,t,r]){let n=Is(r),s=F(e*n),o=F(t*n);return vm(o|(s&1n)<<255n)}var ym=(...e)=>GP("sha512").update(Buffer.concat(e)).digest();function YP(e,t,r){let n=Os(e.subarray(0,32)),s=F(Os(ym(e.subarray(32,64),r)),ca),o=km(bm(s,_m)),i=F(Os(ym(o,t,r)),ca);return Buffer.concat([o,vm(F(s+i*n,ca))])}var JP=Buffer.from("302e020100300506032b657004220420","hex"),QP=Buffer.from("302a300506032b6570032100","hex"),Ts=(e)=>new y(`the Sparkle key ${e}`,"Store the text that generate_keys -x writes, with tapster init --sparkle <label>.");function xm(e){let t=e.trim();if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw Ts("is not base64");let r=Buffer.from(t,"base64");Mt(r.toString("hex"));let n,s;if(r.length===32){let i=HP({key:Buffer.concat([JP,r]),format:"der",type:"pkcs8"}),a=mm(i).export({format:"der",type:"spki"});n=a.subarray(a.length-32),s=(c)=>WP(null,c,i)}else if(r.length===96){let i=r.subarray(0,64);if(Mt(i.toString("base64")),n=Buffer.from(r.subarray(64)),!km(bm(Os(i.subarray(0,32)),_m)).equals(n))throw Ts("is damaged: its two halves do not match");s=(a)=>YP(i,n,a)}else throw Ts(`decodes to ${r.length} bytes, not 32 or 96`);let o=mm({key:Buffer.concat([QP,n]),format:"der",type:"spki"});return{publicKey:n.toString("base64"),sign(i){let a=s(i);if(!VP(null,i,o,a))throw Ts("produced a signature that does not verify");return a}}}function Sm(e,t=""){try{let n=JSON.parse(e);if(typeof n.id==="string"&&typeof n.status==="string")return{id:n.id,status:n.status}}catch{}if(/HTTP status code: 401\b/.test(t))throw new y("Apple rejected the notary key (HTTP 401)","Store the App Store Connect key, its Key ID and the Issuer ID again with tapster init --rotate notary. The draft is untouched.");let r=t.split(`
923
+ `).find((n)=>n.trim()!=="");if(r)throw new y(`notarytool failed: ${ys(r.trim()).slice(0,300)}`,"The draft is untouched; the next run tries again.");throw new y("notarytool returned output tapster could not read","Re-run the workflow; if it repeats, check the App Store Connect key.")}var Am=`# __TAP__
924
+
925
+ \`\`\`sh
926
+ brew tap __TAP__
927
+ brew trust __TAP__
928
+ brew install __TAP__/<name>
929
+ \`\`\`
930
+
931
+ Homebrew loads casks only from taps you trust; \`brew trust\` says that you trust this one.
932
+
933
+ On Windows this repository is also a Scoop bucket:
934
+
935
+ \`\`\`sh
936
+ scoop bucket add __OWNER__ https://github.com/__HUB__
937
+ scoop install __OWNER__/<name>
938
+ \`\`\`
939
+
940
+ | Path | What it holds |
941
+ | --- | --- |
942
+ | \`Casks/\` | Homebrew casks, written by tapster from signed, notarized releases |
943
+ | \`bucket/\` | Scoop manifests for packages with Windows builds |
944
+ | \`tapster.yml\` | which projects this hub publishes |
945
+ | \`.tapster/state.json\` | the releases tapster published |
946
+
947
+ Releases are signed and published by the \`tapster\` workflow; change the projects, not these files.
948
+ `;import{generateKeyPairSync as eE}from"crypto";import{existsSync as tE}from"fs";function $m(){let{privateKey:e,publicKey:t}=eE("ed25519"),r=e.export({format:"der",type:"pkcs8"}).subarray(-32),n=t.export({format:"der",type:"spki"}).subarray(-32);return{seed:r.toString("base64"),publicKey:n.toString("base64")}}var rE=/^[A-Za-z0-9 .:/@_+=()-]+$/;function qr(e){for(let t of[e.service,e.account,e.label,...e.comment===void 0?[]:[e.comment]])if(!rE.test(t))throw new y(`"${t}" cannot name a keychain item`,"Use letters, digits and simple punctuation.")}function nE(e,t){qr(e);let r=e.comment===void 0?"":` -j "${e.comment}"`,n=`add-generic-password -s "${e.service}" -a "${e.account}" -l "${e.label}" -D "private key"${r} -T "" -X ${Buffer.from(t).toString("hex")}
949
+ `;if(n.length>4000)throw new y("the key is too long for one security command","tapster stores large keys through the Security API instead.");return n}var sE=`ObjC.import("Security");
950
+ ObjC.import("Foundation");
951
+ function run(argv) {
952
+ const k = (ref) => ObjC.castRefToObject(ref);
953
+ const access = Ref();
954
+ const made = $.SecAccessCreate($(argv[2]), $.NSArray.array, access);
955
+ if (made !== 0) return String(made);
956
+ const q = $.NSMutableDictionary.alloc.init;
957
+ q.setObjectForKey(k(access[0]), k($.kSecAttrAccess));
958
+ q.setObjectForKey(k($.kSecClassGenericPassword), k($.kSecClass));
959
+ q.setObjectForKey($(argv[0]), k($.kSecAttrService));
960
+ q.setObjectForKey($(argv[1]), k($.kSecAttrAccount));
961
+ q.setObjectForKey($(argv[2]), k($.kSecAttrLabel));
962
+ q.setObjectForKey($.NSFileHandle.fileHandleWithStandardInput.readDataToEndOfFile, k($.kSecValueData));
963
+ return String($.SecItemAdd(q, null));
964
+ }`;function oE(e){return qr(e),["-l","JavaScript","-e",sE,e.service,e.account,e.label]}function iE(e){return qr(e),["store","--label",e.label,"service",e.service,"account",e.account]}var Mr="/usr/bin/security",Pm="/usr/bin/osascript",Ns="/usr/bin/secret-tool",aE={kind:"keychain",exists:async(e)=>(await C(Mr,"security",["find-generic-password","-s",e.service,"-a",e.account],{allowFail:!0})).code===0,async save(e,t){let r=null;try{r=nE(e,t)}catch(s){if(!(s instanceof y)||!s.reason.includes("too long"))throw s}if(r!==null){let s=await C(Mr,"security",["-i"],{stdin:r,allowFail:!0});if(s.code===0&&!/error|returned/i.test(s.stderr))return;throw new y("the login keychain refused the key","Unlock the login keychain and run this again.")}let n=await C(Pm,"osascript",oE(e),{stdin:t,allowFail:!0});if(n.code!==0||n.stdout.trim()!=="0")throw new y(`the login keychain refused the key (status ${n.stdout.trim()||n.code})`,"Unlock the login keychain and run this again.")},async read(e){let t=await C(Mr,"security",["find-generic-password","-s",e.service,"-a",e.account,"-w"],{allowFail:!0});return t.code===0?t.stdout.replace(/\n$/,""):null},async remove(e){await C(Mr,"security",["delete-generic-password","-s",e.service,"-a",e.account],{allowFail:!0})}},Em={kind:"secret-service",exists:async(e)=>await Em.read(e)!==null,async save(e,t){if((await C(Ns,"secret-tool",iE(e),{stdin:t,allowFail:!0})).code!==0)throw new y("the Secret Service refused the key","Unlock your keyring (GNOME Keyring or KWallet) and run this again.")},async read(e){qr(e);let t=await C(Ns,"secret-tool",["lookup","service",e.service,"account",e.account],{allowFail:!0});return t.code===0&&t.stdout!==""?t.stdout:null},async remove(e){qr(e),await C(Ns,"secret-tool",["clear","service",e.service,"account",e.account],{allowFail:!0})}};function la(e=process.platform,t=tE){if(e==="darwin")return t(Mr)&&t(Pm)?aE:null;if(e==="linux")return t(Ns)?Em:null;return null}async function Tm(e,t){let r=await e.read(t);if(r!==null||!await e.exists(t))return r;throw new y("the previous key is in your keychain, but tapster could not read it","Choose Allow when macOS asks, and run this where you can see that question (not over SSH). Nothing was changed.")}function pa(e){let t=la();if(t)return t;throw new y(`tapster keeps a copy of ${e} in your keychain, and this system has none it can use`,"Run this on macOS, or on Linux with secret-tool (libsecret-tools) installed, so the key is never kept only in GitHub, which never gives secrets back.")}import{readFile as cE}from"fs/promises";function Rs(e,t=process.env.HOME??""){let r=e.trim();if(r=r.length>1&&(r[0]==="'"||r[0]==='"')&&r.at(-1)===r[0]?r.slice(1,-1):r.replace(/\\(.)/g,"$1"),!r)throw new y("no path was given","Type the path, or drag the file into the terminal.");return r.replace(/^~(?=\/|$)/,t)}async function Cs(e,t){try{return await cE(e)}catch(r){let n=r.code;if(n==="ENOENT")throw new y(`${e} does not exist`,`Check the path of ${t}.`);if(n==="EISDIR")throw new y(`${e} is a folder`,`Give the path of ${t} itself.`);throw new y(`${e} cannot be read`,`Check that you can open ${t}.`)}}function fE(e,t,r){return{name:`tapster-${e}-${t.split("/")[1].replace(/^homebrew-/,"")}`.toLowerCase().slice(0,34),url:`https://github.com/${t}`,redirect_url:r,public:!1,default_permissions:{contents:"write",attestations:"read",metadata:"read"},default_events:[],hook_attributes:{url:"https://example.com/tapster-has-no-webhook",active:!1}}}function dE(e){return/(?:^|[,/]\s*)OU=([A-Z0-9]{10})(?:[,/]|$)/.exec(e)?.[1]??null}function hE(e,t,r=Date.now()){let n=/(?:^|,)CN=((?:[^,\\]|\\.)*)/.exec(e)?.[1]??"";if(!n.startsWith("Developer ID Application:"))throw new y(`the certificate is "${n||"unnamed"}", not a Developer ID Application certificate`,"Create a Developer ID Application certificate at developer.apple.com, export it with its key from Keychain Access as .p12, then run this again.");let s=dE(e);if(!s)throw new y("the certificate has no team ID","Export the Developer ID Application certificate from Keychain Access.");let o=Date.parse(t);if(Number.isNaN(o))throw new y("the certificate's expiry date cannot be read","Export the certificate again from Keychain Access.");let i=new Date(o).toISOString().slice(0,10);if(o<r)throw new y(`the certificate expired on ${i}`,"Create a new Developer ID Application certificate at developer.apple.com.");return{team:s,expires:i}}function mE(e,t){let r=new Set(e.vars),n=new Set(e.secrets),s=["protect"];if(!(r.has("TAPSTER_APP_ID")&&r.has("TAPSTER_APP_SLUG")))s.push("app");else if(!n.has("TAPSTER_APP_PRIVATE_KEY"))s.push("app-key");if(t&&!(r.has("TAPSTER_TEAM_ID")&&n.has("MACOS_SIGN_P12")&&n.has("MACOS_SIGN_PASSWORD")))s.push("certificate");if(t&&!["MACOS_NOTARY_KEY","MACOS_NOTARY_KEY_ID","MACOS_NOTARY_ISSUER_ID"].every((o)=>n.has(o)))s.push("notary");return s.push("files"),s}var gE=(e,t,r)=>["notarytool","history","--key",e,"--key-id",t,"--issuer",r,"--output-format","json"];function yE(e,t){if(!(e instanceof D)||!t||![403,404,422].includes(e.status))return e;return new y("GitHub refused environments on this private hub","Environments and their secrets need a public hub or GitHub Pro. Make the hub public or upgrade at https://github.com/settings/billing, then run tapster init again.")}function xt(e){let t=e.packages.filter(fe).flatMap((r)=>r.sparkle?[r.sparkle.key,...r.sparkle.next_key?[r.sparkle.next_key]:[]]:[]);return[...new Set(t)]}function Um(e){let t=e.map((r)=>`SPARKLE_KEY_${r.toUpperCase()}: "\${{ secrets.SPARKLE_KEY_${r.toUpperCase()} }}"`);return t.length?`{ ${t.join(", ")} }`:"{}"}function wE(e,t,r){let n=[];for(let s of e.packages.filter(fe)){let o=s.sparkle?.key===t?s.sparkle.public_key:s.sparkle?.next_key===t?s.sparkle.next_public_key:void 0;if(o===void 0)continue;if(o!==r)throw new y(`${s.name} pins ${o} for ${t}, but this key's public half is ${r}`,"Pick the keychain account of the key the app ships with or fix tapster.yml.");n.push(s.name)}if(n.length===0)throw new y(`no package in tapster.yml uses the Sparkle key ${t}`,"Add the package with its sparkle section first.");return n}function ha(e,t,r,n=[],s=10){return e.replaceAll("__CRON__",na(s)).replaceAll("__SPARKLE_ENV__",Um(n)).replaceAll("__CHECKOUT_SHA__",t["actions/checkout"].sha).replaceAll("__CHECKOUT_TAG__",t["actions/checkout"].tag).replaceAll("__ATTEST_SHA__",t["actions/attest-build-provenance"].sha).replaceAll("__ATTEST_TAG__",t["actions/attest-build-provenance"].tag).replaceAll("__UPLOAD_SHA__",t["actions/upload-artifact"].sha).replaceAll("__UPLOAD_TAG__",t["actions/upload-artifact"].tag).replaceAll("__DOWNLOAD_SHA__",t["actions/download-artifact"].sha).replaceAll("__DOWNLOAD_TAG__",t["actions/download-artifact"].tag).replaceAll("__PAGES_UPLOAD_SHA__",t["actions/upload-pages-artifact"].sha).replaceAll("__PAGES_UPLOAD_TAG__",t["actions/upload-pages-artifact"].tag).replaceAll("__PAGES_DEPLOY_SHA__",t["actions/deploy-pages"].sha).replaceAll("__PAGES_DEPLOY_TAG__",t["actions/deploy-pages"].tag).replaceAll("__TAPSTER_SHA__",r.sha).replaceAll("__TAPSTER_TAG__",r.tag)}async function Zm(e,t,r,n,s){let o=new Oe(qt(e,t));console.log("Waiting until the App is installed; tapster continues by itself once you choose Install.");let i=await ks(()=>o.json("GET",`/users/${r}/installation`).then((c)=>c.id,()=>null));if(i===null){console.log(`The App is not installed yet. Install it at https://github.com/apps/${s}/installations/new; tapster add links there for each project too.`);return}if(await o.json("GET",`/repos/${n}/installation`).then(()=>!0,()=>!1))console.log(`The App is installed on ${n}; remove ${n} from it at https://github.com/settings/installations/${i}, or the hub refuses to run.`)}async function bE(e,t){console.log("GitHub creates a private App for your hub; it lets the hub publish your projects' releases. Confirm it on the page that opens.");let r=await _s((n)=>fE(e,t,n),"your tapster App");await Ie(t,"TAPSTER_APP_ID",String(r.id)),await Ie(t,"TAPSTER_APP_SLUG",r.slug),await ee(t,"TAPSTER_APP_PRIVATE_KEY",r.pem),console.log('Stored the App and its key in the hub. Now install it: choose "Only select repositories" and pick the projects tapster should publish.'),console.log(`Never pick ${t}: the App can write to every repository it is installed on, and the hub holds your signing keys. tapster add can also install it on a project later.`),vt(`https://github.com/apps/${r.slug}/installations/new`),await Zm(String(r.id),r.pem,e,t,r.slug)}function _E(e){let t;try{t=lE(e)}catch{throw new y("that file is not a private key","Use the .pem file GitHub downloaded when you generated the key.")}if(t.asymmetricKeyType!=="rsa")throw new y("that file is not a GitHub App key","Use the .pem file GitHub downloaded when you generated the key.");let r=pE(t).export({type:"spki",format:"der"});return`SHA256:${uE("sha256").update(r).digest("base64")}`}async function Om(e,t){let r=await e.json("GET",`/repos/${t}/environments/tapster/variables`),n=r.variables.find((c)=>c.name==="TAPSTER_APP_ID")?.value,s=r.variables.find((c)=>c.name==="TAPSTER_APP_SLUG")?.value;if(!n||!s)throw new y("the hub has no App yet","Run tapster init first.");console.log(`Open the App's settings, scroll to "Private keys" and click "Generate a private key":`),vt(`https://github.com/settings/apps/${s}`);let o=Rs(await te("Path of the downloaded .pem file (drag it here): ")),i=(await Cs(o,"the .pem file")).toString("utf8"),a=_E(i);await new Oe(qt(n,i)).json("GET","/app").catch(()=>{throw new y("that key does not belong to the hub's App",`Generate the key on https://github.com/settings/apps/${s}.`)}),await ee(t,"TAPSTER_APP_PRIVATE_KEY",i),console.log(`Stored the new key (${a}).`),await Zm(n,i,t.split("/")[0],t,s),console.log(`Now delete every other key on that page so the old one stops working. Then delete ${o}.`)}async function Im(e){console.log("Apple certificate: a Developer ID Application certificate exported as .p12. In Keychain Access, open My Certificates,"),console.log('right-click "Developer ID Application: ...", choose Export and save it as .p12 with a password. Create one at'),console.log("https://developer.apple.com/account/resources/certificates if you have none. It stays in your hub's secrets only.");let t=Rs(await te(".p12 file (drag it here): ")),r=await Cs(t,"the .p12 file"),n=await te(".p12 password: ",!0),s=await Te("openssl",["pkcs12","-in",t,"-passin","env:TAPSTER_P12","-nokeys","-clcerts"],{env:{TAPSTER_P12:n},allowFail:!0});if(s.code!==0||!s.stdout.includes("BEGIN CERTIFICATE"))throw new y("the .p12 could not be opened with that password","Check the password you set when exporting it, or export it again.");let o=await Te("openssl",["x509","-noout","-subject","-enddate","-nameopt","RFC2253"],{stdin:s.stdout}),i=/^subject=\s*(.*)$/m.exec(o.stdout)?.[1]?.trim()??"",a=/^notAfter=(.*)$/m.exec(o.stdout)?.[1]?.trim()??"",{team:c,expires:u}=hE(i,a);await ee(e,"MACOS_SIGN_P12",r.toString("base64")),await ee(e,"MACOS_SIGN_PASSWORD",n),await Ie(e,"TAPSTER_TEAM_ID",c),await Ie(e,"TAPSTER_CERT_EXPIRES",u),console.log(`Certificate stored for team ${c}; it expires on ${u}, and the hub warns 30 days before.`)}async function vE(e,t,r){if(process.platform!=="darwin"||!ot(ws.xcrun)){console.log("Not on macOS, so the key is checked at the first release instead.");return}let n=await C(ws.xcrun,"xcrun",gE(e,t,r),{allowFail:!0});if(n.code!==0)Sm("",n.stderr);console.log("Apple accepted the key.")}async function Nm(e){console.log("Notarization key: an App Store Connect API key. In App Store Connect open Users and Access, Integrations,"),console.log("App Store Connect API, Team Keys; create a key with Developer access and download AuthKey_<id>.p8 (Apple offers"),console.log("the download once). The Key ID is in the list and the Issuer ID above it. It stays in your hub's secrets only.");let t=Rs(await te(".p8 file (drag it here): ")),r=await Cs(t,"the .p8 file");if(!r.toString("utf8").includes("BEGIN PRIVATE KEY"))throw new y("that file is not an App Store Connect key","Download the .p8 from App Store Connect, Users and Access, Integrations.");let n=await te("Key ID: ");if(!/^[A-Z0-9]{10}$/.test(n))throw new y(`${n||"an empty Key ID"} is not a Key ID`,"Copy the 10-character Key ID next to the key in App Store Connect.");let s=(await te("Issuer ID: ")).toLowerCase();if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(s))throw new y("that is not an Issuer ID","Copy the Issuer ID shown above the key list in App Store Connect.");await vE(t,n,s),await ee(e,"MACOS_NOTARY_KEY",r.toString("base64")),await ee(e,"MACOS_NOTARY_KEY_ID",n),await ee(e,"MACOS_NOTARY_ISSUER_ID",s),console.log(`Notarization key stored. You may delete ${t} once you keep a backup.`)}var fa={name:"tapster main",target:"branch",enforcement:"active",bypass_actors:[],conditions:{ref_name:{include:["~DEFAULT_BRANCH"],exclude:[]}},rules:[{type:"deletion"},{type:"non_fast_forward"}]};async function kE(e,t,r){try{await e.json("PUT",`/repos/${t}/environments/tapster`,{deployment_branch_policy:{protected_branches:!1,custom_branch_policies:!0}})}catch(o){throw yE(o,r)}let n=await e.json("GET",`/repos/${t}/environments/tapster/deployment-branch-policies`);for(let o of n.branch_policies.filter((i)=>i.name!=="main"))await e.json("DELETE",`/repos/${t}/environments/tapster/deployment-branch-policies/${o.id}`);if(!n.branch_policies.some((o)=>o.name==="main"))await e.json("POST",`/repos/${t}/environments/tapster/deployment-branch-policies`,{name:"main",type:"branch"});await e.json("PUT",`/repos/${t}/actions/permissions/workflow`,{default_workflow_permissions:"read",can_approve_pull_request_reviews:!1}),await e.json("PUT",`/repos/${t}/actions/permissions`,{enabled:!0,allowed_actions:"selected",sha_pinning_required:!0}),await e.json("PUT",`/repos/${t}/actions/permissions/selected-actions`,{github_owned_allowed:!0,verified_allowed:!1,patterns_allowed:["doguyilmaz/tapster@*"]});let s=(await e.json("GET",`/repos/${t}/rulesets`)).find((o)=>o.name===fa.name);if(s)await e.json("PUT",`/repos/${t}/rulesets/${s.id}`,fa);else await e.json("POST",`/repos/${t}/rulesets`,fa)}async function xE(e,t,r){if(r===null){if(t.sha)return{sha:t.sha,tag:`v${t.version}`};throw new y("this tapster was built from a checkout, so it does not know which tapster the hub should run","Pass --tapster <commit> with a full commit SHA from tapster's main, or use a released tapster.")}if(!/^[0-9a-f]{40}$/.test(r))throw new y(`${r} is not a full commit SHA`,"Pass all 40 characters of the commit.");let n=await e.json("GET",`/repos/doguyilmaz/tapster/compare/${r}...main`);if(n.status!=="ahead"&&n.status!=="identical")throw new y(`${r} is not on tapster's main`,"Pin a commit that is on main.");return{sha:r,tag:"main"}}var Rm=/doguyilmaz\/tapster@([0-9a-f]{40}) # (\S+)/;function SE(e,t){let r=(o)=>`${o[2]} (${o[1].slice(0,7)})`,n=Rm.exec(t),s=e===null?null:Rm.exec(e);if(!s)return`tapster ${r(n)}`;return s[1]===n[1]&&s[2]===n[2]?`tapster ${r(s)}, unchanged`:`tapster ${r(s)} -> ${r(n)}`}function AE(e,t){let r=/(\n\s+with: \{ mode: sparkle(?:, template: \d+)? \}\n\s+env: ).*\n/;if(!r.test(e))throw new y("the hub workflow has no sparkle step","Run tapster init --workflow to rewrite it from the template.");return e.replace(r,(n,s)=>`${s}${Um(t)}
965
+ `)}function Kr(e,t){let r=de(e,"tapster.yml");if(!ot(r))throw new y("tapster.yml is missing","Run tapster init in the hub first.");let{config:n,invalid:s}=bt(Fr(r,"utf8"),t.split("/")[0]);for(let o of s)console.log(`note: ${o.name} in tapster.yml is invalid and left out: ${o.reason}`);return n}function $E(e,t){let r=de(e,"tapster.yml");return ot(r)?xt(bt(Fr(r,"utf8"),t).config):[]}var st=".github/workflows/tapster.yml";async function Mm(e,t,r,n,s){let o=await xE(e,nt,n),i=ot(de(t,st))?Fr(de(t,st),"utf8"):null,a=i===null?null:Gt(i),c=s.every??a??(s.isPrivate?60:10),u=ha(Es,Re,o,r,c);if(await jm(de(t,".github/workflows"),{recursive:!0}),await da(de(t,st),u),console.log(`wrote ${st} from the template, ${SE(i,u)}; hand edits in it are replaced`),c===a)return;if(console.log(`The hub looks for new drafts every ${c} minutes; change it with tapster init --workflow --every <minutes>.`),a!==null)console.log("If the hub has a doorbell, run tapster init --rotate doorbell after you push, so it keeps the same schedule.");if(s.isPrivate&&c>=60&&s.every===null)console.log("GitHub bills every run of a private hub as at least one minute: every 10 minutes would use about 4,300 of the 2,000 free minutes a month. The doorbell (tapster init --doorbell) still publishes right after each release.")}async function qm(e,t){let r=de(e,st);if(!ot(r))throw new y(`${st} is missing`,"Run tapster init --workflow first.");await da(r,AE(Fr(r,"utf8"),t)),console.log(`updated the sparkle step in ${st}`)}async function PE(e,t,r,n,s){if(!/^[a-z0-9]+$/.test(n))throw new y(`${n} is not a valid label`,"Use lowercase letters and digits, as in sparkle.key.");let o=Kr(t,r),i=await Te("security",["find-generic-password","-s","https://sparkle-project.org","-a",s,"-w"],{allowFail:!0});if(i.code!==0)throw new y(`the login keychain has no Sparkle key for the account ${s}`,"Pass the account generate_keys used with --account (ed25519 by default).");let a=i.stdout.trim(),c=xm(a),u=wE(o,n,c.publicKey);if(console.log(`The key ${c.publicKey} signs updates for ${u.join(", ")}.`),console.log("If it is lost, installed copies can never update again; if it leaks, anyone can sign updates for them."),await te("Do you keep an offline backup of this key? Type yes to store it in the hub: ")!=="yes")throw new y("no offline backup confirmed","Back the key up first (generate_keys -x exports it), then run this again.");await ee(r,`SPARKLE_KEY_${n.toUpperCase()}`,a),console.log(`Stored SPARKLE_KEY_${n.toUpperCase()}.`),await qm(t,xt(o)),console.log("Review and commit the workflow change, then push.")}async function EE(e,t,r){if(!/^[a-z0-9]+$/.test(r))throw new y(`${r} is not a valid label`,"Use lowercase letters and digits, as in sparkle.key.");let n=Kr(e,t),s=n.packages.filter(fe).filter((c)=>c.sparkle?.key===r||c.sparkle?.next_key===r);if(s.length)throw new y(`${s.map((c)=>c.name).join(", ")} already sign with the Sparkle key ${r}`,"A new key needs a new label. To change an app's key, follow the Sparkle key change in the README.");let o=pa("the Sparkle key"),i={service:"https://sparkle-project.org",account:r,label:"Private key for signing Sparkle updates"};if(await o.exists(i))throw new y(`your keychain already has a Sparkle key for the account ${r}`,`Store that one with tapster init --sparkle ${r} --account ${r}, or pick another label.`);let a=$m();if(await o.save({...i,comment:`Public key (SUPublicEDKey value) for this key is: ${a.publicKey}`},a.seed),console.log(`Saved a new Sparkle key in your ${o.kind==="keychain"?"login keychain":"keyring"} under the account ${r}; Sparkle's own tools find it there, and macOS asks you before any app reads it.`),console.log(`Its public key is ${a.publicKey}. Put it in the app as SUPublicEDKey and in tapster.yml as sparkle.public_key.`),console.log("If this key is lost, installed copies can never update again. Keep an offline copy too, for example in your password manager:"),console.log(o.kind==="keychain"?` security find-generic-password -s https://sparkle-project.org -a ${r} -w (macOS asks you first)`:` secret-tool lookup service https://sparkle-project.org account ${r}`),await te("Type yes once you keep an offline copy, to store the key in the hub: ")!=="yes"){console.log(`Not stored in the hub yet. Once you keep a copy, run tapster init --sparkle ${r} --account ${r}.`);return}await ee(t,`SPARKLE_KEY_${r.toUpperCase()}`,a.seed),console.log(`Stored SPARKLE_KEY_${r.toUpperCase()} in the hub.`),await qm(e,[...new Set([...xt(n),r])]),console.log("Review and commit the workflow change, then push.")}async function Cm(e,t,r){let n={...t,account:`${t.account} pending`,label:`${t.label} (pending)`};await e.remove(n),await e.save(n,r),await e.remove(t),await e.save(t,r),await e.remove(n)}var Br=(e,t=!1)=>({service:"tapster-linux-key",account:t?`${e} previous`:e,label:`tapster Linux key for ${e}${t?" (previous)":""}`});async function TE(e,t){if((await e.json("GET",`/repos/${t}/environments/tapster/secrets`)).secrets.map((n)=>n.name).includes("TAPSTER_LINUX_KEY_PREVIOUS"))await Zh(t,"TAPSTER_LINUX_KEY_PREVIOUS");await la()?.remove(Br(t,!0)),console.log("The previous Linux key no longer signs; apt and dnf trust only the new one from the next run.")}function OE(e,t){if(e.includes("TAPSTER_LINUX_KEY")&&!t)throw new y("the hub already has a Linux signing key","Replacing it makes every apt and dnf user fetch the new key. To do that, run tapster init --rotate linux.")}async function zm(e,t,r,n){let s=Kr(t,r),o=(await e.json("GET",`/repos/${r}/environments/tapster/secrets`)).secrets.map((l)=>l.name);OE(o,n);let i=pa("the Linux signing key"),a=["/opt/homebrew/bin/gpg","/usr/local/bin/gpg","/usr/bin/gpg"].find((l)=>ot(l));if(!a)throw new y("gpg is not installed","Install it with brew install gnupg, then run this again.");await e.json("POST",`/repos/${r}/pages`,{build_type:"workflow"}).catch(async(l)=>{if(!(l instanceof D)||l.status!==409)throw new y("GitHub Pages could not be turned on for the hub","A private hub needs a paid plan for Pages; make the hub public or turn Pages on by hand with GitHub Actions as the source.");await e.json("PUT",`/repos/${r}/pages`,{build_type:"workflow"})}),console.log("GitHub Pages serves the hub from GitHub Actions.");let c=Ft("tl-"),u={GNUPGHOME:c};try{await C(a,"gpg",["--batch","--pinentry-mode","loopback","--passphrase","","--quick-gen-key",`${r.split("/")[0]} tapster (${r})`,"rsa4096","sign","never"],{env:u});let l=(await C(a,"gpg",["--batch","--armor","--export-secret-keys"],{env:u})).stdout,f=(await C(a,"gpg",["--batch","--with-colons","--list-secret-keys"],{env:u})).stdout.split(`
966
+ `).find((h)=>h.startsWith("fpr:"))?.split(":")[9],p=null;if(n){if(i.kind==="keychain")console.log("macOS asks whether tapster may read the previous key from your keychain; choose Allow.");p=await Tm(i,Br(r))}let d={...Br(r),account:`${r} new`,label:`tapster Linux key for ${r} (new)`};if(await i.remove(d),await i.save(d,l),await ee(r,"TAPSTER_LINUX_KEY",l),p)await ee(r,"TAPSTER_LINUX_KEY_PREVIOUS",p);if(p)await Cm(i,Br(r,!0),p);if(await Cm(i,Br(r),l),await i.remove(d),console.log(`Stored the Linux key (fingerprint ${f}) in the hub and in your ${i.kind==="keychain"?"login keychain":"keyring"} as "tapster-linux-key".`),p)console.log("The previous key keeps signing next to the new one, so apt and dnf users can fetch the new key. Once they have, run tapster init --rotate linux --finish.");else if(n)console.log("The previous key is not in your keychain, so apt and dnf users must fetch the new key before they can update.")}finally{await C(de(a,"..","gpgconf"),"gpgconf",["--kill","all"],{env:u,allowFail:!0}).catch(()=>{return}),rt(c)}if(!s.packages.some((l)=>!fe(l)&&l.linux))console.log("No package sets linux: true yet; add it to the CLI packages that should ship to apt and dnf.")}async function IE(e,t,r,n,s){let[o,i]=r.split("/"),a=`${o}/${i.replace(/^homebrew-/,"")}`,c=async(u,l)=>{if(ot(de(t,u)))return;await jm(de(t,u,".."),{recursive:!0}),await da(de(t,u),l),console.log(`wrote ${u}`)};await c("tapster.yml",`version: 1
967
+ tap: ${a}
968
+ packages: []
969
+ `),await c(".tapster/state.json",`${JSON.stringify({version:1,packages:{}},null,2)}
970
+ `),await c("README.md",Am.replaceAll("__TAP__",a).replaceAll("__OWNER__",o).replaceAll("__HUB__",r)),await Mm(e,t,$E(t,o),n,s)}async function NE(e){let t=(await te(e)).toLowerCase();return t===""||t==="y"||t==="yes"}async function RE(e,t){let r=async(n)=>{try{return((await e.json("GET",`/repos/${t}/environments/tapster/${n}?per_page=100`))[n]??[]).map((o)=>o.name)}catch(s){if(s instanceof D&&s.status===404)return[];throw s}};return{vars:await r("variables"),secrets:await r("secrets"),private:(await e.getRepo(t)).private}}function Lm(e,t){let r=e.indexOf(t);if(r<0)return{value:null,rest:e};return{value:e[r+1]??"",rest:e.filter((n,s)=>s!==r&&s!==r+1)}}var CE="Run tapster init --help for the options.";function zE(e){let[t,r,n,s]=e;if(e.length===0)return{kind:"setup"};if(t==="--rotate"&&e.length===2&&["app","certificate","notary","doorbell","linux"].includes(r??""))return{kind:"rotate",what:r};if(t==="--rotate"&&r==="linux"&&n==="--finish"&&e.length===3)return{kind:"rotate",what:"linux-finish"};if(t==="--doorbell"&&e.length===1)return{kind:"doorbell"};if(t==="--linux"&&e.length===1)return{kind:"linux"};if(t==="--workflow"&&e.length===1)return{kind:"workflow"};if(t==="--sparkle"&&r&&!r.startsWith("-")){if(e.length===2)return{kind:"sparkle",label:r,account:"ed25519"};if(n==="--new"&&e.length===3)return{kind:"sparkle-new",label:r};if(n==="--account"&&s&&e.length===4)return{kind:"sparkle",label:r,account:s}}throw new y(`unknown option ${e.join(" ")}`,CE)}function Dm(e){let t=de(e,st);return ot(t)&&Gt(Fr(t,"utf8"))||10}async function Bm(e){let t=Lm(e,"--tapster"),r=Lm(t.rest,"--every"),n=t.value,s=r.value===null?null:Number(r.value),o=zE(r.rest);if(s!==null)na(s);if((n!==null||s!==null)&&o.kind!=="setup"&&o.kind!=="workflow")throw new y("--tapster and --every go only with tapster init or init --workflow","Those are the commands that write the workflow.");let i=process.cwd(),a=await Kt(i),c=await Bt();if(o.kind==="rotate"){if(o.what==="app")return Om(c,a);if(o.what==="certificate")return Im(a);if(o.what==="notary")return Nm(a);if(o.what==="doorbell")return Jh(c,a,Dm(i));if(o.what==="linux-finish")return TE(c,a);return zm(c,i,a,!0)}if(o.kind==="doorbell")return Yh(c,a,Kr(i,a),vs,Dm(i));if(o.kind==="linux")return zm(c,i,a,!1);if(o.kind==="sparkle-new")return EE(i,a,o.label);if(o.kind==="sparkle")return PE(c,i,a,o.label,o.account);if(o.kind==="workflow")return Mm(c,i,xt(Kr(i,a)),n,{every:s,isPrivate:(await c.getRepo(a)).private});let u=await RE(c,a),f=u.vars.includes("TAPSTER_TEAM_ID")||u.secrets.includes("MACOS_NOTARY_KEY")||await NE("Will this hub sign software for macOS (Mac apps or CLI tools with macOS builds)? [Y/n] "),p=mE(u,f),d=["app","certificate","notary"].filter((h)=>!p.includes(h)&&(h==="app"||f));if(d.length)console.log(`Already done: ${d.join(", ")}. To redo one, run tapster init --rotate <name>.`);for(let h of p){if(h==="protect")await kE(c,a,u.private);if(h==="app")await bE(a.split("/")[0],a);if(h==="app-key")await Om(c,a);if(h==="certificate")await Im(a);if(h==="notary")await Nm(a);if(h==="files")await IE(c,i,a,n,{every:s,isPrivate:u.private})}if(!f)console.log("Skipped the Apple credentials. Add them later with tapster init --rotate certificate and tapster init --rotate notary.");console.log(`
971
+ Done. Review and commit the new files, push, then run tapster add in each project.`)}var B=(e,t)=>({name:e,ok:!0,fix:"",...t?{note:t}:{}}),R=(e,t)=>({name:e,ok:!1,fix:t});function LE(e){let r=X(e)?.on,n=r&&typeof r==="object"&&!Array.isArray(r)?Object.keys(r):[];return n.length>0&&n.every((s)=>s==="schedule"||s==="workflow_dispatch")?B("the hub workflow runs only on schedule and manual dispatch"):R("the hub workflow runs only on schedule and manual dispatch","Other triggers (pull_request_target, issue_comment, workflow_run) would reach the credentials. Restore .github/workflows/tapster.yml with tapster init.")}function DE(e){let r=(s)=>{let o;try{o=X(s)}catch{return!0}let i=o?.jobs;if(!i||typeof i!=="object")return!1;return Object.values(i).some((a)=>{let c=a?.environment,u=typeof c==="object"&&c!==null?c.name:c;return typeof u==="string"&&(u.trim().toLowerCase()==="tapster"||u.includes("${{"))})},n=Object.entries(e).filter(([,s])=>r(s)).map(([s])=>s);return n.length===0?B("no other workflow uses the tapster environment"):R("no other workflow uses the tapster environment",`Remove the tapster environment from ${n.join(", ")}.`)}function jE(e,t,r){let s=xt(e),o=s.filter((a)=>!t.includes(`SPARKLE_KEY_${a.toUpperCase()}`));if(o.length)return R("every Sparkle key is stored and passed to the sparkle step",o.map((a)=>`Run tapster init --sparkle ${a}.`).join(" "));let i=s.filter((a)=>!r.includes(`SPARKLE_KEY_${a.toUpperCase()}: "\${{ secrets.SPARKLE_KEY_${a.toUpperCase()} }}"`));if(i.length)return R("every Sparkle key is stored and passed to the sparkle step",`The workflow does not pass ${i.map((a)=>`SPARKLE_KEY_${a.toUpperCase()}`).join(", ")}. Run tapster init --workflow.`);return B("every Sparkle key is stored and passed to the sparkle step")}function UE(e,t){let n=Object.entries(t).filter(([,s])=>s!==e).map(([s])=>s);return n.length?R("every project rings the hub's doorbell",n.map((s)=>`gh variable set TAPSTER_DOORBELL --repo ${s} --body ${e}`).join("; ")):B("every project rings the hub's doorbell")}function ZE(e,t,r,n){if(!r.includes("TAPSTER_LINUX_KEY"))return R("the Linux repositories can be signed and deployed","Run tapster init --linux to make and store the signing key.");if(!n)return R("the Linux repositories can be signed and deployed","Turn on GitHub Pages for the hub; tapster init --linux does it.");if(n.build_type!=="workflow")return R("the Linux repositories can be signed and deployed","Set the hub's Pages source to GitHub Actions; tapster init --linux does it.");let o=n.html_url.replace(/\/$/,"");if(o!==lh(e,t))return R("the Linux repositories can be signed and deployed",`Pages serves ${o}; set linux.url in tapster.yml to it.`);return B("the Linux repositories can be signed and deployed")}var Km=["MACOS_SIGN_P12","MACOS_SIGN_PASSWORD","MACOS_NOTARY_KEY","MACOS_NOTARY_KEY_ID","MACOS_NOTARY_ISSUER_ID"],ME=[...Km,"TAPSTER_APP_PRIVATE_KEY"];function qE(e,t,r){let s=e?.packages.some(uh)??!1,o=[...["TAPSTER_APP_PRIVATE_KEY",...s?Km:[]].filter((a)=>!t.includes(a)),...["TAPSTER_APP_ID","TAPSTER_APP_SLUG",...s?["TAPSTER_TEAM_ID"]:[]].filter((a)=>!r.includes(a))];if(o.length===0)return B("the credentials this hub needs are stored");let i=[...o.some((a)=>a.startsWith("TAPSTER_APP"))?["tapster init"]:[],...o.some((a)=>a.startsWith("MACOS_SIGN")||a==="TAPSTER_TEAM_ID")?["tapster init --rotate certificate"]:[],...o.some((a)=>a.startsWith("MACOS_NOTARY"))?["tapster init --rotate notary"]:[]];return R("the credentials this hub needs are stored",`Missing: ${o.join(", ")}. Run ${i.join(" and ")}.`)}var BE=/doguyilmaz\/tapster@([0-9a-f]{40}) # (\S+)/;function KE(e,t){let n=BE.exec(e);if(!n)return R("the hub workflow is tapster's template","The workflow does not pin tapster. Run tapster init --workflow.");if(n[1]!==t.sha)return B("the hub workflow is tapster's template",`the hub runs tapster ${n[2]} (${n[1].slice(0,7)}) and this is tapster ${t.version}; tapster init --workflow moves the hub to this one, and the tapster that wrote the workflow checks it byte for byte`);let s=[...e.matchAll(/SPARKLE_KEY_([A-Z0-9]+): "/g)].map((i)=>i[1].toLowerCase());return ha(Es,Re,{sha:n[1],tag:n[2]},s,Gt(e)??10)===e?B("the hub workflow is tapster's template"):R("the hub workflow is tapster's template","The workflow differs from the template; hand edits can reach the credentials. Run tapster init --workflow and review the diff.")}function FE(e){return e.some((n)=>n.enforcement==="active"&&n.target==="branch"&&(n.conditions?.ref_name?.include??[]).some((s)=>s==="~DEFAULT_BRANCH"||s==="~ALL"||s==="refs/heads/main")&&(n.conditions?.ref_name?.exclude??[]).length===0&&["deletion","non_fast_forward"].every((s)=>(n.rules??[]).some((o)=>o.type===s))&&(n.bypass_actors??[]).every((s)=>s.actor_type==="RepositoryRole"&&s.actor_id===5))?B("main cannot be deleted or force-pushed, by anyone"):R("main cannot be deleted or force-pushed, by anyone",'Run tapster init to restore the ruleset "tapster main" (active, deletion and force pushes blocked, no one else may bypass).')}function GE(e,t){return e.allowed_actions==="selected"&&e.sha_pinning_required===!0&&t?.verified_allowed===!1&&(t.patterns_allowed??[]).every((s)=>s==="doguyilmaz/tapster@*")?B("the hub runs only GitHub's and tapster's actions, pinned by commit"):R("the hub runs only GitHub's and tapster's actions, pinned by commit","Run tapster init to restore the hub's Actions policy.")}function HE(e,t,r){let s=e.map((a)=>a.login).filter((a)=>a.toLowerCase()!==r.toLowerCase()),o=t.filter((a)=>!a.read_only).map((a)=>a.title);if(s.length===0&&o.length===0)return B("only you can change the hub");let i=[...s.length?[`collaborators ${s.join(", ")} can push to main and change what the hub signs`]:[],...o.length?[`deploy keys ${o.join(", ")} can push too`]:[]];return R("only you can change the hub",`${i.join("; ")}. Remove them in the hub's settings unless you trust them with your signing keys.`)}function WE(e,t){if(e===String(t))return B("the doorbell keeps the workflow's schedule");return R("the doorbell keeps the workflow's schedule",`The doorbell starts the hub every ${e??"10"} minutes and the workflow every ${t}. Run tapster init --rotate doorbell to move the doorbell to the workflow's schedule.`)}function VE(e,t,r){if(e.some((o)=>(o.event==="schedule"||o.event==="workflow_dispatch")&&t-Date.parse(o.created_at)<86400000))return B("the hub ran in the last day");return R("the hub ran in the last day",r?"Neither GitHub's schedule nor the doorbell started a run. Check the doorbell's logs with wrangler tail and the workflow in the Actions tab.":"GitHub's schedule did not start a run; it is best effort. tapster init --doorbell adds a second clock that starts the hub on time.")}async function qe(e,t,r){try{let n=await e.json("GET",t);return(r?n[r]:n)??[]}catch(n){if(n instanceof D&&n.status===404)return[];throw n}}async function YE(e,t,r,n,s){let o=[],i=await e.json("GET",`/repos/${t}/environments/tapster`).catch(()=>null);if(!i)return[R("the tapster environment exists","Run tapster init.")];let a=await e.json("GET",`/repos/${t}/environments/tapster/deployment-branch-policies`);o.push(i.deployment_branch_policy?.custom_branch_policies&&a.branch_policies.length===1&&a.branch_policies[0].name==="main"&&(a.branch_policies[0].type??"branch")==="branch"?B("only main may open the tapster environment"):R("only main may open the tapster environment","Run tapster init to restore the branch rule."));let c=(await qe(e,`/repos/${t}/environments/tapster/secrets?per_page=100`,"secrets")).map((b)=>b.name),u=await qe(e,`/repos/${t}/environments/tapster/variables?per_page=100`,"variables");o.push(qE(n,c,u.map((b)=>b.name)));let l=u.find((b)=>b.name==="TAPSTER_CERT_EXPIRES")?.value;if(l&&Date.parse(`${l}T00:00:00Z`)-Date.now()<2592000000)o.push(R("the Developer ID certificate is valid for 30 more days",`It expires on ${l}. Renew it at developer.apple.com, then run tapster init --rotate certificate.`));if(n&&xt(n).length)o.push(jE(n,c,s));if(n?.packages.some((b)=>!fe(b)&&b.linux)){let b=await e.json("GET",`/repos/${t}/pages`).catch(()=>null);if(o.push(ZE(n,t,c,b)),c.includes("TAPSTER_LINUX_KEY_PREVIOUS"))o.push(B("the Linux key rotation is running","the previous Linux key still signs; once apt and dnf users have the new key, run tapster init --rotate linux --finish"))}let f=await qe(e,`/repos/${t}/actions/variables?per_page=100`,"variables"),p=[...u,...f].map((b)=>b.name).filter((b)=>ME.includes(b)||/^SPARKLE_KEY_/.test(b)||b.startsWith("TAPSTER_LINUX_KEY"));o.push(p.length?R("credentials are secrets, not variables",`Variables are readable by anyone with access; delete ${p.join(", ")} and store them with tapster init --rotate.`):B("credentials are secrets, not variables"));let d=u.find((b)=>b.name==="TAPSTER_DOORBELL")?.value;if(d&&n){let b={};for(let v of n.packages)b[v.repo]=await e.json("GET",`/repos/${v.repo}/actions/variables/TAPSTER_DOORBELL`).then((k)=>k.value).catch(()=>null);o.push(UE(d,b)),o.push(WE(u.find((v)=>v.name==="TAPSTER_DOORBELL_EVERY")?.value,Gt(s)??10))}let h=await e.json("GET",`/repos/${t}/actions/permissions/workflow`);o.push(h.default_workflow_permissions==="read"?B("the default workflow token is read-only"):R("the default workflow token is read-only","Run tapster init."));let m=await Promise.all((await qe(e,`/repos/${t}/rulesets`)).map((b)=>e.json("GET",`/repos/${t}/rulesets/${b.id}`)));o.push(FE(m));let g=await e.json("GET",`/repos/${t}/actions/permissions`),_=g.allowed_actions==="selected"?await e.json("GET",`/repos/${t}/actions/permissions/selected-actions`):null;o.push(GE(g,_)),o.push(HE(await qe(e,`/repos/${t}/collaborators?affiliation=direct&per_page=100`),await qe(e,`/repos/${t}/keys?per_page=100`),r));let S=await e.json("GET",`/repos/${t}/actions/workflows/tapster.yml`).catch(()=>null);o.push(S?.state==="active"?B("the hub workflow is enabled"):R("the hub workflow is enabled","Enable the tapster workflow in the hub's Actions tab (GitHub pauses it after 60 days without activity; the doorbell turns it back on)."));let x=await qe(e,`/repos/${t}/actions/workflows/tapster.yml/runs?per_page=30`,"workflow_runs");o.push(VE(x,Date.now(),Boolean(d)));for(let b of n?.packages??[]){let v=await e.getRepo(b.repo).catch((T)=>T instanceof D?null:Promise.reject(T));if(!v){o.push(R(`${b.repo} exists`,"Fix the repo field in tapster.yml."));continue}if(v.private)o.push(B(`${b.repo} is published by the hub`,`${b.repo} is private: the hub publishes its releases, but Homebrew, Scoop, apt and dnf users can only install from public projects`));if(b.protection==="off")o.push(B(`${b.repo} is protected`,`protection is off for ${b.name}: a stolen App key could tag code there that the hub would sign`));else{let T=await Qi(e,b.repo,v.default_branch,"admin",b.protection==="dependabot"),P=b.protection==="dependabot"?`branches named dependabot/... are open on ${b.repo}, so a stolen App key could run its workflows on code of its own there`:void 0;o.push(T.length?R(`${b.repo} is protected`,`${T.join("; ")}. Run tapster add in a clone of ${b.repo}.`):B(`${b.repo} is protected`,P))}let k=(await qe(e,`/repos/${b.repo}/actions/secrets?per_page=100`,"secrets")).map((T)=>T.name).filter((T)=>/^(HOMEBREW_TAP_|MACOS_)/.test(T));o.push(k.length?R(`${b.repo} holds no release secrets`,`Delete ${k.join(", ")}: gh secret delete <name> --repo ${b.repo}`):B(`${b.repo} holds no release secrets`))}return o}async function JE(e,t,r){let s=(await e.json("GET",`/repos/${t}/environments/tapster/variables`).catch(()=>null))?.variables.find((o)=>o.name==="TAPSTER_APP_SLUG")?.value;if(!s||r.length===0)return null;return`note the App must be installed on ${r.join(", ")} and not on ${t}; GitHub shows its repositories only to the App itself, so check them at https://github.com/apps/${s}/installations/new (the hub's check job also reports both)`}function QE(e,t){if(e===null)return{checks:[R("tapster.yml is valid","Run tapster init.")],config:null};try{let{config:r,invalid:n}=bt(e,t);if(n.length===0)return{checks:[B("tapster.yml is valid")],config:r};return{checks:n.map((s)=>R(`${s.name} in tapster.yml is valid`,`${s.reason}. ${s.fix}`)),config:r}}catch(r){return{checks:[R("tapster.yml is valid",r instanceof y?`${r.reason}. ${r.fix}`:"Run tapster init.")],config:null}}}async function XE(e,t){let r=(await qe(e,`/repos/${t}/contents/.github/workflows?ref=main`)).filter((s)=>s.type==="file").map((s)=>s.name),n={};for(let s of r)n[s]=await aa(e,t,`.github/workflows/${s}`,"main")??"";return{config:await aa(e,t,"tapster.yml","main"),flows:n}}async function Fm(e){let t=await Kt(process.cwd()),r=t.split("/")[0],n=await Bt();console.log(`Checking ${t} as it is on GitHub's main branch.`);let s=await XE(n,t),o=[],i=QE(s.config,r),a=i.config;o.push(...i.checks);let c=s.flows["tapster.yml"];if(c)o.push(LE(c),KE(c,nt));else o.push(R("the hub workflow exists","Run tapster init, commit and push."));let{"tapster.yml":u,...l}=s.flows;o.push(DE(l)),o.push(...await YE(n,t,r,a,c??""));for(let p of o)if(console.log(p.ok?`ok ${p.name}`:`fix ${p.name}
972
+ ${p.fix}`),p.note)console.log(` note: ${p.note}`);let f=await JE(n,t,a?.packages.map((p)=>p.repo)??[]);if(f)console.log(f);return o.every((p)=>p.ok)?0:1}var eT=`tapster: publish your projects' releases from one Homebrew tap
973
+
974
+ tapster init set up this hub clone; run it again to finish or repair the setup
975
+ tapster add prepare this project clone and propose it to the hub
976
+ tapster doctor check the hub's setup and name the fix for each finding
977
+ tapster --version show this tapster and the commit it pins hubs to
978
+
979
+ Run tapster <command> --help for the options: Sparkle and Linux keys, the doorbell, rotations and more.`,Gm={init:`tapster init: set up the hub in this clone; every step can run again and skips what is done
980
+
981
+ tapster init [--every <minutes>] [--tapster <commit>]
982
+ tapster init --rotate app|certificate|notary|doorbell|linux
983
+ tapster init --rotate linux --finish stop signing with the previous Linux key
984
+ tapster init --sparkle <label> [--account <account>]
985
+ store a Sparkle key from your keychain in the hub
986
+ tapster init --sparkle <label> --new
987
+ make a Sparkle key, keep it in your keychain and store it in the hub
988
+ tapster init --doorbell deploy the Worker that starts the hub when a project releases
989
+ tapster init --linux make the key for the apt and dnf repositories
990
+ tapster init --workflow [--every <minutes>] [--tapster <commit>]
991
+ rewrite the hub workflow, pinned to this tapster`,add:`tapster add: prepare this project clone and propose it to the hub
992
+
993
+ tapster add [--hub owner/repo] [--workflow file.yml] [--auto-tag] [--allow-dependabot] [--force]
994
+ --hub the hub that publishes this project (remembered in git config)
995
+ --workflow the workflow that runs GoReleaser, if not release.yml
996
+ --auto-tag let the project's release workflow push tags with a deploy key
997
+ --allow-dependabot leave branches named dependabot/... open so Dependabot can open pull requests
998
+ --force replace an existing release workflow`,doctor:`tapster doctor: check the hub's setup on GitHub and name the command that fixes each finding
999
+
1000
+ tapster doctor`},[_e,...St]=process.argv.slice(2);try{if(_e==="--version"||_e==="-v")console.log(`tapster ${nt.version} (${nt.sha?nt.sha.slice(0,12):"built from a checkout; init --workflow needs --tapster <commit>"})`);else if(_e&&Gm[_e]&&(St[0]==="--help"||St[0]==="-h"))console.log(Gm[_e]);else if(_e==="init")await Bm(St);else if(_e==="add")await hm(St);else if(_e==="doctor"){if(St.length)throw new y(`unknown option ${St.join(" ")}`,"tapster doctor takes no options.");process.exitCode=await Fm(St)}else console.log(eT),process.exitCode=_e&&_e!=="help"&&_e!=="--help"?1:0}catch(e){console.error(e instanceof y?`tapster: ${e.reason}
1001
+ ${e.fix}`:"tapster: unexpected error"),process.exitCode=1}